JDK-8073644 : Assertion in LambdaFormEditor.bindArgumentType is too strict
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 9
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-02-23
  • Updated: 2017-08-24
  • Resolved: 2015-02-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 JDK 9
8u72Fixed 9 b54Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
With the tip build of jdk9-dev forest, nashorn's "ant clean test" fails. One of the failures shows the following stack trace:


   [testng] Exception in thread "main" java.lang.AssertionError
   [testng] 	at java.lang.invoke.LambdaFormEditor.bindArgumentType(LambdaFormEditor.java:439)
   [testng] 	at java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:402)
   [testng] 	at java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:97)
   [testng] 	at java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1275)
   [testng] 	at jdk.nashorn.internal.lookup.MethodHandleFactory$StandardMethodHandleFunctionality.bindTo(MethodHandleFactory.java:424)
   [testng] 	at jdk.nashorn.internal.runtime.AccessorProperty.bindTo(AccessorProperty.java:380)
   [testng] 	at jdk.nashorn.internal.runtime.AccessorProperty.<init>(AccessorProperty.java:163)
   [testng] 	at jdk.nashorn.internal.runtime.PropertyMap.addPropertyBind(PropertyMap.java:354)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptObject.addBoundProperty(ScriptObject.java:334)
   [testng] 	at jdk.nashorn.internal.objects.Global.addBoundProperties(Global.java:1762)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptObject.addBoundProperties(ScriptObject.java:296)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptRuntime.mergeScope(ScriptRuntime.java:372)
   [testng] 	at jdk.nashorn.internal.scripts.Script$608$zlib_data.:program(file:/Users/sundar/src/jdk9-dev/nashorn/test/script/basic/../external/octane/zlib-data.js)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:388)
   [testng] 	at jdk.nashorn.internal.runtime.Context.evaluateSource(Context.java:1151)
   [testng] 	at jdk.nashorn.internal.runtime.Context.load(Context.java:800)
   [testng] 	at jdk.nashorn.internal.objects.Global.load(Global.java:996)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:658)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:388)
   [testng] 	at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:115)
   [testng] 	at jdk.nashorn.internal.scripts.Script$2$compile_octane.:program(file:/Users/sundar/src/jdk9-dev/nashorn/test/script/basic/compile-octane.js:135)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:388)
   [testng] 	at jdk.nashorn.internal.runtime.Context.evaluateSource(Context.java:1151)
   [testng] 	at jdk.nashorn.internal.runtime.Context.load(Context.java:800)
   [testng] 	at jdk.nashorn.internal.runtime.Context.loadWithNewGlobal(Context.java:842)
   [testng] 	at jdk.nashorn.internal.objects.Global.loadWithNewGlobal(Global.java:1016)
   [testng] 	at jdk.nashorn.internal.scripts.Script$1$compile_octane_normal.:program(test/script/basic/compile-octane-normal.js:42)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:636)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:229)
   [testng] 	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:388)
   [testng] 	at jdk.nashorn.tools.Shell.apply(Shell.java:394)
   [testng] 	at jdk.nashorn.tools.Shell.runScripts(Shell.java:323)
   [testng] 	at jdk.nashorn.tools.Shell.run(Shell.java:169)
   [testng] 	at jdk.nashorn.tools.Shell.main(Shell.java:133)
   [testng] 	at jdk.nashorn.tools.Shell.main(Shell.java:112)
   [testng] 


Note that the same nashorn repo's "ant clean test" passes with jdk8 update 31 on Mac as well as jdk8 update 40 early access build (32 bit) on Ubuntu. So, this is definitely a j.l.invoke change that causes this.

There are other tests that fail with the same AssertionError as well.

This is P1 because this issue prevents Nashorn nightly run as well as developer testing of nashorn with jdk9-dev forest build.

Comments
This problem exists in jdk8u-dev repo. Needs to be backported to jdk8u-dev repo.
01-09-2015

Suggested fix: diff --git a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java --- a/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java +++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java @@ -436,7 +436,7 @@ } private MethodType bindArgumentType(BoundMethodHandle mh, int pos, BasicType bt) { - assert(mh.form == lambdaForm); + assert(mh.form.uncustomize() == lambdaForm); assert(mh.form.names[1+pos].type == bt); assert(BasicType.basicType(mh.type().parameterType(pos)) == bt); return mh.type().dropParameterTypes(pos, pos+1);
26-02-2015

ILW=Assert, several tests, none=HMH=P1
24-02-2015

Attachment "emailable-report.html" is TestNG failure report for nashorn test run.
23-02-2015

[testng] Total tests run: 1348, Failures: 247, Skips: 8 [testng] Configuration Failures: 1, Skips: 1 From "ant clean test" on Mac with jdk9-dev forest build set as JAVA_HOME. All stack traces of failing test look very similar - failing that assert @ LambdaFormEditor.bindArgumentType.
23-02-2015