Absent nested optional shennanigans
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia riproducendo l'esempio di record/ObjectMapper con Jdk8Module e segui il punto di ingresso della deserializzazione di Optional. Verifica se i test esistenti coprono gli Optionals annidati assenti; il lavoro è completato quando un maintainer ha deciso quale sia il risultato previsto e il comportamento e la motivazione sono documentati in un test di regressione o nella documentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Uh... so this is partially for science, I guess. It's obscure enough to not matter, but I'd like to understand the reasoning. I stumbled upon this because I am working on a smaller databind library myself and of course I'm always comparing to Jackson for sensible defaults. Observe the following:
record R(Optional<Optional<String>> s) { }
R r = new ObjectMapper()
.registerModule(new Jdk8Module())
.readValue("{}", new TypeReference<>() {});
assertFalse(r.s.isPresent());
Here, an Optional<Optional<String>> property is absent from the JSON to deserialize. Naively, I expected the property to be set to an empty optional, but actually it's Optional.of(Optional.empty()), so the snippet above crashes.
I didn't find any tests which explicitly cover this here, so I guess it wasn't really considered a worthwhile edge case. But I think following through with these weird cases helps in figuring out consistent behaviour in general. Do you think that the current behaviour (Optional.of(Optional.empty())) is correct or do you think Optional.empty() would be correct?
- Lingua principale
- Java
- Stelle
- 425
- Fork
- 125
- Merge medio
- 19m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FasterXML/jackson-modules-java8
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
-
Wrap `DateTimeException` Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
FasterXML/jackson-modules-java8#382 · 3 commenti ·
-
date-time-config
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
FasterXML/jackson-modules-java8#374 · 31 commenti · 1 reazione ·
-
Instants get not deserialized as expected sometimes (millis vs nanos, non-fractional numbers) Apertatest-needed
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
FasterXML/jackson-modules-java8#304 · 3 commenti ·
-
OffsetTimeSerializer not writing seconds for time object like 15:30:00Z (where seconds is 00) Apertapr-welcome test-needed
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
FasterXML/jackson-modules-java8#299 · 4 commenti · 1 reazione ·
Tutte le issue di FasterXML/jackson-modules-java8
Issue simili
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/flink-agents#1152 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jenkinsci/blueocean-plugin#5417 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
objectionary/eo-graphs#75 ·