Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.1.5
-
None
Description
The following code fails type checking as the inferred type of the entry loop variable is Object.
@groovy.transform.CompileStatic class Looper { static void main(String... args) { Map<String, Integer> map = [foo: 123, bar: 456] for (entry in map) { println entry.key.reverse() println entry.value * 2 } } }
If I change it to for (entry in map.entrySet()) it works fine.
Attachments
Issue Links
- duplicates
-
GROOVY-6123 Cannot use @CompileStatic with loop over Enumeration
-
- Closed
-