[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Eclipse won't work on > JDK9b61 unless default classloader hiearchy is changed

As of http://download.eclipse.org/eclipse/downloads/drops4/I20150511-2130/ Eclipse starts again using the latest JRE 9.

Dani



From:        Tom Schindl <tom.schindl@xxxxxxxxxxxxxxx>
To:        equinox-dev@xxxxxxxxxxx
Date:        07.05.2015 22:23
Subject:        Re: [equinox-dev] Eclipse won't work on > JDK9b61 unless default classloader hiearchy is changed
Sent by:        equinox-dev-bounces@xxxxxxxxxxx




Hi,

[...]
> But you mention that using the boot class loader as the parent class
> loader for bundle class loaders causes problems for Nashorn.  I fail to
> see why that is.  


I don't know the inner details but if you run this app

> package samplenashornosgi;
>
> import javax.script.ScriptEngine;
> import javax.script.ScriptEngineManager;
>
> import org.eclipse.equinox.app.IApplication;
> import org.eclipse.equinox.app.IApplicationContext;
>
> public class Application implements IApplication {
>                  public static class SampleObject {
>                                   public SampleObject() {
>                                                    System.err.println("I am: " + this);
>                                   }
>                  }
>                  public Object start(IApplicationContext context) throws Exception {
>                                   System.out.println("Hello RCP World!");
>                                  
>                                   ScriptEngineManager mgr = new ScriptEngineManager();
>                                   ScriptEngine engine = mgr.getEngineByName("nashorn");
>                                   engine.eval("var SimpleObject = Java.type('samplenashornosgi.Application.SampleObject'); new SimpleObject();");
>                                   engine.eval("var SimpleObject = Java.type('samplenashornosgi.Application.SampleObject'); var SimpleSubClass = Java.extend(SimpleObject); new SimpleSubClass() {};");
>
>                                   return IApplication.EXIT_OK;
>                  }
>
>                  public void stop() {
>                                   // nothing to do
>                  }
> }

With the default setting you get:

> Hello RCP World!
> I am: samplenashornosgi.Application$SampleObject@2f8dad04
> !SESSION 2015-05-07 22:13:46.840 -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.8.0_60-ea
> java.vendor=Oracle Corporation
> BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
> Framework arguments:  -application SampleNashornOSGi.application
> Command-line arguments:  -application SampleNashornOSGi.application -data /Users/tomschindl/Documents/e-workspaces/efxclipse-ide/../runtime-SampleNashornOSGi.application -dev file:/Users/tomschindl/Documents/e-workspaces/efxclipse-ide/.metadata/.plugins/org.eclipse.pde.core/SampleNashornOSGi.application/dev.properties -os macosx -ws cocoa -arch x86_64 -consoleLog
>
> !ENTRY org.eclipse.osgi 4 0 2015-05-07 22:13:47.804
> !MESSAGE Application error
> !STACK 1
> javax.script.ScriptException: TypeError: Can not find a common class loader for ScriptObject and samplenashornosgi.Application.SampleObject. in <eval> at line number 1
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:458)
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:442)
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:404)
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:400)
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
>                  at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
>                  at samplenashornosgi.Application.start(Application.java:24)
>                  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
>                  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
>                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
>                  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
>                  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:497)
>                  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
>                  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
>                  at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
>                  at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
> Caused by: <eval>:1 TypeError: Can not find a common class loader for ScriptObject and samplenashornosgi.Application.SampleObject.
>                  at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
>                  at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
>                  at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
>                  at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
>                  at jdk.nashorn.internal.runtime.linker.AdaptationResult.typeError(AdaptationResult.java:70)
>                  at jdk.nashorn.internal.runtime.linker.JavaAdapterFactory$AdapterInfo.getAdapterClass(JavaAdapterFactory.java:280)
>                  at jdk.nashorn.internal.runtime.linker.JavaAdapterFactory.getAdapterClassFor(JavaAdapterFactory.java:131)
>                  at jdk.nashorn.internal.runtime.linker.JavaAdapterFactory.getAdapterClassFor(JavaAdapterFactory.java:117)
>                  at jdk.nashorn.internal.objects.NativeJava.extend(NativeJava.java:634)
>                  at jdk.nashorn.internal.scripts.Script$1$\^eval\_.:program(<eval>:1)
>                  at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
>                  at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
>                  at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
>                  at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:440)
>                  ... 18 more
> An error has occurred. See the log file
> /Users/tomschindl/Documents/e-workspaces/efxclipse-ide/.metadata/.plugins/org.eclipse.pde.core/SampleNashornOSGi.application/1431029626947.log.

if you run with ext:
> Hello RCP World!
> I am: samplenashornosgi.Application$SampleObject@be35cd9
> I am: samplenashornosgi.Application$SampleObject$$NashornJavaAdapter@505fc5a4

As you can see the problem only happens when you try to subclass a
Java-Class in Nashorn.

Tom

--
Thomas Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
http://www.bestsolution.at/
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/equinox-dev