--- /dev/null 2011-08-09 17:16:04.000000000 -0700 +++ new/make/tools/classanalyzer/classanalyzer.html 2011-08-09 17:16:03.000000000 -0700 @@ -0,0 +1,131 @@ + + + + + + + ClassAnalyzer + + + +

ClassAnalyzer

+The ClassAnalyzer tool analyzes the class dependencies among +the input class files. It parses the class files, finds +all class references, assigns classes to modules per the +specified configuration files and then generates a set +of reports for each module, including the list of classes, +the list of resource files, and its dependencies on +classes from another module. + +

+Input: +

    +
  1. Class files to be analyzed
  2. +
  3. Input configuration file to include/exclude classes in modules
  4. +
+ +Output: +
    +
  1. ClassAnalyzer generated reports: + *.classlist, *.resources, *.dependencies
  2. +
  3. module-info.java for modules
  4. +
+ +The ClassAnalyzer can only find static dependencies +from the bytecode but not implicit dependencies which include +classes loaded by Class.forName, service providers, +constants inlined by the compiler, and JNI_FindClass. +In addition, it does not parse the annotations. + +

ClassAnalyzer's Configuration File

+ +Example: +
+module swingset3 {
+    // include classes in this module
+    include com.sun.swingset3.**;
+
+    // include resource files in this module
+    include META-INF/demolist;
+
+    // main entry point
+    class com.sun.swingset3.SwingSet3;
+}
+
+ + +The syntax is similar to module-info.java. +Directives are: + + +

JDK Modularization

+ +The ClassAnalyzer tool is used in the jigsaw modules build to +analyze the class dependencies amongst the JDK classes and +generate the module-info.java files for JDK modules +as a post-processing step. This is an interim solution +enabling us prototype a modular JDK and make change to +the module definitions during the course of our development, +for example, synchronizing the on-going JDK development +with the jdk8 repository. +Utimately, we will restructure the source tree so that +JDK modules will be compiled in the modulepath +that can be used for development and the image build. +Source tree restructuring has a big impact on all JDK engineers +and thus we should do this when the module definitions and +graph are close to final to minimize the disruption to the teams. + +

+The configuration file for JDK is at: + modules.config and + modules.group. + +

Help

+
+Usage: ClassAnalyzer <options>
+Options: 
+        -classpath     classpath where classes and jars will be parsed
+        -config        config file
+                       This option can be repeated to specify multiple config files.
+        -jigsawLibrary module-library-path
+                       Default is the system module library if present.
+        -moduleinfo    output dir for module-info.java.
+                       If not specified, no module-info.java will be generated.
+        -output        output dir for the generated reports
+        -properties    module's properties
+        -version       version of the modules
+
+ +