Class DCD

  extended by net.sourceforge.pmd.dcd.DCD

public class DCD
extends java.lang.Object

The Dead Code Detector is used to find dead code. What is dead code? Dead code is code which is not used by other code? It exists, but it not used. Unused code is clutter, which can generally be a candidate for removal.

When performing dead code detection, there are various sets of files/classes which must be identified. An analogy of the dead code analysis as a foot race is used to help clarify each of these sets:

  1. The direct users is the set of Classes which will always be parsed to determine what code they use. This set is the starting point of the race.
  2. The indirect users is the set of Classes which will only be parsed if they are accessed by code in the direct users set, or in the indirect users set. This set is the course of the race.
  3. The dead code candidates are the set of Classes which are the focus of the dead code detection. This set is the finish line of the race.

Typically there is intersection between the set of direct users, indirect users and dead code candidates, although it is not required. If the sets are defined too tightly, there the potential for a lot of code to be considered as dead code. You may need to expand the direct users or indirect users sets, or explore using different options.

Ryan Gustafson ,

Constructor Summary
Method Summary
static void dump(UsageGraph usageGraph, boolean verbose)
static void main(java.lang.String[] args)
static void report(UsageGraph usageGraph, boolean verbose)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public DCD()
Method Detail


public static void dump(UsageGraph usageGraph,
                        boolean verbose)


public static void report(UsageGraph usageGraph,
                          boolean verbose)


public static void main(java.lang.String[] args)
                 throws java.lang.Exception

Copyright © 2002-2011 InfoEther. All Rights Reserved.