code: public void report(DiagnosticPosition pos, String msg, Object... args) {
          JavaFileObject currentSource = log.currentSourceFile();
  
          if (verbose) {
              if (sourcesWithReportedWarnings == null)
                  sourcesWithReportedWarnings = new HashSet<JavaFileObject>();
  
              if (log.nwarnings < log.MaxWarnings) {
                  // generate message and remember the source file
                  logMandatoryWarning(pos, msg, args);
                  sourcesWithReportedWarnings.add(currentSource);
              } else if (deferredDiagnosticKind == null) {
                  // set up deferred message
                  if (sourcesWithReportedWarnings.contains(currentSource)) {
                      // more errors in a file that already has reported warnings
                      deferredDiagnosticKind = DeferredDiagnosticKind.ADDITIONAL_IN_FILE;
                  } else {
                      // warnings in a new source file
                      deferredDiagnosticKind = DeferredDiagnosticKind.IN_FILE;
                  }
                  deferredDiagnosticSource = currentSource;
                  deferredDiagnosticArg = currentSource;
              } else if ((deferredDiagnosticKind == DeferredDiagnosticKind.IN_FILE
                          || deferredDiagnosticKind == DeferredDiagnosticKind.ADDITIONAL_IN_FILE)
                         && !equal(deferredDiagnosticSource, currentSource)) {
                  // additional errors in more than one source file
                  deferredDiagnosticKind = DeferredDiagnosticKind.ADDITIONAL_IN_FILES;
                  deferredDiagnosticArg = null;
              }
          } else {
              if (deferredDiagnosticKind == null) {
                  // warnings in a single source
                  deferredDiagnosticKind = DeferredDiagnosticKind.IN_FILE;
                  deferredDiagnosticSource = currentSource;
                  deferredDiagnosticArg = currentSource;
              }  else if (deferredDiagnosticKind == DeferredDiagnosticKind.IN_FILE &&
                          !equal(deferredDiagnosticSource, currentSource)) {
                  // warnings in multiple source files
                  deferredDiagnosticKind = DeferredDiagnosticKind.IN_FILES;
                  deferredDiagnosticArg = null;
              }
          }
      }
docs: Report a mandatory warning.