Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ide-dev] Why we dropped Eclipse in favour of IntelliJ | Java Code Geeks


The problem with List is still there. Having "Organize Imports" as
save action, type the following:

    List<String> l = new ArrayList<String>();

Now save. What happens: ArrayList is automatically imported because
there is only one possibility. Good.

But List is not. Now invoke quick fix on it. The proposals are:

1. Import 'List' (java.awt)
2. Import 'List' (java.util)

Not helpful. Just for fun, select the first entry. The result
is an error, because java.awt.List is not generic.

Even if it was generic, it would still be an error, because
ArrayList is not a subtype of java.awt.List.

So the right thing to do in this case would be to just import
the only valid possibility, java.util.List.

IntelliJ probably gets this right, and I can imagine it being
one of the reasons people prefer it.

Can we really not do any better?

I know about Code Recommenders, but last time I checked, it
only reordered JDT's proposals. IMO the proposals leading to
errors should not be proposed in the first place so that the
extra key presses for invoking quick fix are not necessary.

I would be surprised if the above was not already in Bugzilla
somewhere, but I couldn't find it right away. I'll report it
in case it's really not yet known.

  Robin Stocker

Back to the top