Examples of ClassFormatException


Examples of org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException

    if (indexOfClosingParen == 1) {
      // there is no parameter
      return 0;
    }
    if (indexOfClosingParen == -1) {
      throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature);
    }
    int parameterTypesCounter = 0;
    for (int i = 1; i < indexOfClosingParen; i++) {
      switch(signature[i]) {
        case 'B':
        case 'C':
        case 'D':
        case 'F':
        case 'I':
        case 'J':
        case 'S':
        case 'Z':
          parameterTypesCounter++;
          break;
        case 'L':
          int indexOfSemiColon = CharOperation.indexOf(';', signature, i+1);
          if (indexOfSemiColon == -1) throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature);
          // verify if first parameter is synthetic
          if (className != null && parameterTypesCounter == 0) {
            char[] classSignature = Signature.createCharArrayTypeSignature(className, true);
            int length = indexOfSemiColon-i+1;
            if (classSignature.length > (length+1)) {
              // synthetic means that parameter type has same signature than given class
              for (int j=i, k=0; j<indexOfSemiColon; j++, k++) {
                if (!(signature[j] == classSignature[k] || (signature[j] == '/' && classSignature[k] == '.' ))) {
                  parameterTypesCounter++;
                  break;
                }
              }
            } else {
              parameterTypesCounter++;
            }
            className = null; // do not verify following parameters
          } else {
            parameterTypesCounter++;
          }
          i = indexOfSemiColon;
          break;
        case '[':
          break;
        default:
          throw new ClassFormatException(ClassFormatException.ErrInvalidMethodSignature);
      }
    }
    return parameterTypesCounter;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.