
|
 |
|
Java Mutability Analyzer
|  |
| The Mutability Analyzer Tool is an implementation of the analysis that focuses on detecting the mutability of class variables in order to avoid isolation problems. The implementation incorporates intra- and inter-procedural data-flow analyses and is shown to be highly scalable. Our experimental results demonstrate the effectiveness of the algorithms. The prototype successfully categorizes class variables, instance variables, and classes of the Java runtime code. |
|
 |
We focus on mutability analysis of Java components with the main contribution being in the development of efficient data-flow analysis, which accepts an arbitrary set of classfiles, and determines various mutability characteristics. For example, it can determine whether or not any of the following are mutable or immutable:
- static variable
- instance variable
- object
- field
- class
Immutability of a variable means that its state never changes after the variable is considered to be created. A similar notion copes with the immutability of an object as an aggregation of instance variables. We distinguish between:
- the local state of a variable, which is the value held in it, and
- the global state of a variable, which is a collection of all the local states of the variables reachable from it.
Our work is original in that it applies data-flow analysis in the realm of open-world analysis, where all the code to be executed is not necessarily available at the time of analysis. The mutability analysis identifies locations in the analyzed code where a variable state may be modified, as well as locations in the code that expose a reachable variable to potential modification by code outside the analysis scope. If no such locations exist, the variable is identified as immutable.
Our implementation uses core libraries that were implemented as part of Toad:
- The CFParse library allows the user to read and write classfiles, as well as edit them.
- The JAN library collects and manipulates static information about a Java component (e.g., application, applet, or servlet) by analyzing a set of classfiles, and effectively constructing the component reference, hierarchy and call graphs.
For more information, see the Toad's project page.
The Mutability Analyzer architecture consists of three layers as illustrated in the figure below:
- Core libraries, each providing a particular abstraction of the component.
- Utility modules, each performing an analysis that is supposed to be used in several contexts.
- Mutability sub-analyses, each serving to test mutability conditions.
We have observed a wide spectrum of areas in which mutability information is applicable. Examples of such areas are security, code optimization, code analysis, and software testing. We have been primarily motivated by identification of isolation faults.
Publications
|
 |
|
- Sara Porat, Bilha Mendelson, and Irina Shapira, "Sharpening Global Static Analysis to Cope with Java", Proceedings of CASCON '98 pp . 303-316.
- S. Porat, M Biberstein, L. Koved, and B. Mendelson, "Automatic Detection of Immutable Fields in Java", CASCON '2000.
- A. Zaks, V. Feldman, and N. Aizikowitz, "Sealed Calls in Java Packages", OOPSLA, 2000.
- Sara Porat, Marina Biberstein, and Yossi Gil, "Sealing, Encapsulation, and Immutability" published and presented in ECOOP 2001.
|
 |
|
 |
|