Skip to content
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
32a297b
Starting move PICO to EISOP
aosen-xiong Dec 9, 2024
9cc1911
Remove static import and holder class
aosen-xiong Dec 18, 2024
514a607
Clear star import and static import again
aosen-xiong Dec 18, 2024
2a48ae3
Lots of Javadoc and remove some unused method
aosen-xiong Dec 19, 2024
4260bd3
Remove dangling Javadoc
aosen-xiong Dec 19, 2024
2e4fffd
Add Javadoc
aosen-xiong Dec 19, 2024
7341fad
A few more Javadoc
aosen-xiong Dec 19, 2024
7a4d4a3
Add PICO's annotation for format
aosen-xiong Dec 19, 2024
cac7afa
Fix a few errors and add the very first test cases
aosen-xiong Dec 19, 2024
6d911e4
Format poly and forbid RDM on static class
aosen-xiong Dec 19, 2024
61601da
Yet another test case
aosen-xiong Dec 19, 2024
646b5cb
Add object creation test
aosen-xiong Dec 19, 2024
911355b
Use `PolyMutable` for iterator
aosen-xiong Dec 20, 2024
d7cdc75
Rename qualifier to `PICO...`
aosen-xiong Dec 20, 2024
cb648fe
Remove hack
aosen-xiong Dec 20, 2024
63bd81e
Fixes misc-21 error
aosen-xiong Dec 21, 2024
b09a116
Also test validity of annotation on interface and abstract class
aosen-xiong Dec 22, 2024
fa1fdd7
Remove wrong todo and add JML readonly aliasing
aosen-xiong Dec 22, 2024
cf0cc18
Apply spotless
aosen-xiong Dec 22, 2024
2e82b65
Add assignability annotation test and improve the error message
aosen-xiong Dec 19, 2024
96c92a9
Add RDM class test and initialization test
aosen-xiong Dec 27, 2024
ebae3a8
Merge branch 'master' into pico-move
aosen-xiong Dec 27, 2024
108a938
Add implicit mutable test
aosen-xiong Dec 27, 2024
8bb7327
Add Definite Assignment test
aosen-xiong Dec 27, 2024
c02a0b2
Delete Definite Assignment test as it is already tested in `PICOIniti…
aosen-xiong Dec 27, 2024
b7ab62d
Add test for type use and inheritance
aosen-xiong Dec 27, 2024
5808e34
A few small improvement
aosen-xiong Dec 27, 2024
ecd1534
Add lhs to test object creation default
aosen-xiong Dec 28, 2024
78f6d40
Add builder pattern test case
aosen-xiong Dec 30, 2024
8a86b18
Additional error message
aosen-xiong Dec 30, 2024
8af7401
Add viewpoint adaptation test
aosen-xiong Dec 30, 2024
bacaf49
Add operator test
aosen-xiong Dec 30, 2024
8025eb9
Add immutableclass and immutable list test cases
aosen-xiong Dec 30, 2024
e357d7c
Add cast, enum and refine the RDM test cases
aosen-xiong Dec 30, 2024
ce82ffa
Move some more operator test here
aosen-xiong Dec 30, 2024
bb1dffd
Add adapt constructor parameter test, it is adapted correctly but met…
aosen-xiong Dec 30, 2024
c90c1c7
Merge branch 'master' into pico-move
aosen-xiong Dec 30, 2024
636e9da
Move all test cases over first
aosen-xiong Dec 30, 2024
5d40b33
Remove committed wrong file
aosen-xiong Dec 30, 2024
59b4e50
Rerun the test as it should use JDK from same branch name
aosen-xiong Dec 31, 2024
ef3c155
Test with CI Debug
aosen-xiong Dec 31, 2024
592bbc1
Merge branch 'master' into pico-move
aosen-xiong Dec 31, 2024
a9851d4
Fix errors for JDK 11
aosen-xiong Dec 31, 2024
71685bb
Merge branch 'master' into pico-move
aosen-xiong Jan 3, 2025
736e78c
Merge branch 'master' into pico-move
aosen-xiong Jan 3, 2025
6a7fb65
Remove unused override
aosen-xiong Jan 3, 2025
44a70e6
Correct the test cases
aosen-xiong Jan 7, 2025
3735fbe
Merge branch 'master' into pico-move
aosen-xiong Jan 7, 2025
861d5c8
Undo debug
aosen-xiong Jan 7, 2025
17c11e6
Test array as field in class
aosen-xiong Jan 8, 2025
b0ed675
Delete jdk.astub
aosen-xiong Jan 8, 2025
5cc6842
Correct code and refine example
aosen-xiong Jan 8, 2025
38a547a
Partially fixed override rule
aosen-xiong Jan 9, 2025
aa42c42
Merge branch 'master' into pico-move
aosen-xiong Jan 9, 2025
3b97db2
Remove hack for adding annotation for toString and other methods
aosen-xiong Jan 10, 2025
4f6236a
Apply suggestions from code review
aosen-xiong Jan 10, 2025
e347eb2
Remove super clause annotator
aosen-xiong Jan 11, 2025
999750a
Remove used code
aosen-xiong Jan 11, 2025
e97245d
Apply spotless
aosen-xiong Jan 11, 2025
e2827d9
Fixes PolyMutable factory pattern
aosen-xiong Jan 12, 2025
3fccd21
Compute Varargs before calling setParameterTypes
aosen-xiong Aug 19, 2024
da92fa8
Merge branch 'master' into pico-move
aosen-xiong Jan 16, 2025
e3db549
Doc cleanup
aosen-xiong Jan 25, 2025
586433e
Clean up duplicate code for constructor invocation
aosen-xiong Jan 26, 2025
c3a6cea
Fixed crash bugs and a few more cleanups
aosen-xiong Jan 26, 2025
dcfde22
Clean up code and default method receiver to its class bound
aosen-xiong Jan 26, 2025
1cc754f
Merge branch 'master' into pico-move
aosen-xiong Jan 30, 2025
e31d2f7
Fix behavior in transitive mutable field
aosen-xiong Feb 1, 2025
ffb39ee
Fixes array component type
aosen-xiong Feb 1, 2025
2f9f082
Merge branch 'master' into pico-move
aosen-xiong Feb 15, 2025
958f36a
Merge branch 'master' into pico-move
aosen-xiong Feb 19, 2025
e6c21c2
Adapt framework change
aosen-xiong Feb 19, 2025
698dfc9
Fixing newest change
aosen-xiong Feb 19, 2025
58c78d9
Allow underinit receiver to do assignment
aosen-xiong Feb 20, 2025
87a8ca1
Add test case
aosen-xiong Feb 20, 2025
4c35416
Add Circular initialization test case
aosen-xiong Feb 20, 2025
c79959b
Allow static class be annotated as RDM
aosen-xiong Feb 20, 2025
5f76aaa
Merge branch 'master' into pico-move
aosen-xiong Feb 23, 2025
2ba3033
Add `assumeInitialized` option
aosen-xiong Mar 13, 2025
59367a2
Merge branch 'master' into pico-move
aosen-xiong Mar 13, 2025
3f22ec2
Add suppress warning string
aosen-xiong Mar 13, 2025
3fdc6b3
Merge branch 'master' into pico-move
aosen-xiong Apr 15, 2025
7d3a209
Merge branch 'master' into pico-move
aosen-xiong Oct 4, 2025
42ebb48
Starting move PICO to EISOP
aosen-xiong Dec 9, 2024
3722c62
Remove static import and holder class
aosen-xiong Dec 18, 2024
a0e91bf
Clear star import and static import again
aosen-xiong Dec 18, 2024
ffd2918
Lots of Javadoc and remove some unused method
aosen-xiong Dec 19, 2024
12a690b
Remove dangling Javadoc
aosen-xiong Dec 19, 2024
bcfc180
Add Javadoc
aosen-xiong Dec 19, 2024
6ff2a0c
A few more Javadoc
aosen-xiong Dec 19, 2024
7ef7d5f
Add PICO's annotation for format
aosen-xiong Dec 19, 2024
ef7134b
Fix a few errors and add the very first test cases
aosen-xiong Dec 19, 2024
669818a
Format poly and forbid RDM on static class
aosen-xiong Dec 19, 2024
5aa8ef2
Yet another test case
aosen-xiong Dec 19, 2024
08c1e6d
Add object creation test
aosen-xiong Dec 19, 2024
72b63cb
Use `PolyMutable` for iterator
aosen-xiong Dec 20, 2024
0f4bae2
Rename qualifier to `PICO...`
aosen-xiong Dec 20, 2024
f0b3d2f
Remove hack
aosen-xiong Dec 20, 2024
a005dec
Fixes misc-21 error
aosen-xiong Dec 21, 2024
da13dfb
Also test validity of annotation on interface and abstract class
aosen-xiong Dec 22, 2024
4a3092f
Remove wrong todo and add JML readonly aliasing
aosen-xiong Dec 22, 2024
2a6ede9
Apply spotless
aosen-xiong Dec 22, 2024
641f08a
Add assignability annotation test and improve the error message
aosen-xiong Dec 19, 2024
fcef64e
Add RDM class test and initialization test
aosen-xiong Dec 27, 2024
ae9f30b
Add implicit mutable test
aosen-xiong Dec 27, 2024
2d223cf
Add Definite Assignment test
aosen-xiong Dec 27, 2024
1ecc819
Delete Definite Assignment test as it is already tested in `PICOIniti…
aosen-xiong Dec 27, 2024
0616937
Add test for type use and inheritance
aosen-xiong Dec 27, 2024
c23d73c
A few small improvement
aosen-xiong Dec 27, 2024
a716195
Add lhs to test object creation default
aosen-xiong Dec 28, 2024
41350c8
Add builder pattern test case
aosen-xiong Dec 30, 2024
d52c80e
Additional error message
aosen-xiong Dec 30, 2024
2dc1484
Add viewpoint adaptation test
aosen-xiong Dec 30, 2024
5bebabc
Add operator test
aosen-xiong Dec 30, 2024
e3c31e7
Add immutableclass and immutable list test cases
aosen-xiong Dec 30, 2024
d8e1ea8
Add cast, enum and refine the RDM test cases
aosen-xiong Dec 30, 2024
259c6f3
Move some more operator test here
aosen-xiong Dec 30, 2024
efe50ef
Add adapt constructor parameter test, it is adapted correctly but met…
aosen-xiong Dec 30, 2024
39ecf72
Move all test cases over first
aosen-xiong Dec 30, 2024
95cdb1d
Remove committed wrong file
aosen-xiong Dec 30, 2024
98502ef
Rerun the test as it should use JDK from same branch name
aosen-xiong Dec 31, 2024
e9a248b
Test with CI Debug
aosen-xiong Dec 31, 2024
6ca4e7b
Fix errors for JDK 11
aosen-xiong Dec 31, 2024
2f2de2d
Remove unused override
aosen-xiong Jan 3, 2025
c878c83
Correct the test cases
aosen-xiong Jan 7, 2025
5278293
Undo debug
aosen-xiong Jan 7, 2025
fc9cba8
Test array as field in class
aosen-xiong Jan 8, 2025
52e55b5
Delete jdk.astub
aosen-xiong Jan 8, 2025
9e8365f
Correct code and refine example
aosen-xiong Jan 8, 2025
52360b7
Partially fixed override rule
aosen-xiong Jan 9, 2025
3277134
Remove hack for adding annotation for toString and other methods
aosen-xiong Jan 10, 2025
15f36a2
Apply suggestions from code review
aosen-xiong Jan 10, 2025
48f98af
Remove super clause annotator
aosen-xiong Jan 11, 2025
c642523
Remove used code
aosen-xiong Jan 11, 2025
6a188fb
Apply spotless
aosen-xiong Jan 11, 2025
c3b7aed
Fixes PolyMutable factory pattern
aosen-xiong Jan 12, 2025
a46db54
Compute Varargs before calling setParameterTypes
aosen-xiong Aug 19, 2024
5c9eb0e
Doc cleanup
aosen-xiong Jan 25, 2025
7c98910
Clean up duplicate code for constructor invocation
aosen-xiong Jan 26, 2025
25bdd0e
Fixed crash bugs and a few more cleanups
aosen-xiong Jan 26, 2025
7f93204
Clean up code and default method receiver to its class bound
aosen-xiong Jan 26, 2025
8ca8780
Fix behavior in transitive mutable field
aosen-xiong Feb 1, 2025
2365896
Fixes array component type
aosen-xiong Feb 1, 2025
ec1e8eb
Adapt framework change
aosen-xiong Feb 19, 2025
9481378
Fixing newest change
aosen-xiong Feb 19, 2025
2b6a087
Allow underinit receiver to do assignment
aosen-xiong Feb 20, 2025
f16613c
Add test case
aosen-xiong Feb 20, 2025
132c90b
Add Circular initialization test case
aosen-xiong Feb 20, 2025
6595d26
Allow static class be annotated as RDM
aosen-xiong Feb 20, 2025
e3ddaf4
Don't recursively call the function if the underlining type is raw
aosen-xiong Aug 19, 2024
21f19e4
Commit the hack override
aosen-xiong Jan 18, 2025
124be9b
PR 1078
aosen-xiong Jan 30, 2025
7262aa3
Add PICO's annotation for format
aosen-xiong Dec 19, 2024
1f130f9
Format poly and forbid RDM on static class
aosen-xiong Dec 19, 2024
ea3e0ba
Add `assumeInitialized` option
aosen-xiong Mar 13, 2025
950892d
Add suppress warning string
aosen-xiong Mar 13, 2025
2a0e474
Init change
aosen-xiong Mar 19, 2025
e76eecd
Get default value for poly qualifier
aosen-xiong Mar 19, 2025
45762ad
Use fully qualified name for field
aosen-xiong Mar 19, 2025
71a2056
Expand test cases
aosen-xiong Mar 19, 2025
5d6b4ff
Further expand the test cases with generics
aosen-xiong Mar 19, 2025
0af29e2
Add comment for new field in polynull
aosen-xiong Mar 19, 2025
c0fd193
Undo changes not needed
aosen-xiong Mar 19, 2025
12c001a
PolyMutable with element
aosen-xiong Mar 19, 2025
13eb283
Use areSameByName for polymutable in VPA
aosen-xiong Mar 21, 2025
f673c74
Update default
aosen-xiong Apr 15, 2025
cf58ea9
Delete temp files; Spotless
aosen-xiong Apr 15, 2025
5597395
Don't comit the log
aosen-xiong Apr 15, 2025
b625881
Delete class files
aosen-xiong Apr 16, 2025
2a06285
Don't check initialization for primitive types
aosen-xiong Apr 24, 2025
0011a03
Some refactor
aosen-xiong May 12, 2025
1fd9f5b
Mutable default tests
aosen-xiong May 12, 2025
b5e197e
Add suppress warning for clone
aosen-xiong May 12, 2025
3bba205
Add suppress warning for poly interacts with varargs
aosen-xiong May 12, 2025
ddde593
Delete files not needed and format files
aosen-xiong Oct 4, 2025
0d80050
Lost adapts RDM
aosen-xiong Mar 16, 2025
1b6dc3a
Merge branch 'pico-move' into pico-move-hack
aosen-xiong Oct 4, 2025
b5856f2
Fixes error prone warnings and format test cases
aosen-xiong Oct 4, 2025
042e77a
Suppress escape warning
aosen-xiong Oct 4, 2025
e435fff
Don't run immutable default tests
aosen-xiong Oct 4, 2025
31bd3c6
Delete files not needed
aosen-xiong Oct 4, 2025
3f72979
Fixes eisop#433
aosen-xiong Oct 28, 2025
dbdabab
Remove typetool link
aosen-xiong Oct 28, 2025
5ccb034
Don't create top
aosen-xiong Oct 28, 2025
8abf460
Add warning
aosen-xiong Oct 29, 2025
5142c0b
Also fix for recursive bound
aosen-xiong Oct 29, 2025
514f4a5
Unmerged PR #1438 to fix crash
aosen-xiong Nov 28, 2025
6bc47ac
LazyFinal
aosen-xiong Nov 28, 2025
16a4e98
Add Glacier test
aosen-xiong Nov 28, 2025
1062a33
Remove OverrideEquals error
aosen-xiong Feb 2, 2026
8e4c9bb
Default exception parameter to mutable
aosen-xiong Feb 2, 2026
48be942
WIP
aosen-xiong Mar 4, 2026
c9100c5
Cleanup LazyFinal
aosen-xiong Mar 4, 2026
4be3b83
Constrictor benchmark
aosen-xiong Mar 4, 2026
8fcd2b7
Merge branch 'master' into pico-move
aosen-xiong May 26, 2026
64fd81f
Merge branch 'master' into pico-move
aosen-xiong Jun 15, 2026
b23e559
Address PICO review cleanup
aosen-xiong Jun 16, 2026
59022fd
Reject receiver-dependent mutable in static contexts
aosen-xiong Jun 16, 2026
170959d
Clean up PICO mutability checks
aosen-xiong Jun 16, 2026
bce3034
Use robust anonymous class detection in PICO
aosen-xiong Jun 16, 2026
651fada
Merge pico-artifact into pico-move
aosen-xiong Jun 16, 2026
f5db14c
Revert raw type propagation workaround
aosen-xiong Jun 16, 2026
14a4542
Restore nullness jtreg class files
aosen-xiong Jun 16, 2026
e74496d
Address PICO artifact review comments
aosen-xiong Jun 16, 2026
9f72b49
Revert qualifier polymorphism changes
aosen-xiong Jun 16, 2026
5e5247b
Remove local notes from PICO artifact tests
aosen-xiong Jun 16, 2026
869cf3b
Remove PICO object identity helpers
aosen-xiong Jun 16, 2026
570608a
Fix PICO flexible override checking
aosen-xiong Jun 16, 2026
28ead85
Reject static receiver-dependent mutable arrays
aosen-xiong Jun 16, 2026
eca8e9d
Remove old PICO immutability test suites
aosen-xiong Jun 16, 2026
0106ba2
Refine PICO implementation and manual
aosen-xiong Jun 16, 2026
c416281
Add PICO getClass flow refinement
aosen-xiong Jun 16, 2026
18b524e
Temporary diagnostic for related JDK clone
aosen-xiong Jun 16, 2026
8bac99e
Test patched git-scripts for related clone
aosen-xiong Jun 16, 2026
b7bd84b
Revert temporary related clone diagnostics
aosen-xiong Jun 19, 2026
74ed3d0
Merge branch 'master' into pico-move
aosen-xiong Jun 19, 2026
decc324
Rename PICO checker to Mutability checker
aosen-xiong Jul 4, 2026
99ff6e4
Trigger CI
aosen-xiong Jul 4, 2026
c017610
Rename mutability manual figure
aosen-xiong Jul 4, 2026
e316f29
Report MutabilityLost with targeted errors
aosen-xiong Jul 4, 2026
7bcffbc
Merge branch 'master' into pico-move
aosen-xiong Jul 16, 2026
09f5d02
Use getTypeDeclarationBoundsFromUse in mutability isValidUse
aosen-xiong Jul 16, 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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ allprojects {

googleJavaFormat().aosp()
importOrder('com', 'jdk', 'lib', 'lombok', 'org', 'java', 'javax')
formatAnnotations().addTypeAnnotation("PolyInitialized").addTypeAnnotation("PolyVP").addTypeAnnotation("ReceiverDependentQual")
formatAnnotations().addTypeAnnotation("PolyInitialized").addTypeAnnotation("PolyVP").addTypeAnnotation("ReceiverDependentQual").addTypeAnnotation("Immutable").addTypeAnnotation("Readonly").addTypeAnnotation("Mutable").addTypeAnnotation("ReceiverDependentMutable").addTypeAnnotation("PolyMutable")
}

groovyGradle {
Expand Down
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 {}
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 {}
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 {}
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 {}
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.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 @PICOBottom} can only be annotated before a type parameter (For example, {@code class
* C<@Bottom T extends MutableBox>{}}). This means {@code @PICOBottom} is the lower bound for this
* type parameter.
*
* <p>User can explicitly write {@code @PICOBottom} 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, PICOLost.class})
@DefaultFor(typeKinds = {TypeKind.NULL})
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE_PARAMETER})
@TargetLocations({TypeUseLocation.LOWER_BOUND})
public @interface PICOBottom {}
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 PICOLost {}
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 {}
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 {}
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 {}
Loading