Bug 48871 NPE in JavaAnnotationHover when hovering over left ruler
I200312160010 + export from 1158. I just found this in the log but could not reproduce. The caret was in the method name of a declaration ... private boolean accessesAnnonymousFields() { ... and I hovered over the left ruler. After the NPE was logged, the hover over the left ruler didn't appear any more. It only came back after closing and repoening the editor. I have "Mark occurrences in file" and "Enable light bulb for quick assist" switched on and the method was new and marked by QuickDiff in a block of added lines. Error Dec 16, 2003 17:15:02.738 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.JavaAnnotationHover.isDuplicateJavaAnnotation(JavaAnnotationHover.java:154) at org.eclipse.jdt.internal.ui.text.JavaAnnotationHover.getJavaAnnotationsForLine(JavaAnnotationHover.java:135) at org.eclipse.jdt.internal.ui.text.JavaAnnotationHover.getHoverInfo(JavaAnnotationHover.java:178) at org.eclipse.jface.text.source.AnnotationBarHoverManager.computeInformation(AnnotationBarHoverManager.java:100) at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:661) at org.eclipse.jface.text.AbstractHoverInformationControlManager$MouseTracker.mouseHover(AbstractHoverInformationControlManager.java:298) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:215) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2311) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1992) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1506) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1482) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:246) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:47) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:233) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:741) at org.eclipse.core.launcher.Main.main(Main.java:582)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaAnnotationHover.java
* Determines all markers for the given line and collects, concatenates, and formates
 * their messages.
 */
public class JavaAnnotationHover implements IAnnotationHover {
	private static class JavaAnnotationHoverType {
	}
	
	public static final JavaAnnotationHoverType OVERVIEW_RULER_HOVER= new JavaAnnotationHoverType();
	public static final JavaAnnotationHoverType TEXT_RULER_HOVER= new JavaAnnotationHoverType();
	public static final JavaAnnotationHoverType VERTICAL_RULER_HOVER= new JavaAnnotationHoverType();
	
	private AnnotationPreferenceLookup fPreferenceLookup= new AnnotationPreferenceLookup();
	private IPreferenceStore fStore= JavaPlugin.getDefault().getPreferenceStore();
	
	private JavaAnnotationHoverType fType;
	
	public JavaAnnotationHover(JavaAnnotationHoverType type) {
		Assert.isTrue(OVERVIEW_RULER_HOVER.equals(type) || TEXT_RULER_HOVER.equals(type) || VERTICAL_RULER_HOVER.equals(type));
		fType= type;
	}
	
	/**
	 * Returns the distance to the ruler line. 
	 */
	protected int compareRulerLine(Position position, IDocument document, int line) {
		
		if (position.getOffset() > -1 && position.getLength() > -1) {
			try {
				int javaAnnotationLine= document.getLineOfOffset(position.getOffset());
				if (line == javaAnnotationLine)