Summary: | IVariableBinding: Need to know if it is enum constant or normal var | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Martin Aeschlimann <martinae> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | jeem |
Version: | 3.0 | ||
Target Milestone: | 3.1 M5 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Martin Aeschlimann
2005-01-05 04:33:44 EST
Jim, any comment? The case is even more interesting when the enum has self-typed fields; i.e., public enum E { A, B, C; public static E D; } Checking whether the variable's type is the same enum type as the variable's declaring class would not cut it. Adding IVariableBinding.isEnumConstant() feels like a good approach. Adding API IVariableBinding.isEnumConstant(). I also clarified the spec for IVariableBinding.getConstantValue() to specify that it returns null for enum constants. This approach is consistent with JLS3 15.28, which does not consider enumeration types to be compile-time constant expressions. Olivier, please complete VariableBinding.isEnumConstant() implementation and add tests. The test needs to be done on the modifiers of the binding. An enum constant has AccEnum is its bits. Fixed and released in HEAD. Regression test added in ASTConverter15Test.test0100. Verified in I20050215-2300 |