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

TYPE_USE annotations not shown in JavaDoc

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.10.5

      A DESCRIPTION OF THE PROBLEM :
      Annotation types supporting ElementType.TYPE_USE and meta-annotated with @Documented are not shown in rendered JavaDocs.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      mkdir -p src/main/java/com/example

      cat > src/main/java/com/example/MyAnno.java <<EOL
      package com.example;

      import static java.lang.annotation.ElementType.*;
      import static java.lang.annotation.RetentionPolicy.RUNTIME;

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

      @Documented
      @Target({ TYPE, METHOD, FIELD, CONSTRUCTOR, PARAMETER, TYPE_USE })
      @Retention(RUNTIME)
      public @interface MyAnno {
      }
      EOL

      cat > src/main/java/com/example/MyAnnoUser.java <<EOL
      package com.example;

      import java.util.List;

      @MyAnno
      public class MyAnnoUser {

          @MyAnno public String foo;
          public List<@MyAnno String> foos;

          @MyAnno public MyAnnoUser() {}

          @MyAnno public void doFoo(@MyAnno String foo) {}
          public void doBar(List<@MyAnno String> foos) {}
      }
      EOL

      javadoc -sourcepath src/main/java -d target/javadoc $(find src/main/java -name "*.java")

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The rendered JavaDocs for the field "foos" and the method "doBar()" should show the MyAnno annotation on the type argument of List:

      public java.util.List<@MyAnno java.lang.String> foos
      public void doBar(java.util.List<MyAnno java.lang.String> foos)
      ACTUAL -
      The MyAnno annotation is not shown on the type argument of List:

      public java.util.List<java.lang.String> foos
      public void doBar(java.util.List<java.lang.String> foos)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See "Steps to Reproduce"
      ---------- END SOURCE ----------

            bpatel Bhavesh Patel (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: