Class SourceFileScope

  • All Implemented Interfaces:

    public class SourceFileScope
    extends AbstractJavaScope
    This scope is the outer most scope of a Java file. A Source File can contain one ore more classes.
    • Constructor Detail

      • SourceFileScope

        public SourceFileScope​(ClassLoader classLoader)
      • SourceFileScope

        public SourceFileScope​(ClassLoader classLoader,
                               String packageImage)
    • Method Detail

      • configureImports

        public void configureImports​(List<ASTImportDeclaration> imports)
        Configures the type resolution for the symbol table.
        imports - the import declarations
      • getExplicitImports

        public Set<String> getExplicitImports()
      • hasAuxclasspath

        public boolean hasAuxclasspath()
        Whether an auxclasspath has been configured or not. This can be used to enable/disable more detailed symbol table analysis and type resolution can be used - or to fall back to more simple implementation.
        true if the auxclasspath is configured and types can be resolved reliably.
        See Also:
      • resolveType

        public Class<?> resolveType​(String name)
        Tries to resolve a class by name.
        name - the name of the class
        the class or null if no class could be found
      • getPackageName

        public String getPackageName()
      • getClassDeclarations

        public Map<ClassNameDeclaration,​List<net.sourceforge.pmd.lang.symboltable.NameOccurrence>> getClassDeclarations()
        Convenience method that casts the declarations to ClassNameDeclarations.
        all class name declarations
        See Also:
      • getQualifiedTypeNames

        public Map<String,​net.sourceforge.pmd.lang.ast.Node> getQualifiedTypeNames()
        Returns a set of all types defined within this source file. This includes all top-level types and nested types.
        set of all types in this source file.