Summary: | [1.5] EnumConstantDeclaration should declare resolveConstructorBinding | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Tom Hofmann <eclipse> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | jeem, markus.kell.r, martinae |
Version: | 3.1 | ||
Target Milestone: | 3.1 M6 | ||
Hardware: | PC | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 85228 |
Description
Tom Hofmann
2005-02-15 04:45:12 EST
I am not sure I want to see the enum constants highlighted like a method invocation. From my point of view, this is more a field constant. EnumConstantDeclarations have a double nature of both constructor invocations and constant declarations (plus anonymous class decls sometimes). How this is presented in the UI is a different story, but the AST element should provide all that information. Note that we *do* render EnumConstants like constant fields currently. (In reply to comment #2) > Note that we *do* render EnumConstants like constant fields currently. ...and we don't plan to change this. The dependent bug is about the autoboxing highlighting, where we analyze the type bindings of, amongst other things, method parameters. We also want to highlight the autoboxed parameters inside the enum constant declarations: static final int one= 1, two= 2; static enum Natural { ONE(one), TWO(two); private final Integer n; Natural(Integer n) { this.n= n; } } Enum constants are definitely some sort of field constants. Now in compiler land, they are provided with an initialization expression which is an allocation (normal or qualified when constant body is supplied). Why not simply doing the same ? Autoboxing diagnosis can be implemented using the forthcoming API: isBoxed()/isUnboxed() Adding public IMethodBinding resolveConstructorBinding(); to EnumConstantDeclaration makes sense as a way of exposing the constructor invoked in the enum constant declaration. API has been added. Regression tests added in ASTConverter15Test. I updated existing tests. Look for references to resolveConstructorBinding(). Fixed and released. Verified in 20050330-0500 |