[
https://issues.apache.org/jira/browse/GROOVY-12352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111442#comment-18111442
]
ASF GitHub Bot commented on GROOVY-12352:
-----------------------------------------
codecov-commenter commented on PR #2876:
URL: https://github.com/apache/groovy/pull/2876#issuecomment-5537096801
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2876?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:x: Patch coverage is `76.00000%` with `18 lines` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 71.0791%. Comparing base
([`f344d76`](https://app.codecov.io/gh/apache/groovy/commit/f344d76c69477397c8e3ddc25e5a7e7d795a2447?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`ed2bcf4`](https://app.codecov.io/gh/apache/groovy/commit/ed2bcf4ab4a29a46f4d8a67a222ae53fd579bc18?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2876?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...in/java/org/apache/groovy/json/internal/Dates.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FDates.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0RhdGVzLmphdmE=)
| 62.9630% | [7 Missing and 3 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...apache/groovy/json/internal/CharSequenceValue.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FCharSequenceValue.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0NoYXJTZXF1ZW5jZVZhbHVlLmphdmE=)
| 78.9474% | [1 Missing and 3 partials :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...org/apache/groovy/json/internal/JsonParserLax.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FJsonParserLax.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0pzb25QYXJzZXJMYXguamF2YQ==)
| 80.0000% | [1 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...vy-json/src/main/java/groovy/json/JsonSlurper.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fjson%2FJsonSlurper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9ncm9vdnkvanNvbi9Kc29uU2x1cnBlci5qYXZh)
| 90.0000% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
|
[...rg/apache/groovy/json/internal/JsonFastParser.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FJsonFastParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0pzb25GYXN0UGFyc2VyLmphdmE=)
| 75.0000% | [1 Missing :warning:
](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
|
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2876 +/- ##
==================================================
+ Coverage 71.0741% 71.0791% +0.0050%
- Complexity 37300 37316 +16
==================================================
Files 1578 1579 +1
Lines 135384 135428 +44
Branches 25084 25088 +4
==================================================
+ Hits 96223 96261 +38
- Misses 30477 30482 +5
- Partials 8684 8685 +1
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2876?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...on/src/main/java/groovy/json/JsonDateHandling.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fjson%2FJsonDateHandling.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9ncm9vdnkvanNvbi9Kc29uRGF0ZUhhbmRsaW5nLmphdmE=)
| `100.0000% <100.0000%> (ø)` | |
|
[...vy-json/src/main/java/groovy/json/JsonSlurper.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fjson%2FJsonSlurper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9ncm9vdnkvanNvbi9Kc29uU2x1cnBlci5qYXZh)
| `54.5454% <90.0000%> (+1.2121%)` | :arrow_up: |
|
[...rg/apache/groovy/json/internal/JsonFastParser.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FJsonFastParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0pzb25GYXN0UGFyc2VyLmphdmE=)
| `77.6316% <75.0000%> (ø)` | |
|
[...org/apache/groovy/json/internal/JsonParserLax.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FJsonParserLax.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0pzb25QYXJzZXJMYXguamF2YQ==)
| `73.2026% <80.0000%> (+0.0879%)` | :arrow_up: |
|
[...apache/groovy/json/internal/CharSequenceValue.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FCharSequenceValue.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0NoYXJTZXF1ZW5jZVZhbHVlLmphdmE=)
| `74.3363% <78.9474%> (+0.5045%)` | :arrow_up: |
|
[...in/java/org/apache/groovy/json/internal/Dates.java](https://app.codecov.io/gh/apache/groovy/pull/2876?src=pr&el=tree&filepath=subprojects%2Fgroovy-json%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fgroovy%2Fjson%2Finternal%2FDates.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LWpzb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dyb292eS9qc29uL2ludGVybmFsL0RhdGVzLmphdmE=)
| `76.4706% <62.9630%> (-4.8627%)` | :arrow_down: |
... and [6 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2876/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests,
report on failures, and find test suite problems.
- :package: [JS Bundle
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save
yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
> improve consistency of JSON date parsing
> ----------------------------------------
>
> Key: GROOVY-12352
> URL: https://issues.apache.org/jira/browse/GROOVY-12352
> Project: Groovy
> Issue Type: Improvement
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
> Labels: breaking
>
> {{JsonSlurper.setCheckDates(boolean)}} decides whether a string that looks
> like a date is returned as a {{java.util.Date}}. A boolean can only pick
> between two of the three answers a caller might want, and the one it can
> reach is the one fewest callers would choose today.
> h3. Behaviour now
> Parsing {{{"when":"2026-09-04T10:00:00.000Z"}}}:
> || parser type || checkDates=true || checkDates=false ||
> | INDEX_OVERLAY | {{Date}} | {{String}} |
> | LAX | {{Date}} | {{String}} |
> | CHARACTER_SOURCE | {{String}} | {{String}} |
> | CHAR_BUFFER | {{String}} | {{String}} |
> The default is {{true}}. Only full ISO-8601 and JSON-date forms convert; a
> bare {{"2026-09-04"}} stays a {{String}}.
> Two things are wrong beyond the missing option:
> * The javadoc on both accessors says "Index overlay only". LAX converts as
> well, and the flag has no effect at all on the other two, which have no date
> path — {{JsonParserCharArray}} and {{JsonParserUsingCharacterSource}} contain
> no reference to {{Dates}}.
> * {{java.util.Date}} is an instant, so an offset in the source is discarded.
> {{"2026-09-04T10:00:00+10:00"}} and its UTC equivalent become
> indistinguishable.
> Neither is discoverable: the option is absent from the user guide, so it is
> reachable only by reading {{JsonSlurper}}.
> h3. Proposal
> Replace the boolean with an option naming the type to produce, leaving the
> default as it is so that nothing changes for an existing caller:
> {code:java}
> public enum JsonDateHandling { STRING, UTIL_DATE, INSTANT, OFFSET_DATE_TIME }
> {code}
> {{OFFSET_DATE_TIME}} earns its place beside {{INSTANT}} by being the one that
> keeps the offset.
> The old accessors delegate and are deprecated, so this is additive:
> {code:java}
> @Deprecated
> public JsonSlurper setCheckDates(boolean checkDates) {
> return setDateHandling(checkDates ? UTIL_DATE : STRING);
> }
> @Deprecated
> public boolean isCheckDates() {
> return dateHandling != STRING;
> }
> {code}
> h3. Implementation
> The conversion is one site, the {{case STRING:}} block of
> {{CharSequenceValue.toValue()}}, reached by a {{checkDate}} boolean threaded
> from {{JsonSlurper}} through {{JsonFastParser}} and {{JsonParserLax}}. That
> parameter becomes the enum and the block chooses its target.
> {{Dates}} scans the fields by hand and assembles a {{Date}} through
> {{Calendar}} with a UTC zone. INDEX_OVERLAY exists to be fast, so keep that
> scan and build the chosen type from the fields it already extracts, rather
> than handing the text to {{OffsetDateTime.parse}}.
> h3. Decisions this needs
> * *Scope.* The option covers the two parsers that convert. Extending it to
> the other two means giving them a date path they have never had, which
> changes their current always-{{String}} result. Leaving it at two is the
> smaller change and lets the threat model describe what is true.
> * *The default.* Nothing here requires moving it. Whether {{UTIL_DATE}}
> should eventually give way to {{INSTANT}} or {{STRING}} is a separate
> question about a default that has stood since 2.3, and is better decided on
> its own.
> h3. Compatibility
> {{CharSequenceValue}}'s constructor is public but sits in
> {{org.apache.groovy.json.internal}} and has no caller outside that package in
> this repository. Changing the parameter is defensible; an overload alongside
> the existing one costs little if the package name is not thought to be enough.
> Additive with the default unchanged, so it suits 6.x. Only a change of
> default would need to wait.
> h3. Related
> Raised by the 2026-09-01 security scan as f013, and by tmd-5 against §8 P3 of
> {{THREAT_MODEL.md}}, which asserts the slurpers return only
> Map/List/String/Number/Boolean/null. The no-gadget-instantiation guarantee is
> unaffected: {{Date}} is built from a validated lexical form, not from a class
> named in the document. What P3 has wrong is the list of types, and it should
> be corrected whatever is decided here.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)