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

javadoc omits method receiver for any nested type annotation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8-pool, 11, 15, 16, 17
    • Fix Version/s: 17
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b06
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Javadoc 15.0.1 for Windows x64

      A DESCRIPTION OF THE PROBLEM :
      When a method's receiver parameter's type annotation is not on the immediate receiver type, such as a type annotation on a type argument, Javadoc tool omits that receiver parameter and the type annotations.

      E.g. for a class like Generic<T>, a receiver parameter like
      void take(Generic<@Anno T> this)
      (where Anno is @Documented) will have receiver parameter omitted by javadoc, rendered like
      void take()

      , while
      void take(@Anno Generic<T> this)
      will be rendered correctly.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Set up the "Ape.java" and "Cute.java" files as provided below. Run "javadoc *.java". Observe in the method detail section,

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In the method detail section, m0, m1, and m2 methods should all have receiver (self) parameters documented as annotated with type annotation.

      Expected generated method details by javadoc
      public void m0​(@Cute("m0") Ape<T> this)
      public void m1​(@Cute("m1 outer") Ape<@Cute("m1 inner") T> this)
      public void m2(Ape<@Cute("m2") T> this)
      public void m3()
      ACTUAL -
      Only m0 and m1 have receiver parameters documented with type annotations. m2 whose type annotations is not on the immediate receiver type but in a type argument T does not have receiver parameter generated in method details.

      Actual generated method details by javadoc
      public void m0​(@Cute("m0") Ape<T> this)
      public void m1​(@Cute("m1 outer") Ape<@Cute("m1 inner") T> this)
      public void m2()
      public void m3()

      ---------- BEGIN SOURCE ----------
      Ape.java:

      public class Ape<T> {
      public void m0(@Cute("m0") Ape<T>this) {}
      public void m1(@Cute("m1 outer")Ape<@Cute("m1 inner") T>this) {}
      public void m2(Ape<@Cute("m2") T>this) {}
      public void m3(Ape<T> this) {}
      }

      Cute.java:

      import java.lang.annotation.Documented;
      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      @Documented
      @Target(ElementType.TYPE_USE)
      @Retention(RetentionPolicy.RUNTIME)
      public @interface Cute {
      String value() default "";
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

        1. Cute.java
          0.3 kB
        2. Ape.java
          0.2 kB

          Issue Links

            Activity

              People

              Assignee:
              hannesw Hannes Wallnoefer
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: