8194985: JavaAdapterBytecodeGenerator passes invalid type descriptor to ASM
authorhannesw
Mon, 15 Jan 2018 11:07:41 +0100
changeset 48494 a65e8281b27c
parent 48493 d53732d23ade
child 48538 82c3d4173a53
8194985: JavaAdapterBytecodeGenerator passes invalid type descriptor to ASM Reviewed-by: sundar, attila
src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java
test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Sat Jan 13 18:33:35 2018 -0500
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon Jan 15 11:07:41 2018 +0100
@@ -1083,7 +1083,7 @@
 
         // Simply invoke super.finalize()
         mv.visitVarInsn(ALOAD, 0);
-        mv.checkcast(Type.getType(generatedClassName));
+        mv.checkcast(Type.getType('L' + generatedClassName + ';'));
         mv.invokespecial(superClassName, "finalize", VOID_METHOD_DESCRIPTOR, false);
 
         mv.visitInsn(RETURN);
--- a/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java	Sat Jan 13 18:33:35 2018 -0500
+++ b/test/nashorn/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java	Mon Jan 15 11:07:41 2018 +0100
@@ -133,7 +133,7 @@
         }
     }
 
-
+    // This also covers overriding finalizer in JavaAdapter such as JDK-8194985
     @Test
     public void securitySystemExitFromFinalizerThread() throws ScriptException {
         if (System.getSecurityManager() == null) {