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.static final recordA qualified name, split into the part before the last period and the part after it. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable List<AnnotationFileResource> allAnnotationFiles(String location, AnnotationFileUtil.AnnotationFileType fileType) Returns annotation files found at a given file system location (does not look on classpath).findFileSystemLocation(String location) Returns the file system location that a path names.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).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.
-
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:
- the type name and the member name
-
findFileSystemLocation
Returns the file system location that a path names. Looks for it as an absolute path or relative to the current directory, then relative to theuser.dirsystem property, then relative to thetest.srcsystem property (which jtreg sets to the directory that contains the test).- Parameters:
location- a relative or absolute path- Returns:
- the file or directory that
locationnames, or null if none exists
-
allAnnotationFiles
public static @Nullable List<AnnotationFileResource> allAnnotationFiles(String location, AnnotationFileUtil.AnnotationFileType fileType) Returns annotation files found at a given file system location (does not look on classpath).- Parameters:
location- an annotation file (stub file or ajava file), a jarfile, or a directory. Look for it as described infindFileSystemLocation(java.lang.String).fileType- file type of files to collect- Returns:
- annotation files with the given file type found in the file system (does not look on classpath). Returns null if the file system location does not exist; the caller may wish to issue a warning in that case.
-
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
-