Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.1
-
None
Description
import groovy.transform.* @CompileStatic class Bug2 { void test() { Map<String, Integer> m = ['abcd': 1234] assert m['abcd'] == 1234 assert m.abcd == 1234 } } new Bug1().test()
The code above works fine with static type checking.
But it's not happy with static compilation for the last line, where we're using the property notation for
1 compilation error: Access to java.util.Map <java.lang.String, java.lang.Integer>#abcd is forbidden at line: 8, column: 16
Note that an assignment m.abcd = 1234 seems to be okay though.