Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7012

@Newify with String parameter without parenthesis gives a compiler error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.0-beta-2
    • None
    • xforms
    • None

    Description

      @Newify works fine with parenthesis, also without parenthesis for number parameter, but not for String. Please see the example below.

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

      Attachments

        Activity

          People

            emilles Eric Milles
            venkats Venkat Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: