[code-reflection] RFR: Validate arguments types when interpreting an operation
Paul Sandoz
psandoz at openjdk.org
Thu Jul 31 22:54:09 UTC 2025
On Thu, 31 Jul 2025 20:22:46 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.
src/jdk.incubator.code/share/classes/jdk/incubator/code/interpreter/Interpreter.java line 76:
> 74: }
> 75:
> 76: private static Class<?> getBoxedClass(Class<?> clazz) {
Before resolution you can query if the JavaType is an instance of the primitive type and then obtain the box version (see `PrimitiveType.box` [1]), thereby avoiding this method.
[1] Note `PrimitiveType.box` does not handle void, which should not matter.
test/jdk/java/lang/reflect/code/TestArgsTypesValidationWhenInterpreting.java line 16:
> 14: * @run testng TestArgsTypesValidationWhenInterpreting
> 15: */
> 16: public class TestArgsTypesValidationWhenInterpreting {
Move to the interpreter directory.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/509#discussion_r2246529150
PR Review Comment: https://git.openjdk.org/babylon/pull/509#discussion_r2246529948
More information about the babylon-dev
mailing list