From ce494e8365658f76b2648f5d0ccfd6753c880249 Mon Sep 17 00:00:00 2001 From: Matt Benson Date: Sun, 13 Feb 2022 14:37:53 -0600 Subject: use coreLoader, if set, to create subordinate classLoaders --- src/main/org/apache/tools/ant/Project.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 5b20ca0c2..2cd2ba9c5 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Map; +import java.util.Optional; import java.util.Properties; import java.util.Set; import java.util.Stack; @@ -339,8 +340,8 @@ public class Project implements ResourceFactory { * @return an appropriate classloader. */ public AntClassLoader createClassLoader(final Path path) { - return AntClassLoader - .newAntClassLoader(getClass().getClassLoader(), this, path, true); + return createClassLoader( + Optional.ofNullable(getCoreLoader()).orElse(getClass().getClassLoader()), path); } /** @@ -352,8 +353,7 @@ public class Project implements ResourceFactory { * * @return an appropriate classloader. */ - public AntClassLoader createClassLoader( - final ClassLoader parent, final Path path) { + public AntClassLoader createClassLoader(final ClassLoader parent, final Path path) { return AntClassLoader.newAntClassLoader(parent, this, path, true); } -- cgit v1.2.1