Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid StackOverflowError in TypeUtils#resolveGenerics (#9858)
While the issue (#9855) is related to JDK21 and its new `getFirst` and `getLast` methods in the `List`/`SequencedCollection` interfaces, the current behaviour can in theory cause problems on JDK versions before 21 too. With this fix the `TypeUtils#resolveGenerics` method falls back to `TypeUtils#ensureBaseType` (already used method-level type variables) when a type variable is used in the same class where it has been defined. This class for example, currently causes a `StackOverflowError`. With this PR the error is avoided, and the `T` is resolved as `java.lang.Object`: ```java class BrokenClass<T> { public T getT() { return null; } } ``` Fixes #9855
- Loading branch information