Bug 516205 - [hovering] JavaDoc Hover for {@code class Test {}} does not match JavaDoc generated
Summary: [hovering] JavaDoc Hover for {@code class Test {}} does not match JavaDoc gen...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-04 18:19 EDT by Thomas Schindl CLA
Modified: 2023-11-28 08:20 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2017-05-04 18:19:56 EDT
To reproduce just paste this to your IDE

---8<---
/**
 * {@code class Test {
 *   String a = "";
 * }}
 * 
 */
void bla() {
}
---8<---

generates a JavaDoc:
---
class Test { private String a; }}
---

Notice: additional } at the end

Upon closer look and adding some debug output to JavaDocContentAccess2 one notice that ASTNode representing @code has no content at all if there's another '{' inside the @code-block and so the final HTML produced is:

--
<code></code> class Test {
    private String a;
 }}<dl><dt>Parameters:</dt><dd><b>args</b> </dd></dl>
--

So I guess the real problem is in ASTParser because the @code-tag has no fragments attached to it.

At least the JDK9 JavaDoc Tool allows opening braces inside @code - see eg http://download.java.net/java/jdk9/docs/api/javafx/scene/control/TreeTableView.html where the origin JavaDoc in code looks like

---
* <pre>{@code
 * public class File {
 *     private StringProperty name;
 *     public void setName(String value) { nameProperty().set(value); }
 *     public String getName() { return nameProperty().get(); }
 *     public StringProperty nameProperty() {
 *         if (name == null) name = new SimpleStringProperty(this, "name");
 *         return name;
 *     }
 *
 *     private LongProperty lastModified;
 *     public void setLastModified(long value) { lastModifiedProperty().set(value); }
 *     public long getLastModified() { return lastModifiedProperty().get(); }
 *     public LongProperty lastModifiedProperty() {
 *         if (lastModified == null) lastModified = new SimpleLongProperty(this, "lastModified");
 *         return lastModified;
 *     }
 * }}</pre>
---
Comment 1 Eclipse Genie CLA 2019-10-23 13:40:28 EDT
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.
Comment 2 Florin Barbisch CLA 2019-12-16 14:27:02 EST
You don't even need to create your own JavaDoc, you can hover over java.lang.String.split(String)
Comment 3 Eclipse Genie CLA 2021-12-07 12:44:21 EST
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.
Comment 4 Eclipse Genie CLA 2023-11-28 08:20:31 EST
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.