Class DCD

  • public final 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 <[email protected]>
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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
    • Method Detail

      • dump

        public static void dump​(UsageGraph usageGraph,
                                boolean verbose)
      • report

        public static void report​(UsageGraph usageGraph,
                                  boolean verbose)
      • main

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