@ Override public String findClassAbsoluteFileName ( String fileName , String className , List < String > sourceRoots ) { // usually the fileName is just the name of the file without any package information // so lets turn the package name into a path int lastIdx = className . lastIndexOf ( ' ' ) ; if ( lastIdx > 0 && ! ( fileName . contains ( "/" ) || fileName . contains ( File . separator ) ) ) { String packagePath = className . substring ( 0 , lastIdx ) . replace ( ' ' , File . separatorChar ) ; fileName = packagePath + File . separator + fileName ; } File baseDir = getBaseDir ( ) ; String answer = findInSourceFolders ( baseDir , fileName ) ; if ( answer == null && sourceRoots != null ) { for ( String sourceRoot : sourceRoots ) { answer = findInSourceFolders ( new File ( sourceRoot ) , fileName ) ; if ( answer != null ) break ; } } return answer ; }
Given a class name and a file name try to find the absolute file name of the source file on the users machine or null if it cannot be found