Package xscript.runtime

Examples of xscript.runtime.XRuntimeException


    return Double.longBitsToDouble(pop(XPrimitive.DOUBLE));
  }

  public void push(long value, int type) {
    if(stackPointer==stack.length)
      throw new XRuntimeException("Stack overflow");
    stackType[stackPointer] = (byte) type;
    stack[stackPointer++] = value;
  }
View Full Code Here


  public abstract XClass getXClass(XVirtualMachine virtualMachine);
 
  public XClass getXClassNonNull(XVirtualMachine virtualMachine){
    XClass xClass = getXClass(virtualMachine);
    if(xClass==null)
      throw new XRuntimeException("Can't get class because it's a generic argument");
    return xClass;
  }
View Full Code Here

    push(Double.doubleToLongBits(value), XPrimitive.DOUBLE);
  }

  public long getLocal(int local) {
    if(local<0 || local>=this.local.length)
      throw new XRuntimeException("Local out of bounds %s", local);
    return this.local[local];
  }
View Full Code Here

    return this.local[local];
  }

  public void setLocal(int local, long value) {
    if(local<0 || local>=this.local.length)
      throw new XRuntimeException("Local out of bounds %s", local);
    this.local[local] = value;
  }
View Full Code Here

    if(XModifier.isFinal(field.getModifier())){
      XObject _this = vm.getObjectProvider().getObject(methodExecutor.getLocal(0));
      if(methodExecutor.getMethod().getSimpleName().equals("<init>") && _this==object){
        field.finalSet(object, value);
      }else{
        throw new XRuntimeException("Try to write final field %s", field.getName());
      }
    }else{
      field.set(object, value);
    }
  }
View Full Code Here

    if(field==null){
      XClass xClass = vm.getClassProvider().getXClass(className);
      field = xClass.getField(fieldName);
      XChecks.checkAccess(methodExecutor.getMethod().getDeclaringClass(), field);
      if(!field.getType().equals(fieldType)){
        throw new XRuntimeException("Type of field %s has changed", field);
      }
      if(XModifier.isStatic(field.getModifier())){
        throw new XRuntimeException("Field %s is static", field);
      }
    }
  }
View Full Code Here

  private XGenericClass[] generics;
 
  public XGenericClass(XClass xClass){
    this.xClass = xClass;
    if(xClass.getGenericParams()!=0){
      throw new XRuntimeException("Can't create a generic class of %s without generic params, need %s generic params", xClass, xClass.getGenericParams());
    }
  }
View Full Code Here

 
  public XGenericClass(XClass xClass, XGenericClass[] generics) {
    this.xClass = xClass;
    this.generics = generics;
    if(xClass.getGenericParams()!=generics.length){
      throw new XRuntimeException("Can't create a generic class of %s with %s generic params, need %s generic params", xClass, generics.length, xClass.getGenericParams());
    }
  }
View Full Code Here

  public byte[] toByteArray() {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    try {
      writeToOutputStream(outputStream);
    } catch (IOException e) {
      throw new XRuntimeException(e, "Unexpected IOException");
    }
    return outputStream.toByteArray();
  }
View Full Code Here

 
  public XGenericMethodProviderImp(XMethod method, XGenericClass[] genericClasses){
    this.method = method;
    this.genericClasses = genericClasses;
    if(method.getGenericParams()!=genericClasses.length)
      throw new XRuntimeException("Wrong count of generics");
  }
View Full Code Here

TOP

Related Classes of xscript.runtime.XRuntimeException

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.