Skip to content

Instantiate built-in path functions without reflection - #1093

Open
Ycz007 wants to merge 1 commit into
json-path:masterfrom
Ycz007:candidate/1042-reflection-free
Open

Ycz007 wants to merge 1 commit into
json-path:masterfrom
Ycz007:candidate/1042-reflection-free

Conversation

@Ycz007

@Ycz007 Ycz007 commented Nov 18, 2026

Copy link
Copy Markdown

Fixes #1042.

Create built-in path functions through constructor suppliers instead of Class.newInstance(). Keep the existing public FUNCTIONS class registry compatible and create a new function instance for each lookup.

Tests cover every registered name, instance isolation, aliases, numeric evaluation and the unknown-function error.

Validation on OpenJDK 21: json-path module has 933 tests, 931 passed and 2 existing skips, with no failures/errors. git diff --check passes. Bytecode inspection confirms supplier dispatch and direct constructor references. GraalVM native-image was not run; this is not an end-to-end native-image verification claim. Existing custom-function proposals #1068 and #1085 still use reflection, but may overlap this file.

AI assistance: OpenAI Codex investigated, implemented and tested this proposed change; the contributor is reviewing it before submission.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid reflection in PathFunctionFactory

1 participant