Select menu: Window/Preferences.../UCDetector


Source folders, Packages, Classes, Methods, Fields
It is possible to ignore java elements (and all its children), which should not be checked by UCDetector. A simple regular expression is used: You can enter more than 1 entry, using the separator ","
Source folder example: src\\main\\java

Classes implementing/extending
Classes implementing or extending mentioned class or interface will be ignored during detection. Full class name necessary.

Code with annotations
Code marked with these annotations, will be ignored during detection (full class name recommended). Use class name without @. @UsedBy is automatically excluded, see also ignore code

Classes containing string:
Classes containing one of this strings, will be ignored during detection - usefull for generated code. Be careful! Entering 'class' will exclude all classes!

Ignore bean methods:
Ignore methods, which use the java bean convention. For example

public String getName();
public void setName(String name);
public boolean isValid();

UCDetector preferences

Deprecated code
Ignore code with javadoc @deprecated or annotation @Deprecated.

Ignore code with 'NO_UCD' comments or @SuppressWarnings("ucd")
Ignore UCDetector specific tags or annotations. Useful when running a full detection, to verify if tags/annotations are still OK.

What to detect

Detect code with max number of references:
Number of found references, which are necessary to mark java code as problem. 0 means: If a class has no references, mark it with UCDetector

In classes, in methods, in fields:
Select how problems should be marked. There are 3 possibilities:

Select what kind of code should be marked:

Detect code only called by tests
Markers are created when a class, method or filed is only called by test code. Test code means:

NOTE: @org.junit.Test annotations are ignored.

File search

Search class names in text files:
Select file extension, which should be searched for class name. For example "*.xml,*.jsp"

Use full qualified class name :
The character before and after the match is included in search. Searching for "Application" will NOT match "MyApplication" neither "ApplicationExample".

Searching for "Application" will match:

For nested classes use $ as separator: org.ucdetector.example.Application$NestedClass

File name pattern to search:
It is possible to add a file pattern. Full qualified class names (org.ucdetector.Example) found in this files will get no marker for "0 references found". But text search is slow, if there are many text files!

If a class is found by text search, this class will have NO markers. Even for unused methods or fields!

UCDetector preferences

UCDetector preferences


Possible use of final for methods (don't override methods):
This option will create markers for methods, which could be final. This are methods, which:

Possible use of final for fields (read-only fields):
This option will create markers for fields, which could be final. This are fields, which have no write access.

Maybe this rules are not OK for you! Anyway: Apply changes for this rule carefully.

Reduce visibility to protected or private:
Select error level for visibility. This option will create markers for code which could be protected, default or private. This is code, which has only references in same package or same class.

In some cases this may cause compile errors for classes, if there is code like this:
new A().getB().toString();
For more details, check bug: Wrong default visibility marker for classes - ID: 2539795

Don't care about warning 'Access to enclosing type':
See screenshot for eclipse warnings: Preferences, Java, Compiler Warnings: Code style, 'access to a non-accessible member of an enclosing type'

UCDetector preferences

UCDetector preferences


It is possible to create html, xml and text reports. See examples: html, xml, text
Enter directory name, to create reports.

To get links to the java source locations (code pointers), copy and paste text report to Eclipse 'Java Stack Trace Console'.

Max class cycle size:
For cycle detection you can choose the "max cycle size". If there are many cycles in your code, a big number here makes cycle detection very slow!

UCDetector preferences