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

Fix build failure with JDK 9 EA b148 #470

Merged
merged 1 commit into from Dec 15, 2016
Merged

Fix build failure with JDK 9 EA b148 #470

merged 1 commit into from Dec 15, 2016

Conversation

Godin
Copy link
Member

@Godin Godin commented Dec 9, 2016

Failed to execute goal org.codehaus.groovy.maven:gmaven-plugin:1.0:execute (parse-version) on project org.jacoco.build

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make java.lang.String(char[],int,int,java.lang.Void) accessible: module java.base does not "opens java.lang" to unnamed module @603cabc4
	at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
	at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:184)
	at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:177)
	at org.codehaus.groovy.reflection.CachedConstructor.<init>(CachedConstructor.java:32)
	at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:233)
	at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:115)
	at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:102)
	at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:92)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getGlobalMetaClass(MetaClassRegistryImpl.java:252)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.access$100(MetaClassRegistryImpl.java:45)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getFromGlobal(MetaClassRegistryImpl.java:112)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$LocallyKnownClasses.getMetaClass(MetaClassRegistryImpl.java:88)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$MyThreadLocal.getMetaClass(MetaClassRegistryImpl.java:361)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:265)
	at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)
	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
	at script1481306263465.run(script1481306263465.groovy:6)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:538)
	at org.codehaus.groovy.maven.runtime.support.ScriptExecutorSupport.invokeMethod(ScriptExecutorSupport.java:158)
	... 26 more

According to https://twitter.com/CedricChampeau/status/807285853580103684 Groovy should be updated to 2.4.8

@Godin Godin self-assigned this Dec 9, 2016
@Godin Godin force-pushed the issue-470 branch 3 times, most recently from 587a943 to 70804ba Compare December 14, 2016 23:39
@Godin Godin added this to the 0.7.9 milestone Dec 14, 2016
@Godin Godin requested a review from marchof December 15, 2016 00:05
@@ -86,6 +86,8 @@ case "$JDK" in
;;
9-ea | 9-ea-stable)
# see https://bugs.openjdk.java.net/browse/JDK-8131041 about "java.locale.providers"
Copy link
Member

Choose a reason for hiding this comment

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

This comment refers to the line below the next line of code. Moving down?

Copy link
Member Author

Choose a reason for hiding this comment

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

@marchof you mean change order of comments? Unfortunately it can't be placed exactly above line or on line to which it refers.

Copy link
Member

Choose a reason for hiding this comment

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

I see. What about concatenating MAVEN_OPTS step-by-step instead of using a long multi-line?

Copy link
Member Author

Choose a reason for hiding this comment

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

@marchof not sure what you mean - one comment is about java.locale.providers that is not part of MAVEN_OPTS. Maybe possible to construct whole command in variable step-by-step, but I'm afraid to run into problem with escaping of quotes. Following suggestion of @bjkail below I'm going to split this command on multiple.

Copy link
Member Author

Choose a reason for hiding this comment

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

In fact will be better to get rid of this java.locale.providers completely, but that's another story and I'll try to handle it separately.

Copy link
Member

Choose a reason for hiding this comment

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

@Godin Something like this:

# Groovy version should be updated to get rid of "--add-opens" options (see https://twitter.com/CedricChampeau/status/807285853580103684)
MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
MAVEN_OPTS=$MAVEN_OPTS mvn -V -B -e verify -Dbytecode.version=1.9
# see https://bugs.openjdk.java.net/browse/JDK-8131041 about "java.locale.providers"
MAVEN_OPTS=$MAVEN_OPTS -DargLine=-Djava.locale.providers=JRE,SPI

Copy link
Member Author

Choose a reason for hiding this comment

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

@marchof I'm not sure that -DargLine can be passed via MAVEN_OPTS - usually last one is used to pass options that control Maven JVM, while -D is argument to Maven invocation

Copy link
Member Author

Choose a reason for hiding this comment

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

@marchof ouch, and what you wrote isn't gonna work as is, and looks like attempt to construct the whole command in variable.

Anyway command has been divided on two, where comments are above of respective parts - see updated commit. Seems quite acceptable to me given that actually all this should be gone eventually.

Copy link
Member

@marchof marchof left a comment

Choose a reason for hiding this comment

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

@Godin Didn't we talk about removing at at all? Otherwise we should document the required JVM options in URLStreamHandlerRuntime JavaDoc.

@Godin
Copy link
Member Author

Godin commented Dec 15, 2016

@marchof Well, there is separate ticket about removal - #471 , which anyway requires change in documentation - see page about implementation details, and IMO it will be nice to preserve information about it on this page.

Also for instrumentation with companion classes reflection seems mandatory, so maybe we'll update code of agent to allow reflection. And since there is --add-opens option in JDK 9 I wasn't entirely sure about removal. However sure that we'd better fix build failure to ease process of testing of further JDK 9 EA builds.

WDYT?

@@ -86,6 +86,8 @@ case "$JDK" in
;;
9-ea | 9-ea-stable)
# see https://bugs.openjdk.java.net/browse/JDK-8131041 about "java.locale.providers"
# Groovy version should be updated to get rid of "--add-opens" options (see https://twitter.com/CedricChampeau/status/807285853580103684)
MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED" \
mvn -V -B -e verify -Dbytecode.version=1.9 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor, but perhaps indent the mvn line? The trailing \ on the MAVEN_OPTS line can be difficult to spot.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bjkail indeed, done

@marchof
Copy link
Member

marchof commented Dec 15, 2016

@Godin I'm ok with this fix to make the latest JDK 9 EA work again.

@marchof marchof merged commit 2bc56b2 into master Dec 15, 2016
@marchof marchof deleted the issue-470 branch December 15, 2016 20:22
@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
@marchof marchof moved this from TODO to DONE in Java 9 May 7, 2017
@marchof marchof moved this from DONE to TODO in Java 9 May 7, 2017
@Godin Godin moved this from TODO to DONE in Java 9 Jul 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants