Lines 21893-21896
Link Here
|
21893 |
COMPLETION_PROJECT.setOptions(options); |
21893 |
COMPLETION_PROJECT.setOptions(options); |
21894 |
} |
21894 |
} |
21895 |
} |
21895 |
} |
|
|
21896 |
|
21897 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332268 |
21898 |
// To verify that we DO get proposals for static fields that have not yet been declared |
21899 |
// inside a field declaration statement, iff current field is not static |
21900 |
public void testBug332268a() throws JavaModelException { |
21901 |
this.workingCopies = new ICompilationUnit[1]; |
21902 |
this.workingCopies[0] = getWorkingCopy( |
21903 |
"/Completion/src/test/Test.java", |
21904 |
"package test;"+ |
21905 |
"public class Test {\n" + |
21906 |
" int myVar1 = 1;\n" + |
21907 |
" int myVar2 = 1;\n" + |
21908 |
" int myVar3 = myVar;\n" + |
21909 |
" int myVar4 = 1;\n" + |
21910 |
" static int myVar5 = 1;\n" + |
21911 |
" }\n" + |
21912 |
"}\n"); |
21913 |
|
21914 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
21915 |
String str = this.workingCopies[0].getSource(); |
21916 |
String completeBehind = "int myVar3 = myVar"; |
21917 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
21918 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
21919 |
|
21920 |
assertResults( |
21921 |
"myVar1[FIELD_REF]{myVar1, Ltest.Test;, I, myVar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}\n" + |
21922 |
"myVar2[FIELD_REF]{myVar2, Ltest.Test;, I, myVar2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}\n" + |
21923 |
"myVar5[FIELD_REF]{myVar5, Ltest.Test;, I, myVar5, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}", |
21924 |
requestor.getResults()); |
21925 |
} |
21926 |
|
21927 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=332268 |
21928 |
// To verify that we do not get proposals for static fields that have not yet been declared |
21929 |
// inside a field declaration statement, if current field is static |
21930 |
public void testBug332268b() throws JavaModelException { |
21931 |
this.workingCopies = new ICompilationUnit[1]; |
21932 |
this.workingCopies[0] = getWorkingCopy( |
21933 |
"/Completion/src/test/Test.java", |
21934 |
"package test;"+ |
21935 |
"public class Test {\n" + |
21936 |
" static int myVar1 = 1;\n" + |
21937 |
" int myVar2 = 1;\n" + |
21938 |
" static int myVar3 = myVar;\n" + |
21939 |
" int myVar4 = 1;\n" + |
21940 |
" static int myVar5 = 1;\n" + |
21941 |
" }\n" + |
21942 |
"}\n"); |
21943 |
|
21944 |
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); |
21945 |
String str = this.workingCopies[0].getSource(); |
21946 |
String completeBehind = "int myVar3 = myVar"; |
21947 |
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); |
21948 |
this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); |
21949 |
|
21950 |
assertResults( |
21951 |
"myVar1[FIELD_REF]{myVar1, Ltest.Test;, I, myVar1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_EXACT_EXPECTED_TYPE) + "}", |
21952 |
requestor.getResults()); |
21953 |
} |
21896 |
} |
21954 |
} |