Package net.sourceforge.javautil.bytecode

Examples of net.sourceforge.javautil.bytecode.BytecodeException


      if (this.name.equals("java/lang/Short")) return SHORT;
      if (this.name.equals("java/lang/Byte")) return BYTE;
      if (this.name.equals("java/lang/Boolean")) return BOOLEAN;
      if (this.name.equals("java/lang/Character")) return CHAR;
    }
    throw new BytecodeException("Cannot get an unboxed type for a non primitive boxed type");
  }
View Full Code Here


  /**
   * @param iface The interface to extend
   */
  public JavaInterface addExtends (IBytecodeResolvable iface) {
    if (iface.getClassType() != ClassType.Interface)
      throw new BytecodeException("Not an interface: " + iface);
   
    this.interfaces.add(iface);
    return this;
  }
View Full Code Here

  /**
   * @param iface The interface to add
   */
  public JavaClass addImplements (IBytecodeResolvable iface) {
    if (iface.getClassType() != ClassType.Interface)
      throw new BytecodeException("Not an interface: " + iface);
   
    this.interfaces.add(iface);
    return this;
  }
View Full Code Here

    this.arg2 = arg2;
    this.operator = operator;
  }

  @Override public MethodInvocation createInvocation(BytecodeContextMethod context, String name, IBytecodeReferenceable... parameters) {
    throw new BytecodeException("Cannot do invocations on numerical results");
  }
View Full Code Here

   * @param name The name of the local variable
   * @param type The type of the local variable
   * @param isFinal True if this variable is final, otherwise false
   */
  public BytecodeLocalVariableDeclaration declareLocalVariable (String name, TypeDescriptor type, boolean isFinal) {
    if (this.accessible.containsKey(name)) throw new BytecodeException("A local variable by this name is accessible: " + name);
   
    BytecodeLocalVariableDeclaration lv = new BytecodeLocalVariableDeclaration(currentLocal++, name, type,
      new BytecodeScope(scopes.get(0), writer.mark(this), scopes.get(0).getEnd()), isFinal
    );
    this.localVariables.add(lv);
View Full Code Here

   * @param block The block to pop off the stack
   * @return The popped block if the same as on the stack, otherwise an exception will be thrown
   */
  public BytecodeScope pop (BytecodeScope scope) {
    BytecodeScope removed = this.scopes.remove(0);
    if (removed != scope) throw new BytecodeException("Block pop() out of order");
   
    List<String> toRemove = new ArrayList<String>();
    for (String name : accessible.keySet()) {
      if (accessible.get(name).getScope().getParent() == scope) {
        toRemove.add(name);
View Full Code Here

   * @param type The type to pop
   * @return The popped type if verified, otherwise throws an exception
   */
  public TypeDescriptor pop (TypeDescriptor type) {
    TypeDescriptor removed = this.stack.remove(0);
    if (!removed.equals(type)) throw new BytecodeException("Type removed from stack inconsistent: " + type.toDescriptorString() + ", expected: " + removed.toDescriptorString());
    return removed;
  }
View Full Code Here

    if (st == null) st = this.getResolutionPool().resolve(Object.class.getName());
   
    IBytecodeMethod method = st.findMethod(this.getResolutionPool(), name, getTypes(parameters));
   
    if (method == null)
      throw new BytecodeException("No such method could be found: " + name + " for " + st.getType().toDescriptorString());
   
    return this.createInvocation(resolve("this"), method, parameters);
  }
View Full Code Here

   */
  public MethodInvocation createInvocation (IBytecodeReferenceable instance, String name, IBytecodeReferenceable... parameters) {
    IBytecodeMethod method = instance.getType(this).findMethod(this.getResolutionPool(), name, getTypes(parameters));

    if (method == null)
      throw new BytecodeException("No such method could be found: " + name + " for " + instance.getType().toDescriptorString());
   
    return this.createInvocation(instance, method, parameters);
  }
View Full Code Here

   */
  public MethodInvocation createInvocation (IBytecodeResolvable type, String name, IBytecodeReferenceable... parameters) {
    IBytecodeMethod method = type.findMethod(this.getResolutionPool(), name, getTypes(parameters));
   
    if (method == null)
      throw new BytecodeException("No such method could be found: " + name + " for " + type.getType().toDescriptorString());
   
    return this.createInvocation(null, method, parameters);
  }
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.