Buggy code:
public class SuperTypeNamesCollector { public class TypeDeclarationVisitor extends ASTVisitor { public boolean visit ( TypeDeclaration typeDeclaration , BlockScope scope ) { } public boolean visit ( TypeDeclaration typeDeclaration , CompilationUnitScope scope ) { } public boolean visit ( TypeDeclaration memberTypeDeclaration , ClassScope scope ) { } public boolean visit ( FieldDeclaration fieldDeclaration , MethodScope scope ) { } public boolean visit ( Initializer initializer , MethodScope scope ) { } public boolean visit ( ConstructorDeclaration constructorDeclaration , ClassScope scope ) { } public boolean visit ( MethodDeclaration methodDeclaration , ClassScope scope ) { } } SearchPattern pattern ; char [ ] typeSimpleName ; char [ ] typeQualification ; MatchLocator locator ; IType type ; IProgressMonitor progressMonitor ; char [ ] [ ] [ ] result ; int resultIndex ; public SuperTypeNamesCollector ( SearchPattern pattern , char [ ] typeSimpleName , char [ ] typeQualification , MatchLocator locator , IType type , IProgressMonitor progressMonitor ) { } protected void addToResult ( char [ ] [ ] compoundName ) { } protected CompilationUnitDeclaration buildBindings ( ICompilationUnit compilationUnit , boolean isTopLevelOrMember ) throws JavaModelException { final IFile file = ( ( IFile ) ( compilationUnit . getResource ( ) ) ) ; final String fileName = file . getFullPath ( ) . lastSegment ( ) ; <START_BUG> final char [ ] mainTypeName = fileName . substring ( 0 , ( ( fileName . length ( ) ) - 5 ) ) . toCharArray ( ) ; <END_BUG> IBuffer buffer = compilationUnit . getBuffer ( ) ; final char [ ] source = ( compilationUnit . isWorkingCopy ( ) ) ? buffer == null ? null : buffer . getCharacters ( ) : Util . getResourceContentsAsCharArray ( file ) ; org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit = new org . eclipse . jdt . internal . compiler . env . ICompilationUnit ( ) { public char [ ] getContents ( ) { return source ; } public char [ ] getFileName ( ) { return fileName . toCharArray ( ) ; } public char [ ] getMainTypeName ( ) { return mainTypeName ; } public char [ ] [ ] getPackageName ( ) { return null ; } } ; CompilationResult compilationResult = new CompilationResult ( sourceUnit , 1 , 1 , 0 ) ; CompilationUnitDeclaration unit = ( isTopLevelOrMember ) ? this . locator . basicParser ( ) . dietParse ( sourceUnit , compilationResult ) : this . locator . basicParser ( ) . parse ( sourceUnit , compilationResult ) ; if ( unit != null ) { this . locator . lookupEnvironment . buildTypeBindings ( unit , null ) ; this . locator . lookupEnvironment . completeTypeBindings ( unit , ( ! isTopLevelOrMember ) ) ; if ( ! isTopLevelOrMember ) { if ( ( unit . scope ) != null ) unit . scope . faultInTypes ( ) ; unit . resolve ( ) ; } } return unit ; } public char [ ] [ ] [ ] collect ( ) throws JavaModelException { } protected void collectSuperTypeNames ( ReferenceBinding binding ) { } protected String [ ] getPathsOfDeclaringType ( ) { } protected boolean matches ( char [ ] [ ] compoundName ) { } protected boolean matches ( ReferenceBinding binding ) { } }

Fix:
final char [ ] mainTypeName = Util . getNameWithoutJavaLikeExtension ( fileName ) . toCharArray ( ) ;