Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d0a276c
Add method invocation with lost receiver test
aosen-xiong Apr 5, 2025
317695b
Merge branch 'master' into poly-rdq
aosen-xiong Apr 22, 2026
81d996f
Merge branch 'master' into poly-rdq
aosen-xiong May 24, 2026
0150bc2
Check lost qualifier on assignment LHS
aosen-xiong May 26, 2026
523ad9d
Merge branch 'master' into poly-rdq
aosen-xiong May 26, 2026
30b6f7f
Address lost LHS review feedback
aosen-xiong May 26, 2026
a29edf8
Document lost LHS helper
aosen-xiong May 26, 2026
539258a
Reject nested lost qualifiers on assignment targets
aosen-xiong May 26, 2026
508ed8e
Handle Lost viewpoint adaptation diagnostics
aosen-xiong Jun 10, 2026
6bfa875
Merge branch 'master' into poly-rdq
aosen-xiong Jun 10, 2026
175580c
Remove override Javadocs from viewpoint test hooks
aosen-xiong Jun 10, 2026
f500969
Document viewpoint test diagnostic keys
aosen-xiong Jun 10, 2026
d8d5584
Apply Spotless to viewpoint test files
aosen-xiong Jun 10, 2026
8c4b0ec
Retry CI
aosen-xiong Jun 10, 2026
04ddd85
Trigger CI
aosen-xiong Jun 10, 2026
e900407
Expand viewpoint adaptation bounds test
aosen-xiong Jun 14, 2026
6e4526b
Merge branch 'master' into poly-rdq
aosen-xiong Jun 14, 2026
7ccef46
Merge branch 'master' into poly-rdq
aosen-xiong Jun 15, 2026
a3f0891
Merge branch 'master' of github.com:eisop/checker-framework into poly…
wmdietl Jun 15, 2026
ceeab99
Improve English documentation in Lost qualifier
wmdietl Jun 15, 2026
8a68568
Add viewpoint adaptation method invocation test cases
wmdietl Jun 15, 2026
62a178f
Merge branch 'master' into poly-rdq
aosen-xiong Jun 15, 2026
8a41e41
Check adapted Lost method bounds
aosen-xiong Jun 17, 2026
625ab89
Reject Lost in declaration LHS
aosen-xiong Jun 17, 2026
2c274b4
Merge branch 'master' into poly-rdq
aosen-xiong Jun 17, 2026
0592b0e
Merge branch 'master' into poly-rdq
aosen-xiong Jun 18, 2026
c72da59
Adapt method type parameter bounds from use
aosen-xiong Jul 4, 2026
b795476
Merge branch 'master' into poly-rdq
wmdietl 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

import org.checkerframework.framework.type.GenericAnnotatedTypeFactory;
import org.checkerframework.framework.type.NoElementQualifierHierarchy;
import org.checkerframework.framework.type.QualifierHierarchy;

import java.lang.annotation.Annotation;
import java.util.Collection;

import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.util.Elements;

import viewpointtest.quals.Bottom;
import viewpointtest.quals.Lost;

/** The {@link QualifierHierarchy} for the Viewpoint Test Checker. */
/** The qualifier hierarchy for the Viewpoint Test Checker. */
public class ViewpointTestQualifierHierarchy extends NoElementQualifierHierarchy {
/**
* Creates a ViewpointTestQualifierHierarchy from the given classes.
Expand All @@ -28,14 +23,4 @@ public ViewpointTestQualifierHierarchy(
GenericAnnotatedTypeFactory<?, ?, ?, ?> atypeFactory) {
super(qualifierClasses, elements, atypeFactory);
}

@Override
public boolean isSubtypeQualifiers(AnnotationMirror subAnno, AnnotationMirror superAnno) {
// Lost is not reflexive and the only subtype is Bottom.
if (atypeFactory.areSameByClass(superAnno, Lost.class)
&& !atypeFactory.areSameByClass(subAnno, Bottom.class)) {
return false;
}
return super.isSubtypeQualifiers(subAnno, superAnno);
}
}
17 changes: 14 additions & 3 deletions framework/src/test/java/viewpointtest/ViewpointTestVisitor.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package viewpointtest;

import com.sun.source.tree.AssignmentTree;
import com.sun.source.tree.NewClassTree;

import org.checkerframework.common.basetype.BaseTypeChecker;
import org.checkerframework.common.basetype.BaseTypeVisitor;
import org.checkerframework.framework.type.AnnotatedTypeMirror;
import org.checkerframework.framework.util.AnnotatedTypes;

/** The visitor for the Viewpoint Test Checker. */
public class ViewpointTestVisitor extends BaseTypeVisitor<ViewpointTestAnnotatedTypeFactory> {
Expand All @@ -19,10 +21,19 @@ public ViewpointTestVisitor(BaseTypeChecker checker) {

@Override
public Void visitNewClass(NewClassTree tree, Void p) {
AnnotatedTypeMirror Type = atypeFactory.getAnnotatedType(tree);
if (Type.hasAnnotation(atypeFactory.TOP) || Type.hasAnnotation(atypeFactory.LOST)) {
checker.reportError(tree, "new.class.type.invalid", Type.getAnnotations());
AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(tree);
if (type.hasAnnotation(atypeFactory.TOP) || type.hasAnnotation(atypeFactory.LOST)) {
checker.reportError(tree, "new.class.type.invalid", type.getAnnotations());
}
return super.visitNewClass(tree, p);
}

@Override
public Void visitAssignment(AssignmentTree tree, Void p) {
AnnotatedTypeMirror variableType = atypeFactory.getAnnotatedType(tree.getVariable());
if (AnnotatedTypes.containsModifier(variableType, atypeFactory.LOST)) {
checker.reportError(tree, "viewpointtest.lost.lhs");
}
return super.visitAssignment(tree, p);
}
Comment thread
aosen-xiong marked this conversation as resolved.
Outdated
Comment thread
aosen-xiong marked this conversation as resolved.
Outdated
}
3 changes: 1 addition & 2 deletions framework/src/test/java/viewpointtest/quals/Lost.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
* The Lost qualifier indicates that a relationship cannot be expressed. It is the result of
* viewpoint adaptation that combines {@link Top} and {@link ReceiverDependentQual}.
*
* <p>It is not reflexive in the subtyping relationship and the only subtype for Lost is {@link
* Bottom}.
* <p>It is valid as a viewpoint-adaptation result but not as the left-hand side of an assignment.
Comment thread
aosen-xiong marked this conversation as resolved.
Outdated
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
Expand Down
13 changes: 10 additions & 3 deletions framework/tests/viewpointtest/LostNonReflexive.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class LostNonReflexive {
@ReceiverDependentQual Object f;
@ReceiverDependentQual LostNonReflexive f2;

@SuppressWarnings({"inconsistent.constructor.type", "super.invocation.invalid"})
@ReceiverDependentQual LostNonReflexive(@ReceiverDependentQual Object args) {}
Expand All @@ -10,11 +11,16 @@ public class LostNonReflexive {
return null;
}

@PolyVP LostNonReflexive identity(@PolyVP LostNonReflexive this) {
return this;
}

void set(@ReceiverDependentQual Object o) {}

void test(@Top LostNonReflexive obj, @Bottom Object bottomObj) {
// :: error: (assignment.type.incompatible)
// :: error: (viewpointtest.lost.lhs)
this.f = obj.f;
// :: error: (viewpointtest.lost.lhs)
this.f = bottomObj;

// :: error: (assignment.type.incompatible)
Expand All @@ -24,13 +30,14 @@ void test(@Top LostNonReflexive obj, @Bottom Object bottomObj) {
// :: error: (assignment.type.incompatible)
@Bottom Object botObj = obj.get();

// :: error: (argument.type.incompatible) :: error: (new.class.type.invalid)
// :: error: (new.class.type.invalid)
new LostNonReflexive(obj.f);
// :: error: (new.class.type.invalid)
new LostNonReflexive(bottomObj);

// :: error: (argument.type.incompatible)
this.set(obj.f);
this.set(bottomObj);

obj.f2.identity();
}
}
4 changes: 2 additions & 2 deletions framework/tests/viewpointtest/TestGetAnnotatedLhs.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ void topWithRefinement() {
void topWithoutRefinement() {
// :: error: (new.class.type.invalid)
TestGetAnnotatedLhs top = new @Top TestGetAnnotatedLhs();
// :: error: (assignment.type.incompatible)
// :: error: (assignment.type.incompatible) :: error: (viewpointtest.lost.lhs)
top.f = new @B Object();
// :: error: (assignment.type.incompatible)
// :: error: (assignment.type.incompatible) :: error: (viewpointtest.lost.lhs)
top.f = new @A Object();
}
}
3 changes: 1 addition & 2 deletions framework/tests/viewpointtest/VarargsConstructor.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ void foo() {
};
@A Object a = new @A VarargsConstructor(aObj) {};
@B Object b = new @B VarargsConstructor(bObj) {};
// :: error: (argument.type.incompatible) :: error: (new.class.type.invalid) :: error:
// (varargs.type.incompatible)
// :: error: (argument.type.incompatible) :: error: (new.class.type.invalid)
@Top Object top = new @Top VarargsConstructor(topObj) {};
// :: error: (argument.type.incompatible)
new @A VarargsConstructor(bObj) {};
Expand Down
Loading