From 918063dba17c4920662dc14542efc3b184d933a5 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sat, 27 Mar 2021 09:04:23 +0700 Subject: [PATCH] Fix JRockitAgentTest.testJrockitRecursionProtection for JVM 9+ Signed-off-by: Alexander Kriegisch --- .../aspectj/weaver/loadtime/JRockitAgentTest.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java index 223f66fbb..487ef0832 100644 --- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java +++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java @@ -54,29 +54,16 @@ public class JRockitAgentTest extends TestCase { } public void testJrockitRecursionProtection() { - if (LangUtil.is9VMOrGreater()) { - // Skip test, not castable to URLClassLoader - return; - } - URLClassLoader thisLoader = (URLClassLoader) getClass().getClassLoader(); URL jrockit = FileUtil.getFileURL(new File("../lib/ext/jrockit/jrockit.jar")); URL[] urls = new URL[] {jrockit}; - thisLoader = new URLClassLoader(urls, thisLoader); - ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); - + URLClassLoader thisLoader = new URLClassLoader(urls, getClass().getClassLoader()); try { - /* Needed by Commons Logging */ - Thread.currentThread().setContextClassLoader(thisLoader.getParent()); - ClassLoader loader = new JRockitClassLoader(thisLoader); - Class.forName("java.lang.Object", false, loader); Class.forName("junit.framework.TestCase", false, loader); } catch (Exception ex) { ex.printStackTrace(); fail(ex.toString()); - } finally { - Thread.currentThread().setContextClassLoader(contextLoader); } } -- 2.39.5