Community
Participate
Working Groups
It would be nice if the compiler could flag unused libraries in the Build Path with a warning (that is, libraries that aren't needed to compile the project). Possibly with a quick fix to remove the library from the Build Path.
Would be on the builder side.
*** Bug 161133 has been marked as a duplicate of this bug. ***
Trivial addition for batch compiler or full build scenario. For incremental, we would need to record new dependencies so as for instance that a JAR is no longer needed after a one line change. Feels more like a static analysis tool request (like find all deadcode etc...)
Could also be implemented as a one time action (user could trigger it when configuring the classpath).
That would work, either as part of the JDT UI "Clean Up" wizard, or in a separate Build path cleanup action.
In theory, nothing would prevent us from maintaining a cache of CUs to classpath entries relationships at the project level, and to refresh it according to newest builds (whenever a CU needs to be compiled again, the cache is purged from its associated entries). Looking at the code though, it is clear that a few tools needed to do so (like getting the link from a name environment answer back to its classpath entry, if any) are not in place. Since this is in the builder area, I'll ask Kent to take over anyway.