@GroovyASTTransformation(phase = CompilePhase.CONVERSION)
public class EqualsAndHashCodeASTStubber
extends AbstractASTTransformation
Joint-compilation stubber for EqualsAndHashCode. Emits placeholder
hashCode() and equals(Object) methods so the
@EqualsAndHashCode-generated overrides are visible in the
joint-compilation stub even though Object already provides them.
As with ToStringASTStubber, simple call sites compile either
way (Object-inherited dispatch is enough), but exposing the declared
overrides in the stub matters for Java code that does super.equals()
/ super.hashCode() chaining or for tooling that distinguishes
declared from inherited methods.
The placeholder bodies return safe defaults; the full EqualsAndHashCodeASTTransformation at CANONICALIZATION recognises the stubber metadata and replaces the bodies with the real implementations.
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
visit(ASTNode[] nodes, SourceUnit source) |