use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method transform.
protected void transform(XtendField source, JvmGenericType container) {
if ((source.isExtension() && source.getType() != null) || source.getName() != null) {
JvmField field = typesFactory.createJvmField();
final String computeFieldName = computeFieldName(source);
field.setSimpleName(computeFieldName);
container.getMembers().add(field);
associator.associatePrimary(source, field);
field.setVisibility(source.getVisibility());
field.setStatic(source.isStatic());
field.setTransient(source.isTransient());
field.setVolatile(source.isVolatile());
field.setFinal(source.isFinal());
if (source.getType() != null) {
field.setType(jvmTypesBuilder.cloneWithProxies(source.getType()));
} else if (source.getInitialValue() != null) {
field.setType(jvmTypesBuilder.inferredType(source.getInitialValue()));
}
for (XAnnotation anno : source.getAnnotations()) {
if (!annotationTranslationFilter.apply(anno))
continue;
JvmAnnotationReference annotationReference = jvmTypesBuilder.getJvmAnnotationReference(anno);
if (annotationReference != null)
field.getAnnotations().add(annotationReference);
}
if (source.isExtension() && typeReferences.findDeclaredType(Extension.class, source) != null) {
field.getAnnotations().add(_annotationTypesBuilder.annotationRef(Extension.class));
}
jvmTypesBuilder.copyDocumentationTo(source, field);
jvmTypesBuilder.setInitializer(field, source.getInitialValue());
initializeLocalTypes(field, source.getInitialValue());
}
}
use of org.eclipse.xtext.common.types.JvmAnnotationReference in project xtext-xtend by eclipse.
the class MemberFromSuperImplementor method initializeExecutableBuilder.
protected void initializeExecutableBuilder(final AbstractExecutableBuilder builder, final JvmDeclaredType overrider, final IResolvedExecutable overridden) {
final JvmExecutable executable = overridden.getDeclaration();
builder.setContext(overrider);
builder.setVisibility(overridden.getDeclaration().getVisibility());
final Procedure2<LightweightTypeReference, Integer> _function = (LightweightTypeReference it, Integer index) -> {
final JvmFormalParameter declaredParameter = executable.getParameters().get((index).intValue());
final AbstractParameterBuilder parameterBuilder = builder.newParameterBuilder();
parameterBuilder.setName(declaredParameter.getSimpleName());
parameterBuilder.setType(it);
JvmAnnotationReference _findAnnotation = this.annotationLookup.findAnnotation(declaredParameter, Extension.class);
boolean _tripleNotEquals = (_findAnnotation != null);
parameterBuilder.setExtensionFlag(_tripleNotEquals);
};
IterableExtensions.<LightweightTypeReference>forEach(overridden.getResolvedParameterTypes(), _function);
builder.setVarArgsFlag(executable.isVarArgs());
builder.setExceptions(overridden.getResolvedExceptions());
}
Aggregations