Java Code Examples for org.objectweb.asm.Handle#isInterface()
The following examples show how to use
org.objectweb.asm.Handle#isInterface() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Remapper.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
/** * Returns the given value, remapped with this remapper. * * @param value an object. Only {@link Type} and {@link Handle} values are remapped. * @return the given value, remapped with this remapper. */ public Object mapValue(final Object value) { if (value instanceof Type) { return mapType((Type) value); } if (value instanceof Handle) { Handle handle = (Handle) value; return new Handle( handle.getTag(), mapType(handle.getOwner()), mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()), mapMethodDesc(handle.getDesc()), handle.isInterface()); } return value; }
Example 2
Source File: BigIntegerMutator.java From pitest with Apache License 2.0 | 6 votes |
/** * Mutates a handle within an invoke virtual. */ private Handle mutateHandle(Handle handle) { int opcode = handle.getTag(); String owner = handle.getOwner(); String name = handle.getName(); String descriptor = handle.getDesc(); if (owner.equals(expectedOwner) && opcode == Opcodes.H_INVOKEVIRTUAL) { if (REPLACEMENTS.containsKey(name)) { Replacement replacement = REPLACEMENTS.get(name); if (replacement.descriptor.equals(descriptor)) { MutationIdentifier id = context.registerMutation(factory, replacement.toString()); if (context.shouldMutate(id)) { return new Handle( opcode, owner, replacement.destinationName, descriptor, handle.isInterface()); } } } } return handle; }
Example 3
Source File: Remapper.java From Concurnas with MIT License | 5 votes |
/** * Returns the given value, remapped with this remapper. Possible values are {@link Boolean}, * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double}, * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays * of primitive types . * * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values * are remapped. * @return the given value, remapped with this remapper. */ public Object mapValue(final Object value) { if (value instanceof Type) { return mapType((Type) value); } if (value instanceof Handle) { Handle handle = (Handle) value; return new Handle( handle.getTag(), mapType(handle.getOwner()), mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()), handle.getTag() <= Opcodes.H_PUTSTATIC ? mapDesc(handle.getDesc()) : mapMethodDesc(handle.getDesc()), handle.isInterface()); } if (value instanceof ConstantDynamic) { ConstantDynamic constantDynamic = (ConstantDynamic) value; int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount(); Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount]; for (int i = 0; i < bootstrapMethodArgumentCount; ++i) { remappedBootstrapMethodArguments[i] = mapValue(constantDynamic.getBootstrapMethodArgument(i)); } String descriptor = constantDynamic.getDescriptor(); return new ConstantDynamic( mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor), mapDesc(descriptor), (Handle) mapValue(constantDynamic.getBootstrapMethod()), remappedBootstrapMethodArguments); } return value; }
Example 4
Source File: NamespaceMapper.java From AVM with MIT License | 5 votes |
/** * @param methodHandle The pre-transform method handle. * @param mapMethodDescriptor True if the underlying descriptor should be mapped or false to leave it unchanged. * @return The post-transform method handle. */ public Handle mapHandle(Handle methodHandle, boolean mapMethodDescriptor, boolean preserveDebuggability) { String methodOwner = methodHandle.getOwner(); String methodName = methodHandle.getName(); String methodDescriptor = methodHandle.getDesc(); String newMethodOwner = mapType(methodOwner, preserveDebuggability); String newMethodName = mapMethodName(methodName); String newMethodDescriptor = mapMethodDescriptor ? mapDescriptor(methodDescriptor, preserveDebuggability) : methodDescriptor; return new Handle(methodHandle.getTag(), newMethodOwner, newMethodName, newMethodDescriptor, methodHandle.isInterface()); }
Example 5
Source File: InvokedynamicShadower.java From AVM with MIT License | 5 votes |
private Handle newLambdaHandleFrom(Handle origHandle, boolean shadowMethodDescriptor) { final String owner = origHandle.getOwner(); final String newOwner = owner; final String newMethodName = origHandle.getName(); final String newMethodDescriptor = shadowMethodDescriptor ? replacer.replaceMethodDescriptor(origHandle.getDesc()) : origHandle.getDesc(); return new Handle(origHandle.getTag(), newOwner, newMethodName, newMethodDescriptor, origHandle.isInterface()); }
Example 6
Source File: AsmClassRemapper.java From tiny-remapper with GNU Lesser General Public License v3.0 | 5 votes |
private static boolean isJavaLambdaMetafactory(Handle bsm) { return bsm.getTag() == Opcodes.H_INVOKESTATIC && bsm.getOwner().equals("java/lang/invoke/LambdaMetafactory") && (bsm.getName().equals("metafactory") && bsm.getDesc().equals("(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;") || bsm.getName().equals("altMetafactory") && bsm.getDesc().equals("(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;")) && !bsm.isInterface(); }
Example 7
Source File: Remapper.java From JReFrameworker with MIT License | 5 votes |
/** * Returns the given value, remapped with this remapper. Possible values are {@link Boolean}, * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double}, * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays * of primitive types . * * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values * are remapped. * @return the given value, remapped with this remapper. */ public Object mapValue(final Object value) { if (value instanceof Type) { return mapType((Type) value); } if (value instanceof Handle) { Handle handle = (Handle) value; return new Handle( handle.getTag(), mapType(handle.getOwner()), mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()), handle.getTag() <= Opcodes.H_PUTSTATIC ? mapDesc(handle.getDesc()) : mapMethodDesc(handle.getDesc()), handle.isInterface()); } if (value instanceof ConstantDynamic) { ConstantDynamic constantDynamic = (ConstantDynamic) value; int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount(); Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount]; for (int i = 0; i < bootstrapMethodArgumentCount; ++i) { remappedBootstrapMethodArguments[i] = mapValue(constantDynamic.getBootstrapMethodArgument(i)); } String descriptor = constantDynamic.getDescriptor(); return new ConstantDynamic( mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor), mapDesc(descriptor), (Handle) mapValue(constantDynamic.getBootstrapMethod()), remappedBootstrapMethodArguments); } return value; }
Example 8
Source File: Remapper.java From JReFrameworker with MIT License | 5 votes |
/** * Returns the given value, remapped with this remapper. Possible values are {@link Boolean}, * {@link Byte}, {@link Short}, {@link Character}, {@link Integer}, {@link Long}, {@link Double}, * {@link Float}, {@link String}, {@link Type}, {@link Handle}, {@link ConstantDynamic} or arrays * of primitive types . * * @param value an object. Only {@link Type}, {@link Handle} and {@link ConstantDynamic} values * are remapped. * @return the given value, remapped with this remapper. */ public Object mapValue(final Object value) { if (value instanceof Type) { return mapType((Type) value); } if (value instanceof Handle) { Handle handle = (Handle) value; return new Handle( handle.getTag(), mapType(handle.getOwner()), mapMethodName(handle.getOwner(), handle.getName(), handle.getDesc()), handle.getTag() <= Opcodes.H_PUTSTATIC ? mapDesc(handle.getDesc()) : mapMethodDesc(handle.getDesc()), handle.isInterface()); } if (value instanceof ConstantDynamic) { ConstantDynamic constantDynamic = (ConstantDynamic) value; int bootstrapMethodArgumentCount = constantDynamic.getBootstrapMethodArgumentCount(); Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArgumentCount]; for (int i = 0; i < bootstrapMethodArgumentCount; ++i) { remappedBootstrapMethodArguments[i] = mapValue(constantDynamic.getBootstrapMethodArgument(i)); } String descriptor = constantDynamic.getDescriptor(); return new ConstantDynamic( mapInvokeDynamicMethodName(constantDynamic.getName(), descriptor), mapDesc(descriptor), (Handle) mapValue(constantDynamic.getBootstrapMethod()), remappedBootstrapMethodArguments); } return value; }
Example 9
Source File: Textifier.java From Concurnas with MIT License | 4 votes |
/** * Appends a string representation of the given handle to {@link #stringBuilder}. * * @param handle a handle. */ protected void appendHandle(final Handle handle) { int tag = handle.getTag(); stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : "); boolean isMethodHandle = false; switch (tag) { case Opcodes.H_GETFIELD: stringBuilder.append("GETFIELD"); break; case Opcodes.H_GETSTATIC: stringBuilder.append("GETSTATIC"); break; case Opcodes.H_PUTFIELD: stringBuilder.append("PUTFIELD"); break; case Opcodes.H_PUTSTATIC: stringBuilder.append("PUTSTATIC"); break; case Opcodes.H_INVOKEINTERFACE: stringBuilder.append("INVOKEINTERFACE"); isMethodHandle = true; break; case Opcodes.H_INVOKESPECIAL: stringBuilder.append("INVOKESPECIAL"); isMethodHandle = true; break; case Opcodes.H_INVOKESTATIC: stringBuilder.append("INVOKESTATIC"); isMethodHandle = true; break; case Opcodes.H_INVOKEVIRTUAL: stringBuilder.append("INVOKEVIRTUAL"); isMethodHandle = true; break; case Opcodes.H_NEWINVOKESPECIAL: stringBuilder.append("NEWINVOKESPECIAL"); isMethodHandle = true; break; default: throw new IllegalArgumentException(); } stringBuilder.append('\n'); stringBuilder.append(tab3); appendDescriptor(INTERNAL_NAME, handle.getOwner()); stringBuilder.append('.'); stringBuilder.append(handle.getName()); if (!isMethodHandle) { stringBuilder.append('('); } appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc()); if (!isMethodHandle) { stringBuilder.append(')'); } if (handle.isInterface()) { stringBuilder.append(" itf"); } }
Example 10
Source File: Textifier.java From JByteMod-Beta with GNU General Public License v2.0 | 4 votes |
/** * 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(')'); } if (h.isInterface()) { buf.append(" itf"); } }
Example 11
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
/** * Appends a string representation of the given handle to {@link #stringBuilder}. * * @param handle a handle. */ protected void appendHandle(final Handle handle) { int tag = handle.getTag(); stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : "); boolean isMethodHandle = false; switch (tag) { case Opcodes.H_GETFIELD: stringBuilder.append("GETFIELD"); break; case Opcodes.H_GETSTATIC: stringBuilder.append("GETSTATIC"); break; case Opcodes.H_PUTFIELD: stringBuilder.append("PUTFIELD"); break; case Opcodes.H_PUTSTATIC: stringBuilder.append("PUTSTATIC"); break; case Opcodes.H_INVOKEINTERFACE: stringBuilder.append("INVOKEINTERFACE"); isMethodHandle = true; break; case Opcodes.H_INVOKESPECIAL: stringBuilder.append("INVOKESPECIAL"); isMethodHandle = true; break; case Opcodes.H_INVOKESTATIC: stringBuilder.append("INVOKESTATIC"); isMethodHandle = true; break; case Opcodes.H_INVOKEVIRTUAL: stringBuilder.append("INVOKEVIRTUAL"); isMethodHandle = true; break; case Opcodes.H_NEWINVOKESPECIAL: stringBuilder.append("NEWINVOKESPECIAL"); isMethodHandle = true; break; default: throw new IllegalArgumentException(); } stringBuilder.append('\n'); stringBuilder.append(tab3); appendDescriptor(INTERNAL_NAME, handle.getOwner()); stringBuilder.append('.'); stringBuilder.append(handle.getName()); if (!isMethodHandle) { stringBuilder.append('('); } appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc()); if (!isMethodHandle) { stringBuilder.append(')'); } if (handle.isInterface()) { stringBuilder.append(" itf"); } }
Example 12
Source File: Textifier.java From JReFrameworker with MIT License | 4 votes |
/** * Appends a string representation of the given handle to {@link #stringBuilder}. * * @param handle a handle. */ protected void appendHandle(final Handle handle) { int tag = handle.getTag(); stringBuilder.append("// handle kind 0x").append(Integer.toHexString(tag)).append(" : "); boolean isMethodHandle = false; switch (tag) { case Opcodes.H_GETFIELD: stringBuilder.append("GETFIELD"); break; case Opcodes.H_GETSTATIC: stringBuilder.append("GETSTATIC"); break; case Opcodes.H_PUTFIELD: stringBuilder.append("PUTFIELD"); break; case Opcodes.H_PUTSTATIC: stringBuilder.append("PUTSTATIC"); break; case Opcodes.H_INVOKEINTERFACE: stringBuilder.append("INVOKEINTERFACE"); isMethodHandle = true; break; case Opcodes.H_INVOKESPECIAL: stringBuilder.append("INVOKESPECIAL"); isMethodHandle = true; break; case Opcodes.H_INVOKESTATIC: stringBuilder.append("INVOKESTATIC"); isMethodHandle = true; break; case Opcodes.H_INVOKEVIRTUAL: stringBuilder.append("INVOKEVIRTUAL"); isMethodHandle = true; break; case Opcodes.H_NEWINVOKESPECIAL: stringBuilder.append("NEWINVOKESPECIAL"); isMethodHandle = true; break; default: throw new IllegalArgumentException(); } stringBuilder.append('\n'); stringBuilder.append(tab3); appendDescriptor(INTERNAL_NAME, handle.getOwner()); stringBuilder.append('.'); stringBuilder.append(handle.getName()); if (!isMethodHandle) { stringBuilder.append('('); } appendDescriptor(HANDLE_DESCRIPTOR, handle.getDesc()); if (!isMethodHandle) { stringBuilder.append(')'); } if (handle.isInterface()) { stringBuilder.append(" itf"); } }