Examples of Types


Examples of com.github.sviperll.adt4j.model.util.Types

        return acceptingInterface;
    }

    ValueClassModel createValueClass(ValueVisitorInterfaceModel visitorInterface) throws SourceException, CodeGenerationException {
        try {
            Types types = Types.createInstance(jpackage.owner());
            if (annotation.valueClassIsSerializable()) {
                for (JMethod interfaceMethod: visitorInterface.methods()) {
                    for (JVar param: interfaceMethod.params()) {
                        AbstractJType type = param.type();
                        if (!visitorInterface.isSelf(type) && !types.isSerializable(type))
                            throw new SourceException("Value class can't be serializable: " + param.name() + " parameter in " + interfaceMethod.name() + " method is not serializable");
                    }
                    JVar param = interfaceMethod.listVarParam();
                    if (param != null) {
                        AbstractJType type = param.type();
                        if (!visitorInterface.isSelf(type) && !types.isSerializable(type))
                            throw new SourceException("Value class can't be serializable: " + param.name() + " parameter in " + interfaceMethod.name() + " method is not serializable");
                    }
                }
            }

            if (annotation.valueClassIsComparable()) {
                for (JMethod interfaceMethod: visitorInterface.methods()) {
                    for (JVar param: interfaceMethod.params()) {
                        AbstractJType type = param.type();
                        if (!visitorInterface.isSelf(type) && !types.isComparable(type))
                            throw new SourceException("Value class can't be comparable: " + param.name() + " parameter in " + interfaceMethod.name() + " method is not comparable");
                    }
                    JVar param = interfaceMethod.listVarParam();
                    if (param != null) {
                        AbstractJType type = param.type();
                        if (!visitorInterface.isSelf(type) && !types.isComparable(type))
                            throw new SourceException("Value class can't be comparable: " + param.name() + " parameter in " + interfaceMethod.name() + " method is not comparable");
                    }
                }
            }
View Full Code Here

Examples of com.sun.mirror.util.Types

    private static final Context.Key<Types> typesKey =
            new Context.Key<Types>();

    public static Types instance(Context context) {
        Types instance = context.get(typesKey);
        if (instance == null) {
            instance = new TypesImpl(context);
        }
        return instance;
    }
View Full Code Here

Examples of com.sun.tools.javac.code.Types

    super(typeToCompare);
  }

  @Override
  public boolean matches(T tree, VisitorState state) {
    Types types = state.getTypes();
    Type typeToCompare = typeToCompareSupplier.get(state);
    return (typeToCompare != null &&
        types.isSubtype(((JCTree) tree).type, types.erasure(typeToCompare)));
  }
View Full Code Here

Examples of javax.lang.model.util.Types

        assert element != null;
        if (element.getKind() == ElementKind.METHOD) {
            return true;
        }
        if (element.getKind() == ElementKind.CLASS) {
            Types typeUtils = environment.getTypeUtils();
            DeclaredType type = typeUtils.getDeclaredType((TypeElement) element);
            return typeUtils.isSubtype(type, environment.getDeclaredType(FlowDescription.class));
        }
        return false;
    }
View Full Code Here

Examples of javax.lang.model.util.Types

            ConcreteDataModelMirror that = (ConcreteDataModelMirror) other;
            return environment.getTypeUtils().isSameType(this.type, that.type);
        }
        if (other instanceof PartialDataModelMirror) {
            PartialDataModelMirror that = (PartialDataModelMirror) other;
            Types typeUtils = environment.getTypeUtils();
            return typeUtils.isSubtype(this.type, that.type.getUpperBound())
                && typeUtils.isSubtype(that.type.getLowerBound(), this.type);
        }
        return false;
    }
View Full Code Here

Examples of javax.lang.model.util.Types

    @Override
    public boolean canContain(DataModelMirror other) {
        Precondition.checkMustNotBeNull(other, "other"); //$NON-NLS-1$
        if (other instanceof PartialDataModelMirror) {
            PartialDataModelMirror that = (PartialDataModelMirror) other;
            Types typeUtils = environment.getTypeUtils();
            return typeUtils.isSubtype(this.type, that.type.getUpperBound())
                && typeUtils.isSubtype(that.type.getLowerBound(), this.type);
        }
        return false;
    }
View Full Code Here

Examples of javax.lang.model.util.Types

                executable.getParameters().get(parameterIndex));
        sawError = true;
    }

    boolean typeEqual(TypeMirror a, TypeMirror b) {
        Types types = environment.getTypeUtils();
        return types.isSameType(a, b);
    }
View Full Code Here

Examples of javax.lang.model.util.Types

            return false;
        }
        if (b.getKind() != TypeKind.DECLARED) {
            return false;
        }
        Types types = environment.getTypeUtils();
        if (types.isSameType(a, b)) {
            return true;
        }
        // EclipseJDTのバグでerasureは正しく計算されない模様
        DeclaredType at = (DeclaredType) a;
        DeclaredType bt = (DeclaredType) b;
View Full Code Here

Examples of javax.lang.model.util.Types

        public String findInput(TypeMirror type) {
            Precondition.checkMustNotBeNull(type, "type"); //$NON-NLS-1$
            if (type.getKind() != TypeKind.TYPEVAR) {
                return null;
            }
            Types types = context.environment.getTypeUtils();
            for (OperatorPortDeclaration input : inputPorts) {
                if (types.isSameType(type, input.getType().getRepresentation())) {
                    return input.getName();
                }
            }
            return null;
        }
View Full Code Here

Examples of javax.lang.model.util.Types

            List<OperatorPortDeclaration> inputPorts,
            List<OperatorPortDeclaration> parameters) {
        assert output != null;
        assert inputPorts != null;
        assert parameters != null;
        Types types = environment.getTypeUtils();
        TypeMirror outputType = output.getType().getRepresentation();
        for (OperatorPortDeclaration input : inputPorts) {
            if (types.isSameType(outputType, input.getType().getRepresentation())) {
                return new OperatorPortDeclaration(
                        output.getKind(),
                        output.getDocumentation(),
                        output.getName(),
                        PortTypeDescription.reference(outputType, input.getName()),
                        output.getParameterPosition(),
                        null);
            }
        }
        DeclaredType classType = environment.getDeclaredType(Class.class);
        for (OperatorPortDeclaration param : parameters) {
            // check is form of M<T>
            TypeMirror paramType = param.getType().getRepresentation();
            if (paramType.getKind() != TypeKind.DECLARED) {
                continue;
            }
            DeclaredType declParamType = (DeclaredType) paramType;
            if (declParamType.getTypeArguments().size() != 1) {
                continue;
            }
            // check is <: Class<?>
            if (types.isSameType(environment.getErasure(paramType), classType) == false) {
                continue;
            }
            if (types.isSameType(declParamType.getTypeArguments().get(0), outputType)) {
                return new OperatorPortDeclaration(
                        output.getKind(),
                        output.getDocumentation(),
                        output.getName(),
                        PortTypeDescription.reference(outputType, param.getName()),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.