Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing improved Optional Checker #6901

Open
wants to merge 575 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
575 commits
Select commit Hold shift + click to select a range
5586258
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 26, 2024
6558f07
Use terminology "callers" and "callees"
mernst Jun 26, 2024
650f123
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 26, 2024
60a0da5
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 26, 2024
e936fd3
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jun 27, 2024
7923e92
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 27, 2024
fd6c40a
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jun 29, 2024
cfd5df6
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 29, 2024
9bf2c2f
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 29, 2024
1f49898
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 29, 2024
40e0dba
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jun 29, 2024
1e50657
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 2, 2024
18436a9
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 2, 2024
e1e01c3
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 2, 2024
1876cc2
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 2, 2024
fd1d59d
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 2, 2024
f52c321
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 4, 2024
73e2762
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 4, 2024
dbfc5f2
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
3be76a1
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
bc4312f
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
da35f9c
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
2f06c53
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 4, 2024
3e1df52
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
c797805
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
ac3ec3c
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
aa0c22b
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 4, 2024
aa02fc0
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 5, 2024
845c9fe
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 5, 2024
71b9a86
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 5, 2024
e704084
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 5, 2024
fbe8639
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 5, 2024
affdb91
Address review comments in `JavaExpression`
jyoo980 Jul 6, 2024
049d2b9
Address review comment for `CFAbstractTransfer`
jyoo980 Jul 6, 2024
c06a912
Use terminology "callers" and "callees"
jyoo980 Jul 6, 2024
27edf3d
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 6, 2024
edf1b53
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 6, 2024
6b95b3b
Address review comments for `OptionalVisitor`
jyoo980 Jul 6, 2024
0df969f
Update `@skip-test` comment in `OptionalRelyGuaranteeTest`
jyoo980 Jul 7, 2024
20e60ee
Change "-AdisableOptionalChecker" to "-ArunAsOptionalChecker"
jyoo980 Jul 7, 2024
118fefa
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' in…
jyoo980 Jul 7, 2024
78529a5
Use methods that take a collection
jyoo980 Jul 7, 2024
9114b21
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 7, 2024
b9cdbdc
Merge ../checker-framework-fork-mernst-branch-yoo-nonempty-optional-t…
mernst Jul 7, 2024
ab3b320
Clarify that method trees are declarations
jyoo980 Jul 7, 2024
ecf7170
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 8, 2024
771b267
Introduce boolean variable
mernst Jul 8, 2024
32d2fcd
Simplify variable name
mernst Jul 8, 2024
dddf1a8
Renamings
mernst Jul 8, 2024
1f20bec
Comments
mernst Jul 8, 2024
c6ce0d1
Fix Javadoc
mernst Jul 8, 2024
aa601ec
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 9, 2024
12b7a22
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 11, 2024
6c1e80f
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 12, 2024
e03d24a
Address review comment in `NonEmptyChecker.java`
jyoo980 Jul 14, 2024
615ebb9
Short-circuit callee check in methods for Non-Empty Checker in `Optio…
jyoo980 Jul 14, 2024
ec7ee6e
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 14, 2024
d9dbca2
Remove import statement
mernst Jul 15, 2024
c79a6bf
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 15, 2024
6655d09
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 16, 2024
37b8631
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 18, 2024
4ec8b51
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 19, 2024
5fa3ea1
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 19, 2024
4bf42ef
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Jul 19, 2024
d2045b3
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 20, 2024
c02ad4a
Add a TODO to re-name the `RevisedOptionalChecker`
jyoo980 Jul 21, 2024
bf48327
Refactor `OptionalTransfer.getReceiverDeclaration`
jyoo980 Jul 21, 2024
1392abf
Update documentation for where a method call receiver is being looked up
jyoo980 Jul 21, 2024
f6829f3
Make compile.
smillst Jul 23, 2024
ee92c77
Fix Could not instantiate bug.
smillst Jul 23, 2024
5d63542
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 26, 2024
d13d050
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Jul 31, 2024
12e119d
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 2, 2024
0f468a0
Renaming `OptionalTransfer#getReceiverDeclaration` to `getLeftmostRec…
jyoo980 Aug 4, 2024
8870ab9
Merge branch 'master' into yoo/nonempty-optional-transfer-nonempty-in…
jyoo980 Aug 4, 2024
0864ddc
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 5, 2024
6acef19
Code review changes
mernst Aug 5, 2024
847993e
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Aug 5, 2024
6403155
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 6, 2024
52b79b5
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 7, 2024
b7466db
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 10, 2024
6b3763f
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 11, 2024
8ffa05b
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 15, 2024
12e3a1e
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 15, 2024
bc8f3a4
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 19, 2024
61e2ba1
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 20, 2024
4d224b2
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 20, 2024
cf07601
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Aug 20, 2024
3d22c3f
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Aug 21, 2024
83220f4
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 1, 2024
eeb7c5d
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 2, 2024
97b7ba0
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 2, 2024
78f953a
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 3, 2024
c1a25f3
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 4, 2024
80c8b1c
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 4, 2024
2254dc9
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 5, 2024
8a2736f
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 5, 2024
745398b
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 9, 2024
34aaf06
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 9, 2024
933adea
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 9, 2024
28eb6f1
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 9, 2024
5f4bcc3
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 9, 2024
b1757fe
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Sep 9, 2024
28fa63d
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 11, 2024
b1cd688
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 13, 2024
0a97b27
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 13, 2024
4c5dc52
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 16, 2024
7a22e43
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 17, 2024
9d2539a
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 17, 2024
9e8f230
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 18, 2024
2834594
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 19, 2024
bd930aa
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 22, 2024
800d7cd
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 24, 2024
f79489a
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 24, 2024
19c8a2c
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 26, 2024
5b028dd
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 26, 2024
a2597a5
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Sep 29, 2024
b35bfa2
Merge remote-tracking branch 'typetools/master' into yoo/nonempty-opt…
jyoo980 Oct 1, 2024
bfceeb9
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Oct 2, 2024
0b59d45
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 2, 2024
3ad3815
Fixing compilation issue
jyoo980 Oct 2, 2024
5e2baa7
Merge branch 'master' into yoo/nonempty-optional-transfer-nonempty-in…
jyoo980 Oct 2, 2024
4a4f1a9
Avoiding crash when Non-Empty Checker is run
jyoo980 Oct 2, 2024
a20fcd7
Adding comment to `NonEmptyChecker#RUN_AS_OPTIONAL_CHECKER_KEY`
jyoo980 Oct 3, 2024
1af5e66
Merge branch 'typetools:master' into yoo/nonempty-optional-transfer-n…
jyoo980 Oct 3, 2024
fb42285
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Oct 3, 2024
0af1fa4
Avoiding re-computation of the `-ArunAsOptionalChecker` value
jyoo980 Oct 3, 2024
db2fc1f
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 4, 2024
1d839d8
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 4, 2024
94d873a
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 4, 2024
296646d
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 5, 2024
bb8aaa8
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 5, 2024
aca6845
Code review tweaks
mernst Oct 5, 2024
75edf7d
Code review tweaks
mernst Oct 5, 2024
600d90f
Addressing comments in `NonEmptyChecker.java`
jyoo980 Oct 5, 2024
f0b4bff
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 7, 2024
27ce48d
Merge branch 'master' into yoo/nonempty-optional-transfer-nonempty-in…
jyoo980 Oct 7, 2024
f750dfb
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Oct 7, 2024
650f334
Fixing compilation issue
jyoo980 Oct 7, 2024
f6d6316
Merge branch 'yoo/nonempty-optional-transfer-nonempty-information' of…
mernst Oct 7, 2024
5f5099b
Addressing some comments in `OptionalVisitor.java`
jyoo980 Oct 7, 2024
37de026
Renaming `JavaExpression#getReceiverDeclarationInClass` to `JavaExpre…
jyoo980 Oct 7, 2024
ffe250d
Merge branch 'master' into yoo/nonempty-optional-transfer-nonempty-in…
jyoo980 Oct 7, 2024
0daa5e5
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 8, 2024
3127f48
Add todo note for work to eliminate false positive
jyoo980 Oct 8, 2024
83d1b6c
Merge ../checker-framework-branch-master into yoo/nonempty-optional-t…
mernst Oct 9, 2024
5c915d4
Merge remote-tracking branch 'typetools/master' into yoo/nonempty-opt…
jyoo980 Oct 9, 2024
60295ad
Merge remote-tracking branch 'typetools/master' into yoo/optional-che…
jyoo980 Nov 13, 2024
e164966
Re-start refactoring
jyoo980 Nov 13, 2024
3d4c756
Recover post-refactoring changes from other branch
mernst Nov 14, 2024
8290828
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 17, 2024
4edeeee
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 20, 2024
21dc00e
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 20, 2024
2e32f9b
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 20, 2024
827392b
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 20, 2024
3fd57c8
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 21, 2024
4e3b335
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 22, 2024
4406957
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 22, 2024
f242bc8
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Nov 22, 2024
eb57863
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Nov 22, 2024
3fd5455
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Nov 22, 2024
bc3d3f9
Fixing compilation error
jyoo980 Nov 22, 2024
42c38b5
Ensuring `OptionalImplChecker` respects `optional` prefix
jyoo980 Nov 22, 2024
8242e12
Enabling rely-guarantee test case for `Optional Checker`
jyoo980 Nov 22, 2024
7398b1b
Merge remote-tracking branch 'typetools/master' into yoo/optional-che…
jyoo980 Nov 23, 2024
b974dd8
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Nov 23, 2024
27313f7
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Nov 23, 2024
2bb39d2
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 23, 2024
ec084f9
Making the Non-Empty test suite pass
jyoo980 Nov 24, 2024
b15e916
Updating Non-Empty Checker manual entry with `-AcheckAllDefs`
jyoo980 Nov 24, 2024
275d99a
Work around crash
mernst Nov 25, 2024
8270335
Removing outdated documentation for the Optional Checker
jyoo980 Nov 25, 2024
5248e71
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Nov 25, 2024
9b721c0
Undo a change
mernst Nov 26, 2024
e021997
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Nov 26, 2024
7c738f1
Updating documentation, removing unnecessary override
jyoo980 Nov 27, 2024
afa8daa
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Nov 27, 2024
a0909b7
Removing unnecessary `-AcheckAllDefs` flag in Non-Empty Checker
jyoo980 Nov 27, 2024
2acbc8a
Adding documentation for parent checker check in `NonEmptyChecker#sho…
jyoo980 Nov 27, 2024
dee9c8c
Storing method name strings, not entire method trees
jyoo980 Nov 27, 2024
d263ad1
Addressing additional comments
jyoo980 Nov 28, 2024
de5ed5c
Abstracting out message key for Rule 3
jyoo980 Nov 28, 2024
3160d2c
Annotate parameter with `@CompilerMessageKey`
jyoo980 Nov 28, 2024
52acc85
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 2, 2024
5219851
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 2, 2024
738452b
Adding additional check for "prefer.map.and.orelse"
jyoo980 Dec 2, 2024
0c130e0
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 2, 2024
9fd4bd9
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 2, 2024
769d3c2
Fixing Javadoc
jyoo980 Dec 2, 2024
6b7213a
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
jyoo980 Dec 2, 2024
73ebbbe
Passing `framework:checkOptional` task
jyoo980 Dec 3, 2024
d00de27
Addressing PR comment
jyoo980 Dec 3, 2024
401588e
Adding comment to `OptionalImplTypeValidator` constructor
jyoo980 Dec 3, 2024
add5c7a
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 3, 2024
f57b895
Updating Javadoc
jyoo980 Dec 3, 2024
d6e84e0
Whitespace fixes
mernst Dec 3, 2024
e6ed51e
Typo fix
mernst Dec 5, 2024
e116c37
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 6, 2024
1bc7387
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 9, 2024
e1bf05f
Merge remote-tracking branch 'typetools/master' into yoo/optional-che…
jyoo980 Dec 10, 2024
2670e53
Merge branch 'master' into yoo/optional-checker-latest
jyoo980 Dec 10, 2024
b2717f0
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 11, 2024
c210721
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 11, 2024
395e357
Merge remote-tracking branch 'typetools/master' into yoo/optional-che…
jyoo980 Dec 12, 2024
19844ac
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 12, 2024
026503b
Undo workaround
mernst Dec 16, 2024
0eed3f0
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 17, 2024
34ddd55
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 17, 2024
3494a6b
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 17, 2024
93bf710
Adapt to upstream change
mernst Dec 17, 2024
64ebd07
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Dec 17, 2024
e326f7e
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 17, 2024
41eeb84
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 17, 2024
a9f37a7
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Dec 17, 2024
1829076
Renamings and documentation
mernst Dec 18, 2024
ad03029
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 18, 2024
4ae62e5
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Dec 18, 2024
102229c
Tweaks
mernst Dec 18, 2024
58dbc46
Merge branch 'yoo/optional-checker-latest' of github.com:jyoo980/chec…
mernst Dec 18, 2024
d79ba4d
Javadoc fix
mernst Dec 18, 2024
73762dd
Merge remote-tracking branch 'typetools/master' into yoo/optional-che…
jyoo980 Dec 18, 2024
209bb9f
Addressing comments in `NonEmptyChecker.java`
jyoo980 Dec 18, 2024
239c09b
Extracting `asAssignmentTree` method to `TreeUtils`
jyoo980 Dec 18, 2024
6b009b5
Do not shadow `parentChecker` in `NonEmptyChecker`
jyoo980 Dec 19, 2024
0751a9b
Documenting why `OptionalImplVisitor#sameExpression` is not in `TreeU…
jyoo980 Dec 19, 2024
5ee2916
Making naming consistent
jyoo980 Dec 19, 2024
1f04215
Improving Javadoc
jyoo980 Dec 19, 2024
9c30676
Updating blurb about the Non-Empty Checker's default modality
jyoo980 Dec 19, 2024
bed6074
Discontinuing use of string comparison in `JavaExpression#getReceiver…
jyoo980 Dec 19, 2024
4199f77
Supporting inner/outer `@NonEmpty` class field declarations
jyoo980 Dec 23, 2024
d85e5d5
Adding test for nested methods using non-empty declarations in the Op…
jyoo980 Dec 23, 2024
523b09a
Updating documentation for `OptionalImplVisitor#checkConditionalState…
jyoo980 Dec 24, 2024
30c6e38
Updating documentation for `OptionalImplVisitor#handleAssignmentInCon…
jyoo980 Dec 25, 2024
007fa5c
Removing impossible code path in `JavaExpression#getLeftmostReceiverO…
jyoo980 Dec 25, 2024
8a148c2
Adding test case for disjoint live variable ranges for the Optional C…
jyoo980 Dec 26, 2024
455adae
Adding test case for `Optional` variable in non top-level scope
jyoo980 Dec 29, 2024
c651b2e
Consider purity in issuing `prefer.map.and.orelse` warning
jyoo980 Dec 29, 2024
195e617
Disambiguating Javadoc for `JavaExpression#getReceiverDeclarationInMe…
jyoo980 Dec 30, 2024
5329d5b
Updating Javadoc for `OptionalImplVisitor#checkConditionalStatementIs…
jyoo980 Dec 30, 2024
99eabcc
Updating Javadoc for `OptionalImplVisitor#handleCreationElimination`
jyoo980 Dec 30, 2024
6e58727
Consider purity in `OptionalImplVisitor#handleConditionalStatementIsP…
jyoo980 Dec 31, 2024
f22dc7d
Updating Javadoc for `OptionalImplVisitor#calleesToCallers`
jyoo980 Dec 31, 2024
497b8a7
Documenting relationship between `namesOfMethodsToVerifyWithNonEmptyC…
jyoo980 Dec 31, 2024
471d07d
Avoiding recursion in `JavaExpression#getLeftmostReceiverOfMethodInvo…
jyoo980 Jan 1, 2025
4581c3c
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Jan 2, 2025
bc725ba
Merge ../checker-framework-branch-master into yoo/optional-checker-la…
mernst Jan 3, 2025
44b9e74
Get annotations for elements.
smillst Jan 3, 2025
d0d120f
Incorporating Suzanne's changes to enable lookup of annotations on pa…
jyoo980 Jan 3, 2025
d1afa0f
Adding test cases for `@NonEmpty` annotated field in superclasses
jyoo980 Jan 3, 2025
7a01b80
Applying minor refactorings
jyoo980 Jan 3, 2025
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 @@ -8,8 +8,9 @@
import org.checkerframework.framework.qual.SubtypeOf;

/**
* The {@link java.util.Collection Collection}, {@link java.util.Iterator Iterator}, {@link
* java.lang.Iterable Iterable}, or {@link java.util.Map Map} is definitely non-empty.
* The {@link java.util.Collection Collection}, {@link java.util.Iterator Iterator}, {@link Iterable
* Iterable}, or {@link java.util.Map Map}, or {@link java.util.stream.Stream Stream} is definitely
* non-empty.
*
* @checker_framework.manual #non-empty-checker Non-Empty Checker
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

/**
* The {@link java.util.Collection Collection}, {@link java.util.Iterator Iterator}, {@link
* java.lang.Iterable Iterable}, or {@link java.util.Map Map} may or may not be empty.
* java.lang.Iterable Iterable}, {@link java.util.Map Map}, or {@link java.util.stream.Stream
* Stream} may or may not be empty.
*
* @checker_framework.manual #non-empty-checker Non-Empty Checker
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,70 @@
package org.checkerframework.checker.nonempty;

import com.sun.source.tree.MethodTree;
import java.util.Set;
import org.checkerframework.checker.optional.OptionalChecker;
import org.checkerframework.checker.optional.OptionalImplChecker;
import org.checkerframework.checker.optional.OptionalImplVisitor;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.source.SourceChecker;

/**
* A type-checker that prevents {@link java.util.NoSuchElementException} in the use of container
* classes.
*
* <p>Runs the {@link org.checkerframework.checker.optional.OptionalImplChecker} (as a subchecker)
* by default. This checker should not yet be run as a standalone checker. The Non-Empty Checker
* uses explicitly-written (i.e., programmer-written) annotations from the Non-Empty type system to
* refine the analysis of operations on containers (e.g., Streams, Collections) that result in
* values of type {@link java.util.Optional}.
*
* @checker_framework.manual #non-empty-checker Non-Empty Checker
*/
public class NonEmptyChecker extends BaseTypeChecker {

/** A cached instance of {@link OptionalImplVisitor} */
private OptionalImplVisitor optionalImplVisitor;

/** Creates a NonEmptyChecker. */
public NonEmptyChecker() {
super();
}

@Override
protected Set<Class<? extends SourceChecker>> getImmediateSubcheckerClasses() {
Set<Class<? extends SourceChecker>> checkers = super.getImmediateSubcheckerClasses();
// Ideally, the OptionalImplChecker should only be added as a subchecker if this Non-Empty
// Checker is being run in aggregate with the top-level Optional Checker
// However, it appears that this information (via SourceChecker#getParentChecker()) is not
// available at the time when this method is called.
checkers.add(OptionalImplChecker.class);
return checkers;
}

@Override
public boolean shouldSkipDefs(MethodTree tree) {
if (!(this.parentChecker instanceof OptionalChecker)) {
// The parent checker being null, or not being an instance of the top-level Optional Checker
// indicates that this Non-Empty Checker is being run independently.
// Check all definitions in this case, not just the ones relevant to the Optional Checker's
// guarantee.
return false;
}
return !getMethodsToVerify().contains(tree.getName().toString());
}

/**
* Obtains the methods to verify w.r.t. the Non-Empty type system from the Optional Checker.
*
* @return the set of names of the methods to be verified by the Non-Empty Checker
* @throws AssertionError if the {@link OptionalImplChecker} is not a subchecker of this checker
*/
private Set<String> getMethodsToVerify() {
if (optionalImplVisitor == null) {
OptionalImplChecker optionalCheckerImpl = getSubchecker(OptionalImplChecker.class);
assert optionalCheckerImpl != null;
optionalImplVisitor = (OptionalImplVisitor) optionalCheckerImpl.getVisitor();
}
return optionalImplVisitor.getNamesOfMethodsToVerifyWithNonEmptyChecker();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public TransferResult<NullnessValue, NullnessStore> visitMethodInvocation(
}
if (isKeyFor) {
AnnotatedTypeMirror receiverType = nullnessTypeFactory.getReceiverType(n.getTree());
if (!hasNullableValueType(receiverType)) {
if (!isValueTypeNullable(receiverType)) {
makeNonNull(result, n);
refineToNonNull(result);
}
Expand All @@ -446,7 +446,7 @@ public TransferResult<NullnessValue, NullnessStore> visitMethodInvocation(
* @param mapOrSubtype the Map type, or a subtype
* @return true if mapType's value type is @Nullable
*/
private boolean hasNullableValueType(AnnotatedTypeMirror mapOrSubtype) {
private boolean isValueTypeNullable(AnnotatedTypeMirror mapOrSubtype) {
AnnotatedDeclaredType mapType =
AnnotatedTypes.asSuper(nullnessTypeFactory, mapOrSubtype, MAP_TYPE);
int numTypeArguments = mapType.getTypeArguments().size();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
package org.checkerframework.checker.optional;

import java.util.Optional;
import java.util.Set;
import org.checkerframework.common.aliasing.AliasingChecker;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.qual.RelevantJavaTypes;
import org.checkerframework.framework.qual.StubFiles;
import java.util.ArrayList;
import java.util.Collection;
import org.checkerframework.checker.nonempty.NonEmptyChecker;
import org.checkerframework.framework.source.AggregateChecker;
import org.checkerframework.framework.source.SourceChecker;
import org.checkerframework.framework.source.SupportedOptions;

/**
* A type-checker that prevents misuse of the {@link java.util.Optional} class.
* A type-checker that prevents {@link java.util.NoSuchElementException} in the use of the {@link
* java.util.Optional} class.
*
* @checker_framework.manual #optional-checker Optional Checker
*/
// TODO: For a call to `@Optional#ofNullable`, if the argument has type
// @NonNull, make the return type have type @Present.
@RelevantJavaTypes(Optional.class)
@StubFiles({"javaparser.astub"})
@SupportedOptions("optionalMapAssumeNonNull")
public class OptionalChecker extends BaseTypeChecker {
/** Create an OptionalChecker. */
public class OptionalChecker extends AggregateChecker {

/** Creates a new {@link org.checkerframework.checker.optional.OptionalChecker} */
public OptionalChecker() {}

@Override
protected Set<Class<? extends SourceChecker>> getImmediateSubcheckerClasses() {
Set<Class<? extends SourceChecker>> subcheckers = super.getImmediateSubcheckerClasses();
subcheckers.add(AliasingChecker.class);
return subcheckers;
protected Collection<Class<? extends SourceChecker>> getSupportedCheckers() {
Collection<Class<? extends SourceChecker>> checkers = new ArrayList<>(2);
checkers.add(NonEmptyChecker.class);
return checkers;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import org.checkerframework.javacutil.AnnotationBuilder;
import org.checkerframework.javacutil.TreeUtils;

/** OptionalAnnotatedTypeFactory for the Optional Checker. */
public class OptionalAnnotatedTypeFactory extends BaseAnnotatedTypeFactory {
/** Type factory for the OptionalImplChecker. */
public class OptionalImplAnnotatedTypeFactory extends BaseAnnotatedTypeFactory {

/** The element for java.util.Optional.map(). */
private final ExecutableElement optionalMap;
Expand All @@ -31,11 +31,12 @@ public class OptionalAnnotatedTypeFactory extends BaseAnnotatedTypeFactory {
protected final AnnotationMirror PRESENT = AnnotationBuilder.fromClass(elements, Present.class);

/**
* Creates an OptionalAnnotatedTypeFactory.
* Creates an OptionalImplAnnotatedTypeFactory.
*
* @param checker the Optional Checker associated with this type factory
* @param checker the {@link org.checkerframework.checker.optional.OptionalImplChecker} associated
* with this type factory
*/
public OptionalAnnotatedTypeFactory(BaseTypeChecker checker) {
public OptionalImplAnnotatedTypeFactory(BaseTypeChecker checker) {
super(checker);
postInit();
optionalMap = TreeUtils.getMethodOrNull("java.util.Optional", "map", 1, getProcessingEnv());
Expand All @@ -49,13 +50,13 @@ protected void addComputedTypeAnnotations(Tree tree, AnnotatedTypeMirror type, b

/**
* If {@code tree} is a call to {@link java.util.Optional#map(Function)} whose argument is a
* method reference, then this method adds {@code @Present} to {@code type} if the following is
* method reference m, then this method adds {@code @Present} to {@code type} if the following is
* true:
*
* <ul>
* <li>The type of the receiver to {@link java.util.Optional#map(Function)} is {@code @Present},
* and
* <li>{@link #returnHasNullable(MemberReferenceTree)} returns false.
* <li>{@link #isReturnTypeNullable(MemberReferenceTree)} returns false for m.
* </ul>
*
* @param tree a tree
Expand All @@ -67,39 +68,41 @@ private void optionalMapNonNull(Tree tree, AnnotatedTypeMirror type) {
}
MethodInvocationTree mapTree = (MethodInvocationTree) tree;
ExpressionTree argTree = mapTree.getArguments().get(0);
if (argTree.getKind() == Kind.MEMBER_REFERENCE) {
MemberReferenceTree memberReferenceTree = (MemberReferenceTree) argTree;
AnnotatedTypeMirror optType = getReceiverType(mapTree);
if (optType == null || !optType.hasEffectiveAnnotation(Present.class)) {
return;
}
if (!returnHasNullable(memberReferenceTree)) {
// The method still could have a @PolyNull on the return and might return null.
// If @PolyNull is the primary annotation on the parameter and not on any type
// arguments or array elements, then it is still safe to mark the optional type as
// present.
// TODO: Add the check for poly null on arguments.
type.replaceAnnotation(PRESENT);
}
if (argTree.getKind() != Kind.MEMBER_REFERENCE) {
return;
}
AnnotatedTypeMirror mapReceiver = getReceiverType(mapTree);
if (mapReceiver == null || !mapReceiver.hasEffectiveAnnotation(Present.class)) {
return;
}
MemberReferenceTree memberReferenceTree = (MemberReferenceTree) argTree;
if (!isReturnTypeNullable(memberReferenceTree)) {
// The method still could have a @PolyNull on the return and might return null.
// If @PolyNull is the primary annotation on the parameter and not on any type
// arguments or array elements, then it is still safe to mark the optional type as
// present.
// TODO: Add the check for @PolyNull on arguments.
type.replaceAnnotation(PRESENT);
}
}

/**
* Returns true if the return type of the function type of {@code memberReferenceTree} is
* annotated with {@code @Nullable}.
*
* @param memberReferenceTree a member reference
* @param memberReferenceTree a member reference (which is to a method or constructor)
* @return true if the return type of the function type of {@code memberReferenceTree} is
* annotated with {@code @Nullable}
*/
private boolean returnHasNullable(MemberReferenceTree memberReferenceTree) {
private boolean isReturnTypeNullable(MemberReferenceTree memberReferenceTree) {
// A member reference refers to either a method or a constructor.
if (TreeUtils.MemberReferenceKind.getMemberReferenceKind(memberReferenceTree)
.isConstructorReference()) {
return false;
}
ExecutableElement memberReferenceFuncType = TreeUtils.elementFromUse(memberReferenceTree);
if (memberReferenceFuncType.getEnclosingElement().getKind() == ElementKind.ANNOTATION_TYPE) {
// Annotation element accessor are always non-null;
// Annotation element accessors are always non-null;
return false;
}

Expand All @@ -111,10 +114,10 @@ private boolean returnHasNullable(MemberReferenceTree memberReferenceTree) {
}

/**
* Returns true if {@code annos} contains a nullable annotation.
* Returns true if {@code annos} contains an annotation named "Nullable".
*
* @param annos a collection of annotations
* @return true if {@code annos} contains a nullable annotation
* @return true if {@code annos} contains an annotation named "Nullable".
*/
private boolean containsNullable(Collection<? extends AnnotationMirror> annos) {
for (AnnotationMirror anno : annos) {
Expand All @@ -128,6 +131,6 @@ private boolean containsNullable(Collection<? extends AnnotationMirror> annos) {
@Override
public CFTransfer createFlowTransferFunction(
CFAbstractAnalysis<CFValue, CFStore, CFTransfer> analysis) {
return new OptionalTransfer(analysis);
return new OptionalImplTransfer(analysis);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.checkerframework.checker.optional;

import java.util.NavigableSet;
import java.util.Optional;
import java.util.Set;
import org.checkerframework.common.aliasing.AliasingChecker;
import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.framework.qual.RelevantJavaTypes;
import org.checkerframework.framework.qual.StubFiles;
import org.checkerframework.framework.source.SourceChecker;
import org.checkerframework.framework.source.SupportedOptions;

/**
* The implementation of a type-checker that prevents misuse of the {@link java.util.Optional}
* class.
*
* @checker_framework.manual #optional-checker Optional Checker
*/
// TODO: For a call to `@Optional#ofNullable`, if the argument has type
// @NonNull, make the return type have type @Present.
@RelevantJavaTypes(Optional.class)
@StubFiles({"javaparser.astub"})
@SupportedOptions("optionalMapAssumeNonNull")
public class OptionalImplChecker extends BaseTypeChecker {
/** Create an OptionalImplChecker. */
public OptionalImplChecker() {}

@Override
protected Set<Class<? extends SourceChecker>> getImmediateSubcheckerClasses() {
Set<Class<? extends SourceChecker>> subcheckers = super.getImmediateSubcheckerClasses();
subcheckers.add(AliasingChecker.class);
return subcheckers;
}

/** Use "optional", rather than "optionalimpl", as the {@link SuppressWarnings} prefix. */
@Override
public NavigableSet<String> getSuppressWarningsPrefixes() {
NavigableSet<String> prefixes = super.getSuppressWarningsPrefixes();
prefixes.add("optional");
return prefixes;
}
}
Loading