14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 import java.io.File;
27 import java.io.FileInputStream;
28 import java.io.IOException;
29 import java.io.InputStream;
30 import java.lang.reflect.InvocationTargetException;
31 import java.lang.reflect.Method;
32
33 /*
34 * @test 8163162
35 * @summary Checks that LazyLoggers are returned for System.Logger instances
36 * created by modules in the platform class loader.
37 * @modules java.base/java.lang:open
38 * @build systempkg.log.SystemLoggerAccessor SystemLoggerInPlatformLoader
39 * @run main/othervm SystemLoggerInPlatformLoader
40 * @author danielfuchs
41 */
42 public class SystemLoggerInPlatformLoader {
43
44 static final class PlatformClassLoaderChild extends ClassLoader {
45 private PlatformClassLoaderChild() {
46 super(ClassLoader.getPlatformClassLoader());
47 }
48 public Class<?> definePlatformClass(String name) throws IOException {
49 String testClasses = System.getProperty("test.classes", "./build/classes");
50 String fname = name.replace('.', '/').concat(".class");
51 try (InputStream is = new FileInputStream(new File(testClasses, fname))) {
52 byte[] b = is.readAllBytes();
53 ClassLoader parent = getParent();
54 try {
|
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 import java.io.File;
27 import java.io.FileInputStream;
28 import java.io.IOException;
29 import java.io.InputStream;
30 import java.lang.reflect.InvocationTargetException;
31 import java.lang.reflect.Method;
32
33 /*
34 * @test
35 * @bug 8163162
36 * @summary Checks that LazyLoggers are returned for System.Logger instances
37 * created by modules in the platform class loader.
38 * @modules java.base/java.lang:open
39 * @build systempkg.log.SystemLoggerAccessor SystemLoggerInPlatformLoader
40 * @run main/othervm SystemLoggerInPlatformLoader
41 * @author danielfuchs
42 */
43 public class SystemLoggerInPlatformLoader {
44
45 static final class PlatformClassLoaderChild extends ClassLoader {
46 private PlatformClassLoaderChild() {
47 super(ClassLoader.getPlatformClassLoader());
48 }
49 public Class<?> definePlatformClass(String name) throws IOException {
50 String testClasses = System.getProperty("test.classes", "./build/classes");
51 String fname = name.replace('.', '/').concat(".class");
52 try (InputStream is = new FileInputStream(new File(testClasses, fname))) {
53 byte[] b = is.readAllBytes();
54 ClassLoader parent = getParent();
55 try {
|