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:
peter
2013-02-12 19:23:44 +01:00
parent 5d08fcc141
commit 8b63d897e2
4 changed files with 58 additions and 15 deletions
@@ -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>
}
}
@@ -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'
}