-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java runtime: add module-info.java and multi-release build to support… #4137
base: master
Are you sure you want to change the base?
java runtime: add module-info.java and multi-release build to support… #4137
Conversation
i think we're stuck at jdk 8 for now... |
That's ok, the runtime will continue to work under java 8. module-info.java will only be visible on java 9+ - see https://openjdk.org/jeps/238 |
… java modules on java 9+ Signed-off-by: Alexander Berdnik <[email protected]>
Signed-off-by: Alexander Berdnik <[email protected]>
5c55eef
to
fc83811
Compare
Signed-off-by: Alexander Berdnik <[email protected]>
I just noticed that antlr4-maven-plugin requires java 11+, otherwise I'm getting wrong class version error... I tested locally with these code (sample json parser): final JSONLexer lexer = new JSONLexer(CharStreams.fromString(json));
final JSONParser parser = new JSONParser(new CommonTokenStream(lexer));
final JSONParser.JsonContext ctx = parser.json();
System.out.println(ctx.toStringTree()); ... and the snapshot version of the runtime (one with module-info.java) So to sum-up:
|
I think I might have duplicated this one #4383 But in that PR, small difference is that I don't think Java 9 is required to build, so the JDK wouldn't need to be changed anywhere. |
I'm not sure moditect works without java 9 - you need to compile module-info.java somehow and java 8 compiler just can't do it. |
This PR fixes #2946 by adding module-info.java to antlr-runtime module of the project. This is done as "multi-release jar" which allows to specify multiple versions of classes for different java versions. In this case the module is compiled for java 8 with java 9 classes stored in META-INF/versions/9.
Module-info.java exports module named
org.antlr.antlr.runtime
. This differs from the original automatic-module-name (org.antlr.antlr4.runtime
) because JPMS doesn't like trailing digits in names.Module exports all packages except
org.antlr.v4.runtime.tree.pattern
andorg.antlr.v4.runtime.tree.xpath
. Please let me know if these are used outside the module and should be included as well.