From eb9cddacc2e03662b974d78eb4740a5c6bb8a0c6 Mon Sep 17 00:00:00 2001 From: Knut Wannheden Date: Sat, 11 Nov 2023 16:00:48 +0100 Subject: [PATCH] Another fix for `TypeUtils#isAssignable()` A type like `List` is not assignable to e.g. `List` (without cast). --- .../src/main/java/org/openrewrite/java/tree/TypeUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rewrite-java/src/main/java/org/openrewrite/java/tree/TypeUtils.java b/rewrite-java/src/main/java/org/openrewrite/java/tree/TypeUtils.java index a0a29a1a338..cb0142f8d73 100644 --- a/rewrite-java/src/main/java/org/openrewrite/java/tree/TypeUtils.java +++ b/rewrite-java/src/main/java/org/openrewrite/java/tree/TypeUtils.java @@ -213,7 +213,7 @@ public static boolean isAssignableTo(@Nullable JavaType to, @Nullable JavaType f return true; } } - return isAssignableTo(toFq.getFullyQualifiedName(), from); + return !(from instanceof JavaType.GenericTypeVariable) && isAssignableTo(toFq.getFullyQualifiedName(), from); } else if (to instanceof JavaType.GenericTypeVariable) { JavaType.GenericTypeVariable toGeneric = (JavaType.GenericTypeVariable) to; List toBounds = toGeneric.getBounds();