The following steps describe the installation of AccessAnalysis in Eclipse 3.5 (Galileo) to 3.7 (Indigo).
- Go to menu Help and choose item Install New Software...
- In the following dialog click on Add... in the upper right corner.
- Enter a name for the new repository and as location.
- Select feature AccessAnalysis and follow the next steps in the installation dialog.
Analyze Java projects
Once you have installed the AccessAnalysis plug-in, you can analyze your Java projects by simply clicking right on them (e.g. in the Package Explorer) and choosing Analyze Access from the context menu. You can select one project or multiple projects and analyze them altogether.
After the analysis is finished, the AccessAnalysis View will come up and show the results in a tree-like table.
The results of the analysis are shown in a table with five columns and structured in a tree with five levels. The levels of the tree represent the hierarchy of the source code units: projects, source folders, packages, types and methods. The columns of the table are:
- Element: The name of the source code unit.
- IGAT: The unit's IGAT value which is calculated as follows: IGAT = T* / T with
- T* : Number of included types with actual access modifier more generous than the corresponding minimal access modifier
- T : Total number of included types
- IGAM: The unit's IGAM value which is calculated as follows: IGAM = M* / M with
- M* : Number of included methods with actual access modifier more generous than the corresponding minimal access modifier
- M : Total number of included methods
- Minimal Access (types and methods only): The unit's minimal access modifier, which is the most restrictive access
modifier that allows all existing usages of the particular type or member from inside all analyzed projects.
Usage means any reference to the type or method that needs access rights.
If a type or method is not used at all in the entire projects, the pseudo access modifier not used is assigned.
- Actual Access (types and methods only): The access modifier actually assigned to the unit in the source code. Higlighted red when deviating from minimal access.
In the results table, you can double-click on a type or method to jump to the corresponding code line.
If you want the minimal access modifiers of some types or methods to be not more restrictive than a particular access modifier, you can set up exceptional rules by using annotations. Therefore you have configure the annotation types in the properties of the analyzed projects.
- Open the properties of your project and go to AccessAnalysis => Annotations.
- Here you can add new Annotation Constraints and edit or delete existing ones.
- For the configuration of an Annotation Constraint you have to choose
- the annotation type,
- if it applies to types, methods or both and
- an access modifier of your choice.
In following analysis runs, the minimal access modifier of a type or method marked with an annotation of the configured type will be at least the chosen one.
Classes and methods that are identified to be JUnit 3 or 4 tests get public as minimal access modifier according to requirements of the test frameworks.
You can disable these features in the project properties under AccessAnalysis => JUnit constraints.
- AccessAnalysis is based on static source code analysis. Binaries are ignored.
- The analysis works only with Java. Any other documents or code in other languages, even Java Server Pages (JSP) or JVM compatible languages (e.g. Groovy), will be ignored.
- Any reference to a type or method via reflection is not considered in the analysis.