Class JavacMethodIntrospector
- java.lang.Object
-
- org.inferred.freebuilder.processor.model.MethodIntrospector
-
- org.inferred.freebuilder.processor.model.javac.JavacMethodIntrospector
-
public class JavacMethodIntrospector extends MethodIntrospector
Implementation ofMethodIntrospectorfor javac.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classJavacMethodIntrospector.TreeAnalysisData object retuned byOWN_METHOD_INVOCATIONS_FETCHER.-
Nested classes/interfaces inherited from class org.inferred.freebuilder.processor.model.MethodIntrospector
MethodIntrospector.OwnMethodInvocationVisitor
-
-
Field Summary
Fields Modifier and Type Field Description private static com.sun.source.util.SimpleTreeVisitor<JavacMethodIntrospector.TreeAnalysis,?>OWN_METHOD_INVOCATIONS_FETCHERTree visitor to find all method invocations that are guaranteed to be hit.private static com.sun.source.util.TreeScanner<?,java.util.function.BiConsumer<com.sun.source.tree.MethodInvocationTree,javax.lang.model.element.Name>>OWN_METHOD_INVOCATIONS_VISITORprivate static com.sun.source.util.SimpleTreeVisitor<javax.lang.model.element.Name,?>OWNED_IDENTIFIERReturns the name of an identifier or a this member selection.private static com.sun.source.util.TreeScanner<com.sun.source.tree.ReturnTree,?>RETURN_TREE_FINDERTree scanner to return any ReturnTree, or null if none is present.private com.sun.source.util.Treestrees
-
Constructor Summary
Constructors Modifier Constructor Description privateJavacMethodIntrospector(com.sun.source.util.Trees trees)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<javax.lang.model.element.Name>getOwnMethodInvocations(javax.lang.model.element.ExecutableElement method)Returns a set of methods which are definitely invoked onthisin the given method, or the empty set if method introspection is not supported on this compiler.static MethodIntrospectorinstance(javax.annotation.processing.ProcessingEnvironment env)Returns aMethodIntrospectorimplementation for the given javac environment.voidvisitAllOwnMethodInvocations(javax.lang.model.element.ExecutableElement method, MethodIntrospector.OwnMethodInvocationVisitor visitor)Callsvisitorwith every method invoked onthisin the given method, if method introspection is supported on this compiler.
-
-
-
Field Detail
-
trees
private final com.sun.source.util.Trees trees
-
OWN_METHOD_INVOCATIONS_FETCHER
private static final com.sun.source.util.SimpleTreeVisitor<JavacMethodIntrospector.TreeAnalysis,?> OWN_METHOD_INVOCATIONS_FETCHER
Tree visitor to find all method invocations that are guaranteed to be hit.
-
OWNED_IDENTIFIER
private static final com.sun.source.util.SimpleTreeVisitor<javax.lang.model.element.Name,?> OWNED_IDENTIFIER
Returns the name of an identifier or a this member selection.
-
RETURN_TREE_FINDER
private static final com.sun.source.util.TreeScanner<com.sun.source.tree.ReturnTree,?> RETURN_TREE_FINDER
Tree scanner to return any ReturnTree, or null if none is present.
-
OWN_METHOD_INVOCATIONS_VISITOR
private static final com.sun.source.util.TreeScanner<?,java.util.function.BiConsumer<com.sun.source.tree.MethodInvocationTree,javax.lang.model.element.Name>> OWN_METHOD_INVOCATIONS_VISITOR
-
-
Method Detail
-
instance
public static MethodIntrospector instance(javax.annotation.processing.ProcessingEnvironment env)
Returns aMethodIntrospectorimplementation for the given javac environment.- Throws:
java.lang.IllegalArgumentException- if the environment is not from javac
-
getOwnMethodInvocations
public java.util.Set<javax.lang.model.element.Name> getOwnMethodInvocations(javax.lang.model.element.ExecutableElement method)
Description copied from class:MethodIntrospectorReturns a set of methods which are definitely invoked onthisin the given method, or the empty set if method introspection is not supported on this compiler.- Specified by:
getOwnMethodInvocationsin classMethodIntrospector
-
visitAllOwnMethodInvocations
public void visitAllOwnMethodInvocations(javax.lang.model.element.ExecutableElement method, MethodIntrospector.OwnMethodInvocationVisitor visitor)Description copied from class:MethodIntrospectorCallsvisitorwith every method invoked onthisin the given method, if method introspection is supported on this compiler.The visitor is given the method name, and a logger to log warnings or errors to the user at the method invocation site.
- Specified by:
visitAllOwnMethodInvocationsin classMethodIntrospector
-
-