use of spoon.test.generics.testclasses.Banana in project spoon by INRIA.
the class GenericsTest method testClassContextOnInnerClass.
@Test
public void testClassContextOnInnerClass() throws Exception {
CtClass<?> classBanana = (CtClass<?>) buildClass(Banana.class);
CtClass<?> classVitamins = classBanana.getNestedType("Vitamins");
CtTypeReference<?> refList_T = classVitamins.getSuperclass();
// contract: generic types defined in enclocing classe (Banana<T>) are resolved from inner class hierarchy (Vitamins->List<T>) too.
assertSame(classBanana.getFormalCtTypeParameters().get(0), new ClassTypingContext(classVitamins).adaptType(refList_T.getActualTypeArguments().get(0)).getDeclaration());
}
Aggregations