Repository navigation
Conversation
…ive entries one at a time * A named archive that cannot be opened yields a warning, rather than a line on standard error. * Every "Could not read" diagnostic for an annotation file is a warning, and it includes the exception. * New `AnnotationFileUtil.forEachAnnotationFile` passes each archive entry while the archive is open, so an archive's entries need not all be in memory at once. * Parse an ajava file found on the classpath as a stub file, as is done for one found in the file system. Co-authored-by: Chimaobi Emeka-Iheonu <chimaemekaiheonu@gmail.com>
* Within a directory or archive, a hidden file or directory (one whose name starts with "."), such as the `._Foo.astub` file that macOS creates, is not read. A hidden file or directory that is named explicitly is read. * An archive within a directory is not read, and a note says so. * A named file that is not an archive and lacks the expected extension yields a warning. Co-authored-by: Chimaobi Emeka-Iheonu <chimaemekaiheonu@gmail.com>
…s; do not document -Aajava archives Also share the -Astubs search rules with -Aajava by cross-reference, and fix Javadoc.
…a parseAnnotationFileResource * A directory named in -Astubs that cannot be listed yields a warning, rather than a line on standard error. * The classpath branch of parseAnnotationFiles uses parseAnnotationFileResource, so it shares the whitespace-only check and the "Could not read" warning. * Name each open JarFile `jarFile`, consistently.
…to annotation-file-search # Conflicts: # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileUtil.java # framework/src/test/java/org/checkerframework/framework/stub/AnnotationFileUtilTest.java
…is read as a stub file
…ies one at a time AnnotationFileUtil.forEachAnnotationFile passes each annotation file to its client, and passes an archive's entries while the archive is open. An archive that cannot be opened, or a directory that cannot be listed, yields a resource whose getInputStream throws, so the client reports it. Co-authored-by: Chimaobi Emeka-Iheonu <chimaemekaiheonu@gmail.com>
…ve' into annotation-file-archive-read
…to annotation-file-archive-read # Conflicts: # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java
…ve' into annotation-file-read-warning
…to annotation-file-archive-read
…to annotation-file-search # Conflicts: # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileUtil.java
…ve' into annotation-file-read-warning
…to annotation-file-archive-read
…to annotation-file-archive-read
… remove unused methods * Read a classpath annotation file without the JDK's cache of jar files, so the jar is closed. * Test that an annotation file that starts with much whitespace is parsed, in a file and in an archive. * Check an annotation file for being whitespace-only without decoding it. * Remove SystemUtil.isWhitespaceOnly() and AnnotationFileUtil.allAnnotationFiles().
…r-writing test helper; improve Javadoc
… improve comments
…earch # Conflicts: # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileElementTypes.java # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileUtil.java # framework/src/test/java/org/checkerframework/framework/stub/AnnotationFileTestUtil.java # framework/src/test/java/org/checkerframework/framework/stub/AnnotationFileUtilTest.java
…unlistable subdirectory An archive within a searched directory is reported only if it contains an annotation file of the requested type or cannot be opened. A directory within a searched directory that cannot be listed yields the same warning as an unreadable annotation file, rather than a note. Rename isUserSupplied to isExplicitlyNamed, since a checker can name a location too. Tests use AnnotationFileTestUtil to write archives.
… along several paths
# Conflicts: # framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileUtil.java
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
|
@coderabbitai review |
Action performed
|
Land after #8588.
When a directory named in
-Astubsor-Aajavais searched, each directory under it is searched at most once, even if symbolic links make it reachable along several paths. Previously, a link such asstubs/loopwhose target isstubsmade the search read each stub file instubsrepeatedly, throughloop/,loop/loop/, and so on, until the file system refused to resolve the path. A directory that two links lead to was read twice.AnnotationFileUtil.forEachAnnotationFilerecords the real path of each directory that it searches, and skips a directory whose real path it has already recorded.Tests:
AnnotationFileUtilTest.symbolicLinkLoopIsSearchedOnce: a link to an enclosing directory.AnnotationFileUtilTest.directoryReachedTwiceIsSearchedOnce: two links to one directory.Both tests are skipped on a file system that does not support symbolic links.