RFR(M): 8203824: Chain exception from initialization in later NoClassDefFoundErrors.
David Holmes
david.holmes at oracle.com
Tue Jun 5 02:35:45 UTC 2018
Hi Goetz,
On 2/06/2018 2:02 AM, Lindenmaier, Goetz wrote:
> Hi,
>
> If static initialization of a class fails, an ExceptionInInitializerError
> is thrown. Later accesses to this class will fail, too. They report
> a NoClassDefFoundError. This is misleading, as the class has been
> found in first place but the initialization failed.
>
> To give more context, retain the previous ExceptionInInitializerError
> and chain it into the NoClassDefFoundError:
>
> I added a field to java/lang/Class to retain the exception.
> This is the design we followed in SAP JVM. I am not sure whether
> the additional memory consumption of Class is acceptable, or whether
> a hash map holding the exceptions internally would be a better
> design.
I suggest moving the field to instanceKlass and keeping this entirely
within the VM. I would not want to see the change on the Java side or
the need for a Java upcall to set this - you might hit more exceptions
in the process! Any change on the Java side has to go through the
core-libs folk anyway.
Thanks,
David
-----
> I also left out code that transforms the Throwable::backtrace in the retained
> ExceptionInInitializerError and it's recursively chained exceptions into
> Throwable::stackTrace and limits the recursively chained exceptions.
> If this change is appreciated, I'll add that in a later change.
>
> I found a test for NoClassDefFoundError messages and extended that.
> I moved the existing test into the canonical location under /exceptionMsgs/
>
> Best regards,
> Goetz.
>
>
>
>
>
>
> Failing class initialization throws a ExceptionInInitializerError.
> Later accesses to this class throw a NoClassDefFoundErrors
> hiding the original cause.
>
> This change adds code to chain the initial EIIE in the NCDFE.
> http://cr.openjdk.java.net/~goetz/wr18/8203826-exMsg-NoClassDefFoundError/webrev
>
> The initial EIIE is stored in the Class that failed to initialize.
> I thought
>
More information about the hotspot-runtime-dev
mailing list