Java Code Examples for org.eclipse.xtext.common.types.JvmGenericType#eResource()
The following examples show how to use
org.eclipse.xtext.common.types.JvmGenericType#eResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_07() { String typeName = StaticNestedTypes.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = StaticNestedTypes.class.getDeclaredMethods().length; assertEquals(1, methodCount); int constructorCount = StaticNestedTypes.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor int nestedTypesCount = StaticNestedTypes.class.getClasses().length; assertEquals(1, nestedTypesCount); assertEquals(methodCount + constructorCount + nestedTypesCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 2
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testFindTypeByName_javaUtilList_01() { String typeName = List.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); assertNotNull(type); assertEquals(typeName, type.getIdentifier()); assertEquals(1, type.getTypeParameters().size()); JvmTypeParameter typeVariable = type.getTypeParameters().get(0); assertEquals("E", typeVariable.getName()); assertEquals(1, typeVariable.getConstraints().size()); JvmTypeConstraint typeConstraint = typeVariable.getConstraints().get(0); assertTrue(typeConstraint instanceof JvmUpperBound); JvmUpperBound upperBound = (JvmUpperBound) typeConstraint; assertSame(typeVariable, upperBound.getOwner()); assertNotNull(upperBound.getTypeReference()); assertFalse(upperBound.getTypeReference().getType().eIsProxy()); assertEquals(Object.class.getName(), upperBound.getTypeReference().getIdentifier()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 3
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_12() { String typeName = Fields.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int constructorCount = Fields.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor 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); }
Example 4
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_10() { String typeName = ParameterizedTypes.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = ParameterizedTypes.class.getDeclaredMethods().length; assertEquals(7, methodCount); int constructorCount = ParameterizedTypes.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor int nestedTypesCount = ParameterizedTypes.class.getClasses().length; assertEquals(1, nestedTypesCount); assertEquals(methodCount + constructorCount + nestedTypesCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 5
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_12() { String typeName = Fields.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int constructorCount = Fields.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor 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); }
Example 6
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private void doTestFindTypeByName_$StartsWithDollar(JvmGenericType type) { assertNotNull(type); Iterable<String> innerTypes = Iterables.transform(Iterables.filter(type.getMembers(), JvmType.class), new Function<JvmType, String>() { @Override public String apply(JvmType input) { return input.getSimpleName(); } }); assertTrue("Missing member type $Builder", Iterables.contains(innerTypes, "Builder")); assertEquals(1, Iterables.size(innerTypes)); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 7
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_10() { String typeName = ParameterizedTypes.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = ParameterizedTypes.class.getDeclaredMethods().length; assertEquals(7, methodCount); int constructorCount = ParameterizedTypes.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor int nestedTypesCount = ParameterizedTypes.class.getClasses().length; assertEquals(1, nestedTypesCount); assertEquals(methodCount + constructorCount + nestedTypesCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 8
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
private void doTestFindTypeByName_$StartsWithDollar(JvmGenericType type) { assertNotNull(type); Iterable<String> innerTypes = Iterables.transform(Iterables.filter(type.getMembers(), JvmType.class), new Function<JvmType, String>() { @Override public String apply(JvmType input) { return input.getSimpleName(); } }); assertTrue("Missing member type $Builder", Iterables.contains(innerTypes, "Builder")); assertEquals(1, Iterables.size(innerTypes)); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 9
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@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; assertEquals(1, constructorCount); // default constructor 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); }
Example 10
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Test public void testMemberCount_10() { String typeName = ParameterizedTypes.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = ParameterizedTypes.class.getDeclaredMethods().length; assertEquals(7, methodCount); int constructorCount = ParameterizedTypes.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor int nestedTypesCount = ParameterizedTypes.class.getClasses().length; assertEquals(1, nestedTypesCount); assertEquals(methodCount + constructorCount + nestedTypesCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 11
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testBug347739_01() { String typeName = Bug347739.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); diagnose(type); }
Example 12
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testMemberCount_01() { String typeName = ParameterizedMethods.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = ParameterizedMethods.class.getDeclaredMethods().length; assertEquals(10, methodCount); int constructorCount = ParameterizedMethods.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); assertEquals(methodCount + constructorCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 13
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testFindTypeByName_AbstractMultimap() { String typeName = "com.google.common.collect.AbstractMultimap"; JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); assertNotNull(type); diagnose(type, "java:/Objects/javax.annotation.Nullable#javax.annotation.Nullable"); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 14
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testBug347739_04() { String typeName = Bug347739ThreeTypeParamsSuper.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); diagnose(type); }
Example 15
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testBug347739_06() { String typeNameList = List.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeNameList); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); diagnose(type); }
Example 16
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testMemberCount_03() { String typeName = InitializerWithoutConstructor.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = InitializerWithoutConstructor.class.getDeclaredMethods().length; assertEquals(0, methodCount); int constructorCount = InitializerWithoutConstructor.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); // default constructor assertEquals(methodCount + constructorCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 17
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testBug347739_06() { String typeNameList = List.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeNameList); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); diagnose(type); }
Example 18
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testMemberCount_02() { String typeName = InitializerWithConstructor.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); int methodCount = InitializerWithConstructor.class.getDeclaredMethods().length; assertEquals(0, methodCount); int constructorCount = InitializerWithConstructor.class.getDeclaredConstructors().length; assertEquals(1, constructorCount); assertEquals(methodCount + constructorCount, type.getMembers().size()); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }
Example 19
Source File: AbstractTypeProviderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testBug347739_05() { String typeName = Bug347739ThreeTypeParamsSuperSuper.class.getName(); JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); diagnose(type); }
Example 20
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Test public void testFindTypeByName_TypeParamEndsWithDollar() { String typeName = "org.eclipse.xtext.common.types.testSetups.TypeParamEndsWithDollar"; JvmGenericType type = (JvmGenericType) getTypeProvider().findTypeByName(typeName); assertNotNull(type); diagnose(type); Resource resource = type.eResource(); getAndResolveAllFragments(resource); recomputeAndCheckIdentifiers(resource); }