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 79896 Details for
Bug 44627
[assist] improve content assist for static members when import missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed fix
bug44627_002.txt (text/plain), 28.82 KB, created by
David Audel
on 2007-10-08 09:11:28 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-10-08 09:11:28 EDT
Size:
28.82 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java,v >retrieving revision 1.4 >diff -u -r1.4 CompletionWithMissingTypesTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 6 Mar 2007 04:43:19 -0000 1.4 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 8 Oct 2007 11:51:13 -0000 >@@ -1305,7 +1305,7 @@ > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 >-public void test031() throws JavaModelException { >+public void test0031() throws JavaModelException { > this.workingCopies = new ICompilationUnit[3]; > this.workingCopies[0] = getWorkingCopy( > "/Completion/src/test/Test.java", >@@ -1412,4 +1412,150 @@ > "", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44627 >+public void test0034() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " MissingType.foo\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public void foo1()\n" + >+ " public static void foo2()\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NON_INHERITED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "foo2[METHOD_REF]{foo2(), Lmissing.MissingType;, ()V, foo2, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44627 >+public void test0035() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " MissingType.foo\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public int foo1;\n" + >+ " public static int foo2;\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NON_INHERITED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "foo2[FIELD_REF]{foo2, Lmissing.MissingType;, I, foo2, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44627 >+public void test0036() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " MissingType.foo\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public class foo1 {}\n" + >+ " public static class foo2 {}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NON_INHERITED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "MissingType.foo1[TYPE_REF]{foo1, missing, Lmissing.MissingType$foo1;, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "MissingType.foo2[TYPE_REF]{foo2, missing, Lmissing.MissingType$foo2;, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44627 >+public void test0037() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " MissingType.MissingType2.foo\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public class MissingType2 {\n" + >+ " public void foo1()\n" + >+ " public static void foo2()\n" + >+ " }\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ 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( >+ "", >+ requestor.getResults()); >+} > } >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/CompletionProposal.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionProposal.java,v >retrieving revision 1.38 >diff -u -r1.38 CompletionProposal.java >--- model/org/eclipse/jdt/core/CompletionProposal.java 26 Jan 2007 10:41:27 -0000 1.38 >+++ model/org/eclipse/jdt/core/CompletionProposal.java 8 Oct 2007 11:51:15 -0000 >@@ -1767,6 +1767,12 @@ > * <li><code>METHOD_IMPORT</code></li> > * </ul> > * </li> >+ * </li> >+ * <li><code>TYPE_REF</code> - The allowed required proposals for this kind are: >+ * <ul> >+ * <li><code>TYPE_REF</code></li> >+ * </ul> >+ * </li> > * </ul> > * </p> > * <p> >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.341 >diff -u -r1.341 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 24 Sep 2007 22:49:54 -0000 1.341 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 8 Oct 2007 11:51:15 -0000 >@@ -1038,7 +1038,11 @@ > false, > !this.assistNodeIsConstructor, > null, >- new ObjectVector()); >+ new ObjectVector(), >+ null, >+ null, >+ null, >+ false); > } > } else if (astNode instanceof CompletionOnQualifiedNameReference) { > >@@ -1061,7 +1065,17 @@ > (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) || > this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) { > if(ref.tokens.length == 1) { >- findFieldsAndMethodsFromMissingFieldType(ref.tokens[0], scope, ref, insideTypeAnnotation); >+ boolean foundSomeFields = findFieldsAndMethodsFromMissingFieldType(ref.tokens[0], scope, ref, insideTypeAnnotation); >+ >+ if (!foundSomeFields) { >+ findMembersFromMissingType( >+ ref.tokens[0], >+ ref.sourcePositions[0], >+ null, >+ scope, >+ ref, >+ ref.isInsideAnnotationAttribute); >+ } > } > } > } else if (qualifiedBinding instanceof VariableBinding) { >@@ -1100,89 +1114,16 @@ > ReferenceBinding receiverType = (ReferenceBinding) qualifiedBinding; > setSourceRange((int) (completionPosition >>> 32), (int) completionPosition); > >- if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >- findMemberTypes( >- this.completionToken, >- receiverType, >- scope, >- scope.enclosingSourceType(), >- false, >- true, >- new ObjectVector()); >- } >- if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { >- findClassField(this.completionToken, (TypeBinding) qualifiedBinding, scope); >- } >- >- MethodScope methodScope = null; >- if (!isInsideAnnotationAttribute && >- !this.requestor.isIgnored(CompletionProposal.KEYWORD) && >- ((scope instanceof MethodScope && !((MethodScope)scope).isStatic) >- || ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) { >- if (this.completionToken.length > 0) { >- findKeywords(this.completionToken, new char[][]{Keywords.THIS}, false, true); >- } else { >- int relevance = computeBaseRelevance(); >- relevance += computeRelevanceForResolution(); >- relevance += computeRelevanceForInterestingProposal(); >- relevance += computeRelevanceForCaseMatching(this.completionToken, Keywords.THIS); >- relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords >- relevance += R_NON_INHERITED; >- >- this.noProposal = false; >- if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { >- CompletionProposal proposal = this.createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition); >- proposal.setName(Keywords.THIS); >- proposal.setCompletion(Keywords.THIS); >- proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >- proposal.setRelevance(relevance); >- this.requestor.accept(proposal); >- if (DEBUG) { >- this.printDebug(proposal); >- } >- } >- } >- } >- >- if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { >- findFields( >- this.completionToken, >- receiverType, >- scope, >- new ObjectVector(), >- new ObjectVector(), >- true, >- ref, >- scope, >- false, >- false, >- null, >- null, >- null, >- false); >- } >- >- if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >- findMethods( >+ findMembers( > this.completionToken, >- null, >- null, > receiverType, > scope, >- new ObjectVector(), >- true, >- false, >- false, > ref, >- scope, >- false, >- false, >- false, >+ isInsideAnnotationAttribute, > null, > null, > null, > false); >- } > > } else if (qualifiedBinding instanceof PackageBinding) { > >@@ -1228,7 +1169,11 @@ > scope.enclosingSourceType(), > false, > false, >- typesFound); >+ typesFound, >+ null, >+ null, >+ null, >+ false); > } > } else if (qualifiedBinding instanceof PackageBinding) { > >@@ -1463,7 +1408,11 @@ > scope.enclosingSourceType(), > false, > false, >- typesFound); >+ typesFound, >+ null, >+ null, >+ null, >+ false); > } > } else if (astNode instanceof CompletionOnMarkerAnnotationName) { > CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode; >@@ -1506,7 +1455,11 @@ > scope.enclosingSourceType(), > false, > false, >- new ObjectVector()); >+ new ObjectVector(), >+ null, >+ null, >+ null, >+ false); > } > } > } else if (astNode instanceof CompletionOnMemberValueName) { >@@ -1625,13 +1578,18 @@ > ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF))) { > int rangeStart = typeRef.completeInText() ? typeRef.sourceStart : (int) (completionPosition >>> 32); > setSourceRange(rangeStart, (int) completionPosition); >- findMemberTypes(this.completionToken, >+ findMemberTypes( >+ this.completionToken, > (ReferenceBinding) qualifiedBinding, > scope, > scope.enclosingSourceType(), > false, > false, >- new ObjectVector()); >+ new ObjectVector(), >+ null, >+ null, >+ null, >+ false); > } > } else if (qualifiedBinding instanceof PackageBinding) { > >@@ -2597,7 +2555,16 @@ > > this.noProposal = false; > if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >- createTypeProposal(exceptionType, exceptionType.qualifiedSourceName(), IAccessRule.K_ACCESSIBLE, completionName, relevance); >+ createTypeProposal( >+ exceptionType, >+ exceptionType.qualifiedSourceName(), >+ IAccessRule.K_ACCESSIBLE, >+ completionName, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > >@@ -3532,12 +3499,14 @@ > } > } > >- private void findFieldsAndMethodsFromMissingFieldType( >+ private boolean findFieldsAndMethodsFromMissingFieldType( > char[] token, > Scope scope, > InvocationSite invocationSite, > boolean insideTypeAnnotation) { > >+ boolean foundSomeFields = false; >+ > boolean staticsOnly = false; > Scope currentScope = scope; > >@@ -3565,6 +3534,7 @@ > FieldDeclaration fieldDeclaration = fields[i]; > if (CharOperation.equals(fieldDeclaration.name, token)) { > if (fieldDeclaration.binding == null) { >+ foundSomeFields = true; > findFieldsAndMethodsFromMissingType( > this.completionToken, > fieldDeclaration.type, >@@ -3584,6 +3554,7 @@ > } > currentScope = currentScope.parent; > } >+ return foundSomeFields; > } > > private void findFieldsAndMethodsFromMissingReturnType( >@@ -3925,7 +3896,16 @@ > } > this.noProposal = false; > if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >- createTypeProposal(memberType, memberType.qualifiedSourceName(), IAccessRule.K_ACCESSIBLE, completionName, relevance); >+ createTypeProposal( >+ memberType, >+ memberType.qualifiedSourceName(), >+ IAccessRule.K_ACCESSIBLE, >+ completionName, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > } >@@ -4286,6 +4266,141 @@ > findKeywords(token, keywords, false, false); > } > >+ protected void findMembers( >+ char[] token, >+ ReferenceBinding receiverType, >+ Scope scope, >+ InvocationSite invocationSite, >+ boolean isInsideAnnotationAttribute, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { >+ >+ if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >+ findMemberTypes( >+ token, >+ receiverType, >+ scope, >+ scope.enclosingSourceType(), >+ false, >+ true, >+ new ObjectVector(), >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); >+ } >+ if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { >+ findClassField(token, receiverType, scope); >+ } >+ >+ MethodScope methodScope = null; >+ if (!isInsideAnnotationAttribute && >+ !this.requestor.isIgnored(CompletionProposal.KEYWORD) && >+ ((scope instanceof MethodScope && !((MethodScope)scope).isStatic) >+ || ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) { >+ if (token.length > 0) { >+ findKeywords(token, new char[][]{Keywords.THIS}, false, true); >+ } else { >+ int relevance = computeBaseRelevance(); >+ relevance += computeRelevanceForResolution(); >+ relevance += computeRelevanceForInterestingProposal(); >+ relevance += computeRelevanceForCaseMatching(this.completionToken, Keywords.THIS); >+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords >+ relevance += R_NON_INHERITED; >+ >+ this.noProposal = false; >+ if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { >+ CompletionProposal proposal = this.createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition); >+ proposal.setName(Keywords.THIS); >+ proposal.setCompletion(Keywords.THIS); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ this.requestor.accept(proposal); >+ if (DEBUG) { >+ this.printDebug(proposal); >+ } >+ } >+ } >+ } >+ >+ if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { >+ findFields( >+ token, >+ receiverType, >+ scope, >+ new ObjectVector(), >+ new ObjectVector(), >+ true, >+ invocationSite, >+ scope, >+ false, >+ false, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); >+ } >+ >+ if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >+ findMethods( >+ token, >+ null, >+ null, >+ receiverType, >+ scope, >+ new ObjectVector(), >+ true, >+ false, >+ false, >+ invocationSite, >+ scope, >+ false, >+ false, >+ false, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); >+ } >+ } >+ >+ private void findMembersFromMissingType( >+ final char[] token, >+ final long pos, >+ TypeBinding resolveType, >+ final Scope scope, >+ final InvocationSite invocationSite, >+ final boolean isInsideAnnotationAttribute) { >+ MissingTypesGuesser missingTypesConverter = new MissingTypesGuesser(this); >+ MissingTypesGuesser.GuessedTypeRequestor substitutionRequestor = >+ new MissingTypesGuesser.GuessedTypeRequestor() { >+ public void accept( >+ TypeBinding guessedType, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean hasProblems) { >+ if (guessedType instanceof ReferenceBinding) { >+ findMembers( >+ CompletionEngine.this.completionToken, >+ (ReferenceBinding)guessedType, >+ scope, >+ invocationSite, >+ isInsideAnnotationAttribute, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ hasProblems); >+ } >+ } >+ }; >+ SingleTypeReference typeRef = new SingleTypeReference(token, pos); >+ typeRef.resolvedType = new ProblemReferenceBinding(token, null, ProblemReasons.NotFound); >+ missingTypesConverter.guess(typeRef, scope, substitutionRequestor); >+ } >+ > // Helper method for findMemberTypes(char[], ReferenceBinding, Scope) > private void findMemberTypes( > char[] typeName, >@@ -4297,7 +4412,11 @@ > boolean staticFieldsAndMethodOnly, > boolean fromStaticImport, > boolean checkQualification, >- Scope scope) { >+ Scope scope, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > // Inherited member types which are hidden by subclasses are filtered out > // No visibility checks can be performed without the scope & invocationSite >@@ -4411,9 +4530,22 @@ > } else if(memberType.isInterface()) { > relevance += computeRelevanceForInterface(); > } >+ >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > this.noProposal = false; >- createTypeProposal(memberType, memberType.qualifiedSourceName(), IAccessRule.K_ACCESSIBLE, completionName, relevance); >+ createTypeProposal( >+ memberType, >+ memberType.qualifiedSourceName(), >+ IAccessRule.K_ACCESSIBLE, >+ completionName, >+ relevance, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > } > >@@ -4424,7 +4556,11 @@ > SourceTypeBinding typeInvocation, > boolean staticOnly, > boolean staticFieldsAndMethodOnly, >- ObjectVector typesFound) { >+ ObjectVector typesFound, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > findMemberTypes( > typeName, > receiverType, >@@ -4436,7 +4572,11 @@ > false, > false, > null, >- typesFound); >+ typesFound, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > private void findMemberTypes( > char[] typeName, >@@ -4449,7 +4589,11 @@ > boolean checkQualification, > boolean proposeAllMemberTypes, > SourceTypeBinding typeToIgnore, >- ObjectVector typesFound) { >+ ObjectVector typesFound, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > ReferenceBinding currentType = receiverType; > if (typeName == null) >@@ -4472,7 +4616,11 @@ > staticFieldsAndMethodOnly, > fromStaticImport, > checkQualification, >- scope); >+ scope, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > return; > } > >@@ -4508,7 +4656,11 @@ > staticFieldsAndMethodOnly, > fromStaticImport, > checkQualification, >- scope); >+ scope, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > > currentType = currentType.superclass(); > } while (currentType != null); >@@ -4543,7 +4695,11 @@ > staticFieldsAndMethodOnly, > fromStaticImport, > checkQualification, >- scope); >+ scope, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > > ReferenceBinding[] itsInterfaces = anInterface.superInterfaces(); > if (itsInterfaces != Binding.NO_SUPERINTERFACES) { >@@ -4626,7 +4782,11 @@ > staticFieldsAndMethodOnly, > fromStaticImport, > true, >- scope); >+ scope, >+ null, >+ null, >+ null, >+ false); > > ReferenceBinding[] memberTypes = receiverType.memberTypes(); > next : for (int i = 0; i < memberTypes.length; i++) { >@@ -6358,7 +6518,16 @@ > > this.noProposal = false; > if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >- createTypeProposal(localType, localType.sourceName, IAccessRule.K_ACCESSIBLE, localType.sourceName, relevance); >+ createTypeProposal( >+ localType, >+ localType.sourceName, >+ IAccessRule.K_ACCESSIBLE, >+ localType.sourceName, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > } >@@ -6367,7 +6536,22 @@ > > case Scope.CLASS_SCOPE : > SourceTypeBinding enclosingSourceType = scope.enclosingSourceType(); >- findMemberTypes(typeName, enclosingSourceType, scope, currentType, false, false, false, false, proposeAllMemberTypes, nextTypeToIgnore, typesFound); >+ findMemberTypes( >+ typeName, >+ enclosingSourceType, >+ scope, >+ currentType, >+ false, >+ false, >+ false, >+ false, >+ proposeAllMemberTypes, >+ nextTypeToIgnore, >+ typesFound, >+ null, >+ null, >+ null, >+ false); > nextTypeToIgnore = enclosingSourceType; > if (typeLength == 0) > return; // do not search outside the class scope if no prefix was provided >@@ -6428,7 +6612,16 @@ > relevance += computeRelevanceForRestrictions(accessibility); // no access restriction for type in the current unit > > if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) { >- createTypeProposal(refBinding, refBinding.qualifiedSourceName(), IAccessRule.K_ACCESSIBLE, CharOperation.NO_CHAR, relevance); >+ createTypeProposal( >+ refBinding, >+ refBinding.qualifiedSourceName(), >+ IAccessRule.K_ACCESSIBLE, >+ CharOperation.NO_CHAR, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > } >@@ -6599,7 +6792,16 @@ > this.noProposal = false; > if(proposeType) { > char[] typeName = sourceType.sourceName(); >- createTypeProposal(sourceType, typeName, IAccessRule.K_ACCESSIBLE, typeName, relevance); >+ createTypeProposal( >+ sourceType, >+ typeName, >+ IAccessRule.K_ACCESSIBLE, >+ typeName, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > } >@@ -6852,7 +7054,16 @@ > this.noProposal = false; > if(proposeType) { > char[] typeName = sourceType.sourceName(); >- createTypeProposal(sourceType, typeName, IAccessRule.K_ACCESSIBLE, typeName, relevance); >+ createTypeProposal( >+ sourceType, >+ typeName, >+ IAccessRule.K_ACCESSIBLE, >+ typeName, >+ relevance, >+ null, >+ null, >+ null, >+ false); > } > } > } >@@ -6901,7 +7112,11 @@ > true, > proposeAllMemberTypes, > null, >- typesFound); >+ typesFound, >+ null, >+ null, >+ null, >+ false); > } > } else { > if ((binding.kind() & Binding.TYPE) != 0) { >@@ -8627,10 +8842,19 @@ > /* > * Create a completion proposal for a member type. > */ >- private void createTypeProposal(ReferenceBinding refBinding, char[] typeName, int accessibility, char[] completionName, int relevance) { >+ private void createTypeProposal( >+ ReferenceBinding refBinding, >+ char[] typeName, >+ int accessibility, >+ char[] completionName, >+ int relevance, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > // Create standard type proposal >- if(!this.requestor.isIgnored(CompletionProposal.TYPE_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { >+ if(!this.isIgnored(CompletionProposal.TYPE_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { > CompletionProposal proposal = CompletionProposal.create(CompletionProposal.TYPE_REF, this.actualCompletionPosition - this.offset); > proposal.nameLookup = this.nameEnvironment.nameLookup; > proposal.completionEngine = this; >@@ -8638,6 +8862,18 @@ > proposal.setSignature(getSignature(refBinding)); > proposal.setPackageName(refBinding.qualifiedPackageName()); > proposal.setTypeName(typeName); >+ if (missingElements != null) { >+ CompletionProposal[] subProposals = new CompletionProposal[missingElements.length]; >+ for (int i = 0; i < missingElements.length; i++) { >+ subProposals[i] = >+ createRequiredTypeProposal( >+ missingElements[i], >+ missingElementsStarts[i], >+ missingElementsEnds[i], >+ relevance); >+ } >+ proposal.setRequiredProposals(subProposals); >+ } > proposal.setCompletion(completionName); > proposal.setFlags(refBinding.modifiers); > proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
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 44627
: 79896