mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
better fix for IDEA-125082
This commit is contained in:
+9
-2
@@ -417,11 +417,18 @@ public class WeakestTypeFinder {
|
||||
final PsiClass aClass2 = method2.getContainingClass();
|
||||
if (aClass1 == null || aClass2 == null || aClass1.equals(aClass2)) {
|
||||
return 0;
|
||||
} else if (aClass1.isInheritor(aClass2, true)) {
|
||||
} else if (aClass1.isInterface() && !aClass2.isInterface()) {
|
||||
return -1;
|
||||
} else {
|
||||
} else if (!aClass1.isInterface() && aClass2.isInterface()) {
|
||||
return 1;
|
||||
} else if (aClass1.isInheritor(aClass2, true)) {
|
||||
return 1;
|
||||
} else if (aClass2.isInheritor(aClass1, true)) {
|
||||
return -1;
|
||||
}
|
||||
final String name1 = aClass1.getName();
|
||||
final String name2 = aClass2.getName();
|
||||
return name1.compareTo(name2);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import java.util.*;
|
||||
public class DeclareCollectionAsInterface
|
||||
{
|
||||
private HashMap<String, String> m_mapThree = new HashMap<String, String>(2);
|
||||
private <warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.AbstractMap'">HashMap</warning> m_setOne = new HashMap(2);
|
||||
private <warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.Map'">HashMap</warning> m_setOne = new HashMap(2);
|
||||
private Map m_setTwo = new HashMap(2);
|
||||
|
||||
public DeclareCollectionAsInterface()
|
||||
@@ -16,13 +16,13 @@ public class DeclareCollectionAsInterface
|
||||
|
||||
public void fooBar()
|
||||
{
|
||||
final <warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.AbstractMap'">HashMap</warning> map1 = new HashMap(2);
|
||||
final <warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.Map'">HashMap</warning> map1 = new HashMap(2);
|
||||
final Map map2 = new HashMap(2);
|
||||
map1.put("foo", "foo");
|
||||
map2.put("bar", "bar");
|
||||
}
|
||||
|
||||
public void fooBaz(<warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.AbstractMap'">HashMap</warning> set1, Map set2)
|
||||
public void fooBaz(<warning descr="Declaration of 'HashMap' should probably be weakened to 'java.util.Map'">HashMap</warning> set1, Map set2)
|
||||
{
|
||||
set1.put("foo", "foo");
|
||||
set2.put("bar", "bar");
|
||||
@@ -49,10 +49,10 @@ public class DeclareCollectionAsInterface
|
||||
}
|
||||
|
||||
void makeItRight() {
|
||||
<warning descr="Declaration of 'ArrayList' should probably be weakened to 'java.util.AbstractList'">ArrayList</warning> list22 = new ArrayList();
|
||||
<warning descr="Declaration of 'ArrayList' should probably be weakened to 'java.util.List'">ArrayList</warning> list22 = new ArrayList();
|
||||
System.out.println(list22.get(0));
|
||||
|
||||
<warning descr="Declaration of 'ArrayList' should probably be weakened to 'java.util.AbstractList'">ArrayList</warning><String> list33 = new ArrayList();
|
||||
<warning descr="Declaration of 'ArrayList' should probably be weakened to 'java.util.List'">ArrayList</warning><String> list33 = new ArrayList();
|
||||
System.out.println(list33.get(0));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user