|
|
|
@ -25,6 +25,7 @@ import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.jar.Attributes; |
|
|
|
import java.util.jar.Attributes; |
|
|
|
import java.util.jar.JarFile; |
|
|
|
import java.util.jar.JarFile; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
import java.util.regex.Pattern; |
|
|
|
@ -50,6 +51,7 @@ import org.eclipse.aether.transport.http.HttpTransporterFactory; |
|
|
|
import org.springframework.core.annotation.MergedAnnotation; |
|
|
|
import org.springframework.core.annotation.MergedAnnotation; |
|
|
|
import org.springframework.core.annotation.MergedAnnotations; |
|
|
|
import org.springframework.core.annotation.MergedAnnotations; |
|
|
|
import org.springframework.util.AntPathMatcher; |
|
|
|
import org.springframework.util.AntPathMatcher; |
|
|
|
|
|
|
|
import org.springframework.util.ConcurrentReferenceHashMap; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -60,6 +62,8 @@ import org.springframework.util.StringUtils; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
final class ModifiedClassPathClassLoader extends URLClassLoader { |
|
|
|
final class ModifiedClassPathClassLoader extends URLClassLoader { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final Map<Class<?>, ModifiedClassPathClassLoader> cache = new ConcurrentReferenceHashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
private static final Pattern INTELLIJ_CLASSPATH_JAR_PATTERN = Pattern.compile(".*classpath(\\d+)?\\.jar"); |
|
|
|
private static final Pattern INTELLIJ_CLASSPATH_JAR_PATTERN = Pattern.compile(".*classpath(\\d+)?\\.jar"); |
|
|
|
|
|
|
|
|
|
|
|
private final ClassLoader junitLoader; |
|
|
|
private final ClassLoader junitLoader; |
|
|
|
@ -78,6 +82,10 @@ final class ModifiedClassPathClassLoader extends URLClassLoader { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static ModifiedClassPathClassLoader get(Class<?> testClass) { |
|
|
|
static ModifiedClassPathClassLoader get(Class<?> testClass) { |
|
|
|
|
|
|
|
return cache.computeIfAbsent(testClass, ModifiedClassPathClassLoader::compute); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static ModifiedClassPathClassLoader compute(Class<?> testClass) { |
|
|
|
ClassLoader classLoader = testClass.getClassLoader(); |
|
|
|
ClassLoader classLoader = testClass.getClassLoader(); |
|
|
|
return new ModifiedClassPathClassLoader(processUrls(extractUrls(classLoader), testClass), |
|
|
|
return new ModifiedClassPathClassLoader(processUrls(extractUrls(classLoader), testClass), |
|
|
|
classLoader.getParent(), classLoader); |
|
|
|
classLoader.getParent(), classLoader); |
|
|
|
|