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

Static factory method does not compile anymore with 2.5.3 (was ok with 2.4.x)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.0, 2.5.2, 2.5.3, 2.5.4
    • 3.0.0-alpha-4, 2.5.5
    • None
    • None

    Description

      I just tried to update our codebase from 2.4.15 to 2.5.3.

      This doesn't compile anymore:

      @groovy.transform.CompileStatic
      @groovy.transform.Immutable
      class Foo {
      
         static Foo create(){
            return new Foo()
         }
      }

      I get

      ...
      > Task :compileTestGroovy
      startup failed:
      C:\Dev\Foo\src\test\groovy\Foo.groovy: 6: [Static type checking] - Cannot find matching method Foo#<init>(). Please check if the declared type is correct and if the method exists.
       @ line 6, column 10.
           return new Foo()
                  ^
      1 error
      > Task :compileTestGroovy FAILED
      ...

      Attachments

        1. Screenshot.PNG
          39 kB
          Peti Koch

        Activity

          People

            paulk Paul King
            PetiKoch Peti Koch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: