Class JrtfsCodeBase
java.lang.Object
edu.umd.cs.findbugs.classfile.impl.AbstractScannableCodeBase
edu.umd.cs.findbugs.classfile.impl.JrtfsCodeBase
- All Implemented Interfaces:
ICodeBase, IScannableCodeBase, AutoCloseable
Code base supporting Java 9 new jimage packed modules
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclassNested classes/interfaces inherited from interface ICodeBase
ICodeBase.Discovered -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method should be called when done using the code base.private @Nullable ICodeBaseEntrycreateEntry(String resourceName, String moduleName) boolean(package private) static @NonNull Stringprivate static StringgetPackage(String resourceName) Get the filesystem pathname of this codebase.inthashCode()(package private) static booleanisClassFile(Path p) iterator()Get an iterator over the resources in the this code base.private static @Nullable PathjavaHomeOf(String jrtFsJar) Maps<javaHome>/lib/jrt-fs.jarback to<javaHome>.@Nullable ICodeBaseEntrylookupResource(String resourceName) Look up a resource in this code base.private static FileSystemopenJrtFileSystem(String jrtFsJar) Opens the module image of the JDK the givenjrt-fs.jarbelongs to, which is not necessarily the JDK running SpotBugs.toString()
-
Field Details
-
PRIME
private static final int PRIME- See Also:
-
fs
-
fileName
-
root
-
packageToModuleMap
-
-
Constructor Details
-
JrtfsCodeBase
- Throws:
IOException
-
-
Method Details
-
openJrtFileSystem
Opens the module image of the JDK the givenjrt-fs.jarbelongs to, which is not necessarily the JDK running SpotBugs.Selecting a foreign image requires the
java.homeenvironment entry used byjdk.internal.jrtfs.JrtFileSystemProvider. Without it, thejrtprovider installed in the running JVM answers the request with the running JVM's own image.Passing a class loader over the given
jrt-fs.jardoes not help: since Java 9,java.baseinstalls a provider for thejrtscheme, andFileSystems.newFileSystem(URI, Map, ClassLoader)falls back to the loader only when no installed provider matches the scheme.- Parameters:
jrtFsJar- path of ajrt-fs.jar, usually<javaHome>/lib/jrt-fs.jar- Returns:
- file system for the module image of that JDK, or of the running JVM if the jar is not in the layout expected by the provider
- Throws:
IOException
-
javaHomeOf
-
createPackageToModuleMap
- Throws:
IOException
-
lookupResource
Description copied from interface:ICodeBaseLook up a resource in this code base.- Parameters:
resourceName- name of the resource to look up- Returns:
- ICodeBaseEntry representing the resource or null if the resource cannot be found in this code base
-
createEntry
-
getPackage
-
getPathName
-
hashCode
-
equals
-
toString
-
close
public void close()Description copied from interface:ICodeBaseThis method should be called when done using the code base. -
iterator
Description copied from interface:IScannableCodeBaseGet an iterator over the resources in the this code base.- Returns:
- ICodeBaseIterator over the resources in the code base
- Throws:
InterruptedException
-
fileName
-
isClassFile
-