Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 50786 Details for
Bug 123225
Code assist suggests overridden method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug123225_002.txt (text/plain), 13.46 KB, created by
David Audel
on 2006-09-25 04:13:54 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2006-09-25 04:13:54 EDT
Size:
13.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v >retrieving revision 1.127 >diff -u -r1.127 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 6 Sep 2006 08:32:44 -0000 1.127 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 25 Sep 2006 07:56:55 -0000 >@@ -10485,16 +10485,32 @@ > requestor.getResults()); > } > public void testCompletionAfterSupercall1() throws JavaModelException { >- CompletionTestsRequestor requestor = new CompletionTestsRequestor(); >- ICompilationUnit cu= getCompilationUnit("Completion", "src", "", "CompletionAfterSupercall1.java"); >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/CompletionAfterSupercall1.java", >+ "public class CompletionAfterSupercall1 extends CompletionAfterSupercall1_1 {\n" + >+ " public void foo(){\n" + >+ " super.foo\n" + >+ " }\n" + >+ "}\n" + >+ "abstract class CompletionAfterSupercall1_1 extends CompletionAfterSupercall1_2 implements CompletionAfterSupercall1_3 {\n" + >+ " \n" + >+ "}\n" + >+ "class CompletionAfterSupercall1_2 implements CompletionAfterSupercall1_3 {\n" + >+ " public void foo(){}\n" + >+ "}\n" + >+ "interface CompletionAfterSupercall1_3 {\n" + >+ " public void foo();\n" + >+ "}"); > >- String str = cu.getSource(); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); > String completeBehind = "super.foo"; >- int cursorLocation = str.indexOf(completeBehind) + completeBehind.length(); >- cu.codeComplete(cursorLocation, requestor); >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertEquals( >- "element:foo completion:foo() relevance:" + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED), >+ assertResults( >+ "foo[METHOD_REF]{foo(), LCompletionAfterSupercall1_2;, ()V, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC+ R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > public void testCompletionPackageAndClass1() throws JavaModelException { >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v >retrieving revision 1.73 >diff -u -r1.73 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 6 Sep 2006 14:50:24 -0000 1.73 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 25 Sep 2006 07:56:59 -0000 >@@ -9010,6 +9010,160 @@ > "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225 >+public void test0291() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[5]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void foo(){\n" + >+ " new Test2<Test4>().foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/Test1.java", >+ "package test;\n" + >+ "public class Test1<TTest1> {\n" + >+ " public void foo(TTest1 t){}\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/test/Test2.java", >+ "package test;\n" + >+ "public class Test2<TTest2 extends Test3> extends Test1<TTest2> {\n" + >+ " public void foo(Test3 t){}\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/test/Test3.java", >+ "package test;\n" + >+ "public class Test3 {\n" + >+ "}"); >+ >+ this.workingCopies[4] = getWorkingCopy( >+ "/Completion/src3/test/Test4.java", >+ "package test;\n" + >+ "public class Test4 extends Test3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = ".foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.Test2<Ltest.Test4;>;, (Ltest.Test3;)V, foo, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225 >+public void tes0292() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[6]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void foo(){\n" + >+ " new Test5().foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/Test1.java", >+ "package test;\n" + >+ "public class Test1<TTest1> {\n" + >+ " public void foo(TTest1 t){}\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/test/Test2.java", >+ "package test;\n" + >+ "public class Test2<TTest2 extends Test3> extends Test1<TTest2> {\n" + >+ " public void foo(Test3 t){}\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/test/Test3.java", >+ "package test;\n" + >+ "public class Test3 {\n" + >+ "}"); >+ >+ this.workingCopies[4] = getWorkingCopy( >+ "/Completion/src3/test/Test4.java", >+ "package test;\n" + >+ "public class Test4 extends Test3 {\n" + >+ "}"); >+ >+ this.workingCopies[5] = getWorkingCopy( >+ "/Completion/src3/test/Test5.java", >+ "package test;\n" + >+ "public class Test5 extends Test2<Test4> {\n" + >+ " public void foo(Test4 t){}\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = ".foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.Test2<Ltest.Test4;>;, (Ltest.Test3;)V, foo, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}\n" + >+ "foo[METHOD_REF]{foo(), Ltest.Test5;, (Ltest.Test4;)V, foo, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123225 >+public void test0293() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[5]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test extends Test2<Test4> {\n" + >+ " public void foo(Test4 t){}\n" + >+ " public void bar(){\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/Test1.java", >+ "package test;\n" + >+ "public class Test1<TTest1> {\n" + >+ " public void foo(TTest1 t){}\n" + >+ "}"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src3/test/Test2.java", >+ "package test;\n" + >+ "public class Test2<TTest2 extends Test3> extends Test1<TTest2> {\n" + >+ " public void foo(Test3 t){}\n" + >+ "}"); >+ >+ this.workingCopies[3] = getWorkingCopy( >+ "/Completion/src3/test/Test3.java", >+ "package test;\n" + >+ "public class Test3 {\n" + >+ "}"); >+ >+ this.workingCopies[4] = getWorkingCopy( >+ "/Completion/src3/test/Test4.java", >+ "package test;\n" + >+ "public class Test4 extends Test3 {\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.Test2<Ltest.Test4;>;, (Ltest.Test3;)V, foo, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + >+ "foo[METHOD_REF]{foo(), Ltest.Test;, (Ltest.Test4;)V, foo, (t), " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=153130 > public void testEC001() throws JavaModelException { > this.workingCopies = new ICompilationUnit[1]; >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.299 >diff -u -r1.299 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 8 Sep 2006 13:19:22 -0000 1.299 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 25 Sep 2006 07:57:04 -0000 >@@ -924,7 +924,7 @@ > ref, > scope, > false, >- true); >+ false); > } > > if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >@@ -942,7 +942,7 @@ > scope, > false, > false, >- true); >+ false); > } > > } else if (qualifiedBinding instanceof PackageBinding) { >@@ -1030,7 +1030,7 @@ > scope, > false, > messageSend.receiver instanceof SuperReference, >- true); >+ false); > } > } else if (astNode instanceof CompletionOnExplicitConstructorCall) { > if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >@@ -2779,7 +2779,7 @@ > invocationSite, > invocationScope, > implicitCall, >- true); >+ false); > } > > if(proposeMethod) { >@@ -2797,7 +2797,7 @@ > invocationScope, > implicitCall, > superCall, >- true); >+ false); > } > } > >@@ -3821,45 +3821,40 @@ > ReferenceBinding otherReceiverType = (ReferenceBinding) other[1]; > if (method == otherMethod && receiverType == otherReceiverType) > continue next; >- >- if (CharOperation.equals(method.selector, otherMethod.selector, true) >- && lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) { >- >- if (method.declaringClass.isSuperclassOf(otherMethod.declaringClass)) >- continue next; >- >- if (otherMethod.declaringClass.isInterface()) { >- if(method.declaringClass == scope.getJavaLangObject()) >- continue next; >- >- if (method.declaringClass.isInterface()) >- continue next; >- >- if (!superCall && method >- .declaringClass >- .implementsInterface(otherMethod.declaringClass, true)) >- continue next; >- } >- >- if (method.declaringClass.isInterface()) >- if(otherMethod >- .declaringClass >- .implementsInterface(method.declaringClass,true)) >- continue next; >- >- if(receiverType.isAnonymousType()) continue next; >- >- if(!superCall) { >- if(canBePrefixed) { >- prefixRequired = true; >- } else { >- continue next; >+ >+ if (CharOperation.equals(method.selector, otherMethod.selector, true)) { >+ if (receiverType == otherReceiverType) { >+ if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) { >+ if (!superCall || !otherMethod.declaringClass.isInterface()) { >+ continue next; >+ } >+ } >+ } else { >+ if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) { >+ if(receiverType.isAnonymousType()) continue next; >+ >+ if(!superCall) { >+ if(!canBePrefixed) continue next; >+ >+ prefixRequired = true; >+ } > } > } > } > } > > newMethodsFound.add(new Object[]{method, receiverType}); >+ >+ ReferenceBinding superTypeWithSameErasure = (ReferenceBinding)receiverType.findSuperTypeWithSameErasure(method.declaringClass); >+ if (method.declaringClass != superTypeWithSameErasure) { >+ MethodBinding[] otherMethods = superTypeWithSameErasure.getMethods(method.selector); >+ for (int i = 0; i < otherMethods.length; i++) { >+ if(otherMethods[i].original() == method.original()) { >+ method = otherMethods[i]; >+ } >+ } >+ } >+ > int length = method.parameters.length; > char[][] parameterPackageNames = new char[length][]; > char[][] parameterTypeNames = new char[length][]; >@@ -4720,7 +4715,11 @@ > } else { > hasPotentialDefaultAbstractMethods = false; > } >- currentType = currentType.superclass(); >+ if(currentType.isParameterizedType()) { >+ currentType = ((ParameterizedTypeBinding)currentType).type.superclass(); >+ } else { >+ currentType = currentType.superclass(); >+ } > } > } > private char[][] findMethodParameterNames(MethodBinding method, char[][] parameterTypeNames){
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 123225
: 50786