Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.21
-
None
Description
Consider the following:
class M extends HashMap<String,Number> { private void setFoo(foo) { print foo } } @groovy.transform.CompileStatic void test() { def map = new M() map.foo = 123 print map.foo }
Assignment expression "map.foo = 123" shows error "[Static type checking] - Cannot assign value of type int to variable of type java.lang.Object". Adding cast to Object changes the message to "Cannot assign value of type java.lang.Object to variable of type java.lang.Object".
Attachments
Issue Links
- is related to
-
GROOVY-5001 Map access is given higher precedence when trying to access fields/properties in classes which implement java.util.Map or extend java.util.HashMap or java.util.Properties
- Closed
-
GROOVY-11319 Access to a private property of a parent object is not caught
- Closed