Review of framework-test package#1724
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Small cleanup and bug-fix pass over the framework-test package: tightens collection construction, replaces Scanner with BufferedReader, removes a now-unused helper, and fixes a couple of latent correctness issues in diagnostic parsing and equality.
Changes:
- Replace
Scanner-based file scanning withFiles.newBufferedReader, and add askip-testfast-path filter inTestUtilities.isJavaTestFile. - Defensive-copy
diagnosticFiles, markprocessorsunmodifiable inImmutableTestConfiguration; simplify list mutation inTestConfigurationBuilderand drop the unusedcatListAndIterablehelper; switchString.join("%n", ...)toSystem.lineSeparator(). - Fix
TestDiagnosticUtils.fromPatternMatchingto read fromwarningMatcher(notdiagnosticMatcher) in the warning branch, and makeTestDiagnostic.equalsusethis.getClass()soDetailedTestDiagnostic.equals(which delegates viasuper) actually works.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| framework-test/.../TypecheckResult.java | Build unexpectedDiagnostics directly from actualDiagnostics; wrap expected in a HashSet for removeAll. |
| framework-test/.../TypecheckExecutor.java | Use Collections.emptyList() instead of an empty ArrayList for the classes argument. |
| framework-test/.../TestUtilities.java | Switch Scanner to BufferedReader; add skip-test fast-path to short-circuit per-line checks. |
| framework-test/.../TestConfigurationBuilder.java | Inline list appends, drop catListAndIterable, and use System.lineSeparator() for joining error lines. |
| framework-test/.../SimpleOptionMap.java | Minor: drop redundant toAppend.length() argument to substring. |
| framework-test/.../PerDirectorySuite.java | Use real newlines in error message; construct ctor args array directly. |
| framework-test/.../ImmutableTestConfiguration.java | Defensive-copy diagnosticFiles; make processors an unmodifiable list. |
| framework-test/.../diagnostics/TestDiagnosticUtils.java | Read the linenogroup/lineno from warningMatcher and guard for patterns without that named group. |
| framework-test/.../diagnostics/TestDiagnostic.java | Use this.getClass() in equals so subclasses (e.g. DetailedTestDiagnostic) can be equal. |
| framework-test/.../CheckerFrameworkWPIPerDirectoryTest.java | Switch Scanner to BufferedReader in hasSkipComment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+154
to
+159
| // Wrap expectedDiagnostics in a HashSet so the two removeAll calls below get O(1) | ||
| // membership tests. | ||
| Set<TestDiagnostic> expectedSet = new HashSet<>(expectedDiagnostics); | ||
|
|
||
| Set<TestDiagnostic> unexpectedDiagnostics = new LinkedHashSet<>(actualDiagnostics); | ||
| unexpectedDiagnostics.removeAll(expectedSet); |
wmdietl
commented
May 16, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Werner Dietl <wdietl@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.