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 (+84 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
20159
/**
20160
 * An inner/member interface should not be offered as completion suggestion.
20161
 * @throws JavaModelException
20162
 */
20163
public void test270437c() throws JavaModelException {
20164
	this.workingCopies = new ICompilationUnit[1];
20165
	this.workingCopies[0] = getWorkingCopy(
20166
			"/Completion/src/test/Test270437c.java",
20167
			"package test;" +
20168
			"class X extends X.MyClass1. {\n" +
20169
		    "    public class MyClass1 {\n" +
20170
		    "            public class MyClass2 {\n" +
20171
		    "            }\n" +
20172
		    "    }\n" +
20173
			"}\n");
20174
			
20175
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
20176
	String str = this.workingCopies[0].getSource();
20177
	String completeBehind = "X.MyClass1.";
20178
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
20179
20180
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
20181
	
20182
	// In the absence of the fix, the results would be as follows, which is wrong:
20183
	//"X.MyClass1.MyClass2[TYPE_REF]{MyClass2, test, Ltest.X$MyClass1$MyClass2;, null, 39}",
20184
	assertResults(
20185
			"", //Empty!
20186
			requestor.getResults());
20187
}
20188
20105
}
20189
}

Return to bug 270437