Package net.bytebuddy.implementation
Class EqualsMethod.NullValueGuard.UsingJump
java.lang.Object
net.bytebuddy.implementation.EqualsMethod.NullValueGuard.UsingJump
- All Implemented Interfaces:
EqualsMethod.NullValueGuard
- Enclosing interface:
- EqualsMethod.NullValueGuard
@Enhance
public static class EqualsMethod.NullValueGuard.UsingJump
extends Object
implements EqualsMethod.NullValueGuard
A null value guard that expects a reference type and that skips the comparison if both values are
null
but returns if
the invoked instance's field value is null
but not the compared instance's value.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
The stack manipulation to apply after the equality computation.protected class
The stack manipulation to apply before the equality computation.Nested classes/interfaces inherited from interface net.bytebuddy.implementation.EqualsMethod.NullValueGuard
EqualsMethod.NullValueGuard.NoOp, EqualsMethod.NullValueGuard.UsingJump
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Object[]
An empty array.private final org.objectweb.asm.Label
A label indicating the end of the null-guarding block.private final org.objectweb.asm.Label
The label to jump to if the first value isnull
whereas the second value is notnull
.private final MethodDescription
The instrumented method.private static final Object[]
An array containing a single reference value.private final org.objectweb.asm.Label
The label to jump to if the second value isnull
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UsingJump
(MethodDescription instrumentedMethod) Creates a new null value guard using a jump instruction fornull
values. -
Method Summary
-
Field Details
-
EMPTY
An empty array. -
REFERENCE
An array containing a single reference value. -
instrumentedMethod
The instrumented method. -
firstValueNull
private final org.objectweb.asm.Label firstValueNullThe label to jump to if the first value isnull
whereas the second value is notnull
. -
secondValueNull
private final org.objectweb.asm.Label secondValueNullThe label to jump to if the second value isnull
. -
endOfBlock
private final org.objectweb.asm.Label endOfBlockA label indicating the end of the null-guarding block.
-
-
Constructor Details
-
UsingJump
Creates a new null value guard using a jump instruction fornull
values.- Parameters:
instrumentedMethod
- The instrumented method.
-
-
Method Details
-
before
Returns a stack manipulation to apply before computing equality.- Specified by:
before
in interfaceEqualsMethod.NullValueGuard
- Returns:
- A stack manipulation to apply before computing equality.
-
after
Returns a stack manipulation to apply after computing equality.- Specified by:
after
in interfaceEqualsMethod.NullValueGuard
- Returns:
- A stack manipulation to apply after computing equality.
-
getRequiredVariablePadding
public int getRequiredVariablePadding()Returns the required padding for the local variable array to apply this guard.- Specified by:
getRequiredVariablePadding
in interfaceEqualsMethod.NullValueGuard
- Returns:
- The required padding for the local variable array to apply this guard.
-