Buggy code:
public class AnnotationCompletionProposalComputer implements IJavaCompletionProposalComputer { public AnnotationCompletionProposalComputer ( ) { } @ SuppressWarnings ( "unchecked" ) public List computeCompletionProposals ( ContentAssistInvocationContext context , IProgressMonitor monitor ) { } @ SuppressWarnings ( "unchecked" ) private List < ICompletionProposal > computeCompletionProposals ( JavaContentAssistInvocationContext context ) { CompletionContext completionContext = context . getCoreContext ( ) ; int tokenStart = completionContext . getOffset ( ) ; ICompilationUnit source = context . getCompilationUnit ( ) ; try { IJavaElement javaElement = source . getElementAt ( tokenStart ) ; if ( javaElement != null ) { <START_BUG> CompilationUnit compilationUnit = JDTUtils . getCompilationUnit ( source ) ; <END_BUG> int elementType = javaElement . getElementType ( ) ; if ( elementType == ( IJavaElement . PACKAGE_DECLARATION ) ) { PackageDeclaration packageDeclaration = compilationUnit . getPackage ( ) ; List < Annotation > packageAnnotations = packageDeclaration . annotations ( ) ; for ( Annotation annotation : packageAnnotations ) { if ( annotation instanceof NormalAnnotation ) { NormalAnnotation normalAnnotation = ( ( NormalAnnotation ) ( annotation ) ) ; MemberValuePair memberValuePair = getMemberValuePairForPosition ( normalAnnotation , tokenStart ) ; if ( memberValuePair != null ) { return getCompletionProposalsForASTNode ( normalAnnotation , memberValuePair , packageDeclaration ) ; } } } } if ( ( elementType == ( IJavaElement . TYPE ) ) || ( elementType == ( IJavaElement . FIELD ) ) ) { return getCompletionProposalsForJavaElement ( AnnotationUtils . getExtendedModifiers ( compilationUnit , javaElement ) , javaElement , tokenStart ) ; } if ( elementType == ( IJavaElement . METHOD ) ) { SingleVariableDeclaration parameter = AnnotationUtils . getMethodParameter ( compilationUnit , ( ( IMethod ) ( javaElement ) ) , tokenStart ) ; if ( parameter != null ) { return getCompletionProposalsForASTNode ( parameter . modifiers ( ) , parameter , tokenStart ) ; } else { return getCompletionProposalsForJavaElement ( AnnotationUtils . getExtendedModifiers ( compilationUnit , javaElement ) , javaElement , tokenStart ) ; } } } } catch ( JavaModelException jme ) { JAXWSUIPlugin . log ( jme . getStatus ( ) ) ; } return Collections . emptyList ( ) ; } private List < ICompletionProposal > getCompletionProposalsForASTNode ( List < IExtendedModifier > modifiers , ASTNode astNode , int offset ) { } private List < ICompletionProposal > getCompletionProposalsForJavaElement ( List < IExtendedModifier > modifiers , IJavaElement javaElement , int offset ) { } private List < ICompletionProposal > getCompletionProposalsForASTNode ( NormalAnnotation normalAnnotation , MemberValuePair memberValuePair , ASTNode astNode ) { } private List < ICompletionProposal > getCompletionProposalsForJavaElement ( NormalAnnotation normalAnnotation , MemberValuePair memberValuePair , IJavaElement javaElement ) { } @ SuppressWarnings ( "unchecked" ) private MemberValuePair getMemberValuePairForPosition ( NormalAnnotation normalAnnotation , int offset ) { } @ SuppressWarnings ( "unchecked" ) public List computeContextInformation ( ContentAssistInvocationContext context , IProgressMonitor monitor ) { } public String getErrorMessage ( ) { } public void sessionEnded ( ) { } public void sessionStarted ( ) { } }

Fix:
CompilationUnit compilationUnit = AnnotationUtils . getASTParser ( source , true ) ;