You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/10/29 20:37:00 UTC
[jira] [Resolved] (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 ]
Eric Milles resolved GROOVY-7012.
---------------------------------
Resolution: Fixed
All of these examples work under the new parser.
> @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.3.4#803005)