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

javadoc omits method receiver for any nested type annotation

    XMLWordPrintable

Details

    • b06
    • generic
    • generic
    • 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. Ape.java
          0.2 kB
        2. Cute.java
          0.3 kB

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: