View | Details | Raw Unified | Return to bug 253008 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java (-1 / +2 lines)
Lines 162-168 Link Here
162
		"  }\n" +
162
		"  }\n" +
163
		"  void foo() {\n" +
163
		"  void foo() {\n" +
164
		"    Enumeration e;\n" +
164
		"    Enumeration e;\n" +
165
		"    <CompleteOnName:e.has>;\n" +
165
	    "    for (; <CompleteOnName:e.has>; ) \n" +
166
	    "      ;\n" + 
166
		"  }\n" +
167
		"  }\n" +
167
		"}\n",
168
		"}\n",
168
		// expectedCompletionIdentifier:
169
		// expectedCompletionIdentifier:
(-)src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java (-1 / +2 lines)
Lines 1118-1124 Link Here
1118
		"  }\n" +
1118
		"  }\n" +
1119
		"  void foo() {\n" +
1119
		"  void foo() {\n" +
1120
		"    int i;\n" +
1120
		"    int i;\n" +
1121
		"    <CompleteOnMemberAccess:fred().x>;\n" +
1121
		"    for (; <CompleteOnMemberAccess:fred().x>; ) \n" + 
1122
	    "      ;\n" +
1122
		"  }\n" +
1123
		"  }\n" +
1123
		"}\n",
1124
		"}\n",
1124
		// expectedCompletionIdentifier:
1125
		// expectedCompletionIdentifier:
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (+8 lines)
Lines 3608-3613 Link Here
3608
					switchStatement.expression.resolvedType != null) {
3608
					switchStatement.expression.resolvedType != null) {
3609
				addExpectedType(switchStatement.expression.resolvedType, scope);
3609
				addExpectedType(switchStatement.expression.resolvedType, scope);
3610
			}
3610
			}
3611
		// https://bugs.eclipse.org/bugs/show_bug.cgi?id=253008, flag boolean as the expected
3612
		// type if we are completing inside if(), for (; ;), while() and do while()
3613
		} else if (parent instanceof WhileStatement) {  // covers both while and do-while loops
3614
			addExpectedType(TypeBinding.BOOLEAN, scope);
3615
		} else if (parent instanceof IfStatement) {  
3616
			addExpectedType(TypeBinding.BOOLEAN, scope);
3617
		} else if (parent instanceof ForStatement) {   // astNodeParent set to ForStatement only for the condition  
3618
			addExpectedType(TypeBinding.BOOLEAN, scope);
3611
3619
3612
		// Expected types for javadoc
3620
		// Expected types for javadoc
3613
		} else if (parent instanceof Javadoc) {
3621
		} else if (parent instanceof Javadoc) {
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (+20 lines)
Lines 76-81 Link Here
76
	protected static final int K_MEMBER_VALUE_ARRAY_INITIALIZER = COMPLETION_PARSER + 37;
76
	protected static final int K_MEMBER_VALUE_ARRAY_INITIALIZER = COMPLETION_PARSER + 37;
77
	protected static final int K_CONTROL_STATEMENT_DELIMITER = COMPLETION_PARSER + 38;
77
	protected static final int K_CONTROL_STATEMENT_DELIMITER = COMPLETION_PARSER + 38;
78
	protected static final int K_INSIDE_ASSERT_EXCEPTION = COMPLETION_PARSER + 39;
78
	protected static final int K_INSIDE_ASSERT_EXCEPTION = COMPLETION_PARSER + 39;
79
	protected static final int K_INSIDE_FOR_CONDITIONAL = COMPLETION_PARSER + 40;
79
80
80
	public final static char[] FAKE_TYPE_NAME = new char[]{' '};
81
	public final static char[] FAKE_TYPE_NAME = new char[]{' '};
81
	public final static char[] FAKE_METHOD_NAME = new char[]{' '};
82
	public final static char[] FAKE_METHOD_NAME = new char[]{' '};
Lines 979-984 Link Here
979
				WhileStatement whileStatement = new WhileStatement(expression, new EmptyStatement(expression.sourceEnd, expression.sourceEnd), expression.sourceStart, expression.sourceEnd);
980
				WhileStatement whileStatement = new WhileStatement(expression, new EmptyStatement(expression.sourceEnd, expression.sourceEnd), expression.sourceStart, expression.sourceEnd);
980
				this.assistNodeParent = whileStatement;
981
				this.assistNodeParent = whileStatement;
981
				break nextElement;
982
				break nextElement;
983
			case K_INSIDE_FOR_CONDITIONAL: // https://bugs.eclipse.org/bugs/show_bug.cgi?id=253008
984
				ForStatement forStatement = new ForStatement(new Statement[0], expression, new Statement[0],
985
															 new EmptyStatement(expression.sourceEnd, expression.sourceEnd),
986
						                                     false,
987
						                                     expression.sourceStart, expression.sourceEnd);
988
				this.assistNodeParent = forStatement;
989
				break nextElement;
982
			case K_BETWEEN_SWITCH_AND_RIGHT_PAREN:
990
			case K_BETWEEN_SWITCH_AND_RIGHT_PAREN:
983
				SwitchStatement switchStatement = new SwitchStatement();
991
				SwitchStatement switchStatement = new SwitchStatement();
984
				switchStatement.expression = expression;
992
				switchStatement.expression = expression;
Lines 3479-3484 Link Here
3479
							popElement(K_INSIDE_CONTINUE_STATEMENT);
3487
							popElement(K_INSIDE_CONTINUE_STATEMENT);
3480
						}
3488
						}
3481
						break;
3489
						break;
3490
					case K_BETWEEN_FOR_AND_RIGHT_PAREN:
3491
						if(topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == this.bracketDepth - 1) {
3492
							popElement(K_BETWEEN_FOR_AND_RIGHT_PAREN);
3493
							pushOnElementStack(K_INSIDE_FOR_CONDITIONAL, this.bracketDepth - 1);
3494
						}
3495
						break;
3496
					case K_INSIDE_FOR_CONDITIONAL:
3497
						if(topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == this.bracketDepth - 1) {
3498
							popElement(K_INSIDE_FOR_CONDITIONAL);
3499
							pushOnElementStack(K_BETWEEN_FOR_AND_RIGHT_PAREN, this.bracketDepth - 1);
3500
						}
3501
						break;
3482
				}
3502
				}
3483
				break;
3503
				break;
3484
			case TokenNamereturn:
3504
			case TokenNamereturn:
(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (-11 / +171 lines)
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
19877
}
20037
}

Return to bug 253008