Examples of TypeCheckError


Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

  if (_arg instanceof LiteralExpr) {
      return _type = Type.Boolean;
  }
  ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
      "function-available", this);
  throw new TypeCheckError(err);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
  final int argc = argumentCount();
  if (argc > 1) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
      throw new TypeCheckError(err);
  }

  if (argc > 0) {
      argument().typeCheck(stable);
  }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

      */
      else if (ftype instanceof NodeType)  {
    _filterExpr = new CastExpr(_filterExpr, Type.NodeSet);
      }
      else {
    throw new TypeCheckError(this);
      }
  }

  // Wrap single node path in a node set
  final Type ptype = _path.typeCheck(stable);
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

  }
  if (_type instanceof NodeSetType||_type instanceof ResultTreeType) {
      typeCheckContents(stable);
      return Type.Void;
  }
  throw new TypeCheckError(this);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

  // Check that the function was passed exactly two arguments
  if (argumentCount() != 2) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR,
          getName(), this);
      throw new TypeCheckError(err);
  }

  // The first argument must be a String, or cast to a String
  _base = argument(0);
  Type baseType = _base.typeCheck(stable)
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

  if (argument() instanceof LiteralExpr) {
      return _type = Type.Boolean;
  }
  ErrorMsg err = new ErrorMsg(ErrorMsg.NEED_LITERAL_ERR,
            "element-available", this);
  throw new TypeCheckError(err);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

      if (!arg2.identicalTo(tright)) {
    _right = new CastExpr(_right, arg1);
      }
      return _type = ptype.resultType();
  }
  throw new TypeCheckError(this);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {

  // Check that the function was passed exactly two arguments
  if (argumentCount() != 2) {
      throw new TypeCheckError(ErrorMsg.ILLEGAL_ARG_ERR, getName(), this);
  }

  // The first argument must be a String, or cast to a String
  _base = argument(0);
  Type baseType = _base.typeCheck(stable)
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

    if (!argType.identicalTo(exp.getType())) {
        try {
      _arguments.setElementAt(new CastExpr(exp, argType), i);
        }
        catch (TypeCheckError e) {
      throw new TypeCheckError(this)// invalid conversion
        }
    }
      }
      _chosenMethodType = ptype;
      return _type = ptype.resultType();
  }
  throw new TypeCheckError(this);
    }
View Full Code Here

Examples of org.apache.xalan.xsltc.compiler.util.TypeCheckError

    public Type typeCheckConstructor(SymbolTable stable) throws TypeCheckError{
        final Vector constructors = findConstructors();
  if (constructors == null) {
            // Constructor not found in this class
            throw new TypeCheckError(ErrorMsg.CONSTRUCTOR_NOT_FOUND,
    _className);
       
  }

  final int nConstructors = constructors.size();
  final int nArgs = _arguments.size();
  final Vector argsType = typeCheckArgs(stable);

  // Try all constructors
  int bestConstrDistance = Integer.MAX_VALUE;
  _type = null;      // reset
  for (int j, i = 0; i < nConstructors; i++) {
      // Check if all parameters to this constructor can be converted
      final Constructor constructor =
    (Constructor)constructors.elementAt(i);
      final Class[] paramTypes = constructor.getParameterTypes();

      Class extType = null;
      int currConstrDistance = 0;
      for (j = 0; j < nArgs; j++) {
    // Convert from internal (translet) type to external (Java) type
    extType = paramTypes[j];
    final Type intType = (Type)argsType.elementAt(j);
    Object match = _internal2Java.maps(intType, extType);
    if (match != null) {
        currConstrDistance += ((JavaType)match).distance;
    }
    else if (intType instanceof ObjectType) {
        ObjectType objectType = (ObjectType)intType;
        if (objectType.getJavaClass() == extType)
            continue;
        else if (extType.isAssignableFrom(objectType.getJavaClass()))
            currConstrDistance += 1;
        else {
      currConstrDistance = Integer.MAX_VALUE;
      break;
        }
    }
    else {
        // no mapping available
        currConstrDistance = Integer.MAX_VALUE;
        break;
    }
      }

      if (j == nArgs && currConstrDistance < bestConstrDistance ) {
          _chosenConstructor = constructor;
          _isExtConstructor = true;
    bestConstrDistance = currConstrDistance;
   
                _type = (_clazz != null) ? Type.newObjectType(_clazz)
                    : Type.newObjectType(_className);
      }
  }

  if (_type != null) {
      return _type;
  }

  throw new TypeCheckError(ErrorMsg.ARGUMENT_CONVERSION_ERR, getMethodSignature(argsType));
    }
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.