Buggy code:
public class ClassFile extends Openable implements IClassFile , SuffixConstants { protected BinaryType fBinaryType = null ; private boolean checkAutomaticSourceMapping ; protected ClassFile ( PackageFragment parent , String name ) { } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { } public void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner owner ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner owner ) throws JavaModelException { } protected Object createElementInfo ( ) { } public boolean exists ( ) { } protected IJavaElement findElement ( IJavaElement elt , int position , SourceMapper mapper ) { } private IBinaryType getBinaryTypeInfo ( IFile file ) throws JavaModelException { } public IClassFile getClassFile ( ) { } public IResource getCorrespondingResource ( ) throws JavaModelException { } public IJavaElement getElementAt ( int position ) throws JavaModelException { } protected char getHandleMementoDelimiter ( ) { } public IPath getPath ( ) { } public IResource getResource ( ) { } public String getSource ( ) throws JavaModelException { } public ISourceRange getSourceRange ( ) throws JavaModelException { } public IType getType ( ) throws JavaModelException { } public IJavaElement getWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory ) throws JavaModelException { } protected boolean hasBuffer ( ) { } public boolean hasChildren ( ) throws JavaModelException { } public boolean isClass ( ) throws JavaModelException { } public boolean isInterface ( ) throws JavaModelException { } public boolean isReadOnly ( ) { } private boolean isValidClassFile ( ) { } protected IBuffer openBuffer ( IProgressMonitor pm , Object info ) throws JavaModelException { SourceMapper mapper = getSourceMapper ( ) ; if ( mapper != null ) { return mapSource ( mapper ) ; } else if ( ! ( checkAutomaticSourceMapping ) ) { PackageFragmentRoot root = getPackageFragmentRoot ( ) ; if ( root . isArchive ( ) ) { String elementName = getElementName ( ) ; StringBuffer sourceFileName = new StringBuffer ( elementName . substring ( 0 , elementName . lastIndexOf ( '.' ) ) ) ; <START_BUG> sourceFileName . append ( Util . SUFFIX_java ) ; <END_BUG> JarPackageFragmentRoot jarPackageFragmentRoot = ( ( JarPackageFragmentRoot ) ( root ) ) ; ZipFile jar = null ; try { jar = jarPackageFragmentRoot . getJar ( ) ; IPackageFragment packageFragment = ( ( IPackageFragment ) ( getParent ( ) ) ) ; ZipEntry zipEntry = null ; if ( packageFragment . isDefaultPackage ( ) ) { zipEntry = jar . getEntry ( sourceFileName . toString ( ) ) ; } else { zipEntry = jar . getEntry ( ( ( ( getParent ( ) . getElementName ( ) ) + '//' ) + ( sourceFileName . toString ( ) ) ) ) ; } if ( zipEntry != null ) { checkAutomaticSourceMapping = true ; root . attachSource ( root . getPath ( ) , null , null ) ; SourceMapper sourceMapper = getSourceMapper ( ) ; if ( sourceMapper != null ) { return mapSource ( sourceMapper ) ; } } } catch ( CoreException e ) { if ( e instanceof JavaModelException ) throw ( ( JavaModelException ) ( e ) ) ; throw new JavaModelException ( e ) ; } finally { JavaModelManager . getJavaModelManager ( ) . closeZipFile ( jar ) ; } } else { String qualifiedName = getType ( ) . getFullyQualifiedName ( ) ; NameLookup lookup = ( ( JavaProject ) ( getJavaProject ( ) ) ) . getNameLookup ( ) ; ICompilationUnit cu = lookup . findCompilationUnit ( qualifiedName ) ; if ( cu != null ) { return cu . getBuffer ( ) ; } else { IPath sourceFilePath = getPath ( ) . removeFileExtension ( ) . addFileExtension ( SuffixConstants . EXTENSION_java ) ; IWorkspace workspace = ResourcesPlugin . getWorkspace ( ) ; if ( workspace == null ) { checkAutomaticSourceMapping = true ; return null ; } if ( ( JavaModel . getTarget ( workspace . getRoot ( ) , sourceFilePath . makeRelative ( ) , true ) ) != null ) { checkAutomaticSourceMapping = true ; root . attachSource ( root . getPath ( ) , null , null ) ; SourceMapper sourceMapper = getSourceMapper ( ) ; if ( sourceMapper != null ) { return mapSource ( sourceMapper ) ; } } } } } return null ; } private IBuffer mapSource ( SourceMapper mapper ) throws JavaModelException { } static char [ ] simpleName ( char [ ] className ) { } public static char [ ] translatedName ( char [ ] name ) { } static char [ ] [ ] translatedNames ( char [ ] [ ] names ) { } static char [ ] unqualifiedName ( char [ ] className ) { } public void codeComplete ( int offset , final ICodeCompletionRequestor requestor ) throws JavaModelException { } }

Fix:
sourceFileName . append ( SuffixConstants . SUFFIX_java ) ;