Class EqualsMethod.ConditionalReturn

  • All Implemented Interfaces:
    StackManipulation
    Enclosing class:
    EqualsMethod

    @Enhance
    protected static class EqualsMethod.ConditionalReturn
    extends java.lang.Object
    implements StackManipulation
    A conditional return aborts the equality computation if a given condition was reached.
    • Field Detail

      • EMPTY

        private static final java.lang.Object[] EMPTY
        An empty array.
      • jumpCondition

        private final int jumpCondition
        The conditional jump instruction upon which the return is not triggered.
      • value

        private final int value
        The opcode for the value being returned.
    • Constructor Detail

      • ConditionalReturn

        protected ConditionalReturn​(int jumpCondition)
        Creates a conditional return for a value of false.
        Parameters:
        jumpCondition - The opcode upon which the return is not triggered.
      • ConditionalReturn

        private ConditionalReturn​(int jumpCondition,
                                  int value)
        Creates a conditional return.
        Parameters:
        jumpCondition - The opcode upon which the return is not triggered.
        value - The opcode for the value being returned.
    • Method Detail

      • onZeroInteger

        protected static EqualsMethod.ConditionalReturn onZeroInteger()
        Returns a conditional return that returns on an int value of 0.
        Returns:
        A conditional return that returns on an int value of 0.
      • onNonZeroInteger

        protected static EqualsMethod.ConditionalReturn onNonZeroInteger()
        Returns a conditional return that returns on an int value of not 0.
        Returns:
        A conditional return that returns on an int value of not 0.
      • onNullValue

        protected static EqualsMethod.ConditionalReturn onNullValue()
        Returns a conditional return that returns on a reference value of null.
        Returns:
        A conditional return that returns on a reference value of null.
      • onNonIdentity

        protected static EqualsMethod.ConditionalReturn onNonIdentity()
        Returns a conditional return that returns if two reference values are not identical.
        Returns:
        A conditional return that returns if two reference values are not identical.
      • onIdentity

        protected static EqualsMethod.ConditionalReturn onIdentity()
        Returns a conditional return that returns if two reference values are identical.
        Returns:
        A conditional return that returns if two reference values are identical.
      • onNonEqualInteger

        protected static EqualsMethod.ConditionalReturn onNonEqualInteger()
        Returns a conditional return that returns if two int values are not equal.
        Returns:
        A conditional return that returns if two int values are not equal.
      • returningTrue

        protected StackManipulation returningTrue()
        Returns a new stack manipulation that returns true for the given condition.
        Returns:
        A new stack manipulation that returns true for the given condition.
      • isValid

        public boolean isValid()
        Determines if this stack manipulation is valid.
        Specified by:
        isValid in interface StackManipulation
        Returns:
        If false, this manipulation cannot be applied and should throw an exception.
      • apply

        public StackManipulation.Size apply​(org.objectweb.asm.MethodVisitor methodVisitor,
                                            Implementation.Context implementationContext)
        Applies the stack manipulation that is described by this instance.
        Specified by:
        apply in interface StackManipulation
        Parameters:
        methodVisitor - The method visitor used to write the method implementation to.
        implementationContext - The context of the current implementation.
        Returns:
        The changes to the size of the operand stack that are implied by this stack manipulation.