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

Documented annotations show up twice in Javadoc for fields and parameters

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b75
    • Introduced In Version:
      8
    • CPU:
      generic
    • OS:
      generic

      Description

      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 :
      Annotations meta-annotated with @Documented show up twice in the JavaDoc when given on a public field or method parameter.

      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
      @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;

      public class MyAnnoUser {

          @MyAnno public String foo;
          public void doFoo(@MyAnno String foo) {}
      }
      EOL

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

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      In the field/method details section of MyAnnoUser, the MyAnno annotation should be shown once for each usage:

      public @MyAnno java.lang.String foo

      public void doFoo(@MyAnno java.lang.String foo)
      ACTUAL -
      The MyAnno annotation is show twice for each usage:

      @MyAnno
      public @MyAnno java.lang.String foo

      public void doFoo(@MyAnno
                        @MyAnno java.lang.String foo)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See above (steps to reproduce)
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: