本文整理匯總了Java中org.objectweb.asm.Opcodes.H_INVOKEINTERFACE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Opcodes.H_INVOKEINTERFACE屬性的具體用法?Java Opcodes.H_INVOKEINTERFACE怎麽用?Java Opcodes.H_INVOKEINTERFACE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.objectweb.asm.Opcodes
的用法示例。
在下文中一共展示了Opcodes.H_INVOKEINTERFACE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkLDCConstant
void checkLDCConstant(final Object cst) {
if (cst instanceof Type) {
int s = ((Type) cst).getSort();
if (s != Type.OBJECT && s != Type.ARRAY && s != Type.METHOD) {
throw new IllegalArgumentException("Illegal LDC constant value");
}
if (s != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
throw new IllegalArgumentException(
"ldc of a constant class requires at least version 1.5");
}
if (s == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
throw new IllegalArgumentException(
"ldc of a method type requires at least version 1.7");
}
} else if (cst instanceof Handle) {
if ((version & 0xFFFF) < Opcodes.V1_7) {
throw new IllegalArgumentException(
"ldc of a handle requires at least version 1.7");
}
int tag = ((Handle) cst).getTag();
if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
throw new IllegalArgumentException("invalid handle tag " + tag);
}
} else {
checkConstant(cst);
}
}
示例2: registerMethodHandleType
private void registerMethodHandleType(Handle handle) {
switch (handle.getTag()) {
case Opcodes.H_GETFIELD:
visitFieldInsn(Opcodes.GETFIELD, handle.getOwner(), handle.getName(), handle.getDesc());
break;
case Opcodes.H_GETSTATIC:
visitFieldInsn(Opcodes.GETSTATIC, handle.getOwner(), handle.getName(), handle.getDesc());
break;
case Opcodes.H_PUTFIELD:
visitFieldInsn(Opcodes.PUTFIELD, handle.getOwner(), handle.getName(), handle.getDesc());
break;
case Opcodes.H_PUTSTATIC:
visitFieldInsn(Opcodes.PUTSTATIC, handle.getOwner(), handle.getName(), handle.getDesc());
break;
case Opcodes.H_INVOKEVIRTUAL:
visitMethodInsn(
Opcodes.INVOKEVIRTUAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
break;
case Opcodes.H_INVOKEINTERFACE:
visitMethodInsn(
Opcodes.INVOKEINTERFACE, handle.getOwner(), handle.getName(), handle.getDesc(), true);
break;
case Opcodes.H_INVOKESPECIAL:
visitMethodInsn(
Opcodes.INVOKESPECIAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
break;
case Opcodes.H_INVOKESTATIC:
visitMethodInsn(
Opcodes.INVOKESTATIC, handle.getOwner(), handle.getName(), handle.getDesc(), false);
break;
case Opcodes.H_NEWINVOKESPECIAL:
visitMethodInsn(
Opcodes.INVOKESPECIAL, handle.getOwner(), handle.getName(), handle.getDesc(), false);
break;
default:
throw new Unreachable("MethodHandle tag is not supported: " + handle.getTag());
}
}
示例3: getMethodHandleType
private MethodHandleType getMethodHandleType(Handle handle) {
switch (handle.getTag()) {
case Opcodes.H_GETFIELD:
return MethodHandleType.INSTANCE_GET;
case Opcodes.H_GETSTATIC:
return MethodHandleType.STATIC_GET;
case Opcodes.H_PUTFIELD:
return MethodHandleType.INSTANCE_PUT;
case Opcodes.H_PUTSTATIC:
return MethodHandleType.STATIC_PUT;
case Opcodes.H_INVOKESPECIAL:
DexType owner = application.getTypeFromName(handle.getOwner());
if (owner == clazz || handle.getName().equals(Constants.INSTANCE_INITIALIZER_NAME)) {
return MethodHandleType.INVOKE_INSTANCE;
} else {
return MethodHandleType.INVOKE_SUPER;
}
case Opcodes.H_INVOKEVIRTUAL:
return MethodHandleType.INVOKE_INSTANCE;
case Opcodes.H_INVOKEINTERFACE:
return MethodHandleType.INVOKE_INTERFACE;
case Opcodes.H_INVOKESTATIC:
return MethodHandleType.INVOKE_STATIC;
case Opcodes.H_NEWINVOKESPECIAL:
return MethodHandleType.INVOKE_CONSTRUCTOR;
default:
throw new Unreachable("MethodHandle tag is not supported: " + handle.getTag());
}
}
示例4: appendHandle
/**
* Appends the information about the given handle to {@link #buf buf}.
*
* @param h
* a handle, non null.
*/
protected void appendHandle(final Handle h) {
int tag = h.getTag();
buf.append("// handle kind 0x").append(Integer.toHexString(tag))
.append(" : ");
boolean isMethodHandle = false;
switch (tag) {
case Opcodes.H_GETFIELD:
buf.append("GETFIELD");
break;
case Opcodes.H_GETSTATIC:
buf.append("GETSTATIC");
break;
case Opcodes.H_PUTFIELD:
buf.append("PUTFIELD");
break;
case Opcodes.H_PUTSTATIC:
buf.append("PUTSTATIC");
break;
case Opcodes.H_INVOKEINTERFACE:
buf.append("INVOKEINTERFACE");
isMethodHandle = true;
break;
case Opcodes.H_INVOKESPECIAL:
buf.append("INVOKESPECIAL");
isMethodHandle = true;
break;
case Opcodes.H_INVOKESTATIC:
buf.append("INVOKESTATIC");
isMethodHandle = true;
break;
case Opcodes.H_INVOKEVIRTUAL:
buf.append("INVOKEVIRTUAL");
isMethodHandle = true;
break;
case Opcodes.H_NEWINVOKESPECIAL:
buf.append("NEWINVOKESPECIAL");
isMethodHandle = true;
break;
}
buf.append('\n');
buf.append(tab3);
appendDescriptor(INTERNAL_NAME, h.getOwner());
buf.append('.');
buf.append(h.getName());
if(!isMethodHandle){
buf.append('(');
}
appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
if(!isMethodHandle){
buf.append(')');
}
}