diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java index 3318d15b747a..dd171de90d18 100644 --- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java +++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java @@ -231,7 +231,8 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ final PsiMethod method = ((MethodCandidateInfo)conflict).getElement(); for (HierarchicalMethodSignature methodSignature : method.getHierarchicalMethodSignature().getSuperSignatures()) { final PsiMethod superMethod = methodSignature.getMethod(); - if (!CommonClassNames.JAVA_LANG_OBJECT.equals(superMethod.getContainingClass().getQualifiedName())) { + final PsiClass aClass = superMethod.getContainingClass(); + if (aClass != null && !CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) { superMethods.add(superMethod); } } @@ -513,7 +514,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{ if (varargsPosition) { if (type1 instanceof PsiEllipsisType && type2 instanceof PsiEllipsisType && params1.length == params2.length && - (!JavaVersionService.getInstance().isAtLeast(class1, JavaSdkVersion.JDK_1_7) || ((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) { + class1 != null && (!JavaVersionService.getInstance().isAtLeast(class1, JavaSdkVersion.JDK_1_7) || ((PsiArrayType)type1).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || ((PsiArrayType)type2).getComponentType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT))) { type1 = ((PsiEllipsisType)type1).toArrayType(); type2 = ((PsiEllipsisType)type2).toArrayType(); } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ResolveConflictDiamonds.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ResolveConflictDiamonds.java new file mode 100644 index 000000000000..a4949425dbd3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ResolveConflictDiamonds.java @@ -0,0 +1,19 @@ +class Test { + enum FooBar {Foo, Bar} + + void someMethod() { + new Infer<>((FooBar) null, FooBar.class); + new Infer( (FooBar) null, FooBar.class ); + } + + + public class Infer> { + @SafeVarargs + public Infer(T inst, Class tClass, T... excludes) { + } + + @SafeVarargs + public Infer(String inst, Class tClass, T... excludes) { + } + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java index e7e236999426..36861062d1a0 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java @@ -107,6 +107,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase { public void testInnerInTypeArguments() { doTest(false, false); } public void testRawSubstitutor() { doTest(false, false); } public void testIncompleteDiamonds() { doTest(false, false); } + public void testResolveConflictDiamonds() { doTest(false, false); } public void testDynamicallyAddIgnoredAnnotations() { ExtensionPoint point = Extensions.getRootArea().getExtensionPoint(ToolExtensionPoints.DEAD_CODE_TOOL);