[jira] [Commented] (GROOVY-7601) shallow parameter for @Immutable

2018-02-04 Thread Christopher Smith (JIRA)

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

Christopher Smith commented on GROOVY-7601:
---

With the overhaul, it sounds like this should be closed, at least in its 
current form.

> 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)


[jira] [Commented] (GROOVY-7601) shallow parameter for @Immutable

2018-02-04 Thread Paul King (JIRA)

[ 
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)


[jira] [Commented] (GROOVY-7601) shallow parameter for @Immutable

2016-02-16 Thread Jochen Theodorou (JIRA)

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

Jochen Theodorou commented on GROOVY-7601:
--

Frankly, I would like to have a different transform for this like @Final... 
on the other hand, why not just make the fields and class final, and apply 
@Canonical to the class instead? You would then still not implement Immutable, 
but do you even wish for that?

> 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
>
> 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
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7601) shallow parameter for @Immutable

2016-02-15 Thread Christopher Smith (JIRA)

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

Christopher Smith commented on GROOVY-7601:
---

It's a clumsy workaround, because I have to list every possibly-mutable field 
type. The request is for a blanket {{*}} option.

> 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
>
> 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
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7601) shallow parameter for @Immutable

2015-12-05 Thread Rahul Somasunderam (JIRA)

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

Rahul Somasunderam commented on GROOVY-7601:


Does it look like this solves your problem?
http://docs.groovy-lang.org/latest/html/gapi/groovy/transform/Immutable.html#knownImmutables

> 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
>
> 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
(v6.3.4#6332)