Java 17 Support for Java Pathfinder
Bringing modern Java language features and JDK functionality to JPF.
- Opened
- 19
- Merged
- 19
- Open
- 0
Student
- Darshan R
- Darshan-dev57
- darshan.dev57@gmail.com
Project details
- Organization: The JPF Team
- Mentors: Cyrille Artho, Mahmoud Khawaja
- Duration: June – September 2026
Google Summer of Code × The JPF Team
Goals
I spent the program making the checker handle the Java people actually write, then fixing whatever that work exposed. Over the summer I opened 19 pull requests across three repositories: JPF-Core (12), JPF-NAS (5), and jpf-nhandler (2). All 19 are merged.
Abstract
Java Pathfinder finds bugs by running a program down every path it can take. But it was built for older Java. Modern code broke that promise. Sealed classes and records crashed the checker or silently gave wrong answers. The hidden setup calls the compiler generates did the same. My project brings the checker up to modern Java. I completed sealed-class and record support in the core engine. I fixed the text-building and switch machinery around them. I repaired the networking and delegation extensions that work touched. Every fix ships with a test that fails before and passes after, so future contributors build on verified ground.
Feature areas
- Sealed classes. Read the permitted-subclass list correctly and reject classes that break the seal.
- Records. Understand record data and run the equality, printing, and hashing code the compiler generates.
- Pattern-matching switch. Run the type and enum switches Java 17 added.
- String concatenation. Handle the constants and boxed values modern text building emits.
- JDK models. Fill the startup hooks and file models Java needs before checking starts.
- Test infrastructure. Isolation between tests and control over when a run counts as finished.
How Java 17 flows through JPF
One picture of the project: what goes in, where it breaks, what I fixed, and what comes out.
Java 17 Program
- Records
- Sealed classes
- Pattern matching
- String concatenation
modern Java source
Java Class Files
bytecodeinvokedynamicbootstrap methods
what JPF actually executes
Java Pathfinder (JPF)
- JPF virtual machine
- execution state
- bytecode execution
- state exploration
Java 17 Support
- Language: records · sealed · switch
- Runtime:
invokedynamic· concat - JDK: reflection · models · resources
- records → equals/hashCode · reflection
- sealed → parsing · runtime checks
- switch → SwitchBootstraps
- concat → constants · boxed types
Model Checking
- Explore
- Different states
- Verify behavior
JPF tries every execution
Java 17 + JPF
- Modern features supported
- Runtime behavior modeled
- Regression tests added
1,071
tests passing
Before → After
Making Java 17 behavior work correctly inside Java Pathfinder.
Before
Java 17 record ↓ JPF
✕ Reference and array components gave incorrect equals, hashCode, and toString.
Sealed class ↓ JPF
✕ Sealed-class handling incomplete.
Pattern switch ↓ invokedynamic
✕ Unsupported bootstrap handling.
String concatenation ↓ invokedynamic
✕ Incorrect behavior (JEP 280).
After
Java 17 record ↓ JPF
✓ Correct behavior + regression tests
Sealed class ↓ JPF
✓ Permitted subclasses handled, parsing and runtime validated
Pattern switch ↓ SwitchBootstraps
✓ Bootstrap handled, execution tested
String concatenation ↓ invokedynamic
✓ Recipes and constants correct, boxed Float/Double fixed
From unsupported or incorrect Java 17 behavior → validated Java 17 support inside JPF.
1,071 tests passing
Regression testing across the affected components
JPF-Core contributions
12 pull requests, all merged. Without these, everyday programs crash the checker before checking starts.
| PR # | Title and link | Description | Status |
|---|---|---|---|
| Language features | |||
| #636 | SwitchBootstraps support | Runs Java 17 pattern-matching switch, for both type switches and enum switches. | Merged |
| #631 | Record equality for reference components | Equality and printing match Java for texts, numbers, arrays, and nested records (fixes #628). | Merged |
| #627 | Boxed Float and Double concatenation | Text building with boxed decimal values reads the right fields (fixes #626). | Merged |
| #625 | Record signatures and reflection | Type details survive parsing and reflection on records works (fixes #624). | Merged |
| #621 | Constant handling in string concat | Constant values decode correctly instead of going missing (fixes #619). | Merged |
| #620 | Sealed-class parsing tests | Proves sealed-class metadata parses correctly; 3 of 5 failed before the fix. | Merged |
| Models and infrastructure | |||
| #640 | SharedSecrets for ZipFile and JarFile | JPF can now start the JDK code that zip files need, so Clojure programs load instead of crashing (fixes #507). | Merged |
| #639 | SharedSecrets security hook | Adds a JDK startup hook Java needs for security setup. Fixes 2 serialization test failures; suite now 1028 of 1028. | Merged |
| #638 | JarFile model and peer | Programs reading jars get entries and manifests (fixes #477, #483). | Merged |
| #635 | Resource loading from the tested program | Shipped data files load with content instead of coming back null. | Merged |
| #634 | Per-test classloader isolation | Optional mode stops tests leaking state into each other through shared loaders. | Merged |
| #633 | Configurable end-state detection | Options control when a run counts as finished, for single and multiprocess runs. | Merged |
Technical highlights
Records implementation
- Component metadata parsed from classfiles with generic signatures and annotations preserved
- Array components compare by reference identity per JEP 395; boxed JDK types compare by wrapped value through a safe whitelist
toStringrenders actual content instead of heap addresses;hashCodecovers nested and multidimensional arrays- Reflection support through modeled record components with accessor and annotation queries
Bootstrap methods
- StringConcatFactory recipe decoding with resolved static arguments and zero-arg guards
- SwitchBootstraps dispatch for type switches (
instanceofmatching) and enum switches, with null fall-through per host convention - ASM-generated tests checked against host JDK 17 behavior first
Sealed classes support
- Permitted-subclass metadata parsed into class info and covered by direct classfile tests
- Parsing tests confirm the pre-fix failures before the shadowing fix lands
- Consistent name handling between storage and comparison paths
JPF-NAS contributions
5 pull requests, all merged. The socket demo and its tests did not run at all before these.
| PR # | Title and link | Description | Status |
|---|---|---|---|
| #18 | OutputStreamWriter charset support | The socket demo prints text again; charset settings are stored instead of crashing. | Merged |
| #17 | Socket model loading and peer repairs | Network models load correctly; accept and read behave; all 5 socket tests pass. | Merged |
| #13 | Debug output removal | Leftover debug prints removed from the networking code. | Merged |
| #12 | Formatting cleanup | Whitespace only, no behavior change. | Merged |
| #11 | Build script simplification | 137 lines of helper code removed from the build. | Merged |
Technical highlights
- Model jar moved from the boot path onto the classpath JPF actually reads, with both
modulesandjava.basetrees - ServerSocket peer restored with address-in-use checking; accepted sockets use the model; finalizer waits and instant-timeout throws removed
- Socket tests go from 3 failed with orphan warnings to 5 of 5 clean
- Combined upstream work split into build, formatting, debug, and peer fixes per reviewer feedback
JPF-NHandler contributions
2 pull requests, both merged. Programs using jars and lambdas can be checked instead of crashing.
| PR # | Title and link | Description | Status |
|---|---|---|---|
| #26 | Lambda and compact-string delegation | Jar delegation handles lambdas and modern string storage (fixes #14). | Merged |
| #24 | JDK 11 build stabilization | Build works on JDK 11 and the test runner finds all tests; 35 of 35 pass. | Merged |
Technical highlights
- Synthetic lambda classes resolve to their functional interface first during conversion
- String conversion falls back to character access when compact-string bytes are absent
- Missing
jdk.internal.miscopen flag added; explicit Vintage engine runs the JUnit 4 tests - Suite moves from 34 of 35 to 35 of 35 passing
Validation
How each change was proven before review. Every fix starts from this baseline:
- Fail before, pass after. Each new test runs against the unfixed code first. The sealed tests fail 3 of 5 pre-fix; the concat test fails pre-fix; then all pass post-fix.
- Host parity first. Where semantics matter, expected values are measured on the host JDK (17 for switch behavior) before asserting them under JPF.
- Full suite after risky edits. Classfile, classloader, and dispatch changes each end with full runs: 1028, 1066, and 1071 tests green.
- Small pull requests. Combined work was split per reviewer feedback, so each change is independently reviewable and revertible.
Results & Impact
What was accomplished.
- Modern Java support. Records compare, print, and hash exactly like the host JVM. Sealed hierarchies parse and validate. Pattern switches execute instead of crashing the bootstrap.
- Programs that load. Clojure reaches its test code instead of dying in jar loading. The KnockKnock socket dialogue completes end to end. Jar delegation runs past entry lookup.
- Suites that prove it. Serialization 9 of 9, sockets 5 of 5 with zero orphan warnings, delegation 35 of 35, core suites 1028, 1066, and 1071 green.
- A repo in better shape. 137 lines of build boilerplate gone, tests isolated from each other's static state, end-of-run behavior configurable instead of hardcoded.
Test evidence: full suites recorded green at 1028, 1066, and 1,071 tests passing. Each fix has a regression test that fails before and passes after.
Challenges & Solutions
What was difficult and how it was solved.
The hardest part was not implementing individual features. It was learning a large, unfamiliar codebase. I had to determine where Java 17 behavior was handled, what already worked, what silently failed, and where the actual compatibility gaps were.
invokedynamic, bootstrap methods, string concatenation, records, and newer JDK APIs.- Understand existing behavior
- Find a minimal reproducer
- Compare with the real JVM
- Trace JPF's execution path
- Identify the compatibility gap
- Implement the smallest fix
- Add a regression test
- Run the broader test suite
- Repeat
The biggest lesson was that supporting a new Java version in a mature JVM-based system is less about adding isolated features and more about understanding how those features interact with the existing execution model.
Remaining Work
The implementation is in place; the remaining work is focused on integration, release updates, and long-term maintenance.
- Merge Java 17 support into the main development line. Complete the remaining review and integration work, then transition the
java-17branch into the project's main/master development branch once the maintainers are ready. - Keep JPF aligned with new Java releases. Continue updating the project as newer Java/JDK releases introduce changes to class-file formats, JVM behavior, language features, APIs, and runtime internals.
- Refine and maintain the codebases. Continue cleaning up implementations. Improve consistency across JPF-Core and its related repositories. Address reviewer feedback. Maintain the new Java 17 support as the surrounding code evolves.
- Continue regression testing and compatibility validation. Keep expanding and maintaining tests around Java 17 behavior and verify that future changes do not regress the functionality already implemented.
Acknowledgments
Who helped.
A sincere thank you to Cyrille Artho and Mahmoud Khawaja for their mentorship, thoughtful guidance, and patient code reviews throughout the project. Their feedback helped me understand JPF at a much deeper level and pushed me to approach problems more carefully.
I'm also grateful to the JPF Team for welcoming me into the project and giving me the opportunity to contribute to such a technically interesting codebase.
And finally, thank you to Google Summer of Code for making this experience possible. It was a great opportunity to learn, contribute to open source, and grow as an engineer.
Contact
Darshan-dev57
darshan.dev57@gmail.com