Hmmm, it works with the alpha versions of Groovy 5. There must be a fix we didn't backport. A workaround (though shouldn't be needed) is to use an explicit qualifier, e.g.: "println Foo.wth". Did you want to create an issue?
Thanks, Paul. <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> On Thu, Nov 2, 2023 at 8:57 AM OCsite <o...@ocs.cz> wrote: > > Hi there, > > looks like 3 used to inline private static finals, while 4 does not, which > causes the following regression. Is that the intended behaviour, or a bug? > > Thanks, > OC > > === > > 1030 ocs /tmp> <q.groovy > > class Foo { > > private static final String wth='wth' > > def foo() { > > 1.times { > > println wth > > } > > } > > } > > class Bar extends Foo { } > > new Bar().foo() > > 1031 ocs /tmp> /usr/local/groovy-3.0.8/bin/groovy q > > wth > > 1032 ocs /tmp> /usr/local/groovy-4.0.0-alpha-1/bin/groovy q.m > > Caught: java.io.FileNotFoundException: /private/tmp/q.m (/private/tmp/q.m) > > java.io.FileNotFoundException: /private/tmp/q.m (/private/tmp/q.m) > > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > 1033 ocs /tmp> > > ===