Class JavacMethodIntrospector

    • 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
    • Constructor Detail

      • JavacMethodIntrospector

        private JavacMethodIntrospector​(com.sun.source.util.Trees trees)
    • Method Detail

      • instance

        public static MethodIntrospector instance​(javax.annotation.processing.ProcessingEnvironment env)
        Returns a MethodIntrospector implementation 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: MethodIntrospector
        Returns a set of methods which are definitely invoked on this in the given method, or the empty set if method introspection is not supported on this compiler.
        Specified by:
        getOwnMethodInvocations in class MethodIntrospector
      • visitAllOwnMethodInvocations

        public void visitAllOwnMethodInvocations​(javax.lang.model.element.ExecutableElement method,
                                                 MethodIntrospector.OwnMethodInvocationVisitor visitor)
        Description copied from class: MethodIntrospector
        Calls visitor with every method invoked on this in 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:
        visitAllOwnMethodInvocations in class MethodIntrospector