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

(-)src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java (+60 lines)
Lines 9272-9275 Link Here
9272
			expectedReplacedSource,
9272
			expectedReplacedSource,
9273
			"full ast");
9273
			"full ast");
9274
}
9274
}
9275
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=137623
9276
public void test0166() {
9277
9278
	String str = 
9279
		"public class X {\n" +
9280
		"	public boolean foo() {\n" +
9281
		"      if(this.equals(null))\n" +
9282
		"      {\n" +
9283
		"         (zzz==int.\n" +
9284
		"      }\n" +
9285
		"   }" +
9286
		"}\n"; 
9287
9288
	String completeBehind = "int.";
9289
	int cursorLocation = str.lastIndexOf("int.") + completeBehind.length() - 1;
9290
	String expectedCompletionNodeToString = "<NONE>";
9291
	String expectedParentNodeToString = "<NONE>";
9292
	String completionIdentifier = "<NONE>";
9293
	String expectedReplacedSource = "<NONE>";
9294
	String expectedUnitDisplayString =
9295
		"public class X {\n" + 
9296
		"  public X() {\n" + 
9297
		"  }\n" + 
9298
		"  public boolean foo() {\n" + 
9299
		"  }\n" + 
9300
		"}\n";
9301
9302
	checkDietParse(
9303
			str.toCharArray(),
9304
			cursorLocation,
9305
			expectedCompletionNodeToString,
9306
			expectedParentNodeToString,
9307
			expectedUnitDisplayString,
9308
			completionIdentifier,
9309
			expectedReplacedSource,
9310
	"diet ast");
9311
	
9312
	expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int.>";
9313
	expectedParentNodeToString = "<NONE>";
9314
	completionIdentifier = "";
9315
	expectedReplacedSource = "int.";
9316
	expectedUnitDisplayString =
9317
		"public class X {\n" + 
9318
		"  public X() {\n" + 
9319
		"  }\n" + 
9320
		"  public boolean foo() {\n" + 
9321
		"    <CompleteOnClassLiteralAccess:int.>;\n" + 
9322
		"  }\n" + 
9323
		"}\n";
9324
9325
	checkMethodParse(
9326
			str.toCharArray(),
9327
			cursorLocation,
9328
			expectedCompletionNodeToString,
9329
			expectedParentNodeToString,
9330
			expectedUnitDisplayString,
9331
			completionIdentifier,
9332
			expectedReplacedSource,
9333
			"full ast");
9334
}
9275
}
9335
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (-1 / +6 lines)
Lines 1299-1304 Link Here
1299
 */
1299
 */
1300
private boolean checkMemberAccess() {
1300
private boolean checkMemberAccess() {
1301
	if (this.previousToken == TokenNameDOT && this.qualifier > -1 && this.expressionPtr == this.qualifier) {
1301
	if (this.previousToken == TokenNameDOT && this.qualifier > -1 && this.expressionPtr == this.qualifier) {
1302
		if (this.identifierLengthPtr > 1 && this.identifierLengthStack[this.identifierLengthPtr - 1] < 0) {
1303
			// its not a  member access because the receiver is a base type
1304
			// fix for bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=137623
1305
			return false;
1306
		}
1302
		// the receiver is an expression
1307
		// the receiver is an expression
1303
		pushCompletionOnMemberAccessOnExpressionStack(false);
1308
		pushCompletionOnMemberAccessOnExpressionStack(false);
1304
		return true;
1309
		return true;
Lines 3808-3811 Link Here
3808
		return field;
3813
		return field;
3809
	}
3814
	}
3810
}
3815
}
3811
}
3816
}

Return to bug 137623