Run structural checker on Java code

To run the structural checker from inside Eclipse, follow these 3 steps:

  1. Open launch configuration wizard
  2. Create a new analysis launch configuration
  3. Run the analysis launch configuration

Open launch configuration wizard
In a Java perspective or Plug-in Development perspective, the main menu toolbar should show an Analysis drop-down menu between "Projects" and "Run" . Select and click on Application Analysis....

Remark: You can also access the same menu items via main toolbar.

This dialog box should appear:
Create new analysis launch configuration
Right click on Analysis and select New.
Open the following wizard:
Note: If any of these tabs are missing, it indicates some problem during the installation process.

Only the first three tabs are necessary for a proper run of structural analysis. Let's examine them in detail.

Input tab

The Input tab is used to specify the set of projects you want to analyze. You can choose
  • The complete workspace.
  • A set of projects related to a working set definition.
  • A set of specific projects you select.
    Note: You may observe that when selecting a given project, others become automatically selected. This reflects build dependencies deduced from the Eclipse workspace. It is strongly recommended that you respect these dependencies, but you can safely uncheck the box(es) for other(s) project(s) if desired.

SAFE will examine the class files (i.e., the Java byte code) for the chosen projects. SAFE does not require source code, but if source code is available, the SAFE findings can provide the appropriate links back to source.

Remark: It is important that you use a up-to-date compiled version of your current project(s). If you disabled the automatic build feature in Eclipse (by unchecking Project > Build Automatically), then you might need to rebuild the relevant projects before starting analysis.

Domain tab

Here's a snapshot of the Domain tab.
Each checker can process a set of rules. Each rule indicates a specific code smell or bug. The rules available fall into two main categories
  1. Structural and,
  2. TypeState.

Each category provides sub-categories.
In order to run a structural analysis, check Structural rules. For typestate analysis, check TypeState rules. You can also select a mix in which case the structural checker will run first, followed by typestate rules.

For example, to select all structural rules:

JRE tab

You might need to configure this tab to indicate the target JRE for analysis.
By default, the launch configuration will select the libraries for the default JRE identified in your Eclipse environment. If it is not adequate, then select an alternate JRE appropriately.
Run analysis launch configuration
Having configured an Analysis launcher, simply click on the Run button.
Privacy |  Legal |  Feedback |  IBM Home |  Research Home |  Project List |  Research Sites |  Contact Us