Community
Participate
Working Groups
I tried adding as the Javadoc for a method something like: /** Method usage: <pre> class ClassName { [...] @Override public int toString(){ return Class.staticMethod(this, ClassName.class); } [...] } </pre> @param object an object. @param objClass the object's compile-time class. */ The problem is that apparently the Javadoc extractor considers the @Override annotation as a Javadoc tag, can't recognize it, and stops working with a warning at that point. I tried using the @ (that should have been [ampersand, hash, lower-case x, four, zero, semicolon], not sure if it will show up right), the HTML-entity for the "@" sign (at?). Unfortunately, when auto-formatting the file Eclipse converts the entity in a plain "@" character. While perhaps not really a bug (as far as HTML is concerned the change should be invisible), I think that it may help changing this. (I'm not sure though, and anyway I wouldn't be surprised if the Javadoc extractor wouldn't see it as a "@" anyway. Any suggestions for including code snippets with annotations in Javadoc are welcome.)
I discovered that using <code>@Override [...]</code> works. However I can't seem to convince the <code/> tag to behave as anything other than an inline element (which it is in HTML, AFAIK), meaning it doesn't work with multi-line code snippets. I was able to get the thing above work using <pre> class ClassName { [...] <code>@Override</code> public int toString(){ return Class.staticMethod(this, ClassName.class); } [...] } </pre> that is, wraping the annotation in a <code/> tag (on top, or rather inside of the <pre/> tag). This is not at all elegant, but works. If anyone knows a better solution, please drop me a note. Since this is not really an Eclipse bug, rather a deficiency of Javascript (I think), I resolved the bug to "fixed". Not sure if this is right, but "wontfix" seems to suggest it really is a bug.
Of course, now I noticed this still doesn't work right. The snippet in my last comment works, presumably meaning it's valid Javascript. However, when auto-formatting Eclipse turns it into <pre> class ClassName { [...] <code> @Override </code> public int toString(){ return Class.staticMethod(this, ClassName.class); } [...] } </pre> (moves the <code/> markers on separate lines, and slides everything at line beginning) which is not only very ugly, but changes the semantic--meaning that the Javadoc extractor chokes on it. I presume this is because the <code/> tag is supposed to be one line only, but I'm not sure. Anyway, this means that Eclipse turns something that works in something that doesn't when auto-formatting, which is probably bad.
Probably a separate issue, but maybe related: while using <code>@Annotation</code>, in a single line, outside of a <pre/> tag, works as far as the Javadoc extractor is concerned, Eclipse autoformats everything after the occurence incorrectly. Apparently it assumes it is a Javadoc tag. I'm sure most of this is because "@" was not expected to appear in code when Javadoc was initially designed, so it's probably unclear yet how to deal with it, but we probably want to look at the problem.
Can be reproduced in 3.2 RC7
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Still an issue in 4.11 M1.
One can use @ instead of @ as a workaround. Also, the formatter does this for you.
(In reply to Dani Megert from comment #7) > One can use @ instead of @ as a workaround. > > Also, the formatter does this for you. So what should be the fix for this bug? When you type @ inside <pre> it automatically inserts @ instead?
(In reply to Mateusz Matela from comment #8) > (In reply to Dani Megert from comment #7) > > One can use @ instead of @ as a workaround. > > > > Also, the formatter does this for you. > > So what should be the fix for this bug? > When you type @ inside <pre> it automatically inserts @ instead? Probably.