Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.6, 2.4.0-rc-1
-
None
-
java version "1.8.0_11"
Description
@CompileStatic breaks assignment for code like
@groovy.transform.CompileStatic class StaticClass { StringHolder holder = new StringHolder() String str StaticClass(String s) { str = holder.str = s } } class StringHolder { String str } def s = new StaticClass('test') assert s.holder.str == 'test' assert s.str != 'test'
The second assert fails because s.str == null. Without @CompileStatic it works correctly (and as java).