Skip to content

Commit 482ccd2

Browse files
change bound names
1 parent 095db02 commit 482ccd2

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/ExternalRefinementTypeChecker.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,18 @@ private boolean typesMatch(CtTypeReference<?> type1, CtTypeReference<?> type2) {
153153
if (type1 == null || type2 == null)
154154
return false;
155155

156-
// Type variables (generics such as E, N, T) carry different names in the JDK type and in the refinement
157-
// interface (e.g. Iterator's `E next()` vs a spec's `N next()`), so they never match by qualified name.
158-
// Treat any two type-parameter references as compatible.
159-
if (type1 instanceof CtTypeParameterReference && type2 instanceof CtTypeParameterReference)
160-
return true;
156+
// Type variables (generics such as E, N, T) carry different names in the JDK type
157+
if (type1 instanceof CtTypeParameterReference t1 && type2 instanceof CtTypeParameterReference t2)
158+
return boundName(t1).equals(boundName(t2));
161159

162160
return type1.getQualifiedName().equals(type2.getQualifiedName());
163161
}
164162

163+
private static String boundName(CtTypeParameterReference ref) {
164+
CtTypeReference<?> bound = ref.getBoundingType();
165+
return bound == null ? "java.lang.Object" : bound.getQualifiedName();
166+
}
167+
165168
private boolean parametersMatch(List<?> targetParams, List<?> refinementParams) {
166169
if (targetParams.size() != refinementParams.size())
167170
return false;

0 commit comments

Comments
 (0)