JDK-8011888 : sa.js: TypeError: [object JSAdapter] has no such function "__has__"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: hs25,8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-04-10
  • Updated: 2013-09-11
  • Resolved: 2013-08-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 Other
8 b106Fixed hs25Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
sa intermittently throw 'javax.script.ScriptException: TypeError: [object JSAdapter] has no such function "__has__" in sa.js at line number 150' during attaching to core

way to reproduce:
0. generate core-file, e.g.:
  java -XX:ErrorHandlerTest=1'
1. try to attach:
   ${JAVA_HOME}/bin/java -cp ${JAVA_HOME}/lib/sa-jdi.jar  sun.jvm.hotspot.CLHSDB ${JAVA_HOME}/bin/java ${CORE}

output:
Opening core file, please wait...
javax.script.ScriptException: SyntaxError: sa.js#752<eval>:1:23 Expected ( but found :
function readHeapBlock_:Header(addr) {   return readVMType('HeapBlock_:Header', addr);}
                       ^ in sa.js at line number 752
javax.script.ScriptException: SyntaxError: sa.js#752<eval>:1:23 Expected ( but found :
function readHeapBlock_:Header(addr) {   return readVMType('HeapBlock_:Header', addr);}
                       ^ in sa.js at line number 752
Exception in thread "main" java.lang.RuntimeException: javax.script.ScriptException: TypeError: [object JSAdapter] has no such function "__has__" in sa.js at line number 150
        at sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine.call(JSJavaScriptEngine.java:82)
        at sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine.start(JSJavaScriptEngine.java:434)
        at sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine.start(JSJavaScriptEngine.java:61)
        at sun.jvm.hotspot.CommandProcessor.postAttach(CommandProcessor.java:1739)
        at sun.jvm.hotspot.CommandProcessor.<init>(CommandProcessor.java:1777)
        at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:90)
        at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35)
Caused by: javax.script.ScriptException: TypeError: [object JSAdapter] has no such function "__has__" in sa.js at line number 150
        at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:421)
        at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:369)
        at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:170)
        at sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine.call(JSJavaScriptEngine.java:78)
        ... 6 more
Caused by: sa.js:150 TypeError: [object JSAdapter] has no such function "__has__"
        at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:66)
        at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:222)
        at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:194)
        at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:181)
        at jdk.nashorn.internal.objects.NativeJSAdapter.findGetMethod(NativeJSAdapter.java:629)
        at jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1603)
        at jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:76)
        at jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:176)
        at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
        at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:138)
        at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:229)
        at jdk.nashorn.internal.scripts.Script$sa.main$wrapScriptObject$_L149(sa.js:150)
        at jdk.nashorn.internal.scripts.Script$sa.main(sa.js:193)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:514)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:205)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:345)
        at jdk.nashorn.internal.runtime.ScriptRuntime.checkAndApply(ScriptRuntime.java:330)
        at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:367)
        ... 8 more

Comments
Christian - could you take a look at the webrev here (http://cr.openjdk.java.net/~allwin/8011888/webrev.00/) which addresses the issues in this bug plus a few others: - javascript Array need explicit conversion to java.lang.Object[] - println calls have been removed as function is not present in Nashorn - "SyntaxError: sa.js#752<eval>:1:23 Expected ( but found" fixed by using global regex replace flag
23-07-2013

Is someone actively working on this? We need a fix so we can investigate a compiler bug.
22-07-2013

Yes this is a difference in Nashorn vs. Rhino. I've contacted the Nashorn people to get some feedback on what should be the expected behavior.
18-04-2013

Peter, is this not similar to a bug you worked on, where the switch to nashorn wrecked havoc?
15-04-2013

ILW = MMH => P3
12-04-2013