Skip to content
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

#53 Add option to specify JVM version for add-module-info. Fixes #53 #54

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

beikov
Copy link
Contributor

@beikov beikov commented Apr 20, 2018

Fixes #53

Copy link
Member

@gunnarmorling gunnarmorling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beikov LGTM overall, thanks a lot! Just one remark inline. And could you also add a description of the new option to the goal's section in README.md (which is the authorative documentation for ModiTect for the time being)?

Manifest manifest = new Manifest();
manifest.getMainAttributes().put( Attributes.Name.MANIFEST_VERSION, "1.0" );
if ( mrJar ) {
manifest.getMainAttributes().put( Attributes.Name.MULTI_RELEASE, "true" );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this attribute to amended JARs (if not present yet) also in the actual Maven goal, if jvmVersion is given?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean. Could you please be more specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we can't always add this attribute because of https://bugs.openjdk.java.net/browse/JDK-8193802

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is, is this attribute needed for a JAR to be properly recognized as MR JAR? Or will the JVM also load class files from META-INF/versions/... if that attribute is not present?

About the referenced JDK bug, I'm not quite clear what is triggering it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JVM needs this attribute to be set, otherwise classes located in META-INF/versions aren't considered. If there is no content in META-INF/versions and the attribute is set, Java 9 and 10 JVMs will throw the NPE described in the issue when reading such a JAR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the add-module-info goal should set the attribute then if the jvmVersion is given and the patched JAR hasn't been an MR JAR before.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll add that in a second.

@beikov
Copy link
Contributor Author

beikov commented Apr 24, 2018

The AddModuleInfo now marks the JAR as Multi-Release JAR if a specific jvm version is selected. I also added documentation about that configuration element.

@gunnarmorling gunnarmorling merged commit 3a2bb33 into moditect:master Apr 24, 2018
@gunnarmorling
Copy link
Member

Excellent; rebased and applied. Thanks, @beikov! I'll try and do another Beta release later this week.

@beikov
Copy link
Contributor Author

beikov commented Apr 24, 2018

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants