Search in sources :

Example 61 with JvmGenericType

use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.

the class AbstractTypeProviderTest method testMemberCount_08_01.

@Test
public void testMemberCount_08_01() {
    String typeName = StaticNestedTypes.Outer.class.getName().replace('$', '.');
    JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName, false);
    doTestMemberCount_08(type);
}
Also used : JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) Test(org.junit.Test)

Example 62 with JvmGenericType

use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.

the class AbstractTypeProviderTest method testMemberCount_05.

@Test
public void testMemberCount_05() {
    String typeName = NestedTypes.Outer.class.getName();
    JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
    doTestMemberCount_05(type);
}
Also used : StaticNestedTypes(org.eclipse.xtext.common.types.testSetups.StaticNestedTypes) NestedTypes(org.eclipse.xtext.common.types.testSetups.NestedTypes) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) Test(org.junit.Test)

Example 63 with JvmGenericType

use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.

the class AbstractTypeProviderTest method testFields_privateT_01.

@Test
public void testFields_privateT_01() {
    String typeName = Fields.class.getName();
    JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
    JvmField field = getFieldFromType(type, Fields.class, "privateT");
    assertSame(type, field.getDeclaringType());
    assertEquals(JvmVisibility.PRIVATE, field.getVisibility());
    JvmType fieldType = field.getType().getType();
    assertSame(type.getTypeParameters().get(0), fieldType);
}
Also used : JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) JvmField(org.eclipse.xtext.common.types.JvmField) JvmType(org.eclipse.xtext.common.types.JvmType) Test(org.junit.Test)

Example 64 with JvmGenericType

use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.

the class AbstractTypeProviderTest method testFindTypeByName_javaUtilList_04.

@Test
public void testFindTypeByName_javaUtilList_04() {
    String typeName = List.class.getName();
    JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
    JvmOperation addAll = (JvmOperation) type.eResource().getEObject("java.util.List.addAll(java.util.Collection)");
    assertNotNull(addAll);
    assertEquals("boolean", addAll.getReturnType().getIdentifier());
}
Also used : JvmOperation(org.eclipse.xtext.common.types.JvmOperation) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) Test(org.junit.Test)

Example 65 with JvmGenericType

use of org.eclipse.xtext.common.types.JvmGenericType in project xtext-eclipse by eclipse.

the class AbstractTypeProviderTest method testMemberCount_04.

@Test
public void testMemberCount_04() {
    String typeName = NestedTypes.class.getName();
    JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName);
    int methodCount = NestedTypes.class.getDeclaredMethods().length;
    assertEquals(1, methodCount);
    int constructorCount = NestedTypes.class.getDeclaredConstructors().length;
    // default constructor
    assertEquals(1, constructorCount);
    int nestedTypesCount = NestedTypes.class.getClasses().length;
    assertEquals(1, nestedTypesCount);
    assertEquals(methodCount + constructorCount + nestedTypesCount, type.getMembers().size());
    diagnose(type);
    Resource resource = type.eResource();
    getAndResolveAllFragments(resource);
    recomputeAndCheckIdentifiers(resource);
}
Also used : StaticNestedTypes(org.eclipse.xtext.common.types.testSetups.StaticNestedTypes) NestedTypes(org.eclipse.xtext.common.types.testSetups.NestedTypes) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) Resource(org.eclipse.emf.ecore.resource.Resource) JvmTypeConstraint(org.eclipse.xtext.common.types.JvmTypeConstraint) Test(org.junit.Test)

Aggregations

JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)297 Test (org.junit.Test)237 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)117 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)64 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)56 JvmType (org.eclipse.xtext.common.types.JvmType)49 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)47 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)33 JvmConstructor (org.eclipse.xtext.common.types.JvmConstructor)33 JvmTypeParameter (org.eclipse.xtext.common.types.JvmTypeParameter)33 JvmField (org.eclipse.xtext.common.types.JvmField)31 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)30 EObject (org.eclipse.emf.ecore.EObject)28 Resource (org.eclipse.emf.ecore.resource.Resource)28 JvmMember (org.eclipse.xtext.common.types.JvmMember)25 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)24 JvmTypeConstraint (org.eclipse.xtext.common.types.JvmTypeConstraint)21 JvmUpperBound (org.eclipse.xtext.common.types.JvmUpperBound)17 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)15 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)15