From 026f64952ae731eb02c2d896f4e07f8341485ec8 Mon Sep 17 00:00:00 2001 From: Mikhail Pyltsin Date: Thu, 2 Feb 2023 12:07:06 +0100 Subject: [PATCH] Revert "IJ-CR-102037 [java-inspections] IDEA-311705. Support type inference changes in Java 20 for foreach" This reverts commit 6851fe36806ce5b26b729d1aa3a0bf7eec19c76c. GitOrigin-RevId: 1204ac08b61235469f75bf3eea65bd59cb43788a --- .../codeInsight/daemon/impl/analysis/JavaGenericsUtil.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/java-psi-api/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java b/java/java-psi-api/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java index 3ccb2a23e81d..23164b15b4be 100644 --- a/java/java-psi-api/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java +++ b/java/java-psi-api/src/com/intellij/codeInsight/daemon/impl/analysis/JavaGenericsUtil.java @@ -316,9 +316,7 @@ public final class JavaGenericsUtil { PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getClassSubstitutor(owner, aClass, substitutor); if (superClassSubstitutor == null) return null; PsiType itemType = superClassSubstitutor.substitute(typeParameter); - if (itemType != null) { - itemType = PsiUtil.captureToplevelWildcards(itemType, aClass); - } + itemType = PsiUtil.captureToplevelWildcards(itemType, aClass); return itemType == null ? PsiType.getJavaLangObject(manager, aClass.getResolveScope()) : itemType; } if (type instanceof PsiIntersectionType) {