Buggy code:
public class SearchableEnvironment implements IJavaSearchConstants , INameEnvironment { public NameLookup nameLookup ; protected ICompilationUnit unitToSkip ; protected org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ; protected JavaProject project ; protected IJavaSearchScope searchScope ; protected boolean checkAccessRestrictions ; public SearchableEnvironment ( JavaProject project , org . eclipse . jdt . core . ICompilationUnit [ ] workingCopies ) throws JavaModelException { } public SearchableEnvironment ( JavaProject project , WorkingCopyOwner owner ) throws JavaModelException { } protected NameEnvironmentAnswer find ( String typeName , String packageName ) { if ( packageName == null ) packageName = IPackageFragment . DEFAULT_PACKAGE_NAME ; IType type = this . nameLookup . findType ( typeName , packageName , false , NameLookup . ACCEPT_ALL ) ; if ( type != null ) { boolean isBinary = type instanceof BinaryType ; AccessRestriction accessRestriction = null ; if ( ( this . checkAccessRestrictions ) && ( isBinary || ( ! ( type . getJavaProject ( ) . equals ( this . project ) ) ) ) ) { PackageFragmentRoot root = ( ( PackageFragmentRoot ) ( type . getAncestor ( IJavaElement . PACKAGE_FRAGMENT_ROOT ) ) ) ; ClasspathEntry entry = ( ( ClasspathEntry ) ( this . nameLookup . rootToResolvedEntries . get ( root ) ) ) ; if ( entry != null ) { AccessRuleSet accessRuleSet = entry . getAccessRuleSet ( ) ; if ( accessRuleSet != null ) { char [ ] [ ] packageChars = CharOperation . splitOn ( '.' , packageName . toCharArray ( ) ) ; <START_BUG> char [ ] classFileChars = type . getParent ( ) . getElementName ( ) . toCharArray ( ) ; <END_BUG> accessRestriction = accessRuleSet . getViolatedRestriction ( CharOperation . concatWith ( packageChars , classFileChars , '//' ) ) ; } } } if ( isBinary ) { try { return new NameEnvironmentAnswer ( ( ( IBinaryType ) ( ( ( BinaryType ) ( type ) ) . getElementInfo ( ) ) ) , accessRestriction ) ; } catch ( JavaModelException npe ) { return null ; } } else { try { SourceTypeElementInfo sourceType = ( ( SourceTypeElementInfo ) ( ( ( SourceType ) ( type ) ) . getElementInfo ( ) ) ) ; ISourceType topLevelType = sourceType ; while ( ( topLevelType . getEnclosingType ( ) ) != null ) { topLevelType = topLevelType . getEnclosingType ( ) ; } IType [ ] types = sourceType . getHandle ( ) . getCompilationUnit ( ) . getTypes ( ) ; ISourceType [ ] sourceTypes = new ISourceType [ types . length ] ; sourceTypes [ 0 ] = sourceType ; int length = types . length ; for ( int i = 0 , index = 1 ; i < length ; i ++ ) { ISourceType otherType = ( ( ISourceType ) ( ( ( JavaElement ) ( types [ i ] ) ) . getElementInfo ( ) ) ) ; if ( ( ! ( otherType . equals ( topLevelType ) ) ) && ( index < length ) ) sourceTypes [ ( index ++ ) ] = otherType ; } return new NameEnvironmentAnswer ( sourceTypes , accessRestriction ) ; } catch ( JavaModelException npe ) { return null ; } } } return null ; } public void findPackages ( char [ ] prefix , ISearchRequestor requestor ) { } public NameEnvironmentAnswer findType ( char [ ] [ ] compoundTypeName ) { } public NameEnvironmentAnswer findType ( char [ ] name , char [ ] [ ] packageName ) { } public void findTypes ( char [ ] prefix , final boolean findMembers , final ISearchRequestor storage ) { } private void findTypes ( String prefix , ISearchRequestor storage , int type ) { } public boolean isPackage ( char [ ] [ ] parentPackageName , char [ ] subPackageName ) { } public boolean isTopLevelPackage ( char [ ] packageName ) { } protected String toStringChar ( char [ ] name ) { } protected String toStringCharChar ( char [ ] [ ] names ) { } public void cleanup ( ) { } }

Fix:
char [ ] classFileChars = type . getElementName ( ) . toCharArray ( ) ;