4.3.1. Java Model

Sonargraph parses the Java byte code (i.e. the .class files) for the static analysis. For a basic analysis, it is sufficient to specify the directories where the compiled byte code can be found. For a more advanced analysis like the detection of duplicate code blocks and the direct navigation to references in the source code, the source root directories are required (recommended). If the source file is available for a found type (class, interface, ...) the compilation unit is created underneath the corresponding source root directory. If no source can be found the compilation unit is created under the corresponding directory where the byte code was found. The following diagram shows the domain model for Java.

Java Domain Model
Figure 4.3. Java Domain Model


For inner classes and anonymous inner classes the correct nesting of Java compilation units is applied to types and methods respectively. This is not shown in the diagram for simplicity reasons.

All classes found in the byte code of the specified workspace are part of the system. Classes that are referenced by these classes but cannot be found in the given root directories are not part of the workspace and appear in the "External" node.