Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 24-30
Link Here
|
24 |
|
24 |
|
25 |
public class CompletionTests_1_5 extends AbstractJavaModelCompletionTests { |
25 |
public class CompletionTests_1_5 extends AbstractJavaModelCompletionTests { |
26 |
static { |
26 |
static { |
27 |
// TESTS_NAMES = new String[]{"test0040"}; |
27 |
// TESTS_NAMES = new String[]{"testBug204100"}; |
28 |
} |
28 |
} |
29 |
public CompletionTests_1_5(String name) { |
29 |
public CompletionTests_1_5(String name) { |
30 |
super(name); |
30 |
super(name); |
Lines 13790-13794
Link Here
|
13790 |
(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", |
13790 |
(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXACT_EXPECTED_TYPE + R_NON_RESTRICTED) + "}", |
13791 |
requestor.getResults()); |
13791 |
requestor.getResults()); |
13792 |
} |
13792 |
} |
|
|
13793 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204100 |
13794 |
// To verify that the declaration signature for a proposal in |
13795 |
// static import is the generic signature |
13796 |
public void testBug204100a() throws JavaModelException { |
13797 |
this.oldOptions = JavaCore.getOptions(); |
13798 |
try { |
13799 |
Hashtable options = new Hashtable(this.oldOptions); |
13800 |
options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); |
13801 |
JavaCore.setOptions(options); |
13802 |
this.workingCopies = new ICompilationUnit[2]; |
13803 |
this.workingCopies[0] = getWorkingCopy( |
13804 |
"/Completion/src3/test/pack/AClass.java", |
13805 |
"package test.pack;\n"+ |
13806 |
"public class AClass <T> {\n" + |
13807 |
" public static int zork;\n" + |
13808 |
"}\n"); |
13809 |
|
13810 |
this.workingCopies[1] = getWorkingCopy( |
13811 |
"/Completion/src3/test/Test.java", |
13812 |
"package test;\n" + |
13813 |
"import static test.pack.AClass.;\n" + |
13814 |
"public class Test {\n" + |
13815 |
" public void bar() {\n" + |
13816 |
" }\n" + |
13817 |
"}\n"); |
13818 |
|
13819 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
13820 |
requestor.allowAllRequiredProposals(); |
13821 |
String str = this.workingCopies[1].getSource(); |
13822 |
String completeBehind = "test.pack.AClass."; |
13823 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
13824 |
this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner); |
13825 |
assertResults( |
13826 |
"zork[FIELD_REF]{zork;, Ltest.pack.AClass<TT;>;, I, zork, null, " + |
13827 |
(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
13828 |
requestor.getResults()); |
13829 |
} |
13830 |
finally { |
13831 |
JavaCore.setOptions(this.oldOptions); |
13832 |
} |
13833 |
} |
13834 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204100 |
13835 |
// To verify that the declaration signature for a proposal in |
13836 |
// static import is the generic signature |
13837 |
public void testBug204100b() throws JavaModelException { |
13838 |
this.oldOptions = JavaCore.getOptions(); |
13839 |
try { |
13840 |
Hashtable options = new Hashtable(this.oldOptions); |
13841 |
options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); |
13842 |
JavaCore.setOptions(options); |
13843 |
this.workingCopies = new ICompilationUnit[2]; |
13844 |
this.workingCopies[0] = getWorkingCopy( |
13845 |
"/Completion/src3/test/pack/AClass.java", |
13846 |
"package test.pack;\n" + |
13847 |
"class ABC {\n" + |
13848 |
" int aField;\n" + |
13849 |
"}\n"+ |
13850 |
"public class AClass <T> {\n" + |
13851 |
" public static ABC abc;\n" + |
13852 |
"}\n"); |
13853 |
|
13854 |
this.workingCopies[1] = getWorkingCopy( |
13855 |
"/Completion/src3/test/Test.java", |
13856 |
"package test;\n" + |
13857 |
"import static test.pack.AClass.;\n" + |
13858 |
"public class Test {\n" + |
13859 |
" public void bar() {\n" + |
13860 |
" }\n" + |
13861 |
"}\n"); |
13862 |
|
13863 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
13864 |
requestor.allowAllRequiredProposals(); |
13865 |
String str = this.workingCopies[1].getSource(); |
13866 |
String completeBehind = "test.pack.AClass."; |
13867 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
13868 |
this.workingCopies[1].codeComplete(cursorLocation, requestor, this.wcOwner); |
13869 |
assertResults( |
13870 |
"abc[FIELD_REF]{abc;, Ltest.pack.AClass<TT;>;, Ltest.pack.ABC;, abc, null, " + |
13871 |
(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", |
13872 |
requestor.getResults()); |
13873 |
} |
13874 |
finally { |
13875 |
JavaCore.setOptions(this.oldOptions); |
13876 |
} |
13877 |
} |
13793 |
|
13878 |
|
13794 |
} |
13879 |
} |