diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java index 921c41088b7757..c3ad8e038bd0b4 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java @@ -15,7 +15,6 @@ /** * Classloader used for production application, using the multi jar strategy - * */ public class RunnerClassLoader extends ClassLoader { @@ -33,7 +32,7 @@ public class RunnerClassLoader extends ClassLoader { } RunnerClassLoader(ClassLoader parent, Map<String, ClassLoadingResource[]> resourceDirectoryMap, - Set<String> parentFirstPackages) { + Set<String> parentFirstPackages) { super(parent); this.resourceDirectoryMap = resourceDirectoryMap; this.parentFirstPackages = parentFirstPackages; @@ -49,10 +48,6 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce //note that for performance reasons this CL does not do parent first delegation //although the intention is not for it to be a true isolated parent first CL //'delegation misses' where the parent throws a ClassNotFoundException are very expensive - Class<?> loaded = findLoadedClass(name); - if (loaded != null) { - return loaded; - } if (name.startsWith("java.")) { return getParent().loadClass(name); } @@ -61,6 +56,10 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce return getParent().loadClass(name); } synchronized (getClassLoadingLock(name)) { + Class<?> loaded = findLoadedClass(name); + if (loaded != null) { + return loaded; + } ClassLoadingResource[] resources; if (packageName == null) { resources = resourceDirectoryMap.get("");