Google Summer of Code
Darshan R, GSoC

GSoC 2026 · The JPF Team

Java 17 Support for Java Pathfinder

Bringing modern Java language features and JDK functionality to JPF.

Opened
19
Merged
19
Open
0

Student

Project details

Google Summer of Code logo Java Pathfinder logo

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

  • bytecode
  • invokedynamic
  • bootstrap methods

what JPF actually executes

Java Pathfinder (JPF)

  • JPF virtual machine
  • execution state
  • bytecode execution
  • state exploration
GSoC 2026 contribution

Java 17 Support

  • Language: records · sealed · switch
  • Runtime: invokedynamic · concat
  • JDK: reflection · models · resources

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 linkDescriptionStatus
Language features
#636SwitchBootstraps supportRuns Java 17 pattern-matching switch, for both type switches and enum switches.Merged
#631Record equality for reference componentsEquality and printing match Java for texts, numbers, arrays, and nested records (fixes #628).Merged
#627Boxed Float and Double concatenationText building with boxed decimal values reads the right fields (fixes #626).Merged
#625Record signatures and reflectionType details survive parsing and reflection on records works (fixes #624).Merged
#621Constant handling in string concatConstant values decode correctly instead of going missing (fixes #619).Merged
#620Sealed-class parsing testsProves sealed-class metadata parses correctly; 3 of 5 failed before the fix.Merged
Models and infrastructure
#640SharedSecrets for ZipFile and JarFileJPF can now start the JDK code that zip files need, so Clojure programs load instead of crashing (fixes #507).Merged
#639SharedSecrets security hookAdds a JDK startup hook Java needs for security setup. Fixes 2 serialization test failures; suite now 1028 of 1028.Merged
#638JarFile model and peerPrograms reading jars get entries and manifests (fixes #477, #483).Merged
#635Resource loading from the tested programShipped data files load with content instead of coming back null.Merged
#634Per-test classloader isolationOptional mode stops tests leaking state into each other through shared loaders.Merged
#633Configurable end-state detectionOptions 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
  • toString renders actual content instead of heap addresses; hashCode covers 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 (instanceof matching) 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 linkDescriptionStatus
#18OutputStreamWriter charset supportThe socket demo prints text again; charset settings are stored instead of crashing.Merged
#17Socket model loading and peer repairsNetwork models load correctly; accept and read behave; all 5 socket tests pass.Merged
#13Debug output removalLeftover debug prints removed from the networking code.Merged
#12Formatting cleanupWhitespace only, no behavior change.Merged
#11Build script simplification137 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 modules and java.base trees
  • 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 linkDescriptionStatus
#26Lambda and compact-string delegationJar delegation handles lambdas and modern string storage (fixes #14).Merged
#24JDK 11 build stabilizationBuild 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.misc open 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:

$ ./gradlew buildJars # BUILD SUCCESSFUL $ java -jar build/RunJPF.jar HelloWorld.jpf # no errors detected $ ./gradlew parallelTest # 1028 of 1028 green
  • 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.

Understanding an unfamiliar codebase. JPF spans a model-checking VM, bytecode execution, JDK models, native peers, and several extension repositories. Before changing code, I had to trace how a Java feature moved through these layers and identify the correct implementation point. I gradually built a mental model of the execution path. I read existing implementations, followed call chains, and compared related features. I used small experiments to validate my assumptions.
Finding what actually worked, and what did not. Java 17 support was rarely a simple "implemented / not implemented" problem. Some features appeared to work but produced incorrect behavior in specific cases, while others failed much later in execution. I used small, focused Java programs and regression tests to isolate behavior. I compared JPF's execution with the host JVM. That comparison showed whether a failure came from parsing, bytecode execution, a bootstrap method, a JDK model, or the surrounding infrastructure.
Tracing failures across abstraction layers. A visible failure was often several layers removed from its actual cause. A Java language feature can compile correctly, reach JPF successfully, and only fail when a bootstrap method, reflection path, or modeled JDK class runs. I traced execution from the Java source through class-file behavior into JPF's VM. Then I traced it back into the relevant model or peer implementation.
Bridging host-JVM behavior with JPF's modeled execution. One of the hardest problems was that JPF does not simply execute Java using the host JVM. It models parts of the JVM and JDK itself, which means Java 17 behavior had to be reproduced inside JPF's execution model. A feature can behave correctly on the real JVM but still fail in JPF. The cause is a missing or different bytecode handler, bootstrap method, JDK model, or native peer. I treated the host JVM as the behavioral reference. I built minimal programs to isolate the difference. I traced the execution through JPF's VM and models. Then I implemented and regression-tested the missing behavior.
Working with incomplete compatibility assumptions. A major challenge was discovering that existing JPF implementations often encoded assumptions from older Java versions. Supporting Java 17 meant identifying which assumptions were still valid and which had become incorrect as the JDK and class-file behavior evolved. I did not replace working code wholesale. I compared the existing implementation with actual Java 17 behavior. I extended it only where the underlying assumption no longer held.
Reproducing JVM behavior outside the JPF environment. Some failures were difficult to understand from JPF's code alone because the expected behavior was defined by the real JVM and JDK. I used small standalone Java programs to observe host-JVM behavior first, then used those observations as a reference while implementing the corresponding JPF behavior. This was particularly useful for invokedynamic, bootstrap methods, string concatenation, records, and newer JDK APIs.
Validating changes without breaking existing behavior. JPF is a model checker, so a change that makes one Java 17 example pass is not enough. Every fix had to be checked against existing behavior and regression tests. I repeatedly moved between a minimal reproducer, the implementation, and the broader test suite to make sure a local fix did not introduce regressions elsewhere.
Large combined changes. My networking work initially arrived as one large pull request. Review feedback showed that the change was easier to understand and validate when separated. I split it into focused changes covering build updates, formatting, cleanup, and peer fixes. Each piece was easier to review and merge independently.
  1. Understand existing behavior
  2. Find a minimal reproducer
  3. Compare with the real JVM
  4. Trace JPF's execution path
  5. Identify the compatibility gap
  6. Implement the smallest fix
  7. Add a regression test
  8. Run the broader test suite
  9. 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-17 branch 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

Primary repositories

JPF-Core · JPF-NAS · JPF-NHandler