/**
  * Create a fragment diagnostic, for use as an argument in other diagnostics
  *
  * @param key The key for the localized error message.
  * @param args Fields of the error message.
  */
 @Deprecated
 public static JCDiagnostic fragment(String key, Object... args) {
   return new JCDiagnostic(
       getFragmentFormatter(),
       DiagnosticInfo.of(FRAGMENT, "compiler", key, args),
       null,
       EnumSet.noneOf(DiagnosticFlag.class),
       null,
       null);
 }
 /**
  * Create a new diagnostic of the given kind.
  *
  * @param kind The diagnostic kind
  * @param lc The lint category, if applicable, or null
  * @param flags The set of flags for the diagnostic
  * @param source The source of the compilation unit, if any, in which to report the message.
  * @param pos The source position at which to report the message.
  * @param key The key for the localized message.
  * @param args Fields of the message.
  */
 public JCDiagnostic create(
     DiagnosticType kind,
     LintCategory lc,
     Set<DiagnosticFlag> flags,
     DiagnosticSource source,
     DiagnosticPosition pos,
     String key,
     Object... args) {
   return create(lc, flags, source, pos, DiagnosticInfo.of(kind, prefix, key, args));
 }
 // where
 DiagnosticInfo normalize(DiagnosticInfo diagnosticInfo) {
   // replace all nested FragmentKey with full-blown JCDiagnostic objects
   return DiagnosticInfo.of(
       diagnosticInfo.type,
       diagnosticInfo.prefix,
       diagnosticInfo.code,
       Stream.of(diagnosticInfo.args)
           .map(
               o -> {
                 return (o instanceof Fragment) ? fragment((Fragment) o) : o;
               })
           .toArray());
 }
 /**
  * Create a new diagnostic of the given kind, which is not mandatory and which has no lint
  * category.
  *
  * @param kind The diagnostic kind
  * @param source The source of the compilation unit, if any, in which to report the message.
  * @param pos The source position at which to report the message.
  * @param key The key for the localized message.
  * @param args Fields of the message.
  */
 public JCDiagnostic create(
     DiagnosticType kind,
     DiagnosticSource source,
     DiagnosticPosition pos,
     String key,
     Object... args) {
   return create(
       null,
       EnumSet.noneOf(DiagnosticFlag.class),
       source,
       pos,
       DiagnosticInfo.of(kind, prefix, key, args));
 }
 @DefinedBy(Api.COMPILER)
 public String getCode() {
   return diagnosticInfo.key();
 }
 /** Create a new fragment key. */
 Fragment fragmentKey(String code, Object... args) {
   return (Fragment) DiagnosticInfo.of(FRAGMENT, prefix, code, args);
 }
 /** Create a new note key. */
 Note noteKey(String code, Object... args) {
   return (Note) DiagnosticInfo.of(NOTE, prefix, code, args);
 }
 /** Create a new warning key. */
 Warning warningKey(String code, Object... args) {
   return (Warning) DiagnosticInfo.of(WARNING, prefix, code, args);
 }
 /** Create a new error key. */
 Error errorKey(String code, Object... args) {
   return (Error) DiagnosticInfo.of(ERROR, prefix, code, args);
 }