Class AbstractJavaParserContext<N extends Node>

    • Field Detail

      • wrappedNode

        protected N extends Node wrappedNode
    • Constructor Detail

      • AbstractJavaParserContext

        public AbstractJavaParserContext​(N wrappedNode,
                                         TypeSolver typeSolver)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getParent

        public final java.util.Optional<Context> getParent()
        Specified by:
        getParent in interface Context
        Returns:
        The parent context, if there is one. For example, a method exists within a compilation unit.
      • getScope

        protected Node getScope​(Node node)
      • solveWithAsValue

        protected java.util.Optional<Value> solveWithAsValue​(SymbolDeclarator symbolDeclarator,
                                                             java.lang.String name)
      • solveMethodAsUsage

        public java.util.Optional<MethodUsage> solveMethodAsUsage​(java.lang.String name,
                                                                  java.util.List<ResolvedType> argumentsTypes)
        Similar to solveMethod but we return a MethodUsage. A MethodUsage corresponds to a MethodDeclaration plus the resolved type variables.
        Specified by:
        solveMethodAsUsage in interface Context
      • getWrappedNode

        public N getWrappedNode()
        Description copied from interface: Context
        Returns the node wrapped in the context
        Specified by:
        getWrappedNode in interface Context
      • typePatternExprsDiscoveredInPattern

        public java.util.List<TypePatternExpr> typePatternExprsDiscoveredInPattern​(PatternExpr patternExpr)
        When looking for a variable declaration in a pattern expression, there are 2 cases: 1. The pattern expression is a type pattern expression (e.g. Foo f), in which case we can just compare the name of the variable we're trying to resolve with the name declared in the pattern. 2. The pattern expression is a record pattern expression (e.g. Foo (Bar b, Baz (...) )), in which case we need to traverse the "pattern tree" to find all type pattern expressions, so that we can compare names for all of these. In both cases, we only really care about the type pattern expressions, so this method simply does a traversal of the pattern tree to find all type pattern expressions contained in it.
        Parameters:
        patternExpr - the root of the pattern tree to traverse
        Returns:
        all type pattern expressions discovered in the tree