Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8268973

Add default impl for recent new Reporter.print method

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 17
    • tools
    • None
    • source
    • minimal
    • just providing a default implementation
    • Java API
    • JDK

      Summary

      Provide a default implementation for the recent new Reporter.print method

      Problem

      In methods recently added to Reporter, one of the methods was not given a default implementation.

      Solution

      Provide a default implementation and corresponding @implSpec.

      Specification

      diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Reporter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Reporter.java
      index 2ac7741ce46..91bc5fe8ea2 100644
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Reporter.java
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/Reporter.java
      @@ -94,6 +94,12 @@ public interface Reporter {
            * The positions are all 0-based character offsets from the beginning of content of the file.
            * The positions should satisfy the relation {@code start <= pos <= end}.
            *
      +     * @implSpec
      +     * This implementation always throws {@code UnsupportedOperationException}.
      +     * The implementation provided by the {@code javadoc} tool to
      +     * {@link Doclet#init(Locale, Reporter) initialize} a doclet
      +     * overrides this implementation.
      +     *
            * @param kind    the kind of diagnostic
            * @param file    the file
            * @param start   the beginning of the enclosing range
      @@ -103,7 +109,9 @@ public interface Reporter {
            *
            * @since 17
            */
      -    void print(Diagnostic.Kind kind, FileObject file, int start, int pos, int end, String message);
      +    default void print(Diagnostic.Kind kind, FileObject file, int start, int pos, int end, String message) {
      +        throw new UnsupportedOperationException();
      +    }
      
           /**
            * Returns a writer that can be used to write non-diagnostic output,

            jjg Jonathan Gibbons
            jjg Jonathan Gibbons
            Pavel Rappo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: