Skip to content

Move PICO to EISOP - #1013

Open
aosen-xiong wants to merge 258 commits into
eisop:masterfrom
aosen-xiong:pico-move
Open

Move PICO to EISOP#1013
aosen-xiong wants to merge 258 commits into
eisop:masterfrom
aosen-xiong:pico-move

Conversation

@aosen-xiong

@aosen-xiong aosen-xiong commented Dec 9, 2024

Copy link
Copy Markdown
Collaborator

Original code repo: https://github.com/opprop/immutability
Some of commits are presented in: https://github.com/Ao-senXiong/immutability/tree/pico-cf-only
Merge with: eisop/jdk#106
As discussed before, I will try to move PICO here gradually. Hopefully adding test cases and Javadoc with more discussion as well.

@wmdietl wmdietl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick round of initial comments.

Comment thread checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Bottom.java Outdated
Comment thread checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Lost.java Outdated
Comment thread checker/src/main/java/org/checkerframework/checker/pico/jdk.astub Outdated
Comment thread checker/src/main/java/org/checkerframework/checker/pico/jdk.astub Outdated
Comment thread checker/src/main/java/org/checkerframework/checker/pico/jdk.astub Outdated
Comment thread checker/src/main/java/org/checkerframework/checker/pico/jdk.astub Outdated
Comment thread checker/src/main/java/org/checkerframework/checker/pico/jdk.astub Outdated
Comment thread framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java Outdated
aosen-xiong and others added 17 commits August 4, 2026 13:51
Replace TypesUtils.isAnonymous(TreeUtils.typeOf(...)) with
TreeUtils.isAnonymousClass(ClassTree) in MutabilityNoInitVisitor and
MutabilityValidator, following the API unification in eisop#1909
which fixes a JDK 11 anonymous class detection bug.
Java enums can have mutable fields, so @mutable on enum declarations
is a valid use case. The existing defaulting (MutabilityEnumDefaultAnnotator)
already handles this correctly via addMissingAnnotations. Added a Counter
enum test case demonstrating mutable enum with mutable state.
Replace actionable TODO with descriptive comment explaining that the
modern builder pattern (mutating target via setters) correctly reports
illegal.field.write and would require uniqueness tracking to support.
No custom poly.invocation.error key needed — the generic
assignment.type.incompatible is correct for poly return constrained
by receiver mutability. Chained poly calls (test5) correctly error
since each poly return resolves based on the receiver's mutability.
In @immutable ObjectMethods2, annotate clone() return type as
@immutable Object instead of using SuppressWarnings workaround.
The override.return.invalid remains (consistent with all three
test classes) due to how Object.clone() is annotated in stubs.
Replace the TODO with a descriptive comment explaining that varargs
type inference with @PolyMutable (e.g. Arrays.asList) does not
correctly adapt to the required mutability context, causing a false
positive that requires @SuppressWarnings.
Convert actionable TODOs into a descriptive note explaining that the
test is skipped because PICO lacks postcondition qualifiers (like
@EnsuresAssigned), preventing it from verifying initialization via
helper methods.
Add method calls with assertions to LocalVariableRefinement.java foo()
to test that local variable mutability flow refinement is correctly
applied after reassignment.
Update MutabilityNoInitVisitor to strictly check that constructors
can only initialize fields declared in their own class. Reassigning
inherited fields is now forbidden since the superclass constructor
has already completed and its state should not be mutated.
Added illegal.field.write expectation to SuperClassTest.java.
Update MemoizedRectangle.java to replace the TODO with a comment
explaining why no override error is emitted: mutating an @Assignable
field does not require a @mutable receiver. Also explicitly annotated
the receiver of size() as @readonly to make it clear why it validly
overrides the superclass method.
Make inner classes static in ImplicitMutable.java. In Java 11,
non-static inner classes cannot declare static fields, which was
causing a compilation error in the test suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants