jOOR - Fluent Reflection in Java jOOR is a very simple fluent API that gives access to your Java Class structures in a more intuitive way. The JDK's reflection APIs are hard and verbose to use. Other languages have much simpler constructs to access type meta information at runtime. Let us make Java reflection better.
The current implementation for JDK 9+'s default behaviour when all else fails is to create a new ad-hoc class loader and load the compiled byte array this way:
result = new ClassLoader() {
@Override
protected Class<?> findClass(String name) {
byte[] b = fileManager.o.getBytes();
return defineClass(className, b, 0, b.length);
}
}.loadClass(className);
This approach using an anonymous class leaks the fileManager instance, and thus transitively other unnecessary artifacts. We only need the byte[] in this class loader.
The current implementation for JDK 9+'s default behaviour when all else fails is to create a new ad-hoc class loader and load the compiled byte array this way:
This approach using an anonymous class leaks the
fileManager
instance, and thus transitively other unnecessary artifacts. We only need thebyte[]
in this class loader.