8029031: "ant clean jar" on nashorn repo results in number of ASM deprecated warnings
Reviewed-by: lagergren, jlaskey, hannesw
This commit is contained in:
parent
feeefa4945
commit
8a6f7a3d45
@ -349,19 +349,19 @@ public class MethodGenerator extends MethodVisitor {
|
||||
|
||||
// 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 @@ public class MethodGenerator extends MethodVisitor {
|
||||
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 @@ public class MethodGenerator extends MethodVisitor {
|
||||
super.visitMethodInsn(INVOKEVIRTUAL,
|
||||
"java/io/PrintStream",
|
||||
"println",
|
||||
"(Ljava/lang/Object;)V");
|
||||
"(Ljava/lang/Object;)V", false);
|
||||
}
|
||||
}
|
||||
|
@ -146,16 +146,16 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
// 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 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
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 @@ public class ScriptClassInstrumentor extends ClassVisitor {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc);
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1130,7 +1130,11 @@ public class MethodEmitter implements Emitter {
|
||||
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);
|
||||
|
@ -261,7 +261,7 @@ public abstract class Type implements Comparable<Type>, BytecodeOps {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,7 +317,7 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
}
|
||||
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
// 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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
// 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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
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 @@ final class JavaAdapterBytecodeGenerator {
|
||||
mv.load(nextParam, t);
|
||||
nextParam += t.getSize();
|
||||
}
|
||||
mv.invokespecial(superClassName, name, methodDesc);
|
||||
mv.invokespecial(superClassName, name, methodDesc, false);
|
||||
mv.areturn(methodType.getReturnType());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user