public class CompareIdentityExpression
extends BinaryExpression
Compares two objects using identity comparison. This expression will generate bytecode using the IF_ACMPNE instruction, instead of using the "equals" method that is currently mapped to "==" in Groovy. This expression should only be used to compare to objects, not primitives, and only in the context of reference equality check.
| Fields inherited from class | Fields |
|---|---|
class Expression |
EMPTY_ARRAY |
| Constructor and description |
|---|
CompareIdentityExpression(Expression leftExpression, boolean eq, Expression rightExpression)Creates an identity comparison between two expressions. |
CompareIdentityExpression(Expression leftExpression, Expression rightExpression)Creates an identity-equality comparison between two expressions. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
isEq()Indicates whether this expression checks identity equality rather than inequality. |
|
public void |
setType(ClassNode type)Prevents changing the fixed boolean result type of this expression. |
|
public Expression |
transformExpression(ExpressionTransformer transformer)Transforms both operands while preserving identity-comparison semantics. |
|
public void |
visit(GroovyCodeVisitor visitor)Emits direct reference-comparison bytecode for this expression. |
Creates an identity comparison between two expressions.
leftExpression - the left operandeq - true for ===; false for !==rightExpression - the right operandCreates an identity-equality comparison between two expressions.
leftExpression - the left operandrightExpression - the right operandIndicates whether this expression checks identity equality rather than inequality.
true for ===; false for !==Prevents changing the fixed boolean result type of this expression.
type - ignoredTransforms both operands while preserving identity-comparison semantics.
transformer - the expression transformer to applyEmits direct reference-comparison bytecode for this expression.
visitor - the visitor to acceptCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.