Package xscript.runtime.clazz

Examples of xscript.runtime.clazz.XClass


    return XPrimitive.getPrimitiveID(xClass);
  }
 
  private void resolve(XVirtualMachine vm, XMethodExecutor methodExecutor){
    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())){
View Full Code Here


public abstract class XClassPtr {
 
  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

      field.set(object, value);
    }
  }

  private int getPrimitiveID(XVirtualMachine vm){
    XClass xClass = fieldType.getXClass(vm);
    if(xClass==null)
      return XPrimitive.OBJECT;
    return XPrimitive.getPrimitiveID(xClass);
  }
View Full Code Here

    return XPrimitive.getPrimitiveID(xClass);
  }
 
  private void resolve(XVirtualMachine vm, XMethodExecutor methodExecutor){
    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())){
View Full Code Here

  public XGenericClass getGeneric(int genericID) {
    return generics[genericID];
  }

  public boolean canCastTo(XGenericClass to) {
    XClass oClass = to.getXClass();
    if(!xClass.canCastTo(oClass))
      return false;
    if(to.generics==null)
      return true;
    XClassTable classTable = oClass.getClassTable(xClass);
    for(int i=0; i<to.generics.length; i++){
      if(!classTable.getGenericPtr(i).getXClass(xClass.getVirtualMachine(), generics[i], null).equals(to.generics[i])){
        return false;
      }
    }
View Full Code Here

    thread.call(method, solvedGenerics, params);
  }

  private void resolve(XVirtualMachine vm, XMethodExecutor methodExecutor){
    if(method==null){
      XClass xClass = vm.getClassProvider().getXClass(className);
      method = xClass.getMethod(methodName, methodParams, methodReturn);
      XChecks.checkAccess(methodExecutor.getMethod().getDeclaringClass(), method);
      if(generics==null){
        if(method.getGenericParams()!=0)
          throw new XRuntimeException("Can't create a generic method %s without generic params, need %s generic params", method, method.getGenericParams());
      }else if(generics.length!=method.getGenericParams()){
View Full Code Here

  }
 
  @Override
  public XGenericClass getXClass(XVirtualMachine virtualMachine, XGenericClass genericClass, XGenericMethodProvider methodExecutor) {
    if(method==null){
      XClass xClass = virtualMachine.getClassProvider().getXClass(className);
      method = xClass.getMethod(methodName, paramNames, retName);
      genericID = method.getGenericID(genericName);
    }
    if(methodExecutor.getMethod()!=method)
      throw new XRuntimeException("Can't get generic %s of method %s in method %s", genericName, method, methodExecutor.getMethod());
    return methodExecutor.getGeneric(genericID);
View Full Code Here

    thread.call(method, solvedGenerics, params);
  }

  private void resolve(XVirtualMachine vm, XMethodExecutor methodExecutor){
    if(method==null){
      XClass xClass = vm.getClassProvider().getXClass(className);
      method = xClass.getMethod(methodName, methodParams, methodReturn);
      XChecks.checkAccess(methodExecutor.getMethod().getDeclaringClass(), method);
      if(generics==null){
        if(method.getGenericParams()!=0)
          throw new XRuntimeException("Can't create a generic method %s without generic params, need %s generic params", method, method.getGenericParams());
      }else if(generics.length!=method.getGenericParams()){
View Full Code Here

    }
  }
 
  public XMethod getMethod(XVirtualMachine vm){
    if(method==null){
      XClass xClass = vm.getClassProvider().getXClass(className);
      return xClass.getMethod(methodName, methodParams, methodReturn);
    }
    return method;
  }
View Full Code Here

    long value = field.get(null);
    methodExecutor.push(value, getPrimitiveID(vm));
  }

  private int getPrimitiveID(XVirtualMachine vm){
    XClass xClass = fieldType.getXClass(vm);
    if(xClass==null)
      return XPrimitive.OBJECT;
    return XPrimitive.getPrimitiveID(xClass);
  }
View Full Code Here

TOP

Related Classes of xscript.runtime.clazz.XClass

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.