A Proposed Java Static Slicing Approach

,

Other researchers, had used data dependencies computations to introduce the incremental slicing, which is a static slicing "that computes a slice in several steps, by incorporating additional types of data dependencies at each step" [10].
In [11] the researchers introduced the program slicing for Object-Oriented Programs, Java precisely, using the data dependence analysis. Their proposed method has based on dynamic data dependence analysis and static control dependence analysis. Where in [12] they used the dependency graph structure to capture the data from the source code.
A tool to produce a lightweight slice using program and system dependency graph to produce a list of line numbers, dependent variables, aliases, and function calls that are part of the slice for all variables both local and global for the entire system. The method is implemented as a tool [13,14] Chen and Xu [15] proposed an approach to slice approach the Object-Oriented programs written in Java. They produced an approach that is distinguished data members for different objects. Furthermore, they developed a model to produce a class slicing, object slicing in addition to statement slicing for Java programs.
Another way to look at the static slicing is to look at the slicing semantic and notations. In [16] the researchers identifies and categorizes different notions of a program slice available in the literature as well as several new notions.
In addition to previously proposed tools, there are off-the-shelf tools that run static slicing For Java programs. WALA [17] includes a slicer, based on context-sensitive tabulation of reachability in the system dependence graph. It also has been expanding the set of WALA tools implemented in JavaScript.
Indus [18] is an effort to provide a collection of program analyses and transformations implemented in Java to customize and adapt Java programs. It is intended to serve as an umbrella for static analyses such as points-to analysis, escape analysis, and dependence analyses, transformations such as program slicing and program specialization via partial evaluation, and any software module that delivers the analyses/transformations into a particular application or platform.
Kaveri [18,19] is an Eclipse plug-in front-end for the Indus Java slicer. It utilizes the Indus program slicer to calculate slices of Java programs and then displays the results visually in the editor. The purpose of this project is to create an effective tool for simplifying program understanding, program analysis, program debugging and testing.
The problem: The recent program slicing tools are using a particular type of programs, such as Kavari only runs as a plugin in eclipse version 3.2. Therefore, it is not easy to deal with them especially for slicing a piece of a program.
The Proposed Solution: In this paper, we have proposed a new technique to slice Java programs, using an algorithm that checks the dependency of variables directly and indirectly.

JAVA MULTI-SLICING TOOL (JAVAMST)
JavaMST; Java Multi-Slicing Tool, can run on any operating system or platform. JavaMST main purpose is to slice the equations from any Java file or text file. It allows slice the file using backward, forward, or both slicing techniques. It determines all the variables, their direct dependencies, and indirect dependencies, and then produces the needed code. In previous work [28] we introduce the JavaBST, which is a technique only to backward slice the Java programs. In this paper, the static, backward, and forward slicing was introduced for Java programming language.
The JavaMST algorithm is divided into five main stages; Stage 1; define the path of the code file. Stage 2; determines for all the variables, its direct dependents. Stage 3; determines for each variable, its indirect dependents. Stage 4; select slicing criteria (which variable, at which line, and slicing technique). Stage 5: produce the result code and copy it to a new file.
To build the JavaMST algorithm, we created two arrays the first called resultCode, which store the lines number and the code lines after the slicing, and the second array called allVariables, which contains objects of a class called Var.
The Var class contains: 1) Name of the variable.
2) Lines (a list contains the lines where this variable is declared or assigned a value). 3) Direct dependents (an array which contains the variables and their lines number, which current variable depends on directly). 4) Indirect dependents (an array that contains the variables and their lines number which current variable depends on indirectly). To clarify the algorithm, we will use the following example as shown in Figure 1:    Example 3: Suppose that we selected the variable "b" at line 8 and total slicing then the result Code array will be : To clarify the fifth stage, the results, from the three examples in the fourth stage, will be used: The results of example 1, will be after sorting: The results of example 2, will be after sorting: The results of example 3, will be after sorting: After that, the resultCode will be exported to a new text file.

EVALUATION
JavaMST has succeeded to introduce a new slicing approach that supports three types of slicing techniques; forward, backward, and both slicing techniques. JavaMST does not need to be plugged in or work on a certain platform, such as in Indus/Kaveri or WALA.
Moreover, JavaMST read a Java code stored in a text file or a text file that does not need to be compiled nor run before slicing. Therefore, more flexibility and time saving that can be useful for a testing piece of code.
JavaMST produces a slightly small output that specifies the variable and its slices (reference variables) with line numbers. It also categorizes the slice dependency into directly or indirectly dependent. On the other side, Kaveri plug-in, it only colored the slide with yellow without showing the dependencies of it.
Since JavaMST is a simple and user-friendly slicing tool, it can be useful for educational purposes, to introduce the slicing technique to students or fresh researchers.
However, JavaMST is only sliced simple code with simple equations; it is still in the development stage. Also, it still not able to slice Object-Oriented program.

CONCLUSION
JavaMST is a multi-slicing tool, which reads a java code from a text file, extracts the variables, defined their direct and indirect dependencies and depending on the selected slicing criteria, and it produces a list of variables and their slices.
The main advantage of JavaMST that can slice an un-compiled Java program or a piece of code. However, still too simple to slice Object-Oriented programs and complex Java code.