Fix StackOverflowError in TypeDiscoverer comparison.

We now resort to String-based comparison if a generic cannot be resolved. Previously, unresolved generics caused an infinite recursion.

Closes #3084
This commit is contained in:
Mark Paluch
2024-04-23 10:17:53 +02:00
parent badc44a944
commit 289e4d1f52
2 changed files with 36 additions and 0 deletions

View File

@@ -331,6 +331,12 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
return false;
}
// in case types cannot be resolved resort to toString checking to avoid infinite recursion caused by raw types and
// self-referencing generics
if (that.resolvableType.hasUnresolvableGenerics() || this.resolvableType.hasUnresolvableGenerics()) {
return ObjectUtils.nullSafeEquals(that.resolvableType.toString(), this.resolvableType.toString());
}
return ObjectUtils.nullSafeEquals(resolvedGenerics.get(), that.resolvedGenerics.get());
}