Package edu.umd.cs.findbugs
Class DiscoverSourceDirectories
- java.lang.Object
-
- edu.umd.cs.findbugs.DiscoverSourceDirectories
-
public class DiscoverSourceDirectories extends java.lang.ObjectBased on the contents of the application directories/archives in a Project, and a "root" source directory (under which some number of "real" source directories may be located), scan to find the source directories containing the application's source files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDiscoverSourceDirectories.NoOpErrorLoggerprivate static classDiscoverSourceDirectories.NoOpProgressstatic interfaceDiscoverSourceDirectories.ProgressProgress callback interface for reporting the progress of source directory discovery.
-
Field Summary
Fields Modifier and Type Field Description private static booleanDEBUGprivate java.util.List<java.lang.String>discoveredSourceDirectoryListprivate IErrorLoggererrorLoggerprivate DiscoverSourceDirectories.Progressprogressprivate Projectprojectprivate java.lang.StringrootSourceDirectory
-
Constructor Summary
Constructors Constructor Description DiscoverSourceDirectories()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private IClassPathbuildClassPath(IClassPathBuilder builder, IClassFactory factory)voidexecute()Execute the search for source directories.private java.lang.StringfindFullyQualifiedSourceFileName(IClassPath classPath, ClassDescriptor classDesc)private java.util.List<java.lang.String>findFullyQualifiedSourceFileNames(IClassPathBuilder builder, IClassPath classPath)private voidfindSourceDirectoriesForAllSourceFiles(java.util.List<java.lang.String> fullyQualifiedSourceFileNameList, java.util.List<java.lang.String> candidateSourceDirList)java.util.List<java.lang.String>getDiscoveredSourceDirectoryList()Get the list of discovered source directories.static voidmain(java.lang.String[] args)Just for testing.voidsetErrorLogger(IErrorLogger errorLogger)Set the error logger to use to report errors during scanning.voidsetProgress(DiscoverSourceDirectories.Progress progress)Set the progress callback to which scanning progress should be reported.voidsetProject(Project project)Set the Project for which we want to find source directories.voidsetRootSourceDirectory(java.lang.String rootSourceDirectory)Set the "root" source directory: we expect all of the actual source directories to be underneath it.
-
-
-
Field Detail
-
DEBUG
private static boolean DEBUG
-
project
private Project project
-
rootSourceDirectory
private java.lang.String rootSourceDirectory
-
errorLogger
private IErrorLogger errorLogger
-
progress
private DiscoverSourceDirectories.Progress progress
-
discoveredSourceDirectoryList
private final java.util.List<java.lang.String> discoveredSourceDirectoryList
-
-
Method Detail
-
setProject
public void setProject(Project project)
Set the Project for which we want to find source directories.- Parameters:
project- Project for which we want to find source directories
-
setRootSourceDirectory
public void setRootSourceDirectory(java.lang.String rootSourceDirectory)
Set the "root" source directory: we expect all of the actual source directories to be underneath it.- Parameters:
rootSourceDirectory- the root source directory
-
setErrorLogger
public void setErrorLogger(IErrorLogger errorLogger)
Set the error logger to use to report errors during scanning. By default, a no-op error logger is used.- Parameters:
errorLogger- error logger to use to report errors during scanning
-
setProgress
public void setProgress(DiscoverSourceDirectories.Progress progress)
Set the progress callback to which scanning progress should be reported.- Parameters:
progress- the progress callback
-
getDiscoveredSourceDirectoryList
public java.util.List<java.lang.String> getDiscoveredSourceDirectoryList()
Get the list of discovered source directories. These can be added to a Project.- Returns:
- list of discovered source directories.
-
execute
public void execute() throws CheckedAnalysisException, java.io.IOException, java.lang.InterruptedExceptionExecute the search for source directories.- Throws:
CheckedAnalysisExceptionjava.io.IOExceptionjava.lang.InterruptedException
-
buildClassPath
private IClassPath buildClassPath(IClassPathBuilder builder, IClassFactory factory) throws java.lang.InterruptedException, java.io.IOException, CheckedAnalysisException
- Throws:
java.lang.InterruptedExceptionjava.io.IOExceptionCheckedAnalysisException
-
findFullyQualifiedSourceFileName
private java.lang.String findFullyQualifiedSourceFileName(IClassPath classPath, ClassDescriptor classDesc) throws java.io.IOException, CheckedAnalysisException
- Throws:
java.io.IOExceptionCheckedAnalysisException
-
findFullyQualifiedSourceFileNames
private java.util.List<java.lang.String> findFullyQualifiedSourceFileNames(IClassPathBuilder builder, IClassPath classPath)
-
findSourceDirectoriesForAllSourceFiles
private void findSourceDirectoriesForAllSourceFiles(java.util.List<java.lang.String> fullyQualifiedSourceFileNameList, java.util.List<java.lang.String> candidateSourceDirList)
-
main
public static void main(java.lang.String[] args) throws java.io.IOException, CheckedAnalysisException, java.lang.InterruptedExceptionJust for testing.- Throws:
java.io.IOExceptionCheckedAnalysisExceptionjava.lang.InterruptedException
-
-