RFR: 8302791: Add specific ClassLoader object to Proxy IllegalArgumentException message
Mandy Chung
mchung at openjdk.org
Fri Feb 24 06:12:03 UTC 2023
On Wed, 22 Feb 2023 07:24:48 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Added specific class loader object to proxy IllegalArgumentException from which the class was not visible
>>
>> The bug report for the same: https://bugs.openjdk.org/browse/JDK-8302791
>
> src/java.base/share/classes/java/lang/reflect/Proxy.java line 881:
>
>> 879: if (type != c) {
>> 880: throw new IllegalArgumentException(c.getName() +
>> 881: " referenced from a method is not visible from class loader: " + ld);
>
> The ClassLoader string representation may or may not be useful here. One suggestion is to use the class loader name (ld.getName()) if not null, otherwise Objects.toIdentityString(ld).
I also think it's helpful to print the name of class loader if present, or the identity string as Alan suggests.
-------------
PR: https://git.openjdk.org/jdk/pull/12641
More information about the core-libs-dev
mailing list