<div dir="ltr"><div>That is only true for Class::getResource which resolves resources relative to the loaded class's class file location. Java agents typically use ClassLoader::getResource(AsStream) as the loaded class is not available in the general case of transforming, and not retransforming, a class. For example, when instrumenting a newly loaded class A in a ClassFileTransformer, it might not be the case that its superclass B is loaded. If class B exists in two versions as part of a multi-release jar file, currently, you need to query the class loader of A as the JVM would do. When loading a class, ClassLoader::findClass respects the multi-release characteristic. But for ClassLoader::getResource, this is not the case. This is why I want to suggest a new method where this is possible, as the intend to resolve a class file is explicit. Currently, you need to iterate as the ClassLoader does not expose any relevant information.</div></div>