Community
Participate
Working Groups
Created attachment 277695 [details] Screenshot showing the problem. Only 1 enum type is valid for the content assist, yet many more enum types are proposed. Snippet is: public class TestContentAssist { enum MyEnum { one, two } static void someMethod(MyEnum fruit) { System.out.println(fruit); } public static void main(String[] args) { someMethod(M); } } Invoke content assist after "M" at line "someMethod(M);", observe that any enum type with starting letter M is listed. This is too vague.
Created attachment 277697 [details] Screenshot showing the problem. Only 1 enum type is valid for the content assist, yet many more enum types are proposed.
*** Bug 544829 has been marked as a duplicate of this bug. ***
If we think about type names in this position, everything should be legal, because we might complete any type to s.t. like "Util.getMyEnumFor(foo)". OTOH, why show the enum type in the first place? Don't we want to directly propose all constants of the target enum?
(In reply to Stephan Herrmann from comment #3) > If we think about type names in this position, everything should be legal, > because we might complete any type to s.t. like "Util.getMyEnumFor(foo)". Good point, though in 99% of the listed types would not be able to produce an enum. Maybe its possible to check whether the listed types can return the enum? If its not too expensive to check. > OTOH, why show the enum type in the first place? Don't we want to directly > propose all constants of the target enum? Wouldn't that be more like a Java code template feature? Usually content assist only suggests the next "word".
If you invoke completion after: MyEnum x= we directly suggest the enum constants followed by the MyEnum class. It would be nice to have the same behaviour for method parameters, at least if the required target type can be determined unambiguously. Anyway it really seems bogus to suggest unrelated Enum classes.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.