Repository navigation
Issue #178 compiled JsonPath engine with parity tests on JDK 24 plus - #207
Merged
Merged
Conversation
…first) Markdown-Driven-Development: describes the two-engine contract (interpreted = JDK 21+ AST walker, compiled = JDK 24+ ClassFile API emitting Java 21 bytecode in the jtd-codegen style) before implementation, including the ahead-of-time compileBytes tooling path and the parity guarantee backed by JsonPathCompilerParityTest. To verify: read json-java21-jsonpath/README.md section 'Two Engines'.
…reted engine Salvaged from the sealed-interface split of the Issue #128 work, reworked onto the current jdk.incubator API: 'JsonPath' is now a public sealed interface permitting 'JsonPathInterpreted' (the unchanged AST-walking engine, package private, JDK 21+, no ClassFile API dependency) and 'JsonPathCompiled'. The compiled-engine facade and its package-private 'JsonPathExecutor' land here so the seal is complete; their construction is wired up by the ClassFile API codegen in the following commit. All 100 existing JsonPath tests pass. To verify: /opt/homebrew/bin/mvnd -pl json-java21-jsonpath test -Djava.util.logging.ConsoleHandler.level=INFO (100 tests green).
JsonPathHelpers now owns resolvePropertyPath, toJsonComparable, and compareValues exactly as the interpreter evaluated them; the interpreted engine delegates to them and the bytecode-generated engine (next commit) calls the same methods, giving compiled/interpreted parity for filter semantics by construction. All 100 existing JsonPath tests pass. To verify: mvn -pl json-java21-jsonpath test -Djava.util.logging.ConsoleHandler.level=INFO (100 tests green).
Moves the slice index normalization into the helpers shared by both engines so the interpreted and compiled engines normalize slice bounds identically; the interpreter now delegates. All 100 existing JsonPath tests pass on both JDK 21 and JDK 25. To verify: mvn -pl json-java21-jsonpath test -Djava.util.logging.ConsoleHandler.level=INFO (100 tests green).
Compiled engine in the jtd-codegen style: JsonPathCodegen.compiles any parsed JsonPath with the JDK 24 ClassFile API (JEP 484) into a Java 21 classfile (ClassFile.JAVA_21_VERSION, v65) implementing the package-private JsonPathExecutor; compileBytes exposes raw bytes for ahead-of-time, jtd2jar-style tooling. The emitter produces one continuation method per segment, mirroring the interpreted engine's evaluation order exactly; filter predicates call the shared JsonPathHelpers so both engines agree by construction. TDD: JsonPathCompilerParityTest (red against the emitter stub, then green) reuses the existing test corpus (64 expression/document cases plus 6 codegen-mechanics tests). The Maven profile jsonpath-codegen activates on JDK 24+ and compiles the generator and parity tests at release 24; on JDK 21 the interpreted engine builds unchanged and all 100 existing tests pass. Docs updated with the two-engine contract. To verify: mvn -pl json-java21-jsonpath test -Djava.util.logging.ConsoleHandler.level=INFO (170 tests green on JDK 25; 100 on JDK 21).
…oc on JDK 21
CI's JDK 21 build failed in maven-javadoc-plugin because javadoc completes
each documented package by re-scanning -sourcepath, which re-read the
ClassFile API sources even though sourceFileExcludes removed them from the
file list ('package java.lang.classfile does not exist'). The module now
points -sourcepath at a placeholder path so nothing extra is scanned on JDK
21; the JDK 24+ jsonpath-codegen profile overrides the excludes and sets
release 24 so the compiled-engine classes stay documentable there (matching
the jtd-codegen parent profile convention).
To verify: with JDK 21, mvn -pl json-java21-jsonpath clean package
-DskipTests (attach-javadocs included) and mvn -pl json-java21-jsonpath test
(100 tests green); with JDK 24+, mvn -pl json-java21-jsonpath test (170 tests
green).
…en tests The build job asserts total test counts to catch silently skipped tests. 2038 -> 2108 (64 parity + 6 codegen tests added by this issue).
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.
Closes #178
What
Two JsonPath engines with parity by construction, salvaged from the stale #128 branches:
JsonPathis now a sealed interface over package-privateJsonPathInterpreted/JsonPathCompiled(+JsonPathExecutor). Semantics unchanged.jsonpath-codegenMaven profile):JsonPathCodegen+JsonPathBytecodeEmitter(ClassFile API,ClassFile.JAVA_21_VERSION/ v65) withcompileBytesfor jtd2jar-style AOT.JsonPathCompilerParityTestcases over the existing expression corpus — interpreted == generated by construction (shared filter helpers +normalizeIndex).cursor/jsonpath-runtime-compilation-54b6(sealed-interface split, parity corpus); dropped both branches'javax.toolssource-string compilation entirely — superseded by the JEP 484 emitter.Verify
mvnd -pl json-java21-jsonpath test→ 170/170 (100 existing + 64 parity + 6 codegen;compileBytesEmitsJava21Classfileasserts major version 65).