Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0.1
-
Fix Version/s: 2.0.2
-
Component/s: Static compilation
-
Labels:None
-
Number of attachments :
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.