Skip to content

Commit 7b0f549

Browse files
authored
Reproduce, fix #117 (#118)
1 parent 3070725 commit 7b0f549

File tree

5 files changed

+633
-17
lines changed

5 files changed

+633
-17
lines changed

VERSION.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Java ClassMate project: licensed under Apache License 2.0
33

44
Release notes:
55

6+
1.7.3 (02-Jan-2026)
7+
8+
#117: Regression in 1.7.2 (wrt #53) causes `StackOverflowError` for some recursive types
9+
(reported by Marcin E)
10+
611
1.7.2 (27-Dec-2025)
712

813
#53: Allow for subtype resolution with unknown generics

src/main/java/com/fasterxml/classmate/types/ResolvedRecursiveType.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,21 @@ public StringBuilder appendFullDescription(StringBuilder sb)
151151
/* Other overrides
152152
/**********************************************************************
153153
*/
154-
155-
@Override public boolean equals(Object o)
154+
155+
// 02-Jan-2026: [classmate#117]: Do NOT compare _referencedType to avoid infinite
156+
// recursion: super.equals() already compares class type, erased type, and type
157+
// bindings, which is sufficient for determining equality of recursive types.
158+
// Comparing _referencedType causes StackOverflowError when comparing types
159+
// from different TypeResolver instances.
160+
/*
161+
@Override
162+
public boolean equals(Object o)
156163
{
157-
if (!super.equals(o)) {
158-
return false;
159-
}
160-
// not sure if we should match at all, but definitely need this
161-
// additional part if we do:
162-
ResolvedRecursiveType other = (ResolvedRecursiveType) o;
163-
if (_referencedType == null) {
164-
return other._referencedType == null;
165-
}
166-
return _referencedType.equals(other._referencedType);
164+
return super.equals(o);
167165
}
166+
*/
168167

169168
// Only for compliance purposes: lgtm.com complains if only equals overridden
170-
@Override public int hashCode() {
171-
return super.hashCode();
172-
}
169+
// 02-Jan-2026, tatu: No longer, base impl is fine
170+
// @Override public int hashCode() { return super.hashCode(); }
173171
}

0 commit comments

Comments
 (0)