Lines 34-40
Link Here
|
34 |
// Names of tests to run: can be "testBugXXXX" or "BugXXXX") |
34 |
// Names of tests to run: can be "testBugXXXX" or "BugXXXX") |
35 |
// TESTS_PREFIX = "testCombineAccessRestrictions"; |
35 |
// TESTS_PREFIX = "testCombineAccessRestrictions"; |
36 |
// TESTS_NAMES = new String[] {"test004"}; |
36 |
// TESTS_NAMES = new String[] {"test004"}; |
37 |
// TESTS_NUMBERS = new int[] { 23, 28, 38 }; |
37 |
// TESTS_NUMBERS = new int[] { 5, 6 }; |
38 |
// TESTS_RANGE = new int[] { 21, 38 }; |
38 |
// TESTS_RANGE = new int[] { 21, 38 }; |
39 |
} |
39 |
} |
40 |
public static Test suite() { |
40 |
public static Test suite() { |
Lines 148-152
Link Here
|
148 |
JavaCore.setOptions(oldOptions); |
148 |
JavaCore.setOptions(oldOptions); |
149 |
} |
149 |
} |
150 |
} |
150 |
} |
151 |
|
151 |
|
|
|
152 |
public void test005() throws JavaModelException { |
153 |
Hashtable oldOptions = JavaCore.getOptions(); |
154 |
try { |
155 |
Hashtable options = new Hashtable(oldOptions); |
156 |
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); |
157 |
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); |
158 |
JavaCore.setOptions(options); |
159 |
ICompilationUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "E2.java"); |
160 |
assertNotNull("No compilation unit", compilationUnit); |
161 |
IType[] types = compilationUnit.getTypes(); |
162 |
assertNotNull("No types", types); |
163 |
assertEquals("Wrong size", 1, types.length); |
164 |
IType type = types[0]; |
165 |
type.createField("int i;", null, true, null); |
166 |
String expectedSource = |
167 |
"public enum E2 {\n" + |
168 |
" A, B, C;\n\n" + |
169 |
" int i;\n" + |
170 |
"}"; |
171 |
assertSourceEquals("Unexpected source", expectedSource, type.getSource()); |
172 |
} finally { |
173 |
JavaCore.setOptions(oldOptions); |
174 |
} |
175 |
} |
176 |
|
177 |
public void test006() throws JavaModelException { |
178 |
Hashtable oldOptions = JavaCore.getOptions(); |
179 |
try { |
180 |
Hashtable options = new Hashtable(oldOptions); |
181 |
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); |
182 |
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); |
183 |
JavaCore.setOptions(options); |
184 |
ICompilationUnit compilationUnit = getCompilationUnit("CreateMembers", "src", "", "E3.java"); |
185 |
assertNotNull("No compilation unit", compilationUnit); |
186 |
IType[] types = compilationUnit.getTypes(); |
187 |
assertNotNull("No types", types); |
188 |
assertEquals("Wrong size", 1, types.length); |
189 |
IType type = types[0]; |
190 |
type.createType("class DD {}", null, true, null); |
191 |
String expectedSource = |
192 |
"public enum E3 {\n" + |
193 |
" A, B, C;\n\n" + |
194 |
" class DD {}\n" + |
195 |
"}"; |
196 |
assertSourceEquals("Unexpected source", expectedSource, type.getSource()); |
197 |
} finally { |
198 |
JavaCore.setOptions(oldOptions); |
199 |
} |
200 |
} |
152 |
} |
201 |
} |