From 6678de581761955fca981f5129d82d22537fe79f Mon Sep 17 00:00:00 2001 From: Mikhail Pyltsin Date: Thu, 2 Feb 2023 12:07:23 +0100 Subject: [PATCH] Revert "IJ-CR-102037 [java-inspections] IDEA-311705. Support type inference changes in Java 20 for foreach" This reverts commit ea173dc1bc9794b1acb6fcc97b3539bbd87319cd. GitOrigin-RevId: 6a0ecd9623a9cf1209b93e115e527a3579ea096d --- .../codeInsight/daemon/impl/analysis/JavaGenericsUtil.java | 1 - .../java/codeInsight/daemon/DeconstructionInferenceTest.java | 5 ----- 2 files changed, 6 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 23164b15b4be..4e56bec0b86f 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,7 +316,6 @@ public final class JavaGenericsUtil { PsiSubstitutor superClassSubstitutor = TypeConversionUtil.getClassSubstitutor(owner, aClass, substitutor); if (superClassSubstitutor == null) return null; PsiType itemType = superClassSubstitutor.substitute(typeParameter); - itemType = PsiUtil.captureToplevelWildcards(itemType, aClass); return itemType == null ? PsiType.getJavaLangObject(manager, aClass.getResolveScope()) : itemType; } if (type instanceof PsiIntersectionType) { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/DeconstructionInferenceTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/DeconstructionInferenceTest.java index 8e433ea0ea56..f97d6f202382 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/DeconstructionInferenceTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/DeconstructionInferenceTest.java @@ -214,11 +214,6 @@ public class DeconstructionInferenceTest extends LightJavaCodeInsightFixtureTest int length = text.length(); } } - public static void test2(List> records) { - for (Box(var x ) : records) { - System.out.println(x.isEmpty()); - } - } } """); myFixture.enableInspections(new RawUseOfParameterizedTypeInspection());