Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.2
-
None
Description
There's a difference in behavior with static type checking between property and subscript access to map elements.
@groovy.transform.TypeChecked class Test { static void test() { def m = [retries: 10] // passes int r1 = m['retries'] ?: 1 // fails int r2 = m.retries ?: 1 } } Test.test()
Fails with:
[Static type checking] - Cannot assign value of type java.lang.Object to variable of type int
Attachments
Issue Links
- relates to
-
GROOVY-8788 Inconsistency in extension method selection with @CompileStatic
- Closed