[ 
https://issues.apache.org/jira/browse/GROOVY-7601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16352000#comment-16352000
 ] 

Paul King commented on GROOVY-7601:
-----------------------------------

I am inclined to close this issue. In 2.5, @Immutable is now a meta-annotation 
which means the functionality is more fine-grained and it's easier to build 
your own combination of desired features. You could make your own 
@ShallowImmutable meta-annotation combining for instance @Canonical and 
@KnownImmutable and as Jochen suggests manually make your properties final. We 
have also considered expanding @AutoFinal to automatically make fields final 
given some configuration option. That would give you the last piece of the 
puzzle if we went that way - but you could certainly provide your own transform 
for just that part.

> shallow parameter for @Immutable
> --------------------------------
>
>                 Key: GROOVY-7601
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7601
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.4.4
>            Reporter: Christopher Smith
>            Priority: Major
>
> I am using {{@Immutable}} for some command objects, where some of the fields 
> are sometimes-complex domain objects. In this case, I don't need deep 
> immutability for semantic correctness, and it would be helpful to have a 
> parameter to indicate that the transform shouldn't bother checking the 
> fields' types, just make them final and generate the appropriate methods:
> {code}
> @Immutable(shallow = true)
> class PayCommand {
>   Invoice invoice
>   Money amount
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to