RFR: 8048190: NoClassDefFoundError omits original ExceptionInInitializerError [v3]
Doug Simon
dnsimon at openjdk.java.net
Fri Aug 6 07:36:35 UTC 2021
On Thu, 5 Aug 2021 13:17:00 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This is a change to save the class initialization error stack trace in a hashtable and return it as the cause when NoClassDefFoundError is thrown. The first commit is a more limited version of this that just changes the message, by adding to the message string. The second commit is getting and saving the stack trace for the original exception, and using the thread in the message. See CR for more details about how the message looks.
>>
>> Tested with tier1-3 tests on 3 platforms. Tier 4-6 in progress (all but two done and passed).
>
> Coleen Phillimore has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>
> - Merge branch 'master' into init-oom
> - David review comments.
> - Merge branch 'master' into init-oom
> - 8048190: NoClassDefFoundError omits original ExceptionInInitializerError
> - 8048190: NoClassDefFoundError omits original ExceptionInInitializerError
src/hotspot/share/oops/instanceKlass.cpp line 1054:
> 1052:
> 1053: ResizeableResourceHashtable<const InstanceKlass*, InitErrorElement, ResourceObj::C_HEAP, mtClass>
> 1054: _initialization_error_table(20);
As I understand, the whole point of this table is to save space. Instead, you could repurpose `T[] Class.enumConstants` to be `Object Class.enumConstantsOrInitError`. For a non-enum classes, this field is never used (and thus already "wasted") and for enum classes it will never be successfully initialized if there's a clinit error.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4996
More information about the hotspot-dev
mailing list