Translate a Java Parser AST into a CPG AST
- Companion:
- object
Value members
Concrete methods
The below representation for constructor invocations and object creations was chosen for the sake of consistency
with the Java frontend. It follows the bytecode approach of splitting a constructor call into separate alloc
and
init
calls.
The below representation for constructor invocations and object creations was chosen for the sake of consistency
with the Java frontend. It follows the bytecode approach of splitting a constructor call into separate alloc
and
init
calls.
There are two cases to consider. The first is a constructor invocation in an assignment, for example:
Foo f = new Foo(42);
is represented as
Foo f =
The second case is a constructor invocation not in an assignment, for example as an argument to a method call. In this case, the representation does not stay as close to Java as in case
- In particular, a new BLOCK is introduced to contain the constructor invocation. For example:
foo(new Foo(42));
is represented as
foo({ Foo temp = alloc(); temp.init(42); temp })
This is not valid Java code, but this representation is a decent compromise between staying faithful to Java and being consistent with the Java bytecode frontend.
Entry point of AST creation. Translates a compilation unit created by JavaParser into a DiffGraph containing the corresponding CPG AST.
Entry point of AST creation. Translates a compilation unit created by JavaParser into a DiffGraph containing the corresponding CPG AST.
Inherited methods
Absolute path for the given file name
Absolute path for the given file name
- Inherited from:
- AstCreatorBase
For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.
For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.
- Inherited from:
- AstCreatorBase
For a given call node, arguments, and optionally, a receiver, create an AST that represents the call site. The main purpose of this method is to automatically assign the correct argument indices.
For a given call node, arguments, and optionally, a receiver, create an AST that represents the call site. The main purpose of this method is to automatically assign the correct argument indices.
- Inherited from:
- AstCreatorBase
For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.
For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.
- Inherited from:
- AstCreatorBase
Create a global namespace block for the given filename
Create a global namespace block for the given filename
- Inherited from:
- AstCreatorBase
Creates an AST that represents an entire method, including its content.
Creates an AST that represents an entire method, including its content.
- Inherited from:
- AstCreatorBase
Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.
Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.
- Inherited from:
- AstCreatorBase
Create a method return node
Create a method return node
- Inherited from:
- AstCreatorBase
Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.
Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.
- Inherited from:
- AstCreatorBase
For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.
For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.
- Inherited from:
- AstCreatorBase