Buggy code:
public WorkingCopyOwner owner ; public CompilationUnit ( PackageFragment parent , String name , WorkingCopyOwner owner ) { } public void becomeWorkingCopy ( IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException { } public void becomeWorkingCopy ( IProgressMonitor monitor ) throws JavaModelException { } protected boolean buildStructure ( OpenableElementInfo info , final IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { CompilationUnitElementInfo unitInfo = ( ( CompilationUnitElementInfo ) ( info ) ) ; IBuffer buffer = getBufferManager ( ) . getBuffer ( this ) ; if ( buffer == null ) { openBuffer ( pm , unitInfo ) ; } CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor ( this , unitInfo , newElements ) ; JavaModelManager . PerWorkingCopyInfo perWorkingCopyInfo = getPerWorkingCopyInfo ( ) ; IJavaProject project = getJavaProject ( ) ; boolean createAST ; boolean resolveBindings ; int reconcileFlags ; HashMap problems ; if ( info instanceof ASTHolderCUInfo ) { ASTHolderCUInfo astHolder = ( ( ASTHolderCUInfo ) ( info ) ) ; createAST = ( astHolder . astLevel ) != ( ICompilationUnit . NO_AST ) ; resolveBindings = astHolder . resolveBindings ; reconcileFlags = astHolder . reconcileFlags ; problems = astHolder . problems ; } else { createAST = false ; resolveBindings = false ; reconcileFlags = 0 ; problems = null ; } boolean computeProblems = ( ( ( perWorkingCopyInfo != null ) && ( perWorkingCopyInfo . isActive ( ) ) ) && ( project != null ) ) && ( JavaProject . hasJavaNature ( project . getProject ( ) ) ) ; IProblemFactory problemFactory = new DefaultProblemFactory ( ) ; Map options = ( project == null ) ? JavaCore . getOptions ( ) : project . getOptions ( true ) ; if ( ! computeProblems ) { options . put ( JavaCore . COMPILER_TASK_TAGS , "" ) ; } SourceElementParser parser = new SourceElementParser ( requestor , problemFactory , new CompilerOptions ( options ) , true , ( ! createAST ) ) ; parser . reportOnlyOneSyntaxError = ! computeProblems ; parser . setMethodsFullRecovery ( true ) ; parser . setStatementsRecovery ( ( ( reconcileFlags & ( ICompilationUnit . ENABLE_STATEMENTS_RECOVERY ) ) != 0 ) ) ; if ( ( ( ! computeProblems ) && ( ! resolveBindings ) ) && ( ! createAST ) ) parser . javadocParser . checkDocComment = false ; requestor . parser = parser ; if ( underlyingResource == null ) { underlyingResource = getResource ( ) ; } if ( underlyingResource != null ) unitInfo . timestamp = ( ( IFile ) ( underlyingResource ) ) . getModificationStamp ( ) ; CompilationUnitDeclaration compilationUnitDeclaration = null ; CompilationUnit source = cloneCachingContents ( ) ; try { if ( computeProblems ) { if ( problems == null ) { problems = new HashMap ( ) ; compilationUnitDeclaration = CompilationUnitProblemFinder . process ( source , parser , this . owner , problems , createAST , reconcileFlags , pm ) ; try { perWorkingCopyInfo . beginReporting ( ) ; for ( Iterator iteraror = problems . values ( ) . iterator ( ) ; iteraror . hasNext ( ) ; ) { CategorizedProblem [ ] categorizedProblems = ( ( CategorizedProblem [ ] ) ( iteraror . next ( ) ) ) ; if ( categorizedProblems == null ) continue ; for ( int i = 0 , length = categorizedProblems . length ; i < length ; i ++ ) { perWorkingCopyInfo . acceptProblem ( categorizedProblems [ i ] ) ; } } } finally { perWorkingCopyInfo . endReporting ( ) ; } } else { compilationUnitDeclaration = CompilationUnitProblemFinder . process ( source , parser , this . owner , problems , createAST , reconcileFlags , pm ) ; } } else { <START_BUG> compilationUnitDeclaration = parser . parseCompilationUnit ( source , true ) ; <END_BUG> } if ( createAST ) { int astLevel = ( ( ASTHolderCUInfo ) ( info ) ) . astLevel ; org . eclipse . jdt . core . dom . CompilationUnit cu = AST . convertCompilationUnit ( astLevel , compilationUnitDeclaration , options , computeProblems , source , reconcileFlags , pm ) ; ( ( ASTHolderCUInfo ) ( info ) ) . ast = cu ; } } finally { if ( compilationUnitDeclaration != null ) { compilationUnitDeclaration . cleanUp ( ) ; } } return unitInfo . isStructureKnown ( ) ; } public CompilationUnit cloneCachingContents ( ) { } public boolean canBeRemovedFromCache ( ) { } public boolean canBufferBeRemovedFromCache ( IBuffer buffer ) { } public void close ( ) throws JavaModelException { } protected void closing ( Object info ) { } public void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public void codeComplete ( int offset , final ICodeCompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , CompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public void commit ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void commitWorkingCopy ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected Object createElementInfo ( ) { } public IImportDeclaration createImport ( String importName , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException { } public IImportDeclaration createImport ( String importName , IJavaElement sibling , int flags , IProgressMonitor monitor ) throws JavaModelException { } public IPackageDeclaration createPackageDeclaration ( String pkg , IProgressMonitor monitor ) throws JavaModelException { }

Fix:
compilationUnitDeclaration = parser . parseCompilationUnit ( source , true , pm ) ;