From 772a97fa7bf1cffc8dee4ad13a1d0e170078fb4a Mon Sep 17 00:00:00 2001 From: Marcos Paulo dos Santos Date: Mon, 26 Jun 2023 01:33:04 -0300 Subject: [PATCH] fix loop when reponse inherits generic class #2271 --- .../java/org/springdoc/core/parsers/ReturnTypeParser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/parsers/ReturnTypeParser.java b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/parsers/ReturnTypeParser.java index 1dfd2bc23..d911a4b9c 100644 --- a/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/parsers/ReturnTypeParser.java +++ b/springdoc-openapi-starter-common/src/main/java/org/springdoc/core/parsers/ReturnTypeParser.java @@ -27,6 +27,7 @@ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; +import java.util.Arrays; import java.util.Objects; import org.springframework.core.MethodParameter; @@ -92,7 +93,8 @@ static void resolveType(ResolvableType[] resolvableTypes, Class contextClass) resolvableTypes[i] = resolvableType; } else if (resolvableTypes[i].hasGenerics()) { - resolveType(resolvableTypes[i].getGenerics(), contextClass); + if(!Arrays.equals(resolvableTypes[i].getGenerics(), resolvableTypes)) + resolveType(resolvableTypes[i].getGenerics(), contextClass); if (resolvableTypes[i].getRawClass() != null) resolvableTypes[i] = ResolvableType.forClassWithGenerics(Objects.requireNonNull(resolvableTypes[i].getRawClass()), resolvableTypes[i].getGenerics()); }