I’d like to configure Eclipse with some “favorite” static-method collections, but without using static imports.
For example, if I add com.google.common.collect.Lists
the list in Window » Preferences » Java » Editor » Content Assist » Favorites, I can type “<code>newA”, press Ctrl-Space, and pick the Lists.newArrayList
method from that list. But:
1) If “static imports” is enabled in Preferences » Java » Editor » Content Assist, the result is that Eclipse adds a static import for com.google.common.collect.Lists.newArrayList
and auto-completes my code to newArrayList(...)
.
2) If “static imports” is disabled, then:
2.a) If the class with the static method is not imported, it adds an import for the class, and auto-completes to Lists.newArrayList(...)
, which is exactly what I want. However,
2.b) If the class with the static method is already imported, then it just auto-completes to newArrayList(...)
, which of course doesn’t compile.
My question is: Is there a way to configure Eclipse so that (2.b) behaves like (2.a) all the time? (I.e. so that it auto-completes favorite static methods with their class name prefix even when the class is already imported.)