mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
don't always prefer common methods like Object#equals once they ever were chosen
choosing another method from a subclass now also affects all superclass methods statistics
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
class Foo1 { boolean method1() {} }
|
||||
class Foo2 { boolean method2() {} }
|
||||
class Foo3 { boolean method3() {} }
|
||||
|
||||
public class MyFirstTestClassFoo {
|
||||
|
||||
void foo(Foo1 f1, Foo2 f2, Foo3 f3) {
|
||||
f1.<caret>
|
||||
}
|
||||
|
||||
}
|
||||
+23
@@ -181,6 +181,27 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
assertPreferredItems(0, "getComponents", "getComponent");
|
||||
}
|
||||
|
||||
public void testAbandonSameStatsForDifferentQualifiers() throws Throwable {
|
||||
invokeCompletion(getTestName(false) + ".java");
|
||||
assertPreferredItems 0, "method1", "equals"
|
||||
myFixture.type('eq\n2);\nf2.')
|
||||
|
||||
myFixture.completeBasic();
|
||||
assertPreferredItems 0, "equals", "method2"
|
||||
myFixture.type('me\n);\n')
|
||||
|
||||
for (i in 0..StatisticsManager.OBLIVION_THRESHOLD) {
|
||||
myFixture.type('f2.')
|
||||
myFixture.completeBasic()
|
||||
assertPreferredItems 0, "method2", "equals"
|
||||
myFixture.type('me\n);\n')
|
||||
}
|
||||
|
||||
myFixture.type('f3.')
|
||||
myFixture.completeBasic()
|
||||
assertPreferredItems 0, "method3", "equals"
|
||||
}
|
||||
|
||||
public void testDispreferFinalize() throws Throwable {
|
||||
checkPreferredItems(0, "final", "finalize");
|
||||
}
|
||||
@@ -394,6 +415,8 @@ import java.lang.annotation.Target;
|
||||
public void testDoNotPreferGetClass() {
|
||||
checkPreferredItems 0, 'get', 'getClass'
|
||||
incUseCount(lookup, 1)
|
||||
assertPreferredItems 0, 'getClass', 'get'
|
||||
incUseCount(lookup, 1)
|
||||
assertPreferredItems 0, 'get', 'getClass'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user