heads up: type annos issue

Bhavesh Patel bhavesh.x.patel at oracle.com
Fri Nov 30 18:35:45 PST 2012


Hi Werner,
          I implemented the javadoc tests for receiver annotations and annotation on parameters. I reviewed the output with Jon and we saw a few issues in how the annotations are handled. Below if the link to the generated test pages and the source files used to generate these pages

Test Pages Location: http://cr.openjdk.java.net/~bpatel/annotations-test/test/api/
Source Files Location: http://cr.openjdk.java.net/~bpatel/annotations-test/source/

The issues we encountered were

1) When I put a type annotation on Object, it ended up on ALL instances of Object, and thus shows up throughout the javadoc for the class. If you look at Generic3.java and Generic4.java in the source, the class extends Object with @Bug annotation. Now if you look at the generated test .html files, the @Bug annotation appears throughout the javadoc for Object. Another example would be that the test3 and test4 methods in these classes has @A on X and the @A annotation appears throughout the javadoc for X.

2) To display the receiver annotation correctly in the generated javadoc, we need to get the receiver type (and not just the receiver annotation) exposed through com.sun.javadoc for the doclet to display it correctly. If you look at the generated pages in the test, the receiver annotation is displayed but receiver type information is not exposed so it displays the class name.

3) On GenericOuter.GenericInner, the outer, inner and both methods do not see the receiver annotation. Am I annotating it correctly in the source? Also, I saw issues with multiple receiver annotation and only one receiver annotation gets reported in that case.

          On array annotations, the compiler changes for new location needs to happen before the doclet can pick up the array annotation. The compiler still uses the old location.

Regards,
Bhavesh.


----- Original Message -----
From: wdietl at gmail.com
To: jonathan.gibbons at oracle.com
Cc: type-annotations-dev at openjdk.java.net
Sent: Friday, November 30, 2012 2:21:04 PM GMT -08:00 US/Canada Pacific
Subject: Re: heads up: type annos issue

Hi Jon, Bhavesh,

On Fri, Nov 30, 2012 at 11:17 AM, Jonathan Gibbons
<jonathan.gibbons at oracle.com> wrote:
> Yesterday, Bhavesh reported that while working on type annotations support
> for javadoc, he noted that when he put a type annotation on a wildcard bound
> (which may have been Object), it ended up on *all* instances of Object, and
> thus showed up throughout the javadoc for the class. We suspect this is due
> to the type annotation being stored in the wrong place. Bhavesh will be
> following up with detailed evidence, but in the meantime, have you seen
> anything like this?

No, I've not seen such behavior. If you could send a small example
program I can investigate.
We do have test cases that annotations on the wildcard and its bound
are stored correctly, for example see
typeAnnotations/referenceinfos/MethodParameters.java method
"methodParamAsWildcard()". That method has annotations on the wildcard
and the String bound and a later use of String does not seem to have
an extra annotation. But maybe the behavior is different for Object.


> Would it help to to have a type/symbol printer that pretty prints the
> type/symbol showing all annotations?  That way we can (a) take javadoc out
> of the loop here, (b) write test cases more easily/

Yes, having better testing support for this would be helpful. The
referenceinfos tests work from the classfile information, if I
remember correctly. Having tests that work directly on the attributed
AST would be good.

cu, WMD.

-- 
http://www.google.com/profiles/wdietl


More information about the type-annotations-dev mailing list