eclipse-jdt / eclipse-jdt/eclipse.jdt.core
static imports are removed at save (when there is an error or when code clean up happens not sure)
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
Many times when i touch a bit older java file
and i create a compile error or if the code clean up does stuff (not sure which one)
then many times static imports are removed and i have really compiler errors
for example:
import static java.util.stream.Collectors.toList;
that is then removed and in the place where i use that i have a compile error that i also can't quick fix or anything
Except when i go to the general preferences and add this java.util.stream.Collectors to the favorites
But that is not so nice that i need to add static methods (or classes having static methods) to a favorites list that is even not tied to the stuff i can check it (that favorites is not an option the the project settings)
Why is it not possible for eclipse to just be able to under stand that when i type "toList" it will give me an option of all the possible static imports i can do?
We also have our self a few utilitly classes with a lot of static methods that we can use, but also those will not be found out of the box by eclipse. And yes the same problem is happening eclipse now and then really removes those imports completely (i think because of a clean imports action where it thinks it doesn't need it anymore)
Is it not possible for eclipse to build up an index where all static imports are registered?
Or at least add a lot of pure java static stuff into a list (but then the question comes up why does this work but this doesn't....)
Contributor guide
Assessment
This issue has not been assessed yet.