Record Class WholeProgramInferenceJavaParserStorage.CompilationUnitAnnos
- Record Components:
compilationUnit- compilation unit being wrappedtypes- wrappers for classes and interfaces incompilationUnit
- All Implemented Interfaces:
org.plumelib.util.DeepCopyable<WholeProgramInferenceJavaParserStorage.CompilationUnitAnnos>
- Enclosing class:
WholeProgramInferenceJavaParserStorage
The wrappers in types, and the wrappers they contain, hold references to JavaParser
nodes within compilationUnit. Every CompilationUnitAnnos for a given source
file, including the ones produced by deepCopy(), refers to the same JavaParser AST.
-
Constructor Summary
ConstructorsConstructorDescriptionCompilationUnitAnnos(com.github.javaparser.ast.CompilationUnit compilationUnit) Constructs a wrapper around the given compilation unit.CompilationUnitAnnos(com.github.javaparser.ast.CompilationUnit compilationUnit, List<WholeProgramInferenceJavaParserStorage.ClassOrInterfaceAnnos> types) Creates an instance of aCompilationUnitAnnosrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.github.javaparser.ast.CompilationUnitReturns the value of thecompilationUnitrecord component.deepCopy()final booleanIndicates whether some other object is "equal to" this one.com.github.javaparser.ast.body.TypeDeclaration<?> Returns the top-level type declaration namednamein the compilation unit.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Returns a verbose printed representation of this.voidtransferAnnotations(BaseTypeChecker checker) Transfers all annotations inferred by whole program inference for the wrapped compilation unit to their corresponding JavaParser locations.types()Returns the value of thetypesrecord component.
-
Constructor Details
-
CompilationUnitAnnos
public CompilationUnitAnnos(com.github.javaparser.ast.CompilationUnit compilationUnit) Constructs a wrapper around the given compilation unit.- Parameters:
compilationUnit- compilation unit to wrap
-
CompilationUnitAnnos
public CompilationUnitAnnos(com.github.javaparser.ast.CompilationUnit compilationUnit, List<WholeProgramInferenceJavaParserStorage.ClassOrInterfaceAnnos> types) Creates an instance of aCompilationUnitAnnosrecord class.- Parameters:
compilationUnit- the value for thecompilationUnitrecord componenttypes- the value for thetypesrecord component
-
-
Method Details
-
deepCopy
The wrapped
CompilationUnitis shared with, not copied into, the result: the wrappers intypesrefer to JavaParser nodes within it, so a copy of the AST would not correspond to them. Only the inference results (thetypeswrappers) are copied. Therefore, a side effect on the JavaParser AST -- notablytransferAnnotations(org.checkerframework.common.basetype.BaseTypeChecker)-- is visible in both this and the result.- Specified by:
deepCopyin interfaceorg.plumelib.util.DeepCopyable<WholeProgramInferenceJavaParserStorage.CompilationUnitAnnos>
-
transferAnnotations
Transfers all annotations inferred by whole program inference for the wrapped compilation unit to their corresponding JavaParser locations.This side-effects the wrapped JavaParser AST, which is shared with every other
CompilationUnitAnnosfor the same source file (seedeepCopy()). Calling this method repeatedly is harmless because it first removes all annotations from the AST, so each call overwrites the previous call's output rather than adding to it.- Parameters:
checker- the checker who's name to include in the @AnnotatedFor annotation
-
getClassOrInterfaceDeclarationByName
public com.github.javaparser.ast.body.TypeDeclaration<?> getClassOrInterfaceDeclarationByName(String name) Returns the top-level type declaration namednamein the compilation unit.- Parameters:
name- name of type declaration- Returns:
- the type declaration named
namein the wrapped compilation unit
-
toStringVerbose
Returns a verbose printed representation of this.- Returns:
- a verbose printed representation of this
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
compilationUnit
public com.github.javaparser.ast.CompilationUnit compilationUnit()Returns the value of thecompilationUnitrecord component.- Returns:
- the value of the
compilationUnitrecord component
-
types
Returns the value of thetypesrecord component.- Returns:
- the value of the
typesrecord component
-