RFR: 8297727: Forcing LF interpretation lead to StackOverflowError in reflection code

Chen Liang liach at openjdk.org
Wed Apr 23 22:45:41 UTC 2025


When LambdaForms are interpreted, so are field lambda forms. When this happens, we may get into an infinite recursion due to field lambda forms using `MethodHandleStatics.UNSAFE` via field lambda form.

I think the best solution here is to always eagerly compile field DMH forms - we already do so for all method forms, and there is a finite number of field forms, mostly pregenerated. The reference with cast form is erroneously missed, and it is actually the culprit of this issue. Will pregenerate that in another patch.

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

Commit messages:
 - 8297727: Forcing LF interpretation lead to StackOverflowError in reflection code

Changes: https://git.openjdk.org/jdk/pull/24835/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24835&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297727
  Stats: 53 lines in 2 files changed: 45 ins; 8 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/24835.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24835/head:pull/24835

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


More information about the core-libs-dev mailing list