You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2018/01/23 01:30:00 UTC

[jira] [Commented] (GROOVY-8456) @MapConstructor could provide a noArg flag

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

Paul King commented on GROOVY-8456:
-----------------------------------

This functionality isn't strictly needed. Calling a no-arg constructor with current Groovy versions calls the Map constructor with {{null}}. However, we should try not to rely on that functionality as much as possible and having this option allows providing a like-for-like replacement of {{@Immutable}} with an annotation collector.

> @MapConstructor could provide a noArg flag
> ------------------------------------------
>
>                 Key: GROOVY-8456
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8456
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Priority: Major
>
> This could provide a noArgs constructor which called the Map-based constructor with an empty Map, e.g.:
> {code}
> @MapConstructor(noArg=true)
> class Foo { ... }
> {code}
> would in addition to the Map-based constructor, also provide this:
> {code}
> Foo() { this([:]) }
> {code}
> This is currently part of what @Immutable provides.



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