RFR: 8302791: Add specific ClassLoader object to Proxy IllegalArgumentException message

Alan Bateman alanb at openjdk.org
Wed Feb 22 07:27:31 UTC 2023


On Sun, 19 Feb 2023 08:28:37 GMT, Ravali Yatham <duke 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).

-------------

PR: https://git.openjdk.org/jdk/pull/12641


More information about the core-libs-dev mailing list