File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
main/java/com/fasterxml/jackson/dataformat/avro/schema
test/java/com/fasterxml/jackson/dataformat/avro/schema Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1010import com .fasterxml .jackson .databind .SerializerProvider ;
1111import com .fasterxml .jackson .databind .jsonFormatVisitors .JsonStringFormatVisitor ;
1212import com .fasterxml .jackson .databind .jsonFormatVisitors .JsonValueFormat ;
13- import com .fasterxml .jackson .databind .type .TypeFactory ;
1413
1514public class StringVisitor extends JsonStringFormatVisitor .Base
1615 implements SchemaBuilder
@@ -37,7 +36,8 @@ public void enumTypes(Set<String> enums) {
3736 public Schema builtAvroSchema () {
3837 // Unlike Jackson, Avro treats characters as an int with the java.lang.Character class type.
3938 if (_type .hasRawClass (char .class ) || _type .hasRawClass (Character .class )) {
40- return AvroSchemaHelper .numericAvroSchema (NumberType .INT , TypeFactory .defaultInstance ().constructType (Character .class ));
39+ // should we construct JavaType for `Character.class` in case of primitive or... ?
40+ return AvroSchemaHelper .numericAvroSchema (NumberType .INT , _type );
4141 }
4242 // [dataformats-binary#179]: need special help with UUIDs, to coerce into Binary
4343 // (could actually be
Original file line number Diff line number Diff line change 2525@ RunWith (Parameterized .class )
2626public class DateTimeVisitor_builtAvroSchemaTest {
2727
28- private static final TypeFactory TYPE_FACTORY = TypeFactory .defaultInstance ();
29-
3028 @ Parameter (0 )
31- public Class testClass ;
29+ public Class <?> testClass ;
3230
3331 @ Parameter (1 )
3432 public JsonParser .NumberType givenNumberType ;
@@ -40,7 +38,7 @@ public class DateTimeVisitor_builtAvroSchemaTest {
4038 public String expectedLogicalType ;
4139
4240 @ Parameters (name = "With {0} and number type {1}" )
43- public static Collection testData () {
41+ public static Collection <?> testData () {
4442 return Arrays .asList (new Object [][]{
4543 // Java type | given number type, | expected Avro type | expected logicalType
4644 {
@@ -72,14 +70,16 @@ public static Collection testData() {
7270 LocalTime .class ,
7371 JsonParser .NumberType .INT ,
7472 Schema .Type .INT ,
75- "time-millis" },
73+ "time-millis"
74+ }
7675 });
7776 }
7877
7978 @ Test
8079 public void builtAvroSchemaTest () {
8180 // GIVEN
82- DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (TYPE_FACTORY .constructSimpleType (testClass , null ));
81+ final TypeFactory tf = TypeFactory .createDefaultInstance ();
82+ DateTimeVisitor dateTimeVisitor = new DateTimeVisitor (tf .constructSimpleType (testClass , null ));
8383 dateTimeVisitor .numberType (givenNumberType );
8484
8585 // WHEN
You can’t perform that action at this time.
0 commit comments