Class AnnotationFileUtil
java.lang.Object
org.checkerframework.framework.stub.AnnotationFileUtil
Utility class for annotation files (stub files and ajava files).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe types of files that can contain annotations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<AnnotationFileResource> allAnnotationFiles(File location, AnnotationFileUtil.AnnotationFileType fileType) Return annotation files found at a given file system location.static booleanisCanonicalConstructor(ExecutableElement elt, Types types) Returns true if the givenExecutableElementis the canonical constructor of a record (i.e., the parameter types of the constructor correspond to the parameter types of the record components, ignoring annotations).static Pair<@FullyQualifiedName String, String> partitionQualifiedName(String imported) Split a name (which comes from an import statement) into the part before the last period and the part after the last period.resolveAnnotationFileLocation(String location) Resolves a-Astubs-style location string to a file systemFile, trying it both as given and relative to the current working directory.
-
Constructor Details
-
AnnotationFileUtil
public AnnotationFileUtil()
-
-
Method Details
-
partitionQualifiedName
Split a name (which comes from an import statement) into the part before the last period and the part after the last period.- Parameters:
imported- the name to split- Returns:
- a pair of the type name and the field name
-
resolveAnnotationFileLocation
Resolves a-Astubs-style location string to a file systemFile, trying it both as given and relative to the current working directory. Does not look on the classpath.- Parameters:
location- an annotation file (stub file or ajava file), a jarfile, or a directory. Look for it as an absolute file and relative to the current directory.- Returns:
- the resolved file, or null if neither location exists; the caller may wish to issue a warning in that case
-
allAnnotationFiles
public static List<AnnotationFileResource> allAnnotationFiles(File location, AnnotationFileUtil.AnnotationFileType fileType) Return annotation files found at a given file system location.- Parameters:
location- an annotation file (stub file or ajava file), a jarfile, or a directory, as resolved byresolveAnnotationFileLocation(java.lang.String)fileType- file type of files to collect- Returns:
- annotation files with the given file type found under
location
-
isCanonicalConstructor
Returns true if the givenExecutableElementis the canonical constructor of a record (i.e., the parameter types of the constructor correspond to the parameter types of the record components, ignoring annotations).- Parameters:
elt- the constructor/method to checktypes- the Types instance to use for comparing types- Returns:
- true if elt is the canonical constructor of the record containing it
-