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 122270 Details for
Bug 260717
[assist] Constructors should be proposed even when the declaring type is not imported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug260717_003.txt (text/plain), 24.61 KB, created by
David Audel
on 2009-01-12 10:10:45 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-01-12 10:10:45 EST
Size:
24.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.46 >diff -u -r1.46 CompletionProposal.java >--- model/org/eclipse/jdt/core/CompletionProposal.java 18 Sep 2008 14:06:39 -0000 1.46 >+++ model/org/eclipse/jdt/core/CompletionProposal.java 12 Jan 2009 15:07:33 -0000 >@@ -1463,6 +1463,11 @@ > * <li><code>TYPE_REF</code></li> > * </ul> > * </li> >+ * <li><code>ANONYMOUS_CLASS_DECLARATION</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.383 >diff -u -r1.383 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 8 Jan 2009 20:51:06 -0000 1.383 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 Jan 2009 15:07:32 -0000 >@@ -1540,6 +1540,10 @@ > argTypes, > scope, > constructorCall, >+ false, >+ null, >+ null, >+ null, > false); > } > } >@@ -1618,7 +1622,7 @@ > > ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; > if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && ref.isClass()) { >- findConstructors(ref, argTypes, scope, allocExpression, false); >+ findConstructors(ref, argTypes, scope, allocExpression, false, null, null, null, false); > } > } > //TODO >@@ -1690,7 +1694,7 @@ > if (this.completionToken == null > || CharOperation.prefixEquals(this.completionToken, refBinding.sourceName) > || (this.options.camelCaseMatch && CharOperation.camelCaseMatch(this.completionToken, refBinding.sourceName))) { >- findConstructors(refBinding, null, scope, fieldRef, false); >+ findConstructors(refBinding, null, scope, fieldRef, false, null, null, null, false); > } > } > } >@@ -2277,27 +2281,44 @@ > TypeBinding[] argTypes = computeTypes(allocExpression.arguments); > > ReferenceBinding ref = (ReferenceBinding) qualifiedBinding; >- if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) >- && ref.isClass() >- && !ref.isAbstract()) { >- findConstructors( >+ >+ if (ref.problemId() == ProblemReasons.NotFound) { >+ findConstructorsFromMissingType( >+ allocExpression.type, >+ argTypes, >+ scope, >+ allocExpression); >+ } else { >+ if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) >+ && ref.isClass() >+ && !ref.isAbstract()) { >+ findConstructors( >+ ref, >+ argTypes, >+ scope, >+ allocExpression, >+ false, >+ null, >+ null, >+ null, >+ false); >+ } >+ >+ checkCancel(); >+ >+ if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION) >+ && !ref.isFinal() >+ && !ref.isEnum()){ >+ findAnonymousType( > ref, > argTypes, > scope, > allocExpression, >+ null, >+ null, >+ null, > false); >- } >- >- checkCancel(); >- >- if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION) >- && !ref.isFinal() >- && !ref.isEnum()){ >- findAnonymousType( >- ref, >- argTypes, >- scope, >- allocExpression); >+ } > } > } > >@@ -3942,11 +3963,15 @@ > } > } > } >- private void findAnonymousType( >+ void findAnonymousType( > ReferenceBinding currentType, > TypeBinding[] argTypes, > Scope scope, >- InvocationSite invocationSite) { >+ InvocationSite invocationSite, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > if (currentType.isInterface()) { > char[] completion = CharOperation.NO_CHAR; >@@ -3954,9 +3979,13 @@ > relevance += computeRelevanceForResolution(); > relevance += computeRelevanceForInterestingProposal(); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); >+ >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > this.noProposal = false; >- if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) { >+ if(!isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null)) { > InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setDeclarationKey(currentType.computeUniqueKey()); >@@ -3974,6 +4003,18 @@ > //proposal.setParameterTypeNames(null); > //proposal.setPackageName(null); > //proposal.setTypeName(null); >+ 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(completion); > proposal.setFlags(Flags.AccPublic); > proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); >@@ -3990,7 +4031,11 @@ > argTypes, > scope, > invocationSite, >- true); >+ true, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > } > private void findClassField( >@@ -4069,12 +4114,16 @@ > } > } > } >- private void findConstructors( >+ void findConstructors( > ReferenceBinding currentType, > TypeBinding[] argTypes, > Scope scope, > InvocationSite invocationSite, >- boolean forAnonymousType) { >+ boolean forAnonymousType, >+ Binding[] missingElements, >+ int[] missingElementsStarts, >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > // No visibility checks can be performed without the scope & invocationSite > MethodBinding[] methods = currentType.availableMethods(); >@@ -4122,9 +4171,13 @@ > relevance += computeRelevanceForResolution(); > relevance += computeRelevanceForInterestingProposal(); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); >+ >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > this.noProposal = false; >- if(!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)) { >+ if(!this.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null)) { > InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setDeclarationKey(currentType.computeUniqueKey()); >@@ -4140,6 +4193,18 @@ > proposal.setParameterTypeNames(parameterTypeNames); > //proposal.setPackageName(null); > //proposal.setTypeName(null); >+ 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(completion); > proposal.setFlags(constructor.modifiers); > proposal.setReplaceRange(this.endPosition - this.offset, this.endPosition - this.offset); >@@ -4156,6 +4221,10 @@ > relevance += computeRelevanceForResolution(); > relevance += computeRelevanceForInterestingProposal(); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); >+ >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > // Special case for completion in javadoc > if (this.assistNodeInJavadoc > 0) { >@@ -4212,7 +4281,7 @@ > > // Create standard proposal > this.noProposal = false; >- if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { >+ if(!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { > InternalCompletionProposal proposal = createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(getSignature(currentType)); > proposal.setSignature(getSignature(constructor)); >@@ -4227,6 +4296,18 @@ > //proposal.setPackageName(null); > //proposal.setTypeName(null); > proposal.setName(currentType.sourceName()); >+ 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.setIsContructor(true); > proposal.setCompletion(completion); > proposal.setFlags(constructor.modifiers); >@@ -5925,6 +6006,58 @@ > }; > missingTypesConverter.guess(typeRef, scope, substitutionRequestor); > } >+ >+ private void findConstructorsFromMissingType( >+ TypeReference typeRef, >+ final TypeBinding[] argTypes, >+ final Scope scope, >+ final InvocationSite invocationSite) { >+ 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) { >+ ReferenceBinding ref = (ReferenceBinding) guessedType; >+ if (!isIgnored(CompletionProposal.METHOD_REF, missingElements != null) >+ && ref.isClass() >+ && !ref.isAbstract()) { >+ findConstructors( >+ ref, >+ argTypes, >+ scope, >+ invocationSite, >+ false, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ hasProblems); >+ } >+ >+ checkCancel(); >+ >+ if (!isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION, missingElements != null) >+ && !ref.isFinal() >+ && !ref.isEnum()){ >+ findAnonymousType( >+ ref, >+ argTypes, >+ scope, >+ invocationSite, >+ missingElements, >+ missingElementsStarts, >+ missingElementsEnds, >+ hasProblems); >+ } >+ } >+ } >+ }; >+ missingTypesConverter.guess(typeRef, scope, substitutionRequestor); >+ } > > private void findFieldsAndMethodsFromStaticImports( > char[] token, >@@ -10275,7 +10408,7 @@ > private boolean isIgnored(int kind) { > return this.requestor.isIgnored(kind); > } >- private boolean isIgnored(int kind, boolean missingTypes) { >+ boolean isIgnored(int kind, boolean missingTypes) { > return this.requestor.isIgnored(kind) || > (missingTypes && !this.requestor.isAllowingRequiredProposals(kind, CompletionProposal.TYPE_REF)); > } >#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.11 >diff -u -r1.11 CompletionWithMissingTypesTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 9 Sep 2008 12:43:37 -0000 1.11 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 12 Jan 2009 15:07:34 -0000 >@@ -1667,4 +1667,209 @@ > " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=260717 >+public void test0041() 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" + >+ " new MissingType(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new MissingType("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("new MissingType(") + "new MissingType(".length(); >+ int end1 = start1 + "".length(); >+ int start2 = str.indexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "MissingType[ANONYMOUS_CLASS_DECLARATION]{, Lmissing.MissingType;, ()V, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "MissingType[METHOD_REF<CONSTRUCTOR>]{, Lmissing.MissingType;, ()V, MissingType, 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=260717 >+public void test0042() 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" + >+ " new MissingType.Member(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public static class Member {}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new MissingType.Member("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("new MissingType.Member(") + "new MissingType.Member(".length(); >+ int end1 = start1 + "".length(); >+ int start2 = str.indexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "Member[METHOD_REF<CONSTRUCTOR>]{, Lmissing.MissingType$Member;, ()V, Member, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "MissingType.Member[ANONYMOUS_CLASS_DECLARATION]{, Lmissing.MissingType$Member;, ()V, 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=260717 >+public void test0043() 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" + >+ " this.new MissingType(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new MissingType("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=260717 >+public void test0044() 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 m = null;\n" + >+ " m.new Member(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public class Member {}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new Member("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=260717 >+public void test0045() 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" + >+ " new MissingType(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public interface MissingType {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new MissingType("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("new MissingType(") + "new MissingType(".length(); >+ int end1 = start1 + "".length(); >+ int start2 = str.indexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "MissingType[ANONYMOUS_CLASS_DECLARATION]{, Lmissing.MissingType;, ()V, 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=260717 >+public void test0046() 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" + >+ " new MissingType(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public abstract class MissingType {\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new MissingType("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("new MissingType(") + "new MissingType(".length(); >+ int end1 = start1 + "".length(); >+ int start2 = str.indexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "MissingType[ANONYMOUS_CLASS_DECLARATION]{, Lmissing.MissingType;, ()V, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} > } >Index: src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java,v >retrieving revision 1.9 >diff -u -r1.9 CompletionWithMissingTypesTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 9 Sep 2008 12:43:37 -0000 1.9 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 12 Jan 2009 15:07:35 -0000 >@@ -636,4 +636,42 @@ > " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=260717 >+public void test0015() 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" + >+ " new <String>MissingType(\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing/MissingType.java", >+ "package missing;"+ >+ "public class MissingType {\n" + >+ " public <T> MissingType() {}\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "new <String>MissingType("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("new <String>MissingType(") + "new <String>MissingType(".length(); >+ int end1 = start1 + "".length(); >+ int start2 = str.indexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "MissingType[ANONYMOUS_CLASS_DECLARATION]{, Lmissing.MissingType;, <T:Ljava.lang.Object;>()V, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "MissingType[METHOD_REF<CONSTRUCTOR>]{, Lmissing.MissingType;, <T:Ljava.lang.Object;>()V, MissingType, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} > }
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 260717
: 122270