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

Embedded version of Byte Buddy fails to recognize Java 10 #177

Closed
don-vip opened this issue Nov 3, 2017 · 5 comments
Closed

Embedded version of Byte Buddy fails to recognize Java 10 #177

don-vip opened this issue Nov 3, 2017 · 5 comments
Labels

Comments

@don-vip
Copy link
Contributor

don-vip commented Nov 3, 2017

What steps will reproduce the problem?

Run code with a project compiled with Java 10 EA build.

What is the code that triggers this problem?

Anything. All our tests using equalsverifier (53) are failing.

What error message or stack trace does EqualsVerifier give?

junit.framework.AssertionFailedError: UnsupportedOperationException: Cannot define class using reflection
	at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:384)
	at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:373)
	at org.openstreetmap.josm.actions.CombineWayActionTest.testEqualsContract(CombineWayActionTest.java:69)
	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 org.openstreetmap.josm.testutils.JOSMTestRules$TimeoutThread.run(JOSMTestRules.java:504)
Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$Unavailable.defineClass(ClassInjector.java:821)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.inject(ClassInjector.java:185)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:187)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.TypeResolutionStrategy$Passive.initialize(TypeResolutionStrategy.java:79)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.DynamicType$Default$Unloaded.load(DynamicType.java:4376)
	at nl.jqno.equalsverifier.internal.reflection.Instantiator.giveDynamicSubclass(Instantiator.java:103)
	at nl.jqno.equalsverifier.internal.reflection.Instantiator.instantiateAnonymousSubclass(Instantiator.java:87)
	at nl.jqno.equalsverifier.internal.reflection.ObjectAccessor.copyIntoAnonymousSubclass(ObjectAccessor.java:126)
	at nl.jqno.equalsverifier.internal.checkers.HierarchyChecker.checkSubclass(HierarchyChecker.java:137)
	at nl.jqno.equalsverifier.internal.checkers.HierarchyChecker.check(HierarchyChecker.java:61)
	at nl.jqno.equalsverifier.EqualsVerifier.verifyWithExamples(EqualsVerifier.java:434)
	at nl.jqno.equalsverifier.EqualsVerifier.performVerification(EqualsVerifier.java:396)
	at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:367)
Caused by: java.lang.IllegalArgumentException: Unknown Java version: 10
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion.ofJavaVersion(ClassFileVersion.java:135)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion$VersionLocator$ForJava9CapableVm.locate(ClassFileVersion.java:337)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion.ofThisVm(ClassFileVersion.java:147)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:301)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassInjector$UsingReflection$Dispatcher$CreationAction.run(ClassInjector.java:290)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.<clinit>(ClassInjector.java:70)
	at nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.loading.ClassLoadingStrategy$Default$InjectionDispatcher.load(ClassLoadingStrategy.java:184)

What did you expect?

Same behaviour as Java 9.

Which version of EqualsVerifier are you using?

2.3.3

Please provide any additional information below.

Embedded version of Byte Buddy is not up to date but I don't see any commit related to Java 10 yet, so probably we must ask to @raphw a new version :)

@jqno
Copy link
Owner

jqno commented Nov 3, 2017

I suppose we must, although some of my other dependencies may need to upgrade as well; I'm not sure. It may not just be Byte Buddy.

In the mean time, I'm still wrapping my head around Java 9 ;).

@don-vip
Copy link
Contributor Author

don-vip commented Nov 3, 2017

simon04 pushed a commit to JOSM/josm that referenced this issue Nov 4, 2017
floscher pushed a commit to floscher/josm that referenced this issue Nov 5, 2017
@raphw
Copy link

raphw commented Nov 6, 2017

Is already fixed on master. Update version will come out some time this week.

@jqno
Copy link
Owner

jqno commented Nov 7, 2017

Thanks @raphw for fixing this so quicky in Byte Buddy, and thanks @don-vip for the PRs! I'll try to do a release later this week.

@jqno
Copy link
Owner

jqno commented Nov 11, 2017

I just made a release for this (version 2.4).

akhalikov pushed a commit to akhalikov/equalsverifier that referenced this issue Nov 6, 2019
to add Java 10 compatibility (fix jqno#177)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants