forked from FasterXML/jackson-modules-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix FasterXML#141: Avoid attempting to optimize varargs methods
- Loading branch information
1 parent
1a4517e
commit d2c000e
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...bird/failing/DoubleArrayDeser141Test.java → ...ckbird/deser/DoubleArrayDeser141Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...d/src/test/java/com/fasterxml/jackson/module/blackbird/deser/ObjectArrayDeser141Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.fasterxml.jackson.module.blackbird.deser; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.module.blackbird.BlackbirdTestBase; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
// [modules-base#141] | ||
public class ObjectArrayDeser141Test extends BlackbirdTestBase | ||
{ | ||
static class Bar { | ||
@JsonProperty("baz") | ||
String baz; | ||
|
||
@JsonCreator | ||
public Bar(@JsonProperty("baz") String baz) { | ||
this.baz = baz; | ||
} | ||
} | ||
// [modules-base#141] | ||
static class Foo141 { | ||
@JsonProperty("bar") | ||
List<Bar> bar; | ||
|
||
@JsonCreator | ||
public Foo141(@JsonProperty("bar") Bar... bar) { | ||
this.bar = Arrays.asList(bar); | ||
} | ||
} | ||
|
||
private final ObjectMapper MAPPER = newObjectMapper(); | ||
|
||
// [modules-base#141] | ||
public void testDoubleArrayViaCreator() throws Exception | ||
{ | ||
Foo141 foo = new Foo141(new Bar("a"), new Bar("b")); | ||
String serialized = MAPPER.writeValueAsString(foo); | ||
Foo141 foo2 = MAPPER.readValue(serialized, Foo141.class); | ||
|
||
assertEquals(2, foo2.bar.size()); | ||
assertEquals("a", foo2.bar.get(0).baz); | ||
assertEquals("b", foo2.bar.get(1).baz); | ||
} | ||
} |