Search in sources :

Example 21 with TypeMirror

use of org.eclipse.ceylon.model.loader.mirror.TypeMirror in project ceylon by eclipse.

the class AbstractModelLoader method isCoercedMethod.

private boolean isCoercedMethod(MethodMirror methodMirror) {
    List<VariableMirror> parameters = methodMirror.getParameters();
    for (int i = 0; i < parameters.size(); i++) {
        VariableMirror param = parameters.get(i);
        TypeMirror type = param.getType();
        if (methodMirror.isVariadic() && i == parameters.size() - 1) {
            type = type.getComponentType();
        }
        if (isCoercedType(type))
            return true;
    }
    return false;
}
Also used : TypeMirror(org.eclipse.ceylon.model.loader.mirror.TypeMirror) VariableMirror(org.eclipse.ceylon.model.loader.mirror.VariableMirror)

Example 22 with TypeMirror

use of org.eclipse.ceylon.model.loader.mirror.TypeMirror in project ceylon by eclipse.

the class ReflectionClass method getInterfaces.

@Override
public List<TypeMirror> getInterfaces() {
    if (interfaces != null)
        return interfaces;
    Type[] javaInterfaces = klass.getGenericInterfaces();
    interfaces = new ArrayList<TypeMirror>(javaInterfaces.length);
    for (Type javaInterface : javaInterfaces) interfaces.add(new ReflectionType(javaInterface));
    return interfaces;
}
Also used : Type(java.lang.reflect.Type) TypeMirror(org.eclipse.ceylon.model.loader.mirror.TypeMirror)

Example 23 with TypeMirror

use of org.eclipse.ceylon.model.loader.mirror.TypeMirror in project ceylon by eclipse.

the class ReflectionTypeParameter method getBounds.

@Override
public List<TypeMirror> getBounds() {
    if (bounds != null)
        return bounds;
    Type[] javaBounds = type.getBounds();
    bounds = new ArrayList<TypeMirror>(javaBounds.length);
    for (Type bound : javaBounds) bounds.add(new ReflectionType(bound));
    return bounds;
}
Also used : Type(java.lang.reflect.Type) TypeMirror(org.eclipse.ceylon.model.loader.mirror.TypeMirror)

Aggregations

TypeMirror (org.eclipse.ceylon.model.loader.mirror.TypeMirror)23 FunctionalInterfaceType (org.eclipse.ceylon.model.loader.mirror.FunctionalInterfaceType)10 Type (org.eclipse.ceylon.model.typechecker.model.Type)10 UnknownType (org.eclipse.ceylon.model.typechecker.model.UnknownType)10 ArrayList (java.util.ArrayList)7 TypeDeclaration (org.eclipse.ceylon.model.typechecker.model.TypeDeclaration)6 AnnotationMirror (org.eclipse.ceylon.model.loader.mirror.AnnotationMirror)5 Type (org.eclipse.ceylon.langtools.tools.javac.code.Type)4 LazyFunction (org.eclipse.ceylon.model.loader.model.LazyFunction)4 TypeParameter (org.eclipse.ceylon.model.typechecker.model.TypeParameter)4 Type (java.lang.reflect.Type)3 ClassMirror (org.eclipse.ceylon.model.loader.mirror.ClassMirror)3 TypeParameterMirror (org.eclipse.ceylon.model.loader.mirror.TypeParameterMirror)3 LazyClass (org.eclipse.ceylon.model.loader.model.LazyClass)3 LazyValue (org.eclipse.ceylon.model.loader.model.LazyValue)3 ClassOrInterface (org.eclipse.ceylon.model.typechecker.model.ClassOrInterface)3 Declaration (org.eclipse.ceylon.model.typechecker.model.Declaration)3 Function (org.eclipse.ceylon.model.typechecker.model.Function)3 Module (org.eclipse.ceylon.model.typechecker.model.Module)3 ParameterList (org.eclipse.ceylon.model.typechecker.model.ParameterList)3