Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325291 - [otmodel] NPE in SourceRefElement.getAnnotations() at hover for callout binding
Summary: [otmodel] NPE in SourceRefElement.getAnnotations() at hover for callout binding
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 0.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.7.1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-14 16:13 EDT by Stephan Herrmann CLA
Modified: 2010-09-23 18:27 EDT (History)
0 users

See Also:


Attachments
Fix with one test (10.65 KB, patch)
2010-09-17 19:20 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2010-09-14 16:13:52 EDT
The following NPE happend while hovering over a callout binding
(of CompletionAdaptor.CreateMethodMappingCompletionProposal.MyJavaLinkedModeProposal)

java.lang.NullPointerException
at org.eclipse.jdt.internal.core.SourceRefElement.getAnnotations(SourceRefElement.java:115)
at org.eclipse.objectteams.otdt.internal.core.MethodMapping.getAnnotations(MethodMapping.java:763)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getAnnotations(JavadocHover.java:957)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.addAnnotations(JavadocHover.java:937)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:604)
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)
Comment 1 Stephan Herrmann CLA 2010-09-17 19:20:38 EDT
Created attachment 179156 [details]
Fix with one test

Fixed by these steps:

* include annotations in transformations by SourceElementNotifier and
  CompilationUnitStructureRequestor

* don't let MethodMapping.getAnnotation(s) delegate to the IMethod - 
  meanwhile MethodMappings are JavaElements and support getElementInfo()
  directly.

BTW: we might want to reconsider class MethodMappingInfo, which essentially
duplicates ISourceElementRequestor.MappingInfo and subclasses.
However, such changes would need to respect ClassFileInfo which currently
uses MethodMappingInfo for creating method mappings from bytecode attributes.
Comment 2 Stephan Herrmann CLA 2010-09-17 19:22:22 EDT
Fix has been committed as r823 / r824.
Comment 3 Stephan Herrmann CLA 2010-09-23 17:30:56 EDT
Verified using I201009211735
Comment 4 Stephan Herrmann CLA 2010-09-23 18:27:18 EDT
.