Skip to content

Commit

Permalink
Mark #404 as fixed (via actual fix in jackson-databind)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 4, 2023
1 parent 54703fc commit dc06384
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,8 @@ Niels Basjes (nielsbasjes@github)

* Contributed #415: (yaml) Use `LoaderOptions.allowDuplicateKeys` to enforce duplicate key detection
(2.15.0)

Peter Haumer (phaumer@github)

* Reported #404: (yaml) Cannot serialize YAML with Deduction-Based Polymorphism
(2.15.1)
5 changes: 5 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Active Maintainers:
=== Releases ===
------------------------------------------------------------------------

2.15.1 (not yet released)

#404: (yaml) Cannot serialize YAML with Deduction-Based Polymorphism
(reported by Peter H)

2.15.0 (23-Apr-2023)

#373: (yaml) Positive numbers with plus sign not quoted correctly with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import static com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import static com.fasterxml.jackson.annotation.JsonTypeInfo.Id.DEDUCTION;

// for [databind#43], deduction-based polymorphism
// Copied from [databind#43], deduction-based polymorphism
public class PolymorphicDeductionTest extends ModuleTestBase
{
@JsonTypeInfo(use = DEDUCTION)
Expand All @@ -21,7 +21,7 @@ interface Feline {}
@JsonSubTypes( {@Type(LiveCat.class), @Type(DeadCat.class)})
// A supertype containing common properties
public static class Cat implements Feline {
public String name;
public String name = "Grizabella";
}

// Distinguished by its parent and a unique property
Expand Down Expand Up @@ -87,4 +87,11 @@ public void testCaseInsensitiveInference() throws Exception
assertEquals("FELIX", cat.name);
assertEquals("ENTROPY", ((DeadCat)cat).causeOfDeath);
}

// [dataformats-text#404]:
public void testSerializationOfInferred() throws Exception
{
assertEquals("name: \"Grizabella\"",
trimDocMarker(MAPPER.writeValueAsString(new Cat())));
}
}

0 comments on commit dc06384

Please sign in to comment.