RFR: 8285401: Proxy class initializer should use 3-arg `Class.forName` to avoid unnecessary class initialization [v4]

liach duke at openjdk.java.net
Thu May 26 20:52:43 UTC 2022


> Simplify calls `Class.forName(String, boolean, ClassLoader)` instead of `Class.forName(String)`. `make test TEST="jtreg:test/jdk/java/lang/reflect/Proxy"` passes, with the new `LazyInitializationTest` failing the eager initialization check on the baseline and passing with this patch.
> 
> On a side note, this might reduce the number of methods that can be encoded in a proxy due to code attribute size restrictions; we probably would address that in another issue, as we never mandated a count of methods that the proxy must be able to implement.
> 
> Mandy, would you mind review this?

liach has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:

 - Merge branch 'master' into proxy-class-forname
 - Move the try catch block as it doesn't throw checked exceptions
 - remove unused field
 - whitespace
 - Copyright year
 - typo
 - 8285401: Proxy class initializer should use 3-arg `Class.forName` to avoid unnecessary class initialization
 - Test for eager initialization

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8800/files
  - new: https://git.openjdk.java.net/jdk/pull/8800/files/82f8eeb9..1262e8fa

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8800&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8800&range=02-03

  Stats: 37306 lines in 626 files changed: 8637 ins; 27109 del; 1560 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8800.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8800/head:pull/8800

PR: https://git.openjdk.java.net/jdk/pull/8800


More information about the core-libs-dev mailing list