Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Tycho 2.1.0 cannot run tests with Java 1.8 anymore. Bug?

Hi

Java 8 is dead as far as significant parts of Eclipse are now concerned. Java 11 is pretty much mandatory UI-wise though you can still test for Java 8 or even Java 5 standalone.

You may find https://bugs.eclipse.org/bugs/show_bug.cgi?id=569379 provides some helpful clues after I attempted a similar migration.

    Regards

        Ed Willink

On 14/04/2021 14:42, Andreas Sewe wrote:
Hi,

I am currently updating from Tycho 2.0.0 to 2.1.0. Well, actually I want
to update to 2.3.0 but the build breaks somewhere between 2.0.0 and 2.1.0.

I use toolchains to build my plug-in against different Eclipse versions,
ranging all from Eclipse Luna to Eclipse 2021-03. My own
Bundle-RequiredExecutionEnvironment is always JavaSE-1.8,
maven.compiler.source|target are 1.8, and I even use the
maven-enforcer-plugin's <enforceBytecodeVersion> rule to check that my
own JAR doesn't contain any bytecode that won't run on a Java 1.8 JRE.

Unfortunately, tests that ran previously just fine with Java 1.8 in a
target platform based on Eclipse 2020-06 (the last Eclipse still
supporting Java 1.8) now fail with this error message:

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.ClassNotFoundException: org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
	at org.apache.maven.surefire.util.ReflectionUtils.loadClass(ReflectionUtils.java:249)
	at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:133)
	at org.apache.maven.surefire.booter.SurefireReflector.instantiateProvider(SurefireReflector.java:265)
	at org.apache.maven.surefire.booter.ProviderFactory.createProvider(ProviderFactory.java:118)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:83)
	at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:114)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4928)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4449)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1158)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1047)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:27)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:120)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:33)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1420)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
	at org.eclipse.tycho.surefire.osgibooter.CombinedClassLoader.findClass(CombinedClassLoader.java:37)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
	at org.apache.maven.surefire.util.ReflectionUtils.loadClass(ReflectionUtils.java:241)
	... 35 more
I suspect that the root cause is a class file with major verison 55 (aka
Java 11) which cannot be loaded by the forked Java 1.8 JVM used to run
the tests:

[INFO] --- tycho-surefire-plugin:2.1.0:test (default-test) @
com.teamscale.ide.eclipse.tests ---
[INFO] Toolchain in tycho-surefire-plugin: JDK[/usr/lib/jvm/zulu-8-amd64]

I know that Tycho 2.1.0 itself requires Java 11, but would have hoped
that this does not apply to its test runtime, as sanity checking your
plugin against less modern target platforms seems to be a valid use case.

Now, as far as I can see, the
org.eclipse.tycho:org.eclipse.tycho.surefire.junit5:2.1.0 artifact
containing org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
only contains Java 1.8 compatible classes:

javap/grep/sort/uniq magic:
      2   major version: 49
     18   major version: 50
    220   major version: 52
Likewise for org.eclipse.tycho.surefire.osgibooter-2.1.0.jar:
     12   major version: 49
So I suspect there are some other "test runtime" classes not compatible
with Java 1.8. (BTW, the JUnit version itself, 5.6.0, is that same as
before the Tycho update and compatible with Java 1.8.)

Any ideas?

IMHO, it should still be possible to use Tycho 2.1.0 or later to execute
tests with Java 1.8, even if the rest of Tycho requires Java 11.

Best wishes,

Andreas Sewe


_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/tycho-user

Virus-free. www.avast.com

Back to the top