GUI Tools Tutorial
Once PPA for Eclipse is installed, you can use various GUI tools to analyze partial Java programs. This section demonstrates the main tools.
Analyzing a Java source file in a Java project
Suppose that you have a Java file, MyApplication.java, in a Java project:
This source file references classes for which you do not have the declaration (e.g., Animal). In the Package Explorer view, right-click on the MyApplication.java file and choose: PPA -> Run PPA (ICompilationUnit). A console will appear with a walk of the Abstract Syntax Tree, showing each name element with its corresponding type information:

For example, you can see that the node new Animal()
is associated with the method binding
void p1:Animal:<init>()
, which is the binding of the constructor of type
p1.Animal
. The standard Eclipse compiler would usually not produce this binding, because the
declaration of Animal
is missing. If you look further down in the console, you will see that
the binding associated with the printInfo method is: UNKNOWNP.UNKNOWN
p1.Animal:printInfo(int,java.lang.String)
. In this case, PPA has inferred the container of the
method, the parameters' types and the container's type.
Analyzing a Java source file
It is also possible to analyze a complete Java source file that is not in a Java project:

Again, this source file references classes for which you do not have the declaration such as
Animal
and also java.lang.String
. Notice that because this file is not part of a
source folder in a Java Project, the editor does not show any compiler error. In the Package
Explorer view, right-click on the MyApplication.java file and choose: PPA -> Run PPA (File). A
console will appear with a walk of the Abstract Syntax Tree, showing each name element
with its corresponding type information.
Analyzing a code snippet
It is sometimes desirable to analyze snippets of code. Currently, only lines of code that represent a method body (i.e., lines without a method header) or a class body (lines without a class header) are supported. Suppose that you have a snippet of code in a text file:

This source file references classes for which you do not have the declaration such as
Animal
and also java.lang.String
. In the Package Explorer view,
right-click on the Snippet.txt file and choose: PPA -> Run PPA (Method Body Snippet). A console will
appear with a walk of the Abstract Syntax Tree, showing each name element with its
corresponding type information.
Analyzing a single element in a Java source file
Finally, if you want to know the binding of a particular name element (e.g., a method call, a variable, etc.), you can select a particular name in a Java editor, right-click on it and then select PPA -> Run PPA (Name):
