### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model 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.4 diff -u -r1.4 CompletionWithMissingTypesTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 6 Mar 2007 04:43:19 -0000 1.4 +++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 21 Mar 2008 14:13:52 -0000 @@ -566,4 +566,74 @@ " MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}", requestor.getResults()); } +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=223479 +public void test0013() throws JavaModelException { + this.workingCopies = new ICompilationUnit[3]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test.java", + "package test;"+ + "public class Test {\n" + + " MissingType.Mem\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 = "MissingType.Mem"; + 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; + int start1 = str.lastIndexOf("Mem") + "".length(); + int end1 = start1 + "Mem".length(); + int start2 = str.indexOf("MissingType"); + int end2 = start2 + "MissingType".length(); + assertResults( + "MissingType.Member[TYPE_REF]{Member, missing, Lmissing.MissingType$Member;, 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=223479 +public void test0014() throws JavaModelException { + this.workingCopies = new ICompilationUnit[3]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test.java", + "package test;"+ + "public class Test {\n" + + " {\n" + + " MissingType.Mem\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 = "MissingType.Mem"; + 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; + int start1 = str.lastIndexOf("Mem") + "".length(); + int end1 = start1 + "Mem".length(); + int start2 = str.indexOf("MissingType"); + int end2 = start2 + "MissingType".length(); + assertResults( + "MissingType.Member[TYPE_REF]{Member, missing, Lmissing.MissingType$Member;, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + + " MissingType[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", + requestor.getResults()); +} } #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.356 diff -u -r1.356 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 Mar 2008 11:52:09 -0000 1.356 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 Mar 2008 14:13:55 -0000 @@ -1633,28 +1633,40 @@ long completionPosition = ref.sourcePositions[ref.tokens.length]; setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition); - ObjectVector typesFound = new ObjectVector(); - if (this.assistNodeIsException && astNodeParent instanceof TryStatement) { - findExceptionFromTryStatement( - this.completionToken, - (ReferenceBinding)qualifiedBinding, - scope.enclosingSourceType(), - (BlockScope)scope, - typesFound); + if (qualifiedBinding.problemId() == ProblemReasons.NotFound) { + if (this.assistNodeInJavadoc == 0 && + (this.requestor.isAllowingRequiredProposals(CompletionProposal.TYPE_REF, CompletionProposal.TYPE_REF))) { + if(ref.tokens.length == 1) { + findMemberTypesFromMissingType( + ref.tokens[0], + ref.sourcePositions[0], + scope); + } + } + } else { + ObjectVector typesFound = new ObjectVector(); + if (this.assistNodeIsException && astNodeParent instanceof TryStatement) { + findExceptionFromTryStatement( + this.completionToken, + (ReferenceBinding)qualifiedBinding, + scope.enclosingSourceType(), + (BlockScope)scope, + typesFound); + } + + findMemberTypes( + this.completionToken, + (ReferenceBinding) qualifiedBinding, + scope, + scope.enclosingSourceType(), + false, + false, + typesFound, + null, + null, + null, + false); } - - findMemberTypes( - this.completionToken, - (ReferenceBinding) qualifiedBinding, - scope, - scope.enclosingSourceType(), - false, - false, - typesFound, - null, - null, - null, - false); } } else if (astNode instanceof CompletionOnMarkerAnnotationName) { CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;