6

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.

sprinter
  • 27,148
  • 6
  • 47
  • 78

1 Answers1

3

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.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • Ok thanks for your help. I will have a shot at fixing it myself. – sprinter Nov 25 '17 at 20:01
  • @sprinter That would be super cool! There is a similar bug that has been fixed recently: https://bugs.eclipse.org/bugs/show_bug.cgi?id=526590 – howlger Nov 25 '17 at 23:46
  • 1
    Truely amazing, in Enums this is so annoying! – JRA_TLL Oct 03 '19 at 10:57
  • 1
    So this hasn't been fixed yet? @sprinter no luck? – AgentM Oct 09 '19 at 16:11
  • 1
    @AgentM Nope. I had a go at fixing it but found understanding the eclipse code in this area incredibly time consuming so eventually gave up. To be honest I gave up on eclipse altogether and moved to intellij not long after this question. This was one of several bugs in eclipse that I found incredibly annoying for Java and unfixed for a long period. – sprinter Oct 10 '19 at 01:40