test/java/util/logging/ClassLoaderLeakTest.java

Print this page
rev 6099 : 8003380: Compiler warnings in logging test code
Summary: Use generics, suppress warnings where appropriate, remove unused imports, etc.
Reviewed-by: lancea, chegar

*** 1,7 **** /* ! * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 38,48 **** import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.concurrent.CountDownLatch; import java.util.logging.Logger; - import java.util.logging.Logger; public class ClassLoaderLeakTest { private static CountDownLatch doneSignal; private static CountDownLatch launchSignal; --- 38,47 ----
*** 57,71 **** Runnable launcher = new Runnable() { public void run() { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! Class appMain = cl.loadClass("AppTest"); Method launch = appMain.getDeclaredMethod("launch", doneSignal.getClass()); ! Constructor c = appMain.getConstructor(); Object o = c.newInstance(); launch.invoke(o, doneSignal); --- 56,70 ---- Runnable launcher = new Runnable() { public void run() { try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! Class<?> appMain = cl.loadClass("AppTest"); Method launch = appMain.getDeclaredMethod("launch", doneSignal.getClass()); ! Constructor<?> c = appMain.getConstructor(); Object o = c.newInstance(); launch.invoke(o, doneSignal);
*** 78,89 **** }; /* prepare test class loader */ URL pwd = null; try { ! ! pwd = new File(System.getProperty("test.classes",".")).toURL(); } catch (MalformedURLException e) { throw new RuntimeException("Test failed.", e); } URL[] urls = new URL[] { pwd }; --- 77,87 ---- }; /* prepare test class loader */ URL pwd = null; try { ! pwd = new File(System.getProperty("test.classes",".")).toURI().toURL(); } catch (MalformedURLException e) { throw new RuntimeException("Test failed.", e); } URL[] urls = new URL[] { pwd };
*** 137,147 **** super(urls); uniqClassName = uniq; } ! public Class loadClass(String name) throws ClassNotFoundException { if (verbose) { System.out.printf("%s: load class %s\n", uniqClassName, name); } if (uniqClassName.equals(name)) { return Object.class; --- 135,145 ---- super(urls); uniqClassName = uniq; } ! public Class<?> loadClass(String name) throws ClassNotFoundException { if (verbose) { System.out.printf("%s: load class %s\n", uniqClassName, name); } if (uniqClassName.equals(name)) { return Object.class;