Search in sources :

Example 1 with MethodMirror

use of com.redhat.ceylon.model.loader.mirror.MethodMirror in project ceylon-compiler by ceylon.

the class AnnotationLoader method loadAnnotationConstructorDefaultedParameter.

private AnnotationTerm loadAnnotationConstructorDefaultedParameter(LazyFunction method, MethodMirror meth, Parameter ctorParam, AnnotationConstructorParameter acp) {
    // Find the method mirror for the DPM
    for (MethodMirror mm : method.classMirror.getDirectMethods()) {
        if (mm.getName().equals(Naming.getDefaultedParamMethodName(method, ctorParam))) {
            // Create the appropriate AnnotationTerm
            if (mm.getAnnotation(AbstractModelLoader.CEYLON_ANNOTATION_INSTANTIATION_ANNOTATION) != null) {
                // If the DPM has a @AnnotationInstantiation
                // then it must be an invocation term so recurse
                InvocationAnnotationTerm invocationTerm = new InvocationAnnotationTerm();
                invocationTerm.setInstantiation(loadAnnotationInvocation(method, mm, meth));
                return invocationTerm;
            } else {
                return loadLiteralAnnotationTerm(method, ctorParam, mm);
            }
        }
    }
    return null;
}
Also used : MethodMirror(com.redhat.ceylon.model.loader.mirror.MethodMirror) InvocationAnnotationTerm(com.redhat.ceylon.compiler.java.codegen.InvocationAnnotationTerm)

Example 2 with MethodMirror

use of com.redhat.ceylon.model.loader.mirror.MethodMirror in project ceylon-compiler by ceylon.

the class JavacClass method getDirectMethods.

@Override
public List<MethodMirror> getDirectMethods() {
    if (methods == null) {
        List<MethodMirror> ret = new LinkedList<MethodMirror>();
        for (Symbol sym : classSymbol.getEnclosedElements()) {
            if (sym instanceof MethodSymbol && (sym.flags() & Flags.PRIVATE) == 0) {
                ret.add(new JavacMethod(this, (MethodSymbol) sym));
            }
        }
        methods = Collections.unmodifiableList(ret);
    }
    return methods;
}
Also used : MethodMirror(com.redhat.ceylon.model.loader.mirror.MethodMirror) MethodSymbol(com.sun.tools.javac.code.Symbol.MethodSymbol) MethodSymbol(com.sun.tools.javac.code.Symbol.MethodSymbol) Symbol(com.sun.tools.javac.code.Symbol) ClassSymbol(com.sun.tools.javac.code.Symbol.ClassSymbol) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol) LinkedList(java.util.LinkedList)

Aggregations

MethodMirror (com.redhat.ceylon.model.loader.mirror.MethodMirror)2 InvocationAnnotationTerm (com.redhat.ceylon.compiler.java.codegen.InvocationAnnotationTerm)1 Symbol (com.sun.tools.javac.code.Symbol)1 ClassSymbol (com.sun.tools.javac.code.Symbol.ClassSymbol)1 MethodSymbol (com.sun.tools.javac.code.Symbol.MethodSymbol)1 VarSymbol (com.sun.tools.javac.code.Symbol.VarSymbol)1 LinkedList (java.util.LinkedList)1