Lines 21303-21308
Link Here
|
21303 |
requestor.getResults()); |
21303 |
requestor.getResults()); |
21304 |
} |
21304 |
} |
21305 |
|
21305 |
|
|
|
21306 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310747 |
21307 |
// To verify that we get correctly sorted proposals inside an array initializers |
21308 |
// and we dont get comment strings as proposals |
21309 |
public void testBug310747() throws JavaModelException { |
21310 |
this.workingCopies = new ICompilationUnit[1]; |
21311 |
this.workingCopies[0] = getWorkingCopy( |
21312 |
"/Completion/src/test/X.java", |
21313 |
"package test;" + |
21314 |
"class X {\n" + |
21315 |
" public X memberGet() {\n" + |
21316 |
" return new X();\n" + |
21317 |
" }\n" + |
21318 |
" public X memberField;\n" + |
21319 |
" public X[] memberArray = {\n" + |
21320 |
" /**///completion here shouldnt give dubious proposals\n" + |
21321 |
" };\n" + |
21322 |
"}\n"); |
21323 |
|
21324 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, true, true, true, true, true); |
21325 |
requestor.allowAllRequiredProposals(); |
21326 |
String str = this.workingCopies[0].getSource(); |
21327 |
String completeBehind = "/**/"; |
21328 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
21329 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
21330 |
|
21331 |
int relevance1 = R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC + R_EXACT_EXPECTED_TYPE; |
21332 |
int relevance2 = R_RESOLVED + R_INTERESTING + R_CASE + R_NON_STATIC; |
21333 |
int relevance3 = R_RESOLVED + R_CASE + R_NON_STATIC; |
21334 |
int start1 = str.lastIndexOf("/**/") + "".length(); |
21335 |
int end1 = start1 + "/**/".length(); |
21336 |
assertResults( |
21337 |
"expectedTypesSignatures={Ltest.X;}\n" + |
21338 |
"expectedTypesKeys={Ltest/X;}", |
21339 |
requestor.getContext()); |
21340 |
assertResults( |
21341 |
"X[TYPE_REF]{X, test, Ltest.X;, null, null, null, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + |
21342 |
"memberField[FIELD_REF]{memberField, Ltest.X;, Ltest.X;, null, null, memberField, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + |
21343 |
"memberGet[METHOD_REF]{memberGet(), Ltest.X;, ()Ltest.X;, null, null, memberGet, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance1 + "}\n" + |
21344 |
"clone[METHOD_REF]{clone(), Ljava.lang.Object;, ()Ljava.lang.Object;, null, null, clone, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + |
21345 |
"equals[METHOD_REF]{equals(), Ljava.lang.Object;, (Ljava.lang.Object;)Z, null, null, equals, (obj), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + |
21346 |
"getClass[METHOD_REF]{getClass(), Ljava.lang.Object;, ()Ljava.lang.Class;, null, null, getClass, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + |
21347 |
"hashCode[METHOD_REF]{hashCode(), Ljava.lang.Object;, ()I, null, null, hashCode, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + |
21348 |
"toString[METHOD_REF]{toString(), Ljava.lang.Object;, ()Ljava.lang.String;, null, null, toString, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance2 + "}\n" + |
21349 |
"finalize[METHOD_REF]{finalize(), Ljava.lang.Object;, ()V, null, null, finalize, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + |
21350 |
"notify[METHOD_REF]{notify(), Ljava.lang.Object;, ()V, null, null, notify, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + |
21351 |
"notifyAll[METHOD_REF]{notifyAll(), Ljava.lang.Object;, ()V, null, null, notifyAll, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + |
21352 |
"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (JI)V, null, null, wait, (millis, nanos), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + |
21353 |
"wait[METHOD_REF]{wait(), Ljava.lang.Object;, (J)V, null, null, wait, (millis), replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}\n" + |
21354 |
"wait[METHOD_REF]{wait(), Ljava.lang.Object;, ()V, null, null, wait, null, replace[" + end1 + ", " + end1 + "], token[" + end1 + ", " + end1 +"], " + relevance3 + "}", |
21355 |
requestor.getReversedResults()); |
21356 |
} |
21357 |
|
21306 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534 |
21358 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534 |
21307 |
// To verify that autocast works correctly even when instanceof expression |
21359 |
// To verify that autocast works correctly even when instanceof expression |
21308 |
// and completion node are in the same binary expression, related by && |
21360 |
// and completion node are in the same binary expression, related by && |