-
Notifications
You must be signed in to change notification settings - Fork 438
RLC extension for resource collection #7602
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
Open
iamsanjaymalakar
wants to merge
464
commits into
typetools:master
Choose a base branch
from
iamsanjaymalakar:rlc-for-collections
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 250 commits
Commits
Show all changes
464 commits
Select commit
Hold shift + click to select a range
331931e
default resource collection constructor returns no OCwO
123f26d
fix return rule for resource collections
d9d7feb
fix tests to account for enhanced precision of new defaults
ee95caa
add CollectionOwnershipStore and Analysis
ee0ce6d
add collectionfielddestructor postcon anno
12ae8fc
doc
b2505b7
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli ce34a10
add support for @OC fields
73af398
demand @CreatesCollectionObligation method invocs on fields to have @…
75f3cbf
add test for @OC fields
6134f55
make missing.creates.mustcall.for slightly more generic
fdf9b0a
add method deciding whether rc field is owning or not
0ae2cf5
introduce owning rc field as @OCwO in constructor
dcde6c3
prevent ownership transfer out of owning rc field
febc5cb
fix how owning rc fields are decided in COVisitor
e19a61c
check owning rc field assignments in consistency analyzer
2468321
more field tests
73b3985
Javadoc
mernst 2b6456c
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
mernst 21f3503
move logic for parsing JavaExp from string from visitor to atf
efa1d38
fix how @OC and owning rc field are decided
bf14a97
check field accesses to prevent accessing foreign owning rc fields
7fd44cc
new field tests
f3442c3
comment field null test, not implemented yet
eb46285
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
3dfe32b
Merge branch 'master' of https://github.com/typetools/checker-framewo…
5474b79
add missing doc
4700443
please new preferences of formatter
410f092
use new isOwningCollectionField in costore as well
77d6946
isocfield now expects element instead of tree
01ae15c
add missing @param
d7e3c0c
fix crash due to receiver not in store
a201ecb
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 620b82e
manual update
3181578
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
08a7c08
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 076f0b7
fix rlc-collections manual
b386e9e
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
b9bf410
fix quotes
fcf9e05
suppress this-escape warning for calling postInit()
fab3eb9
fix nullness crash
dd92896
make @OCBottom and @OCwO illegal manual annotations
6a46cfb
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 56e8fd4
disallow owning rc field assignments with @OC rhs
627cc6e
keep @NotOwningCollection rc fields in store as well
0a7d4f2
fix how return statements are checked for @OC return vals
ffd8f25
allow assignments to final field
d935a35
disallow static rc fields
23a2fcd
remove obligation of rhs in assignment to owning rc final field lhs
c8d95a0
improve error message for foreign rc field access
8ddb042
add field test cases
a62bede
remove array support
5f32f89
fix test outcomse after making List#get not owning
ab5b2a2
remove array tests
9e3c23a
fix collections rlc manual section with manu feedback
bbb7ef8
also require createsmcfor(this) for field asgnment with noc rhs
3ade7ed
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 62c4299
maps are now also resource collections
66901ee
remove expected warning for type.arg because map can now hold non-emp…
be87c39
@OwningCollection and @NotOwningCollection are inheritable!!!!
79506bd
polyowning inherited
71ae840
only collections with one typearg are rc
b1687a6
fix crash when annotated type not available
2b13a8d
Format
mernst 518e749
fix loopbodyanalysis (fix by Suzanne)
fe206ee
no errors for map.get
4c3dc9c
uncomment now working loop body analysis tests
14d37bf
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
82717fc
formatting
f474bc5
suppress interning warning
398d16c
fix crash in for-loop pattern match
f30abbb
make collectionownership annotations inheritable
80cd91a
formating
b10609c
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 9a4d4ef
suzanne's fix for the afu build file
33d7b64
annotate afu for collection ownership checker
3347442
warning suppressions in afu for collection ownership checker
555194e
add poly annotation as field
0f25e74
don't inherit polyoc annotation
a4f1a3f
propagate annotations from parameter decl to use site
64b1855
adapt annos&suppressions for afu subproject after not inheriting poly…
03efa5f
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 4433b46
Add Javadoc
mernst ffa65ba
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
mernst b39a77a
Add Javadoc
mernst fe92dab
Use %n, not \n, in format strings
mernst 10a30c2
Documentation improvements
mernst eaadec9
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst ceebfff
Documentation improvements
mernst 6e95c34
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 9549bfc
Use "true if" instead of "whether"
mernst 116f596
Improve Javadoc style
mernst 6b0b327
Rename variable
mernst 346b9ed
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst a012a9d
Use curly braces around then and else clauses
mernst 96bd8a1
Documentation tweaks and improve efficiency by doing cheap test first
mernst a961341
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 5d55958
Improve Javadoc style
mernst 9a0246b
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 7db0254
Checkpoint
mernst 83fed79
Variable names
mernst b343553
Documentation for `defaultCreateAbstractValue`
mernst 20aa7d7
Checkpoint
mernst 13c41f0
Merge ../checker-framework-fork-mernst-branch-defaultCreateAbstractVa…
mernst 94c2730
Add curly braces around `then` clauses
mernst 76358b6
Merge ../checker-framework-fork-mernst-branch-curly-braces into rlc-c…
mernst 0e80e9d
Add curly braces
mernst 41396e0
Code review edits
mernst a00e883
Code review edits
mernst 2e81982
Revert experimental change
mernst 37c76a5
Make `insertIntoStores` non-static
mernst 66d4ca8
Documentation fixes
mernst a6e60b7
Remove suppression
mernst 6f47713
Add `@NotOwning` annotation
mernst 8c1d87a
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst f9da2da
Suppress warnings
mernst f4d47c6
Temporary warning suppression
mernst eaa5492
more annotations for rlc4c
e3e06d9
add receiver annotation
596f2e1
add comment
6b17e65
add rlc4c annos
dada8a3
fix javadoc
7bcf851
remove unnecessary warning suppression
343f76a
Add annotations
mernst 8477297
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
mernst 7f51f70
Add Javadoc
mernst 19f39a8
Add annotations, suppress warnings
mernst 8e2fc86
import `@Nullable`
mernst 1480bed
Move annotations
mernst 9d12532
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 251cb94
address code review
02cc724
address code review: remove createSourceVisitor override in coc
72bdbc8
remove unnecessary nullness checks
d552b3e
make mcatf a field in coatf
aab1708
remove catch bugincf to make error explicit
bba3c2f
remove mcoeobligationaltering loop wrapper class
d915819
replace catch (Exception) with catch (BugInCF)
b88929c
minor changes code review
0ab02c8
minor changes code review
03aed4a
fix expected test outcome after renaming an error code
3bf63c4
minor fixes code review
8ed76d7
formatting
d00a615
minor changes code review
3aeafe7
fix faulty link
02fa7e8
use old collectors method to prevent runtime error
c53a155
prevent crash in loop body analysis
845006a
catch BugInCF if tree has unexpected shape when deciding rc
1b89b55
prevent crash when rhs of oc field assignment not in store
e325d51
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst adfc3ab
Fix a typo
kelloggm f9a0665
clarifications and typo fixes in the manual
kelloggm 73d6163
explanatory comment
kelloggm 7322107
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 4504294
clarify comment
912aa9a
remove commented out code
639ff0d
add explanation why loop matching is in mc-visitor
26a43c1
update explanation for expected test behavior
4b2a223
add a test case
4bf1f92
remove commented out defaults for OCBottom
65abe44
move field example code before explanation in manual
3d1a831
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
5179206
comment out mentions of iterator support in rl manual
062b104
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst ccc78f1
Merge branch 'master' into rlc-collections-redesign
mernst ec858ae
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 157054a
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli b4fe2ef
parser moved
fcfc684
add obligation upon CreatsCollectionObligation even for @OC
7f155e1
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 0913ff3
Merge branch 'master' into rlc-collections-redesign
mernst a8d2991
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst a5030a7
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 0de2d9c
Fix bug in CFG construction for preincrement
mernst 9d61bff
Fixup
mernst 11ee250
Return locally
mernst 6645c05
Merge ../checker-framework-fork-mernst-branch-partially-undo-9bc061c-…
mernst 1d12e3d
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 49a566f
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 50ff472
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 23da55c
fix spelling mistake in manual
8b35b86
add explanation when catching InvalidLoopBodyAnalysis Exception
e40bbbf
mark method as @override
a552a56
prefer this.equals over other.equals
04284ad
remove array example from rlc4c manual
af26a63
fix typo in comment
54b6000
add override decorators to test file
69175cf
explicitly use MustCall({}) instead of MustCall
f945491
remove exceptional stores noop
527004c
annotated @CreatesCollectionObligation as documented
3b3a8df
fix doc for createscollectionobligation
b105a8a
improve javadoc
a8111ef
address trivial coderabbit PR comments
c2309f0
revert error message to previous
2d53603
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 50394ff
Comment improvements
mernst 4afb91f
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 7018049
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst e94545e
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 7bb6e34
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli a7824c3
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 0faec76
fix compilation error in rlccmatf
skehrli 4c56f0c
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli a8d9fca
fix up rlc4c manual section
skehrli 43dcf8e
fix typo in error message
skehrli 5956dd2
nullness guard when checking owning collection field
skehrli 3142935
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli b33e107
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 4006c6f
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 2c99d54
Merge branch 'typetools:master' into rlc-collections-redesign
skehrli 036ebd8
Merge branch 'rlc-collections-redesign' of github.com:skehrli/checker…
skehrli e99fdb7
remove old manual section about missing rlc for collections
skehrli 5d9dc72
fix error in example program in manual
skehrli 63f0c0f
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst ea3601a
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 57985ba
Put error key in brackets
mernst 88ca42c
Merge ../checker-framework-fork-mernst-branch-more-square-brackets in…
mernst 7668ccc
Undo a change
mernst cb5f029
Another pair of brackets
mernst 9cae831
Merge ../checker-framework-fork-mernst-branch-more-square-brackets in…
mernst 224f485
Merge ../checker-framework-branch-master into more-square-brackets
mernst 775a2db
Add space around heading
mernst f26dca7
Merge ../checker-framework-branch-master into more-square-brackets
mernst 58be6f6
Merge ../checker-framework-fork-mernst-branch-more-square-brackets in…
mernst 21ece95
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 83464c7
Merge ../checker-framework-branch-master into rlc-collections-redesign
mernst 2893965
Merge branch 'master' into rlc-collections-redesign
msridhar ffda69b
Add pre-lambda post-analysis hook for resource leak
iamsanjaymalakar 0082c05
Preserve RLCC method analysis during lambda fixpoint
iamsanjaymalakar e71b956
More loop support.
iamsanjaymalakar 3b5490e
Allow mutation of not owning collection if inserted element is not ow…
iamsanjaymalakar aeb82cd
bug fixes.
iamsanjaymalakar 983ecdb
Tests are passing now. more restructuring + documentation remains.
iamsanjaymalakar d19c583
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 26f8422
Documentation in COATF and COA.
iamsanjaymalakar 06e60fa
Document lambda fixpoint lifecycle for resource leak analysis
iamsanjaymalakar 58219b0
More documentation.
iamsanjaymalakar 1b3f47e
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 09593d7
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 5c6eeef
Use the new annotation hierarchy API in RLCC
iamsanjaymalakar 91e9f76
Fix RLCC typecheck and misc CI issues
iamsanjaymalakar c3fef46
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 93abd88
Type check issue.
iamsanjaymalakar 2e03c50
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 2c2468a
Type check issue.
iamsanjaymalakar a809c1c
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar 34c5027
Made LinkedHashKeyedSet as NOC; the Map takes ownership of the resour…
iamsanjaymalakar d2d1a36
Type check issue.
iamsanjaymalakar ae959a1
Merge remote-tracking branch 'upstream/master' into rlc-for-collections
iamsanjaymalakar 9e18cc6
Handle zero-arg Arrays.asList() in must-call polymorphism
iamsanjaymalakar b48eba3
Merge branch 'master' into rlc-for-collections
iamsanjaymalakar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...java/org/checkerframework/checker/collectionownership/qual/CollectionFieldDestructor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package org.checkerframework.checker.collectionownership.qual; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.checkerframework.framework.qual.InheritedAnnotation; | ||
| import org.checkerframework.framework.qual.PostconditionAnnotation; | ||
|
|
||
| /** | ||
| * The annotated method destructs the given resource collection fields. That is, this method calls | ||
| * all required methods on their elements. | ||
| * | ||
| * <pre><code> | ||
| * {@literal @}CollectionFieldDestructor("socketList") | ||
| * void close() { | ||
| * for (Socket s : this.socketList) { | ||
| * try { | ||
| * s.close(); | ||
| * } catch (Exception e) {} | ||
| * } | ||
| * } | ||
| * </code></pre> | ||
| * | ||
| * @checker_framework.manual #resource-leak-checker Resource Leak Checker | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD}) | ||
| @PostconditionAnnotation(qualifier = OwningCollectionWithoutObligation.class) | ||
| @InheritedAnnotation | ||
| public @interface CollectionFieldDestructor { | ||
| /** | ||
| * Returns the resource collection fields whose collection obligation the destructor fulfills. | ||
| * | ||
| * @return the resource collection fields whose collection obligation the destructor fulfills | ||
| */ | ||
| String[] value(); | ||
| } |
29 changes: 29 additions & 0 deletions
29
...va/org/checkerframework/checker/collectionownership/qual/CreatesCollectionObligation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package org.checkerframework.checker.collectionownership.qual; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.checkerframework.framework.qual.InheritedAnnotation; | ||
|
|
||
| /** | ||
| * A method carrying this annotation creates a {@code CollectionObligation} for the receiver | ||
| * collection. | ||
| * | ||
| * <p>Consider a call to a {@code CreatesCollectionObligation}-annotated method. If the receiver is | ||
| * of type {@code @OwningCollectionWithoutObligation}, it is unrefined to {@code @OwningCollection}, | ||
| * and a CollectionObligation is created for each {@code @MustCall} method of the type variable of | ||
| * the receiver. | ||
| * | ||
| * <p>This annotation should only be used on method declarations of collections, as defined by the | ||
| * CollectionOwnershipChecker, that is, {@code java.lang.Iterable} and {@code java.util.Iterator} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the reference to |
||
| * implementations. | ||
| * | ||
| * @checker_framework.manual #resource-leak-checker Resource Leak Checker | ||
| */ | ||
| @Documented | ||
| @InheritedAnnotation | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD}) | ||
| public @interface CreatesCollectionObligation {} | ||
21 changes: 21 additions & 0 deletions
21
.../main/java/org/checkerframework/checker/collectionownership/qual/NotOwningCollection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package org.checkerframework.checker.collectionownership.qual; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
|
|
||
| /** | ||
| * An expression of type {@code NotOwningCollection} is a non-owning reference to a resource | ||
| * collection/array. Because it does not own the underlying collection/array, it cannot add or | ||
| * remove elements from it. | ||
| * | ||
| * @checker_framework.manual #resource-leak-checker Resource Leak Checker | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @SubtypeOf({}) | ||
| public @interface NotOwningCollection {} |
24 changes: 24 additions & 0 deletions
24
...src/main/java/org/checkerframework/checker/collectionownership/qual/OwningCollection.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package org.checkerframework.checker.collectionownership.qual; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
|
|
||
| /** | ||
| * An expression of type {@code @OwningCollection} is a resource collection/array that definitely | ||
| * owns the underlying collection/array. It can add or remove elements from the collection/array. | ||
| * | ||
| * <p>The annotated expression (or one of its aliases) must either call the methods in the | ||
| * {@code @MustCall} type of its elements on all of its elements, or pass on the obligation to | ||
| * another expression. | ||
| * | ||
| * @checker_framework.manual #resource-leak-checker Resource Leak Checker | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @SubtypeOf({NotOwningCollection.class}) | ||
| public @interface OwningCollection {} |
30 changes: 30 additions & 0 deletions
30
...in/java/org/checkerframework/checker/collectionownership/qual/OwningCollectionBottom.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package org.checkerframework.checker.collectionownership.qual; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.checkerframework.framework.qual.DefaultFor; | ||
| import org.checkerframework.framework.qual.DefaultQualifierInHierarchy; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
| import org.checkerframework.framework.qual.TypeUseLocation; | ||
|
|
||
| /** | ||
| * The bottom qualifier of the Collection Ownership type hierarchy. It is the default qualifier. | ||
| * | ||
| * <p>An expression of type {@code @OwningCollectionBottom} is either not a collection/array or is a | ||
| * collection/array whose elements have empty {@code @MustCall} type. | ||
| * | ||
| * @checker_framework.manual #resource-leak-checker Resource Leak Checker | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @SubtypeOf({OwningCollectionWithoutObligation.class}) | ||
| @DefaultQualifierInHierarchy | ||
| @DefaultFor({ | ||
| TypeUseLocation.EXCEPTION_PARAMETER, | ||
| TypeUseLocation.RESOURCE_VARIABLE, | ||
| TypeUseLocation.RETURN, | ||
| TypeUseLocation.UPPER_BOUND | ||
| }) | ||
| public @interface OwningCollectionBottom {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: typetools/checker-framework
Length of output: 7389
Ownership contract is inconsistent across insertion APIs.
Line 119 requires
@Owningforadd(V), but insertion still occurs throughadd(V, int, int)(Line 109) andreplace(V)(Line 148) without ownership annotations. Both methods calltheMap.put(), creating bypass paths that weaken ownership/RLC guarantees.Update both
KeyedSetinterface andLinkedHashKeyedSetimplementation:@Owningtoadd(V, int, int)parameter@Owningtoreplace(V)parameter💡 Changes needed
In
KeyedSet.java:In
LinkedHashKeyedSet.java:🤖 Prompt for AI Agents