// Generated by delombok at Sun Feb 26 12:31:38 KST 2017
package scouter.bytebuddy.implementation.bytecode.member;
import scouter.bytebuddy.implementation.Implementation;
import scouter.bytebuddy.implementation.bytecode.StackManipulation;
import scouter.bytebuddy.utility.JavaConstant;
import scouter.bytebuddy.jar.asm.MethodVisitor;
import scouter.bytebuddy.jar.asm.Opcodes;
/**
* An exact invocation of a method handle with a polymorphic signature.
*/
public class HandleInvocation implements StackManipulation {
/**
* The name of the {@code java.lang.invoke.MethodHandle} type.
*/
private static final String METHOD_HANDLE_NAME = "java/lang/invoke/MethodHandle";
/**
* The name of the {@code invokeExact} method.
*/
private static final String INVOKE_EXACT = "invokeExact";
/**
* The method type of the invoked handle.
*/
private final JavaConstant.MethodType methodType;
/**
* Creates a public invocation of a method handle.
*
* @param methodType The method type of the invoked handle.
*/
public HandleInvocation(JavaConstant.MethodType methodType) {
this.methodType = methodType;
}
@Override
public boolean isValid() {
return true;
}
@Override
public Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext) {
methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, METHOD_HANDLE_NAME, INVOKE_EXACT, methodType.getDescriptor(), false);
int size = methodType.getReturnType().getStackSize().getSize() - methodType.getParameterTypes().getStackSize();
return new Size(size, Math.max(size, 0));
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof HandleInvocation)) return false;
final HandleInvocation other = (HandleInvocation) o;
if (!other.canEqual((java.lang.Object) this)) return false;
final java.lang.Object this$methodType = this.methodType;
final java.lang.Object other$methodType = other.methodType;
if (this$methodType == null ? other$methodType != null : !this$methodType.equals(other$methodType)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof HandleInvocation;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@javax.annotation.Generated("lombok")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final java.lang.Object $methodType = this.methodType;
result = result * PRIME + ($methodType == null ? 43 : $methodType.hashCode());
return result;
}
}