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)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5.0, 2.5.2, 2.5.3, 2.5.4
    • Fix Version/s: 3.0.0-alpha-4, 2.5.5
    • Component/s: None
    • Labels:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: