[ 
https://issues.apache.org/jira/browse/GROOVY-8868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16676616#comment-16676616
 ] 

Paul King edited comment on GROOVY-8868 at 11/6/18 11:07 AM:
-------------------------------------------------------------

I think this will only be true for classes with no properties. Still a bug 
obviously but shouldn't affect (as) many classes. Workaround is to use:
{code}
@groovy.transform.CompileStatic
@groovy.transform.Immutable
class Foo {
   static Foo create(){
      return new Foo([:])
   }
}
{code}


was (Author: paulk):
I think this will only be true for classes with no properties. Still a bug 
obviously but shouldn't affect (as) many classes.

> Static factory method does not compile anymore with 2.5.3 (was ok with 2.4.x)
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-8868
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8868
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.0, 2.5.2, 2.5.3
>            Reporter: Peti Koch
>            Priority: Critical
>
> I just tried to update our codebase from 2.4.15 to 2.5.3.
> This doesn't compile anymore:
> {noformat}
> @groovy.transform.CompileStatic
> @groovy.transform.Immutable
> class Foo {
>    static Foo create(){
>       return new Foo()
>    }
> }{noformat}
> I get
> {noformat}
> ...
> > 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
> ...{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to