A few notes

Jonathan Gibbons jonathan.gibbons at oracle.com
Sat Jan 16 04:31:17 UTC 2021


Hi,

Although I've not studied your emails in detail, it seems to me that 
annotations should never be included in ids, and it is an error (bug) if 
they are.

-- Jon

On 1/15/21 7:36 PM, - wrote:
> For that bug, after another look, I think the problem lies in javadoc 
> not erasing type annotations for primitives when generating links.
> I changed Daug.java to
> public class Daug {
>      public void bark(@Cute("") int t, @Cute("a") 
> Comparable<@Cute("?") ? super @Cute("int") Integer> p2) {}
> }
> and the html link is now
> <a href="#bark(@Cute(%22%22)int,java.lang.Comparable)">bark</a>
> showing how the Comparable has been erased. Javadoc should do the same 
> to the int primitive.
>
> Another interesting observation is that in the generated javadoc, Cute 
> annotation on int is not linked, while that on comparable is. It is like
> (@Cute("") int t,
> <a href="Cute.html" title="annotation in <Unnamed>">@Cute</a>("a") 
> java.lang.Comparable<<a href="Cute.html" title="annotation in 
> <Unnamed>">@Cute</a>("?") ? super <a href="Cute.html" 
> title="annotation in <Unnamed>">@Cute</a>("int") 
> java.lang.Integer> p2)</code>
>
> That might be filed as a separate bug, I guess.
>
> liangchenblue at gmail.com <http://gmail.com>
>
> On Fri, Jan 15, 2021 at 9:15 PM - <liangchenblue at gmail.com 
> <mailto:liangchenblue at gmail.com>> wrote:
>
>     Hello,
>     I have a few pieces of notes after looking at javadoc stuff.
>     1. JDK-8077565 <https://bugs.openjdk.java.net/browse/JDK-8077565>
>     is the same as JDK-8253700
>     <https://bugs.openjdk.java.net/browse/JDK-8253700> and has been
>     addressed in commit 8cf8e46
>     <https://github.com/openjdk/jdk/commit/8cf8e463c623b3908befb0af289749b47a793267>.
>     It can be closed now.
>     2. When a method has type annotations, its html element id may be
>     broken. I request filing a bug so I can submit a fix. A minimal
>     example:
>
>     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 "";
>     }
>
>     Daug.java:
>     public class Daug {
>          public void bark(@Cute("") int t) {}
>     }
>
>     Build the javadoc for the two classes. Observe that in the method
>     details section, the id field of it is like
>     <section class="detail" id="bark(@Cute(" ")int)"="">
>     which is a map of
>     class -> detail
>     id -> "bark(@Cute("
>     ")int)" -> ""
>
>     I suggest changing the id to that used in the method summary
>     section (already correct), like
>     "bark(@Cute(%22%3Cannotationcontent%3E%22)int)".
>
>     liangchenblue at gmail.com <http://gmail.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/javadoc-dev/attachments/20210115/26a93e52/attachment.htm>


More information about the javadoc-dev mailing list