Open
Conversation
Co-authored-by: Werner Dietl <wdietl@gmail.com> Co-authored-by: Haifeng Shi <shihaifeng1998@gmail.com> Co-authored-by: Weitian Xing <xingweitian@gmail.com> Co-authored-by: Jeff Luo <j36luo@uwaterloo.ca> Co-authored-by: Mier Ta <m2ta@uwaterloo.ca>
33dfd50 to
32a297b
Compare
wmdietl
requested changes
Dec 20, 2024
Member
wmdietl
left a comment
There was a problem hiding this comment.
A quick round of initial comments.
checker/src/test/java/org/checkerframework/checker/test/junit/PICOImmutabilityTest.java
Show resolved
Hide resolved
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Bottom.java
Outdated
Show resolved
Hide resolved
checker-qual/src/main/java/org/checkerframework/checker/pico/qual/Lost.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/checkerframework/checker/pico/PICOInitializationAnnotatedTypeFactory.java
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/PICONoInitAnnotatedTypeFactory.java
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/jdk.astub
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/jdk.astub
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/jdk.astub
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/jdk.astub
Outdated
Show resolved
Hide resolved
checker/src/main/java/org/checkerframework/checker/pico/jdk.astub
Outdated
Show resolved
Hide resolved
Co-authored-by: Werner Dietl <wdietl@gmail.com>
aosen-xiong
commented
Dec 27, 2024
| PICOViewpointAdapter vpa = atypeFactory.getViewpointAdapter(); | ||
| AnnotationMirror adapted = vpa.combineAnnotationWithAnnotation(lhs, rhs); | ||
| return atypeFactory.getQualifierHierarchy().isSubtypeQualifiersOnly(adapted, lhs); | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
After #1032, this method and the override of isValidUse( AnnotatedDeclaredType declarationType, AnnotatedDeclaredType useType, Tree tree) can be removed.
Collaborator
Author
|
Looks like this hack override of I am using a different branch for doing case study on guava based on the hack. |
aosen-xiong
commented
Jan 16, 2025
Comment on lines
+515
to
+538
| protected boolean isTypeCastSafe(AnnotatedTypeMirror castType, AnnotatedTypeMirror exprType) { | ||
| QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); | ||
|
|
||
| final TypeKind castTypeKind = castType.getKind(); | ||
| if (castTypeKind == TypeKind.DECLARED) { | ||
| // Don't issue an error if the mutability annotations are equivalent to the qualifier | ||
| // upper bound of the type. | ||
| // BaseTypeVisitor#isTypeCastSafe is not used, to be consistent with inference which | ||
| // only have mutability qualifiers if inference is supporting FBC in the future, this | ||
| // overridden method can be removed. | ||
| AnnotatedDeclaredType castDeclared = (AnnotatedDeclaredType) castType; | ||
| AnnotationMirror bound = | ||
| qualifierHierarchy.findAnnotationInHierarchy( | ||
| atypeFactory.getTypeDeclarationBounds(castDeclared.getUnderlyingType()), | ||
| atypeFactory.READONLY); | ||
| assert bound != null; | ||
|
|
||
| if (AnnotationUtils.areSame( | ||
| castDeclared.getAnnotationInHierarchy(atypeFactory.READONLY), bound)) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return super.isTypeCastSafe(castType, exprType); |
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.