Buggy code:
public final class ClassFinder { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final String DOT_JAR = ".jar" ; private static final String DOT_CLASS = ".class" ; private static final int DOT_CLASS_LEN = ClassFinder . DOT_CLASS . length ( ) ; private ClassFinder ( ) { } private static class FilterTreeSet extends TreeSet < String > { private static final long serialVersionUID = 234L ; private final Class < ? > [ ] parents ; private final boolean inner ; private final String contains ; private final String notContains ; private final transient ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; FilterTreeSet ( Class < ? > [ ] parents , boolean inner , String contains , String notContains ) { } @ Override public boolean add ( String s ) { } } private static class AnnoFilterTreeSet extends TreeSet < String > { private static final long serialVersionUID = 240L ; private final boolean inner ; private final Class < ? extends Annotation > [ ] annotations ; private final transient ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; AnnoFilterTreeSet ( Class < ? extends Annotation > [ ] annotations , boolean inner ) { } @ Override public boolean add ( String s ) { } } public static List < String > findClassesThatExtend ( String [ ] paths , Class < ? > [ ] superClasses ) throws IOException { } private static String [ ] addJarsInPath ( String [ ] paths ) { Set < String > fullList = new HashSet < String > ( ) ; for ( int i = 0 ; i < ( paths . length ) ; i ++ ) { final String path = paths [ i ] ; fullList . add ( path ) ; if ( ! ( path . endsWith ( ClassFinder . DOT_JAR ) ) ) { File dir = new File ( path ) ; if ( ( dir . exists ( ) ) && ( dir . isDirectory ( ) ) ) { String [ ] jars = dir . list ( new FilenameFilter ( ) { public boolean accept ( File f , String name ) { return name . endsWith ( ClassFinder . DOT_JAR ) ; } } ) ; for ( int x = 0 ; x < ( jars . length ) ; x ++ ) { fullList . add ( jars [ x ] ) ; } } } } <START_BUG> return fullList . toArray ( new String [ 0 ] ) ; <END_BUG> } public static List < String > findClassesThatExtend ( String [ ] strPathsOrJars , final Class < ? > [ ] superClasses , final boolean innerClasses ) throws IOException { } public static List < String > findClassesThatExtend ( String [ ] strPathsOrJars , final Class < ? > [ ] superClasses , final boolean innerClasses , String contains , String notContains ) throws IOException { } public static List < String > findAnnotatedClasses ( String [ ] strPathsOrJars , final Class < ? extends Annotation > [ ] annotations , final boolean innerClasses ) throws IOException { } public static List < String > findAnnotatedClasses ( String [ ] strPathsOrJars , final Class < ? extends Annotation > [ ] annotations ) throws IOException { } private static List < String > findClassesThatExtend ( String [ ] strPathsOrJars , final Class < ? > [ ] classNames , final boolean innerClasses , String contains , String notContains , boolean annotations ) throws IOException { } private static List < String > getClasspathMatches ( String [ ] strPathsOrJars ) { } private static String fixPathEntry ( String path ) { } private static boolean isChildOf ( Class < ? > [ ] parentClasses , String strClassName , ClassLoader contextClassLoader ) { } private static boolean hasAnnotationOnMethod ( Class < ? extends Annotation > [ ] annotations , String classInQuestion , ClassLoader contextClassLoader ) { } private static String fixClassName ( String strClassName ) { } private static void findClassesInOnePath ( String strPath , Set < String > listClasses ) throws IOException { } private static void findClassesInPaths ( List < String > listPaths , Set < String > listClasses ) throws IOException { } private static void findClassesInPathsDir ( String strPathElement , File dir , Set < String > listClasses ) throws IOException { } }

Fix:
return fullList . toArray ( new String [ fullList . size ( ) ] ) ;