While there is no deterministic way to flag public classes, methods and fields are unused (they can be referenced by external projects) Netbeans should still provide a mechanism for doing so to help developers trim potentially unused code. Eclipse has a plugin that does this: http://www.ucdetector.org/
yes, this would be very useful.
I agree there is no way to absolutely detect unused code, but you can do it within certain scope (project, opened project, project hierarchy, package, you name it).
*** Bug 89809 has been marked as a duplicate of this bug. ***
*** Bug 236496 has been marked as a duplicate of this bug. ***
Version is meant to indicate when the problem was first reported. Please don't update it to a newer value.
*** Bug 35617 has been marked as a duplicate of this bug. ***
FYI: There is already a 3rd-party plugin for that
Source -> Inspect
with FindBugs -configuration, which will check for unused private methods:
However the dcd dead code detector does raise a lot more possible suspects and with a decent ui it could be a nice addition to nb.
The plugin you referenced is listed for Netbeans 7.3. I don't think it'll work for the latest version.
(In reply to _ gtzabari from comment #8)
> The plugin you referenced is listed for Netbeans 7.3. I don't think it'll
> work for the latest version.
It works using NB 8.0.2. I tested it some minutes ago. AFAIK the plugin integration is very thin and uses only stable NB APIs. That the reason why you can often use NB plugins from 6.x-ages in NB 8.x.
If there is any bug contact Geertjan and he can fix it or he can give you access to the sources to fix it yourself.
Thanks for the head's up. I'll check it out.
The plugin still works, however only up to java 1.7. I guess this is not a problem of the plugin but of the underlying Dead Code Detector
*** Bug 197574 has been marked as a duplicate of this bug. ***
I would *really* like it if Netbeans had first-class support for this, to include Java8 support. IntelliJ, Eclipse, and even Visual Studio all do this. Of those, Eclipse is the only one that needs a plugin to do so. Please consider this request Netbeans team, and thanks for making the best JAVA IDE out there!