Package net.sourceforge.javautil.bytecode

Examples of net.sourceforge.javautil.bytecode.BytecodeException


  }

  public void box(BytecodeContextMethodASM context) {
    TypeDescriptor type = context.getStack(0);
     
    if (!type.isPrimitive()) throw new BytecodeException("Cannot box a non-primitive: " + type);
   
    //Type unboxed = getType(type);
    //context.getTarget().box(unboxed);
    context.pop(type);
    context.push(type.getBoxedType());
View Full Code Here


  }
 
  public void unbox(BytecodeContextMethodASM context) {
    TypeDescriptor type = context.getStack(0);
   
    if (type.isPrimitive()) throw new BytecodeException("Cannot unbox a primitive: " + type);
   
    //Type boxed = getType(type);
    //context.getTarget().unbox(boxed);
    context.pop(type);
    context.push(type.getUnboxedType());
View Full Code Here

      case Divide: opcode = type.getOpcode(IDIV); break;
      case Plus: opcode = type.getOpcode(IADD); break;
      case Minus: opcode = type.getOpcode(ISUB); break;
     
      default:
        throw new BytecodeException("Unsupported operator: " + operator);
    }
   
    context.popStack();
    context.popStack();
   
View Full Code Here

    context.push(ts);
  }
 
  public void loadField(BytecodeContextMethodASM context, IBytecodeResolvable type, String name) {
    IBytecodeField field = type.getField(context.getResolutionPool(), name);
    if (field == null) throw new BytecodeException("No such field " + name + " for " + type.getType().getClassName());
   
    context.getTarget().visitFieldInsn(GETFIELD, type.getType().getName(), name, field.getType().toDescriptorString());
    context.popStack();
    context.push(field.getType());
  }
View Full Code Here

    context.push(field.getType());
  }

  public void loadStaticField(BytecodeContextMethodASM context, IBytecodeResolvable type, String name) {
    IBytecodeField field = type.getField(context.getResolutionPool(), name);
    if (field == null) throw new BytecodeException("No such field " + name + " for " + type.getType().getClassName());
   
    context.getTarget().visitFieldInsn(GETSTATIC, type.getType().getName(), name, field.getType().toDescriptorString());
    context.push(field.getType());
  }
View Full Code Here

    context.push(field.getType());
  }

  public void storeField(BytecodeContextMethodASM context, IBytecodeResolvable type, String name) {
    IBytecodeField field = type.getField(context.getResolutionPool(), name);
    if (field == null) throw new BytecodeException("No such field " + name + " for " + type.getType().getClassName());
   
    context.getTarget().visitFieldInsn(PUTFIELD, type.getType().getName(), name, field.getType().toDescriptorString());
    context.popStack();
    context.popStack();
  }
View Full Code Here

    context.popStack();
  }

  public void storeStaticField(BytecodeContextMethodASM context, IBytecodeResolvable type, String name) {
    IBytecodeField field = type.getField(context.getResolutionPool(), name);
    if (field == null) throw new BytecodeException("No such field " + name + " for " + type.getType().getClassName());
   
    context.getTarget().visitFieldInsn(PUTSTATIC, type.getType().getName(), name, field.getType().toDescriptorString());
    context.popStack();
  }
View Full Code Here

      switch (comparator) {
        case Equals: return negate ? IF_ACMPNE : IF_ACMPEQ;
      }
    }

    throw new BytecodeException("Unsupported operator type for comparison arguments: " + comparator);
  }
View Full Code Here

    if (resolvable.getType().getName().equals(Object.class.getName())) return true;
    return false;
  }

  public IBytecodeConstructor findConstructor(BytecodeResolutionPool pool, TypeDescriptor... parameters) {
    throw new BytecodeException("Cannot instantiate this type: " + getName());
  }
View Full Code Here

      if (this == SHORT) return getFor(Short.class);
      if (this == BYTE) return getFor(Byte.class);
      if (this == BOOLEAN) return getFor(Boolean.class);
      if (this == CHAR) return getFor(Character.class);
    }
    throw new BytecodeException("Cannot get a boxed type for a non-primitive");
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.javautil.bytecode.BytecodeException

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.