Avoid ResolvableType creation for interface/superclass check

See gh-30713

(cherry picked from commit 1dfe737d0e)
This commit is contained in:
Juergen Hoeller
2023-06-21 17:17:58 +02:00
parent 5375f62dc1
commit d3df45d8fe

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -568,7 +568,7 @@ public class ResolvableType implements Serializable {
try {
for (Type genericInterface : resolved.getGenericInterfaces()) {
if (genericInterface instanceof Class) {
if (forClass((Class<?>) genericInterface).hasGenerics()) {
if (((Class<?>) genericInterface).getTypeParameters().length > 0) {
return true;
}
}
@@ -577,7 +577,10 @@ public class ResolvableType implements Serializable {
catch (TypeNotPresentException ex) {
// Ignore non-present types in generic signature
}
return getSuperType().hasUnresolvableGenerics();
Class<?> superclass = resolved.getSuperclass();
if (superclass != null && superclass != Object.class) {
return getSuperType().hasUnresolvableGenerics();
}
}
return false;
}