Move PICO to EISOP - #1013
Open
aosen-xiong wants to merge 258 commits into
Open
Conversation
aosen-xiong
force-pushed
the
pico-move
branch
from
December 14, 2024 19:35
33dfd50 to
32a297b
Compare
wmdietl
requested changes
Dec 20, 2024
wmdietl
left a comment
Member
There was a problem hiding this comment.
A quick round of initial comments.
Co-authored-by: Werner Dietl <wdietl@gmail.com>
aosen-xiong
commented
Dec 27, 2024
aosen-xiong
commented
Aug 4, 2026
aosen-xiong
commented
Aug 4, 2026
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.