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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+54 lines)
Lines 20102-20105 Link Here
20102
			requestor.getResults());
20102
			requestor.getResults());
20103
}
20103
}
20104
20104
20105
/**
20106
 * An inner/member class should not be offered as completion suggestion.
20107
 * @throws JavaModelException
20108
 */
20109
public void test270437a() throws JavaModelException {
20110
	this.workingCopies = new ICompilationUnit[1];
20111
	this.workingCopies[0] = getWorkingCopy(
20112
			"/Completion/src/test/Test270437a.java",
20113
			"package test;" +
20114
			"public class Test270437a extends Test270437a. {\n" +
20115
			"	public class Inner {}\n" +
20116
			"}\n");
20117
			
20118
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20119
	String str = this.workingCopies[0].getSource();
20120
	String completeBehind = "Test270437a.";
20121
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20122
20123
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20124
	
20125
	// In the absence of the fix, the results would be as follows, which is wrong:
20126
	//"Test270437a.Inner[TYPE_REF]{Inner, test, Ltest.Test270437a$Inner;, null, 39}",
20127
	assertResults(
20128
			"", //Empty!
20129
			requestor.getResults());
20130
}
20131
20132
/**
20133
 * An inner/member interface should not be offered as completion suggestion.
20134
 * @throws JavaModelException
20135
 */
20136
public void test270437b() throws JavaModelException {
20137
	this.workingCopies = new ICompilationUnit[1];
20138
	this.workingCopies[0] = getWorkingCopy(
20139
			"/Completion/src/test/Test270437b.java",
20140
			"package test;" +
20141
			"public class Test270437b implements Test270437b. {\n" +
20142
			"	public interface Inner {}\n" +
20143
			"}\n");
20144
			
20145
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20146
	String str = this.workingCopies[0].getSource();
20147
	String completeBehind = "Test270437b.";
20148
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20149
20150
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20151
	
20152
	// In the absence of the fix, the results would be as follows, which is wrong:
20153
	//"Test270437b.Inner[TYPE_REF]{Inner, test, Ltest.Test270437b$Inner;, null, 39}",
20154
	assertResults(
20155
			"", //Empty!
20156
			requestor.getResults());
20157
}
20158
20105
}
20159
}

Return to bug 270437