Class JavacMethodIntrospector
java.lang.Object
org.inferred.freebuilder.processor.model.MethodIntrospector
org.inferred.freebuilder.processor.model.javac.JavacMethodIntrospector
Implementation of
MethodIntrospector for javac.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classData object retuned byOWN_METHOD_INVOCATIONS_FETCHER.Nested classes/interfaces inherited from class org.inferred.freebuilder.processor.model.MethodIntrospector
MethodIntrospector.OwnMethodInvocationVisitor -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.sun.source.util.SimpleTreeVisitor<JavacMethodIntrospector.TreeAnalysis, ?> Tree visitor to find all method invocations that are guaranteed to be hit.private static final com.sun.source.util.TreeScanner<?, BiConsumer<com.sun.source.tree.MethodInvocationTree, Name>> private static final com.sun.source.util.SimpleTreeVisitor<Name, ?> Returns the name of an identifier or a this member selection.private static final com.sun.source.util.TreeScanner<com.sun.source.tree.ReturnTree, ?> Tree scanner to return any ReturnTree, or null if none is present.private final com.sun.source.util.Trees -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns 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 MethodIntrospectorReturns aMethodIntrospectorimplementation for the given javac environment.voidvisitAllOwnMethodInvocations(ExecutableElement method, MethodIntrospector.OwnMethodInvocationVisitor visitor) Callsvisitorwith every method invoked onthisin the given method, if method introspection is supported on this compiler.
-
Field Details
-
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_FETCHERTree visitor to find all method invocations that are guaranteed to be hit. -
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_FINDERTree scanner to return any ReturnTree, or null if none is present. -
OWN_METHOD_INVOCATIONS_VISITOR
private static final com.sun.source.util.TreeScanner<?,BiConsumer<com.sun.source.tree.MethodInvocationTree, OWN_METHOD_INVOCATIONS_VISITORName>>
-
-
Constructor Details
-
JavacMethodIntrospector
private JavacMethodIntrospector(com.sun.source.util.Trees trees)
-
-
Method Details
-
instance
Returns aMethodIntrospectorimplementation for the given javac environment.- Throws:
IllegalArgumentException- if the environment is not from javac
-
getOwnMethodInvocations
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(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
-