GROOVY-12124: Modernize the TimeCategory date/time DSL: add a java.ti…#2653
Open
paulk-asert wants to merge 1 commit into
Open
GROOVY-12124: Modernize the TimeCategory date/time DSL: add a java.ti…#2653paulk-asert wants to merge 1 commit into
paulk-asert wants to merge 1 commit into
Conversation
5cad6b9 to
68b3cba
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2653 +/- ##
==================================================
+ Coverage 68.5728% 68.5879% +0.0151%
- Complexity 33803 33884 +81
==================================================
Files 1524 1531 +7
Lines 128128 128339 +211
Branches 23289 23298 +9
==================================================
+ Hits 87861 88025 +164
- Misses 32468 32514 +46
- Partials 7799 7800 +1
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces modern, “quirk-free” TimeCategory-style DSLs alongside the legacy groovy.time API, addressing GROOVY-12124 by providing:
- a
java.util.Date-flavored DSL inorg.apache.groovy.dateutilwith deterministictoMilliseconds()and time-of-day-preserving.ago/.from.now - a
java.time-based DSL inorg.apache.groovy.datetimeproducing nativeDuration/Period
Changes:
- Added new
org.apache.groovy.dateutilduration/value classes andTimeCategoryforDatearithmetic. - Added new
org.apache.groovy.datetime.TimeCategoryDSL forjava.timetypes, with tests and spec docs. - Deprecated legacy
groovy.timeduration/category classes (and marked their test classes deprecated) while keeping them for compatibility.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| subprojects/groovy-dateutil/src/test/groovy/org/apache/groovy/dateutil/TimeCategoryTest.groovy | New test suite for the dequirked org.apache.groovy.dateutil.TimeCategory behavior. |
| subprojects/groovy-dateutil/src/test/groovy/org/apache/groovy/dateutil/DurationTest.groovy | New tests for the dequirked org.apache.groovy.dateutil duration hierarchy and arithmetic. |
| subprojects/groovy-dateutil/src/spec/doc/_working-with-dateutil-types.adoc | Adds user-facing documentation for the new number-based Date/Duration DSL. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/TimeDuration.java | Introduces the Date-based TimeDuration subtype used by the new DSL. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/TimeDatumDependentDuration.java | Introduces mixed duration type for combining time-only and datum-dependent durations. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/TimeCategory.java | Adds the new java.util.Date-flavored TimeCategory DSL and Date arithmetic hooks. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/Duration.java | Adds the fixed (days-and-below) duration implementation for the new Date DSL. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/DatumDependentDuration.java | Adds years/months-capable duration implementation for the new Date DSL. |
| subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/BaseDuration.java | New shared base implementing deterministic toMilliseconds() and time-preserving relative calculations. |
| subprojects/groovy-datetime/src/test/groovy/org/apache/groovy/datetime/TimeCategoryTest.groovy | New tests for the java.time-based TimeCategory DSL. |
| subprojects/groovy-datetime/src/spec/doc/_working-with-datetime-types.adoc | Adds spec documentation for the java.time DSL (Period/Duration producers and terminals). |
| subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/TimeCategory.java | Adds the java.time-native TimeCategory DSL producing Duration and Period. |
| src/test/groovy/groovy/time/TimeDurationTest.groovy | Marks legacy tests deprecated (aligned with legacy API deprecation). |
| src/test/groovy/groovy/time/TimeDatumDependentDurationTest.groovy | Marks legacy tests deprecated (aligned with legacy API deprecation). |
| src/test/groovy/groovy/time/TimeCategoryTest.groovy | Marks legacy tests deprecated (aligned with legacy API deprecation). |
| src/test/groovy/groovy/time/DurationTest.groovy | Marks legacy tests deprecated (aligned with legacy API deprecation). |
| src/test/groovy/groovy/time/DatumDependentDurationTest.groovy | Marks legacy tests deprecated (aligned with legacy API deprecation). |
| src/main/java/groovy/time/TimeDuration.java | Deprecates legacy groovy.time.TimeDuration with pointers to replacements. |
| src/main/java/groovy/time/TimeDatumDependentDuration.java | Deprecates legacy mixed duration type with pointers to replacements. |
| src/main/java/groovy/time/TimeCategory.java | Deprecates legacy TimeCategory with pointers to new Date/java.time alternatives. |
| src/main/java/groovy/time/Duration.java | Deprecates legacy fixed duration class with pointers to replacements. |
| src/main/java/groovy/time/DatumDependentDuration.java | Deprecates legacy datum-dependent duration class with pointers to replacements. |
| src/main/java/groovy/time/BaseDuration.java | Deprecates legacy base duration class with pointers to replacements. |
…me flavor and a dequirked java.util.Date flavor
✅ All tests passed ✅🏷️ Commit: 32b5dff Learn more about TestLens at testlens.app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…me flavor and a dequirked java.util.Date flavor
See: https://issues.apache.org/jira/browse/GROOVY-12124