use of org.eclipse.xtext.common.types.JvmArrayType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method test_nestedArrayWildcard_02.
@Test
public void test_nestedArrayWildcard_02() {
JvmOperation nestedArrayWildcard = getMethodFromParameterizedMethods("nestedArrayWildcard(java.util.List[][])");
JvmTypeReference paramType = nestedArrayWildcard.getParameters().get(0).getParameterType();
assertTrue(paramType.getType() instanceof JvmArrayType);
JvmArrayType arrayType = (JvmArrayType) paramType.getType();
assertTrue(arrayType.getComponentType() instanceof JvmArrayType);
arrayType = (JvmArrayType) arrayType.getComponentType();
assertTrue(arrayType.getComponentType() instanceof JvmDeclaredType);
assertTrue(paramType instanceof JvmGenericArrayTypeReference);
JvmGenericArrayTypeReference paramTypeAsArray = (JvmGenericArrayTypeReference) paramType;
assertTrue(paramTypeAsArray.getComponentType() instanceof JvmGenericArrayTypeReference);
paramTypeAsArray = (JvmGenericArrayTypeReference) paramTypeAsArray.getComponentType();
assertTrue(paramTypeAsArray.getComponentType() instanceof JvmParameterizedTypeReference);
JvmParameterizedTypeReference listWithWildcard = (JvmParameterizedTypeReference) paramTypeAsArray.getComponentType();
assertTrue(listWithWildcard.getArguments().get(0) instanceof JvmWildcardTypeReference);
}
use of org.eclipse.xtext.common.types.JvmArrayType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method test_ParameterizedTypes_Inner_08.
@Test
public void test_ParameterizedTypes_Inner_08() {
String typeName = ParameterizedTypes.Inner.class.getName();
JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
JvmOperation methodV = getMethodFromType(type, ParameterizedTypes.Inner.class, "methodZArray_02()");
JvmTypeReference listZ = methodV.getReturnType();
assertEquals("java.util.List<Z[]>[]", listZ.getIdentifier());
JvmParameterizedTypeReference listType = (JvmParameterizedTypeReference) ((JvmGenericArrayTypeReference) listZ).getComponentType();
assertEquals(1, listType.getArguments().size());
JvmTypeReference typeArgument = listType.getArguments().get(0);
JvmType argumentType = typeArgument.getType();
assertTrue(argumentType instanceof JvmArrayType);
JvmComponentType componentType = ((JvmArrayType) argumentType).getComponentType();
JvmTypeParameter z = type.getTypeParameters().get(2);
assertSame(z, componentType);
}
use of org.eclipse.xtext.common.types.JvmArrayType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method test_nestedArrayParameterized_02.
@Test
public void test_nestedArrayParameterized_02() {
JvmOperation nestedArrayParameterized = getMethodFromParameterizedMethods("nestedArrayParameterized(java.util.List[][])");
JvmTypeReference paramType = nestedArrayParameterized.getParameters().get(0).getParameterType();
assertTrue(paramType.getType() instanceof JvmArrayType);
JvmArrayType arrayType = (JvmArrayType) paramType.getType();
assertTrue(arrayType.getComponentType() instanceof JvmArrayType);
arrayType = (JvmArrayType) arrayType.getComponentType();
assertTrue(arrayType.getComponentType() instanceof JvmDeclaredType);
assertTrue(paramType instanceof JvmGenericArrayTypeReference);
JvmGenericArrayTypeReference paramTypeAsArray = (JvmGenericArrayTypeReference) paramType;
assertTrue(paramTypeAsArray.getComponentType() instanceof JvmGenericArrayTypeReference);
paramTypeAsArray = (JvmGenericArrayTypeReference) paramTypeAsArray.getComponentType();
assertTrue(paramTypeAsArray.getComponentType() instanceof JvmParameterizedTypeReference);
JvmParameterizedTypeReference listWithT = (JvmParameterizedTypeReference) paramTypeAsArray.getComponentType();
assertTrue(listWithT.getArguments().get(0) instanceof JvmParameterizedTypeReference);
assertEquals("T", listWithT.getArguments().get(0).getType().getSimpleName());
}
use of org.eclipse.xtext.common.types.JvmArrayType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testFindTypeByName_int_array_04.
@Test
public void testFindTypeByName_int_array_04() {
String typeName = "int[][][]";
JvmType type = getTypeProvider().findTypeByName(typeName);
assertNotNull(type);
assertTrue(type instanceof JvmArrayType);
assertEquals(typeName, type.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmArrayType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testFindTypeByName_int_array_03.
@Test
public void testFindTypeByName_int_array_03() {
String typeName = int[][][].class.getName();
JvmType type = getTypeProvider().findTypeByName(typeName);
assertNotNull(type);
assertTrue(type instanceof JvmArrayType);
assertEquals("int[][][]", type.getIdentifier());
diagnose(type);
Resource resource = type.eResource();
getAndResolveAllFragments(resource);
recomputeAndCheckIdentifiers(resource);
}
Aggregations