private static void processPathPart ( String path , Set < String > classes ) { File rootFile = new File ( path ) ; if ( rootFile . isDirectory ( ) == false ) { return ; } File [ ] files = rootFile . listFiles ( ) ; for ( File f : files ) { // classes in the anonymous package if ( f . getName ( ) . endsWith ( ".class" ) ) { String className = f . getName ( ) ; // trim the trailing .class from the end className = className . substring ( 0 , className . length ( ) - ".class" . length ( ) ) ; classes . add ( className ) ; } if ( f . isDirectory ( ) ) { Package p = new Package ( null , f ) ; p . process ( classes ) ; } } }
For a given classpath root scan it for packages and classes adding all found classnames to the given classes param .