Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
258 commits
Select commit Hold shift + click to select a range
8534341
Merge branch 'unboxing-keeps-conditional-stores' into explicit-unboxi…
mernst Oct 23, 2026
60653f5
Merge conditional stores by default; refine them for boolean operators
mernst Oct 23, 2026
09b59b5
Move the unboxing transfer function into its own method, so the gener…
mernst Oct 23, 2026
01d6ab6
Merge remote-tracking branch 'origin/conditional-stores-of-operands' …
mernst Oct 23, 2026
a1024d8
Keep the conditional stores at the target of an unboxing call
mernst Oct 23, 2026
4535ce4
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Oct 23, 2026
862e58b
createTransferResult: keep two (equal) stores when the input has two
mernst Oct 23, 2026
45810a0
Merge branch 'master' into conditional-stores-of-operands
mernst Oct 24, 2026
125627a
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Oct 24, 2026
b774035
Merge remote-tracking branch 'upstream/master' into explicit-unboxing…
mernst Oct 27, 2026
ff55d4e
Merge remote-tracking branch 'upstream/master' into unboxing-keeps-co…
mernst Oct 27, 2026
9bc9770
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Oct 27, 2026
704c420
JointJavacJavaParserVisitor: assert that an Optional is present befor…
mernst Oct 27, 2026
229f6a7
Address review findings: tree-based operand check, single lambda-resu…
mernst Oct 27, 2026
3919420
Merge branch 'master' into ajava-optional-asserts
mernst Oct 27, 2026
49abdc9
Merge branch 'ajava-optional-asserts' into conditional-stores-of-oper…
mernst Oct 27, 2026
6a4bcae
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Oct 27, 2026
fee0a0f
Restore imports that isTargetOfUnboxingCall uses
mernst Oct 27, 2026
dc718d2
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Oct 27, 2026
380fe28
Suppress interning warning for reference equality of trees
mernst Oct 27, 2026
92c2817
Merge remote-tracking branch 'origin/conditional-stores-of-operands' …
mernst Oct 27, 2026
40470a7
Merge remote-tracking branch 'origin/conditional-stores-of-operands' …
mernst Oct 27, 2026
d2e4388
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Oct 27, 2026
a9bb8e8
Merge branch 'master' of /home/mernst/research/types/checker-framewor…
mernst Oct 28, 2026
01311f7
Merge branch 'conditional-stores-of-operands' of /home/mernst/researc…
mernst Oct 28, 2026
5b3a221
Merge branch 'master' into unboxing-keeps-conditional-stores
mernst Oct 28, 2026
1cdf5cd
Merge branch 'unboxing-keeps-conditional-stores' into explicit-unboxi…
mernst Oct 28, 2026
4e24e89
Merge branch 'master' into conditional-stores-of-operands
mernst Oct 29, 2026
1fdb4e0
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Oct 29, 2026
22f10ac
Merge branch 'unboxing-keeps-conditional-stores' into explicit-unboxi…
mernst Oct 29, 2026
7bba3e0
Merge remote-tracking branch 'upstream/master' into conditional-store…
mernst Oct 30, 2026
bc75694
Improve comments
mernst Oct 30, 2026
86e3b0d
Improve documentation of createTransferResult and related methods; ad…
mernst Oct 30, 2026
1264a0e
Precision
mernst Oct 30, 2026
bc95d4c
Merge branch 'master' into conditional-stores-of-operands
mernst Oct 31, 2026
a90cc0a
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 1, 2026
ef3b95e
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 1, 2026
6ece119
Look through unboxing calls in isConstantBoolean; update visitUnboxin…
mernst Nov 3, 2026
699f2aa
Check receiver type before scanning block for unboxing call
mernst Nov 3, 2026
d972699
Don't refine == of two boxed operands; see through unboxing in isCons…
mernst Nov 3, 2026
b833d67
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 7, 2026
30e13fc
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 7, 2026
7df5cd8
Merge branch 'unboxing-keeps-conditional-stores' into explicit-unboxi…
mernst Nov 7, 2026
7e5be39
Rename the parameter of visitConditionalNot to `in`
mernst Nov 8, 2026
d967709
Clarify the comment about skipping the least upper bound of equal stores
mernst Nov 8, 2026
cb355dc
Merge branch 'conditional-stores-of-operands' of /home/mernst/researc…
mernst Nov 8, 2026
1d4a6ea
Merge branch 'unboxing-keeps-conditional-stores' of /home/mernst/rese…
mernst Nov 8, 2026
c1d64f5
createTransferResult: keep the result's stores distinct when the inpu…
mernst Nov 8, 2026
a6dc353
Merge branch 'conditional-stores-of-operands' of ../checker-framework…
mernst Nov 8, 2026
ae906fd
Changelog: visitMethodAccess() skips visitNode() only when the input …
mernst Nov 8, 2026
ef88081
Test | with a negated boxed constant operand (moved from #8404)
mernst Nov 8, 2026
159dd13
Merge branch 'unboxing-keeps-conditional-stores' of ../checker-framew…
mernst Nov 8, 2026
3883ea3
Drop removeCastsAndUnboxing, which duplicates isConstantBoolean's unb…
mernst Nov 8, 2026
e466218
Do not refine == or != with two boxed operands, which Java compares b…
mernst Nov 8, 2026
928ca54
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 8, 2026
05a8bbf
Move tests of Boolean operands of |, ^, and == here from #8399
mernst Nov 8, 2026
390bd7e
Merge branch 'unboxing-keeps-conditional-stores' into explicit-unboxi…
mernst Nov 8, 2026
fb37ca0
Describe an unboxing call's final behavior: implicit or explicit call…
mernst Nov 8, 2026
0f9f5d7
Fix the conversion of an enhanced for loop's element
mernst Nov 8, 2026
2172770
Unbox Boolean operands of && and ||
mernst Nov 9, 2026
fa3e314
Keep conditional stores through an explicitly unboxed constant; toler…
mernst Nov 10, 2026
db2f512
Suppress the interning warning for the reference-equality test of the…
mernst Nov 10, 2026
3588b43
Always merge the stores; boolean operators compute their result direc…
mernst Nov 10, 2026
7d73e3e
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 11, 2026
e5cc813
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 11, 2026
220785c
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 11, 2026
39d810f
Keep conditional stores through an explicitly unboxed constant; toler…
mernst Nov 10, 2026
ad7277e
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 11, 2026
674367b
Separate changelog entries with a blank line
mernst Nov 12, 2026
b83cadf
Test explicit unboxing inside a try block
mernst Nov 12, 2026
7f165d7
Document createEnhancedForLoopIteratorVariable and createEnhancedForL…
mernst Nov 12, 2026
b7e4cc1
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 13, 2026
ea2bd87
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 13, 2026
620f289
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 13, 2026
94aa561
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 13, 2026
f726992
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 13, 2026
30493fb
Translate next() once; do not give boxing calls the element type
mernst Nov 14, 2026
e683cfc
Comment improvements
mernst Nov 14, 2026
7ff5fd3
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 14, 2026
20462b6
Clarify Javadoc of enhanced for loop variable creation
mernst Nov 15, 2026
a2d81ae
Merge remote-tracking branch 'upstream/master' into enhanced-for-elem…
mernst Nov 15, 2026
f0bd9b9
Unboxing keeps the qualifiers of the value being unboxed
mernst Nov 15, 2026
24b99a2
Leave iterator typing and type-variable unboxing to #8516 and #8492
mernst Nov 15, 2026
3915269
Use an indefinite article in a @param description
mernst Nov 15, 2026
947a67d
Clarify what "the factory value" is in the unboxing comment
mernst Nov 15, 2026
300675f
Translate an enhanced for loop's next() once; find the conversion und…
mernst Nov 15, 2026
5e94af6
Merge remote-tracking branch 'origin/enhanced-for-next-once' into enh…
mernst Nov 15, 2026
586ab68
Fix CI failures: suppress interning warning, add Javadoc; set the box…
mernst Nov 15, 2026
a1cacb4
Test unboxing an Iterable's element and next()'s exceptional edges; c…
mernst Nov 15, 2026
dc6d906
moreSpecificValue accepts and returns null
mernst Nov 15, 2026
70dd59c
Merge remote-tracking branch 'origin/enhanced-for-next-once' into enh…
mernst Nov 15, 2026
9d709d6
Say that variableElement is the element of the loop variable
mernst Nov 15, 2026
e6dc495
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 16, 2026
8f5017c
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 16, 2026
cd44410
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 16, 2026
8d70e40
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 16, 2026
b48c40a
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 16, 2026
4ae2bc1
Keep qualifiers through boxing; adapt them with set-level hooks
mernst Nov 16, 2026
3a5c68c
Treat a boxed boolean or byte as @Interned
mernst Nov 16, 2026
af113e0
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 16, 2026
d7aff19
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 16, 2026
d0328ca
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 16, 2026
e17588c
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 16, 2026
d564ce3
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 16, 2026
c65446f
Narrow a constant char to byte or short (and vice versa) before boxing
mernst Nov 16, 2026
21643e4
JavaExpression.fromNode: handle a MethodInvocationNode without a tree
mernst Nov 16, 2026
cf2df7b
Reformat with spotless
mernst Nov 16, 2026
8fb1ff0
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 17, 2026
bd04540
Fix nullness errors: nullable enclosing type and nullable invocation …
mernst Nov 15, 2026
ecec485
isBooleanValueMethod: check for a null enclosing type element
mernst Nov 16, 2026
1adbbd2
Merge remote-tracking branch 'origin/enhanced-for-element-conversion'…
mernst Nov 17, 2026
093244b
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Nov 17, 2026
0179327
Unboxing a type-variable value uses its upper bound's qualifiers
mernst Nov 17, 2026
2947c34
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 17, 2026
7a47676
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 17, 2026
418e101
SwitchExpressionBoxing test: check the interning qualifiers of switch…
mernst Nov 17, 2026
8ed0cd2
Adapt array-initializer qualifiers for boxing and unboxing
mernst Nov 18, 2026
428b10e
Merge github.com:typetools/checker-framework into conditional-stores-…
mernst Nov 18, 2026
5da289a
Merge github.com:typetools/checker-framework into enhanced-for-elemen…
mernst Nov 18, 2026
0c293e7
Move constant narrowing, enhanced-for marking removal, and Interning …
mernst Nov 18, 2026
ebe22a6
Narrow a compile-time constant before boxing it
mernst Nov 18, 2026
722cc9b
Keep the Interning Checker's boxing changes in this pull request
mernst Nov 18, 2026
a3669d3
Merge branch 'constant-narrowing-before-boxing' into enhanced-for-ele…
mernst Nov 18, 2026
b22dc4a
Use TreeUtils.typeOf; simplify isCompileTimeConstant
mernst Nov 18, 2026
57b48db
Box a byte constant assigned to Short by Short.valueOf; rename conver…
mernst Nov 18, 2026
1d20544
Changelog entry for the renamed method
mernst Nov 18, 2026
fe55a80
Merge remote-tracking branch 'origin/constant-narrowing-before-boxing…
mernst Nov 18, 2026
16ea922
Test that a byte constant assigned to Short is boxed by Short.valueOf
mernst Nov 18, 2026
f06efd7
Rename SwitchConstantNarrowingBoxing to ConstantNarrowingBoxingInSwitch
mernst Nov 18, 2026
61898c4
Where a boxing or unboxing's two values are incomparable, the operand…
mernst Nov 18, 2026
54a5bc0
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 18, 2026
6990e6c
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 18, 2026
ea965be
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 18, 2026
17d30f9
Merge branch 'master' into constant-narrowing-before-boxing
mernst Nov 19, 2026
2031416
Merge branch 'constant-narrowing-before-boxing' into enhanced-for-ele…
mernst Nov 19, 2026
36c86ec
Address review: tree-less invocations, cast boxing, unbox-then-widen …
mernst Nov 19, 2026
b569618
Pass the initializer's unboxed kind to getUnboxedAnnotations
mernst Nov 19, 2026
a79e282
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 19, 2026
afa7175
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 19, 2026
9e1c761
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 19, 2026
d7d0dd9
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 19, 2026
9eb47a7
Add NodeUtils.constantBooleanValue; narrow an interning suppression t…
mernst Nov 21, 2026
2659c5b
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 21, 2026
0a00a9a
Clarify comments in narrow()
mernst Nov 21, 2026
d24c4e0
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 21, 2026
0580369
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 21, 2026
bc5695e
Merge branch 'master' into constant-narrowing-before-boxing
mernst Nov 21, 2026
fc50994
Merge branch 'constant-narrowing-before-boxing' into enhanced-for-ele…
mernst Nov 21, 2026
177bc42
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 21, 2026
49f34d3
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 21, 2026
89c74b3
Tighten and simplify constant conversion helpers
mernst Nov 21, 2026
8d63cf9
Handle tree-less calls in AliasingTransfer; recognize unboxing of typ…
mernst Nov 22, 2026
3a5ac9a
Merge remote-tracking branch 'origin/constant-narrowing-before-boxing…
mernst Nov 22, 2026
1a2ce5f
Handle a method call without a tree when processing postconditions an…
mernst Nov 22, 2026
ef7e6b6
Unbox an array initializer to its own primitive type, then widen; box…
mernst Nov 22, 2026
f606ab6
Merge remote-tracking branch 'origin/enhanced-for-element-conversion'…
mernst Nov 22, 2026
142d3ca
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Nov 22, 2026
9ecfb57
Address review comments: changelog placement, array-initializer conve…
mernst Nov 23, 2026
e3101ce
Rename `TypesUtils.isNumeric` to `isNumericPrimitive`
mernst Nov 23, 2026
b6f5afd
Rename constant-conversion methods to isNarrowableConstantConversion …
mernst Nov 23, 2026
f533a9b
Rename `TypeKindUtils.isNumeric` to `isNumericPrimitive` and `TreeInf…
mernst Nov 23, 2026
5485d39
Add date comments to `@Deprecated` annotations
mernst Nov 23, 2026
ee9c3e5
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
28a49b7
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
9a90ae2
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
0536ae7
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
7b3d58a
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
489b1cb
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
12095f8
Merge branch 'rename-isnumeric-primitive' of github.com:mernst/checke…
mernst Nov 23, 2026
0cd92a8
Test constant narrowing to primitive types; move isCompileTimeConstan…
mernst Nov 23, 2026
4059cab
Use `TypeKindUtils.isNumericPrimitive`
mernst Nov 23, 2026
61a4a55
Use `TypeKindUtils.isNumericPrimitive`
mernst Nov 23, 2026
56ea28e
Use `TypeKindUtils.isNumericPrimitive`
mernst Nov 23, 2026
930a8b7
Merge commit '5485d39aa5' into constant-narrowing-before-boxing
mernst Nov 23, 2026
ea51dae
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 23, 2026
1ecc0e9
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 23, 2026
558679c
Merge branch 'constant-narrowing-before-boxing' into enhanced-for-ele…
mernst Nov 23, 2026
c542400
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 23, 2026
d8ee691
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 23, 2026
45b7745
Clear annotations before installing boxed annotations; handle tree-le…
mernst Nov 23, 2026
5f89b80
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 23, 2026
76d65dd
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 23, 2026
494ed55
Merge the final version of pull request 8606
mernst Nov 23, 2026
7ea6814
Merge commit 22bb62bcc3, which landed pull request 8606
mernst Nov 23, 2026
2ee6eee
Merge branch 'master' into rename-isnumeric-primitive
mernst Nov 23, 2026
013f97f
Merge branch 'rename-isnumeric-primitive' into enhanced-for-element-c…
mernst Nov 23, 2026
bec1bae
Clarify the Javadoc of CFAbstractTransfer.visitValueLiteral
smillst Nov 23, 2026
e0941b5
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 23, 2026
e485697
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 23, 2026
b87e581
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 23, 2026
068bcf2
Adapt the factory value of an enhanced-for boxing conversion for boxing
mernst Nov 24, 2026
637663f
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 24, 2026
d9a668c
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 24, 2026
0315b99
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 24, 2026
b875c53
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 24, 2026
8759cfc
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 24, 2026
cad5f46
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 24, 2026
783cd73
Merge remote-tracking branch 'upstream/master' into enhanced-for-elem…
mernst Nov 25, 2026
ae376fe
Use Field.getShort and Field.getInt to avoid unboxing a nullable refe…
mernst Nov 25, 2026
c7f5823
A cast of a boxed primitive to a primitive type applies the unboxing …
mernst Nov 25, 2026
2b1d29a
Limit boxed and unboxed qualifiers to the qualifier upper bound; unbo…
mernst Nov 25, 2026
b7017db
Limit to the qualifier upper bound only in dataflow, so tree-level un…
mernst Nov 25, 2026
077d1b0
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 25, 2026
fd24b5f
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 25, 2026
1f6c7eb
Adapt the enhanced-for element for unboxing; clear leaked values in b…
mernst Nov 25, 2026
b7cbce1
Clarify BoxingConversion documentation; test for a boxed primitive ra…
mernst Nov 26, 2026
ec8a539
Use Field.getInt, getShort, setShort, and setInt rather than boxing i…
mernst Nov 26, 2026
1af1fd8
Merge remote-tracking branch 'origin/local-location-field-accessors' …
mernst Nov 26, 2026
9874f5c
Leave the Javadoc of the enhanced for loop's iterator and array varia…
mernst Nov 26, 2026
300023f
Write the narrowing explicitly; remove unneeded suppressions
mernst Nov 26, 2026
31eeca0
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 26, 2026
3134da5
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 26, 2026
c6ddf72
Reformat
mernst Nov 26, 2026
9e76743
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 26, 2026
01f3b71
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 26, 2026
f360c5c
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 26, 2026
44182a4
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 26, 2026
3b07f07
Merge the final version of pull request 8679
mernst Nov 26, 2026
e4909ce
Merge commit be58283d80, which landed pull request 8679
mernst Nov 26, 2026
f35e19a
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 26, 2026
4cba62b
Merge the final version of pull request 8679
mernst Nov 26, 2026
6daa729
Merge commit be58283d80, which landed pull request 8679
mernst Nov 26, 2026
38b69f8
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 26, 2026
003af03
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 26, 2026
ec53b30
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 26, 2026
6b4a1b7
Fix nullness issues in CFAbstractTransfer
mernst Nov 27, 2026
2bbe488
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 27, 2026
5b30287
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 27, 2026
aeb9c18
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 27, 2026
249d213
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 27, 2026
da02ef7
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 27, 2026
671e687
Keep conditional stores for a Boolean-bounded operand; clarify docs
mernst Nov 27, 2026
f5e959a
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 27, 2026
c5bff0a
Remove the enhanced-for boxing and unboxing branches of getValueFromF…
mernst Nov 29, 2026
36fc935
Document where postcondition diagnostics go when there is no invocati…
mernst Nov 29, 2026
784e4cf
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Nov 29, 2026
247429f
Merge remote-tracking branch 'origin/unboxing-keeps-conditional-store…
mernst Nov 29, 2026
bc1d7ff
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 29, 2026
5d9fd32
Move the CFAbstractTransfer changelog entries to the unreleased section
mernst Nov 29, 2026
1613830
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 29, 2026
cfc3541
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 29, 2026
8caad0e
Discard a boxed type's declared annotations before adding the boxed a…
mernst Nov 29, 2026
470c496
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 29, 2026
b6622db
Unbox a Boolean operand of a conditional expression whose type is boo…
mernst Nov 29, 2026
1e70eba
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 29, 2026
da17a0e
Merge branch 'master' into conditional-stores-of-operands
mernst Nov 30, 2026
c3b041b
Merge branch 'conditional-stores-of-operands' into unboxing-keeps-con…
mernst Nov 30, 2026
1f22446
Merge branch 'master' into enhanced-for-element-conversion
mernst Nov 30, 2026
d6b54ac
Merge branch 'enhanced-for-element-conversion' into unboxing-keeps-co…
mernst Nov 30, 2026
6f98923
Merge branch 'unboxing-keeps-conditional-stores' into conditional-and…
mernst Nov 30, 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 @@ -760,7 +760,7 @@ public TransferResult<CFValue, CFStore> visitMethodInvocation(
protected void processConditionalPostconditions(
MethodInvocationNode n,
ExecutableElement methodElement,
ExpressionTree tree,
@Nullable ExpressionTree tree,
CFStore thenStore,
CFStore elseStore) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,51 @@ public Void visitPrimitive(AnnotatedPrimitiveType t, Void p) {
}

/**
* Unboxes the type and replaces any interning type annotations with @Interned, since all
* primitives can safely use ==. See case 4 in the class comments.
* Returns a copy of {@code annos} in which @Interned replaces the interning type annotation, if
* any, because all primitives can safely use ==. See case 4 in the class comments.
*
* <p>{@inheritDoc}
*/
@Override
public AnnotatedPrimitiveType getUnboxedType(AnnotatedDeclaredType type) {
AnnotatedPrimitiveType primitive = super.getUnboxedType(type);
primitive.replaceAnnotation(INTERNED);
return primitive;
public AnnotationMirrorSet getUnboxedAnnotations(
AnnotationMirrorSet annos, TypeKind primitiveKind) {
return replaceInterningAnnotation(annos, INTERNED);
}

/**
* Returns a copy of {@code annos} in which @UnknownInterned replaces the interning type
* annotation, if any, because a boxed value need not be interned, even though every primitive is.
* For example, {@code Integer.valueOf(1000) == Integer.valueOf(1000)} can be false. The
* exceptions are {@code boolean} and {@code byte}: {@code Boolean.valueOf()} and {@code
* Byte.valueOf()} return a cached object for every value, so a boxed {@code boolean} or {@code
* byte} is @Interned.
*
* <p>{@inheritDoc}
*/
@Override
public AnnotationMirrorSet getBoxedAnnotations(
AnnotationMirrorSet annos, TypeKind primitiveKind) {
boolean everyValueCached = primitiveKind == TypeKind.BOOLEAN || primitiveKind == TypeKind.BYTE;
return replaceInterningAnnotation(annos, everyValueCached ? INTERNED : TOP);
}

/**
* Returns a copy of {@code annos} in which {@code interningAnno} replaces the annotation of the
* interning hierarchy, if any.
*
* @param annos a set of annotations
* @param interningAnno an annotation of the interning hierarchy
* @return a copy of {@code annos} that contains {@code interningAnno} in place of the annotation
* of the interning hierarchy
*/
private AnnotationMirrorSet replaceInterningAnnotation(
AnnotationMirrorSet annos, AnnotationMirror interningAnno) {
AnnotationMirrorSet result = new AnnotationMirrorSet(annos);
AnnotationMirror old = qualHierarchy.findAnnotationInSameHierarchy(annos, interningAnno);
if (old != null) {
result.remove(old);
}
result.add(interningAnno);
return result;
}
}
23 changes: 23 additions & 0 deletions checker/tests/fenum/BoxingKeepsFenum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import org.checkerframework.checker.fenum.qual.Fenum;

// Boxing and unboxing keep the fenum qualifier of the converted value, even though the declared
// return types of intValue() and valueOf() are @FenumUnqualified.
public class BoxingKeepsFenum {
void unboxArrayElement(@Fenum("A") Integer[] a) {
for (int x : a) {
@Fenum("A") int y = x;
}
int q = a[0];
@Fenum("A") int r = q;
}

void unbox(@Fenum("A") Integer i) {
int j = i;
@Fenum("A") int k = j;
}

void box(@Fenum("A") int i) {
Integer b = i;
@Fenum("A") Integer c = b;
}
}
35 changes: 35 additions & 0 deletions checker/tests/interning/ArrayInitializerBoxing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.util.Arrays;
import java.util.Iterator;
import org.checkerframework.checker.interning.qual.Interned;

// An array initializer that boxes or unboxes its elements.
public class ArrayInitializerBoxing {
void box(int i, long l, double d) {
Integer[] is = new Integer[] {i, i - 1, i};
Long[] ls = {l, l + 1};
Object[] os = new Object[] {i, l, d};
Iterator<Integer> itor = Arrays.stream(new Integer[] {i, i - 1}).iterator();
// :: error: [assignment]
@Interned Integer[] interned = new Integer[] {i};
}

void boxBooleanAndByte(boolean bool, byte b) {
@Interned Boolean[] bools = new Boolean[] {bool, bool};
@Interned Byte[] bytes = new Byte[] {b, b};
}

void unbox(Integer i, Long l) {
@Interned int[] is = new int[] {i, i};
@Interned long[] ls = {l, l};
}

void unboxAndWiden(Integer i) {
@Interned long[] ls = new long[] {i, i};
}

// The initializer's type is a type variable whose bound is a boxed primitive. It unboxes to
// int, which is then widened to long.
<T extends Integer> void unboxTypeVariable(T t) {
@Interned long[] ls = new long[] {t, t};
}
}
30 changes: 30 additions & 0 deletions checker/tests/interning/BoxingNotInterned.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import org.checkerframework.checker.interning.qual.Interned;

// A boxed value is not interned, even though every primitive is. The exceptions are boolean and
// byte, for which boxing returns a cached object.
public class BoxingNotInterned {
void box(int i) {
// :: error: [assignment]
@Interned Integer x = i;
// :: error: [assignment]
@Interned Object o = i;
Integer y = i;
// :: error: [assignment]
@Interned Integer z = y;
}

void boxByCast(int i, boolean bool) {
// :: error: [assignment]
@Interned Integer x = (Integer) i;
// :: error: [assignment]
@Interned Object o = (Object) i;
@Interned Boolean b = (Boolean) bool;
}

void boxBooleanAndByte(boolean bool, byte b) {
@Interned Boolean x = bool;
@Interned Object o = bool;
@Interned Byte y = b;
@Interned Object p = b;
}
}
37 changes: 37 additions & 0 deletions checker/tests/interning/ConstantNarrowingToByte.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import org.checkerframework.checker.interning.qual.Interned;

// Assignment conversion narrows a constant of type char, short, or int to byte before boxing it
// (JLS 5.2), so the value is boxed by Byte.valueOf(), which returns a cached object.
public class ConstantNarrowingToByte {
static final char C = 1;
static final short S = 1;

void narrowToByte() {
@Interned Byte b1 = (char) 1;
@Interned Byte b2 = (short) 1;
@Interned Byte b3 = 1;
@Interned Object o = b1;
}

void narrowConstantVariableToByte() {
@Interned Byte b1 = C;
@Interned Byte b2 = S;
final char localC = 2;
@Interned Byte b3 = localC;
@Interned Byte b4 = 'a';
}

void narrowToShort() {
// A boxed short is not interned.
// :: error: [assignment]
@Interned Short s = (char) 1;
}

void widenToShort() {
// Assignment conversion widens a constant byte to short before boxing it, so the value is boxed
// by Short.valueOf(), not by Byte.valueOf().
Short s = (byte) 1;
// :: error: [assignment]
@Interned Object o = s;
}
}
1 change: 1 addition & 0 deletions checker/tests/interning/Issue6716.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void method(Stream<Integer> integerStream) {
}

static @Interned Integer sum(Integer a, Integer b) {
// :: error: [return]
return a + b;
}
}
4 changes: 2 additions & 2 deletions checker/tests/interning/MethodInvocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ void internedCharacterParameter(@Interned Character a) {}

// See https://github.com/typetools/checker-framework/issues/84
void internedCharacterParametersClient() {
// TODO: autoboxing from char to Character // :: error: [argument]
// :: error: [argument]
internedCharacterParameter('\u00E4'); // lowercase a with umlaut
// TODO: autoboxing from char to Character // :: error: [argument]
// :: error: [argument]
internedCharacterParameter('a');
// :: error: [argument]
internedCharacterParameter(Character.valueOf('a'));
Expand Down
46 changes: 46 additions & 0 deletions checker/tests/interning/SwitchExpressionBoxing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// A switch expression whose results are boxed booleans is interned, but one whose results are
// boxed ints is not.

// @below-java17-jdk-skip-test

import org.checkerframework.checker.interning.qual.Interned;

public class SwitchExpressionBoxing {
enum Kind {
A,
B
}

@Interned Boolean equalTo(Kind k, int x, int y) {
return switch (k) {
case A -> x == y;
case B -> x != y;
};
}

Integer sum(Kind k, int x, int y) {
return switch (k) {
case A -> x + y;
case B -> x - y;
};
}

void assignEqualTo(Kind k, int x, int y) {
Boolean result =
switch (k) {
case A -> x == y;
case B -> x != y;
};
@Interned Boolean interned = result;
}

void assignSum(Kind k, int x, int y) {
Integer result =
switch (k) {
case A -> x + y;
case B -> x - y;
};
// :: error: [assignment]
@Interned Integer interned = result;
}
}
16 changes: 16 additions & 0 deletions checker/tests/lock/UnboxedCopyNotGuarded.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import org.checkerframework.checker.lock.qual.GuardedBy;

// Unboxing a guarded value yields a primitive copy, which no lock guards.
public class UnboxedCopyNotGuarded {
final Object lock = new Object();

@GuardedBy("lock") Object guarded = 0;

void useCopyOutsideSynchronized() {
int x;
synchronized (lock) {
x = (Integer) guarded;
}
System.out.println(x);
}
}
108 changes: 108 additions & 0 deletions checker/tests/nullness/ConditionalAndOrUnboxing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import org.checkerframework.checker.nullness.qual.EnsuresNonNullIf;
import org.checkerframework.checker.nullness.qual.Nullable;

// The operands of && and || are unboxed, so a Boolean operand is non-null after it is evaluated.
public class ConditionalAndOrUnboxing {
void leftOfAnd(@Nullable Boolean b, boolean x) {
// :: error: [unboxing.of.nullable]
if (b && x) {}
b.toString();
}

void leftOfOr(@Nullable Boolean b, boolean x) {
// :: error: [unboxing.of.nullable]
if (b || x) {}
b.toString();
}

void rightOfAnd(boolean x, @Nullable Boolean b) {
// :: error: [unboxing.of.nullable]
if (x && b) {
b.toString();
}
// The right operand is not evaluated when x is false.
// :: error: [dereference.of.nullable]
b.toString();
}

void rightOfOr(boolean x, @Nullable Boolean b) {
// :: error: [unboxing.of.nullable]
if (x || b) {
} else {
b.toString();
}
// The right operand is not evaluated when x is true.
// :: error: [dereference.of.nullable]
b.toString();
}

// Unboxing an operand keeps the facts that hold when the operand is true or false.

@EnsuresNonNullIf(expression = "#1", result = true)
static Boolean isNN(@Nullable Object o) {
return o != null;
}

@EnsuresNonNullIf(expression = "#1", result = false)
static Boolean isNull(@Nullable Object o) {
return o == null;
}

boolean refinedLeftOfAnd(@Nullable Object o) {
return isNN(o) && o.hashCode() > 0;
}

boolean refinedLeftOfOr(@Nullable Object o) {
return isNull(o) || o.hashCode() > 0;
}

boolean refinedCastLeftOfAnd(@Nullable Object o) {
return ((Boolean) (o != null)) && o.hashCode() > 0;
}

void refinedRightOfAnd(boolean x, @Nullable Object o) {
if (x && isNN(o)) {
o.hashCode();
}
}

void refinedRightOfOr(boolean x, @Nullable Object o) {
if (x || isNull(o)) {
} else {
o.hashCode();
}
}

// The facts that hold when an operand is true or false do not necessarily hold when the
// enclosing expression is true or false.

void unrefinedLeftOfAnd(@Nullable Object o, boolean x) {
if (isNN(o) && x) {
} else {
// :: error: [dereference.of.nullable]
o.hashCode();
}
}

void unrefinedLeftOfOr(@Nullable Object o, boolean x) {
if (isNN(o) || x) {
// :: error: [dereference.of.nullable]
o.hashCode();
}
}

void unrefinedRightOfAnd(boolean x, @Nullable Object o) {
if (x && isNN(o)) {
} else {
// :: error: [dereference.of.nullable]
o.hashCode();
}
}

void unrefinedRightOfOr(boolean x, @Nullable Object o) {
if (x || isNN(o)) {
// :: error: [dereference.of.nullable]
o.hashCode();
}
}
}
Loading
Loading