forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 29
Move PICO to EISOP #1013
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
aosen-xiong
wants to merge
222
commits into
eisop:master
Choose a base branch
from
aosen-xiong:pico-move
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
Move PICO to EISOP #1013
Changes from 12 commits
Commits
Show all changes
222 commits
Select commit
Hold shift + click to select a range
32a297b
Starting move PICO to EISOP
aosen-xiong 9cc1911
Remove static import and holder class
aosen-xiong 514a607
Clear star import and static import again
aosen-xiong 2a48ae3
Lots of Javadoc and remove some unused method
aosen-xiong 4260bd3
Remove dangling Javadoc
aosen-xiong 2e4fffd
Add Javadoc
aosen-xiong 7341fad
A few more Javadoc
aosen-xiong 7a4d4a3
Add PICO's annotation for format
aosen-xiong cac7afa
Fix a few errors and add the very first test cases
aosen-xiong 6d911e4
Format poly and forbid RDM on static class
aosen-xiong 61601da
Yet another test case
aosen-xiong 646b5cb
Add object creation test
aosen-xiong 911355b
Use `PolyMutable` for iterator
aosen-xiong d7cdc75
Rename qualifier to `PICO...`
aosen-xiong cb648fe
Remove hack
aosen-xiong 63bd81e
Fixes misc-21 error
aosen-xiong b09a116
Also test validity of annotation on interface and abstract class
aosen-xiong fa1fdd7
Remove wrong todo and add JML readonly aliasing
aosen-xiong cf0cc18
Apply spotless
aosen-xiong 2e82b65
Add assignability annotation test and improve the error message
aosen-xiong 96c92a9
Add RDM class test and initialization test
aosen-xiong ebae3a8
Merge branch 'master' into pico-move
aosen-xiong 108a938
Add implicit mutable test
aosen-xiong 8bb7327
Add Definite Assignment test
aosen-xiong c02a0b2
Delete Definite Assignment test as it is already tested in `PICOIniti…
aosen-xiong b7ab62d
Add test for type use and inheritance
aosen-xiong 5808e34
A few small improvement
aosen-xiong ecd1534
Add lhs to test object creation default
aosen-xiong 78f6d40
Add builder pattern test case
aosen-xiong 8a86b18
Additional error message
aosen-xiong 8af7401
Add viewpoint adaptation test
aosen-xiong bacaf49
Add operator test
aosen-xiong 8025eb9
Add immutableclass and immutable list test cases
aosen-xiong e357d7c
Add cast, enum and refine the RDM test cases
aosen-xiong ce82ffa
Move some more operator test here
aosen-xiong bb1dffd
Add adapt constructor parameter test, it is adapted correctly but met…
aosen-xiong c90c1c7
Merge branch 'master' into pico-move
aosen-xiong 636e9da
Move all test cases over first
aosen-xiong 5d40b33
Remove committed wrong file
aosen-xiong 59b4e50
Rerun the test as it should use JDK from same branch name
aosen-xiong ef3c155
Test with CI Debug
aosen-xiong 592bbc1
Merge branch 'master' into pico-move
aosen-xiong a9851d4
Fix errors for JDK 11
aosen-xiong 71685bb
Merge branch 'master' into pico-move
aosen-xiong 736e78c
Merge branch 'master' into pico-move
aosen-xiong 6a7fb65
Remove unused override
aosen-xiong 44a70e6
Correct the test cases
aosen-xiong 3735fbe
Merge branch 'master' into pico-move
aosen-xiong 861d5c8
Undo debug
aosen-xiong 17c11e6
Test array as field in class
aosen-xiong b0ed675
Delete jdk.astub
aosen-xiong 5cc6842
Correct code and refine example
aosen-xiong 38a547a
Partially fixed override rule
aosen-xiong aa42c42
Merge branch 'master' into pico-move
aosen-xiong 3b97db2
Remove hack for adding annotation for toString and other methods
aosen-xiong 4f6236a
Apply suggestions from code review
aosen-xiong e347eb2
Remove super clause annotator
aosen-xiong 999750a
Remove used code
aosen-xiong e97245d
Apply spotless
aosen-xiong e2827d9
Fixes PolyMutable factory pattern
aosen-xiong 3fccd21
Compute Varargs before calling setParameterTypes
aosen-xiong da92fa8
Merge branch 'master' into pico-move
aosen-xiong e3db549
Doc cleanup
aosen-xiong 586433e
Clean up duplicate code for constructor invocation
aosen-xiong c3a6cea
Fixed crash bugs and a few more cleanups
aosen-xiong dcfde22
Clean up code and default method receiver to its class bound
aosen-xiong 1cc754f
Merge branch 'master' into pico-move
aosen-xiong e31d2f7
Fix behavior in transitive mutable field
aosen-xiong ffb39ee
Fixes array component type
aosen-xiong 2f9f082
Merge branch 'master' into pico-move
aosen-xiong 958f36a
Merge branch 'master' into pico-move
aosen-xiong e6c21c2
Adapt framework change
aosen-xiong 698dfc9
Fixing newest change
aosen-xiong 58c78d9
Allow underinit receiver to do assignment
aosen-xiong 87a8ca1
Add test case
aosen-xiong 4c35416
Add Circular initialization test case
aosen-xiong c79959b
Allow static class be annotated as RDM
aosen-xiong 5f76aaa
Merge branch 'master' into pico-move
aosen-xiong 2ba3033
Add `assumeInitialized` option
aosen-xiong 59367a2
Merge branch 'master' into pico-move
aosen-xiong 3f22ec2
Add suppress warning string
aosen-xiong 3fdc6b3
Merge branch 'master' into pico-move
aosen-xiong 7d3a209
Merge branch 'master' into pico-move
aosen-xiong 42ebb48
Starting move PICO to EISOP
aosen-xiong 3722c62
Remove static import and holder class
aosen-xiong a0e91bf
Clear star import and static import again
aosen-xiong ffd2918
Lots of Javadoc and remove some unused method
aosen-xiong 12a690b
Remove dangling Javadoc
aosen-xiong bcfc180
Add Javadoc
aosen-xiong 6ff2a0c
A few more Javadoc
aosen-xiong 7ef7d5f
Add PICO's annotation for format
aosen-xiong ef7134b
Fix a few errors and add the very first test cases
aosen-xiong 669818a
Format poly and forbid RDM on static class
aosen-xiong 5aa8ef2
Yet another test case
aosen-xiong 08c1e6d
Add object creation test
aosen-xiong 72b63cb
Use `PolyMutable` for iterator
aosen-xiong 0f4bae2
Rename qualifier to `PICO...`
aosen-xiong f0b3d2f
Remove hack
aosen-xiong a005dec
Fixes misc-21 error
aosen-xiong da13dfb
Also test validity of annotation on interface and abstract class
aosen-xiong 4a3092f
Remove wrong todo and add JML readonly aliasing
aosen-xiong 2a6ede9
Apply spotless
aosen-xiong 641f08a
Add assignability annotation test and improve the error message
aosen-xiong fcef64e
Add RDM class test and initialization test
aosen-xiong ae9f30b
Add implicit mutable test
aosen-xiong 2d223cf
Add Definite Assignment test
aosen-xiong 1ecc819
Delete Definite Assignment test as it is already tested in `PICOIniti…
aosen-xiong 0616937
Add test for type use and inheritance
aosen-xiong c23d73c
A few small improvement
aosen-xiong a716195
Add lhs to test object creation default
aosen-xiong 41350c8
Add builder pattern test case
aosen-xiong d52c80e
Additional error message
aosen-xiong 2dc1484
Add viewpoint adaptation test
aosen-xiong 5bebabc
Add operator test
aosen-xiong e3c31e7
Add immutableclass and immutable list test cases
aosen-xiong d8e1ea8
Add cast, enum and refine the RDM test cases
aosen-xiong 259c6f3
Move some more operator test here
aosen-xiong efe50ef
Add adapt constructor parameter test, it is adapted correctly but met…
aosen-xiong 39ecf72
Move all test cases over first
aosen-xiong 95cdb1d
Remove committed wrong file
aosen-xiong 98502ef
Rerun the test as it should use JDK from same branch name
aosen-xiong e9a248b
Test with CI Debug
aosen-xiong 6ca4e7b
Fix errors for JDK 11
aosen-xiong 2f2de2d
Remove unused override
aosen-xiong c878c83
Correct the test cases
aosen-xiong 5278293
Undo debug
aosen-xiong fc9cba8
Test array as field in class
aosen-xiong 52e55b5
Delete jdk.astub
aosen-xiong 9e8365f
Correct code and refine example
aosen-xiong 52360b7
Partially fixed override rule
aosen-xiong 3277134
Remove hack for adding annotation for toString and other methods
aosen-xiong 15f36a2
Apply suggestions from code review
aosen-xiong 48f98af
Remove super clause annotator
aosen-xiong c642523
Remove used code
aosen-xiong 6a188fb
Apply spotless
aosen-xiong c3b7aed
Fixes PolyMutable factory pattern
aosen-xiong a46db54
Compute Varargs before calling setParameterTypes
aosen-xiong 5c9eb0e
Doc cleanup
aosen-xiong 7c98910
Clean up duplicate code for constructor invocation
aosen-xiong 25bdd0e
Fixed crash bugs and a few more cleanups
aosen-xiong 7f93204
Clean up code and default method receiver to its class bound
aosen-xiong 8ca8780
Fix behavior in transitive mutable field
aosen-xiong 2365896
Fixes array component type
aosen-xiong ec1e8eb
Adapt framework change
aosen-xiong 9481378
Fixing newest change
aosen-xiong 2b6a087
Allow underinit receiver to do assignment
aosen-xiong f16613c
Add test case
aosen-xiong 132c90b
Add Circular initialization test case
aosen-xiong 6595d26
Allow static class be annotated as RDM
aosen-xiong e3ddaf4
Don't recursively call the function if the underlining type is raw
aosen-xiong 21f19e4
Commit the hack override
aosen-xiong 124be9b
PR 1078
aosen-xiong 7262aa3
Add PICO's annotation for format
aosen-xiong 1f130f9
Format poly and forbid RDM on static class
aosen-xiong ea3e0ba
Add `assumeInitialized` option
aosen-xiong 950892d
Add suppress warning string
aosen-xiong 2a0e474
Init change
aosen-xiong e76eecd
Get default value for poly qualifier
aosen-xiong 45762ad
Use fully qualified name for field
aosen-xiong 71a2056
Expand test cases
aosen-xiong 5d6b4ff
Further expand the test cases with generics
aosen-xiong 0af29e2
Add comment for new field in polynull
aosen-xiong c0fd193
Undo changes not needed
aosen-xiong 12c001a
PolyMutable with element
aosen-xiong 13eb283
Use areSameByName for polymutable in VPA
aosen-xiong f673c74
Update default
aosen-xiong cf58ea9
Delete temp files; Spotless
aosen-xiong 5597395
Don't comit the log
aosen-xiong b625881
Delete class files
aosen-xiong 2a06285
Don't check initialization for primitive types
aosen-xiong 0011a03
Some refactor
aosen-xiong 1fd9f5b
Mutable default tests
aosen-xiong b5e197e
Add suppress warning for clone
aosen-xiong 3bba205
Add suppress warning for poly interacts with varargs
aosen-xiong ddde593
Delete files not needed and format files
aosen-xiong 0d80050
Lost adapts RDM
aosen-xiong 1b6dc3a
Merge branch 'pico-move' into pico-move-hack
aosen-xiong b5856f2
Fixes error prone warnings and format test cases
aosen-xiong 042e77a
Suppress escape warning
aosen-xiong e435fff
Don't run immutable default tests
aosen-xiong 31bd3c6
Delete files not needed
aosen-xiong 3f72979
Fixes eisop#433
aosen-xiong dbdabab
Remove typetool link
aosen-xiong 5ccb034
Don't create top
aosen-xiong 8abf460
Add warning
aosen-xiong 5142c0b
Also fix for recursive bound
aosen-xiong 514f4a5
Unmerged PR #1438 to fix crash
aosen-xiong 6bc47ac
LazyFinal
aosen-xiong 16a4e98
Add Glacier test
aosen-xiong 1062a33
Remove OverrideEquals error
aosen-xiong 8e4c9bb
Default exception parameter to mutable
aosen-xiong 48be942
WIP
aosen-xiong c9100c5
Cleanup LazyFinal
aosen-xiong 4be3b83
Constrictor benchmark
aosen-xiong 8fcd2b7
Merge branch 'master' into pico-move
aosen-xiong 64fd81f
Merge branch 'master' into pico-move
aosen-xiong b23e559
Address PICO review cleanup
aosen-xiong 59022fd
Reject receiver-dependent mutable in static contexts
aosen-xiong 170959d
Clean up PICO mutability checks
aosen-xiong bce3034
Use robust anonymous class detection in PICO
aosen-xiong 651fada
Merge pico-artifact into pico-move
aosen-xiong f5db14c
Revert raw type propagation workaround
aosen-xiong 14a4542
Restore nullness jtreg class files
aosen-xiong e74496d
Address PICO artifact review comments
aosen-xiong 9f72b49
Revert qualifier polymorphism changes
aosen-xiong 5e5247b
Remove local notes from PICO artifact tests
aosen-xiong 869cf3b
Remove PICO object identity helpers
aosen-xiong 570608a
Fix PICO flexible override checking
aosen-xiong 28ead85
Reject static receiver-dependent mutable arrays
aosen-xiong eca8e9d
Remove old PICO immutability test suites
aosen-xiong 0106ba2
Refine PICO implementation and manual
aosen-xiong c416281
Add PICO getClass flow refinement
aosen-xiong 18b524e
Temporary diagnostic for related JDK clone
aosen-xiong 8bac99e
Test patched git-scripts for related clone
aosen-xiong b7bd84b
Revert temporary related clone diagnostics
aosen-xiong 74ed3d0
Merge branch 'master' into pico-move
aosen-xiong decc324
Rename PICO checker to Mutability checker
aosen-xiong 99ff6e4
Trigger CI
aosen-xiong c017610
Rename mutability manual figure
aosen-xiong e316f29
Report MutabilityLost with targeted errors
aosen-xiong 7bcffbc
Merge branch 'master' into pico-move
aosen-xiong 09f5d02
Use getTypeDeclarationBoundsFromUse in mutability isValidUse
aosen-xiong 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
19 changes: 19 additions & 0 deletions
19
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Assignable.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,19 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.checker.initialization.qual.HoldsForDefaultValue; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * This annotation is used to exclude the field from the abstract state and means the field can be | ||
| * reassigned after initialization. It should only annotate on field, not class or method. | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.FIELD}) | ||
| @HoldsForDefaultValue | ||
| public @interface Assignable {} |
29 changes: 29 additions & 0 deletions
29
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Bottom.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.pico.qual; | ||
|
|
||
| import org.checkerframework.framework.qual.DefaultFor; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
| import org.checkerframework.framework.qual.TargetLocations; | ||
| import org.checkerframework.framework.qual.TypeKind; | ||
| import org.checkerframework.framework.qual.TypeUseLocation; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * {@code @Bottom} can only be annotated before a type parameter (For example, {@code class | ||
| * C<@Bottom T extends MutableBox>{}}). This means {@code @Bottom} is the lower bound for this type | ||
| * parameter. | ||
| * | ||
| * <p>User can explicitly write {@code @Bottom} but it's not necessary because it's automatically | ||
| * inferred, and we have -AwarnRedundantAnnotations flag to warn about redundant annotations. | ||
| */ | ||
| @SubtypeOf({Mutable.class, Immutable.class, ReceiverDependentMutable.class, Lost.class}) | ||
| @DefaultFor(typeKinds = {TypeKind.NULL}) | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_PARAMETER}) | ||
| @TargetLocations({TypeUseLocation.LOWER_BOUND}) | ||
| public @interface Bottom {} | ||
83 changes: 83 additions & 0 deletions
83
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Immutable.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,83 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.checker.initialization.qual.HoldsForDefaultValue; | ||
| import org.checkerframework.framework.qual.DefaultFor; | ||
| import org.checkerframework.framework.qual.DefaultQualifierInHierarchy; | ||
| import org.checkerframework.framework.qual.LiteralKind; | ||
| import org.checkerframework.framework.qual.QualifierForLiterals; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
| import org.checkerframework.framework.qual.TypeKind; | ||
| import org.checkerframework.framework.qual.TypeUseLocation; | ||
| import org.checkerframework.framework.qual.UpperBoundFor; | ||
|
|
||
| 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 java.math.BigDecimal; | ||
| import java.math.BigInteger; | ||
|
|
||
| /** | ||
| * {@code @Immutable} is a type qualifier that indicates that the fields of annotated reference | ||
| * cannot be mutated. | ||
| * | ||
| * <p>For usage in PICO, there are three ways to use this annotation: Object creation: the object | ||
| * created will always be immutable; Annotation on a reference: the object that reference points to | ||
| * is immutable; Annotation on a class: all instances of that class are immutable. | ||
| */ | ||
| @SubtypeOf({Readonly.class}) | ||
| @Documented | ||
| @DefaultQualifierInHierarchy | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @DefaultFor( | ||
| value = {TypeUseLocation.EXCEPTION_PARAMETER}, | ||
| types = { | ||
| Enum.class, | ||
| String.class, | ||
| Double.class, | ||
| Boolean.class, | ||
| Byte.class, | ||
| Character.class, | ||
| Float.class, | ||
| Integer.class, | ||
| Long.class, | ||
| Short.class, | ||
| Number.class, | ||
| BigDecimal.class, | ||
| BigInteger.class | ||
| }, | ||
| typeKinds = { | ||
| TypeKind.INT, | ||
| TypeKind.BYTE, | ||
| TypeKind.SHORT, | ||
| TypeKind.BOOLEAN, | ||
| TypeKind.LONG, | ||
| TypeKind.CHAR, | ||
| TypeKind.FLOAT, | ||
| TypeKind.DOUBLE | ||
| }) | ||
| @QualifierForLiterals({LiteralKind.PRIMITIVE, LiteralKind.STRING}) | ||
| @UpperBoundFor( | ||
| typeKinds = { | ||
| TypeKind.INT, TypeKind.BYTE, TypeKind.SHORT, TypeKind.BOOLEAN, | ||
| TypeKind.LONG, TypeKind.CHAR, TypeKind.FLOAT, TypeKind.DOUBLE | ||
| }, | ||
| types = { | ||
| Enum.class, | ||
| String.class, | ||
| Double.class, | ||
| Boolean.class, | ||
| Byte.class, | ||
| Character.class, | ||
| Float.class, | ||
| Integer.class, | ||
| Long.class, | ||
| Short.class, | ||
| Number.class, | ||
| BigDecimal.class, | ||
| BigInteger.class | ||
| }) | ||
| @HoldsForDefaultValue | ||
| public @interface Immutable {} |
16 changes: 16 additions & 0 deletions
16
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Lost.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,16 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
|
|
||
| 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; | ||
|
|
||
| /** Lost means the mutability type of this reference is unknown. This is a subtype of Readonly. */ | ||
| @SubtypeOf({Readonly.class}) | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| public @interface Lost {} | ||
|
aosen-xiong marked this conversation as resolved.
Outdated
|
||
26 changes: 26 additions & 0 deletions
26
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Mutable.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,26 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.checker.initialization.qual.HoldsForDefaultValue; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * {@code @Mutable} is a type qualifier that indicates that the fields of annotated reference can be | ||
| * mutated through this reference. This is default behavior for all references in Java. | ||
| * | ||
| * <p>For usage in PICO, there are three ways to use this annotation: Object creation: the object | ||
| * created will always be mutable; Annotation on a reference: the object that reference points to is | ||
| * mutable; Annotation on a class: all instances of that class are mutable. | ||
| */ | ||
| @SubtypeOf({Readonly.class}) | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| // @DefaultFor({ TypeUseLocation.EXCEPTION_PARAMETER }) | ||
| @HoldsForDefaultValue | ||
| public @interface Mutable {} |
19 changes: 19 additions & 0 deletions
19
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/ObjectIdentityMethod.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,19 @@ | ||
| package org.checkerframework.checker.pico.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; | ||
|
|
||
| /** | ||
| * Indicates that the annotated method is an object identity method. An object identity method is a | ||
| * method that returns the identity of the object it is called on. | ||
| * | ||
| * <p>For example, the {@code hashCode} method is an object identity method, because it returns the | ||
| * identity of the object it is called on. | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD}) | ||
| public @interface ObjectIdentityMethod {} |
30 changes: 30 additions & 0 deletions
30
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/PolyMutable.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.pico.qual; | ||
|
|
||
| import org.checkerframework.framework.qual.PolymorphicQualifier; | ||
| import org.checkerframework.framework.qual.TargetLocations; | ||
| import org.checkerframework.framework.qual.TypeUseLocation; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * The polymorphic qualifier {@code @PolyMutable} indicates that the mutability type of this | ||
| * reference can be substituted to {@code @Mutable} or {@code @Immutable} or {@code @RDM}. This is a | ||
| * polymorphic qualifier that can be used in the type hierarchy. | ||
| * | ||
| * <p>{@code @PolyMutable} applies to method parameters, method return type and receiver. | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @PolymorphicQualifier(Readonly.class) | ||
| @TargetLocations({ | ||
| TypeUseLocation.PARAMETER, | ||
| TypeUseLocation.RECEIVER, | ||
| TypeUseLocation.RETURN, | ||
| TypeUseLocation.LOCAL_VARIABLE | ||
| }) | ||
| public @interface PolyMutable {} |
23 changes: 23 additions & 0 deletions
23
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Readonly.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,23 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.framework.qual.DefaultFor; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
| import org.checkerframework.framework.qual.TypeUseLocation; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * The top qualifier in the mutability type hierarchy that indicates that the fields of annotated | ||
| * reference cannot be mutated through this reference but can be mutated through other Aliasing. | ||
| * This is the default qualifier for local variables and subject to flow-sensitive type refinement. | ||
| */ | ||
| @SubtypeOf({}) | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| @DefaultFor({TypeUseLocation.LOCAL_VARIABLE, TypeUseLocation.IMPLICIT_UPPER_BOUND}) | ||
| public @interface Readonly {} |
26 changes: 26 additions & 0 deletions
26
...r-qual/src/main/java/org/checkerframework/checker/pico/qual/ReceiverDependentMutable.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,26 @@ | ||
| package org.checkerframework.checker.pico.qual; | ||
|
|
||
| import org.checkerframework.checker.initialization.qual.HoldsForDefaultValue; | ||
| import org.checkerframework.framework.qual.SubtypeOf; | ||
|
|
||
| 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; | ||
|
|
||
| /** | ||
| * {@code @ReceiverDependentMutable} is a type qualifier that indicates that mutability type depends | ||
| * on the receiver type. | ||
| * | ||
| * <p>For usage in PICO, there are three ways to use this annotation: Object creation: the object | ||
| * created depends on the lhs type; Annotation on a reference: the object that reference depends on | ||
| * the receiver type; Annotation on a class: the instances can be mutable or immutable. | ||
| */ | ||
| @SubtypeOf(Readonly.class) | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
| // @DefaultFor({ TypeUseLocation.FIELD }) | ||
| @HoldsForDefaultValue | ||
| public @interface ReceiverDependentMutable {} |
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.
Uh oh!
There was an error while loading. Please reload this page.