示例#1
0
 public void report(JCDiagnostic diag) {
   if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE)
       && (filter == null || filter.accepts(diag))) {
     deferred.add(diag);
   } else {
     prev.report(diag);
   }
 }
示例#2
0
    public void report(JCDiagnostic diagnostic) {
      if (expectDiagKeys != null) expectDiagKeys.remove(diagnostic.getCode());

      switch (diagnostic.getType()) {
        case FRAGMENT:
          throw new IllegalArgumentException();

        case NOTE:
          // Print out notes only when we are permitted to report warnings
          // Notes are only generated at the end of a compilation, so should be small
          // in number.
          if ((emitWarnings || diagnostic.isMandatory()) && !suppressNotes) {
            writeDiagnostic(diagnostic);
          }
          break;

        case WARNING:
          if (emitWarnings || diagnostic.isMandatory()) {
            if (nwarnings < MaxWarnings) {
              writeDiagnostic(diagnostic);
              nwarnings++;
            }
          }
          break;

        case ERROR:
          if (nerrors < MaxErrors
              && (diagnostic.isFlagSet(DiagnosticFlag.MULTIPLE)
                  || shouldReport(diagnostic.getSource(), diagnostic.getIntPosition()))) {
            writeDiagnostic(diagnostic);
            nerrors++;
          }
          break;
      }
      if (diagnostic.isFlagSet(JCDiagnostic.DiagnosticFlag.COMPRESSED)) {
        compressedOutput = true;
      }
    }