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

(-)src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java (+58 lines)
Lines 11479-11482 Link Here
11479
			expectedReplacedSource,
11479
			expectedReplacedSource,
11480
			"full ast");
11480
			"full ast");
11481
}
11481
}
11482
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=150632
11483
public void test0172() {
11484
11485
	String str = 
11486
		"abstract class MatchFilter {\n"+
11487
		"    private static final String SETTINGS_LAST_USED_FILTERS= \"filters_last_used\"; \n"+
11488
		"\n"+
11489
		"    // works if next line is commented out or moved to after PUBLIC_FILTER\n"+
11490
		"    public abstract String getName();\n"+
11491
		"\n"+
11492
		"    // content assist at new ModifierFilter(|):\n"+
11493
		"    private static final MatchFilter PUBLIC_FILTER= new ModifierFilter();\n"+
11494
		"}\n"+
11495
		"\n"+
11496
		"class ModifierFilter extends MatchFilter {\n"+
11497
		"   private final String fName;\n"+
11498
		"    public ModifierFilter(String name) {\n"+
11499
		"        fName= name;\n"+
11500
		"    }\n"+
11501
		"   public String getName() {\n"+
11502
		"        return fName;\n"+
11503
		"    }\n"+
11504
		"}\n"; 
11505
11506
	String completeBehind = "new ModifierFilter(";
11507
	int cursorLocation = str.lastIndexOf("new ModifierFilter(") + completeBehind.length() - 1;
11508
	String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new ModifierFilter()>";
11509
	String expectedParentNodeToString = "<NONE>";
11510
	String completionIdentifier = "";
11511
	String expectedReplacedSource = "";
11512
	String expectedUnitDisplayString =
11513
		"abstract class MatchFilter {\n" + 
11514
		"  private static final String SETTINGS_LAST_USED_FILTERS;\n" + 
11515
		"  private static final MatchFilter PUBLIC_FILTER = <CompleteOnAllocationExpression:new ModifierFilter()>;\n" + 
11516
		"  MatchFilter() {\n" + 
11517
		"  }\n" + 
11518
		"  <clinit>() {\n" + 
11519
		"  }\n" + 
11520
		"  public abstract String getName();\n" + 
11521
		"}\n" + 
11522
		"class ModifierFilter extends MatchFilter {\n" + 
11523
		"  private final String fName;\n" + 
11524
		"  public ModifierFilter(String name) {\n" + 
11525
		"  }\n" + 
11526
		"  public String getName() {\n" + 
11527
		"  }\n" + 
11528
		"}\n";
11529
11530
	checkDietParse(
11531
			str.toCharArray(),
11532
			cursorLocation,
11533
			expectedCompletionNodeToString,
11534
			expectedParentNodeToString,
11535
			expectedUnitDisplayString,
11536
			completionIdentifier,
11537
			expectedReplacedSource,
11538
	"diet ast");
11539
}
11482
}
11540
}
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java (+6 lines)
Lines 2723-2728 Link Here
2723
	super.consumeMethodHeader();
2723
	super.consumeMethodHeader();
2724
	pushOnElementStack(K_BLOCK_DELIMITER);
2724
	pushOnElementStack(K_BLOCK_DELIMITER);
2725
}
2725
}
2726
protected void consumeMethodDeclaration(boolean isNotAbstract) {
2727
	if (!isNotAbstract) {
2728
		popElement(K_BLOCK_DELIMITER);
2729
	}
2730
	super.consumeMethodDeclaration(isNotAbstract);
2731
}
2726
protected void consumeModifiers() {
2732
protected void consumeModifiers() {
2727
	super.consumeModifiers();
2733
	super.consumeModifiers();
2728
	// save from stack values
2734
	// save from stack values
(-)codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java (+6 lines)
Lines 352-357 Link Here
352
	super.consumeMethodBody();
352
	super.consumeMethodBody();
353
	popElement(K_METHOD_DELIMITER);
353
	popElement(K_METHOD_DELIMITER);
354
}
354
}
355
protected void consumeMethodDeclaration(boolean isNotAbstract) {
356
	if (!isNotAbstract) {
357
		popElement(K_METHOD_DELIMITER);
358
	}
359
	super.consumeMethodDeclaration(isNotAbstract);
360
}
355
protected void consumeMethodHeader() {
361
protected void consumeMethodHeader() {
356
	super.consumeMethodHeader();
362
	super.consumeMethodHeader();
357
	pushOnElementStack(K_METHOD_DELIMITER);
363
	pushOnElementStack(K_METHOD_DELIMITER);

Return to bug 150632