Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
482 commits
Select commit Hold shift + click to select a range
2d9d66b
Merge ../checker-framework-fork-mernst-branch-canonical-annotation-wi…
mernst May 2, 2026
0669b86
Code review changes
mernst May 2, 2026
9802e30
Rename `IteratorPreservesRemove` to `IteratorPolyShrink`
mernst May 2, 2026
20f03d1
Update manual
mernst May 2, 2026
2297182
fixed typos in javadoc
YukiYang31 May 2, 2026
6c22d05
clean up methodFromUse in ShrinkAnnotatedTypeFactory and add document…
YukiYang31 May 2, 2026
a7c8b4b
extends special treatment of iterator method to ListIterator. TODO: a…
YukiYang31 May 3, 2026
4a17235
add listiterator handler in grow and replace.
YukiYang31 May 4, 2026
ffcfd9f
reorganize methodFromUse for both grow and replace annotatedTypeFactory.
YukiYang31 May 4, 2026
d34d794
rename IteratorPolyShrink to IteratorPolyMod
YukiYang31 May 4, 2026
b21d486
Merge branch 'master' into modifiability
YukiYang31 May 4, 2026
36fc863
add more cases to SubtypeCapabilityPreservationTest
YukiYang31 May 4, 2026
7c14cd2
Better way to test
mernst May 5, 2026
e582242
Merge ../checker-framework-branch-master into canonical-annotation-wi…
mernst May 5, 2026
de20100
Add import
mernst May 5, 2026
f688f08
Remove nullness annotation
mernst May 5, 2026
ea0b8f7
Merge ../checker-framework-fork-mernst-branch-canonical-annotation-wi…
mernst May 5, 2026
56903e8
fixed javadoc in modifiable and unmodifiable
YukiYang31 May 5, 2026
0d733ae
refine SubtypeCapabilityPreservationTest
YukiYang31 May 5, 2026
6d5d787
add test for canonical annotation
YukiYang31 May 6, 2026
0be4792
finished overriding canonical annotation
YukiYang31 May 6, 2026
4897c61
add documentation
YukiYang31 May 6, 2026
20567a7
add below java21 jdk skip test in ThrowsUOEtest.java
YukiYang31 May 7, 2026
459f9ba
Merge branch 'master' into modifiability
YukiYang31 May 7, 2026
302c068
Merge ../checker-framework-branch-master into canonical-annotation-wi…
mernst May 8, 2026
fcb8582
Undo changes in `ContractsFromMethod`
mernst May 8, 2026
26d259d
Merge ../checker-framework-fork-mernst-branch-canonical-annotation-wi…
mernst May 8, 2026
e4d05f1
Merge ../checker-framework-branch-master into modifiability
mernst May 8, 2026
e566240
Merge branch 'master' into modifiability
YukiYang31 May 13, 2026
f410159
add test for @IteratorPolyMod on method parameters
YukiYang31 May 15, 2026
eeb0389
spotlessApply
YukiYang31 May 15, 2026
addbe3e
Merge ../checker-framework-branch-master into modifiability
mernst May 15, 2026
f67a3dd
Merge branch 'master' into modifiability
YukiYang31 May 17, 2026
b2efced
add iteratorPolyMod annotations to stub files.
YukiYang31 May 18, 2026
2dd5a64
add iteratorPolyMod to collectionsPlume.withoutDuplicates.
YukiYang31 May 18, 2026
4b98152
rename unknownMod to be MaybeMod
YukiYang31 May 18, 2026
0589bff
add unmodParam annotation
YukiYang31 May 18, 2026
f9f9a8e
setRefinementTest is fixed in jdk.
YukiYang31 May 19, 2026
d59f5aa
fix setRefinementTest.
YukiYang31 May 19, 2026
f30d590
forbid unmodparam on non-parameters.
YukiYang31 May 20, 2026
4bacd4b
add suppress interning:not.intered
YukiYang31 May 21, 2026
5594b50
throw warning when user created their own collection class.
YukiYang31 May 21, 2026
8327947
Merge branch 'master' into modifiability
YukiYang31 May 22, 2026
7c621b1
Merge branch 'typetools:master' into modifiability
YukiYang31 May 22, 2026
12d6bfc
Add test for `Map.getOrDefault()`
mernst May 23, 2026
e3aff7c
Rename modifiability qualifiers
mernst May 24, 2026
f7a19dd
Rename file
mernst May 24, 2026
4afa7a6
Expand `@UnmodParam` => `@UnmodifiableParam`
mernst May 24, 2026
1bf7950
fixed getOrDefaultTest.java and add error comments.
YukiYang31 May 25, 2026
6be0ca4
Explain purpose of command-line argument
mernst May 25, 2026
eea150b
Merge ../checker-framework-fork-yukiyang31-branch-modifiability into …
mernst May 26, 2026
f5822c8
Merge ../checker-framework-branch-master into modifiability-typequal-…
mernst May 26, 2026
bdfcc1e
Merge branch 'master' into modifiability
YukiYang31 May 26, 2026
8fcd0c3
Merge pull request #4 from mernst/modifiability-typequal-no-abbrev
YukiYang31 May 26, 2026
a69b9ac
Tweak
mernst May 26, 2026
6795abc
Merge branch 'master' into modifiability
YukiYang31 May 27, 2026
80afc27
Merge ../checker-framework-branch-master into modifiability
mernst May 27, 2026
41950a8
Merge branch 'master' into modifiability
YukiYang31 May 28, 2026
7bde249
Merge branch 'modifiability' of github.com:YukiYang31/checker-framewo…
mernst May 28, 2026
9ed50c6
Fix `@RelevantJavaTypes`
mernst May 29, 2026
d57455e
Use ASCII
mernst May 29, 2026
9292fc2
Code review changes
mernst May 29, 2026
7efc60c
Merge branch 'modifiability' of github.com:YukiYang31/checker-framewo…
mernst May 29, 2026
a1c9cc4
Merge branch 'master' into modifiability
YukiYang31 May 29, 2026
ae36309
documented refineListIteratorReturnType
YukiYang31 May 29, 2026
e8419f2
documented isListIteratorMethod and isIteratorMethod.
YukiYang31 May 29, 2026
55d8d48
rename iteratorPolyShrinkable back to IteratorPolyMod
YukiYang31 May 29, 2026
c7f2cfb
documented IteratorPolyMod
YukiYang31 May 29, 2026
93da15d
documented ModifiabilityBaseChecker.
YukiYang31 May 29, 2026
4cd731a
clean up refineListIteratorReturnType, delete hasIteratorPolyMod method
YukiYang31 May 29, 2026
225ce54
document refineListIteratorReturnType
YukiYang31 May 29, 2026
2abdd3a
fixed isCollectionFromSourceCode documentation
YukiYang31 May 29, 2026
eb1be9f
fixed canonicalAnnotation, all modifiabilityTest passed.
YukiYang31 May 29, 2026
a738f26
created PreservesModifiability annotated and annotated plume-util.wit…
YukiYang31 May 30, 2026
87354ec
refactored common methods into ModifiabilityAnnotatedTypeFactory.
YukiYang31 May 30, 2026
2eca59c
bring iterator_preserve_remove to modifiabilityAnnotatedTypeFactory
YukiYang31 May 31, 2026
6556506
removed isIteratorMethod and isListIteratorMethod. simplified.
YukiYang31 May 31, 2026
e15d571
clean up typeCannotGrow and typeCannotShrink
YukiYang31 May 31, 2026
77f7b49
fully remove isMayEntry
YukiYang31 May 31, 2026
d03275a
add return comments in ModifiabilityAnnotatedTypeFactory
YukiYang31 May 31, 2026
7130458
implement override rules that any override method should preserve the…
YukiYang31 May 31, 2026
b51f254
fixed nullness checker error in CI.
YukiYang31 May 31, 2026
49303b9
fixed nullable warning.
YukiYang31 May 31, 2026
1711717
add Seqgrow for sequenced collection, does not include sequenced map …
YukiYang31 Jun 1, 2026
48a4449
Merge branch 'master' into modifiability
YukiYang31 Jun 1, 2026
2b2d744
ask SeqGrowVisitor to skip checkUnmodParamLocation and CheckCustomMod…
YukiYang31 Jun 1, 2026
741d957
fixed seqGrowAnnotatedTypeFactory to handle jdk under21 where sequenc…
YukiYang31 Jun 1, 2026
c31c83f
document SeqGrowAnnotatedTypeFactory.
YukiYang31 Jun 1, 2026
e9348b1
Typo fix
mernst Jun 2, 2026
db1f396
fixed seqGrow logic to add Deque.
YukiYang31 Jun 2, 2026
887ecbf
add sequencedMap to @SeqGrowable annotation.
YukiYang31 Jun 2, 2026
397dfc3
optimize the implementation of deteching unmodparam.location error.
YukiYang31 Jun 2, 2026
84758d7
merge master
YukiYang31 Jun 2, 2026
927fcf9
fixed unmodParamLocationTest.
YukiYang31 Jun 2, 2026
cde29f8
restrict the modifiability.annotation.unverified warning to class/con…
YukiYang31 Jun 3, 2026
713b171
remvoed throwsUOE.
YukiYang31 Jun 3, 2026
e2e35de
changed the location of messages.properties
YukiYang31 Jun 3, 2026
e84da5b
edit the test files to include @iteratorPolyMod.
YukiYang31 Jun 4, 2026
adcb842
combined shouldCheckUnmodifiableParamLocation and shouldCheckCustomMo…
YukiYang31 Jun 4, 2026
d53e839
First pass.
smillst Jun 4, 2026
3e6a875
A comment.
smillst Jun 4, 2026
3a7827f
Merge pull request #5 from smillst/modifiability-smillst-manual-edits
YukiYang31 Jun 4, 2026
fec4068
Merge branch 'master' into modifiability
YukiYang31 Jun 4, 2026
25fae0c
refine aliasing in the manual.
YukiYang31 Jun 4, 2026
67a4943
clean up typos and comments
YukiYang31 Jun 4, 2026
340172f
fixed more typo
YukiYang31 Jun 4, 2026
8f37570
edit @PreservesModifiabilityReturn type to detect void method.
YukiYang31 Jun 4, 2026
e33375b
fixed more documentation.
YukiYang31 Jun 4, 2026
ddda816
expand HierarchyTest and PolyModifiableTest to include SeqGrow.
YukiYang31 Jun 4, 2026
e72cfaa
update astub file.
YukiYang31 Jun 4, 2026
ab29312
listed methods in each modifiability family.
YukiYang31 Jun 4, 2026
65da92e
Mike's edits
mernst Jun 4, 2026
78e563c
Merge branch 'modifiability' of github.com:YukiYang31/checker-framewo…
mernst Jun 5, 2026
fde5e54
Merge ../checker-framework-branch-master into modifiability
mernst Jun 5, 2026
4b3a600
removed maybe qualifiers from AnnotatedTypeFactory becasue it is not …
YukiYang31 Jun 5, 2026
c1b38fd
simplified shouldCheckModifiabilityAnnotationValidity
YukiYang31 Jun 5, 2026
7f951cf
make last commit complete.
YukiYang31 Jun 5, 2026
0df3fc8
revert last two commit beasue the simplification doesn't work.
YukiYang31 Jun 5, 2026
df4ab03
Edits to manual
mernst Jun 5, 2026
f96609a
Merge branch 'modifiability' of github.com:YukiYang31/checker-framewo…
mernst Jun 5, 2026
ff2899a
implement iteratorChecker.
YukiYang31 Jun 5, 2026
cf8c834
revert changes in refinePreservesModifiabilityReturnType.
YukiYang31 Jun 6, 2026
6a66e86
implement PolyIteratorPolyMod.
YukiYang31 Jun 6, 2026
d51a2f4
start annotating @PolyIteratorPolyMod
YukiYang31 Jun 6, 2026
22dec0a
fixed a nullability bug
YukiYang31 Jun 6, 2026
1398ca0
Tweaks to PreservesModifiability.
smillst Jun 8, 2026
90f83e8
test out annotation on getOrDefault.
YukiYang31 Jun 8, 2026
406a10b
test annotation on getOrDefault.
YukiYang31 Jun 9, 2026
006eb3c
test out super.invocation error vs annotation.unverified.
YukiYang31 Jun 9, 2026
0c82f19
clarifies the manual
YukiYang31 Jun 9, 2026
977df2f
Suzanne's code review.
smillst Jun 10, 2026
546dc22
Merge pull request #6 from smillst/modifiablity-manual-PreservesModif…
YukiYang31 Jun 10, 2026
63d977d
add annotation.unverified to the manual.
YukiYang31 Jun 10, 2026
7e508c3
fixed unmodArrayListTest
YukiYang31 Jun 10, 2026
3daca67
Merge branch 'modifiability' of github.com:smillst/checker-framework …
smillst Jun 11, 2026
7860edb
Make the IteratorChecker a subchecker.
smillst Jun 11, 2026
a8d3ef1
Merge pull request #7 from smillst/modifiability
YukiYang31 Jun 11, 2026
73c6541
fixed CustomModifiabilityAnnotationWarning test.
YukiYang31 Jun 11, 2026
35b5c8f
test out defaultQualifierForUse
YukiYang31 Jun 11, 2026
c4e5f76
answer a todo about overriding rule.
YukiYang31 Jun 11, 2026
b7db6b6
Modifiability annotations
mernst Jun 12, 2026
7030323
tweaks.
smillst Jun 12, 2026
52a6b47
Merge pull request #8 from smillst/modifiability
YukiYang31 Jun 14, 2026
ec3a0ae
test out annotation.unverified with class inside a class
YukiYang31 Jun 15, 2026
289e6cf
Merge branch 'master' into modifiability
YukiYang31 Jun 15, 2026
0ee871e
Merge ../checker-framework-branch-master into modifiability
mernst Jun 15, 2026
919849a
Issue either modifiability.annotation.unverified or super.invocation …
smillst Jun 18, 2026
fa8d54b
Merge remote-tracking branch 'yukiyang31/modifiability' into modifiab…
smillst Jun 18, 2026
2c54a6f
Triggering CI build
smillst Jun 18, 2026
92fba3c
more examples for `-AresourceLeakIgnoredExceptions`
mernst Jun 18, 2026
1b46a32
Flip if statement.
smillst Jun 18, 2026
7ff4f65
Use modifiability-annotated plume-util
mernst Jun 20, 2026
ab972df
Use modifiability-annotated plume-util
mernst Jun 20, 2026
ad93809
Merge ../checker-framework-fork-mernst-branch-plume-util-snapshot int…
mernst Jun 20, 2026
056e7b3
Merge ../checker-framework-fork-yukiyang31-branch-modifiability into …
mernst Jun 27, 2026
1f96196
New way to verify collection implementations
mernst Jun 28, 2026
ef7d8db
Use `@MonotonicNonNull` annotation
mernst Jul 2, 2026
9b4c69f
Merge ../checker-framework-branch-master into modifiability
mernst Jul 17, 2026
2636bfd
Merge ../checker-framework-branch-master into modifiability
mernst Jul 17, 2026
27d3d50
Merge ../checker-framework-branch-master into modifiability
mernst Jul 18, 2026
fbdc931
Merge ../checker-framework-branch-master into modifiability
mernst Jul 24, 2026
f5f8bcf
Merge ../checker-framework-branch-master into modifiability
mernst Jul 25, 2026
3a9f134
Merge ../checker-framework-branch-master into modifiability
mernst Jul 25, 2026
d745dff
Merge ../checker-framework-branch-master into modifiability
mernst Jul 25, 2026
508e5d4
Merge ../checker-framework-branch-master into modifiability
mernst Jul 27, 2026
11e42f3
Merge ../checker-framework-branch-master into modifiability
mernst Jul 27, 2026
45efc3f
Merge ../checker-framework-branch-master into modifiability
mernst Jul 27, 2026
8cbee38
Merge ../checker-framework-branch-master into modifiability
mernst Jul 27, 2026
d3b8aef
Merge ../checker-framework-branch-master into modifiability
mernst Jul 28, 2026
4490726
Merge ../checker-framework-branch-master into modifiability
mernst Jul 28, 2026
70b6294
Merge ../checker-framework-branch-master into modifiability
mernst Jul 28, 2026
6395b80
Merge ../checker-framework-branch-master into modifiability
mernst Jul 28, 2026
57721e4
Merge ../checker-framework-branch-master into modifiability
mernst Jul 29, 2026
eecbce4
Merge ../checker-framework-branch-master into modifiability
mernst Jul 29, 2026
12630c5
Merge ../checker-framework-branch-master into modifiability
mernst Jul 31, 2026
fc8eb24
Merge ../checker-framework-branch-master into modifiability
mernst Jul 31, 2026
81381e3
Merge ../checker-framework-branch-master into modifiability
mernst Aug 1, 2026
a1290a8
Merge ../checker-framework-branch-master into modifiability
mernst Aug 1, 2026
44283bb
Merge ../checker-framework-branch-master into modifiability
mernst Aug 1, 2026
14e9d96
Add newline at end of file
mernst Aug 1, 2026
5f121c7
Documentation
mernst Aug 1, 2026
534fb69
Code review
mernst Aug 1, 2026
c4291b4
Merge ../checker-framework-fork-mernst-branch-doc-for-modifiability i…
mernst Aug 1, 2026
341c3b5
Merge ../checker-framework-branch-master into modifiability
mernst Aug 2, 2026
77bcc37
Merge ../checker-framework-branch-master into modifiability
mernst Aug 2, 2026
c60e8cc
Merge ../checker-framework-branch-master into modifiability
mernst Aug 3, 2026
d388fc2
Merge ../checker-framework-branch-master into modifiability
mernst Aug 4, 2026
ca488d9
Merge ../checker-framework-branch-master into modifiability
mernst Aug 31, 2026
f92c2f4
Add Javadoc
mernst Aug 31, 2026
d3e99b8
CI diagnostics
mernst Aug 31, 2026
0ca5487
`ci_info` job
mernst Aug 31, 2026
1a8ea07
Set container
mernst Sep 1, 2026
2cdad08
Merge ../checker-framework-branch-master into modifiability
mernst Sep 1, 2026
16c1d97
Use correct container
mernst Sep 1, 2026
f7e343a
Fix container
mernst Sep 1, 2026
40a3c6f
AFU Javadoc
mernst Sep 1, 2026
b6d9040
Add signature annotation
mernst Sep 1, 2026
53bc3cf
Merge ../checker-framework-fork-mernst-branch-modifiability-javadoc i…
mernst Sep 1, 2026
317692a
Move UnmodifiableParam code
smillst Sep 1, 2026
0903fc4
Merge ../checker-framework-branch-master into modifiability
mernst Sep 1, 2026
9d01877
Code review
mernst Sep 1, 2026
357957a
Merge ../checker-framework-branch-master into modifiability
mernst Sep 4, 2026
0c9e82d
Code review
mernst Sep 4, 2026
7f89cad
Merge /home/mernst/research/types/checker-framework-branch-master int…
mernst Sep 6, 2026
e171765
Add signature annotations
mernst Sep 6, 2026
45ba3ef
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 12, 2026
0f1a37e
Code review fixes for the Modifiability Checker
mernst Sep 12, 2026
52500e5
Follow-up code review fixes for the Modifiability Checker
mernst Sep 12, 2026
8cb081d
Fix the two CI failures on the modifiability branch
mernst Sep 13, 2026
1f98dc9
Code review
mernst Sep 14, 2026
97be375
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 14, 2026
ddbbe08
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 14, 2026
374ce62
Add type qualifiers
mernst Sep 15, 2026
d4caeef
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 15, 2026
fb304a5
Code review
mernst Sep 16, 2026
9d1b40b
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 16, 2026
19e85ee
Check for a bottom receiver independently of the constructors
mernst Sep 16, 2026
2fcf3f7
Share the modifiability stub files rather than duplicating them
mernst Sep 16, 2026
26ef9d4
Code review
mernst Sep 16, 2026
4bedf8f
Address code review findings
mernst Sep 16, 2026
4cdb4f1
Move the wpi2.sh changes to the wpi2 branch
mernst Sep 16, 2026
9fd21a1
Merge branch 'master' of ../checker-framework-branch-master into modi…
mernst Sep 16, 2026
8dfb898
Move the CHANGELOG entry to the unreleased section
mernst Sep 16, 2026
620041b
Merge branch 'master' into modifiability
mernst Sep 21, 2026
978f854
Code review
mernst Sep 21, 2026
7ecd752
Add Javadoc
mernst Sep 21, 2026
71d6ad0
Code review
mernst Sep 21, 2026
66d1e8b
Fix iteration test
mernst Sep 21, 2026
5703ddb
Merge branch 'master' into modifiability
mernst Sep 21, 2026
cb9b57d
Merge branch 'master' into modifiability
mernst Sep 22, 2026
1ade24f
Merge branch 'master' into modifiability
mernst Sep 22, 2026
7ce10a0
Address code review findings on the Modifiability Checker
mernst Sep 22, 2026
9cdd9f8
Update linting settings
mernst Sep 22, 2026
3075622
Fix Modifiability Checker type-variable weakening and polymorphic ite…
mernst Sep 23, 2026
332cd41
Suppress nullness warning
mernst Sep 23, 2026
4e2b35f
Merge branch 'master' into modifiability
mernst Sep 23, 2026
3a61306
Merge branch 'master' into modifiability
mernst Sep 23, 2026
e68d996
Add test that reproduces a StackOverflowError for a poly-expression a…
mernst Sep 24, 2026
43296b2
Fix StackOverflowError for a poly-expression argument to a @Preserves…
smillst Sep 24, 2026
6d04c20
Merge branch 'master' of https://github.com/typetools/checker-framewo…
YukiYang31 Sep 30, 2026
04e6d99
Use \hyperref instead of removed \ahrefloc macro
YukiYang31 Sep 30, 2026
287e2fb
fix the comments
YukiYang31 Sep 30, 2026
191b9cb
use processMethodTree to handle constructor and inline atypeFactory.…
YukiYang31 Sep 30, 2026
fd85daa
use ErasedSubtype and clean up
YukiYang31 Sep 30, 2026
936569b
fix stale comment in IdentityHashMapModifiableTest
YukiYang31 Sep 30, 2026
24d1e8d
change vivifyingLHMap to return a modifiable map
YukiYang31 Sep 30, 2026
577cf93
fix CI
YukiYang31 Sep 30, 2026
b4d961a
fix annotation in wrapperMap.java
YukiYang31 Sep 30, 2026
bfbd6fd
Merge branch 'master' into modifiability
YukiYang31 Sep 30, 2026
6fe052f
make vivifyingMap modifiable
YukiYang31 Oct 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 @@ -4,6 +4,7 @@
import java.util.List;
import java.util.Set;
import org.checkerframework.afu.scenelib.type.Type;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
Expand All @@ -15,7 +16,7 @@ public class ConstructorInsertion extends TypedInsertion {
private @Nullable ReceiverInsertion receiverInsertion = null;

/** The declaration annotations to write on the generated constructor. */
private Set<Insertion> declarationInsertions = new LinkedHashSet<>();
private @Growable Set<Insertion> declarationInsertions = new LinkedHashSet<>();

/**
* Construct a ConstructorInsertion.
Expand All @@ -28,7 +29,8 @@ public class ConstructorInsertion extends TypedInsertion {
* @param criteria where to insert the text
* @param innerTypeInsertions the inner types to go on this constructor
*/
public ConstructorInsertion(Type type, Criteria criteria, List<Insertion> innerTypeInsertions) {
public ConstructorInsertion(
Type type, Criteria criteria, @Growable List<Insertion> innerTypeInsertions) {
super(type, criteria, true, innerTypeInsertions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.checkerframework.afu.scenelib.io.ASTPath;
import org.checkerframework.afu.scenelib.io.DebugWriter;
import org.checkerframework.checker.interning.qual.FindDistinct;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.modifiability.qual.Replaceable;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signature.qual.ClassGetName;
import org.objectweb.asm.TypePath;
Expand All @@ -28,7 +30,7 @@ public final class Criteria {

// NOTE: This does not permit multiple criteria of a given kind.
/** The set of criterion objects, indexed by kind. */
private final Map<Criterion.Kind, Criterion> criteria;
private final @Growable @Replaceable Map<Criterion.Kind, Criterion> criteria;

/** Creates a new {@code Criteria} without any {@code Criterion}. */
public Criteria() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.checkerframework.afu.scenelib.type.BoundedType;
import org.checkerframework.afu.scenelib.type.DeclaredType;
import org.checkerframework.afu.scenelib.type.Type;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.objectweb.asm.TypePath;
import org.plumelib.util.StringsP;
Expand Down Expand Up @@ -46,7 +47,7 @@ public enum Kind {
* The package names for the annotations being inserted by this Insertion. This will be empty
* unless {@link #getText(boolean)} is called with abbreviate=true.
*/
protected Set<String> packageNames;
protected @Growable Set<String> packageNames;

/**
* Set of annotation names that should always be inserted fully-qualified, even when {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.checkerframework.afu.scenelib.type.BoundedType;
import org.checkerframework.afu.scenelib.type.DeclaredType;
import org.checkerframework.afu.scenelib.type.Type;
import org.checkerframework.checker.modifiability.qual.Growable;

/**
* An insertion that may result in code generation other than just annotations. {@code
Expand All @@ -28,7 +29,7 @@ public abstract class TypedInsertion extends Insertion {
protected boolean annotationsOnly;

/** The inner types to go on this insertion. See {@link ReceiverInsertion} for more details. */
protected List<Insertion> innerTypeInsertions;
protected @Growable List<Insertion> innerTypeInsertions;

/**
* Creates a new {@code TypedInsertion} whose text is not on its own line.
Expand All @@ -37,7 +38,8 @@ public abstract class TypedInsertion extends Insertion {
* @param criteria where to insert the text
* @param innerTypeInsertions the inner types to go on this insertion
*/
public TypedInsertion(Type type, Criteria criteria, List<Insertion> innerTypeInsertions) {
public TypedInsertion(
Type type, Criteria criteria, @Growable List<Insertion> innerTypeInsertions) {
this(type, criteria, false, innerTypeInsertions);
}

Expand All @@ -50,7 +52,7 @@ public TypedInsertion(Type type, Criteria criteria, List<Insertion> innerTypeIns
* @param innerTypeInsertions the inner types to go on this insertion
*/
public TypedInsertion(
Type type, Criteria criteria, boolean b, List<Insertion> innerTypeInsertions) {
Type type, Criteria criteria, boolean b, @Growable List<Insertion> innerTypeInsertions) {
super(criteria, b);
this.type = type;
this.innerTypeInsertions = innerTypeInsertions;
Expand Down Expand Up @@ -83,7 +85,7 @@ public Type getType() {
*
* @return a copy of the inner types
*/
public List<Insertion> getInnerTypeInsertions() {
public @Growable List<Insertion> getInnerTypeInsertions() {
return innerTypeInsertions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
import org.checkerframework.afu.scenelib.type.Type;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.formatter.qual.FormatMethod;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.modifiability.qual.IteratorPolyMod;
import org.checkerframework.checker.modifiability.qual.Shrinkable;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.signature.qual.ClassGetName;
import org.objectweb.asm.ClassReader;
Expand All @@ -61,7 +64,8 @@ public class IndexFileSpecification {
LinkedHashMultimap.<Insertion, Annotation>create();

/** The state of this object. */
private final List<Insertion> insertions = new ArrayList<>();
private final @Growable @Shrinkable @IteratorPolyMod List<Insertion> insertions =
new ArrayList<>();

/** An insertion for the default constructor, or null. Is a member of insertions if non-null. */
private ConstructorInsertion constructorInsertion = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import java.util.StringJoiner;
import org.checkerframework.afu.scenelib.el.AnnotationDef;
import org.checkerframework.afu.scenelib.field.AnnotationFieldType;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.modifiability.qual.Replaceable;
import org.checkerframework.checker.nullness.qual.KeyFor;
import org.checkerframework.checker.nullness.qual.NonNull;

Expand Down Expand Up @@ -114,7 +116,9 @@ public Annotation(AnnotationDef def, Map<String, ? extends Object> fields) {
* @param ja the java.lang.annotation.Annotation to make an Annotation for
* @param adefs a cache from which to look up (or insert into) AnnotationDefs
*/
public Annotation(java.lang.annotation.Annotation ja, Map<String, AnnotationDef> adefs) {
// TODO: `adefs` need not be `@Replaceable`. Use the Map Key checker to avoid a warning.
public Annotation(
java.lang.annotation.Annotation ja, @Growable @Replaceable Map<String, AnnotationDef> adefs) {
Class<? extends java.lang.annotation.Annotation> jaType = ja.annotationType();
String name = jaType.getName();
if (adefs.containsKey(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Map;
import java.util.Objects;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.modifiability.qual.Shrinkable;

/**
* ABlock has local variables in scope. We currently directly use them only for static initializer
Expand All @@ -12,7 +13,7 @@ public class ABlock extends AExpression {
// Currently we don't validate the local locations (e.g., that no two
// distinct ranges for the same index overlap).
/** The method's annotated local variables; map key contains local variable location numbers. */
public final VivifyingMap<LocalLocation, AField> locals =
public final @Shrinkable VivifyingMap<LocalLocation, AField> locals =
AField.<LocalLocation>newVivifyingLHMap_AF();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@
import javax.lang.model.element.VariableElement;
import org.checkerframework.afu.scenelib.Annotation;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.modifiability.qual.Modifiable;
import org.checkerframework.checker.modifiability.qual.Replaceable;
import org.checkerframework.checker.modifiability.qual.Shrinkable;
import org.plumelib.util.MapsP;

/** An annotated class. */
public class AClass extends ADeclaration {
/** The class's annotated type parameter bounds. */
public final VivifyingMap<BoundLocation, ATypeElement> bounds =
public final @Growable @Replaceable @Shrinkable VivifyingMap<BoundLocation, ATypeElement> bounds =
ATypeElement.<BoundLocation>newVivifyingLHMap_ATE();

/** -1 maps to superclass, non-negative integers map to implemented or extended interfaces. */
public final VivifyingMap<TypeIndexLocation, ATypeElement> extendsImplements =
public final @Shrinkable VivifyingMap<TypeIndexLocation, ATypeElement> extendsImplements =
ATypeElement.<TypeIndexLocation>newVivifyingLHMap_ATE();

/**
Expand All @@ -31,19 +35,22 @@ public class AClass extends ADeclaration {
* The annotation scene library does not validate the keys, nor does it check that annotated
* subelements of the {@link AMethod}s exist in the signature.
*/
public final VivifyingMap<String, AMethod> methods = createMethodMap();
public final @Growable @Shrinkable VivifyingMap<String, AMethod> methods = createMethodMap();

/** The class's annotated static initializer blocks; map key is the index of the block. */
public final VivifyingMap<Integer, ABlock> staticInits = createInitBlockMap();
public final @Growable @Shrinkable VivifyingMap<Integer, ABlock> staticInits =
createInitBlockMap();

/** The class's annotated instance initializer blocks; map key is the index of the block. */
public final VivifyingMap<Integer, ABlock> instanceInits = createInitBlockMap();
public final @Growable @Shrinkable VivifyingMap<Integer, ABlock> instanceInits =
createInitBlockMap();

/** The class's annotated fields; map key is field name. */
public final VivifyingMap<String, AField> fields = AField.<String>newVivifyingLHMap_AF();
public final @Growable @Shrinkable VivifyingMap<String, AField> fields =
AField.<String>newVivifyingLHMap_AF();

/** The class's annotated field initializers; map key is field name. */
public final VivifyingMap<String, AExpression> fieldInits = createFieldInitMap();
public final @Growable VivifyingMap<String, AExpression> fieldInits = createFieldInitMap();

/**
* The type element representing the class. Clients must call {@link #setTypeElement(TypeElement)}
Expand All @@ -55,23 +62,23 @@ public class AClass extends ADeclaration {
public final String className;

/** The simple class names any of this class's outer classes (or this class) that are enums. */
private final HashSet<String> enums = new HashSet<>();
private final @Growable HashSet<String> enums = new HashSet<>();

/** The enum constants of this class, or null if this class is not an enum. */
private /*@MonotonicNonNull*/ List<VariableElement> enumConstants = null;

/**
* The simple class names any of this class's outer classes (or this class) that are annotations.
*/
private final HashSet<String> annotationTypes = new HashSet<>();
private final @Growable HashSet<String> annotationTypes = new HashSet<>();

/**
* The simple class names any of this class's outer classes (or this class) that are interfaces.
*/
private final HashSet<String> interfaces = new HashSet<>();
private final @Growable HashSet<String> interfaces = new HashSet<>();

/** The simple class names any of this class's outer classes (or this class) that are records. */
private final HashSet<String> records = new HashSet<>();
private final @Growable HashSet<String> records = new HashSet<>();

// debug fields to keep track of all classes created
// private static List<AClass> debugAllClasses = new ArrayList<>();
Expand Down Expand Up @@ -244,7 +251,9 @@ public <R, T> R accept(ElementVisitor<R, T> v, T t) {
*
* @return a new vivifying map from method signature to {@link AMethod}
*/
private static VivifyingMap<String, AMethod> createMethodMap() {
@SuppressWarnings("modifiability:return") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
private static @Modifiable VivifyingMap<String, AMethod> createMethodMap() {
return new VivifyingMap<>(new LinkedHashMap<>()) {
@Override
public AMethod createValueFor(String k) {
Expand All @@ -264,7 +273,9 @@ public boolean isEmptyValue(AMethod v) {
*
* @return a new vivifying map from initializer block index to {@link ABlock}
*/
private static VivifyingMap<Integer, ABlock> createInitBlockMap() {
@SuppressWarnings("modifiability:return") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
private static @Modifiable VivifyingMap<Integer, ABlock> createInitBlockMap() {
return new VivifyingMap<>(new LinkedHashMap<>()) {
@Override
public ABlock createValueFor(Integer k) {
Expand All @@ -284,7 +295,9 @@ public boolean isEmptyValue(ABlock v) {
*
* @return a new vivifying map from field name to field initializer
*/
private static VivifyingMap<String, AExpression> createFieldInitMap() {
@SuppressWarnings("modifiability:return") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
private static @Modifiable VivifyingMap<String, AExpression> createFieldInitMap() {
return new VivifyingMap<>(new LinkedHashMap<>()) {
@Override
public AExpression createValueFor(String k) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
import java.util.TreeMap;
import org.checkerframework.afu.scenelib.io.ASTPath;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.modifiability.qual.Modifiable;

/** A declaration, as opposed to an expression. Base class for AClass, AMethod, and AField. */
public abstract class ADeclaration extends AElement {
/**
* The element's insert-annotation invocations; map key is the AST path to the insertion place.
*/
public final VivifyingMap<ASTPath, ATypeElement> insertAnnotations =
@SuppressWarnings("modifiability:assignment") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
public final @Modifiable VivifyingMap<ASTPath, ATypeElement> insertAnnotations =
new VivifyingMap<>(new TreeMap<>()) {
@Override
public ATypeElement createValueFor(ASTPath k) {
Expand All @@ -28,7 +31,9 @@ public boolean isEmptyValue(ATypeElement v) {
* The element's annotated insert-typecast invocations; map key is the AST path to the insertion
* place
*/
public final VivifyingMap<ASTPath, ATypeElementWithType> insertTypecasts =
@SuppressWarnings("modifiability:assignment") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
public final @Modifiable VivifyingMap<ASTPath, ATypeElementWithType> insertTypecasts =
Comment thread
mernst marked this conversation as resolved.
new VivifyingMap<>(new TreeMap<>()) {
@Override
public ATypeElementWithType createValueFor(ASTPath k) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import java.util.StringJoiner;
import org.checkerframework.afu.scenelib.Annotation;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.modifiability.qual.Growable;
import org.checkerframework.checker.modifiability.qual.Modifiable;
import org.checkerframework.checker.modifiability.qual.Replaceable;

/**
* An {@code AElement} represents a Java element and the annotations it carries. Some {@code
Expand All @@ -22,7 +25,7 @@ public class AElement implements Cloneable {
* The top-level annotations directly on this element. Annotations on subelements are in those
* subelements' {@code tlAnnotationsHere} sets, not here.
*/
public final Set<Annotation> tlAnnotationsHere;
public final @Modifiable Set<Annotation> tlAnnotationsHere;

// TODO: What about methods; is `type` the return type?
/**
Expand Down Expand Up @@ -201,7 +204,9 @@ public <R, T> R accept(ElementVisitor<R, T> v, T t) {
* @param <K> the type of the map keys
* @return a new vivifying map from keys to {@link AElement}s
*/
static <K extends Object> VivifyingMap<K, AElement> newVivifyingLHMap_AE() {
@SuppressWarnings("modifiability:return") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
static <K extends Object> @Modifiable VivifyingMap<K, AElement> newVivifyingLHMap_AE() {
return new VivifyingMap<>(new LinkedHashMap<>()) {
@Override
public AElement createValueFor(K k) {
Expand Down Expand Up @@ -245,7 +250,7 @@ public boolean isEmptyValue(AElement v) {
// `@Nullable Object`, to `WrapperMap.get(Object)`, whose parameter is `@NonNull`.
})
static <K, V extends AElement> void copyMapContents(
VivifyingMap<K, V> orig, VivifyingMap<K, V> copy) {
VivifyingMap<K, V> orig, @Growable @Replaceable VivifyingMap<K, V> copy) {
for (K key : orig.keySet()) {
V val = orig.get(key);
copy.put(key, (V) val.clone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,47 @@
import java.util.SortedMap;
import java.util.TreeMap;
import org.checkerframework.afu.scenelib.util.coll.VivifyingMap;
import org.checkerframework.checker.modifiability.qual.Modifiable;

/**
* Manages all annotations within expressions, that is, annotations on typecasts, instanceofs, and
* object creations. We can use this class for methods, field initializers, and static initializers.
*/
public class AExpression extends AElement {
/** The method's annotated typecasts; map key is the offset of the checkcast bytecode. */
public final VivifyingMap<RelativeLocation, ATypeElement> typecasts =
public final @Modifiable VivifyingMap<RelativeLocation, ATypeElement> typecasts =
ATypeElement.<RelativeLocation>newVivifyingLHMap_ATE();

/**
* The method's annotated "instanceof" tests; map key is the offset of the instanceof bytecode.
*/
public final VivifyingMap<RelativeLocation, ATypeElement> instanceofs =
public final @Modifiable VivifyingMap<RelativeLocation, ATypeElement> instanceofs =
ATypeElement.<RelativeLocation>newVivifyingLHMap_ATE();

/** The method's annotated "new" invocations; map key is the offset of the new bytecode. */
public final VivifyingMap<RelativeLocation, ATypeElement> news =
public final @Modifiable VivifyingMap<RelativeLocation, ATypeElement> news =
ATypeElement.<RelativeLocation>newVivifyingLHMap_ATE();

/**
* A method invocation's annotated type arguments; map key is the offset of the invokestatic
* bytecode
*/
public final VivifyingMap<RelativeLocation, ATypeElement> calls =
public final @Modifiable VivifyingMap<RelativeLocation, ATypeElement> calls =
ATypeElement.<RelativeLocation>newVivifyingLHMap_ATE();

/**
* A member reference's annotated type parameters; map key is the offset of the invokestatic
* bytecode
*/
public final VivifyingMap<RelativeLocation, ATypeElement> refs =
public final @Modifiable VivifyingMap<RelativeLocation, ATypeElement> refs =
ATypeElement.<RelativeLocation>newVivifyingLHMap_ATE();

/**
* The method's annotated lambda expressions; map key is the offset of the invokedynamic bytecode
*/
public final VivifyingMap<RelativeLocation, AMethod> funs =
@SuppressWarnings("modifiability:assignment") // The anonymous subclass's constructor result
// is the top qualifier, so it does not propagate the backing map's @Modifiable type.
public final @Modifiable VivifyingMap<RelativeLocation, AMethod> funs =
new VivifyingMap<>(new LinkedHashMap<>()) {
@Override
public AMethod createValueFor(RelativeLocation k) {
Expand Down
Loading
Loading