Class TreeParser
- java.lang.Object
-
- org.checkerframework.javacutil.trees.TreeParser
-
public class TreeParser extends java.lang.Object
A utility class for parsing Java expression snippets, and converting them to proper Javac AST nodes.This is useful for parsing
EnsuresNonNull*
, andKeyFor
values.Currently, it handles four tree types only:
- Identifier tree (e.g.
id
) - Literal tree (e.g. 2, 3)
- Method invocation tree (e.g.
method(2, 3)
) - Member select tree (e.g.
Class.field
,instance.method()
) - Array access tree (e.g.
array[id]
)
It's implemented via a Recursive-Descend parser.
- Identifier tree (e.g.
-
-
Constructor Summary
Constructors Constructor Description TreeParser(javax.annotation.processing.ProcessingEnvironment env)
Create a TreeParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.sun.source.tree.ExpressionTree
parseTree(java.lang.String s)
Parses the snippet in the string as an internal Javac AST expression node.
-