Re: [11] RFR JDK-8198653: ClassLoader::getSystemClassLoader throws InternalError when called after shutdown

2018-02-23 Thread mandy chung
Yes, 
test/hotspot/jtreg/compiler/jvmci/events/JvmciShutdownEventTest.java. 
This test passes with the change.


Mandy

On 2/23/18 10:18 PM, David Holmes wrote:

Looks good.

Is there an existing test that caught this?

Thanks,
David

On 24/02/2018 7:57 AM, mandy chung wrote:
JDK-8198249 added a new shutdown VM initLevel.  
ClassLoader::getSystemClassLoader
should be updated to handle the new case.  I checked all other 
callers of

VM::initLevel and no other place needs update.

Thanks
Mandy

diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java 
b/src/java.base/share/classes/java/lang/ClassLoader.java

--- a/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -1922,7 +1922,7 @@
  case 3:
  String msg = "getSystemClassLoader cannot be called 
during the system class loader instantiation";

  throw new IllegalStateException(msg);
-    case 4:
+    default:
  // system fully initialized
  assert VM.isBooted() && scl != null;
  SecurityManager sm = System.getSecurityManager();
@@ -1930,8 +1930,6 @@
  checkClassLoaderPermission(scl, 
Reflection.getCallerClass());

  }
  return scl;
-    default:
-    throw new InternalError("should not reach here");
  }
  }





Re: [11] RFR JDK-8198653: ClassLoader::getSystemClassLoader throws InternalError when called after shutdown

2018-02-23 Thread David Holmes

Looks good.

Is there an existing test that caught this?

Thanks,
David

On 24/02/2018 7:57 AM, mandy chung wrote:
JDK-8198249 added a new shutdown VM initLevel.  
ClassLoader::getSystemClassLoader

should be updated to handle the new case.  I checked all other callers of
VM::initLevel and no other place needs update.

Thanks
Mandy

diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java 
b/src/java.base/share/classes/java/lang/ClassLoader.java

--- a/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -1922,7 +1922,7 @@
  case 3:
  String msg = "getSystemClassLoader cannot be called 
during the system class loader instantiation";

  throw new IllegalStateException(msg);
-    case 4:
+    default:
  // system fully initialized
  assert VM.isBooted() && scl != null;
  SecurityManager sm = System.getSecurityManager();
@@ -1930,8 +1930,6 @@
  checkClassLoaderPermission(scl, 
Reflection.getCallerClass());

  }
  return scl;
-    default:
-    throw new InternalError("should not reach here");
  }
  }



[11] RFR JDK-8198653: ClassLoader::getSystemClassLoader throws InternalError when called after shutdown

2018-02-23 Thread mandy chung

JDK-8198249 added a new shutdown VM initLevel.  
ClassLoader::getSystemClassLoader
should be updated to handle the new case.  I checked all other callers of
VM::initLevel and no other place needs update.

Thanks
Mandy

diff --git a/src/java.base/share/classes/java/lang/ClassLoader.java 
b/src/java.base/share/classes/java/lang/ClassLoader.java
--- a/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -1922,7 +1922,7 @@
 case 3:
 String msg = "getSystemClassLoader cannot be called during the 
system class loader instantiation";
 throw new IllegalStateException(msg);
-case 4:
+default:
 // system fully initialized
 assert VM.isBooted() && scl != null;
 SecurityManager sm = System.getSecurityManager();
@@ -1930,8 +1930,6 @@
 checkClassLoaderPermission(scl, 
Reflection.getCallerClass());
 }
 return scl;
-default:
-throw new InternalError("should not reach here");
 }
 }