@Documented ignored for type-use annotations

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Feb 22 19:00:35 UTC 2017


Gunnar,

Thanks.

-- Jon


On 02/22/2017 12:54 AM, Gunnar Morling wrote:
> Hi Jon,
>
> filed a bug; that's the "internal review id": 9047801.
>
> The steps to reproduce are this:
>
> 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")
>
> I'm using 1.8.0_121.
>
> --Gunnar
>
>
> 2017-02-21 23:52 GMT+01:00 Jonathan Gibbons <jonathan.gibbons at oracle.com>:
>> Hi Gunnar,
>>
>> Can you put together a tiny test case and file a bug?
>>
>> -- Jon
>>
>>
>> On 02/20/2017 01:54 AM, Gunnar Morling wrote:
>>> Hi,
>>>
>>> Is there a way to show annotations on type arguments in JavaDoc?
>>>
>>> My annotation type is meta-annotated with @Target(TYPE_USE) and
>>> @Documented, still it isn't shown in JavaDocs for elements using it,
>>> e.g. a method like this:
>>>
>>>       foo(List<@MyAnno String> strings) { ... }
>>>
>>> Is this generally not supported or is there some sort of option I need
>>> to enable to have type use annotations showing up in JavaDoc?
>>>
>>> Thanks,
>>>
>>> --Gunnar
>>



More information about the javadoc-dev mailing list