Package ceylon.language.meta.model

Examples of ceylon.language.meta.model.IncompatibleTypeException


        checkInit();
        final FreeClassOrInterface type = declaration.findType(name);
        if(type == null)
            return null;
        if(type instanceof FreeClass == false)
            throw new IncompatibleTypeException("Specified member is not a class: "+name);
        MemberLookup<FreeClass, Container> lookup = lookupMember(FreeClass.$TypeDescriptor$, $reifiedContainer, (FreeClass)type);
        if(lookup == null)
            return null;
        return lookup.declaration.memberClassApply($reifiedContainer, $reifiedType, $reifiedArguments,
                                                   lookup.containerMetamodel, types);
View Full Code Here


        checkInit();
        final FreeClassOrInterface type = declaration.findDeclaredType(name);
        if(type == null)
            return null;
        if(type instanceof FreeClass == false)
            throw new IncompatibleTypeException("Specified member is not a class: "+name);
        // do not return the attribute if the container is not a subtype of this type
        ProducedType reifiedContainer = Metamodel.getProducedType($reifiedContainer);
        if(!reifiedContainer.isSubtypeOf(producedType))
            return null;
        return ((FreeClass)type).memberClassApply($reifiedContainer, $reifiedType, $reifiedArguments,
View Full Code Here

        checkInit();
        final FreeClassOrInterface type = declaration.findType(name);
        if(type == null)
            return null;
        if(type instanceof FreeInterface == false)
            throw new IncompatibleTypeException("Specified member is not an interface: "+name);
        MemberLookup<FreeInterface, Container> lookup = lookupMember(FreeInterface.$TypeDescriptor$, $reifiedContainer, (FreeInterface)type);
        if(lookup == null)
            return null;
       
        return (ceylon.language.meta.model.MemberInterface<Container, Type>)
View Full Code Here

        checkInit();
        final FreeClassOrInterface type = declaration.findDeclaredType(name);
        if(type == null)
            return null;
        if(type instanceof FreeInterface == false)
            throw new IncompatibleTypeException("Specified member is not an interface: "+name);
        // do not return the attribute if the container is not a subtype of this type
        ProducedType reifiedContainer = Metamodel.getProducedType($reifiedContainer);
        if(!reifiedContainer.isSubtypeOf(producedType))
            return null;
        return (ceylon.language.meta.model.MemberInterface<Container, Type>)
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public java.lang.Object $setIfAssignable(@Name("newValue") @TypeInfo("ceylon.language::Anything") java.lang.Object newValue){
        ProducedType newValueType = Metamodel.getProducedType(newValue);
        if(!newValueType.isSubtypeOf(this.producedType))
            throw new IncompatibleTypeException("Invalid new value type: "+newValueType+", expecting: "+this.producedType);
        return set((Set) newValue);
    }
View Full Code Here

        if(!check){
            String appliedTypeString = appliedType.getProducedTypeName();
            String expectedReifiedTypeString = expectedReifiedType.getProducedTypeName();
            String appliedString = className.replace("$1", appliedTypeString);
            String expectedString = className.replace("$1", expectedReifiedTypeString);
            throw new IncompatibleTypeException("Incompatible type: actual type of applied declaration is "+appliedString
                    +" is not compatible with expected type: "+expectedString+". Try passing the type argument explicitly with: "
                    +methodName+"<"+appliedTypeString+">()");
        }
    }
View Full Code Here

            String expectedReifiedTypeString1 = expectedReifiedType1.getProducedTypeName();
            String appliedTypeString2 = appliedType2.getProducedTypeName();
            String expectedReifiedTypeString2 = expectedReifiedType2.getProducedTypeName();
            String appliedString = className.replace("$1", appliedTypeString1).replace("$2", appliedTypeString2);
            String expectedString = className.replace("$1", expectedReifiedTypeString1).replace("$2", expectedReifiedTypeString2);
            throw new IncompatibleTypeException("Incompatible type: actual type of applied declaration is "+appliedString
                    +" is not compatible with expected type: "+expectedString+". Try passing the type argument explicitly with: "
                    +methodName+"<"+appliedTypeString1+","+appliedTypeString2+">()");
        }
    }
View Full Code Here

            String expectedReifiedTypeString2 = expectedReifiedType2.getProducedTypeName();
            String appliedTypeString3 = appliedType3.getProducedTypeName();
            String expectedReifiedTypeString3 = expectedReifiedType3.getProducedTypeName();
            String appliedString = className.replace("$1", appliedTypeString1).replace("$2", appliedTypeString2).replace("$3", appliedTypeString3);
            String expectedString = className.replace("$1", expectedReifiedTypeString1).replace("$2", expectedReifiedTypeString2).replace("$3", expectedReifiedTypeString3);
            throw new IncompatibleTypeException("Incompatible type: actual type of applied declaration is "+appliedString
                    +" is not compatible with expected type: "+expectedString+". Try passing the type argument explicitly with: "
                    +methodName+"<"+appliedTypeString1+","+appliedTypeString2+","+appliedTypeString3+">()");
        }
    }
View Full Code Here

    }

    public static void checkQualifyingType(ProducedType qualifyingType, Declaration declaration) {
        Scope container = declaration.getContainer();
        if(container instanceof TypeDeclaration == false)
            throw new IncompatibleTypeException("Declaration container is not a type: "+container);
        TypeDeclaration typeDecl = (TypeDeclaration) container;
        ProducedType supertype = qualifyingType.getSupertype(typeDecl);
        if(supertype == null)
            throw new IncompatibleTypeException("Invalid container type: "+qualifyingType+" is not a subtype of "+typeDecl);
    }
View Full Code Here

                    parameterProducedTypes.get(i)
                    // variadic param
                    : variadicElement;
            ProducedType argumentType = Metamodel.getProducedType(arg);
            if(!argumentType.isSubtypeOf(parameterType))
                throw new IncompatibleTypeException("Invalid argument "+i+", expected type "+parameterType+" but got "+argumentType);
            i++;
        }
        // they are all good, let's call it
        return Util.apply(function, arguments);
    }
View Full Code Here

TOP

Related Classes of ceylon.language.meta.model.IncompatibleTypeException

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.