[code-reflection] RFR: Catching and logging exceptions from BodyScanner::scanLambda when reflectAll enabled

Paul Sandoz psandoz at openjdk.org
Thu Jan 15 17:03:27 UTC 2026


On Thu, 15 Jan 2026 09:16:40 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> [PR: Implementation of -XDreflectAll switch](https://github.com/openjdk/babylon/pull/822) wrapped `BodyScanner::scanMethod` with try/catch block and logged warnings when `reflectAll` enabled.
> This PR also wraps `BodyScanner::scanLambda` to enable `reflectAll` testing.
> 
> Please review.
> 
> Thank you,
> Adam

src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 311:

> 309:             // quoted lambda - scan it
> 310:             BodyScanner bodyScanner = new BodyScanner(tree);
> 311:             try {

Like with the last related PR is it possible to reduce the scope of the code in the try block? Otherwise it is hard to reason about the statements and whether it is applied to all or only a sub-set - i am presuming it only applies to `body.scanLambda`?

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

PR Review Comment: https://git.openjdk.org/babylon/pull/846#discussion_r2695221773


More information about the babylon-dev mailing list