예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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));
 }
예제 #3
0
 // 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());
 }
예제 #4
0
 /**
  * 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));
 }
예제 #5
0
 /** Create a new fragment key. */
 Fragment fragmentKey(String code, Object... args) {
   return (Fragment) DiagnosticInfo.of(FRAGMENT, prefix, code, args);
 }
예제 #6
0
 /** Create a new note key. */
 Note noteKey(String code, Object... args) {
   return (Note) DiagnosticInfo.of(NOTE, prefix, code, args);
 }
예제 #7
0
 /** Create a new warning key. */
 Warning warningKey(String code, Object... args) {
   return (Warning) DiagnosticInfo.of(WARNING, prefix, code, args);
 }
예제 #8
0
 /** Create a new error key. */
 Error errorKey(String code, Object... args) {
   return (Error) DiagnosticInfo.of(ERROR, prefix, code, args);
 }