Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse content assist not working in enum constant parameter list

Tags:

java

eclipse

Using eclipse, when I enter the following:

public enum Foo {
    A(Integer.);
    private final Integer integer;

    private Foo(Integer integer) {
        this.integer = integer;
    }
}

And position my cursor after Integer. and ask for content assist (^space) I get nothing. In fact content assist does not seem to work at all inside enum constant argument lists.

Is this a known problem or expected behaviour? If the latter, why?

EDIT: I'm wondering if this is a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=395604

If so I'm amazed that such an obvious thing hasn't been fixed in the past 5 years with the number of Java developers using Eclipse.

like image 960
sprinter Avatar asked Nov 25 '17 00:11

sprinter


People also ask

How does Eclipse content assist work?

Using Content Assist Within an editor, content assist helps reduce the characters typed by providing a context sensitive list of possible completions to the characters already typed. The context assist can be invoked by clicking Ctrl + Space.

Why suggestions are not showing in eclipse?

Step 1: Open your Eclipse or Spring Tool Suite, then go to the Window > Preferences as shown in the below image. Step 2: In the next screen go to the Java > Editor > Content Assist > Auto activation triggers for Java as shown in the below image.


1 Answers

Yes, you're right, it is a known bug or at least a missing feature of the Eclipse Java IDE:

Eclipse Bug 395604 - Code assist does not work after anonymous class inside in an array initializer

In the last 5 years, there have been only a few votes for this bug and also only very few comments, so it doesn't seem to be particularly important for most users. I voted for the bug and added a comment with a link to your question. Eclipse is open source and the bug is tagged with helpwanted. So any Java developer is welcome to make Eclipse a little bit better by implementing this.

like image 91
howlger Avatar answered Oct 11 '22 20:10

howlger