public static Type intern(String descriptor) {
    Type result = internTable.get(descriptor);

    if (result != null) {
      return result;
    }

    char firstChar;
    try {
      firstChar = descriptor.charAt(0);
    } catch (IndexOutOfBoundsException ex) {
      // Translate the exception.
      throw new IllegalArgumentException("descriptor is empty");
    } catch (NullPointerException ex) {
      // Elucidate the exception.
      throw new NullPointerException("descriptor == null");
    }

    if (firstChar == '[') {
      /*
       * Recursively strip away array markers to get at the underlying
       * type, and build back on to form the result.
       */
      result = intern(descriptor.substring(1));
      return result.getArrayType();
    }

    /*
     * If the first character isn't '[' and it wasn't found in the
     * intern cache, then it had better be the descriptor for a class.
     */

    int length = descriptor.length();
    if ((firstChar != 'L') || (descriptor.charAt(length - 1) != ';')) {
      throw new IllegalArgumentException("bad descriptor: " + descriptor);
    }

    /*
     * Validate the characters of the class name itself. Note that
     * vmspec-2 does not have a coherent definition for valid
     * internal-form class names, and the definition here is fairly
     * liberal: A name is considered valid as long as it doesn't
     * contain any of '[' ';' '.' '(' ')', and it has no more than one
     * '/' in a row, and no '/' at either end.
     */

    int limit = (length - 1); // Skip the final ';'.
    for (int i = 1; i < limit; i++) {
      char c = descriptor.charAt(i);
      switch (c) {
        case '[':
        case ';':
        case '.':
        case '(':
        case ')':
          {
            throw new IllegalArgumentException("bad descriptor: " + descriptor);
          }
        case '/':
          {
            if ((i == 1) || (i == (length - 1)) || (descriptor.charAt(i - 1) == '/')) {
              throw new IllegalArgumentException("bad descriptor: " + descriptor);
            }
            break;
          }
      }
    }

    result = new Type(descriptor, BT_OBJECT);
    return putIntern(result);
  }
Returns the unique instance corresponding to the type with the given descriptor. See vmspec-2
sec4.3.2 for details on the field descriptor syntax. This method does <i>not</i> allow {@code
"V"} (that is, type {@code void}) as a valid descriptor.

@param descriptor {@code non-null;} the descriptor
@return {@code non-null;} the corresponding instance
@throws IllegalArgumentException thrown if the descriptor has invalid syntax
android/android_framework/dex-maker/src/main/java/com/android/dx/rop/type/Type.java