Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
243 commits
Select commit Hold shift + click to select a range
4190eb5
Honor @TerminatesExecution on every call that the CFG builds
mernst Nov 8, 2026
0afd0a0
Decide whether a receiver may be null in one place
mernst Nov 9, 2026
7408203
Unboxing a never-null value does not throw NullPointerException
mernst Nov 9, 2026
6938dfa
Address review: method-reference NPE edge, enum constants may be null…
mernst Nov 10, 2026
53a5a7b
Merge branch 'master' into terminates-execution-check
mernst Nov 10, 2026
eb0f098
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 10, 2026
7c07758
Merge branch 'master' into terminates-execution-check
mernst Nov 11, 2026
43ce2d0
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 11, 2026
2ed4020
Honor @TerminatesExecution on the desugared calls of an enhanced for …
mernst Nov 11, 2026
92b24cc
Throw NullPointerException for a null receiver after evaluating call …
mernst Nov 11, 2026
bdc36b1
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 11, 2026
47bba23
Refine a call's receiver to non-null only after the call completes no…
mernst Nov 12, 2026
d42bc04
Merge branch 'master' into terminates-execution-check
mernst Nov 13, 2026
c0f5c35
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 13, 2026
c62d720
Give enhanced-for synthetic calls exceptional edges; don't rescan next()
mernst Nov 14, 2026
c4bb41d
Make extendWithMethodInvocationNode void and derive the method from t…
mernst Nov 14, 2026
ae2b768
Merge branch 'master' into terminates-execution-check
mernst Nov 14, 2026
7e676e4
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 14, 2026
2ec36b1
RLC: a @PolyMustCall alias has the must-call methods of its fellow al…
mernst Nov 15, 2026
39380a3
RLC: an unrefined alias has the must-call methods of a refined alias
mernst Nov 15, 2026
9c5a442
Address review: unboxing node, array-branch comment, Javadoc, tests
mernst Nov 15, 2026
a4943f7
Unwrap widening to find an enhanced-for element's boxing conversion; …
mernst Nov 15, 2026
15f7e02
Merge remote-tracking branch 'upstream/master' into terminates-execut…
mernst Nov 15, 2026
be80f2f
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 15, 2026
62e326e
RLC: an alias that has no @MustCall type in the store cannot satisfy …
mernst Nov 15, 2026
300675f
Translate an enhanced for loop's next() once; find the conversion und…
mernst Nov 15, 2026
7159813
RLC: an alias that has no @MustCall type in the store cannot satisfy …
mernst Nov 15, 2026
377e555
Honor @TerminatesExecution on the desugared close() of a try-with-res…
mernst Nov 15, 2026
91e9767
Merge remote-tracking branch 'origin/rlc-alias-not-in-store' into ter…
mernst Nov 15, 2026
2c32a44
Merge remote-tracking branch 'origin/terminates-execution-extend' int…
mernst Nov 15, 2026
fe5b5bc
Merge remote-tracking branch 'origin/enhanced-for-next-once' into ter…
mernst Nov 15, 2026
586ab68
Fix CI failures: suppress interning warning, add Javadoc; set the box…
mernst Nov 15, 2026
2179bee
Merge remote-tracking branch 'origin/enhanced-for-next-once' into ter…
mernst Nov 15, 2026
b736ada
Honor @TerminatesExecution on constructors and enhanced-for iterator(…
mernst Nov 15, 2026
a1cacb4
Test unboxing an Iterable's element and next()'s exceptional edges; c…
mernst Nov 15, 2026
9befe18
RLC: an alias that has no value in the Must Call store gets the must-…
mernst Nov 15, 2026
884dd4c
Add a test of an alias that is in the Called Methods store but not th…
mernst Nov 15, 2026
2210b61
Merge remote-tracking branch 'origin/enhanced-for-next-once' into ter…
mernst Nov 15, 2026
d0b79ba
Simplify getMustCallMethods, make its union deterministic, and correc…
mernst Nov 15, 2026
ec5982e
Merge branch 'rlc-alias-not-in-store' into terminates-execution-check
mernst Nov 15, 2026
564ab5e
Merge branch 'terminates-execution-extend' into terminates-execution-…
mernst Nov 15, 2026
9b39347
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 15, 2026
c55947e
Give the desugared iterator() call exceptional successors only if it …
mernst Nov 15, 2026
9e2b0b2
Comment
mernst Nov 15, 2026
285254d
Comment
mernst Nov 15, 2026
9bb170e
Merge branch 'master' into rlc-alias-not-in-store
mernst Nov 16, 2026
0d331c4
Merge branch 'rlc-alias-not-in-store' into terminates-execution-check
mernst Nov 16, 2026
22e3cc1
Merge branch 'master' into terminates-execution-extend
mernst Nov 16, 2026
c18c80f
Merge branch 'terminates-execution-extend' into terminates-execution-…
mernst Nov 16, 2026
c5ed52d
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 16, 2026
ec04486
Merge branch 'master' into rlc-alias-not-in-store
mernst Nov 16, 2026
a0c291d
Merge branch 'rlc-alias-not-in-store' into terminates-execution-check
mernst Nov 16, 2026
a331eb3
Merge branch 'master' into terminates-execution-extend
mernst Nov 16, 2026
96ecc51
Merge branch 'terminates-execution-extend' into terminates-execution-…
mernst Nov 16, 2026
c453f2a
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 16, 2026
00430d5
Don't refine a receiver after a call whose arguments may reassign it
mernst Nov 16, 2026
89745e5
Merge branch 'master' into receiver-may-be-null
mernst Nov 16, 2026
4f25266
Fix the build after merging branch 'master'
mernst Nov 16, 2026
f760161
Merge branch 'master' into receiver-may-be-null
mernst Nov 16, 2026
399c53e
Detect increment and decrement of receiver subexpressions in method a…
mernst Nov 16, 2026
3066475
Merge branch 'master' into terminates-execution-check
mernst Nov 16, 2026
583c0ea
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 16, 2026
6f73bc2
Fix the build after merging branch 'terminates-execution-check'
mernst Nov 16, 2026
2564c40
Give the desugared iterator() call of an enhanced for loop exceptiona…
mernst Nov 17, 2026
d416952
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 17, 2026
8aa66f5
Model suppressed close() exceptions on the exceptional path of a try-…
mernst Nov 17, 2026
44ca496
Do not examine lambda and anonymous-class bodies when deciding whethe…
mernst Nov 17, 2026
5181743
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 17, 2026
194595f
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 17, 2026
588281a
The exceptional path of a finally block rethrows the exceptions that …
mernst Nov 18, 2026
fbb8b3d
Simplify the suppressing close() call; add a Resource Leak Checker test
mernst Nov 18, 2026
31372f2
Test a try-with-resources statement whose resource's close() throws n…
mernst Nov 18, 2026
7f8becb
Test that a try-with-resources statement's primary exception is not i…
mernst Nov 18, 2026
2def2dc
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 18, 2026
963a903
Record the exceptions that reach a finally block in its frame; rename…
mernst Nov 18, 2026
79c64cf
Give each group of exceptions its own exceptional copy of a finally b…
mernst Nov 18, 2026
2289b8e
Merge branch 'finally-rethrow-exception-types' of /home/mernst/resear…
mernst Nov 18, 2026
9dd7f46
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 18, 2026
b7cb498
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 18, 2026
c6f92dc
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 18, 2026
c381e81
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 18, 2026
25a5160
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 18, 2026
05e5faa
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 18, 2026
fed2636
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 19, 2026
ff57ab1
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 19, 2026
f30cf70
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 19, 2026
e5153fc
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 19, 2026
d73667c
Fix the build after merging branch 'terminates-execution-check'
mernst Nov 19, 2026
fc158bc
Give each type of exception its own exceptional copy of a finally block
mernst Nov 19, 2026
c5aa192
Keep the primary exception reachable when a suppressed close() throws…
mernst Nov 19, 2026
a9dc269
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 19, 2026
209035f
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 19, 2026
0ba801f
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 19, 2026
e042621
Fix the build after merging branch 'terminates-execution-check'
mernst Nov 19, 2026
11f90e3
Share a finally copy among exception types that no method invocation …
mernst Nov 19, 2026
ad5b14c
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 19, 2026
f5635f9
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 19, 2026
f0ef3f0
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 19, 2026
b3e24c2
Fix the build after merging branch 'terminates-execution-check'
mernst Nov 19, 2026
1aea254
Test a call's receiver for nullness after its arguments, at the metho…
mernst Nov 20, 2026
73aa175
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 21, 2026
24e9bc5
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 21, 2026
8c3fd00
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 21, 2026
3e15760
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 21, 2026
83e1266
Clarify the Javadoc of exception groups and of a finally frame's exce…
mernst Nov 21, 2026
b18d37c
Group exception types by where a finally block's copy rethrows them
mernst Nov 21, 2026
ae0ffc2
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 21, 2026
f0d10a7
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 21, 2026
416e437
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 21, 2026
fb09455
A jump in a finally block leaves the try statement without rerunning …
mernst Nov 21, 2026
d50eda0
Move the fix for jumps in a finally block to its own pull request
mernst Nov 21, 2026
054405d
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 22, 2026
04866ec
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 22, 2026
fac8b97
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 22, 2026
5767e14
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 22, 2026
cd34902
Do not apply exceptional postconditions of a suppressed close() on th…
mernst Nov 22, 2026
92bbac3
Model the call to addSuppressed in a try-with-resources, which may th…
mernst Nov 22, 2026
0c824e9
Keep the primary exception reachable when a suppressed close() throws…
mernst Nov 19, 2026
16d2f14
Do not apply exceptional postconditions of a suppressed close() on th…
mernst Nov 22, 2026
fa0c94e
Bound the extra exceptional copies of nested finally blocks
mernst Nov 22, 2026
83fceef
Update the busy-expression test's expected output: the method access …
mernst Nov 22, 2026
98ab8c9
Refine receivers and arguments more carefully after a call
mernst Nov 22, 2026
f29d1d8
Clarify where the primary-exception edges of a suppressed close() cal…
mernst Nov 22, 2026
67fbe5e
Test self-suppression and the primary exception of try-with-resources
mernst Nov 22, 2026
357efa1
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 22, 2026
7e6b5bc
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 22, 2026
2b747db
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 22, 2026
be99508
Pass an unmodifiable view of the rethrown exception types to the fina…
mernst Nov 22, 2026
6b29b31
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 22, 2026
bdf2b75
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 22, 2026
056f407
Introduce RethrowGroup; clarify documentation of exceptional copies o…
mernst Nov 23, 2026
49c60db
Account for implicit toString() calls in string conversion; qualify f…
mernst Nov 23, 2026
7a63e7d
Once the budget is used up, give each finally block one exceptional c…
mernst Nov 23, 2026
2a087bd
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 23, 2026
d26ce80
Fix the build after merging branch 'finally-rethrow-exception-types'
mernst Nov 23, 2026
09c3968
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 23, 2026
c6cd770
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 23, 2026
9131f86
Reformat
mernst Nov 23, 2026
580b34c
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 23, 2026
5211f72
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 23, 2026
c462158
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 23, 2026
6ece809
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 23, 2026
a0de79c
Test the success-flag false positive and a non-ignored throwable; doc…
mernst Nov 23, 2026
4f3fc43
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 23, 2026
a108974
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 23, 2026
1a22778
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 23, 2026
efb3fc9
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 23, 2026
79005bd
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 23, 2026
1878311
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 23, 2026
0f93803
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 23, 2026
b2469d0
Record exceptions from implicit toString() in string conversion and f…
mernst Nov 24, 2026
4a09661
Treat `throw null` as throwing NullPointerException in the CFG
mernst Nov 24, 2026
b70a9d4
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 24, 2026
f4ad72f
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 24, 2026
5e3c8be
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 24, 2026
81f8030
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 24, 2026
2ea2247
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 24, 2026
efc4b8c
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 24, 2026
ed1933a
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 24, 2026
ae4c573
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 24, 2026
03cfb47
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 25, 2026
5fb54d0
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 25, 2026
1c10027
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 25, 2026
34ab2fa
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 25, 2026
6e720fa
Test the shared exceptional finally copy after the budget is used up;…
mernst Nov 25, 2026
b39babf
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 26, 2026
bad6af7
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 26, 2026
d735d91
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 26, 2026
27cd8d9
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 26, 2026
d3d29b3
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 26, 2026
04960ff
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 26, 2026
a47ab3c
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 26, 2026
d7b488f
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 26, 2026
1784373
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 27, 2026
f413a7f
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 27, 2026
3baa7e7
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 27, 2026
02890ed
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 27, 2026
dd11ae5
Compute each block's predecessors once in ControlFlowGraph.checkInvar…
mernst Nov 28, 2026
9ba2d72
Merge remote-tracking branch 'origin/check-invariants-predecessors' i…
mernst Nov 28, 2026
9fc422b
Make FinallyCopyBudget fail if the budget is not used up; document th…
mernst Nov 28, 2026
99fe560
Fix garbled Javadoc of TryFinallyFrame.getExceptionLabels
mernst Nov 28, 2026
045db37
Remove the predecessor cache from ControlFlowGraph.checkInvariants; #…
mernst Nov 28, 2026
312c11a
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 28, 2026
57dc47b
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 28, 2026
5b44bff
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 28, 2026
28e706d
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 28, 2026
71a32ac
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 28, 2026
cfd043e
Explain why the Dataflow Framework bounds the exceptional copies of a…
mernst Nov 28, 2026
fa9b1ff
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 28, 2026
f72292d
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 28, 2026
0f0bb6f
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 28, 2026
8790d96
Account for implicit calls in arguments; refine a source call's recei…
mernst Nov 29, 2026
bfaa903
Check that each catch block is reached; clarify finally-block documen…
mernst Nov 29, 2026
0329191
Merge branch 'master' into finally-rethrow-exception-types
mernst Nov 29, 2026
85c3c0b
Merge branch 'finally-rethrow-exception-types' into twr-suppressed-cl…
mernst Nov 29, 2026
a5bd5d9
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 29, 2026
59ffd3e
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 29, 2026
198ae8e
Test the sharing of an exceptional finally copy in the CFG; clarify w…
mernst Nov 29, 2026
2886807
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 29, 2026
96d7d56
Throw IllegalArgumentException from addSuppressed only if close might…
mernst Nov 29, 2026
994a2f2
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 29, 2026
7c6d8f5
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 29, 2026
c977c71
Exclude a supertype's private method from the implicit calls of try-w…
mernst Nov 29, 2026
7b24676
Dataflow Manual: the finally-copy budget counts nodes across all fina…
mernst Nov 29, 2026
5c3a918
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 29, 2026
03b43e3
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 29, 2026
3a4cc0b
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 29, 2026
4d24600
Resource Leak Checker manual: an exception from close() in the catch …
mernst Nov 29, 2026
3cacc33
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 29, 2026
fd36f79
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 29, 2026
6b45b77
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 29, 2026
223de98
Paragraph break
mernst Nov 29, 2026
71d1c72
Move the budget for exceptional copies of finally blocks to its own p…
mernst Nov 29, 2026
0bd4202
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 29, 2026
a7ede70
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Nov 29, 2026
1835413
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Nov 29, 2026
e91f062
Rename "entry label" to "copy-entry label"; use the term "finally-blo…
mernst Nov 29, 2026
ff248ae
Itemize the types that reach a TryFinallyFrame; say "finally-block co…
mernst Nov 29, 2026
9f5d0ed
Describe the finally-rethrow change in the changelog; keep the origin…
mernst Nov 29, 2026
eab5cb4
Merge remote-tracking branch 'origin/finally-rethrow-exception-types'…
mernst Nov 29, 2026
7b098db
Merge remote-tracking branch 'origin/twr-suppressed-close-terminates'…
mernst Nov 29, 2026
6a19713
Merge remote-tracking branch 'origin/terminates-execution-check' into…
mernst Nov 29, 2026
476b1d6
Do not give a string conversion exceptional edges
mernst Nov 29, 2026
169a381
Keep the receiver NullPointerException on the failure path of an inst…
mernst Nov 29, 2026
95e778c
Reformat a Javadoc comment
mernst Nov 30, 2026
afaff12
Merge branch 'master' into twr-suppressed-close-terminates
mernst Dec 1, 2026
8512fef
Merge branch 'twr-suppressed-close-terminates' of github.com:mernst/c…
mernst Dec 1, 2026
41c9352
Use the effective throws clause of close() when deciding whether a tr…
mernst Dec 1, 2026
b16999c
Merge branch 'twr-suppressed-close-terminates' of github.com:mernst/c…
mernst Dec 1, 2026
7d8f265
Merge branch 'terminates-execution-check' of github.com:mernst/checke…
mernst Dec 1, 2026
19fef13
Keep receiver refinement that the store's side-effect analysis preser…
mernst Dec 1, 2026
7d3a7d1
Test that the NullPointerException handler for `throw null` is reachable
mernst Dec 1, 2026
74ab44b
Dataflow Manual: the most-specific-edge rule does not govern getAnyEx…
mernst Dec 1, 2026
8ff07ff
Give synthetic iterator-protocol method accesses a NullPointerExcepti…
mernst Dec 1, 2026
9151047
Merge branch 'twr-suppressed-close-terminates' of github.com:mernst/c…
mernst Dec 1, 2026
ada5e65
Merge branch 'terminates-execution-check' of github.com:mernst/checke…
mernst Dec 1, 2026
4fb9f94
Resolve implicit close() and other no-argument methods through type-v…
mernst Dec 1, 2026
faab838
CFGConstruction test: check that each rethrow reaches the catch block…
mernst Dec 1, 2026
eedb39b
Merge branch 'master' into twr-suppressed-close-terminates
mernst Dec 1, 2026
ced9c96
Reformat
mernst Dec 1, 2026
6794adf
Merge branch 'twr-suppressed-close-terminates' into terminates-execut…
mernst Dec 1, 2026
964e533
Merge branch 'terminates-execution-check' into receiver-may-be-null
mernst Dec 1, 2026
ad0bde3
Reformat
mernst Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ private void handleEnsuresCalledMethodsVarargs(
/**
* Update the given {@code exceptionalStores} for the {@link
* org.checkerframework.checker.calledmethods.qual.EnsuresCalledMethodsOnException} annotations
* written on the given {@code method}.
* written on the given {@code method}. Does not update the store for an exception type in {@link
* MethodInvocationNode#getAnyExceptionTypes()}.
*
* @param node a method invocation
* @param method the method being invoked
Expand Down Expand Up @@ -302,7 +303,12 @@ private void handleEnsuresCalledMethodsOnException(
AnnotationMirror calledMethod = atypeFactory.createAccumulatorAnnotation(postcond.method());
for (Map.Entry<TypeMirror, AccumulationStore> successor : exceptionalStores.entrySet()) {
TypeMirror caughtException = successor.getKey();
if (types.isSubtype(caughtException, javaLangExceptionType)) {
// The invocation follows an edge labeled by one of node.getAnyExceptionTypes() whenever it
// throws an exception, even one that is not an Exception, so the postcondition might not
// hold on that edge.
if (types.isSubtype(caughtException, javaLangExceptionType)
&& node.getAnyExceptionTypes().stream()
.noneMatch(t -> types.isSameType(t, caughtException))) {
AccumulationStore resultStore = successor.getValue();
resultStore.insertOrRefine(e, calledMethod);
}
Expand Down

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions checker/tests/nullness/EnhancedForIteratorPostcondition.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// The desugared call to iterator() of an enhanced for loop can throw an exception before it
// establishes its postcondition.

import java.util.Collections;
import java.util.Iterator;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;

class EnhancedForIteratorPostcondition {

static class FieldSettingIterable implements Iterable<String> {
@MonotonicNonNull Object f;

@Override
@EnsuresNonNull("f")
public Iterator<String> iterator() {
f = new Object();
return Collections.emptyIterator();
}
}

void afterLoop(FieldSettingIterable it) {
for (String s : it) {}
it.f.toString();
}

void inCatch(FieldSettingIterable it) {
try {
for (String s : it) {}
} catch (RuntimeException e) {
// :: error: (dereference.of.nullable)
it.f.toString();
}
}
}
33 changes: 33 additions & 0 deletions checker/tests/nullness/Exceptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,37 @@ void reassignException() {
throw e;
}
}

// `throw null` throws a NullPointerException.
void throwNullInTryCatch() {
try {
// :: error: [throwing.nullable]
throw null;
} catch (NullPointerException e) {
}
}

// The code after the try statement is reachable only through the NullPointerException handler,
// where `o` is non-null. If the handler were unreachable, `o` would have its declared type.
void throwNullReachesHandler() {
@Nullable Object o = null;
try {
// :: error: [throwing.nullable]
throw null;
} catch (NullPointerException e) {
o = "";
}
o.toString();
}

void throwNullInTryFinallyInTryCatch() {
try {
try {
// :: error: [throwing.nullable]
throw null;
} finally {
}
} catch (IllegalStateException e) {
}
}
}
54 changes: 54 additions & 0 deletions checker/tests/nullness/ReceiverDependsOnStaticField.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.Pure;
import org.checkerframework.dataflow.qual.SideEffectFree;

// The receiver of a call is a method call whose result depends on a static field. If an argument
// writes that static field, normal completion of the call does not show that the receiver
// expression is non-null afterward. See also ReceiverReassignedInArgument.java.
public class ReceiverDependsOnStaticField {

static @Nullable ReceiverDependsOnStaticField slot;

@Pure
static @Nullable ReceiverDependsOnStaticField current() {
return slot;
}

@SideEffectFree
void sefAccept(@Nullable Object o) {}

void directAssignment() {
if (current() == null) {
return;
}
current().sefAccept(slot = null);
// :: error: (dereference.of.nullable)
current().toString();
}

void clearSlot() {
slot = null;
}

void acceptNonNull(Object o) {}

// The invoked method is not side-effect-free and might write the static field, so normal
// completion of the call does not show that the receiver is non-null afterward.
// These tests do not first test `current()` against null: the store retains a refinement of a
// static call with no modifiable argument, such as `current()`, across a call that is not
// side-effect-free (see sideeffectsonly/StaticPureCallRefinement.java).
void sideEffectingCallNoArguments() {
// :: error: (dereference.of.nullable)
current().clearSlot();
// :: error: (dereference.of.nullable)
current().toString();
}

// Likewise for an argument passed to a non-null parameter.
void sideEffectingCallNonNullArgument() {
// :: error: (argument)
acceptNonNull(current());
// :: error: (dereference.of.nullable)
current().toString();
}
}
164 changes: 164 additions & 0 deletions checker/tests/nullness/ReceiverReassignedInArgument.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.dataflow.qual.SideEffectFree;
import org.checkerframework.framework.qual.DoesNotUnrefineReceiver;

// A call's receiver is evaluated before its arguments. If an argument reassigns the receiver
// expression, then normal completion of the call does not show that the receiver expression is
// non-null afterward. Likewise for an argument that a later argument reassigns.
// ReceiverRefinementInCatch.java contains more such tests.
public class ReceiverReassignedInArgument {

@Nullable ReceiverReassignedInArgument f;

void take(@Nullable Object o) {}

@SideEffectFree
void sefTake(@Nullable Object o) {}

void assignInNestedArgument() {
ReceiverReassignedInArgument r = new ReceiverReassignedInArgument();
r.take(String.valueOf(r = null));
// :: error: (dereference.of.nullable)
r.toString();
}

// The receiver is not refined while the arguments are evaluated.
void dereferenceInArgument(@Nullable ReceiverReassignedInArgument r) {
// :: error: (dereference.of.nullable)
r.equals(
// :: error: (dereference.of.nullable)
r.hashCode());
}

// The argument assigns a non-null value to the receiver expression.
void assignNonNullInArgument(@Nullable Object r, Object nn) {
// :: error: (dereference.of.nullable)
r.equals(r = nn);
r.toString();
}

// Evaluating the argument does not execute the lambda body, and a side-effect-free method does
// not execute it either.
void assignInLambdaBody() {
// :: error: (dereference.of.nullable)
f.sefTake((Runnable) () -> f = null);
f.toString();
}

// Evaluating the argument executes the anonymous class's initializer.
void assignInAnonymousClassInitializer() {
// :: error: (dereference.of.nullable)
f.sefTake(
new Object() {
{
f = null;
}
});
// :: error: (dereference.of.nullable)
f.toString();
}

@SideEffectFree
void sefTake2(Object first, @Nullable Object second) {}

// A later argument reassigns an earlier argument that is passed to a non-null parameter.
void assignEarlierArgument() {
ReceiverReassignedInArgument r = new ReceiverReassignedInArgument();
r.sefTake2(r, r = null);
// :: error: (dereference.of.nullable)
r.toString();
}

// Without reassignment, an argument passed to a non-null parameter is non-null afterward.
void noReassignment(@Nullable Object q) {
// :: error: (argument)
sefTake2(q, null);
q.toString();
}

// A toString() method that reassigns the field f. It overrides Object.toString(), which is
// annotated @SideEffectFree, and purity annotations are inherited. So the Checker Framework
// reports the field assignment and treats Mutator.toString() as side-effect-free elsewhere.
class Mutator {
@Override
public String toString() {
// :: error: (purity.assign.field)
f = null;
return "";
}
}

class SefToString {
@Override
@SideEffectFree
public String toString() {
return "";
}
}

// String concatenation implicitly invokes Mutator.toString(). The checker trusts its inherited
// @SideEffectFree annotation (and reports the violation at its declaration), so f is refined.
void stringConcatenationInArgument(Mutator m) {
// :: error: (dereference.of.nullable)
f.sefTake("" + m);
f.toString();
}

// `s += m` implicitly invokes Mutator.toString(), which the checker treats as side-effect-free.
void stringCompoundAssignmentInArgument(Mutator m, String s) {
// :: error: (dereference.of.nullable)
f.sefTake(s += m);
f.toString();
}

// String concatenation of an operand whose toString() is side-effect-free.
void sefStringConcatenationInArgument(SefToString o, int i) {
// :: error: (dereference.of.nullable)
f.sefTake("" + o + i);
f.toString();
}

@Target(ElementType.TYPE_USE)
@interface TypeUseAnno {
int value();
}

// An annotation's element-value pair, such as `value = 1`, is not an assignment.
void annotationInArgument(Object r, @Nullable Object other) {
r.equals((@TypeUseAnno(value = 1) Object) other);
r.toString();
}

void sideEffect() {}

@DoesNotUnrefineReceiver("allcheckers")
void doesNotUnrefineReceiver() {}

@DoesNotUnrefineReceiver("allcheckers")
void doesNotUnrefineReceiver(@Nullable Object o) {}

// The method does not unrefine its receiver, so normal completion shows that f is non-null.
void doesNotUnrefineReceiverField() {
// :: error: (dereference.of.nullable)
f.doesNotUnrefineReceiver();
f.toString();
}

void sideEffectField() {
// :: error: (dereference.of.nullable)
f.sideEffect();
// :: error: (dereference.of.nullable)
f.toString();
}

// An argument that reassigns the receiver blocks the refinement, even if the method does not
// unrefine its receiver.
void doesNotUnrefineReceiverArgumentReassigns() {
// :: error: (dereference.of.nullable)
f.doesNotUnrefineReceiver(f = null);
// :: error: (dereference.of.nullable)
f.toString();
}
}
Loading
Loading