Skip to content

Commit

Permalink
Remove parent delegation hack from QuarkusClassLoader
Browse files Browse the repository at this point in the history
It is no longer needed

Fixes quarkusio#10226
  • Loading branch information
stuartwdouglas committed Nov 2, 2020
1 parent 366c96b commit 23174dc
Showing 1 changed file with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.ProtectionDomain;
Expand Down Expand Up @@ -72,31 +71,11 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
private volatile MemoryClassPathElement transformedClasses;
private volatile ClassLoaderState state;

static final ClassLoader PLATFORM_CLASS_LOADER;

static {
ClassLoader cl = null;
try {
cl = (ClassLoader) ClassLoader.class.getDeclaredMethod("getPlatformClassLoader").invoke(null);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {

}
PLATFORM_CLASS_LOADER = cl;
}

private boolean closed;
private volatile boolean driverLoaded;

private QuarkusClassLoader(Builder builder) {
//we need the parent to be null
//as MP has super broken class loading where it attempts to resolve stuff from the parent
//will hopefully be fixed in 1.4
//e.g. https://github.com/eclipse/microprofile-config/issues/390
//e.g. https://github.com/eclipse/microprofile-reactive-streams-operators/pull/130
//to further complicate things we also have https://github.com/quarkusio/quarkus/issues/8985
//where getParent must work to load JDK services on JDK9+
//to get around this we pass in the platform ClassLoader, if it exists
super(PLATFORM_CLASS_LOADER);
super(builder.parent);
this.name = builder.name;
this.elements = builder.elements;
this.bannedElements = builder.bannedElements;
Expand Down

0 comments on commit 23174dc

Please sign in to comment.