Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Joda-Time to Java Time #1168

Open
WilliamTYH opened this issue Dec 11, 2024 · 0 comments · May be fixed by #1170 or powertac/powertac-core#44
Open

Switch from Joda-Time to Java Time #1168

WilliamTYH opened this issue Dec 11, 2024 · 0 comments · May be fixed by #1170 or powertac/powertac-core#44
Assignees

Comments

@WilliamTYH
Copy link

WilliamTYH commented Dec 11, 2024

Joda time has not been in active development since Java 8 and with the move to Java 21, it is time to switch. Functionality overlaps in most areas, so most of the work is in switching out Joda Time classes for Java time equivalents. There are a few areas that require extra consideration:

Java time supports nanosecond precision, while Joda Time only has millisecond precision. This could lead to issues when communicating with older brokers due to different serialized representation and should be handled through custom serializers.

Time Zone Handling in Java Time can be done using ZoneID or ZoneOffset. In out case, ZoneOffset would be easier to use, as ZoneOffset.UTC is directly comparable to Instant, while ZoneID and Instant will always have different representations and require extra conversion steps.

Null Value Handling Joda-Time is more permissive when dealing with null values. This can lead to NullPointerExceptions if handled incorrectly.
E.g. start = new DateTime(start, DateTimeZone.UTC); in Joda time will set start to now if it was null. This does not work in java time.

@WilliamTYH WilliamTYH self-assigned this Dec 11, 2024
@WilliamTYH WilliamTYH added this to the Upgrade to Java 21 milestone Dec 11, 2024
@WilliamTYH WilliamTYH linked a pull request Jan 15, 2025 that will close this issue
@WilliamTYH WilliamTYH linked a pull request Jan 15, 2025 that will close this issue
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 a pull request may close this issue.

1 participant