Package org.apache.groovy.ast.tools
Class CopyWithUtils
java.lang.Object
org.apache.groovy.ast.tools.CopyWithUtils
Shared AST-generation glue for nested-path
copyWith, used by both
the @Immutable and @RecordType transforms so the generated
code (and its evolution) stays identical across the two.- Since:
- 6.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCopyWithBlockMethod(ClassNode cNode) The transactional block overload:copyWith { name = 'x'; address.city = 'y' }.static voidBackward-compatibility shim: a no-argcopyWith()with its historical semantics (no changes → the same instance).static StatementnestedFlattenStmt(String mapParamName) The leading statement of a nested-awarecopyWith(Map):<mapParamName> = NestedCopyWithSupport.flatten(this, <mapParamName>).
-
Method Details
-
nestedFlattenStmt
The leading statement of a nested-awarecopyWith(Map):<mapParamName> = NestedCopyWithSupport.flatten(this, <mapParamName>). Plain keys pass through unchanged, so flat usage is unaffected. -
addCopyWithIdentityMethod
Backward-compatibility shim: a no-argcopyWith()with its historical semantics (no changes → the same instance). Needed once acopyWith(Closure)overload exists, otherwise the historically supported zero-arg call becomes ambiguous. -
addCopyWithBlockMethod
The transactional block overload:copyWith { name = 'x'; address.city = 'y' }.
-