MethodSignature sig = new MethodSignature(methodInsn.owner, methodInsn.name, methodInsn.desc);
if (isVirtualCall)
{
TypedValue base = (TypedValue)values.get(0);
if (methodChecker != null && !methodChecker.isMethodSafe(sig, base, args))
throw new AnalyzerException(insn, "Unknown method " + sig + " encountered");
MethodCallValue.VirtualMethodCallValue toReturn;
toReturn = new MethodCallValue.VirtualMethodCallValue(methodInsn.owner, methodInsn.name, methodInsn.desc, args, base);
if (toReturn.isConstructor() && linkedFrame != null)
linkedFrame.replaceValues(base, toReturn);
return toReturn;
}
else
{
if (methodChecker != null && !methodChecker.isStaticMethodSafe(sig))
throw new AnalyzerException(insn, "Unknown method " + sig + " encountered");
return new MethodCallValue.StaticMethodCallValue(methodInsn.owner, methodInsn.name, methodInsn.desc, args);
}
}
case INVOKEDYNAMIC:
{
assert(insn instanceof InvokeDynamicInsnNode);
InvokeDynamicInsnNode invokeInsn = (InvokeDynamicInsnNode)insn;
if (!"java/lang/invoke/LambdaMetafactory".equals(invokeInsn.bsm.getOwner())
|| !"altMetafactory".equals(invokeInsn.bsm.getName())
|| !"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;".equals(invokeInsn.bsm.getDesc()))
throw new AnalyzerException(insn, "Unknown invokedynamic " + invokeInsn.bsm + " encountered");
// Return the Lambda creation result
Handle lambdaMethod = (Handle)invokeInsn.bsmArgs[1];
Type functionalInterface = Type.getReturnType(invokeInsn.desc);
return new LambdaFactory(functionalInterface, lambdaMethod);
}
case MULTIANEWARRAY:
default:
throw new AnalyzerException(insn, "Unhandled bytecode instruction");
}
}