char val[] = s.toCharArray();  int i = 0; if (val.length == 0) malformed("is the empty string", s);   while (val[i] == '[') { if (++i >= val.length) malformed("has just '[' chars", s);
try {  String s = a.toUnicodeString(); } catch (java.io.UTFDataFormatException udfe) { IllegalArgumentException iae = new IllegalArgumentException("The atom in question does not represent a valid UTF8 string, so it's not a type descriptor."); iae.initCause(udfe); throw iae;
  public static void validateAsTypeDescriptor(String s)     throws IllegalArgumentException,           InterruptiblePragma  {    char val[] = s.toCharArray();        int i = 0;    if (val.length == 0)      malformed("is the empty string", s);    // array dimensions precede the rest.    while (val[i] == '[') {      if (++i >= val.length)        malformed("has just '[' chars", s);    }    if (VM.VerifyAssertions)     // logically impossible:      VM._assert(i < val.length);    if (val[i] == VoidTypeCode && i != 0)      malformed("can't have an array of void", s);    if (isJavaPrimitive(val[i]))        {      // A primitive should be just 1 char long      if ( i != val.length - 1)        // if this isn't the last character, scream.        malformed("nothing should follow the primitive typecode '"                   + Character.toString(val[i]) + "'", s);      return;                   // otherwise all is well.    }    // logically impossible:    if (VM.VerifyAssertions)       VM._assert(val[i] != '[' && !isJavaPrimitive(val[i]));    // All that's left is ClassTypeCode    if (val[i] != ClassTypeCode)      malformed("unknown character '"                + Character.toString(val[i]) + "'", s);    if (!isJavaClassNameInternalForm(val, i, val.length - 1))      malformed("doesn't end with a valid class name in internal form", s);  }