Skip to content
evernat edited this page Jul 8, 2017 · 3 revisions

This page is the "Frequently" Asked Questions for DCD (Dead Code Detector).

Java sources are not needed for the analysis?

No. Java sources (*.java files) are not needed. The search is made by static analysis of compiled classes (*.class or *.jar or *.war files).

Can I suppress a suspect in the analysis with @SuppressWarnings?

Not for the moment. The annotation @SuppressWarnings is not present in compiled classes and therefore cannot be used by DCD. (The retention of @SuppressWarnings is Source and not Runtime). Perhaps an annotation will be created in the dcd library at a later date in order for DCD to ignore suspects in a particular class or in a method.

But you can add a filter using regular expressions for a particular class (ex : mypackage.MyClass) or for some methods (ex : get.*) as written in the usage manual.

Why DCD logs that javax.xxx.Yyy is not found or why do I have lots of false suspects for "javax" methods?

java.* and javax.* classes are loaded in execution classpath by DCD, in order to know that toString or doGet/doPost methods are not suspects of dead code. But some javax APIs are not in the JDK and you need to manually add the jar file of needed API. Examples of such APIs are ejb, jta. The servlet api and the jsp api jar files are already included in execution classpath if you do as written in the usage manual. So if DCD logs that javax.xxx.Yyy is not found or if you have lots of false suspects for "javax" methods, add the needed jar files in execution classpath of dcd, as written in the usage manual for the servlet api.

Can I run successive analysis after modifications of classes without stopping DCD?

Yes. You can run an analysis in DCD, modify and compile your classes, and run again the analysis without stopping DCD. And you do not need to launch DCD in debug mode for that. DCD read you class files in each analysis without using java ClassLoader.

How can I help to improve Dead Code Detector?

If you want to help, you are welcome!

The simplest thing is for all of you to test your java applications with DCD and report bugs such as false positives or other problems in the issues.

You can also submit pull requests. It would be great if someone would do a maven report plugin (like checkstyle or pmd).