Lines 2265-2271
Link Here
|
2265 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
2265 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
2266 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
2266 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
2267 |
|
2267 |
|
2268 |
int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; |
2268 |
int relevance1 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; |
|
|
2269 |
int relevance2 = R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; |
2269 |
int start1 = str.lastIndexOf("equal") + "".length(); |
2270 |
int start1 = str.lastIndexOf("equal") + "".length(); |
2270 |
int end1 = start1 + "equal".length(); |
2271 |
int end1 = start1 + "equal".length(); |
2271 |
int start2 = str.lastIndexOf("a.equal"); |
2272 |
int start2 = str.lastIndexOf("a.equal"); |
Lines 2273-2280
Link Here
|
2273 |
int start3 = str.lastIndexOf("a."); |
2274 |
int start3 = str.lastIndexOf("a."); |
2274 |
int end3 = start3 + "a".length(); |
2275 |
int end3 = start3 + "a".length(); |
2275 |
assertResults( |
2276 |
assertResults( |
2276 |
"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), replace["+start1+", "+end1+"], token["+start1+", "+end1+"], " + (relevance1) + "}\n" + |
2277 |
"equalsFoo[METHOD_REF_WITH_CASTED_RECEIVER]{((CompletionAfterInstanceOf)a).equalsFoo(), Ltest.CompletionAfterInstanceOf;, ()V, Ltest.CompletionAfterInstanceOf;, equalsFoo, null, replace["+start2+", "+end2+"], token["+start1+", "+end1+"], receiver["+start3+", "+end3+"], " + (relevance2) + "}\n" + |
2277 |
"equalsFoo[METHOD_REF_WITH_CASTED_RECEIVER]{((CompletionAfterInstanceOf)a).equalsFoo(), Ltest.CompletionAfterInstanceOf;, ()V, Ltest.CompletionAfterInstanceOf;, equalsFoo, null, replace["+start2+", "+end2+"], token["+start1+", "+end1+"], receiver["+start3+", "+end3+"], " + (relevance1) + "}", |
2278 |
"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, equals, (obj), replace["+start1+", "+end1+"], token["+start1+", "+end1+"], " + (relevance1) + "}", |
2278 |
requestor.getResults()); |
2279 |
requestor.getResults()); |
2279 |
} |
2280 |
} |
2280 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193909 |
2281 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=193909 |
Lines 8120-8126
Link Here
|
8120 |
cu.codeComplete(cursorLocation, requestor); |
8121 |
cu.codeComplete(cursorLocation, requestor); |
8121 |
|
8122 |
|
8122 |
assertEquals( |
8123 |
assertEquals( |
8123 |
"element:false completion:false relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
8124 |
"element:false completion:false relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
8124 |
requestor.getResults()); |
8125 |
requestor.getResults()); |
8125 |
} |
8126 |
} |
8126 |
public void testCompletionKeywordFalse3() throws JavaModelException { |
8127 |
public void testCompletionKeywordFalse3() throws JavaModelException { |
Lines 8146-8152
Link Here
|
8146 |
cu.codeComplete(cursorLocation, requestor); |
8147 |
cu.codeComplete(cursorLocation, requestor); |
8147 |
|
8148 |
|
8148 |
assertEquals( |
8149 |
assertEquals( |
8149 |
"element:false completion:false relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
8150 |
"element:false completion:false relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
8150 |
requestor.getResults()); |
8151 |
requestor.getResults()); |
8151 |
} |
8152 |
} |
8152 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95008 |
8153 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=95008 |
Lines 11585-11591
Link Here
|
11585 |
cu.codeComplete(cursorLocation, requestor); |
11586 |
cu.codeComplete(cursorLocation, requestor); |
11586 |
|
11587 |
|
11587 |
assertEquals( |
11588 |
assertEquals( |
11588 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11589 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11589 |
requestor.getResults()); |
11590 |
requestor.getResults()); |
11590 |
} |
11591 |
} |
11591 |
public void testCompletionKeywordTrue3() throws JavaModelException { |
11592 |
public void testCompletionKeywordTrue3() throws JavaModelException { |
Lines 11611-11617
Link Here
|
11611 |
cu.codeComplete(cursorLocation, requestor); |
11612 |
cu.codeComplete(cursorLocation, requestor); |
11612 |
|
11613 |
|
11613 |
assertEquals( |
11614 |
assertEquals( |
11614 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11615 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11615 |
requestor.getResults()); |
11616 |
requestor.getResults()); |
11616 |
} |
11617 |
} |
11617 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615 |
11618 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=90615 |
Lines 11718-11724
Link Here
|
11718 |
cu.codeComplete(cursorLocation, requestor); |
11719 |
cu.codeComplete(cursorLocation, requestor); |
11719 |
|
11720 |
|
11720 |
assertEquals( |
11721 |
assertEquals( |
11721 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11722 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11722 |
requestor.getResults()); |
11723 |
requestor.getResults()); |
11723 |
} |
11724 |
} |
11724 |
public void testCompletionKeywordTry3() throws JavaModelException { |
11725 |
public void testCompletionKeywordTry3() throws JavaModelException { |
Lines 11757-11763
Link Here
|
11757 |
cu.codeComplete(cursorLocation, requestor); |
11758 |
cu.codeComplete(cursorLocation, requestor); |
11758 |
|
11759 |
|
11759 |
assertEquals( |
11760 |
assertEquals( |
11760 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11761 |
"element:true completion:true relevance:"+(R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED), |
11761 |
requestor.getResults()); |
11762 |
requestor.getResults()); |
11762 |
} |
11763 |
} |
11763 |
public void testCompletionKeywordTry6() throws JavaModelException { |
11764 |
public void testCompletionKeywordTry6() throws JavaModelException { |
Lines 18826-18833
Link Here
|
18826 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
18827 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
18827 |
|
18828 |
|
18828 |
assertResults( |
18829 |
assertResults( |
18829 |
"zzzz1[LOCAL_VARIABLE_REF]{zzzz1, null, Z, zzzz1, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_RESOLVED + R_NON_RESTRICTED) + "}\n" + |
18830 |
"zzzz1[LOCAL_VARIABLE_REF]{zzzz1, null, Z, zzzz1, null, " + (R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_RESOLVED + R_NON_RESTRICTED) + "}\n" + |
18830 |
"zzzz2[LOCAL_VARIABLE_REF]{zzzz2, null, Z, zzzz2, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_RESOLVED + R_NON_RESTRICTED) + "}", |
18831 |
"zzzz2[LOCAL_VARIABLE_REF]{zzzz2, null, Z, zzzz2, null, " + (R_DEFAULT + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_RESOLVED + R_NON_RESTRICTED) + "}", |
18831 |
requestor.getResults()); |
18832 |
requestor.getResults()); |
18832 |
} |
18833 |
} |
18833 |
public void testParameterNames1() throws CoreException, IOException { |
18834 |
public void testParameterNames1() throws CoreException, IOException { |
Lines 19874-19877
Link Here
|
19874 |
requestor.getResults()); |
19875 |
requestor.getResults()); |
19875 |
} |
19876 |
} |
19876 |
|
19877 |
|
|
|
19878 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=253008, prefer boolean proposal inside if(), while() etc |
19879 |
public void test253008() throws JavaModelException { |
19880 |
this.workingCopies = new ICompilationUnit[1]; |
19881 |
this.workingCopies[0] = getWorkingCopy( |
19882 |
"/Completion/src/test/Test269493.java", |
19883 |
"package test;" + |
19884 |
"public class Test253008 {\n" + |
19885 |
" boolean methodReturningBoolean() { return true; }\n" + |
19886 |
" void methodReturningBlah() { return; }\n" + |
19887 |
" int foo(int p) {\n" + |
19888 |
" if (methodR) {\n" + |
19889 |
" return 0;\n" + |
19890 |
" }\n" + |
19891 |
" }\n" + |
19892 |
"}\n"); |
19893 |
|
19894 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19895 |
String str = this.workingCopies[0].getSource(); |
19896 |
String completeBehind = "methodR"; |
19897 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19898 |
|
19899 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19900 |
assertResults( |
19901 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
19902 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
19903 |
requestor.getResults()); |
19904 |
} |
19905 |
|
19906 |
public void test253008b() throws JavaModelException { |
19907 |
this.workingCopies = new ICompilationUnit[1]; |
19908 |
this.workingCopies[0] = getWorkingCopy( |
19909 |
"/Completion/src/test/Test269493.java", |
19910 |
"package test;" + |
19911 |
"public class Test253008 {\n" + |
19912 |
" boolean methodReturningBoolean() { return true; }\n" + |
19913 |
" void methodReturningBlah() { return; }\n" + |
19914 |
" int foo(int p) {\n" + |
19915 |
" while (methodR) {\n" + |
19916 |
" return 0;\n" + |
19917 |
" }\n" + |
19918 |
" }\n" + |
19919 |
"}\n"); |
19920 |
|
19921 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19922 |
String str = this.workingCopies[0].getSource(); |
19923 |
String completeBehind = "methodR"; |
19924 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19925 |
|
19926 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19927 |
assertResults( |
19928 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
19929 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
19930 |
requestor.getResults()); |
19931 |
} |
19932 |
|
19933 |
public void test253008c() throws JavaModelException { |
19934 |
this.workingCopies = new ICompilationUnit[1]; |
19935 |
this.workingCopies[0] = getWorkingCopy( |
19936 |
"/Completion/src/test/Test269493.java", |
19937 |
"package test;" + |
19938 |
"public class Test253008 {\n" + |
19939 |
" boolean methodReturningBoolean() { return true; }\n" + |
19940 |
" void methodReturningBlah() { return; }\n" + |
19941 |
" int foo(int p) {\n" + |
19942 |
" do { \n" + |
19943 |
" } while (methodR);\n" + |
19944 |
" }\n" + |
19945 |
"}\n"); |
19946 |
|
19947 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19948 |
String str = this.workingCopies[0].getSource(); |
19949 |
String completeBehind = "methodR"; |
19950 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19951 |
|
19952 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19953 |
assertResults( |
19954 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
19955 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
19956 |
requestor.getResults()); |
19957 |
} |
19958 |
|
19959 |
public void test253008d() throws JavaModelException { |
19960 |
this.workingCopies = new ICompilationUnit[1]; |
19961 |
this.workingCopies[0] = getWorkingCopy( |
19962 |
"/Completion/src/test/Test269493.java", |
19963 |
"package test;" + |
19964 |
"public class Test253008 {\n" + |
19965 |
" boolean methodReturningBoolean() { return true; }\n" + |
19966 |
" void methodReturningBlah() { return; }\n" + |
19967 |
" int foo(int p) {\n" + |
19968 |
" for (int i = 0; methodR; i++) {\n" + |
19969 |
" }\n" + |
19970 |
" }\n" + |
19971 |
"}\n"); |
19972 |
|
19973 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
19974 |
String str = this.workingCopies[0].getSource(); |
19975 |
String completeBehind = "methodR"; |
19976 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
19977 |
|
19978 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
19979 |
assertResults( |
19980 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
19981 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
19982 |
requestor.getResults()); |
19983 |
} |
19984 |
|
19985 |
public void test253008e() throws JavaModelException { |
19986 |
this.workingCopies = new ICompilationUnit[1]; |
19987 |
this.workingCopies[0] = getWorkingCopy( |
19988 |
"/Completion/src/test/Test269493.java", |
19989 |
"package test;" + |
19990 |
"public class Test253008 {\n" + |
19991 |
" boolean methodReturningBoolean() { return true; }\n" + |
19992 |
" void methodReturningBlah() { return; }\n" + |
19993 |
" int foo(int p) {\n" + |
19994 |
" for (methodR; true;) {\n" + |
19995 |
" }\n" + |
19996 |
" }\n" + |
19997 |
"}\n"); |
19998 |
|
19999 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20000 |
String str = this.workingCopies[0].getSource(); |
20001 |
String completeBehind = "methodR"; |
20002 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20003 |
|
20004 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20005 |
assertResults( |
20006 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
20007 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
20008 |
requestor.getResults()); |
20009 |
} |
20010 |
|
20011 |
public void test253008f() throws JavaModelException { |
20012 |
this.workingCopies = new ICompilationUnit[1]; |
20013 |
this.workingCopies[0] = getWorkingCopy( |
20014 |
"/Completion/src/test/Test269493.java", |
20015 |
"package test;" + |
20016 |
"public class Test253008 {\n" + |
20017 |
" boolean methodReturningBoolean() { return true; }\n" + |
20018 |
" void methodReturningBlah() { return; }\n" + |
20019 |
" int foo(int p) {\n" + |
20020 |
" for (int i = 0; true; methodR) {\n" + |
20021 |
" }\n" + |
20022 |
" }\n" + |
20023 |
"}\n"); |
20024 |
|
20025 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20026 |
String str = this.workingCopies[0].getSource(); |
20027 |
String completeBehind = "methodR"; |
20028 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20029 |
|
20030 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20031 |
assertResults( |
20032 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
20033 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
20034 |
requestor.getResults()); |
20035 |
} |
20036 |
|
20037 |
public void _test253008g() throws JavaModelException { |
20038 |
this.workingCopies = new ICompilationUnit[1]; |
20039 |
this.workingCopies[0] = getWorkingCopy( |
20040 |
"/Completion/src/test/Test269493.java", |
20041 |
"package test;" + |
20042 |
"import java.lang.Boolean;\n" + |
20043 |
"public class Test253008 {\n" + |
20044 |
" boolean methodReturningboolean() { return true; }\n" + |
20045 |
" Boolean methodReturningBoolean() { return true; }\n" + |
20046 |
" void methodReturningBlah() { return; }\n" + |
20047 |
" int foo(int p) {\n" + |
20048 |
" for (int i = 0; methodR; i++) {\n" + |
20049 |
" }\n" + |
20050 |
" }\n" + |
20051 |
"}\n"); |
20052 |
|
20053 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); |
20054 |
String str = this.workingCopies[0].getSource(); |
20055 |
String completeBehind = "methodR"; |
20056 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
20057 |
|
20058 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
20059 |
assertResults( |
20060 |
"methodReturningBlah[METHOD_REF]{methodReturningBlah(), Ltest.Test253008;, ()V, methodReturningBlah, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" + |
20061 |
"methodReturningBoolean[METHOD_REF]{methodReturningBoolean(), Ltest.Test253008;, ()Z, methodReturningBoolean, " + (R_DEFAULT + R_RESOLVED + R_EXACT_EXPECTED_TYPE + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", |
20062 |
requestor.getResults()); |
20063 |
} |
20064 |
|
20065 |
|
19877 |
} |
20066 |
} |