A few notes

classic Classic list List threaded Threaded
3 messages Options
-
Reply | Threaded
Open this post in threaded view
|

A few notes

-
Hello,
I have a few pieces of notes after looking at javadoc stuff.
1. JDK-8077565 is the same as JDK-8253700 and has been addressed in commit 8cf8e46. 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

-
Reply | Threaded
Open this post in threaded view
|

Re: A few notes

-
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&nbsp;t,
<a href="Cute.html" title="annotation in <Unnamed>">@Cute</a>("a") java.lang.Comparable&lt;<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&gt;&nbsp;p2)</code>

That might be filed as a separate bug, I guess.

liangchenblue at gmail.com

On Fri, Jan 15, 2021 at 9:15 PM - <[hidden email]> wrote:
Hello,
I have a few pieces of notes after looking at javadoc stuff.
1. JDK-8077565 is the same as JDK-8253700 and has been addressed in commit 8cf8e46. 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

Reply | Threaded
Open this post in threaded view
|

Re: A few notes

Jonathan Gibbons

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=[hidden email]>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&nbsp;t,
<a href="Cute.html" title="annotation in <Unnamed>">@Cute</a>("a") java.lang.Comparable&lt;<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&gt;&nbsp;p2)</code>

That might be filed as a separate bug, I guess.

liangchenblue at gmail.com

On Fri, Jan 15, 2021 at 9:15 PM - <[hidden email]> wrote:
Hello,
I have a few pieces of notes after looking at javadoc stuff.
1. JDK-8077565 is the same as JDK-8253700 and has been addressed in commit 8cf8e46. 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