use of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation in project ceylon-compiler by ceylon.
the class AnnotationLoader method loadAnnotationArgumentTerm.
private AnnotationTerm loadAnnotationArgumentTerm(List<AnnotationFieldName> path, LazyFunction method, AnnotationInvocation ai, Parameter parameter, List<AnnotationMirror> annotationTree, AnnotatedMirror dpm, short code) {
if (code < 0 && code != Short.MIN_VALUE) {
AnnotationMirror i = annotationTree.get(-code);
AnnotationInvocation nested = new AnnotationInvocation();
setPrimaryFromAnnotationInvocationAnnotation(i, nested);
loadAnnotationInvocationArguments(path, method, nested, i, annotationTree, dpm);
InvocationAnnotationTerm term = new InvocationAnnotationTerm();
term.setInstantiation(nested);
return term;
} else {
AnnotationTerm term = decode(Decl.getModuleContainer(method), method.getFirstParameterList().getParameters(), ai, parameter, dpm, path, code);
return term;
}
}
use of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation in project ceylon-compiler by ceylon.
the class AnnotationLoader method loadAnnotationInvocation.
private AnnotationInvocation loadAnnotationInvocation(LazyFunction method, AnnotatedMirror annoInstMirror, MethodMirror meth) {
AnnotationInvocation ai = null;
AnnotationMirror annotationInvocationAnnotation = null;
List<AnnotationMirror> annotationTree = getAnnotationArrayValue(annoInstMirror, AbstractModelLoader.CEYLON_ANNOTATION_INSTANTIATION_TREE_ANNOTATION, "value");
if (annotationTree != null && !annotationTree.isEmpty()) {
annotationInvocationAnnotation = annotationTree.get(0);
} else {
annotationInvocationAnnotation = annoInstMirror.getAnnotation(AbstractModelLoader.CEYLON_ANNOTATION_INSTANTIATION_ANNOTATION);
}
//stringValueAnnotation = annoInstMirror.getAnnotation(CEYLON_STRING_VALUE_ANNOTATION);
if (annotationInvocationAnnotation != null) {
ai = new AnnotationInvocation();
setPrimaryFromAnnotationInvocationAnnotation(annotationInvocationAnnotation, ai);
loadAnnotationInvocationArguments(new ArrayList<AnnotationFieldName>(2), method, ai, annotationInvocationAnnotation, annotationTree, annoInstMirror);
}
return ai;
}
use of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation in project ceylon-compiler by ceylon.
the class AnnotationLoader method setAnnotationConstructor.
public void setAnnotationConstructor(LazyFunction method, MethodMirror meth) {
AnnotationInvocation ai = loadAnnotationInvocation(method, method.classMirror, meth);
if (ai != null) {
loadAnnotationConstructorDefaultedParameters(method, meth, ai);
ai.setConstructorDeclaration(method);
method.setAnnotationConstructor(ai);
}
}
use of com.redhat.ceylon.compiler.java.codegen.AnnotationInvocation in project ceylon-compiler by ceylon.
the class AnnotationLoader method makeInterorAnnotationConstructorInvocation.
public void makeInterorAnnotationConstructorInvocation(AnnotationProxyMethod ctor, AnnotationProxyClass klass, java.util.List<Parameter> ctorParams) {
AnnotationInvocation ai = new AnnotationInvocation();
ai.setConstructorDeclaration(ctor);
ai.setPrimary(klass);
ai.setInterop(true);
ctor.setAnnotationConstructor(ai);
java.util.List<AnnotationArgument> annotationArgs = new ArrayList<AnnotationArgument>();
for (Parameter ctorParam : ctorParams) {
boolean isValue = ctorParam.getName().equals("value");
ParameterAnnotationTerm term = new ParameterAnnotationTerm();
AnnotationArgument argument = new AnnotationArgument();
argument.setTerm(term);
argument.setParameter(klass.getParameter(ctorParam.getName()));
term.setSourceParameter(ctorParam);
AnnotationConstructorParameter acp = new AnnotationConstructorParameter();
acp.setParameter(ctorParam);
if (isValue)
ai.getConstructorParameters().add(0, acp);
else
ai.getConstructorParameters().add(acp);
annotationArgs.add(argument);
}
ai.getAnnotationArguments().addAll(annotationArgs);
}
Aggregations