RFR: 8319436: Proxy.newProxyInstance throws NPE if loader is null and interface not visible from class loader

Mandy Chung mchung at openjdk.org
Mon Nov 6 19:19:05 UTC 2023


This is a regression caused by JDK-8302791.   IAE should be thrown when an interface is not visible to the given class loader but NPE is thrown instead when the loader is null.   The boot loader has no name and so the fix will print `null` in the exception message.   `test/jdk/java/lang/reflect/Proxy/ClassRestrictions.java` is converted to junit and updated to test IAE thrown because proxy interface is not visible to null loader.

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

Commit messages:
 - 8319436: Proxy.newProxyInstance throws NPE if loader is null and interface not visible from class loader

Changes: https://git.openjdk.org/jdk/pull/16525/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16525&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8319436
  Stats: 184 lines in 2 files changed: 63 ins; 96 del; 25 mod
  Patch: https://git.openjdk.org/jdk/pull/16525.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16525/head:pull/16525

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


More information about the core-libs-dev mailing list