conflict resolution: missed null checks for diamonds non-physical static methods (IDEA-132534)

This commit is contained in:
Anna Kozlova
2014-11-07 11:57:07 +01:00
parent bdac2ab0af
commit cbd8be4b8e
3 changed files with 23 additions and 2 deletions
@@ -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();
}
@@ -0,0 +1,19 @@
class Test {
enum FooBar {Foo, Bar}
void someMethod() {
new Infer<>((FooBar) null, FooBar.class);
new Infer<FooBar>( (FooBar) null, FooBar.class );
}
public class Infer<T extends Enum<T>> {
@SafeVarargs
public Infer(T inst, Class<T> tClass, T... excludes) {
}
@SafeVarargs
public Infer(String inst, Class<T> tClass, T... excludes) {
}
}
}
@@ -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<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ToolExtensionPoints.DEAD_CODE_TOOL);