[
https://issues.apache.org/jira/browse/GROOVY-12433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131164#comment-18131164
]
ASF GitHub Bot commented on GROOVY-12433:
-----------------------------------------
codeconsole commented on PR #2949:
URL: https://github.com/apache/groovy/pull/2949#issuecomment-6374567300
Thanks for checking it so thoroughly. Four new commits:
1. **Databind annotations** (3ed9138): the YAML, TOML and CSV guides now
have a note beside typed parsing. The `com.fasterxml.jackson.annotation` ones
work unchanged; `@JsonSerialize`, `@JsonDeserialize`, `@JsonNaming`,
`@JsonPOJOBuilder` and the rest must come from
`tools.jackson.databind.annotation`, because the Jackson 2 versions are
silently ignored. I checked it with `@JsonNaming`: the Jackson 2 one is ignored
on both read and write.
2. **XML precedence** (93ed3dc): the XML guide now says Jackson 3 wins
whenever it's on the classpath, gives Spring Boot 4 as the transitive example,
and notes that each version ignores the other's databind annotations, so the
same type can bind differently after the switch.
3. **Transitive dependencies**: listed under breaking changes in the PR
description.
4. **YAML scalar resolution** (e4cb388):
- The note now says "JSON schema" and that it's stricter than the YAML
1.2 core schema, naming `True`, `Null`, `~` and `0x1F` as values the core
schema would still type.
- A new "YAML 1.1 typing with SnakeYAML directly" section follows the
alias recipe, and the scalar note links to it. Its spec test loads `off`,
`yes`, `0x1F` and `~` as `false`, `true`, `31` and `null`.
- Agreed it shouldn't land quietly. I'll start a thread on dev@, and it's
the first entry under breaking changes in the PR description.
**Jackson 3.2**: 3.1.6 was picked to match Spring Boot 4.2, but Boot has
since moved to 3.1.7. 3.2 is also the sibling of the Jackson 2.22 that master
already uses, so 873001b moves to 3.2.4. Scalar resolution is the same apart
from `.inf`, `-.inf` and `.nan`, which Jackson 2 and 3.1 rejected as malformed
numbers. They now parse: as `Double` through the typed API, and as the strings
`'Infinity'`, `'-Infinity'` and `'NaN'` through the untyped one, which converts
through JSON. The guide notes this and `YamlScalarResolutionTest` pins it. 3.2
also applies `maxStringLength` to YAML input, which 3.1 didn't, and fixes
several TOML parser bugs. The yaml, toml, csv, xml and json tests all pass on
it, including `jackson2Test`.
**Release notes**: the PR description's breaking changes are now four
entries (YAML scalars, databind annotations, XML precedence, transitive
dependencies), written so they can be lifted as they are. Happy to open a
groovy-website PR as well if that's easier.
> Move groovy-yaml, groovy-toml and groovy-csv to Jackson 3
> ---------------------------------------------------------
>
> Key: GROOVY-12433
> URL: https://issues.apache.org/jira/browse/GROOVY-12433
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-csv, groovy-toml, groovy-yaml, XML Processing
> Reporter: Scott Murphy Heiberg
> Priority: Major
> Fix For: 7.0.0-alpha-1
>
>
> groovy-yaml, groovy-toml and groovy-csv are built on Jackson 2
> ({{com.fasterxml.jackson}} 2.22.x). Spring Boot 4 uses Jackson 3
> ({{tools.jackson}}) by default, so an application on Spring Boot 4 that uses
> one of these modules carries both major versions and has to manage the
> Jackson 2 one itself. Jackson 2 and 3 use different packages and coordinates,
> so having Jackson 3 on the classpath does nothing for these modules.
> None of the three modules exposes a Jackson type in its public API, so they
> can move to Jackson 3 without source changes for callers.
> Proposal:
> * Depend on {{tools.jackson}} 3.1.6, the version Spring Boot 4.2 manages.
> {{jackson-datatype-jsr310}} is no longer needed; java.time support is built
> into Jackson 3 databind.
> * Build every mapper with {{configureForJackson2()}} so databinding keeps
> Jackson 2's defaults: properties in declaration order, unknown properties
> rejected, nulls for primitives and trailing tokens accepted. The CSV mapper
> also keeps {{SORT_PROPERTIES_ALPHABETICALLY}}, which Jackson 2's
> {{CsvMapper}} enabled itself and the user guide documents.
> * Parser limits follow Jackson 3's defaults: nesting depth 500 (was 1000) and
> string length 100,000,000 (was 20,000,000). Jackson lowered the depth after
> fuzzers reached a StackOverflowError below 1000 (FasterXML/jackson-core#1233)
> and raised the string length for legitimate large payloads
> (FasterXML/jackson-core#1538). {{JsonSlurper}} and {{XmlParser}} keep their
> 1000-level caps.
> * {{XmlParser.parseAs}} and {{parseTextAs}} load jackson-databind
> reflectively; use Jackson 3 when present and fall back to Jackson 2.
> * Jackson 3's YAML backend uses SnakeYAML Engine rather than SnakeYAML, so
> the SnakeYAML alias recipe from GROOVY-12358 needs {{org.yaml:snakeyaml}}
> declared explicitly, as the user guide already anticipates.
> Jackson 3 still uses {{com.fasterxml.jackson.annotation}}, so
> {{@JsonProperty}}, {{@JsonFormat}} and the other annotations in user code
> keep working.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)