diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java index e56fd6269745..d708e921e5dc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java @@ -784,8 +784,11 @@ public class HighlightClassUtil { if (manager.areElementsEquivalent(place, aClass)) return true; } } - if (place instanceof PsiModifierListOwner && ((PsiModifierListOwner)place).hasModifierProperty(PsiModifier.STATIC)) { - return false; + if (place instanceof PsiModifierListOwner) { + final PsiModifierList modifierList = ((PsiModifierListOwner)place).getModifierList(); + if (modifierList != null && modifierList.hasExplicitModifier(PsiModifier.STATIC)) { + return false; + } } place = place.getParent(); } diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java index e1d8289f9dde..741183e811e1 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java @@ -927,7 +927,10 @@ public class TypeConversionUtil { // compatibility feature: allow to assign raw types to generic ones return allowUncheckedConversion; } - if (!typesAgree(typeLeft, typeRight, allowUncheckedConversion)) return false; + if (!typesAgree(typeLeft, typeRight, allowUncheckedConversion)) { + if (allowUncheckedConversion && !(typeLeft instanceof PsiWildcardType) && typeRight instanceof PsiClassType && ((PsiClassType)typeRight).isRaw()) continue; + return false; + } } return true; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA94011.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA94011.java new file mode 100644 index 000000000000..76beb3c2f75f --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA94011.java @@ -0,0 +1,21 @@ +import java.util.*; +class Test { + + class Parent { } + + interface Consumer { } + + interface MyConsumer extends Consumer { } + + + public void test(Set set) { + @SuppressWarnings("unchecked") + Map> map = create(set); + + } + + public > Map create(Set consumers) { + return null; + } + +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index dd4662ab0a89..3912ce4a730a 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -189,6 +189,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase { public void testStaticOverride() throws Exception { doTest(false); } public void testTypeArgumentsGivenOnRawType() throws Exception { doTest(false); } public void testTypeArgumentsGivenOnAnonymousClassCreation() throws Exception { doTest(false); } + public void testIDEA94011() throws Exception { doTest(false); } public void testJavaUtilCollections_NoVerify() throws Exception { PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));