docs: public String format(BugAnnotation[] args, ClassAnnotation primaryClass, boolean abridgedMessages) {
          String pat = pattern;
          StringBuilder result = new StringBuilder();
  
          while (pat.length() > 0) {
              int subst = pat.indexOf('{');
              if (subst < 0) {
                  result.append(pat);
                  break;
              }
  
              result.append(pat.substring(0, subst));
              pat = pat.substring(subst + 1);
  
              int end = pat.indexOf('}');
              if (end < 0) {
                  throw new IllegalStateException("unmatched { in " + pat);
              }
  
              String substPat = pat.substring(0, end);
  
              int dot = substPat.indexOf('.');
              String key = "";
              if (dot >= 0) {
                  key = substPat.substring(dot + 1);
                  substPat = substPat.substring(0, dot);
              } else if (abridgedMessages && primaryClass != null) {
                  key = "givenClass";
              }
  
              int fieldNum;
              try {
                  fieldNum = Integer.parseInt(substPat);
              } catch (NumberFormatException e) {
                  throw new IllegalArgumentException("Bad integer value " + substPat + " in " + pattern);
              }
  
              // System.out.println("fn: " + fieldNum);
              if (fieldNum < 0) {
                  result.append("?<?" + fieldNum + "/" + args.length + "???");
              } else if (fieldNum >= args.length) {
                  result.append("?>?" + fieldNum + "/" + args.length + "???");
              } else {
                  BugAnnotation field = args[fieldNum];
                  String formatted = "";
                  try {
                      formatted = field.format(key, primaryClass);
                  } catch (IllegalArgumentException iae) {
                      if (SystemProperties.ASSERTIONS_ENABLED) {
  
                          throw new IllegalArgumentException("Problem processing " + pattern + " format " + substPat + " for "
                                  + field.getClass().getSimpleName(), iae);
                      }
                      // unknown key -- not unprecedented when reading xml
                      // generated by older versions of findbugs
                      formatted = "\u00BF" + fieldNum + ".(key=" + key + ")?"; // "\u00BF"
                      // is
                      // inverted
                      // question
                      // mark
                      // System.err.println(iae.getMessage()+" in FindBugsMessageFormat");
                      // // FIXME: log this error better
                  }
                  result.append(formatted);
              }
  
              pat = pat.substring(end + 1);
          }
  
          return result.toString();
      }