Package org.aspectj.apache.bcel.classfile

Examples of org.aspectj.apache.bcel.classfile.ClassFormatException


      return new TypeHolder(new ArrayType(th.getType(), dim), dim + th.getConsumed());
    } else { // type == T_REFERENCE
      // Format is 'Lblahblah;'
      int index = signature.indexOf(';'); // Look for closing ';'
      if (index < 0) {
        throw new ClassFormatException("Invalid signature: " + signature);
      }

      // generics awareness
      int nextAngly = signature.indexOf('<');
      String typeString = null;
View Full Code Here


    try {
      // Read return type after ')'
      int index = signature.lastIndexOf(')') + 1;
      return getType(signature.substring(index));
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  }
View Full Code Here

    int index;
    Type[] types;

    try { // Read all declarations between for `(' and `)'
      if (signature.charAt(0) != '(') {
        throw new ClassFormatException("Invalid method signature: " + signature);
      }

      index = 1; // current string position

      while (signature.charAt(index) != ')') {
        TypeHolder th = getTypeInternal(signature.substring(index));
        argumentTypes.add(th.getType());
        index += th.getConsumed(); // update position
      }
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }

    types = new Type[argumentTypes.size()];
    argumentTypes.toArray(types);
    return types;
View Full Code Here

   * stack slots it consumes, eg double=2, int=1). Unlike the call above, this does minimal unpacking
   */
  public static int getArgumentSizes(String signature) {
    int size = 0;
    if (signature.charAt(0) != '(') {
      throw new ClassFormatException("Invalid method signature: " + signature);
    }

    int index = 1; // current string position
    try {
      while (signature.charAt(index) != ')') {
        byte type = Utility.typeOfSignature(signature.charAt(index));
        if (type <= Constants.T_VOID) {
          size += BasicType.getType(type).getSize();
          index++;
        } else if (type == Constants.T_ARRAY) {
          int dim = 0;
          do {
            dim++;
          } while (signature.charAt(dim + index) == '[');
          TypeHolder th = getTypeInternal(signature.substring(dim + index));
          size += 1;
          index += dim + th.getConsumed();
        } else { // type == T_REFERENCE
          // Format is 'Lblahblah;'
          int index2 = signature.indexOf(';', index); // Look for closing ';'

          // generics awareness
          int nextAngly = signature.indexOf('<', index);
          if (nextAngly == -1 || nextAngly > index2) {
          } else {
            boolean endOfSigReached = false;
            int posn = nextAngly;
            int genericDepth = 0;
            while (!endOfSigReached) {
              switch (signature.charAt(posn++)) {
              case '<':
                genericDepth++;
                break;
              case '>':
                genericDepth--;
                break;
              case ';':
                if (genericDepth == 0) {
                  endOfSigReached = true;
                }
                break;
              default:
              }
            }
            index2 = posn - 1;
          }
          size++;
          index = index2 + 1;
        }
      }
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
    return size;
  }
View Full Code Here

      return new TypeHolder(new ArrayType(th.getType(), dim), dim + th.getConsumed());
    } else { // type == T_REFERENCE
      // Format is 'Lblahblah;'
      int index = signature.indexOf(';'); // Look for closing ';'
      if (index < 0) {
        throw new ClassFormatException("Invalid signature: " + signature);
      }

      // generics awareness
      int nextAngly = signature.indexOf('<');
      String typeString = null;
View Full Code Here

    try {
      // Read return type after ')'
      int index = signature.lastIndexOf(')') + 1;
      return getType(signature.substring(index));
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  }
View Full Code Here

    int index;
    Type[] types;

    try { // Read all declarations between for `(' and `)'
      if (signature.charAt(0) != '(') {
        throw new ClassFormatException("Invalid method signature: " + signature);
      }

      index = 1; // current string position

      while (signature.charAt(index) != ')') {
        TypeHolder th = getTypeInternal(signature.substring(index));
        argumentTypes.add(th.getType());
        index += th.getConsumed(); // update position
      }
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }

    types = new Type[argumentTypes.size()];
    argumentTypes.toArray(types);
    return types;
View Full Code Here

   * stack slots it consumes, eg double=2, int=1). Unlike the call above, this does minimal unpacking
   */
  public static int getArgumentSizes(String signature) {
    int size = 0;
    if (signature.charAt(0) != '(') {
      throw new ClassFormatException("Invalid method signature: " + signature);
    }

    int index = 1; // current string position
    try {
      while (signature.charAt(index) != ')') {
        byte type = Utility.typeOfSignature(signature.charAt(index));
        if (type <= Constants.T_VOID) {
          size += BasicType.getType(type).getSize();
          index++;
        } else if (type == Constants.T_ARRAY) {
          int dim = 0;
          do {
            dim++;
          } while (signature.charAt(dim + index) == '[');
          TypeHolder th = getTypeInternal(signature.substring(dim + index));
          size += 1;
          index += dim + th.getConsumed();
        } else { // type == T_REFERENCE
          // Format is 'Lblahblah;'
          int index2 = signature.indexOf(';', index); // Look for closing ';'

          // generics awareness
          int nextAngly = signature.indexOf('<', index);
          if (nextAngly == -1 || nextAngly > index2) {
          } else {
            boolean endOfSigReached = false;
            int posn = nextAngly;
            int genericDepth = 0;
            while (!endOfSigReached) {
              switch (signature.charAt(posn++)) {
              case '<':
                genericDepth++;
                break;
              case '>':
                genericDepth--;
                break;
              case ';':
                if (genericDepth == 0) {
                  endOfSigReached = true;
                }
                break;
              default:
              }
            }
            index2 = posn - 1;
          }
          size++;
          index = index2 + 1;
        }
      }
    } catch (StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
    return size;
  }
View Full Code Here

      TypeHolder th = getTypeInternal(signature.substring(dim));
      return new TypeHolder(new ArrayType(th.getType(), dim),dim+th.getConsumed());
    } else { // type == T_REFERENCE
      // Format is 'Lblahblah;'
      int index = signature.indexOf(';'); // Look for closing ';'
    if (index < 0) throw new ClassFormatException("Invalid signature: " + signature);
   
    // generics awareness
      int nextAngly = signature.indexOf('<');
    String typeString = null;
    if (nextAngly==-1 || nextAngly>index) {
View Full Code Here

    try {
      // Read return type after `)'
      int index = signature.lastIndexOf(')') + 1;
      return getType(signature.substring(index));
    } catch(StringIndexOutOfBoundsException e) { // Should never occur
      throw new ClassFormatException("Invalid method signature: " + signature);
    }
  }
View Full Code Here

TOP

Related Classes of org.aspectj.apache.bcel.classfile.ClassFormatException

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.