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

(-)src/org/eclipse/jdt/core/tests/model/CompletionTests.java (+36 lines)
Lines 2942-2948 Link Here
2942
			requestor.getResults());
2942
			requestor.getResults());
2943
	}
2943
	}
2944
}
2944
}
2945
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=102031
2946
public void testCompletionEmptyTypeName4() throws JavaModelException {
2947
	this.workingCopies = new ICompilationUnit[2];
2948
	this.workingCopies[0] = getWorkingCopy(
2949
		"/Completion/src/test/Test.java",
2950
		"package test;"+
2951
		"public class Test {\n" + 
2952
		"  void foo() {\n" + 
2953
 		"    new A().call(new /*content assist here*/)\n" + 
2954
		"  }\n" + 
2955
		"}\n" +
2956
		"interface I {\n" + 
2957
		"  void call(TestRunnable r);\n" + 
2958
		"}\n" + 
2959
		"class A implements I{\n" + 
2960
		"  public void call(TestRunnable r) {}\n" + 
2961
		"}\n");
2962
	
2963
	this.workingCopies[1] = getWorkingCopy(
2964
		"/Completion/src/test/TestRunnable.java",
2965
		"package test;"+
2966
		"public class TestRunnable {\n" + 
2967
		"}\n");
2968
2969
	CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
2970
	String str = this.workingCopies[0].getSource();
2971
	String completeBehind = "(new ";
2972
	int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
2973
	this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
2945
2974
2975
	assertResults(
2976
			"A[TYPE_REF]{A, test, Ltest.A;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
2977
			"I[TYPE_REF]{I, test, Ltest.I;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}\n" +
2978
			"Test[TYPE_REF]{Test, test, Ltest.Test;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE +R_UNQUALIFIED +  R_NON_RESTRICTED) + "}\n" +
2979
			"TestRunnable[TYPE_REF]{TestRunnable, test, Ltest.TestRunnable;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_NON_RESTRICTED) + "}",
2980
			requestor.getResults());
2981
}
2946
/**
2982
/**
2947
 * Complete at end of file.
2983
 * Complete at end of file.
2948
 */
2984
 */
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (+5 lines)
Lines 8248-8253 Link Here
8248
	}
8248
	}
8249
	private void addExpectedType(TypeBinding type, Scope scope){
8249
	private void addExpectedType(TypeBinding type, Scope scope){
8250
		if (type == null || !type.isValidBinding()) return;
8250
		if (type == null || !type.isValidBinding()) return;
8251
		
8252
		// do not add twice the same type
8253
		for (int i = 0; i <= this.expectedTypesPtr; i++) {
8254
			if (this.expectedTypes[i] == type) return;
8255
		}
8251
8256
8252
		int length = this.expectedTypes.length;
8257
		int length = this.expectedTypes.length;
8253
		if (++this.expectedTypesPtr >= length)
8258
		if (++this.expectedTypesPtr >= length)

Return to bug 102031