Package com.redhat.ceylon.compiler.java.runtime.model

Examples of com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor


        ceylon.language.meta.model.Member<? extends Container, ceylon.language.meta.model.ClassOrInterface<?>> member
            = getAppliedClassOrInterface(null, null, typeArguments, containerType);
       
        // This is all very ugly but we're trying to make it cheaper and friendlier than just checking the full type and showing
        // implementation types to the user, such as AppliedMemberClass
        TypeDescriptor actualReifiedContainer;
        if(member instanceof AppliedMemberClass)
            actualReifiedContainer = ((AppliedMemberClass)member).$reifiedContainer;
        else
            actualReifiedContainer = ((AppliedMemberInterface)member).$reifiedContainer;
        ProducedType actualType = Metamodel.getModel((ceylon.language.meta.model.Type<?>) member);
View Full Code Here


        }
        else if (this.array.length == 1) {
            return (Rest)rest;
        }
        else {
            TypeDescriptor typeArg = ((TypeDescriptor.Class)
                ((TypeDescriptor.Class)$getType$()).getTypeArguments()[2])
                .getTypeArguments()[0];
      java.lang.Object[] copy =
          Arrays.copyOfRange(this.array, 1, this.array.length);
      return (Rest) new Tuple(typeArg, copy, rest, false);
View Full Code Here

   
    @Override
    @Ignore
    public TypeDescriptor $getType$() {
        SoftReference<TypeDescriptor> cachedType = $cachedType;
        TypeDescriptor type = cachedType!=null ? cachedType.get() : null;
        if (type==null) {
            synchronized (this) {
                cachedType = $cachedType;
                type = cachedType!=null ? cachedType.get() : null;
                if (type==null) {
View Full Code Here

        }
        return type;
    }

    private TypeDescriptor computeType() {
        TypeDescriptor restType = getTypeDescriptor(rest);
        TypeDescriptor elementType =
                Metamodel.getIteratedTypeDescriptor(restType);
        for (int i=array.length-1; i>=0; i--) {
            TypeDescriptor elemType = $getElementType(i);
            elementType = TypeDescriptor.union(elementType, elemType);
            restType = TypeDescriptor.klass(Tuple.class,
                    elementType, elemType, restType);
        }
        return restType;
View Full Code Here

        // Don't call super.$serialize$() since our runtime super class is
        // an implementation detail
        Generic myTd = (TypeDescriptor.Generic)$getType$();
        Deconstructor dtor = deconstructor.$call$(ceylon.language.meta.typeLiteral_.typeLiteral(myTd));
       
        TypeDescriptor reifiedElement = myTd.getTypeArguments()[0];
        TypeDescriptor reifiedFirst = myTd.getTypeArguments()[1];
        TypeDescriptor reifiedRest = myTd.getTypeArguments()[2];
       
        dtor.putTypeArgument(
                ((GenericDeclaration)Metamodel.getOrCreateMetamodel(Tuple.class)).getTypeParameterDeclaration("Element"),
                Metamodel.getAppliedMetamodel(reifiedElement));
       
View Full Code Here

    public void $deserialize$(Deconstructed deconstructed) {
        // Don't call super.$deserialize$() since our runtime super class is
        // an implementation detail
        try {
            // hack: recover the reified type arguments stored in the array
            TypeDescriptor reifiedFirst = (TypeDescriptor)this.array[0];
            TypeDescriptor reifiedRest = (TypeDescriptor)this.array[1];
           
            ValueDeclaration firstAttribute = (ValueDeclaration)((ClassDeclaration)Metamodel.getOrCreateMetamodel(Tuple.class)).getMemberDeclaration(ValueDeclaration.$TypeDescriptor$, "first");
            ValueDeclaration restAttribute = (ValueDeclaration)((ClassDeclaration)Metamodel.getOrCreateMetamodel(Tuple.class)).getMemberDeclaration(ValueDeclaration.$TypeDescriptor$, "rest");
           
            java.lang.Object firstValOrRef = deconstructed.<First>getValue(reifiedFirst, firstAttribute);
View Full Code Here

    public static <T> Array<T> instance(T[] array) {
        if (array == null) {
            return null;
        }
        java.lang.Class<?> componentType = array.getClass().getComponentType();
        TypeDescriptor optionalType = TypeDescriptor.union(Null.$TypeDescriptor$,
                TypeDescriptor.klass(componentType));
        return new Array<T>(optionalType, array);
    }
View Full Code Here

            return DoubleArray.$TypeDescriptor$;
        if(klass == boolean[].class)
            return BooleanArray.$TypeDescriptor$;
        if(klass == char[].class)
            return CharArray.$TypeDescriptor$;
        TypeDescriptor componentType = getJavaTypeDescriptor(klass.getComponentType());
        return TypeDescriptor.klass(ObjectArray.class, componentType);
    }
View Full Code Here

    public static boolean isReified(java.lang.Object o, TypeDescriptor type){
        if (o == null) {
            return type.containsNull();
        }
        TypeDescriptor instanceType = getTypeDescriptor(o);
        if(instanceType == null)
            return false;
        return getProducedType(instanceType).isSubtypeOf(getProducedType(type));
    }
View Full Code Here

            return false;
        return getProducedType(instanceType).isSubtypeOf(getProducedType(type));
    }

    public static ProducedType getProducedType(Object instance) {
        TypeDescriptor instanceType = getTypeDescriptor(instance);
        if(instanceType == null)
            throw Metamodel.newModelError("Metamodel not yet supported for Java types");
        return getProducedType(instanceType);
    }
View Full Code Here

TOP

Related Classes of com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.