Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314585 - [hovering] NPE in JavadocHover when annotation value is a primitive type
Summary: [hovering] NPE in JavadocHover when annotation value is a primitive type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 RC3   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 18:48 EDT by Chris Stodden CLA
Modified: 2010-05-31 01:46 EDT (History)
4 users (show)

See Also:
daniel_megert: review+
deepakazad: review+
Olivier_Thomann: review+


Attachments
Fix (1.23 KB, patch)
2010-05-27 12:01 EDT, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Stodden CLA 2010-05-26 18:48:59 EDT
Build Identifier: I20100429-1549

From within the java editor, hovering over the interface (Service1Soap) of an implementation such as:
"public class Service1_Service1SoapImpl implements Service1Soap
{..."

Produces the following stack trace:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabelComposer.appendElementLabel(JavaElementLabelComposer.java:263)
	at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks.getElementLabel(JavaElementLinks.java:514)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addValue(JavadocHover.java:1013)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addValue(JavadocHover.java:1040)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotation(JavadocHover.java:1003)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getAnnotations(JavadocHover.java:980)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotations(JavadocHover.java:928)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:595)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:546)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:538)
	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)

The interface class is contained within a jar.




Reproducible: Always

Steps to Reproduce:
1.Create a Dynamic Web Project
2.Import a jar with a webservice endpoint interface
3.Create a service implementation that references this interface
4.Hover over the interface name from the implementation

(I have a jar and implementation available let me know thxs)
Comment 1 Dani Megert CLA 2010-05-27 03:15:15 EDT
We have reworked that code after I20100429-1549. Can you please retry with 3.6 RC2 and report back?

If you can still reproduce then please attach your example.
Comment 2 Markus Keller CLA 2010-05-27 11:55:46 EDT
Got it. To reproduce, hover over Bug314585.

@Classes({int.class})
public class Bug314585 { }

@interface Classes {
    Class<?>[] value();
}

I think we should fix this, since this code is quite new.
Comment 3 Markus Keller CLA 2010-05-27 12:01:45 EDT
Created attachment 170216 [details]
Fix
Comment 4 Olivier Thomann CLA 2010-05-27 12:16:20 EDT
Is it possible to get a regression test for it ?
Comment 5 Olivier Thomann CLA 2010-05-27 12:26:27 EDT
+1. A null check is required as primitive types don't have a java element.
Comment 6 Markus Keller CLA 2010-05-27 12:30:09 EDT
> Is it possible to get a regression test for it ?

Not at this time, we don't have regression tests for the hover contents. This is UI-related code that generates HTML. Since the output is not well-defined and changes a lot over time, it's not easy to write a stable test suite. We should probably better separate the business logic from the presentation and then write tests for the business logic.
Comment 7 Deepak Azad CLA 2010-05-27 13:00:40 EDT
Looks good.
Comment 8 Markus Keller CLA 2010-05-27 13:56:18 EDT
Released to HEAD.
Comment 9 Dani Megert CLA 2010-05-27 15:09:29 EDT
+1 for RC3 - this worth getting fixed.
Comment 10 Dani Megert CLA 2010-05-28 02:35:07 EDT
.
Comment 11 Dani Megert CLA 2010-05-28 02:35:15 EDT
Verified in I20100527-1700.
Comment 12 Deepak Azad CLA 2010-05-31 01:46:10 EDT
Verified with I20100530-0800