Bug 342194 - [hovering] Javadoc @value not rendered correctly if the constant is not declared in the same class or is qualified or if the javadoc is on a class declaration
Summary: [hovering] Javadoc @value not rendered correctly if the constant is not decla...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows 7
: P5 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-07 12:42 EDT by Mauro Molinari CLA
Modified: 2022-12-21 17:39 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mauro Molinari CLA 2011-04-07 12:42:11 EDT
Build Identifier: M20110210-1200

See the steps to repro

Reproducible: Always

Steps to Reproduce:
1. write the following code:

package test;

/**
 * Various example of Javadoc value tag:
 * <ul>
 * <li>{@value #A_CONST}
 * <li>{@value A#A_CONST}
 * <li>{@value #B_CONST}
 * <li>{@value B#B_CONST}
 * <li>{@value C#C_CONST}
 * </ul>
 */
public class A implements B
{
	public static final String A_CONST = "Value of A constant";

	/**
	 * Various example of Javadoc value tag:
	 * <ul>
	 * <li>{@value #A_CONST}
	 * <li>{@value A#A_CONST}
	 * <li>{@value #B_CONST}
	 * <li>{@value B#B_CONST}
	 * <li>{@value C#C_CONST}
	 * </ul>
	 */
	public void aMethod()
	{

	}
}

package test;

public interface B
{
	String B_CONST = "Value of B constant";
}

package test;

public class C implements B
{
	public static final String C_CONST = "Value of C constant";
}

2. now, try to press F2 on aMethod(): only the first {@value} is rendered correctly

3. then, try to press F2 on the declaration of A: NullPointerException occurs
Comment 1 Olivier Thomann CLA 2011-04-07 13:06:04 EDT
Could you please provide the stacktrace of the NPE ?
I tried to reproduce using latest and I could not get it.

I got this with 3.6.2:
java.lang.NullPointerException
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.handleValueTag(JavadocContentAccess2.java:1175)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.handleInlineTagElement(JavadocContentAccess2.java:1125)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.handleContentElements(JavadocContentAccess2.java:1067)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.handleContentElements(JavadocContentAccess2.java:1033)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.toHTML(JavadocContentAccess2.java:774)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.javadoc2HTML(JavadocContentAccess2.java:630)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContentFromSource(JavadocContentAccess2.java:582)
at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:466)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:609)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:555)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:547)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:141)
at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:82)
at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)

Is this the same ?

Moving to JDT/UI as the DOM seems to return the right constant values, but they are not displayed correctly.
Comment 2 Olivier Thomann CLA 2011-04-07 13:23:06 EDT
Right now only field reference with no qualifier is resolved to the current type in org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.
This is why only the first field ends up being resolved with a link and shows its constant value.
Comment 3 Dani Megert CLA 2011-04-08 02:43:29 EDT
The NPE has been fixed, see bug 320084.
Comment 4 Mauro Molinari CLA 2011-04-08 03:16:12 EDT
(In reply to comment #1)
> Could you please provide the stacktrace of the NPE ?
> I tried to reproduce using latest and I could not get it.
> 
> I got this with 3.6.2:
> java.lang.NullPointerException
> at
> org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.handleValueTag(JavadocContentAccess2.java:1175)

Yes, sorry, that is the stacktrace I see.
I also saw bug #320084 before opening this, but I wrongly assumed it was just about inner/nested classes.

Anyway, the rendering problem for qualified constants is confirmed. Thank you!
Comment 5 Markus Keller CLA 2011-04-08 10:56:52 EDT
As already discovered in bug 72139 comment 9, the Javadoc tool also has problems with this.
Comment 6 Eclipse Genie CLA 2020-12-23 05:41:32 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 7 Mauro Molinari CLA 2020-12-23 05:57:04 EST
This is almost fixed in 2020-09: the only reference that is not yet rendered correctly is {@value #B_CONST}.
Comment 8 Eclipse Genie CLA 2022-12-21 17:39:41 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.