borinquenkid commented on PR #16411: URL: https://github.com/apache/grails-core/pull/16411#issuecomment-5870364166
There's a branch, [`refactor/16411-marshaller-dedup`](https://github.com/apache/grails-core/compare/fix/16406-date-rendering-8.0.x...refactor/16411-marshaller-dedup) (based on this PR's current head), that consolidates the single-type `ObjectMarshaller`/`JsonGenerator.Converter` classes this PR adds — and several that predate it — into two small generic classes: - `SimpleTypeMarshaller<T>` (`grails-converters`) — takes a `Class<T>` and a `Function<T, Object>` value extractor. - `SimpleTypeJsonConverter` (`grails-views-gson`) — the same idea for JSON views. `Year`, `YearMonth`, `MonthDay`, `Duration`, `Period`, `ZoneId`, `TimeZone`, `XMLGregorianCalendar`, the `javax.xml.datatype.Duration`, `LocalTime`, `OffsetTime` (JSON only), plus the pre-existing `Instant`/`LocalDate`/`LocalDateTime`/`OffsetDateTime`/`ZonedDateTime` marshallers, were each ~45-50 lines of identical `supports()`/`handles()` plus a one-line format call. The branch replaces all of them with one-line registrations against the two generic classes instead. Net: 35 files changed, +264/-1414 lines. Registration order/priority and rendered output are unchanged — the existing suites pass as-is (199 `grails-converters` tests, 270 `grails-views-gson` tests), plus two new direct unit tests for the generic classes themselves, and checkstyle/CodeNarc are clean. It deliberately leaves `MonthMarshaller`/`MonthJsonConverter`, `SqlTimeMarshaller`/`SqlTimeJsonConverter`, and the JSON-views `OffsetTimeJsonConverter` completely untouched (zero diff), so it doesn't interfere with the PR A / PR B split being discussed above — everything it touches is material either bucket would keep. Given how much of this PR's diff is that repeated boilerplate, I'd highly suggest merging this consolidation in — either into this PR or as a fast-follow — since it meaningfully shrinks the surface reviewers have to read through. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
