]> source.dussan.org Git - aspectj.git/commitdiff
Fix JRockitAgentTest.testJrockitRecursionProtection for JVM 9+
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 27 Mar 2021 02:04:23 +0000 (09:04 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sun, 28 Mar 2021 01:42:59 +0000 (08:42 +0700)
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
loadtime/src/test/java/org/aspectj/weaver/loadtime/JRockitAgentTest.java

index 223f66fbb537cfc00cbc314e806169dcc824870b..487ef083225899fcd46d8df1869b63eec9b607c6 100644 (file)
@@ -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);
                }
        }