- // Check type
- tsmb.loadThis();
- tsmb.loadLocal(parameter);
- tsmb.ifComparisonBranch(success, "==", TypeDesc.OBJECT);
- tsmb.loadLocal(parameter);
- tsmb.ifNullBranch(failure, true);
- tsmb.loadLocal(parameter);
- tsmb.invokeVirtual("java/lang/Object", "getClass", CLASS, Constants.EMPTY_TYPEDESC_ARRAY);
- tsmb.loadThis();
- tsmb.invokeVirtual("java/lang/Object", "getClass", CLASS, Constants.EMPTY_TYPEDESC_ARRAY);
- tsmb.ifComparisonBranch(failure, "!=", CLASS);
- tsmb.loadLocal(parameter);
- tsmb.checkCast(classBuilder.getType());
- LocalVariable other = tsmb.createLocalVariable("other", classBuilder.getType());
- tsmb.storeLocal(other);
+ MethodBuilderBase tsmb = classBuilder.addMethodBase(Opcodes.ACC_PUBLIC, "equals", TypeDesc.BOOLEAN, Constants.OBJECTS[1]);
+ LocalVariable parameter = tsmb.getParameter(0);
+ Label success = tsmb.createLabel();
+ Label failure = tsmb.createLabel();