Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with GLB. #6853

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -893,6 +893,17 @@ public static AnnotatedTypeMirror annotatedGLB(
TypeMirror tm1 = type1.getUnderlyingType();
TypeMirror tm2 = type2.getUnderlyingType();
TypeMirror glbJava = TypesUtils.greatestLowerBound(tm1, tm2, atypeFactory.getProcessingEnv());
if (glbJava.getKind() == TypeKind.ERROR) {
if (type1.getKind() == TypeKind.TYPEVAR) {
return type1;
}
if (type2.getKind() == TypeKind.TYPEVAR) {
return type2;
}
// I think the only way error happens is when one of the types is a typevarible, but just in
// case, just return type1.
return type1;
}
Types types = atypeFactory.types;
QualifierHierarchy qualHierarchy = atypeFactory.getQualifierHierarchy();
if (types.isSubtype(tm1, tm2)) {
Expand Down
11 changes: 11 additions & 0 deletions framework/tests/all-systems/Issue6810.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Set;

public class Issue6810 {
static class Box<T extends Box<T>> {}

abstract static class BoxSet<T extends Box<T>> implements Set<T> {}

static <E extends Box<E>> void intersect2(BoxSet<? extends E> intersect, Set<E> set2) {
intersect.retainAll(set2);
}
}