use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractConstructorScopeTest method testGetElementByInstance_03.
@Test
public void testGetElementByInstance_03() {
JvmAnnotationReference annotationReference = TypesFactory.eINSTANCE.createJvmAnnotationReference();
IEObjectDescription element = getConstructorScope().getSingleElement(annotationReference);
assertNull(element);
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class AbstractTypeScopeTest method testGetElementByInstance_02.
@Test
public void testGetElementByInstance_02() {
JvmAnnotationReference annotationReference = TypesFactory.eINSTANCE.createJvmAnnotationReference();
IEObjectDescription element = getTypeScope().getSingleElement(annotationReference);
assertNull(element);
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-eclipse by eclipse.
the class XbaseHoverDocumentationProvider method addAnnotations.
protected void addAnnotations(EObject object) {
List<JvmAnnotationReference> annotations = Lists.newArrayList();
if (object instanceof JvmAnnotationTarget) {
annotations.addAll(((JvmAnnotationTarget) object).getAnnotations());
} else {
Set<EObject> jvmElements = associations.getJvmElements(object);
if (jvmElements.size() > 0) {
EObject associatedElement = Lists.newArrayList(jvmElements).get(0);
if (associatedElement instanceof JvmAnnotationTarget) {
annotations.addAll(((JvmAnnotationTarget) associatedElement).getAnnotations());
}
}
}
for (JvmAnnotationReference annotationReference : annotations) {
if (!typeExtensions.isSynthetic(annotationReference)) {
buffer.append(annotationValuePrinter.toHtmlString(annotationReference));
buffer.append("<br>");
}
}
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testExtensionToAnnotation_01.
@Test
public void testExtensionToAnnotation_01() throws Exception {
XtendFile xtendFile = file("class C { extension String }");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmField jvmField = (JvmField) inferredType.getMembers().get(1);
assertEquals("_string", jvmField.getSimpleName());
List<JvmAnnotationReference> annotations = jvmField.getAnnotations();
assertEquals(1, annotations.size());
assertEquals(Extension.class.getCanonicalName(), annotations.get(0).getAnnotation().getQualifiedName());
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testExtensionToAnnotation_02.
@Test
public void testExtensionToAnnotation_02() throws Exception {
XtendFile xtendFile = file("class C { def void m(extension String s) {} }");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmOperation jvmOperation = (JvmOperation) inferredType.getMembers().get(1);
List<JvmFormalParameter> parameters = jvmOperation.getParameters();
JvmFormalParameter singleParameter = parameters.get(0);
List<JvmAnnotationReference> annotations = singleParameter.getAnnotations();
assertEquals(1, annotations.size());
assertEquals(Extension.class.getCanonicalName(), annotations.get(0).getAnnotation().getQualifiedName());
}
Aggregations