Details
Description
I have a class with the following code:
class UnitGroupMap { ... static Map suffixPriority = ['a' : 10, 'b' : 20] ... enum UnitGroup { SAMPLE("foo"), ... UnitGroup(String name) { ... suffixPriority[name] = priority ... } ... } ... }
The compiler does not complain, STS doesn't complain, but at runtime, there's an exception that "suffixPriority" is not a member of UnitGroupMap.UnitGroup.
To make this code work, I have to precede the suffixPriority reference with the class name: UnitGroupMap.suffixPriority
Either this should work as written, or the compiler should generate an error or at least a warning. However, STS at least highlights suffixPriority in italics as though it can and does see the field should be coming from the parent class, UnitGroupMap.
Attachments
Issue Links
- relates to
-
GROOVY-11198 access to public static variable forbidden in enum
- Closed