mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disprefer rarely used Object methods
This commit is contained in:
@@ -48,12 +48,14 @@ public class KnownElementWeigher extends ProximityWeigher {
|
||||
final PsiMethod method = (PsiMethod)element;
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass != null) {
|
||||
if ("finalize".equals(method.getName()) || "registerNatives".equals(method.getName())) {
|
||||
String methodName = method.getName();
|
||||
if ("finalize".equals(methodName) || "registerNatives".equals(methodName) || "getClass".equals(methodName) ||
|
||||
methodName.startsWith("wait") || methodName.startsWith("notify")) {
|
||||
if (CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ("subSequence".equals(method.getName())) {
|
||||
if ("subSequence".equals(methodName)) {
|
||||
if (CommonClassNames.JAVA_LANG_STRING.equals(containingClass.getQualifiedName())) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
public void foo() {
|
||||
Runnable r = () -> {<caret>};
|
||||
Runnable r = () -> {n<caret>};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
public void foo() {
|
||||
new Thread(() -> <caret>);
|
||||
new Thread(() -> n<caret>);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
public void foo() {
|
||||
Runnable r = () -> <caret>
|
||||
Runnable r = () -> n<caret>
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class JavadocCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testSee0() throws Exception {
|
||||
configureByFile("See0.java");
|
||||
assertStringItems("foo", "clone", "equals", "getClass", "hashCode", "notify", "notifyAll", "Object", "toString", "wait", "wait", "wait", "finalize", "registerNatives");
|
||||
myFixture.assertPreferredCompletionItems(0, "foo", "clone", "equals", "hashCode");
|
||||
}
|
||||
|
||||
public void testSee1() throws Exception {
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
|
||||
public void testDeclaredMembersGoFirst() throws Exception {
|
||||
invokeCompletion(getTestName(false) + ".java");
|
||||
assertStringItems("fromThis", "overridden", "fromSuper", "equals", "getClass", "hashCode", "notify", "notifyAll", "toString", "wait",
|
||||
assertStringItems("fromThis", "overridden", "fromSuper", "equals", "hashCode", "toString", "getClass", "notify", "notifyAll", "wait",
|
||||
"wait", "wait");
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -95,7 +95,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testDontPreferKeywords() throws Throwable {
|
||||
checkPreferredItems(0, "o1", "foo", "name", "this", "getClass");
|
||||
checkPreferredItems(0, "o1", "foo", "name", "this");
|
||||
}
|
||||
|
||||
public void testEnumValueOf() throws Throwable {
|
||||
@@ -129,11 +129,11 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testSmartEquals2() throws Throwable {
|
||||
checkPreferredItems(0, "foo", "this", "o", "s", "getClass");
|
||||
checkPreferredItems(0, "foo", "this", "o", "s");
|
||||
}
|
||||
|
||||
public void testSmartEquals3() throws Throwable {
|
||||
checkPreferredItems(0, "b", "this", "a", "z", "getClass");
|
||||
checkPreferredItems(0, "b", "this", "a", "z");
|
||||
}
|
||||
|
||||
public void testSmartCollectionsNew() throws Throwable {
|
||||
@@ -222,7 +222,7 @@ public class SmartTypeCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
}
|
||||
|
||||
public void testFactoryMethodForDefaultType() throws Throwable {
|
||||
checkPreferredItems(0, "create", "this", "getClass");
|
||||
checkPreferredItems(0, "create", "this");
|
||||
}
|
||||
|
||||
public void testLocalVarsBeforeClassLiterals() throws Throwable {
|
||||
|
||||
+1
-1
@@ -471,7 +471,7 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testVoidExpectedType() throws Throwable {
|
||||
configureByTestName();
|
||||
assertStringItems("notify", "notifyAll", "wait", "wait", "wait", "getClass", "equals", "hashCode", "toString");
|
||||
assertStringItems("notify", "notifyAll", "wait", "wait", "wait", "equals", "hashCode", "toString", "getClass");
|
||||
type("eq");
|
||||
assertEquals("equals", assertOneElement(getLookup().getItems()).getLookupString());
|
||||
select();
|
||||
|
||||
Reference in New Issue
Block a user