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 72611 Details for
Bug 99631
[assist][5.0] Unnecessary proposals on annotation completion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug99631_003.txt (text/plain), 16.90 KB, created by
David Audel
on 2007-06-27 11:13:40 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-06-27 11:13:40 EDT
Size:
16.90 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.159 >diff -u -r1.159 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 27 Jun 2007 14:28:39 -0000 1.159 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 27 Jun 2007 15:12:40 -0000 >@@ -16168,4 +16168,205 @@ > "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_INHERITED + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType1() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test extends boole {\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CLASS + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType2() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " boole\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boole[POTENTIAL_METHOD_DECLARATION]{boole, Ltest.Test;, ()V, boole, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType3() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " class InnerTest {\n" + >+ " boole\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boole[POTENTIAL_METHOD_DECLARATION]{boole, Ltest.Test$InnerTest;, ()V, boole, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType4() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " boole\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType5() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " class InnerTest {\n" + >+ " boole\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boole[POTENTIAL_METHOD_DECLARATION]{boole, LInnerTest;, ()V, boole, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}\n" + >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType6() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo(boole) {\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void testType7() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " new boole\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public class booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "boolean[KEYWORD]{boolean, null, null, boolean, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} > } >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.87 >diff -u -r1.87 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 27 Jun 2007 13:33:53 -0000 1.87 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 27 Jun 2007 15:12:42 -0000 >@@ -10822,6 +10822,32 @@ > "b[METHOD_REF]{b, Ltest.InterfaceA;, ()V, b, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_STATIC + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=99631 >+public void test0336() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "@boole"+ >+ "public class Test {\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/test/booleanClass.java", >+ "package test;"+ >+ "public @interface booleanClass {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "boole"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "booleanClass[TYPE_REF]{booleanClass, test, Ltest.booleanClass;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_UNQUALIFIED + R_TARGET + 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.334 >diff -u -r1.334 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 27 Jun 2007 14:30:21 -0000 1.334 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 27 Jun 2007 15:12:46 -0000 >@@ -904,7 +904,7 @@ > this.completionToken = type.token; > setSourceRange(type.sourceStart, type.sourceEnd); > >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, true, new ObjectVector()); > if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { > findKeywordsForMember(this.completionToken, field.modifiers); > } >@@ -926,7 +926,7 @@ > SingleTypeReference type = (CompletionOnSingleTypeReference) method.returnType; > this.completionToken = type.token; > setSourceRange(type.sourceStart, type.sourceEnd); >- findTypesAndPackages(this.completionToken, scope.parent, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope.parent, true, new ObjectVector()); > if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { > findKeywordsForMember(this.completionToken, method.modifiers); > } >@@ -955,7 +955,7 @@ > this.findEnumConstant(this.completionToken, (SwitchStatement) astNodeParent); > } > } else if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) { >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, false, new ObjectVector()); > } else { > if (scope instanceof BlockScope && !this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { > char[][] alreadyDefinedName = computeAlreadyDefinedName((BlockScope)scope, singleNameReference); >@@ -974,7 +974,7 @@ > insideTypeAnnotation, > singleNameReference.isInsideAnnotationAttribute); > // can be the start of a qualified type name >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, true, new ObjectVector()); > if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { > if (this.completionToken != null && this.completionToken.length != 0) { > findKeywords(this.completionToken, singleNameReference.possibleKeywords, false, false); >@@ -1023,7 +1023,7 @@ > (BlockScope)scope, > typesFound); > } >- findTypesAndPackages(this.completionToken, scope, typesFound); >+ findTypesAndPackages(this.completionToken, scope, this.assistNodeIsConstructor, typesFound); > } > } else if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { > findMemberTypes( >@@ -1483,7 +1483,7 @@ > this.completionToken = type.token; > setSourceRange(type.sourceStart, type.sourceEnd); > >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, false, new ObjectVector()); > } else if (annot.type instanceof CompletionOnQualifiedTypeReference) { > this.insideQualifiedReference = true; > >@@ -1522,7 +1522,7 @@ > } > if (this.assistNodeCanBeSingleMemberAnnotation) { > if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) { >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, false, new ObjectVector()); > } else { > if (scope instanceof BlockScope && !this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { > char[][] alreadyDefinedName = computeAlreadyDefinedName((BlockScope)scope, FakeInvocationSite); >@@ -1541,7 +1541,7 @@ > insideTypeAnnotation, > true); > // can be the start of a qualified type name >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages(this.completionToken, scope, false, new ObjectVector()); > } > } > } >@@ -1602,7 +1602,11 @@ > this.completionToken = typeRef.token; > this.javadocTagPosition = typeRef.tagSourceStart; > setSourceRange(typeRef.sourceStart, typeRef.sourceEnd); >- findTypesAndPackages(this.completionToken, scope, new ObjectVector()); >+ findTypesAndPackages( >+ this.completionToken, >+ scope, >+ (this.assistNodeInJavadoc & CompletionOnJavadoc.BASE_TYPES) != 0, >+ new ObjectVector()); > > } else if (astNode instanceof CompletionOnJavadocQualifiedTypeReference) { > >@@ -6479,8 +6483,8 @@ > scope = scope.parent; > } > } >- private void findTypesAndPackages(char[] token, Scope scope, ObjectVector typesFound) { >- >+ private void findTypesAndPackages(char[] token, Scope scope, boolean proposeBaseTypes, ObjectVector typesFound) { >+ > if (token == null) > return; > >@@ -6712,7 +6716,9 @@ > } else { > if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.KEYWORD)) { > if (this.assistNodeInJavadoc == 0 || (this.assistNodeInJavadoc & CompletionOnJavadoc.BASE_TYPES) != 0) { >- findKeywords(token, BASE_TYPE_NAMES, false, false); >+ if (proposeBaseTypes) { >+ findKeywords(token, BASE_TYPE_NAMES, false, false); >+ } > } > } > if(proposeType) {
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 99631
: 72611