Repository navigation
Preserve wildcard arguments when reusing compiled functions - #1088
Open
curforever wants to merge 1 commit into
Open
curforever wants to merge 1 commit into
curforever wants to merge 1 commit into
Conversation
Move the cleanup of Length's temporary wildcard into its own finally block. Removing the first wildcard after every function call otherwise changes a compiled aggregation's original argument and breaks subsequent reads. Add regression coverage across all eight test providers for numeric aggregation, cached queries, repeated length/size calls, and recovery after provider failure. Fixes json-path#1038.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1038.
Reusing
JsonPath.compile("max($.dataset[*].value)")fails after the first read becauseFunctionPathTokenremoves the argument's first wildcard after every function invocation. That cleanup was introduced for #786, whereLengthtemporarily appends a wildcard, but it also deletes wildcards supplied by callers of other functions.Move that cleanup into
Lengthand restore only the tail link that the current invocation changed, usingfinallyso evaluation failures also restore it. Remove the generic wildcard deletion fromFunctionPathToken. Existing wildcard arguments and repeated deep-scanlength()/size()queries remain reusable; no public API changes.Validation on Windows with Gradle 8.5:
build --warning-mode all,check, andclean publishToMavenLocalsucceed. Each JDK's two-module suite has 1,078 passes, 13 existing skips, and no failures. The skipped test classes are unchanged from the base commit.This targets sequential compiled-query reuse and temporary wildcard cleanup; it does not claim to make every compiled function thread-safe.