Buggy code:
public class PackageFragmentRoot extends Openable implements IPackageFragmentRoot { protected static final char ATTACHMENT_PROPERTY_DELIMITER = '*' ; protected static final String NO_SOURCE_ATTACHMENT = "" ; protected static final SourceMapper NO_SOURCE_MAPPER = new SourceMapper ( ) ; protected Object resource ; protected PackageFragmentRoot ( IResource resource , JavaProject project ) { } public void attachSource ( IPath sourcePath , IPath rootPath , IProgressMonitor monitor ) throws JavaModelException { } protected boolean buildStructure ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { } SourceMapper createSourceMapper ( IPath sourcePath , IPath rootPath ) { <START_BUG> SourceMapper mapper = new SourceMapper ( sourcePath , ( rootPath == null ? null : rootPath . toOSString ( ) ) , ( this . isExternal ( ) ? JavaCore . getOptions ( ) : this . getJavaProject ( ) . getOptions ( true ) ) ) ; <END_BUG> return mapper ; } public void delete ( int updateResourceFlags , int updateModelFlags , IProgressMonitor monitor ) throws JavaModelException { } protected boolean computeChildren ( OpenableElementInfo info , Map newElements ) throws JavaModelException { } protected void computeFolderChildren ( IContainer folder , boolean isIncluded , String [ ] pkgName , ArrayList vChildren , char [ ] [ ] inclusionPatterns , char [ ] [ ] exclusionPatterns ) throws JavaModelException { } public void copy ( IPath destination , int updateResourceFlags , int updateModelFlags , IClasspathEntry sibling , IProgressMonitor monitor ) throws JavaModelException { } protected Object createElementInfo ( ) { } public IPackageFragment createPackageFragment ( String pkgName , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected int determineKind ( IResource underlyingResource ) throws JavaModelException { } public boolean equals ( Object o ) { } public boolean exists ( ) { } public IClasspathEntry findSourceAttachmentRecommendation ( ) { } public char [ ] [ ] fullExclusionPatternChars ( ) { } public char [ ] [ ] fullInclusionPatternChars ( ) { } public String getElementName ( ) { } public int getElementType ( ) { } protected char getHandleMementoDelimiter ( ) { } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { } protected void getHandleMemento ( StringBuffer buff ) { } public int getKind ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public IPackageFragment getPackageFragment ( String packageName ) { } public PackageFragment getPackageFragment ( String [ ] pkgName ) { } protected String getPackageName ( IFolder folder ) { } public IPath getPath ( ) { } public IClasspathEntry getRawClasspathEntry ( ) throws JavaModelException { } public IResource getResource ( ) { } public IPath getSourceAttachmentPath ( ) throws JavaModelException { } protected String getSourceAttachmentProperty ( ) throws JavaModelException { } protected QualifiedName getSourceAttachmentPropertyName ( ) { } public void setSourceAttachmentProperty ( String property ) { } public void setSourceMapper ( SourceMapper mapper ) throws JavaModelException { } public IPath getSourceAttachmentRootPath ( ) throws JavaModelException { } public SourceMapper getSourceMapper ( ) { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public boolean hasChildren ( ) throws JavaModelException { } public int hashCode ( ) { } public boolean isArchive ( ) { } public boolean isExternal ( ) { } protected IStatus validateOnClasspath ( ) { } public void move ( IPath destination , int updateResourceFlags , int updateModelFlags , IClasspathEntry sibling , IProgressMonitor monitor ) throws JavaModelException { } protected void toStringInfo ( int tab , StringBuffer buffer , Object info ) { } protected void verifyAttachSource ( IPath sourcePath ) throws JavaModelException { } }

Fix:
SourceMapper mapper = new SourceMapper ( sourcePath , ( rootPath == null ? null : rootPath . toOSString ( ) ) , getJavaProject ( ) . getOptions ( true ) ) ;