View | Details | Raw Unified | Return to bug 223495
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java (+70 lines)
Lines 566-569 Link Here
566
			"   MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}",
566
			"   MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}",
567
			requestor.getResults());
567
			requestor.getResults());
568
}
568
}
569
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=223479
570
public void test0013() throws JavaModelException {
571
	this.workingCopies = new ICompilationUnit[3];
572
	this.workingCopies[0] = getWorkingCopy(
573
		"/Completion/src/test/Test.java",
574
		"package test;"+
575
		"public class Test {\n" + 
576
		"  MissingType<Object>.Mem\n" + 
577
		"}\n");
578
	
579
	this.workingCopies[1] = getWorkingCopy(
580
		"/Completion/src/missing/MissingType.java",
581
		"package missing;"+
582
		"public class MissingType<T> {\n" + 
583
		"  public class Member {}\n" + 
584
		"}\n");
585
586
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true);
587
	requestor.allowAllRequiredProposals();
588
	String str = this.workingCopies[0].getSource();
589
	String completeBehind = "MissingType<Object>.Mem";
590
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
591
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
592
593
	int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED;
594
	int start1 = str.lastIndexOf("Mem") + "".length();
595
	int end1 = start1 + "Mem".length();
596
	int start2 = str.indexOf("MissingType");
597
	int end2 = start2 + "MissingType".length();
598
	assertResults(
599
			"MissingType.Member[TYPE_REF]{Member, missing, Lmissing.MissingType$Member;, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" +
600
			"   MissingType<T>[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType<TT;>;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}",
601
			requestor.getResults());
602
}
603
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=223479
604
public void test0014() throws JavaModelException {
605
	this.workingCopies = new ICompilationUnit[3];
606
	this.workingCopies[0] = getWorkingCopy(
607
		"/Completion/src/test/Test.java",
608
		"package test;"+
609
		"public class Test {\n" + 
610
		"  {\n" + 
611
		"    MissingType<Object>.Mem\n" + 
612
		"  }\n" + 
613
		"}\n");
614
	
615
	this.workingCopies[1] = getWorkingCopy(
616
		"/Completion/src/missing/MissingType.java",
617
		"package missing;"+
618
		"public class MissingType<T> {\n" + 
619
		"  public class Member {}\n" + 
620
		"}\n");
621
622
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true);
623
	requestor.allowAllRequiredProposals();
624
	String str = this.workingCopies[0].getSource();
625
	String completeBehind = "MissingType<Object>.Mem";
626
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
627
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
628
629
	int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED;
630
	int start1 = str.lastIndexOf("Mem") + "".length();
631
	int end1 = start1 + "Mem".length();
632
	int start2 = str.indexOf("MissingType");
633
	int end2 = start2 + "MissingType".length();
634
	assertResults(
635
			"MissingType.Member[TYPE_REF]{Member, missing, Lmissing.MissingType$Member;, null, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" +
636
			"   MissingType<T>[TYPE_REF]{missing.MissingType, missing, Lmissing.MissingType<TT;>;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}",
637
			requestor.getResults());
638
}
569
}
639
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-21 / +33 lines)
Lines 1633-1660 Link Here
1633
				long completionPosition = ref.sourcePositions[ref.tokens.length];
1633
				long completionPosition = ref.sourcePositions[ref.tokens.length];
1634
				setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
1634
				setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition);
1635
				
1635
				
1636
				ObjectVector typesFound = new ObjectVector();
1636
				if (qualifiedBinding.problemId() == ProblemReasons.NotFound) {
1637
				if (this.assistNodeIsException && astNodeParent instanceof TryStatement) {
1637
					if (this.assistNodeInJavadoc == 0 &&
1638
					findExceptionFromTryStatement(
1638
							(this.requestor.isAllowingRequiredProposals(CompletionProposal.TYPE_REF, CompletionProposal.TYPE_REF))) {
1639
							this.completionToken,
1639
						if(ref.tokens.length == 1) {
1640
							(ReferenceBinding)qualifiedBinding,
1640
							findMemberTypesFromMissingType(
1641
							scope.enclosingSourceType(),
1641
									ref.tokens[0],
1642
							(BlockScope)scope,
1642
									ref.sourcePositions[0],
1643
							typesFound);
1643
									scope);
1644
						}
1645
					}
1646
				} else {
1647
					ObjectVector typesFound = new ObjectVector();
1648
					if (this.assistNodeIsException && astNodeParent instanceof TryStatement) {
1649
						findExceptionFromTryStatement(
1650
								this.completionToken,
1651
								(ReferenceBinding)qualifiedBinding,
1652
								scope.enclosingSourceType(),
1653
								(BlockScope)scope,
1654
								typesFound);
1655
					}
1656
					
1657
					findMemberTypes(
1658
						this.completionToken,
1659
						(ReferenceBinding) qualifiedBinding,
1660
						scope,
1661
						scope.enclosingSourceType(),
1662
						false,
1663
						false,
1664
						typesFound,
1665
						null,
1666
						null,
1667
						null,
1668
						false);
1644
				}
1669
				}
1645
				
1646
				findMemberTypes(
1647
					this.completionToken,
1648
					(ReferenceBinding) qualifiedBinding,
1649
					scope,
1650
					scope.enclosingSourceType(),
1651
					false,
1652
					false,
1653
					typesFound,
1654
					null,
1655
					null,
1656
					null,
1657
					false);
1658
			}
1670
			}
1659
		} else if (astNode instanceof CompletionOnMarkerAnnotationName) {
1671
		} else if (astNode instanceof CompletionOnMarkerAnnotationName) {
1660
			CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;
1672
			CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;

Return to bug 223495