On 30/11/2017 22:57, mandy chung wrote:
:
This is indeed a bug that should throw ISE when ClassLoader.getSystemClassLoader is called during the initialization of the system class loader, as the spec states.
line 1921: I suggest to revise the message to make it clearer: "getSystemClassLoader cannot be called during the system class loader instantiation"
In ClassLoader::initSystemClassLoader (line 1971), when the exception is thrown via Constructor::newInstance, it would be good to the cause of an InvocationTargetException like:
+ Throwable t = e; + if (e instanceof InvocationTargetException) { + t = e.getCause(); + } + throw new Error(t.getMessage(), t); Better still might be for initSystemClassLoader to re-throw the cause so that it appears immediately after the "Error occurred during initialization of VM" message that the VM will fail with.
-Alan