Buggy code:
public class CompilationUnit extends Openable implements ICompilationUnit , org . eclipse . jdt . internal . compiler . env . ICompilationUnit { protected CompilationUnit ( IPackageFragment parent , String name ) { } public void accept ( IAbstractSyntaxTreeVisitor visitor ) throws JavaModelException { } public void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException { } public void commit ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected OpenableElementInfo createElementInfo ( ) { } public IImportDeclaration createImport ( String name , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException { } public IPackageDeclaration createPackageDeclaration ( String name , IProgressMonitor monitor ) throws JavaModelException { } public IType createType ( String content , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void delete ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void destroy ( ) { } public boolean equals ( Object o ) { } protected boolean equalsDOMNode ( IDOMNode node ) throws JavaModelException { } protected boolean generateInfos ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { if ( ( getParent ( ) ) instanceof JarPackageFragment ) { throw newNotPresentException ( ) ; } else { fgJavaModelManager . putInfo ( this , info ) ; CompilationUnitElementInfo unitInfo = ( ( CompilationUnitElementInfo ) ( info ) ) ; CompilationUnitStructureRequestor requestor = new CompilationUnitStructureRequestor ( this , unitInfo , newElements ) ; IProblemFactory factory = new DefaultProblemFactory ( ) ; SourceElementParser parser = new SourceElementParser ( requestor , factory , new CompilerOptions ( JavaCore . getOptions ( ) ) ) ; <START_BUG> parser . parseCompilationUnit ( this , ( ! ( isWorkingCopy ( ) ) ) ) ; <END_BUG> if ( isWorkingCopy ( ) ) { ArrayList problems = requestor . fProblems ; if ( problems != null ) { problems . toArray ( ( ( ( WorkingCopyElementInfo ) ( unitInfo ) ) . problems = new IProblem [ problems . size ( ) ] ) ) ; } CompilationUnit original = ( ( CompilationUnit ) ( getOriginalElement ( ) ) ) ; unitInfo . fTimestamp = ( ( IFile ) ( original . getUnderlyingResource ( ) ) ) . getModificationStamp ( ) ; if ( ( unitInfo . fTimestamp ) == ( IResource . NULL_STAMP ) ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . INVALID_RESOURCE ) ) ; } } return unitInfo . isStructureKnown ( ) ; } } public IType [ ] getAllTypes ( ) throws JavaModelException { } public ICompilationUnit getCompilationUnit ( ) { } public char [ ] getContents ( ) { } public IResource getCorrespondingResource ( ) throws JavaModelException { } public IJavaElement getElementAt ( int position ) throws JavaModelException { } public char [ ] getFileName ( ) { } protected char getHandleMementoDelimiter ( ) { } public IImportDeclaration getImport ( String name ) { } public IImportContainer getImportContainer ( ) { } public IImportDeclaration [ ] getImports ( ) throws JavaModelException { } public char [ ] getMainTypeName ( ) { } public IJavaElement getOriginal ( IJavaElement workingCopyElement ) { } public IJavaElement getOriginalElement ( ) { } public IPackageDeclaration getPackageDeclaration ( String name ) { } public IPackageDeclaration [ ] getPackageDeclarations ( ) throws JavaModelException { } public char [ ] [ ] getPackageName ( ) { } public String getSource ( ) throws JavaModelException { } public ISourceRange getSourceRange ( ) throws JavaModelException { } public IType getType ( String name ) { } public IType [ ] getTypes ( ) throws JavaModelException { } public IJavaElement getWorkingCopy ( ) throws JavaModelException { } public IWorkingCopy getWorkingCopy ( IProgressMonitor pm , IBufferFactory factory ) throws JavaModelException { } protected boolean hasBuffer ( ) { } public boolean hasChildren ( ) throws JavaModelException { } public boolean isBasedOn ( IResource resource ) { } public boolean isConsistent ( ) throws JavaModelException { } protected boolean isSourceElement ( ) { } public boolean isWorkingCopy ( ) { } public void makeConsistent ( IProgressMonitor pm ) throws JavaModelException { } public void move ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void offsetSourceEndAndChildren ( int amount , IJavaElement child ) { } public void offsetSourceRange ( int amount ) { } protected IBuffer openBuffer ( IProgressMonitor pm ) throws JavaModelException { } protected void openParent ( IProgressMonitor pm ) throws JavaModelException { } protected boolean parentExists ( ) { } public IMarker [ ] reconcile ( ) throws JavaModelException { } public void rename ( String name , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void restore ( ) throws JavaModelException { } public void triggerSourceEndOffset ( int amount , int nameStart , int nameEnd ) { } public void triggerSourceRangeOffset ( int amount , int nameStart , int nameEnd ) { } public void codeComplete ( int offset , final ICodeCompletionRequestor requestor ) throws JavaModelException { } public IJavaElement rootedAt ( IJavaProject project ) { } }

Fix:
parser . parseCompilationUnit ( this , false ) ;