question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let's Talk: Java Modules

See original GitHub issue

This issue is intended for discussion related to the Java module system that was implemented in Java 9 as part of project Jigsaw.

If implemented in a way that would allow this functionality in Java 9 or greater while maintaining backwards compatibility with Java 8 should be fairly easy, but it will create issues if a backwards compatibility system of sorts is not put in place. If a developer creates a mod and only tests against Java 8 and does not specify any module metadata for Java 9+ it would have to be put into the “Unamed module”.

For what I would consider a proper “backwards compatibility” needs the following:

  • A way to read the module metadata (module-info.java) in mods
  • A basic implementation to prevent package collisions, that violates the module system
  • You don’t need to prevent reflective access across “modules”, but would be nice (Modules can allow reflective access with the opens keyword)
  • Limited access across modules might not be possible, would be nice

Then the actual module loader implementation would require the following:

  • A way to merge the conflicting Minecraft libraries, primarily the logger and Paule’s Audio
  • A module definition for all of the included libraries plus Minecraft itself, my toy implementations based this off of the module name in the library manifest

If this is implemented properly it would allow more flexibility with libraries and prevent reflection hacking from occurring. This prevents many issues with code accessing things that they should not, and can entirely hide internals of libraries if the need arises. It also makes it so all public fields, methods and types have to be explicitly exported. Makes it a little harder to leak info from implementations.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
Pannoniaecommented, Dec 20, 2018

Are you kinda obsessed with security? Please don’t forget that we are modding a game… where you are talking about “hiding internals” or whatever. Are you sure this is the right direction? Malware often occurs for rehosted mods; and this only causes headache to everyone.

1reaction
NeumimTocommented, Jan 3, 2019

The only reason why would you want to use java module system in a game server is to be able to use jingsaw and minimalize size of jre installed on the host machine.

Minecraft is not some complex system made out of several microservices.

“hidding internals” if you are obessed with this why dont you rather focus on creating such api that will allow to modify X without breaking Z. Same goes for reflection access.

Java modules are a powerful tool, but completly useless for mc environment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Java 9 Modules
In this article, I introduce the Java 9 Platform Module System (JPMS), the most important new software engineering technology in Java since its...
Read more >
Java 9 Modules
In this section, we will discuss “Why we need Java SE 9 Module System” that means the problems of Current Java System. Java...
Read more >
Java 9+ modularity: Module basics and rules
Now, let's meet the new first-class citizen of the Java language, ... Now we are going to discuss two more important concepts of...
Read more >
A Guide to Java 9 Modularity
Learn the essentials of building and using modules in Java 9. ... In this tutorial, we'll go through the new system and discuss...
Read more >
Deep dive into Java Modules
Now, let's talk about the module directive in brief, these directives are essentially the restricted keywords and used with module decalaration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found