Community
Participate
Working Groups
In the following scenario the hover is not shown. Instead of that a NPE is shown in the errorlog. Bundle A has a class Foo and does not reexport org.eclipse.jdt.annotation. import org.eclipse.jdt.annotation.NonNullByDefault; @NonNullByDefault class Foo {} Bundle B has a dep to A and the following class that references Foo somehow: class Bar extends Foo {} Hover over Foo. No hover is shown. The errorlog shows: java.lang.NullPointerException at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks.createURI(JavaElementLinks.java:348) at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks.createURI(JavaElementLinks.java:322) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotation(JavadocHover.java:1073) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getAnnotations(JavadocHover.java:1028) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotations(JavadocHover.java:962) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:685) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:607) at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:599) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:129) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:85) at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166) Caused by org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotation(StringBuffer, IJavaElement, IAnnotationBinding) since annotation.getAnnotationType().getJavaElement() is null when the Annotation is not visible.
I forgot to mention that this only happens when the bundle A is installed in the IDE and consumed by bundle B in the workspace. Otherwise PDE would not handle the visibilities correct and the Annotation would be visible even when org.eclipse.jdt.annotation is not exported.
(In reply to Holger Schill from comment #1) > I forgot to mention that this only happens when the bundle A is installed in > the IDE and consumed by bundle B in the workspace. How is it "consumed"?
The issue was reproducible in Build id: I20140515-1230 with the hints provided in comment 1. Steps to reproduce: 1. In the development WS create plugin 'com.test.bug435213A' and create public class 'Foo': import org.eclipse.jdt.annotation.NonNullByDefault; @NonNullByDefault public class Foo {} 2. Open the plugin.xml file and in the 'Runtime' tab export the package containing 'Foo'. 3. Launch runtime Eclipse. 4. In the runtime WS create another plugin 'com.test.bug435213B' and create the 'Bar' class as mentioned in comment 0. 5. Get rid of all the compiler errors by adding 'com.test.bug435213A' to the current plugin dependency. 6. Now hovering over 'Foo' gives NPE as the type associated with the annotation binding is not resolved. Moving to JDT/Core to understand why the type is not resolved from the annotation binding.
(In reply to Manju Mathew from comment #3) > Moving to JDT/Core to understand why the type is not resolved from the > annotation binding. Can you please say which API is being used, and on what element exactly?
(In reply to Stephan Herrmann from comment #4) > Can you please say which API is being used, and on what element exactly? API being invoked is IAnnotationBinding#getAnnotationType() and it returns [MISSING:org.eclipse.jdt.annotation.NonNullByDefault] JavadocHover#addAnnotation LN: 1073 invokes annotation.getAnnotationType().getJavaElement() which in this case returns null and hence the NPE.
Jay, please take a look. TIA,
Any progress on that?
No progress on the API side, but the NPE has been fixed in 4.4, see bug 435279.
No progress on this. Moving out to 4.6.
No progress yet and unlikely to get time during 4.6. Moving out.
bulk move out of 4.8
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.
@Jay, feel free to assign to me, if you don't have time for this.
(In reply to Stephan Herrmann from comment #13) > @Jay, feel free to assign to me, if you don't have time for this. The fact that this has been postponed forever is an indication that it's better of off my plate. Thanks for the offer, Stephan!