Lines 20600-20603
Link Here
|
20600 |
requestor.getResults()); |
20600 |
requestor.getResults()); |
20601 |
} |
20601 |
} |
20602 |
|
20602 |
|
|
|
20603 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939 |
20604 |
public void testCompletionAfterInstanceof25_01() throws JavaModelException { |
20605 |
this.workingCopies = new ICompilationUnit[1]; |
20606 |
this.workingCopies[0] = getWorkingCopy( |
20607 |
"/Completion/src/test/CompletionAfterInstanceOf.java", |
20608 |
"package test;\n" + |
20609 |
"public class CompletionAfterInstanceOf {\n" + |
20610 |
" public int returnZero(){ return 0;}\n" + |
20611 |
" public Object a;\n" + |
20612 |
" void bar(){\n" + |
20613 |
" if (this.a instanceof CompletionAfterInstanceOf) {\n" + |
20614 |
" int j = 0;\n" + |
20615 |
" int k = 2;\n" + |
20616 |
" int i = this.a.r\n" + |
20617 |
" int p = 12;\n" + |
20618 |
" }\n" + |
20619 |
"}\n"); |
20620 |
|
20621 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, true, true, true); |
20622 |
requestor.allowAllRequiredProposals(); |
20623 |
String str = this.workingCopies[0].getSource(); |
20624 |
String completeBehind = "this.a.r"; |
20625 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20626 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20627 |
|
20628 |
int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; |
20629 |
int start1 = str.lastIndexOf("r") + "r".length(); |
20630 |
int end1 = start1 + "r".length(); |
20631 |
int start2 = str.lastIndexOf("this.a.r"); |
20632 |
int end2 = start2 + "this.a.r".length(); |
20633 |
int start3 = str.lastIndexOf("this.a."); |
20634 |
int end3 = start3 + "this.a".length(); |
20635 |
assertResults( |
20636 |
"returnZero[METHOD_REF_WITH_CASTED_RECEIVER]{((CompletionAfterInstanceOf)this.a).returnZero(), Ltest.CompletionAfterInstanceOf;, I, Ltest.CompletionAfterInstanceOf;, returnZero, null, replace["+start2+", "+end2+"], token["+start1+", "+end1+"], receiver["+start3+", "+end3+"], " + (relevance1) + "}", |
20637 |
requestor.getResults()); |
20638 |
} |
20639 |
|
20640 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939 |
20641 |
public void testCompletionAfterInstanceof25_02() throws JavaModelException { |
20642 |
this.workingCopies = new ICompilationUnit[1]; |
20643 |
this.workingCopies[0] = getWorkingCopy( |
20644 |
"/Completion/src/test/CompletionAfterInstanceOf.java", |
20645 |
"package test;\n" + |
20646 |
"public class CompletionAfterInstanceOf {\n" + |
20647 |
" public int returnZero(){ return 0;}\n" + |
20648 |
" public Object a;\n" + |
20649 |
" void bar(){\n" + |
20650 |
" int i;\n" + |
20651 |
" if (this.a instanceof CompletionAfterInstanceOf) {\n" + |
20652 |
" i = this.a.r\n" + |
20653 |
" }\n" + |
20654 |
"}\n"); |
20655 |
|
20656 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, true, true, true); |
20657 |
requestor.allowAllRequiredProposals(); |
20658 |
String str = this.workingCopies[0].getSource(); |
20659 |
String completeBehind = "this.a.r"; |
20660 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20661 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20662 |
|
20663 |
int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; |
20664 |
int start1 = str.lastIndexOf("r") + "r".length(); |
20665 |
int end1 = start1 + "r".length(); |
20666 |
int start2 = str.lastIndexOf("this.a.r"); |
20667 |
int end2 = start2 + "this.a.r".length(); |
20668 |
int start3 = str.lastIndexOf("this.a."); |
20669 |
int end3 = start3 + "this.a".length(); |
20670 |
assertResults( |
20671 |
"returnZero[METHOD_REF_WITH_CASTED_RECEIVER]{((CompletionAfterInstanceOf)this.a).returnZero(), Ltest.CompletionAfterInstanceOf;, I, Ltest.CompletionAfterInstanceOf;, returnZero, null, replace["+start2+", "+end2+"], token["+start1+", "+end1+"], receiver["+start3+", "+end3+"], " + (relevance1) + "}", |
20672 |
requestor.getResults()); |
20673 |
} |
20674 |
|
20603 |
} |
20675 |
} |