Modify

#13150 closed defect (fixed)

Unit test regressions with jdk9

Reported by: Don-vip Owned by: team
Priority: normal Milestone: 16.07
Component: Unit tests Version:
Keywords: regression gsoc-core java9 Cc: michael2402

Description

18 more tests are failing with java 9:

jenkins/job/Java-EarlyAccess-JOSM/jdk=JDK9/lastCompletedBuild/testReport

Looks like the same stacktrace everywhere:

java.lang.IllegalStateException: Dialog was already created
	at org.openstreetmap.josm.gui.dialogs.LayerListDialog.createInstance(LayerListDialog.java:99)
	at org.openstreetmap.josm.gui.MapFrame.<init>(MapFrame.java:263)
	at org.openstreetmap.josm.gui.MainPanel.createNewMapFrame(MainPanel.java:88)
	at org.openstreetmap.josm.gui.MainPanel.updateContent(MainPanel.java:63)
	at org.openstreetmap.josm.gui.MainPanel$1.beforeFirstLayerAdded(MainPanel.java:157)
	at org.openstreetmap.josm.gui.layer.MainLayerManager.realAddLayer(MainLayerManager.java:268)
	at org.openstreetmap.josm.gui.layer.LayerManager$1.run(LayerManager.java:183)
	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:146)
	at org.openstreetmap.josm.gui.layer.LayerManager.addLayer(LayerManager.java:180)
	at org.openstreetmap.josm.JOSMFixture.setupGUI(JOSMFixture.java:147)
	at org.openstreetmap.josm.JOSMFixture.access$000(JOSMFixture.java:28)
	at org.openstreetmap.josm.JOSMFixture$1.run(JOSMFixture.java:126)
	at java.awt.event.InvocationEvent.dispatch(java.desktop@9-ea/InvocationEvent.java:303)
	at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-ea/EventQueue.java:759)
	at java.awt.EventQueue.access$500(java.desktop@9-ea/EventQueue.java:97)
	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:712)
	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:706)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:77)
	at java.awt.EventQueue.dispatchEvent(java.desktop@9-ea/EventQueue.java:729)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-ea/EventDispatchThread.java:199)
	at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-ea/EventDispatchThread.java:124)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-ea/EventDispatchThread.java:113)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:109)
	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.run(java.desktop@9-ea/EventDispatchThread.java:90)

Attachments (0)

Change History (4)

comment:1 Changed 22 months ago by michael2402

This is not a problem with the tests itself. A previous test was failing and destroyed JOSM internal state.

I'm currently getting this in 54 tests.

The first test that has this problem is org.openstreetmap.josm.actions.JoinAreasActionTest

It is caused by nashorn/jacoco. The test that failed previously was org.openstreetmap.josm.actions.AlignInLineActionTest:

    [junit] Testcase: org.openstreetmap.josm.actions.AlignInLineActionTest:	Caused an ERROR

    [junit] java.lang.reflect.InvocationTargetException

    [junit] CrashReportedException [on thread Thread[main,5,main]]

    [junit] 	at org.openstreetmap.josm.tools.bugreport.BugReport.intercept(BugReport.java:52)

    [junit] 	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:151)

    [junit] 	at org.openstreetmap.josm.JOSMFixture.init(JOSMFixture.java:124)

    [junit] 	at org.openstreetmap.josm.actions.AlignInLineActionTest.setUp(AlignInLineActionTest.java:33)

    [junit] 	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)

    [junit] 	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)

    [junit] 	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)

    [junit] Caused by: java.lang.reflect.InvocationTargetException

    [junit] 	at java.awt.EventQueue.invokeAndWait(java.desktop@9-ea/EventQueue.java:1323)

    [junit] 	at java.awt.EventQueue.invokeAndWait(java.desktop@9-ea/EventQueue.java:1298)

    [junit] 	at javax.swing.SwingUtilities.invokeAndWait(java.desktop@9-ea/SwingUtilities.java:1472)

    [junit] 	at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:149)

    [junit] Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IncompatibleClassChangeError: Method jdk.dynalink.linker.LinkerServices.$jacocoInit()[Z must be InterfaceMethodref constant

    [junit] 	at org.openstreetmap.josm.Main.initialize(Main.java:695)

    [junit] 	at org.openstreetmap.josm.JOSMFixture.setupGUI(JOSMFixture.java:143)

    [junit] 	at org.openstreetmap.josm.JOSMFixture.access$000(JOSMFixture.java:28)

    [junit] 	at org.openstreetmap.josm.JOSMFixture$1.run(JOSMFixture.java:127)

    [junit] 	at java.awt.event.InvocationEvent.dispatch(java.desktop@9-ea/InvocationEvent.java:303)

    [junit] 	at java.awt.EventQueue.dispatchEventImpl(java.desktop@9-ea/EventQueue.java:759)

    [junit] 	at java.awt.EventQueue.access$500(java.desktop@9-ea/EventQueue.java:97)

    [junit] 	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:712)

    [junit] 	at java.awt.EventQueue$3.run(java.desktop@9-ea/EventQueue.java:706)

    [junit] 	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)

    [junit] 	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(java.base@9-ea/ProtectionDomain.java:77)

    [junit] 	at java.awt.EventQueue.dispatchEvent(java.desktop@9-ea/EventQueue.java:729)

    [junit] 	at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@9-ea/EventDispatchThread.java:199)

    [junit] 	at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@9-ea/EventDispatchThread.java:124)

    [junit] 	at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@9-ea/EventDispatchThread.java:113)

    [junit] 	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:109)

    [junit] 	at java.awt.EventDispatchThread.pumpEvents(java.desktop@9-ea/EventDispatchThread.java:101)

    [junit] 	at java.awt.EventDispatchThread.run(java.desktop@9-ea/EventDispatchThread.java:90)

    [junit] Caused by: java.util.concurrent.ExecutionException: java.lang.IncompatibleClassChangeError: Method jdk.dynalink.linker.LinkerServices.$jacocoInit()[Z must be InterfaceMethodref constant

    [junit] 	at java.util.concurrent.FutureTask.report(java.base@9-ea/FutureTask.java:123)

    [junit] 	at java.util.concurrent.FutureTask.get(java.base@9-ea/FutureTask.java:193)

    [junit] 	at org.openstreetmap.josm.Main.initialize(Main.java:691)

    [junit] Caused by: java.lang.IncompatibleClassChangeError: Method jdk.dynalink.linker.LinkerServices.$jacocoInit()[Z must be InterfaceMethodref constant

    [junit] 	at jdk.dynalink.linker.LinkerServices.asTypeLosslessReturn(jdk.dynalink@9-ea/LinkerServices.java)

    [junit] 	at jdk.dynalink.linker.GuardedInvocation.asTypeSafeReturn(jdk.dynalink@9-ea/GuardedInvocation.java:380)

    [junit] 	at jdk.nashorn.internal.runtime.linker.Bootstrap.asTypeSafeReturn(jdk.scripting.nashorn@9-ea/Bootstrap.java:441)

    [junit] 	at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(jdk.scripting.nashorn@9-ea/NashornLinker.java:96)

    [junit] 	at jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(jdk.dynalink@9-ea/CompositeTypeBasedGuardingDynamicLinker.java:184)

    [junit] 	at jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(jdk.dynalink@9-ea/CompositeGuardingDynamicLinker.java:132)

    [junit] 	at jdk.dynalink.LinkerServicesImpl.lambda$getGuardedInvocation$0(jdk.dynalink@9-ea/LinkerServicesImpl.java:160)

    [junit] 	at jdk.dynalink.LinkerServicesImpl.getWithLookupInternal(jdk.dynalink@9-ea/LinkerServicesImpl.java:191)

    [junit] 	at jdk.dynalink.LinkerServicesImpl.getGuardedInvocation(jdk.dynalink@9-ea/LinkerServicesImpl.java:158)

    [junit] 	at jdk.dynalink.DynamicLinker.relink(jdk.dynalink@9-ea/DynamicLinker.java:265)

    [junit] 	at jdk.nashorn.internal.runtime.UserAccessorProperty.invokeObjectGetter(jdk.scripting.nashorn@9-ea/UserAccessorProperty.java:291)

    [junit] 	at jdk.nashorn.internal.runtime.UserAccessorProperty.getObjectValue(jdk.scripting.nashorn@9-ea/UserAccessorProperty.java:197)

    [junit] 	at jdk.nashorn.internal.runtime.FindProperty.getObjectValue(jdk.scripting.nashorn@9-ea/FindProperty.java:229)

    [junit] 	at jdk.nashorn.internal.runtime.ScriptObject.get(jdk.scripting.nashorn@9-ea/ScriptObject.java:2900)

    [junit] 	at jdk.nashorn.internal.runtime.ScriptObject.get(jdk.scripting.nashorn@9-ea/ScriptObject.java:2917)

    [junit] 	at jdk.nashorn.internal.objects.Global.initFunctionAndObject(jdk.scripting.nashorn@9-ea/Global.java:3021)

    [junit] 	at jdk.nashorn.internal.objects.Global.init(jdk.scripting.nashorn@9-ea/Global.java:2554)

    [junit] 	at jdk.nashorn.internal.objects.Global.initBuiltinObjects(jdk.scripting.nashorn@9-ea/Global.java:1256)

    [junit] 	at jdk.nashorn.internal.runtime.Context.initGlobal(jdk.scripting.nashorn@9-ea/Context.java:1264)

    [junit] 	at jdk.nashorn.api.scripting.NashornScriptEngine.createNashornGlobal(jdk.scripting.nashorn@9-ea/NashornScriptEngine.java:359)

    [junit] 	at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(jdk.scripting.nashorn@9-ea/NashornScriptEngine.java:142)

    [junit] 	at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(jdk.scripting.nashorn@9-ea/NashornScriptEngineFactory.java:147)

    [junit] 	at javax.script.ScriptEngineManager.getEngineByName(java.scripting@9-ea/ScriptEngineManager.java:238)

    [junit] 	at org.openstreetmap.josm.data.validation.tests.OpeningHourTest.<clinit>(OpeningHourTest.java:41)

    [junit] 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-ea/Native Method)

    [junit] 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)

    [junit] 	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base@9-ea/DelegatingConstructorAccessorImpl.java:45)

    [junit] 	at java.lang.reflect.Constructor.newInstance(java.base@9-ea/Constructor.java:453)

    [junit] 	at org.openstreetmap.josm.data.validation.OsmValidator.addTest(OsmValidator.java:139)

    [junit] 	at org.openstreetmap.josm.data.validation.OsmValidator.<clinit>(OsmValidator.java:147)

    [junit] 	at org.openstreetmap.josm.Main$5.initialize(Main.java:659)

    [junit] 	at org.openstreetmap.josm.Main$InitializationTask.call(Main.java:780)

    [junit] 	at org.openstreetmap.josm.Main$InitializationTask.call(Main.java:764)

    [junit] 	at java.util.concurrent.FutureTask.run(java.base@9-ea/FutureTask.java:266)

    [junit] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@9-ea/ThreadPoolExecutor.java:1158)

    [junit] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@9-ea/ThreadPoolExecutor.java:632)

    [junit] 	at java.lang.Thread.run(java.base@9-ea/Thread.java:843)

See #11924

comment:2 Changed 22 months ago by michael2402

A workaround is to add the following excludes:

<jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" excludes="jdk.dynalink.*:jdk.nashorn.*">

We don't need those classes to be tested any way.

This reduced the number of failed tests by 60 for me.

Last edited 22 months ago by michael2402 (previous) (diff)

comment:3 Changed 22 months ago by Don-vip

ok thanks I'll try that :) Can you please report the issue upstream to https://github.com/jacoco/jacoco/issues ?

comment:4 Changed 22 months ago by Don-vip

Resolution: fixed
Status: newclosed

In 10546/josm:

fix #13150, see #11924 - exclude nashorn classes from jacoco coverage to avoid lot of unit test failures (patch by michael2402)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.