use of org.objectweb.asm.Opcodes.IRETURN in project groovy by apache.
the class RecordTypeASTTransformation method createRecordHashCode.
private void createRecordHashCode(ClassNode cNode) {
String desc = BytecodeHelper.getMethodDescriptor(ClassHelper.int_TYPE, new ClassNode[] { cNode });
Statement body = stmt(bytecodeX(ClassHelper.int_TYPE, mv -> {
mv.visitVarInsn(ALOAD, 0);
mv.visitInvokeDynamicInsn("hashCode", desc, createBootstrapMethod(), createBootstrapMethodArguments(cNode));
mv.visitInsn(IRETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}));
addGeneratedMethod(cNode, "hashCode", PUBLIC_FINAL, ClassHelper.int_TYPE, Parameter.EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, body);
}
use of org.objectweb.asm.Opcodes.IRETURN in project groovy by apache.
the class RecordTypeASTTransformation method createRecordEquals.
private void createRecordEquals(ClassNode cNode) {
String desc = BytecodeHelper.getMethodDescriptor(ClassHelper.boolean_TYPE, new ClassNode[] { cNode, ClassHelper.OBJECT_TYPE });
Statement body = stmt(bytecodeX(ClassHelper.boolean_TYPE, mv -> {
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitInvokeDynamicInsn("equals", desc, createBootstrapMethod(), createBootstrapMethodArguments(cNode));
mv.visitInsn(IRETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
}));
addGeneratedMethod(cNode, "equals", PUBLIC_FINAL, ClassHelper.boolean_TYPE, params(param(ClassHelper.OBJECT_TYPE, "other")), ClassNode.EMPTY_ARRAY, body);
}
Aggregations