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

Upgrade Mockito to 2.25.0 for Java 11 compatibility #647

Merged
merged 1 commit into from
Mar 13, 2019

Conversation

wborn
Copy link
Member

@wborn wborn commented Mar 12, 2019

Currently the first exceptions that occur in a Java 11 build are due to Mockito/Byte Buddy being incompatible with Java 11:

Mockito cannot mock this class: interface java.lang.Runnable.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.


Java               : 11
JVM vendor name    : Oracle Corporation
JVM vendor version : 11.0.1+13
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 11.0.1+13
JVM info           : mixed mode
OS name            : Linux
OS version         : 4.15.0-1026-gcp


Underlying exception : java.lang.UnsupportedOperationException: Cannot define class using reflection
	at org.eclipse.smarthome.test.java.JavaTestTest.waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds(JavaTestTest.java:38)
Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection
	at org.eclipse.smarthome.test.java.JavaTestTest.waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds(JavaTestTest.java:38)
Caused by: java.lang.IllegalStateException: Could not find sun.misc.Unsafe
	at org.eclipse.smarthome.test.java.JavaTestTest.waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds(JavaTestTest.java:38)
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)
	at org.eclipse.smarthome.test.java.JavaTestTest.waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds(JavaTestTest.java:38)

After upgrading Mockito these exceptions are resolved. The stacktraces then show that next Xtext needs to be upgraded to 2.17 (#646) to make the Java 11 build more successful.

We'll also need to update the itests dependencies in openhab2-addons.

@cweitkamp cweitkamp requested a review from davidgraeff March 13, 2019 07:08
@maggu2810
Copy link
Contributor

@wborn Will you update the addons integration tests as soon as I press the button?

@wborn
Copy link
Member Author

wborn commented Mar 13, 2019

I already did it before you pushed the button. 😉

See: https://github.com/openhab/openhab2-addons/pull/5102

@maggu2810 maggu2810 merged commit 56a5c15 into openhab:master Mar 13, 2019
@wborn wborn deleted the upgrade-mockito branch March 13, 2019 12:40
@wborn wborn mentioned this pull request Mar 13, 2019
@wborn wborn added this to the 2.5 milestone Jul 30, 2019
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 11, 2023
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.

2 participants