8029031: "ant clean jar" on nashorn repo results in number of ASM deprecated warnings
authorsundar
Tue, 26 Nov 2013 18:36:39 +0530
changeset 22368 9cb3e7db27c6
parent 22367 8c17b1979d29
child 22369 4771a8ce9037
8029031: "ant clean jar" on nashorn repo results in number of ASM deprecated warnings Reviewed-by: lagergren, jlaskey, hannesw
nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java
nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java
nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java
nashorn/src/jdk/nashorn/internal/codegen/types/Type.java
nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java	Mon Nov 25 11:13:08 2013 -0400
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/MethodGenerator.java	Tue Nov 26 18:36:39 2013 +0530
@@ -349,19 +349,19 @@
 
     // invokes, field get/sets
     void invokeInterface(final String owner, final String method, final String desc) {
-        super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc);
+        super.visitMethodInsn(INVOKEINTERFACE, owner, method, desc, true);
     }
 
     void invokeVirtual(final String owner, final String method, final String desc) {
-        super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc);
+        super.visitMethodInsn(INVOKEVIRTUAL, owner, method, desc, false);
     }
 
     void invokeSpecial(final String owner, final String method, final String desc) {
-        super.visitMethodInsn(INVOKESPECIAL, owner, method, desc);
+        super.visitMethodInsn(INVOKESPECIAL, owner, method, desc, false);
     }
 
     void invokeStatic(final String owner, final String method, final String desc) {
-        super.visitMethodInsn(INVOKESTATIC, owner, method, desc);
+        super.visitMethodInsn(INVOKESTATIC, owner, method, desc, false);
     }
 
     void putStatic(final String owner, final String field, final String desc) {
@@ -413,7 +413,7 @@
         super.visitMethodInsn(INVOKEVIRTUAL,
                     "java/io/PrintStream",
                     "println",
-                    "(Ljava/lang/String;)V");
+                    "(Ljava/lang/String;)V", false);
     }
 
     // print the object on the top of the stack
@@ -426,6 +426,6 @@
         super.visitMethodInsn(INVOKEVIRTUAL,
                     "java/io/PrintStream",
                     "println",
-                    "(Ljava/lang/Object;)V");
+                    "(Ljava/lang/Object;)V", false);
     }
 }
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Mon Nov 25 11:13:08 2013 -0400
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Tue Nov 26 18:36:39 2013 +0530
@@ -146,16 +146,16 @@
                 // call $clinit$ just before return from <clinit>
                 if (isStaticInit && opcode == RETURN) {
                     super.visitMethodInsn(INVOKESTATIC, scriptClassInfo.getJavaName(),
-                            $CLINIT$, DEFAULT_INIT_DESC);
+                            $CLINIT$, DEFAULT_INIT_DESC, false);
                 }
                 super.visitInsn(opcode);
             }
 
             @Override
-            public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
+            public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, final boolean itf) {
                 if (isConstructor && opcode == INVOKESPECIAL &&
                         INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) {
-                    super.visitMethodInsn(opcode, owner, name, desc);
+                    super.visitMethodInsn(opcode, owner, name, desc, false);
 
                     if (memberCount > 0) {
                         // initialize @Property fields if needed
@@ -166,7 +166,7 @@
                                 super.visitTypeInsn(NEW, clazz);
                                 super.visitInsn(DUP);
                                 super.visitMethodInsn(INVOKESPECIAL, clazz,
-                                    INIT, DEFAULT_INIT_DESC);
+                                    INIT, DEFAULT_INIT_DESC, false);
                                 super.visitFieldInsn(PUTFIELD, scriptClassInfo.getJavaName(),
                                     memInfo.getJavaName(), memInfo.getJavaDesc());
                             }
@@ -180,7 +180,7 @@
                         }
                     }
                 } else {
-                    super.visitMethodInsn(opcode, owner, name, desc);
+                    super.visitMethodInsn(opcode, owner, name, desc, itf);
                 }
             }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Mon Nov 25 11:13:08 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Tue Nov 26 18:36:39 2013 +0530
@@ -1130,7 +1130,11 @@
             popType(Type.OBJECT);
         }
 
-        method.visitMethodInsn(opcode, className, methodName, methodDescriptor);
+        if (opcode == INVOKEINTERFACE) {
+            method.visitMethodInsn(opcode, className, methodName, methodDescriptor, true);
+        } else {
+            method.visitMethodInsn(opcode, className, methodName, methodDescriptor, false);
+        }
 
         if (returnType != null) {
             pushType(returnType);
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Mon Nov 25 11:13:08 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Tue Nov 26 18:36:39 2013 +0530
@@ -261,7 +261,7 @@
     }
 
     static void invokeStatic(final MethodVisitor method, final Call call) {
-        method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor());
+        method.visitMethodInsn(INVOKESTATIC, call.className(), call.name(), call.descriptor(), false);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon Nov 25 11:13:08 2013 -0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Nov 26 18:36:39 2013 +0530
@@ -317,7 +317,7 @@
         final InstructionAdapter mv = new InstructionAdapter(cw.visitMethod(ACC_STATIC, CLASS_INIT,
                 Type.getMethodDescriptor(Type.VOID_TYPE), null, null));
 
-        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR);
+        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getClassOverrides", GET_CLASS_INITIALIZER_DESCRIPTOR, false);
         final Label initGlobal;
         if(samName != null) {
             // If the class is a SAM, allow having a ScriptFunction passed as class overrides
@@ -333,7 +333,7 @@
                 if(mi.getName().equals(samName)) {
                     mv.dup();
                     mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-                    mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR);
+                    mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_FUNCTION_DESCRIPTOR, false);
                 } else {
                     mv.visitInsn(ACONST_NULL);
                 }
@@ -350,7 +350,7 @@
             mv.dup();
             mv.aconst(mi.getName());
             mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-            mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR);
+            mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", GET_HANDLE_OBJECT_DESCRIPTOR, false);
             mv.putstatic(generatedClassName, mi.methodHandleClassFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
         }
 
@@ -367,7 +367,7 @@
     private static void invokeGetGlobalWithNullCheck(final InstructionAdapter mv) {
         invokeGetGlobal(mv);
         mv.dup();
-        mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR); // check against null Context
+        mv.invokevirtual(OBJECT_TYPE_NAME, "getClass", GET_CLASS_METHOD_DESCRIPTOR, false); // check against null Context
         mv.pop();
     }
 
@@ -424,7 +424,7 @@
             mv.load(offset, argType);
             offset += argType.getSize();
         }
-        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor());
+        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false);
 
         endInitMethod(mv);
     }
@@ -477,7 +477,7 @@
             mv.load(offset, argType);
             offset += argType.getSize();
         }
-        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor());
+        mv.invokespecial(superClassName, INIT, originalCtorType.getDescriptor(), false);
 
         // Get a descriptor to the appropriate "JavaAdapterFactory.getHandle" method.
         final String getHandleDescriptor = fromFunction ? GET_HANDLE_FUNCTION_DESCRIPTOR : GET_HANDLE_OBJECT_DESCRIPTOR;
@@ -496,7 +496,7 @@
                     mv.aconst(mi.getName());
                 }
                 mv.aconst(Type.getMethodType(mi.type.toMethodDescriptorString()));
-                mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor);
+                mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getHandle", getHandleDescriptor, false);
             }
             mv.putfield(generatedClassName, mi.methodHandleInstanceFieldName, METHOD_HANDLE_TYPE_DESCRIPTOR);
         }
@@ -520,11 +520,11 @@
     }
 
     private static void invokeGetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR);
+        mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false);
     }
 
     private static void invokeSetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR);
+        mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false);
     }
 
     /**
@@ -647,7 +647,7 @@
             // If the super method is abstract, throw an exception
             mv.anew(UNSUPPORTED_OPERATION_TYPE);
             mv.dup();
-            mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR);
+            mv.invokespecial(UNSUPPORTED_OPERATION_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR, false);
             mv.athrow();
         } else {
             // If the super method is not abstract, delegate to it.
@@ -728,7 +728,7 @@
         // Invoke the target method handle
         final Label tryBlockStart = new Label();
         mv.visitLabel(tryBlockStart);
-        mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString());
+        mv.invokevirtual(METHOD_HANDLE_TYPE.getInternalName(), "invokeExact", type.toMethodDescriptorString(), false);
         final Label tryBlockEnd = new Label();
         mv.visitLabel(tryBlockEnd);
         emitFinally(mv, currentGlobalVar, globalsDifferVar);
@@ -744,7 +744,7 @@
             mv.anew(RUNTIME_EXCEPTION_TYPE);
             mv.dupX1();
             mv.swap();
-            mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE));
+            mv.invokespecial(RUNTIME_EXCEPTION_TYPE_NAME, INIT, Type.getMethodDescriptor(Type.VOID_TYPE, THROWABLE_TYPE), false);
             // Fall through to rethrow handler
         } else {
             throwableHandler = null;
@@ -843,7 +843,7 @@
             mv.load(nextParam, t);
             nextParam += t.getSize();
         }
-        mv.invokespecial(superClassName, name, methodDesc);
+        mv.invokespecial(superClassName, name, methodDesc, false);
         mv.areturn(methodType.getReturnType());
     }