Buggy code:
int typeDepth ; int anonymousCounter ; int anonymousClassName ; String encoding ; public SourceMapper ( IPath zipPath , String rootPath , JavaModel model ) { } public void acceptImport ( int declarationStart , int declarationEnd , char [ ] name , boolean onDemand ) { } public void acceptLineSeparatorPositions ( int [ ] positions ) { } public void acceptPackage ( int declarationStart , int declarationEnd , char [ ] name ) { } public void acceptProblem ( IProblem problem ) { } public void close ( ) throws JavaModelException { } private String [ ] convertTypeNamesToSigs ( char [ ] [ ] typeNames ) { } public void enterClass ( int declarationStart , int modifiers , char [ ] name , int nameSourceStart , int nameSourceEnd , char [ ] superclass , char [ ] [ ] superinterfaces ) { } public void enterCompilationUnit ( ) { } public void enterConstructor ( int declarationStart , int modifiers , char [ ] name , int nameSourceStart , int nameSourceEnd , char [ ] [ ] parameterTypes , char [ ] [ ] parameterNames , char [ ] [ ] exceptionTypes ) { } public void enterField ( int declarationStart , int modifiers , char [ ] type , char [ ] name , int nameSourceStart , int nameSourceEnd ) { } public void enterInitializer ( int declarationSourceStart , int modifiers ) { } public void enterInterface ( int declarationStart , int modifiers , char [ ] name , int nameSourceStart , int nameSourceEnd , char [ ] [ ] superinterfaces ) { } public void enterMethod ( int declarationStart , int modifiers , char [ ] returnType , char [ ] name , int nameSourceStart , int nameSourceEnd , char [ ] [ ] parameterTypes , char [ ] [ ] parameterNames , char [ ] [ ] exceptionTypes ) { } public void exitClass ( int declarationEnd ) { } public void exitCompilationUnit ( int declarationEnd ) { } public void exitConstructor ( int declarationEnd ) { } public void exitField ( int declarationEnd ) { } public void exitInitializer ( int declarationEnd ) { } public void exitInterface ( int declarationEnd ) { } public void exitMethod ( int declarationEnd ) { } public char [ ] findSource ( IType type ) { } public char [ ] findSource ( IType type , IBinaryType info ) { } public SourceRange getNameRange ( IJavaElement element ) { } public char [ ] [ ] getMethodParameterNames ( IMethod method ) { } public SourceRange getSourceRange ( IJavaElement element ) { } protected IType getType ( String typeName ) { } protected IJavaElement getUnqualifiedMethodHandle ( IMethod method ) { } public ZipFile getZip ( ) throws CoreException { } public void mapSource ( IType type , char [ ] contents ) { } public ISourceRange mapSource ( IType type , char [ ] contents , IJavaElement searchedElement ) { fType = ( ( BinaryType ) ( type ) ) ; if ( ( this . fSourceRanges . get ( type ) ) != null ) return searchedElement != null ? this . getNameRange ( searchedElement ) : null ; this . importsTable . remove ( fType ) ; this . importsCounterTable . remove ( fType ) ; this . searchedElement = searchedElement ; this . types = new IType [ 1 ] ; this . typeDeclarationStarts = new int [ 1 ] ; this . typeNameRanges = new SourceRange [ 1 ] ; this . typeDepth = - 1 ; this . fMemberDeclarationStart = new int [ 1 ] ; this . fMemberName = new String [ 1 ] ; this . fMemberNameRange = new SourceRange [ 1 ] ; this . fMethodParameterTypes = new char [ 1 ] [ ] [ ] ; this . fMethodParameterNames = new char [ 1 ] [ ] [ ] ; this . anonymousCounter = 0 ; HashMap oldSourceRanges = ( ( HashMap ) ( fSourceRanges . clone ( ) ) ) ; try { IProblemFactory factory = new DefaultProblemFactory ( ) ; SourceElementParser parser = null ; boolean isAnonymousClass = false ; char [ ] fullName = null ; this . anonymousClassName = 0 ; try { IBinaryType binType = ( ( IBinaryType ) ( fType . getRawInfo ( ) ) ) ; isAnonymousClass = binType . isAnonymous ( ) ; fullName = binType . getName ( ) ; } catch ( JavaModelException e ) { } if ( isAnonymousClass ) { String eltName = fType . getElementName ( ) ; eltName = eltName . substring ( ( ( eltName . lastIndexOf ( '$' ) ) + 1 ) , eltName . length ( ) ) ; try { this . anonymousClassName = Integer . parseInt ( eltName ) ; } catch ( NumberFormatException e ) { } } boolean doFullParse = hasToRetrieveSourceRangesForLocalClass ( fullName ) ; parser = new SourceElementParser ( this , factory , new CompilerOptions ( JavaCore . getOptions ( ) ) , doFullParse ) ; <START_BUG> parser . parseCompilationUnit ( new BasicCompilationUnit ( contents , ( ( type . getElementName ( ) ) + ".java" ) , encoding ) , doFullParse ) ; <END_BUG> if ( searchedElement != null ) { ISourceRange range = this . getNameRange ( searchedElement ) ; return range ; } else { return null ; } } finally { if ( searchedElement != null ) { fSourceRanges = oldSourceRanges ; } fType = null ; this . searchedElement = null ; this . types = null ; this . typeDeclarationStarts = null ; this . typeNameRanges = null ; this . typeDepth = - 1 ; } } protected void setMethodParameterNames ( IMethod method , char [ ] [ ] parameterNames ) { } protected void setSourceRange ( IJavaElement element , SourceRange sourceRange , SourceRange nameRange ) { } public char [ ] [ ] getImports ( BinaryType type ) { } private boolean hasToRetrieveSourceRangesForLocalClass ( char [ ] eltName ) { } }

Fix:
parser . parseCompilationUnit ( new BasicCompilationUnit ( contents , null , ( ( type . getElementName ( ) ) + ".java" ) , encoding ) , doFullParse ) ;