use of com.redhat.ceylon.compiler.java.codegen.ParameterAnnotationTerm in project ceylon-compiler by ceylon.
the class AnnotationLoader method decode.
private AnnotationTerm decode(Module moduleScope, List<Parameter> sourceParameters, AnnotationInvocation info, Parameter parameter, AnnotatedMirror dpm, List<AnnotationFieldName> path, int code) {
AnnotationTerm result;
if (code == Short.MIN_VALUE) {
return findLiteralAnnotationTerm(moduleScope, path, parameter, dpm);
} else if (code < 0) {
InvocationAnnotationTerm invocation = new InvocationAnnotationTerm();
result = invocation;
} else if (code >= 0 && code < 512) {
ParameterAnnotationTerm parameterArgument = new ParameterAnnotationTerm();
boolean spread = false;
if (code >= 256) {
spread = true;
code -= 256;
}
parameterArgument.setSpread(spread);
Parameter sourceParameter = sourceParameters.get(code);
parameterArgument.setSourceParameter(sourceParameter);
//result.setTargetParameter(sourceParameter);
result = parameterArgument;
} else {
throw new RuntimeException();
}
return result;
}
use of com.redhat.ceylon.compiler.java.codegen.ParameterAnnotationTerm 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