Conversation
Views on parameters of a properties-based `@JsonCreator` of an Enum were ignored, so all parameters were passed regardless of the active view -- unlike Creator parameters of POJOs. Views of such parameters are now assigned (explicit `@JsonView` on the parameter, or on the Enum type) and parameters not visible in the active view are skipped. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
I don't think this qualifies for 2.18 inclusion, let's go via |
@JsonView on properties-based Enum Creator parameters@JsonView on properties-based Enum Creator parameters
CI failed: Fuzzer build failure in OSS-Fuzz due to an outdated package import in the fuzzer test matching a different major version namespace.Overview1 log analyzed showing a failure during fuzzer compilation in the OSS-Fuzz job due to mismatched package imports. FailuresOSS-Fuzz Compilation Failure (confidence: high)
Summary
Code Review ✅ Approved🟡 Medium risk · Enum creator deserialization now skips parameters hidden by the active view. Fixes Tip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
(note: fixes #6261)
@JsonViewon the parameters of a properties-based@JsonCreatorof an Enum was ignored: every parameter was passed to the factory regardless of the active view. POJO Creator parameters already honor views.Changes
BasicDeserializerFactory.createEnumDeserializer()now assigns views to the Enum Creator properties. Previously none were set, sovisibleInView()was always true.FactoryBasedEnumDeserializer.deserializeEnumUsingPropertyBased()skips Creator parameters that are not visible in the active view, the same wayBeanDeserializerdoes for POJO Creator properties.Tradeoff
Only explicit
@JsonViewannotations count: one on the parameter, or else one on the Enum type. WithDEFAULT_VIEW_INCLUSIONdisabled, parameters without@JsonViewstay visible. POJO Creator properties would be hidden in that case. I stopped short of matching that on a patch branch, because it would change results for existing Enums whose Creator parameters have no@JsonView.Tests
Added
ViewsWithEnumCreatorTest, covering views on parameters (withDEFAULT_VIEW_INCLUSIONboth enabled and disabled), a view on the Enum type, and a Creator without views (behavior unchanged). Without the fix, 2 of its 3 tests fail../mvnw verifyon JDK 17 has one failure,DateSerializationTest.testWithTimeZoneOverride(PSTvsGMT-08:00). It is caused by the local JDK's time zone names and also fails without this change.🤖 Generated with Claude Code