Skip to content

Phase 0a: Migrate Joda-Time to java.time.Instant#165

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1781721767-phase0a-joda-to-java-time
Open

Phase 0a: Migrate Joda-Time to java.time.Instant#165
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1781721767-phase0a-joda-to-java-time

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 17, 2026

Copy link
Copy Markdown

Summary

Replaces all org.joda.time.DateTime usage with java.time.Instant as a prerequisite for the Java 11→21 / Spring Boot 2→3 migration. This eliminates the external joda-time:joda-time:2.10.13 dependency entirely.

Key changes:

  • Domain entities (Article, Comment): DateTime fields → Instant; new DateTime()Instant.now()
  • DTOs (ArticleData, CommentData): same field type migration
  • DateTimeCursor: extends PageCursor<Instant>, uses Instant.ofEpochMilli / toEpochMilli
  • DateTimeHandler (MyBatis): @MappedTypes(Instant.class), converts via Timestamp.from(instant) / timestamp.toInstant()
  • JacksonCustomizations: custom serializer now targets Instant.class, formats with DateTimeFormatter.ISO_INSTANT
  • GraphQL datafetchers: replaced ISODateTimeFormat.dateTime().withZoneUTC().print(...) with instant.toString() (produces ISO-8601)
  • Query services + read services: CursorPageParameter<DateTime>CursorPageParameter<Instant>
  • Tests: all new DateTime()Instant.now(), new DateTime().minusHours(1)Instant.now().minusMillis(3600000)
  • build.gradle: removed implementation 'joda-time:joda-time:2.10.13'

All tests pass with ./gradlew clean test -x jacocoTestCoverageVerification.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/092562f72c11450cb899dab49bfffe94
Requested by: @mbatchelor81


Open in Devin Review

Replace all org.joda.time.DateTime usages with java.time.Instant across
domain entities, DTOs, query services, MyBatis type handler, Jackson
serializer, GraphQL datafetchers, and tests. Remove joda-time dependency
from build.gradle.
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

…ions

Addresses review feedback: SQLite stores timestamps as text, so the
JDBC driver needs an explicit UTC Calendar to correctly format/parse
them regardless of the JVM's default timezone.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

@MappedTypes(Instant.class)
public class DateTimeHandler implements TypeHandler<Instant> {

private static final Calendar UTC_CALENDAR = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Shared mutable Calendar instance in DateTimeHandler is not thread-safe

The UTC_CALENDAR at DateTimeHandler.java:18 is a static final Calendar shared across all threads. Calendar is mutable and not thread-safe. JDBC's getTimestamp(col, Calendar) and setTimestamp(i, ts, Calendar) may internally modify the Calendar's fields during timezone conversion. Under concurrent database access, this could theoretically lead to corrupted timestamp reads/writes. This is a pre-existing issue (unchanged by the PR), but since the PR touched every method in this class, it's worth noting. A safer approach would be to create a new Calendar per call or use TimeZone.getTimeZone("UTC") directly.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@devin-ai-integration

Copy link
Copy Markdown
Author

Devin is archived and cannot be woken up. Please unarchive Devin if you want to continue using it.

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.

1 participant