public class LinkageCheckClassPath
extends org.apache.bcel.util.ClassPath
LinkageChecker. When loading a resource for a
class, LinkageCheckClassPath ensures that the class file comes from only the extension
class loader or the class path specified at the constructor argument.
Background: BCEL's ClassPath.getInputStream(String, String) uses the system class
loader to read class files when ClassPathRepository.loadClass(String) is called, meaning that it loads
other classes outside the class path specified at its constructor argument. In other words,
classes used in this cloud-opensource-java project (including Guava 26) would be unexpectedly
loaded by the system class loader when running linkage check, if BCEL's ClassPath
is naively used.
This class is introduced to avoid the mix-up of the class paths. It loads resources only from the extension class loader, which does not include the class path of this project, or the class path specified at the constructor argument.
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getInputStream(String name,
String suffix)
Returns an input stream for a resource in the class path.
|
public InputStream getInputStream(String name, String suffix) throws IOException
getInputStream in class org.apache.bcel.util.ClassPathname - a slash separated relative path such as "java/lang/String"suffix - the extension of the file in the classpath such as ".class" or ".xml"IOExceptionCopyright © 2018–2021 Google LLC.. All rights reserved.