javac 7 bug: incorrect parsing of @deprecated javadoc tag

Jeremy Manson jeremymanson at
Sat Nov 9 00:17:05 PST 2013

This was a bit of a stalking horse for us - the broader question was, when
you guys fix a bug, but you don't have a test for it, and we happen to have
one, do you want to add it to your test suites?

I think I mentioned to some of you at the JVMLS that we are hoping to use
javac from head at some point, so from a purely selfish standpoint, if we
can ensure that our own code will be treated correctly, that project will
become substantially easier.


On Wed, Nov 6, 2013 at 7:33 PM, cushon <cushon at> wrote:

> I found a small bug in the way javac 7 parses the @deprecated javadoc tag.
> Javac assumes that javadoc always occurs before modifiers when it parses
> member
> declarations. This breaks the dep-ann xlint warning when @Deprecated
> appears
> before /** @deprecated */, because the javadoc tag gets incorrectly
> applied to
> the next member declaration in the class.
> For example:
> class C {
>   @Deprecated
>   /** @deprecated */
>   void f() {}
>   void g() {} // dep-ann warning reported here
> }
> The changes to doc comment parsing in javac 8 appear to have fixed this
> issue, but I thought the regression test might still be useful. I've
> attached a patch with the test cases and a fix for javac 7.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the compiler-dev mailing list