|
|
AboutUCDetector (Unnecessary Code Detector - pronounced "You See Detector") is a eclipse PlugIn tool to find unnecessary (dead) public java code. For example public classes, methods or fields which have no references. UCDetector creates markers for the following problems, which appear in the eclipse problem view:
|
If you can't see the pop menu above, read FAQ |
Get UCDetectorUCDetector needs Eclipse >= 3.5 and java >= 5.0. (For older versions: Eclipse 3.2, RAD, Eclipse 3.3, 3.4 )Download:
http://ucdetector.sourceforge.net/update
Quick startInstead of clicking Shift+Ctrl+G (search references in workspace) all the time, follow the next steps:
Really want to change code?The problems found by UCDetector, are only suggestions. Before changing code, you should really know what you are doing! If UCDetector tells you, that there are no references your code still may be used by:
Change visibility may cause problems with inheritance, reflection, instantiation... It's good idea to do a full text search in workspace for the piece of code, you want to change. |
![]() |
Change code, use QuickFixes!After checking carefully all the possibilities above, maybe you decide to change your code. Click on the marker to see QuickFixes's to change code:
|
![]() |
Ignore code// NO_UCD/** * Class is only used by reflection. * Write a // NO_UCD comment at the end of the line. * This line will be ignored by UCDetector. */ public class BeanExample { // NO_UCD @SuppressWarnings("ucd")/** * Class is only used by reflection. * Add a @SuppressWarnings("ucd") annotation. * This class/method/field will be ignored by UCDetector. */ @SuppressWarnings("ucd") public class BeanExample { @UsedBy("reflection")I don't like this one, but users asked for it:If you want to "polute" your code, you can use the @org.ucdetector.util.UsedBy
annotation located inside ucdetector-annotations.jar which is inside org.ucdetector.source_x.y.z.zip.
/** * Class is only used by reflection. * Add a @SuppressWarnings("ucd") annotation. * This class/method/field will be ignored by UCDetector. */ @UsedBy("reflection") public class BeanExample { |
Set eclipse compiler setting "Unhandled token in '@SuppressWarnings'" to IgnoreTo avoid eclipse Warnings "Unsupported @SuppressWarnings("ucd")" |
| Last Update: 2011-11-16 | Copyright © 2011, by Jörg Spieler |
|
Page views since 2008-03-01:
|
Hosted by:
|