private List < String > listCompiledClassesRegex ( File classFolder ) { List < String > classNames = new ArrayList < String > ( ) ; Stack < File > todo = new Stack < File > ( ) ; todo . push ( classFolder ) ; String classFolderPath = classFolder . getAbsolutePath ( ) ; getLog ( ) . info ( "ClassFolderPath=" + classFolderPath ) ; Pattern pat = Pattern . compile ( classFolderPath + File . separator + "(.*).class" ) ; File workDir ; String name ; while ( ! todo . isEmpty ( ) ) { workDir = todo . pop ( ) ; for ( File file : workDir . listFiles ( ) ) { if ( file . isDirectory ( ) ) { todo . push ( file ) ; } else { if ( file . getName ( ) . endsWith ( ".class" ) ) { name = file . getAbsolutePath ( ) ; name = pat . matcher ( name ) . group ( 1 ) ; name = name . replace ( File . separator , "." ) ; getLog ( ) . debug ( "Found class: " + name ) ; classNames . add ( name ) ; } } } } return classNames ; }
Walks the classFolder and finds all . class files