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 classprivate static classCache of SourceFiles.private static classA directory containing source files.private static classprivate static interfaceA repository of source files.(package private) static classA zip or jar archive containing source files. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SourceFinder.Cacheprivate static final intprivate static final booleanprivate Projectprivate List<SourceFinder.SourceRepository> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()findSourceFile(SourceLineAnnotation source) findSourceFile(String packageName, String fileName) Open a source file in given package.getBase(SourceLineAnnotation sourceLineAnnotation) static StringgetCanonicalName(SourceLineAnnotation source) static StringgetCanonicalName(String packageName, String fileName) static Stringstatic StringgetPlatformName(SourceLineAnnotation source) static StringgetPlatformName(String packageName, String fileName) booleanhasSourceFile(SourceLineAnnotation source) booleanhasSourceFile(String packageName, String fileName) (package private) SourceFinder.SourceRepository(package private) SourceFinder.SourceRepositoryprivate InputStreamopenSource(SourceLineAnnotation source) openSource(String packageName, String fileName) Open an input stream on a source file in given package.private voidsetProject(Project project) voidsetSourceBaseList(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:
IOExceptionMalformedURLException
-
getProject
- Returns:
- Returns the project.
-
setSourceBaseList
-
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:
closein interfaceAutoCloseable
-
getBase
-
getBase
-