use of org.eclipse.xtext.common.types.JvmDeclaredType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testFindTypeByName_javaLangNumber_02.
@Test
public void testFindTypeByName_javaLangNumber_02() {
String typeName = Number[][].class.getName();
JvmArrayType type = (JvmArrayType) getTypeProvider().findTypeByName(typeName);
JvmOperation longValue = (JvmOperation) type.eResource().getEObject("java.lang.Number.longValue()");
assertNotNull(longValue);
JvmDeclaredType number = longValue.getDeclaringType();
assertNotNull(number.getArrayType());
assertSame(type, number.getArrayType().getArrayType());
assertNull(type.eGet(TypesPackage.Literals.JVM_COMPONENT_TYPE__ARRAY_TYPE));
// array will created on the fly
assertNotNull(type.getArrayType());
diagnose(type);
Resource resource = type.eResource();
getAndResolveAllFragments(resource);
recomputeAndCheckIdentifiers(resource);
}
use of org.eclipse.xtext.common.types.JvmDeclaredType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testDefaultAnnotationAnnotationValueByReference.
@Test
public void testDefaultAnnotationAnnotationValueByReference() throws Exception {
String typeName = Bug334943Client.class.getName();
JvmDeclaredType client = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
JvmOperation operation = Iterables.get(client.getDeclaredOperations(), 0);
List<JvmAnnotationReference> annotations = operation.getAnnotations();
assertEquals(1, annotations.size());
JvmAnnotationReference annotation = annotations.get(0);
for (JvmAnnotationValue value : annotation.getValues()) {
if ("enumValue".equals(value.getValueName())) {
JvmEnumAnnotationValue enumValue = (JvmEnumAnnotationValue) value;
assertEquals(1, enumValue.getValues().size());
assertEquals("FirstValue", enumValue.getValues().get(0).getSimpleName());
}
}
}
use of org.eclipse.xtext.common.types.JvmDeclaredType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testAnnotationWithStringDefault_04.
@Test
public void testAnnotationWithStringDefault_04() throws Exception {
String typeName = AnnotatedClassWithStringDefault.class.getName();
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
List<JvmAnnotationReference> annotations = type.getAnnotations();
assertEquals(1, annotations.size());
JvmAnnotationReference annotationReference = annotations.get(0);
assertEquals(TestAnnotationWithStringDefault.class.getName(), annotationReference.getAnnotation().getIdentifier());
checkDefaultAnnotationValuesAnnotatedExternalClass(annotationReference);
}
use of org.eclipse.xtext.common.types.JvmDeclaredType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testAnnotatedParameter_05.
@Test
public void testAnnotatedParameter_05() throws Exception {
String typeName = TestAnnotation.Annotated.class.getName();
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
JvmOperation method = getMethodFromType(type, TestAnnotation.Annotated.class, "method(java.lang.String,java.lang.String,java.lang.String)");
JvmAnnotationTarget target = method.getParameters().get(1);
assertEquals(0, target.getAnnotations().size());
}
use of org.eclipse.xtext.common.types.JvmDeclaredType in project xtext-eclipse by eclipse.
the class AbstractTypeProviderTest method testBug456328_01.
@Test
public void testBug456328_01() {
String typeName = Bug456328.class.getName();
JvmDeclaredType type = (JvmDeclaredType) getTypeProvider().findTypeByName(typeName);
assertNotNull(type);
}
Aggregations