Class UnusedImportsCheck.Frame
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame
- Enclosing class:
UnusedImportsCheck
Holds the names of referenced types and names of declared inner types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionNested types declared in the current scope.private final UnusedImportsCheck.FrameParent frame.Set of references - possibly to imports or locally declared types. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFrame(UnusedImportsCheck.Frame parent) Private constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddDeclaredType(String type) Adds new inner type.(package private) voidaddReferencedType(String type) Adds new type reference to the current frame.(package private) voidaddReferencedTypes(Collection<String> types) Adds new inner types.(package private) static UnusedImportsCheck.FrameCreates a new top-level frame for the compilation unit.(package private) voidfinish()Filters out all references to locally defined types.(package private) booleanisReferencedType(String type) Checks whether this type name is used in this frame.(package private) UnusedImportsCheck.Framepop()Pulls all referenced types up, except those that are declared in this scope.(package private) UnusedImportsCheck.Framepush()Creates new inner frame.
-
Field Details
-
parent
Parent frame. -
declaredTypes
Nested types declared in the current scope. -
referencedTypes
Set of references - possibly to imports or locally declared types.
-
-
Constructor Details
-
Frame
Private constructor. UsecompilationUnit()to create a new top-level frame.- Parameters:
parent- the parent frame
-
-
Method Details
-
addDeclaredType
Adds new inner type.- Parameters:
type- the type name
-
addReferencedType
Adds new type reference to the current frame.- Parameters:
type- the type name
-
addReferencedTypes
Adds new inner types.- Parameters:
types- the type names
-
finish
void finish()Filters out all references to locally defined types. -
push
Creates new inner frame.- Returns:
- a new frame.
-
pop
Pulls all referenced types up, except those that are declared in this scope.- Returns:
- the parent frame
-
isReferencedType
Checks whether this type name is used in this frame.- Parameters:
type- the type name- Returns:
trueif the type is used
-
compilationUnit
Creates a new top-level frame for the compilation unit.- Returns:
- a new frame.
-