| Summary: | [hovering] NPE when hovering over @value reference within a type's Javadoc | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Tom Hofmann <eclipse> | ||||||
| Component: | Text | Assignee: | Tom Hofmann <eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bsi.msa, daniel_megert, markus.kell.r, wim.jongman | ||||||
| Version: | 3.6 | Flags: | markus.kell.r:
review+
|
||||||
| Target Milestone: | 3.7 M4 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 174476 [details]
Patch against JavadocContentAccess2.java
Patch fixing the reported NPE. The code walks the chain of enclosing types until it finds the corresponding field.
Created attachment 174477 [details]
Updated patch
oops, I inadvertedly attached the previous version of the patch which did not stop walking the chain when it encountered a non-constant field.
Tom, which build id? This works fine for me using R3.6 and latest 3.7. Markus to confirm. Sorry, the example is bad and does not reproduce the problem.
I can reproduce with eclipse SDK 3.6 (I20100608-0911) and the following snippet when hovering over 'Test'. The type being hovered over has to be a top-level type to trigger the error.
------- Test.java ---------
/**
* Reference to {@value #OUTER}.
*/
class Test {
public static final String OUTER= "coolbar";
}
---------------------------
*** Bug 323091 has been marked as a duplicate of this bug. *** Reviewed the patch and tested, seems to work fine. Tom, please just go ahead and commit to HEAD and don't forget to add your credentials to the copyright notice as usual. Tom, are you still there? ;-) Tom, please add yourself to the copyright section before committing to HEAD. Fixed > 20101029. Sorry this took so long, turn-around time should be shorter next time... Great to have you back, Tom! Moved milestone, since M3 is already packaged for shipping. *** Bug 373267 has been marked as a duplicate of this bug. *** |
3.6 - have a class with a static final field ------ Test.java ------- class Test { public static final String OUTER= "coolbar"; /** * Reference to {@value #CONSTANT} and {@value #OUTER}. */ static class Inner { public static final String OUTER= "innerbar"; public static final String CONSTANT= "foobar"; } } ------------------------ - hover over the 'Inner' class name > boom: "Unexpected runtime error while computing a text hover" - see exception stack trace below. Problem is that JavadocContentAccess2 assumes that fMember is not a top-level type. 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)