Skip to content

Refactor: Migrate netflix-sel from joda-time to java.time#207

Open
h4xr wants to merge 1 commit intoNetflix:mainfrom
h4xr:migrate-joda-time-to-java-time
Open

Refactor: Migrate netflix-sel from joda-time to java.time#207
h4xr wants to merge 1 commit intoNetflix:mainfrom
h4xr:migrate-joda-time-to-java-time

Conversation

@h4xr
Copy link
Copy Markdown

@h4xr h4xr commented May 5, 2026

Resolves #61

This PR completely removes the joda-time dependency from the netflix-sel module and migrates the internal SEL AST wrappers and type logic to the native java.time (JSR-310) API.

Specifically addressing the concerns raised in the issue:

  1. Preserved SEL Interface: As requested, the Joda-Time expression API structure remains completely intact. Classes like SelJodaDateTime and SelJodaDateTimeFormatter retain their original names, and all MethodHandles continue to expose the exact same string signatures (e.g. plusDays1, withTimeAtStartOfDay0). Users will not need to modify their existing SEL expressions; we simply rewrote the internal implementations to use ZonedDateTime.
  2. Security Manager & ClassLoader Constraints: We addressed the strict SEL classloading rules in SelClassLoader.java by replacing the org.joda.time zone provider caching with proactive caching of java.time.ZoneId available IDs. Because java.time is part of the JDK bootstrap classloader, it inherently avoids the third-party GC unloading risks previously associated with Joda-Time within the SEL sandbox.

Other key changes:

  • Replaced DateTime with ZonedDateTime inside SelJodaDateTime and related wrappers.
  • Reworked property methods to utilize ChronoField and IsoFields.
  • Replaced DateTimeFormatter usages with java.time.format.DateTimeFormatter, implementing strict parseDefaulting logic to maintain backward compatibility with Joda-Time's lenient formatting/parsing patterns.
  • Refactored test suites to inject java.time.Clock.
  • Removed jodaTimeDep from build.gradle.

Exploration and planning for this migration was assisted by Neuvem Decypher.

Resolves Netflix#61.

Migrated all SEL types and utilities from org.joda.time.* to java.time.* (JSR-310). Ensured that all MethodHandles resolve to the new java.time compatible types while preserving the exact SEL expression signatures. Replaced DateTimeUtils test clock overrides with java.time.Clock injection. Removed jodaTimeDep from netflix-sel/build.gradle.
@h4xr
Copy link
Copy Markdown
Author

h4xr commented May 5, 2026

@jun-he Can you please help with the review

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.

Remove joda time dependency from netflix-sel module

1 participant