rdonuk
rdonuk

Reputation: 3956

Find unused public members in Eclipse

I have a class which has 1600 public static members. I must found and delete the unused ones. Is there a way to do it in Eclipse.

Upvotes: 10

Views: 7023

Answers (2)

vkg
vkg

Reputation: 1859

Ucdetector: You can install a plugin from this link. It works pretty well we have been using it in all our projects. It generates a html report as well it can mark warnings in eclipse. It helps you find unused classes, methods and variables. Only thing it dosen't do well is finding if a class is used via reflection only or where instance is created via spring. In these cases it still shows that class is unused.

http://ucdetector.sourceforge.net/update

Another thing you can do to clean up other types of unsed code is GoTo Window>Preferences>Java>Compiler>Error/Warnings

enter image description here Now look for uncessary code section and tweak the settings as you desire to cleanup further.

I hope it helps :)

Upvotes: 8

VincentDS
VincentDS

Reputation: 310

There exists a Eclipse plugin Unused Code Detector (http://www.ucdetector.org/). It can process a specific file or the entire project, searching for unused members/methods.

Upvotes: 11

Related Questions