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

Fix signature of StandardDoclet.getSupportedOptions

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 15
    • tools
    • None
    • source
    • minimal
    • Clients of `StandardDoclet` will normally be calling the interface method, which is unchanged. There should be few, if any, subtypes of `StandardDoclet`, and for those, the change is source compatible.
    • Java API
    • JDK

      Summary

      Fix the signature of the return type StandardDoclet.getSupportedOptions to include a missing wildcard.

      Problem

      The signature of Doclet.getSupportedOptions uses a wildcard in the return type.

      Set<? extends Doclet.Option> getSupportedOptions() 

      There is an overriding method in StandardDoclet, but it incorrectly omits the wildcard, this forcing a more restrictive return type.

      public Set<Doclet.Option> getSupportedOptions() 

      Solution

      Fix the return type.

      Specification

      diff -r 20cb5d43dc2d src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java
      --- a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java Wed Jan 22 14:27:13 2020 -0500
      +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java Wed Jan 22 11:54:40 2020 -0800
      @@ -85,7 +85,7 @@
           }
      
           @Override
      -    public Set<Doclet.Option> getSupportedOptions() {
      +    public Set<? extends Doclet.Option> getSupportedOptions() {
               return htmlDoclet.getSupportedOptions();
           }

            jjg Jonathan Gibbons
            jjg Jonathan Gibbons
            Pavel Rappo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: