[code-reflection] RFR: Validate arguments types when interpreting an operation [v3]

Paul Sandoz psandoz at openjdk.org
Sat Aug 2 14:47:09 UTC 2025


On Fri, 1 Aug 2025 23:21:03 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> We don't validate arguments types in the interpreter. This PR add the validation allowing us to catch invalid arguments early.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Apply suggestions

src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java line 117:

> 115:                 Class<?> c = typeToResolve.toNominalDescriptor().resolveConstantDesc(l);
> 116:                 if (!c.isInstance(rv)) {
> 117:                     Class<?> svc = ((JavaType) sv.type()).toNominalDescriptor().resolveConstantDesc(l);

You don't have to resolve here, we can just directly use `sv.type()` as an argument for the exception message.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/509#discussion_r2249269498


More information about the babylon-dev mailing list