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 2022/03/08 12:17:00 UTC

[jira] [Closed] (GROOVY-7012) @Newify with String parameter without parenthesis gives a compiler error

     [ https://issues.apache.org/jira/browse/GROOVY-7012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-7012.
-----------------------------

> @Newify with String parameter without parenthesis gives a compiler error
> ------------------------------------------------------------------------
>
>                 Key: GROOVY-7012
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7012
>             Project: Groovy
>          Issue Type: Bug
>          Components: xforms
>    Affects Versions: 2.4.0-beta-2
>            Reporter: Venkat Srinivasan
>            Assignee: Eric Milles
>            Priority: Minor
>
> @Newify works fine with parenthesis, also without parenthesis for number parameter, but not for String. Please see the example below.
> {code}
> class MyClass {
>   MyClass(int value) {}
>   MyClass(String value) {}
> }
> @Newify(MyClass)
> def create1() {
>   MyClass(1) //OK
> }
> @Newify(MyClass)
> def create2() {
>   MyClass('hello') //OK
> }
> @Newify(MyClass)
> def create3() {
>   MyClass 1 //OK
> }
> @Newify(MyClass)
> def create4() {
>   MyClass 'hello' //ERROR
> }
> println create1()
> println create2()
> println create3()
> println create4()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)