[10] RFR (S): 8196022: java.lang.VerifyError is thrown instead of java.lang.IllegalAccessError
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Wed Jan 31 04:44:02 UTC 2018
>> Good point. I decided to mimic the behavior for
>> NoSuchMethodE*/NoSuchFieldE* and not for IllegalAccessException. No
>> strong reasons for that on my side, so if you prefer unwrapping I'll
>> go with it.
>>
>> } catch (NoSuchMethodException ex) {
>> Error err = new NoSuchMethodError(ex.getMessage());
>> throw initCauseFrom(err, ex);
>> } catch (NoSuchFieldException ex) {
>> Error err = new NoSuchFieldError(ex.getMessage());
>> throw initCauseFrom(err, ex);
>> + } catch (ClassNotFoundException ex) {
>> + Error err = new NoClassDefFoundError(ex.getMessage());
>> + throw initCauseFrom(err, ex);
>
> That not what I meant - that's still wrapping the original exception in
> a new one. I was thinking more:
>
> } catch (ClassNotFoundException ex) {
> Throwable cause = ex.getcause();
> if (cause instanceof NoClassDefFoundError)
> throw (NoClassDefFoundError) cause;
> // else ...
I quoted the change to provide some context why I did it that way
(NoSuchMethodException/NoSuchFieldException). So, as I said before, if
you prefer to unwrap the error, I'll change it.
Best regards,
Vladimir Ivanov
More information about the hotspot-runtime-dev
mailing list