Repository navigation
Issue #21751: Fix RequireThis resource scope in finally blocks - #21764
Conversation
|
The regression configuration is linked in the PR description. Could a maintainer trigger the hosted diff report? The current workflow restricts comment triggers to owners, members, and collaborators. A local before/after comparison over 1,551 Java files found no changes in Checkstyle or Apache Commons IO main/test sources; only the expected finally-scope fixes appeared in the regression fixtures. |
|
Full local The two currently failed CircleCI jobs fail during checkout, before executing the patch:
These appear to require CI checkout/authentication recovery rather than a change to this fix. Could a maintainer rerun them once that is resolved? |
c918985 to
0b0ce03
Compare
|
please fix pitest. |
|
Github, generate report for RequireThis/Example1 |
0b0ce03 to
98b64d0
Compare
|
Fixed in All 55 RequireThis tests pass. Focused PIT verification kills all 14 mutations in |
98b64d0 to
17599fd
Compare
|
Fixed the FileLength failures in Full |
|
Github, generate report for RequireThis/Example1 |
|
All 135 checks now pass on |
Issue: #21751
RequireThismisses an unqualified instance-field reference infinallywhen a same-named resource is declared in the associated try-with-resources statement. The resource is out of scope there, but the check currently resolves the reference to it.Create the finally block frame outside its associated resource frame. Preserve enclosing resources and local declarations. Update the existing Checker Framework suppression to follow the extracted helper. Add tests covering catch/finally/after-try references, multiple and nested resources, local and parameter shadowing, explicit
this, ordinary try/finally, the default overlapping-only mode, and disabled field checking.Validation:
80ebbfff48f257a775b516fda1f6bb3976bcc80f.JAVA_HOME=<JDK 21> MAVEN_OPTS=-Xmx4g groovy .ci/checker-framework.groovy checker-nullness-optional-interning: passed after updating the existing suppression.JAVA_HOME=<JDK 21> ./mvnw -B -ntp clean verify: passed, including coverage and static analysis.createBlockFramekills all 14 mutations with repository thresholds unchanged. The full RequireThis PIT CI job now passes.eddda2325e161a8852fa4c6b78a6e2143b66383b;./mvnw -B -ntp clean verifypassed again on the rebased commit.Local regression report (original base, before rebase): https://gist.github.com/ishu7w/0386d3328d1a08e74d58b7e37be606c8
Diff Regression config: https://gist.githubusercontent.com/ishu7w/7910b787e503937fe39d33dc6f50d1f2/raw/8064d13e9a70040dd5e04d2db1b229f6c7b1a9c1/regression-config.xml
Codex assisted with investigation, implementation, and validation.
Final fixture validation: reduced
InputRequireThisFinally.javato 113 lines by removing the redundant parameter-only case. Full./mvnw -B -ntp clean verifypassed on the final fixture, including resource checks, and focused PIT again killed all 14 helper mutations.Current CI: all 135 checks pass on
17599fd. The hosted default-configuration report covers 26 projects with zero differences. It uses default overlapping-only behavior; the strict configuration is covered by the local comparison linked above, and a matching hosted report has been requested.