use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testFindTypeByName_$StartsWithDollar_02.
@Test
public void testFindTypeByName_$StartsWithDollar_02() {
// Class<org.eclipse.xtext.common.types.testSetups.$StartsWithDollar> clazz = org.eclipse.xtext.common.types.testSetups.$StartsWithDollar.class;
String typeName = "org.eclipse.xtext.common.types.testSetups.$StartsWithDollar";
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName, false);
doTestFindTypeByName_$StartsWithDollar(type);
}
use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testFindTypeByName_javaUtilList_03.
@Test
public void testFindTypeByName_javaUtilList_03() {
String typeName = List.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation toArray = (JvmOperation) type.eResource().getEObject("java.util.List.toArray(T[])");
assertNotNull(toArray);
assertEquals("T[]", toArray.getReturnType().getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testMemberCount_06.
@Test
public void testMemberCount_06() {
String typeName = NestedTypes.Outer.Inner.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
doTestMemberCount_06(type);
}
use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testMemberCount_12.
@Test
public void testMemberCount_12() {
String typeName = Fields.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
int constructorCount = Fields.class.getDeclaredConstructors().length;
// default constructor
assertEquals(1, constructorCount);
int fieldCount = Fields.class.getDeclaredFields().length;
assertEquals(7, fieldCount);
int nestedCount = Fields.class.getDeclaredClasses().length;
assertEquals(1, nestedCount);
assertEquals(nestedCount + constructorCount + fieldCount, type.getMembers().size());
diagnose(type);
Resource resource = type.eResource();
getAndResolveAllFragments(resource);
recomputeAndCheckIdentifiers(resource);
}
use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method test_ParameterizedTypes_Inner_Z_01.
@Test
public void test_ParameterizedTypes_Inner_Z_01() {
String typeName = ParameterizedTypes.Inner.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmTypeParameter typeParameterZ = type.getTypeParameters().get(2);
assertEquals("Z", typeParameterZ.getIdentifier());
assertSame(type, typeParameterZ.getDeclarator());
assertEquals(1, typeParameterZ.getConstraints().size());
JvmTypeConstraint typeConstraint = typeParameterZ.getConstraints().get(0);
assertTrue(typeConstraint instanceof JvmUpperBound);
JvmUpperBound upperBound = (JvmUpperBound) typeConstraint;
assertNotNull(upperBound.getTypeReference());
assertEquals("java.util.List<W>", upperBound.getTypeReference().getIdentifier());
JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) upperBound.getTypeReference();
assertEquals(1, listType.getArguments().size());
JvmTypeReference typeArgument = listType.getArguments().get(0);
assertEquals("W", typeArgument.getIdentifier());
JvmTypeParameter w = ((JvmTypeParameterDeclarator) type.getDeclaringType()).getTypeParameters().get(4);
assertSame(w, typeArgument.getType());
}
Aggregations