Community
Participate
Working Groups
Javadoc UI elements should support {@value} for Static fields. This is a javadoc 1.4 feature. see http://java.sun.com/j2se/1.4.2/docs/tooldocs/javadoc/whatsnew-1.4.html#{@value} /** * Comment for <code>CDICE_DOCUMENTS</code>= {@value} */ public static final String CDICE_DOCUMENTS = "cims_doc"; currently displays as Comment for CDICE_DOCUMENTS= {
Javadoc view is also affected.
see also bug 152029
Note that the Javadoc tool (1.5 and 1.6) fails to resolve @value inline tags with a reference to another type, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6750224 .
*** Bug 172459 has been marked as a duplicate of this bug. ***
*** Bug 152029 has been marked as a duplicate of this bug. ***
Couldn't this be targeted for 3.5 just like bug #24227? This would give the Javadoc hover a "full" (at least I hope) implementation for 3.5... Mauro.
(In reply to comment #6) Tentatively targetting 3.5. Some of the prerequisites for this (need a resolved AST is some cases) is already done in the work for bug 236850. (In reply to comment #3) > Note that the Javadoc tool (1.5 and 1.6) fails to resolve @value inline tags > with a reference to another type, see > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6750224 . Actually, javadoc.exe does work if the type reference is *fully* qualified.
Sorry, I ran out of time for 3.5. The fix needs to create more ASTs than normal Javadoc hovers, and I don't want to risk breaking or delaying the hovers at this stage.
Fixed in JavadocContentAccess2. I've only implemented {@value} and {@value #FIELD_FROM_SAME_TYPE} for now, since the rest would have been more expensive and since the Javadoc tool is also not reliable in those cases.
Things work for the declaration and references in the same file (even references from secondary class). However when the static field is referred from another file then the javadoc is 'Comment for CDICE_DOCUMENTS= {@value}'. This behavior is same for source and binary with attached source.
(In reply to comment #10) > Things work for the declaration and references in the same file (even > references from secondary class). > > However when the static field is referred from another file then the javadoc is > 'Comment for CDICE_DOCUMENTS= {@value}'. This behavior is same for source and > binary with attached source. Build ID - I20100426-0852
(In reply to comment #11) > (In reply to comment #10) > > Things work for the declaration and references in the same file (even > > references from secondary class). > > > > However when the static field is referred from another file then the javadoc is > > 'Comment for CDICE_DOCUMENTS= {@value}'. This behavior is same for source and > > binary with attached source. > Build ID - I20100426-0852 It seems to be working for me with I20100426-0852. Do you mean this? : public class test { public static final String MAIN_INDIRECT = "Main.3"; //$NON-NLS-1$ } public class Main { /** * Comment for <code>MAIN_INDIRECT</code>= {@value} */ private final static String MAIN_INDIRECT = test.MAIN_INDIRECT; } Hover shows me the value 'Comment for MAIN_INDIRECT= "Main.3"' correctly also in Javadoc view for source and binary with attached source.
(In reply to comment #12) > It seems to be working for me with I20100426-0852. > Do you mean this? : > > public class test { > public static final String MAIN_INDIRECT = "Main.3"; //$NON-NLS-1$ > } > > public class Main { > /** > * Comment for <code>MAIN_INDIRECT</code>= {@value} > */ > private final static String MAIN_INDIRECT = test.MAIN_INDIRECT; > } > > Hover shows me the value 'Comment for MAIN_INDIRECT= "Main.3"' correctly also > in Javadoc view for source and binary with attached source. No, I meant //Main.java public class Main { /** * Comment for <code>CDICE_DOCUMENTS</code>= {@value} */ public static final String CDICE_DOCUMENTS = "cims_doc"; } //A.java public class A { public void foo(){ String cdiceDocuments = Main.CDICE_DOCUMENTS; } } Now, hover over Main.CDICE_DOCUMENTS in A.java (or select it and open JavaDoc view), the value is not available it just shows the annotation. Now the class Main can be available as source or as a binary with source attachment the result is the same.
(In reply to comment #13) Ah I see what you mean. Sorry I marked the bug Verified by mistake due to clash of comments. Pls reopen as necessary.
Reopening.
Fixed the case from comment 10 in JavadocContentAccess2. That's the best I can do for 3.6. It works for simple constants like String literals or chars. Anything more would require a full AST of the target, and that's too expensive without more infrastructure. Please open a new bug if you want to request more features.