Package edu.umd.cs.findbugs.ba
Class SourceFinder
java.lang.Object
edu.umd.cs.findbugs.ba.SourceFinder
- All Implemented Interfaces:
AutoCloseable
Class to open input streams on source files. It maintains a "source path",
which is like a classpath, but for finding source files instead of class
files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private static class
Cache of SourceFiles.private static class
A directory containing source files.private static class
private static interface
A repository of source files.(package private) static class
A zip or jar archive containing source files. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SourceFinder.Cache
private static final int
private static final boolean
private Project
private List
<SourceFinder.SourceRepository> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
findSourceFile
(SourceLineAnnotation source) findSourceFile
(String packageName, String fileName) Open a source file in given package.getBase
(SourceLineAnnotation sourceLineAnnotation) static String
getCanonicalName
(SourceLineAnnotation source) static String
getCanonicalName
(String packageName, String fileName) static String
static String
getPlatformName
(SourceLineAnnotation source) static String
getPlatformName
(String packageName, String fileName) boolean
hasSourceFile
(SourceLineAnnotation source) boolean
hasSourceFile
(String packageName, String fileName) (package private) SourceFinder.SourceRepository
(package private) SourceFinder.SourceRepository
private InputStream
openSource
(SourceLineAnnotation source) openSource
(String packageName, String fileName) Open an input stream on a source file in given package.private void
setProject
(Project project) void
setSourceBaseList
(Iterable<String> sourceBaseList) Set the list of source directories.
-
Field Details
-
DEBUG
private static final boolean DEBUG -
CACHE_SIZE
private static final int CACHE_SIZE- See Also:
-
repositoryList
-
cache
-
project
-
-
Constructor Details
-
SourceFinder
-
-
Method Details
-
makeInMemorySourceRepository
-
makeJarURLConnectionSourceRepository
- Throws:
IOException
-
open
- Parameters:
url
-- Returns:
- Throws:
IOException
MalformedURLException
-
getProject
- Returns:
- Returns the project.
-
setSourceBaseList
Set the list of source directories. -
openSource
Open an input stream on a source file in given package.- Parameters:
packageName
- the name of the package containing the class whose source file is givenfileName
- the unqualified name of the source file- Returns:
- an InputStream on the source file
- Throws:
IOException
- if a matching source file cannot be found
-
openSource
- Throws:
IOException
-
findSourceFile
- Throws:
IOException
-
findSourceFile
Open a source file in given package.- Parameters:
packageName
- the name of the package containing the class whose source file is givenfileName
- the unqualified name of the source file- Returns:
- the source file
- Throws:
IOException
- if a matching source file cannot be found
-
getPlatformName
-
getPlatformName
-
getCanonicalName
-
getCanonicalName
-
getOrGuessSourceFile
-
hasSourceFile
-
hasSourceFile
-
setProject
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
getBase
-
getBase
-