Buggy code:
public class AnnotationsView extends ViewPart implements INullSelectionListener , IPartListener2 { private PageBook pageBook ; private Tree annotationTree ; private Composite notAvaiableComposite ; private ClasspathComposite setupClasspathComposite ; private TreeViewer annotationTreeViewer ; private IMemento memento ; private AnnotationsViewFilterAction annotationsViewFilterAction ; public AnnotationsView ( ) { } public void createPartControl ( Composite parent ) { } private void startListeningForSelectionChanges ( ) { } private void stopListeningForSelectionChanges ( ) { } public void selectionChanged ( IWorkbenchPart part , ISelection selection ) { } public void updateView ( IJavaElement javaElement , ITextSelection textSelection ) { IJavaProject javaProject = javaElement . getJavaProject ( ) ; if ( ! ( checkClasspath ( javaProject ) ) ) { annotationTreeViewer . setInput ( null ) ; pageBook . showPage ( setupClasspathComposite ) ; return ; } pageBook . showPage ( annotationTree ) ; int offset = textSelection . getOffset ( ) ; try { ICompilationUnit compilationUnit = null ; if ( javaElement instanceof ICompilationUnit ) { compilationUnit = ( ( ICompilationUnit ) ( javaElement ) ) ; javaElement = compilationUnit . getElementAt ( offset ) ; } if ( javaElement == null ) { return ; } if ( ( javaElement . getElementType ( ) ) == ( IJavaElement . PACKAGE_DECLARATION ) ) { if ( javaElement . getResource ( ) . getName ( ) . equals ( "package-info.java" ) ) { annotationTreeViewer . setInput ( ( ( IPackageDeclaration ) ( javaElement ) ) ) ; } else { annotationTreeViewer . setInput ( null ) ; } } if ( ( javaElement . getElementType ( ) ) == ( IJavaElement . IMPORT_DECLARATION ) ) { annotationTreeViewer . setInput ( null ) ; } if ( ( javaElement . getElementType ( ) ) == ( IJavaElement . TYPE ) ) { annotationTreeViewer . setInput ( ( ( IType ) ( javaElement ) ) ) ; } if ( ( javaElement . getElementType ( ) ) == ( IJavaElement . FIELD ) ) { annotationTreeViewer . setInput ( ( ( IField ) ( javaElement ) ) ) ; } if ( ( javaElement . getElementType ( ) ) == ( IJavaElement . METHOD ) ) { IMethod method = ( ( IMethod ) ( javaElement ) ) ; <START_BUG> SingleVariableDeclaration parameter = AnnotationUtils . getMethodParameter ( method , offset ) ; <END_BUG> if ( parameter != null ) { annotationTreeViewer . setInput ( parameter ) ; } else { annotationTreeViewer . setInput ( method ) ; } } annotationTreeViewer . refresh ( ) ; } catch ( JavaModelException jme ) { JAXWSUIPlugin . log ( jme . getStatus ( ) ) ; } } private boolean checkClasspath ( IJavaProject javaProject ) { } public void partActivated ( IWorkbenchPartReference partRef ) { } public void partDeactivated ( IWorkbenchPartReference partRef ) { } public void partVisible ( IWorkbenchPartReference partRef ) { } public void partHidden ( IWorkbenchPartReference partRef ) { } public void partOpened ( IWorkbenchPartReference partRef ) { } public void partClosed ( IWorkbenchPartReference partRef ) { } public void partBroughtToTop ( IWorkbenchPartReference partRef ) { } public void partInputChanged ( IWorkbenchPartReference partRef ) { } private void clearAnnotationsView ( ) { } private void javaEditorActivated ( IEditorPart editorPart ) { } private void annotationsViewActivated ( ) { } @ Override public void dispose ( ) { } @ Override public void init ( IViewSite site , IMemento memento ) throws PartInitException { } @ Override public void saveState ( IMemento memento ) { } private void contributeToActionBars ( ) { } private void fillLocalPullDown ( IMenuManager manager ) { } public void setFocus ( ) { } public void refresh ( ) { } }

Fix:
SingleVariableDeclaration parameter = AnnotationUtils . getMethodParameter ( null , method , offset ) ;