Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.3, 2.4.4
-
None
Description
This seems to be something like a regression of GROOVY-5734.
The following fails in Groovy 2.4.3/2.4.4, while it didn't fail in Groovy 2.3.11:
Bar.java
package test2; public class Bar { }
Foo.java
package test2; public class Foo { private Bar bar; public void setBar(Bar bar) { this.bar = bar; } public Bar getBar() { return bar; } }
Test.groovy
package test2 import groovy.transform.CompileStatic; @CompileStatic public class Test { void test() { boolean check = true Foo foo = new Foo() foo.bar = check? new Bar(): null } }
The assignment to foo.bar fails with:Cannot assign value of type java.lang.Object to variable of type test2.Bar.
The same heppens if Foo is written in Groovy instead of Java.
Attachments
Issue Links
- is related to
-
GROOVY-9972 LUB does not work correctly in case of ternary operator
- Closed