public interface

IJavaElement

com.pnfsoftware.jeb.core.units.code.java.IJavaElement
Known Indirect Subclasses

Class Overview

Top-level interface for all elements of a Java Abstract Syntax Tree.

Each AST element implements this interface or one of the sub-interfaces.

Summary

Constants
int FLAG_BUILT
int FLAG_FIELD_REFERENCES_OUTERCLASS
int FLAG_LAMBDA_CLASS
int FLAG_LAMBDA_IMPL
int FLAG_OPTIONAL_RENDERING
int FLAG_SECOND_PARAMETER_IS_OUTER_REF
int FLAG_STICKY
Public Methods
abstract void addFlags(int f)
Add flags to the current list of flags on this element.
abstract Object addTag(String key, Object value)
Add a tag.
abstract boolean canCauseException()
This non-recursive method indicates whether or not this element may be the cause of an exception.
abstract void collectAllPhysicalOffsets(Collection<Integer> physicalOffsets)
Collect physical offsets for this element and all its constituents.
abstract IJavaElement duplicate()
Duplicate this element.
abstract void generate(JavaOutputSink out)
Generate this AST element recursively into a sink.
abstract Object getData(Object key)
Retrieve a piece of data attached to this AST element.
abstract JavaElementType getElementType()
This method returns the type of Java AST element held by this object.
abstract int getFlags()
Retrieve the flags set on this element.
abstract String getOrigin()
abstract int getPhysicalOffset()
Retrieve the low-level offset that map to this AST element.
abstract JavaReconAnon getReconAnon()
abstract JavaReconEnum getReconEnum()
abstract JavaReconEnummap getReconEnummap()
abstract JavaReconLambda getReconLambda()
abstract List<IJavaElement> getSubElements()
Get the list of AST elements that constitute this AST element.
abstract Map<String, Object> getTags()
Get a read-only collection of the current tag map.
abstract boolean hasFlags(int f)
Determine whether any flags have been set on this element.
abstract boolean hasPhysicalOffset()
Determine whether a physical offset is attached to this element.
abstract boolean isReconArtifact()
abstract void removeFlags(int f)
Remove some flags from this element.
abstract Object removeTag(String key)
Remove a tag.
abstract boolean replaceSubElement(IJavaElement oldElement, IJavaElement newElement)
Replace one element by another one.
abstract void setData(String key, Object value)
Attach a piece of arbitrary data to this AST element.
abstract void setFlags(int f)
Set flags on this element.
abstract void setLambdaRecon(JavaReconLambda recon)
abstract void setOrigin(String origin)
abstract void setPhysicalOffset(int offset)
Set a low-level physical offset to this AST element.
abstract void setReconAnon(JavaReconAnon recon)
abstract void setReconEnum(JavaReconEnum recon)
abstract void setReconEnummap(JavaReconEnummap recon)
abstract String toShortString()
Generate a short-string version of this element.
abstract boolean visitDepthPost(IJVisitor visitor, IJavaElement parent, JVisitResults results, boolean doNotVisitBlocksInsideCompounds)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(IJVisitor visitor)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(IJVisitor visitor, IJavaElement parent)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPost(IJVisitor visitor, IJavaElement parent, JVisitResults results)
Depth-first search, post-order visit of an expression tree or sub-tree.
abstract boolean visitDepthPre(IJVisitor visitor, IJavaElement parent)
Visit this AST tree.
abstract boolean visitDepthPre(IJVisitor visitor)
Visit this AST tree.
abstract boolean visitDepthPre(IJVisitor visitor, IJavaElement parent, JVisitResults results)
Visit this AST tree.

Constants

public static final int FLAG_BUILT

Constant Value: 1 (0x00000001)

public static final int FLAG_FIELD_REFERENCES_OUTERCLASS

Constant Value: 64 (0x00000040)

public static final int FLAG_LAMBDA_CLASS

Constant Value: 32 (0x00000020)

public static final int FLAG_LAMBDA_IMPL

Constant Value: 16 (0x00000010)

public static final int FLAG_OPTIONAL_RENDERING

Constant Value: 4 (0x00000004)

public static final int FLAG_SECOND_PARAMETER_IS_OUTER_REF

Constant Value: 2 (0x00000002)

public static final int FLAG_STICKY

Constant Value: 256 (0x00000100)

Public Methods

public abstract void addFlags (int f)

Add flags to the current list of flags on this element. See FLAG_xxx for a list of legal flags.

public abstract Object addTag (String key, Object value)

Add a tag. See getTags().

public abstract boolean canCauseException ()

This non-recursive method indicates whether or not this element may be the cause of an exception. In order to recursively check if the element throws (e.g., for a statement), use JUtil#canThrow(IStatement).

public abstract void collectAllPhysicalOffsets (Collection<Integer> physicalOffsets)

Collect physical offsets for this element and all its constituents. The first element added is for this one, followed by the sub-elements's.

Parameters
physicalOffsets output collection

public abstract IJavaElement duplicate ()

Duplicate this element.

Returns
  • a (possibly) duplicated object of the same type

public abstract void generate (JavaOutputSink out)

Generate this AST element recursively into a sink.

public abstract Object getData (Object key)

Retrieve a piece of data attached to this AST element.

public abstract JavaElementType getElementType ()

This method returns the type of Java AST element held by this object.

public abstract int getFlags ()

Retrieve the flags set on this element. See FLAG_xxx for a list of legal flags.

public abstract String getOrigin ()

public abstract int getPhysicalOffset ()

Retrieve the low-level offset that map to this AST element.

Returns
  • a physical method offset, -1 if none is available

public abstract JavaReconAnon getReconAnon ()

public abstract JavaReconEnum getReconEnum ()

public abstract JavaReconEnummap getReconEnummap ()

public abstract JavaReconLambda getReconLambda ()

public abstract List<IJavaElement> getSubElements ()

Get the list of AST elements that constitute this AST element. Typically, for simple statements, it may be expression. For complex expressions, it may be simpler expressions. For compound statements, it may more statements and expressions.

Note that type and annotation elements are not returned by this method.

Returns
  • the list of constituting elements, may be empty but never null

public abstract Map<String, Object> getTags ()

Get a read-only collection of the current tag map. Tags are special key-value pairs that can be attached to AST elements and rendered during AST generation.

public abstract boolean hasFlags (int f)

Determine whether any flags have been set on this element. See FLAG_xxx for a list of legal flags.

public abstract boolean hasPhysicalOffset ()

Determine whether a physical offset is attached to this element.

public abstract boolean isReconArtifact ()

public abstract void removeFlags (int f)

Remove some flags from this element. See FLAG_xxx for a list of legal flags.

public abstract Object removeTag (String key)

Remove a tag. See getTags().

public abstract boolean replaceSubElement (IJavaElement oldElement, IJavaElement newElement)

Replace one element by another one. Only the references are compared, no equals/deep compare. At most one element is replaced.

Note that type and annotation elements cannot be replaced using this method.

Parameters
oldElement the element to be replaced
newElement the new element

public abstract void setData (String key, Object value)

Attach a piece of arbitrary data to this AST element.

public abstract void setFlags (int f)

Set flags on this element. See FLAG_xxx for a list of legal flags.

public abstract void setLambdaRecon (JavaReconLambda recon)

public abstract void setOrigin (String origin)

public abstract void setPhysicalOffset (int offset)

Set a low-level physical offset to this AST element.

public abstract void setReconAnon (JavaReconAnon recon)

public abstract void setReconEnum (JavaReconEnum recon)

public abstract void setReconEnummap (JavaReconEnummap recon)

public abstract String toShortString ()

Generate a short-string version of this element.

public abstract boolean visitDepthPost (IJVisitor visitor, IJavaElement parent, JVisitResults results, boolean doNotVisitBlocksInsideCompounds)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
doNotVisitBlocksInsideCompounds true to avoid exploring the sub-blocks of compound statements (e.g., if true, when visiting an if-statements, the predicate expressions will be visited, but the if-blocks will not)
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (IJVisitor visitor)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (IJVisitor visitor, IJavaElement parent)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPost (IJVisitor visitor, IJavaElement parent, JVisitResults results)

Depth-first search, post-order visit of an expression tree or sub-tree. The node being visited may be replaced without notifying the visitor.

Parameters
visitor the visitor object
Returns
  • true if the visit was successful

public abstract boolean visitDepthPre (IJVisitor visitor, IJavaElement parent)

Visit this AST tree. Processing of a node is done before visiting the children.

public abstract boolean visitDepthPre (IJVisitor visitor)

Visit this AST tree. Processing of a node is done before visiting the children.

public abstract boolean visitDepthPre (IJVisitor visitor, IJavaElement parent, JVisitResults results)

Visit this AST tree. Processing of a node is done before visiting the children.