Lines 173-179
Link Here
|
173 |
/* |
173 |
/* |
174 |
* Ensures that a hierarchy on an anonymous type in an initializer is correct. |
174 |
* Ensures that a hierarchy on an anonymous type in an initializer is correct. |
175 |
*/ |
175 |
*/ |
176 |
public void testAnonymousType1() throws JavaModelException { |
176 |
public void testAnonymousType01() throws JavaModelException { |
177 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
177 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
178 |
IType type = typeA.getInitializer(1).getType("", 1); |
178 |
IType type = typeA.getInitializer(1).getType("", 1); |
179 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
179 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 188-194
Link Here
|
188 |
/* |
188 |
/* |
189 |
* Ensures that a hierarchy on an anonymous type in a second initializer is correct. |
189 |
* Ensures that a hierarchy on an anonymous type in a second initializer is correct. |
190 |
*/ |
190 |
*/ |
191 |
public void testAnonymousType2() throws JavaModelException { |
191 |
public void testAnonymousType02() throws JavaModelException { |
192 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
192 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
193 |
IType type = typeA.getInitializer(2).getType("", 1); |
193 |
IType type = typeA.getInitializer(2).getType("", 1); |
194 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
194 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 203-209
Link Here
|
203 |
/* |
203 |
/* |
204 |
* Ensures that a hierarchy on an anonymous type in a field declaration is correct. |
204 |
* Ensures that a hierarchy on an anonymous type in a field declaration is correct. |
205 |
*/ |
205 |
*/ |
206 |
public void testAnonymousType3() throws JavaModelException { |
206 |
public void testAnonymousType03() throws JavaModelException { |
207 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
207 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
208 |
IType type = typeA.getField("field1").getType("", 1); |
208 |
IType type = typeA.getField("field1").getType("", 1); |
209 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
209 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 218-224
Link Here
|
218 |
/* |
218 |
/* |
219 |
* Ensures that a hierarchy on an anonymous type in a field declaration is correct. |
219 |
* Ensures that a hierarchy on an anonymous type in a field declaration is correct. |
220 |
*/ |
220 |
*/ |
221 |
public void testAnonymousType4() throws JavaModelException { |
221 |
public void testAnonymousType04() throws JavaModelException { |
222 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
222 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
223 |
IType type = typeA.getField("field2").getType("", 1); |
223 |
IType type = typeA.getField("field2").getType("", 1); |
224 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
224 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 242-248
Link Here
|
242 |
/* |
242 |
/* |
243 |
* Ensures that a hierarchy on an anonymous type in a method declaration is correct. |
243 |
* Ensures that a hierarchy on an anonymous type in a method declaration is correct. |
244 |
*/ |
244 |
*/ |
245 |
public void testAnonymousType5() throws JavaModelException { |
245 |
public void testAnonymousType05() throws JavaModelException { |
246 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
246 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p7", "A.java").getType("A"); |
247 |
IType type = typeA.getMethod("foo", new String[] {}).getType("", 1); |
247 |
IType type = typeA.getMethod("foo", new String[] {}).getType("", 1); |
248 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
248 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 258-264
Link Here
|
258 |
* Ensures that a hierarchy on an anonymous type that uses a non-default constructor is correct. |
258 |
* Ensures that a hierarchy on an anonymous type that uses a non-default constructor is correct. |
259 |
* (regression test for bug 44506 Type hierarchy is missing anonymous type) |
259 |
* (regression test for bug 44506 Type hierarchy is missing anonymous type) |
260 |
*/ |
260 |
*/ |
261 |
public void testAnonymousType6() throws JavaModelException { |
261 |
public void testAnonymousType06() throws JavaModelException { |
262 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p8", "X.java").getType("X"); |
262 |
IType typeA = getCompilationUnit("TypeHierarchy", "src", "p8", "X.java").getType("X"); |
263 |
IType type = typeA.getMethod("foo", new String[] {}).getType("", 1); |
263 |
IType type = typeA.getMethod("foo", new String[] {}).getType("", 1); |
264 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
264 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
Lines 274-280
Link Here
|
274 |
* Ensure that the key of an anonymous binary type in a hierarchy is correct. |
274 |
* Ensure that the key of an anonymous binary type in a hierarchy is correct. |
275 |
* (regression test for bug 93826 ArrayIndexOutOfBoundsException when opening type hierarchy) |
275 |
* (regression test for bug 93826 ArrayIndexOutOfBoundsException when opening type hierarchy) |
276 |
*/ |
276 |
*/ |
277 |
public void testAnonymousType7() throws CoreException { |
277 |
public void testAnonymousType07() throws CoreException { |
278 |
IType type = getClassFile("TypeHierarchy","myLib.jar", "my.pkg", "X.class").getType(); |
278 |
IType type = getClassFile("TypeHierarchy","myLib.jar", "my.pkg", "X.class").getType(); |
279 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
279 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
280 |
IType[] subtypes = hierarchy.getSubtypes(type); |
280 |
IType[] subtypes = hierarchy.getSubtypes(type); |
Lines 284-290
Link Here
|
284 |
* Ensure that hierarchy on an enum also include the anonymous of its enum contants |
284 |
* Ensure that hierarchy on an enum also include the anonymous of its enum contants |
285 |
* (regression test for bug 120667 [hierarchy] Type hierarchy for enum type does not include anonymous subtypes) |
285 |
* (regression test for bug 120667 [hierarchy] Type hierarchy for enum type does not include anonymous subtypes) |
286 |
*/ |
286 |
*/ |
287 |
public void testAnonymousType8() throws CoreException { |
287 |
public void testAnonymousType08() throws CoreException { |
288 |
IType type = getCompilationUnit("TypeHierarchy15/src/Try.java").getType("Try"); |
288 |
IType type = getCompilationUnit("TypeHierarchy15/src/Try.java").getType("Try"); |
289 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
289 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
290 |
assertHierarchyEquals( |
290 |
assertHierarchyEquals( |
Lines 302-308
Link Here
|
302 |
* Ensure that hierarchy on the anonymous type of an enum constant is correct |
302 |
* Ensure that hierarchy on the anonymous type of an enum constant is correct |
303 |
* (regression test for bug 120667 [hierarchy] Type hierarchy for enum type does not include anonymous subtypes) |
303 |
* (regression test for bug 120667 [hierarchy] Type hierarchy for enum type does not include anonymous subtypes) |
304 |
*/ |
304 |
*/ |
305 |
public void testAnonymousType9() throws CoreException { |
305 |
public void testAnonymousType09() throws CoreException { |
306 |
IType type = getCompilationUnit("TypeHierarchy15/src/Try.java").getType("Try").getField("ANONYMOUS").getType("", 1); |
306 |
IType type = getCompilationUnit("TypeHierarchy15/src/Try.java").getType("Try").getField("ANONYMOUS").getType("", 1); |
307 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
307 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
308 |
assertHierarchyEquals( |
308 |
assertHierarchyEquals( |
Lines 316-321
Link Here
|
316 |
"Sub types:\n", |
316 |
"Sub types:\n", |
317 |
hierarchy); |
317 |
hierarchy); |
318 |
} |
318 |
} |
|
|
319 |
/* |
320 |
* Ensure that hierarchy on the anonymous type of a member type that is opened is correct |
321 |
* (regression test for bug 122444 [hierarchy] Type hierarchy of inner member type misses anonymous subtypes) |
322 |
*/ |
323 |
public void testAnonymousType10() throws CoreException { |
324 |
ICompilationUnit cu = getCompilationUnit("TypeHierarchy/src/q7/X.java"); |
325 |
cu.open(null); |
326 |
IType type = cu.getType("X").getType("Member"); |
327 |
ITypeHierarchy hierarchy = type.newTypeHierarchy(null); |
328 |
assertHierarchyEquals( |
329 |
"Focus: Member [in X [in X.java [in q7 [in src [in TypeHierarchy]]]]]\n" + |
330 |
"Super types:\n" + |
331 |
" Object [in Object.class [in java.lang [in "+ getExternalJCLPathString() + "]]]\n" + |
332 |
"Sub types:\n" + |
333 |
" <anonymous #1> [in foo(X) [in Y [in X.java [in q7 [in src [in TypeHierarchy]]]]]]\n", |
334 |
hierarchy); |
335 |
} |
319 |
/** |
336 |
/** |
320 |
* Ensures that the superclass can be retrieved for a binary inner type. |
337 |
* Ensures that the superclass can be retrieved for a binary inner type. |
321 |
*/ |
338 |
*/ |