提交 770cba23 编写于 作者: S sla

7152798: TEST_BUG:...

7152798: TEST_BUG: sun/management/HotspotClassLoadingMBean/GetClassLoadingTime.java does not compile
Summary: Make sure the test is compiled, run and finds it supporting classes
Reviewed-by: alanb, sspitsyn, rbackman
上级 1368a3ac
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
* @summary Basic unit test of HotspotClassLoadingMBean.getClassLoadingTime() * @summary Basic unit test of HotspotClassLoadingMBean.getClassLoadingTime()
* @author Steve Bohne * @author Steve Bohne
* @build ClassToLoad0 * @build ClassToLoad0
* @run main GetClassLoadingTime
*/ */
/* /*
...@@ -71,10 +72,8 @@ public class GetClassLoadingTime { ...@@ -71,10 +72,8 @@ public class GetClassLoadingTime {
} }
long time2 = mbean.getClassLoadingTime(); long time2 = mbean.getClassLoadingTime();
long count = mbean.getLoadedClassCount();
if (trace) { if (trace) {
System.out.println("(new count is " + count + ")");
System.out.println("Class loading time2 (ms): " + time2); System.out.println("Class loading time2 (ms): " + time2);
} }
...@@ -93,8 +92,6 @@ public class GetClassLoadingTime { ...@@ -93,8 +92,6 @@ public class GetClassLoadingTime {
// so we can avoid delegation and spend lots of time loading the // so we can avoid delegation and spend lots of time loading the
// same class over and over, to test the class loading timer. // same class over and over, to test the class loading timer.
class KlassLoader extends ClassLoader { class KlassLoader extends ClassLoader {
static String klassDir="";
static int index=0;
public KlassLoader() { public KlassLoader() {
super(null); super(null);
...@@ -102,14 +99,13 @@ class KlassLoader extends ClassLoader { ...@@ -102,14 +99,13 @@ class KlassLoader extends ClassLoader {
protected synchronized Class findClass(String name) protected synchronized Class findClass(String name)
throws ClassNotFoundException { throws ClassNotFoundException {
String cname = klassDir String cname =
+ (klassDir == "" ? "" : "/") name.replace('.', '/')
+name.replace('.', '/')
+".class"; +".class";
FileInputStream in; FileInputStream in;
try { try {
in=new FileInputStream(cname); in = new FileInputStream(new File(System.getProperty("test.classes", "."), cname));
if (in == null) { if (in == null) {
throw new ClassNotFoundException("getResourceAsStream(" throw new ClassNotFoundException("getResourceAsStream("
+cname+")"); +cname+")");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册