From c55d1577158dca6bcaea5172516b1db4fbef22dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E9=9C=87=E5=AE=87?= Date: Mon, 30 Jan 2023 07:33:42 +0800 Subject: [PATCH 01/20] Deprecate classes in package jsonschema (#3745) --- .../jackson/databind/ext/DOMSerializer.java | 4 +++ .../jsonschema/JsonSerializableSchema.java | 3 ++ .../databind/jsonschema/SchemaAware.java | 4 +++ .../ser/DefaultSerializerProvider.java | 6 ++-- .../ser/impl/StringArraySerializer.java | 4 +++ .../ser/std/AsArraySerializerBase.java | 11 +++++--- .../databind/ser/std/BeanSerializerBase.java | 7 ++--- .../databind/ser/std/BooleanSerializer.java | 4 +++ .../databind/ser/std/ByteArraySerializer.java | 4 +++ .../databind/ser/std/ClassSerializer.java | 4 +++ .../ser/std/DateTimeSerializerBase.java | 4 +++ .../databind/ser/std/EnumSerializer.java | 4 +++ .../databind/ser/std/FileSerializer.java | 4 +++ .../databind/ser/std/JsonValueSerializer.java | 13 +++++---- .../databind/ser/std/MapSerializer.java | 4 +++ .../databind/ser/std/NullSerializer.java | 6 +++- .../databind/ser/std/NumberSerializer.java | 4 +++ .../databind/ser/std/NumberSerializers.java | 4 +++ .../databind/ser/std/RawSerializer.java | 6 +++- .../databind/ser/std/SqlTimeSerializer.java | 4 +++ .../ser/std/StaticListSerializerBase.java | 4 +++ .../databind/ser/std/StdArraySerializers.java | 28 +++++++++++++++++++ .../ser/std/StdDelegatingSerializer.java | 21 ++++++++++---- .../databind/ser/std/StdJdkSerializers.java | 18 ++++++++++-- .../databind/ser/std/StdScalarSerializer.java | 4 +++ .../databind/ser/std/StdSerializer.java | 13 +++++++-- .../databind/ser/std/StringSerializer.java | 4 +++ .../ser/std/ToEmptyObjectSerializer.java | 4 +++ .../ser/std/ToStringSerializerBase.java | 4 +++ .../ser/std/TokenBufferSerializer.java | 4 +++ .../databind/jsonschema/NewSchemaTest.java | 4 ++- .../databind/module/SimpleModuleTest.java | 2 ++ 32 files changed, 183 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java index 0b96dbc5a4..343eb0ebc5 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/DOMSerializer.java @@ -51,6 +51,10 @@ public void serialize(Node value, JsonGenerator g, SerializerProvider provider) } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, java.lang.reflect.Type typeHint) { // Well... it is serialized as String diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java index b34ce6d355..3a9f03db99 100644 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java +++ b/src/main/java/com/fasterxml/jackson/databind/jsonschema/JsonSerializableSchema.java @@ -17,10 +17,13 @@ * * @author Ryan Heaton * @author Tatu Saloranta + * @deprecated Since 2.15, we recommend use of external + * JSON Schema generator module */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @JacksonAnnotation +@Deprecated public @interface JsonSerializableSchema { /** diff --git a/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java b/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java index f3505cd37d..8d7036fb8a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java +++ b/src/main/java/com/fasterxml/jackson/databind/jsonschema/SchemaAware.java @@ -8,7 +8,11 @@ /** * Marker interface for schema-aware serializers. + * + * @deprecated Since 2.15, we recommend use of external + * JSON Schema generator module */ +@Deprecated public interface SchemaAware { /** diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java b/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java index cfef603728..9509933946 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/DefaultSerializerProvider.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.impl.WritableObjectId; @@ -583,8 +582,9 @@ public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(C * type information it needs is accessible via "untyped" serializer) */ JsonSerializer ser = findValueSerializer(type, null); - JsonNode schemaNode = (ser instanceof SchemaAware) ? - ((SchemaAware) ser).getSchema(this, null) : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); + JsonNode schemaNode = (ser instanceof com.fasterxml.jackson.databind.jsonschema.SchemaAware) + ? ((com.fasterxml.jackson.databind.jsonschema.SchemaAware) ser).getSchema(this, null) + : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); if (!(schemaNode instanceof ObjectNode)) { throw new IllegalArgumentException("Class " + type.getName() +" would not be serialized as a JSON object and therefore has no schema"); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java index 70caebfc24..c2f0bd8e66 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java @@ -210,6 +210,10 @@ private void serializeContentsSlow(String[] value, JsonGenerator gen, Serializer } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("array", true).set("items", createSchemaNode("string")); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java index 759c44ff27..e074124711 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java @@ -12,7 +12,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.ContainerSerializer; @@ -271,7 +270,10 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi protected abstract void serializeContents(T value, JsonGenerator gen, SerializerProvider provider) throws IOException; - @SuppressWarnings("deprecation") + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException @@ -279,8 +281,9 @@ public JsonNode getSchema(SerializerProvider provider, Type typeHint) ObjectNode o = createSchemaNode("array", true); if (_elementSerializer != null) { JsonNode schemaNode = null; - if (_elementSerializer instanceof SchemaAware) { - schemaNode = ((SchemaAware) _elementSerializer).getSchema(provider, null); + if (_elementSerializer instanceof com.fasterxml.jackson.databind.jsonschema.SchemaAware) { + schemaNode = ((com.fasterxml.jackson.databind.jsonschema.SchemaAware) _elementSerializer) + .getSchema(provider, null); } if (schemaNode == null) { schemaNode = com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java index bbd8d437ef..8df52f0797 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java @@ -15,8 +15,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; -import com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.*; @@ -40,7 +38,7 @@ public abstract class BeanSerializerBase extends StdSerializer implements ContextualSerializer, ResolvableSerializer, - JsonFormatVisitable, SchemaAware + JsonFormatVisitable { protected final static PropertyName NAME_FOR_OBJECT_REF = new PropertyName("#object-ref"); @@ -849,7 +847,8 @@ public JsonNode getSchema(SerializerProvider provider, Type typeHint) ObjectNode o = createSchemaNode("object", true); // [JACKSON-813]: Add optional JSON Schema id attribute, if found // NOTE: not optimal, does NOT go through AnnotationIntrospector etc: - JsonSerializableSchema ann = _handledType.getAnnotation(JsonSerializableSchema.class); + com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema ann = + _handledType.getAnnotation(com.fasterxml.jackson.databind.jsonschema.JsonSerializableSchema.class); if (ann != null) { String id = ann.id(); if (id != null && !id.isEmpty()) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java index de691fb917..72bd899cc7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java @@ -75,6 +75,10 @@ public final void serializeWithType(Object value, JsonGenerator g, SerializerPro g.writeBoolean(Boolean.TRUE.equals(value)); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("boolean", !_forPrimitive); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java index 69c2ae602f..07e196eca8 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ByteArraySerializer.java @@ -69,6 +69,10 @@ public void serializeWithType(byte[] value, JsonGenerator g, SerializerProvider */ } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java index 6dfffcf80b..9ab21cc107 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ClassSerializer.java @@ -27,6 +27,10 @@ public void serialize(Class value, JsonGenerator g, SerializerProvider provid g.writeString(value.getName()); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java index 572d23eb62..73762eb8be 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java @@ -148,6 +148,10 @@ public boolean isEmpty(SerializerProvider serializers, T value) { protected abstract long _timestamp(T value); + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider serializers, Type typeHint) { //todo: (ryan) add a format for the date in the schema? diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java index 8fa003d156..933628ebfe 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java @@ -139,6 +139,10 @@ public final void serialize(Enum en, JsonGenerator gen, SerializerProvider se /********************************************************** */ + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java index 696348aba7..9c7f28096b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/FileSerializer.java @@ -26,6 +26,10 @@ public void serialize(File value, JsonGenerator g, SerializerProvider provider) g.writeString(value.getAbsolutePath()); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("string", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java index 9201cca43d..65854b1714 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java @@ -17,7 +17,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.BeanSerializer; @@ -41,7 +40,7 @@ @JacksonStdImpl public class JsonValueSerializer extends StdSerializer - implements ContextualSerializer, JsonFormatVisitable, SchemaAware + implements ContextualSerializer, JsonFormatVisitable { /** * @since 2.9 @@ -302,13 +301,17 @@ public void serializeWithType(Object bean, JsonGenerator gen, SerializerProvider /********************************************************** */ - @SuppressWarnings("deprecation") + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider ctxt, Type typeHint) throws JsonMappingException { - if (_valueSerializer instanceof SchemaAware) { - return ((SchemaAware)_valueSerializer).getSchema(ctxt, null); + if (_valueSerializer instanceof com.fasterxml.jackson.databind.jsonschema.SchemaAware) { + return ((com.fasterxml.jackson.databind.jsonschema.SchemaAware) _valueSerializer) + .getSchema(ctxt, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java index 36137c1e8b..36c3a3e8af 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java @@ -1102,6 +1102,10 @@ public void serializeFilteredAnyProperties(SerializerProvider provider, JsonGene /********************************************************** */ + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java index e7e8a2f234..a21893fcf0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NullSerializer.java @@ -43,7 +43,11 @@ public void serializeWithType(Object value, JsonGenerator gen, SerializerProvide { gen.writeNull(); } - + + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { return createSchemaNode("null"); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java index 86d49314d0..95acf710a7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializer.java @@ -91,6 +91,10 @@ public void serialize(Number value, JsonGenerator g, SerializerProvider provider } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode(_isInt ? "integer" : "number", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java index f9c2c6bd15..01ed61fcb3 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java @@ -75,6 +75,10 @@ protected Base(Class cls, JsonParser.NumberType numberType, || (numberType == JsonParser.NumberType.BIG_INTEGER); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode(_schemaType, true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java index bed8e7a998..92d24ea002 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/RawSerializer.java @@ -41,7 +41,11 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi serialize(value, g, provider); typeSer.writeTypeSuffix(g, typeIdDef); } - + + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java index ba49c76b4f..3a3e2a419a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/SqlTimeSerializer.java @@ -22,6 +22,10 @@ public void serialize(java.sql.Time value, JsonGenerator g, SerializerProvider p g.writeString(value.toString()); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("string", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java index 4f186b8ea7..9c8a717323 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java @@ -106,6 +106,10 @@ public boolean isEmpty(SerializerProvider provider, T value) { return (value == null) || (value.isEmpty()); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("array", true).set("items", contentSchema()); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java index 93b646a46a..52f8dc215e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdArraySerializers.java @@ -155,6 +155,10 @@ public void serializeContents(boolean[] value, JsonGenerator g, SerializerProvid } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { @@ -232,6 +236,10 @@ public void serializeContents(short[] value, JsonGenerator g, SerializerProvider } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { @@ -307,6 +315,10 @@ private final void _writeArrayContents(JsonGenerator g, char[] value) } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { @@ -397,6 +409,10 @@ public void serializeContents(int[] value, JsonGenerator g, SerializerProvider p } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("array", true).set("items", createSchemaNode("integer")); @@ -469,6 +485,10 @@ public void serializeContents(long[] value, JsonGenerator g, SerializerProvider } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { @@ -547,6 +567,10 @@ public void serializeContents(float[] value, JsonGenerator g, SerializerProvider } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("array", true).set("items", createSchemaNode("number")); @@ -631,6 +655,10 @@ public void serializeContents(double[] value, JsonGenerator g, SerializerProvide } } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("array", true).set("items", createSchemaNode("number")); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java index 9973b85be2..727a62a9e1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.ResolvableSerializer; @@ -29,7 +28,7 @@ public class StdDelegatingSerializer extends StdSerializer implements ContextualSerializer, ResolvableSerializer, - JsonFormatVisitable, SchemaAware + JsonFormatVisitable { protected final Converter _converter; @@ -201,22 +200,32 @@ public boolean isEmpty(SerializerProvider prov, Object value) /********************************************************** */ + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { - if (_delegateSerializer instanceof SchemaAware) { - return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); + if (_delegateSerializer instanceof com.fasterxml.jackson.databind.jsonschema.SchemaAware) { + return ((com.fasterxml.jackson.databind.jsonschema.SchemaAware) _delegateSerializer) + .getSchema(provider, typeHint); } return super.getSchema(provider, typeHint); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { - if (_delegateSerializer instanceof SchemaAware) { - return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); + if (_delegateSerializer instanceof com.fasterxml.jackson.databind.jsonschema.SchemaAware) { + return ((com.fasterxml.jackson.databind.jsonschema.SchemaAware) _delegateSerializer) + .getSchema(provider, typeHint, isOptional); } return super.getSchema(provider, typeHint); } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java index 7f7dc5870f..0599fda8f2 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdJdkSerializers.java @@ -66,7 +66,11 @@ public static class AtomicBooleanSerializer public void serialize(AtomicBoolean value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeBoolean(value.get()); } - + + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("boolean", true); @@ -87,7 +91,11 @@ public static class AtomicIntegerSerializer public void serialize(AtomicInteger value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeNumber(value.get()); } - + + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("integer", true); @@ -109,7 +117,11 @@ public static class AtomicLongSerializer public void serialize(AtomicLong value, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeNumber(value.get()); } - + + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("integer", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java index 683a2f40f3..e1d9a84dd2 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdScalarSerializer.java @@ -58,6 +58,10 @@ public void serializeWithType(T value, JsonGenerator g, SerializerProvider provi typeSer.writeTypeSuffix(g, typeIdDef); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java index 3869d3319c..a1ca2fd0ad 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java @@ -15,7 +15,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.*; -import com.fasterxml.jackson.databind.jsonschema.SchemaAware; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.FilterProvider; @@ -27,11 +26,11 @@ * Base class used by all standard serializers, and can also * be used for custom serializers (in fact, this is the recommended * base class to use). - * Provides convenience methods for implementing {@link SchemaAware} */ +@SuppressWarnings("deprecation") public abstract class StdSerializer extends JsonSerializer - implements JsonFormatVisitable, SchemaAware, java.io.Serializable + implements JsonFormatVisitable, com.fasterxml.jackson.databind.jsonschema.SchemaAware, java.io.Serializable { private static final long serialVersionUID = 1L; @@ -120,7 +119,11 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t /** * Default implementation simply claims type is "string"; usually * overriden by custom serializers. + * + * @deprecated Since 2.15, we recommend use of external + * JSON Schema generator module */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { @@ -130,7 +133,11 @@ public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws Jso /** * Default implementation simply claims type is "string"; usually * overriden by custom serializers. + * + * @deprecated Since 2.15, we recommend use of external + * JSON Schema generator module */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java index f9d525ac93..432a3772bd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StringSerializer.java @@ -49,6 +49,10 @@ public final void serializeWithType(Object value, JsonGenerator gen, SerializerP gen.writeString((String) value); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return createSchemaNode("string", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToEmptyObjectSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToEmptyObjectSerializer.java index ef4dbba9c1..bded43f0c2 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToEmptyObjectSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToEmptyObjectSerializer.java @@ -57,6 +57,10 @@ public boolean isEmpty(SerializerProvider provider, Object value) { return true; } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase.java index 7e759f6d1c..034c2a3a9c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase.java @@ -59,6 +59,10 @@ public void serializeWithType(Object value, JsonGenerator g, SerializerProvider typeSer.writeTypeSuffix(g, typeIdDef); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { return createSchemaNode("string", true); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java index a7624b078e..8987d1cf9b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/TokenBufferSerializer.java @@ -56,6 +56,10 @@ public final void serializeWithType(TokenBuffer value, JsonGenerator g, typeSer.writeTypeSuffix(g, typeIdDef); } + /** + * @deprecated Since 2.15 + */ + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java index 8a42978fa9..75f6f6acf2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java @@ -148,7 +148,9 @@ private void _visit(BeanProperty prop) throws JsonMappingException } // and this just for bit of extra coverage... if (ser instanceof StdSerializer) { - assertNotNull(((StdSerializer) ser).getSchema(prov, prop.getType())); + @SuppressWarnings("deprecation") + JsonNode schemaNode = ((StdSerializer) ser).getSchema(prov, prop.getType()); + assertNotNull(schemaNode); } JsonFormatVisitorWrapper visitor = new JsonFormatVisitorWrapper.Base(getProvider()); ser.acceptJsonFormatVisitor(visitor, prop.getType()); diff --git a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java index 6e824ea1ca..6352a96cf8 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java @@ -44,6 +44,7 @@ public void serialize(CustomBean value, JsonGenerator jgen, SerializerProvider p jgen.writeString(value.str + "|" + value.num); } + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return null; @@ -78,6 +79,7 @@ public void serialize(SimpleEnum value, JsonGenerator jgen, SerializerProvider p jgen.writeString(value.name().toLowerCase()); } + @Deprecated @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return null; From f2cb5d56fda16fed1bc5f79957c50400d1bbe944 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sun, 29 Jan 2023 15:38:20 -0800 Subject: [PATCH 02/20] Update release notes wrt #3745 --- release-notes/CREDITS-2.x | 3 +++ release-notes/VERSION-2.x | 2 ++ 2 files changed, 5 insertions(+) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 56f686b670..94b2699558 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -1559,3 +1559,6 @@ Ajay Siwach (Siwach16@github) * Contributed #3637: Add enum features into `@JsonFormat.Feature` (2.15.0) +Zhenyu Luo (luozhenyu@github) + * Contributed #3745: Deprecate classes in package `com.fasterxml.jackson.databind.jsonschema` + (2.15.0) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index c3f8fbf2c5..56d8a133ba 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -34,6 +34,8 @@ Project: jackson-databind #3736: Try to avoid auto-detecting Fields for Record types #3742: schemaType of `LongSerializer` is wrong (reported by @luozhenyu) +#3745: Deprecate classes in package `com.fasterxml.jackson.databind.jsonschema` + (contributed by @luozhenyu) #3748: `DelegatingDeserializer` missing override of `getAbsentValue()` (and couple of other methods) From 434b7ebfcb072e8cdc04cbd94db6b605bfb7aa02 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 30 Jan 2023 01:25:45 +0100 Subject: [PATCH 03/20] lgtm and travis are no longer used (#3762) --- .travis.yml | 17 ----------------- lgtm.yml | 8 -------- 2 files changed, 25 deletions(-) delete mode 100644 .travis.yml delete mode 100644 lgtm.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 89f4c6fa4b..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: java - -git: - quiet: true - submodules: false - -# 08-Jul-2020, tatu: can not yet enable JDK14 due to new Record tests failing -jdk: - - openjdk8 - - openjdk11 - -branches: - only: - - master - - "2.13" - -script: mvn -B clean verify diff --git a/lgtm.yml b/lgtm.yml deleted file mode 100644 index f64995f90a..0000000000 --- a/lgtm.yml +++ /dev/null @@ -1,8 +0,0 @@ - -# Let's exclude certain queries, rationales: -# -# - equals() vs hashCode(): either hashCode() never used, or (more likely) base impl is -# already fine as-is, even if equality check changed -# -queries: - - exclude: java/inconsistent-equals-and-hashcode From fa5d5abb88f27e8c6a8de928abd72011e5bfd66d Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sun, 29 Jan 2023 16:26:09 -0800 Subject: [PATCH 04/20] Minor test Javadoc improvement --- .../com/fasterxml/jackson/failing/POJONode3262Test.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/fasterxml/jackson/failing/POJONode3262Test.java b/src/test/java/com/fasterxml/jackson/failing/POJONode3262Test.java index 0a9709086c..a06432b845 100644 --- a/src/test/java/com/fasterxml/jackson/failing/POJONode3262Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/POJONode3262Test.java @@ -4,7 +4,11 @@ import com.fasterxml.jackson.databind.*; -// [databind#3262]: not sure what could be done here +// [databind#3262]: not sure what could be done here. The issue is that +// `JsonNode.toString()` will use internal "default" ObjectMapper which +// does not (and cannot) have modules for external datatypes, such as +// Java 8 Date/Time types. One possibility would be catch IOException for +// POJONode, produce something like "ERROR: " TextNode for that case? public class POJONode3262Test extends BaseMapTest { private final ObjectMapper MAPPER = newJsonMapper(); From 3268fd876ecd66bef557b0e64b72a16268b20ba7 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 30 Jan 2023 19:28:43 -0800 Subject: [PATCH 05/20] Disable CodeQL for regular pushes, PRs; too unreliable --- .github/workflows/codeql-analysis.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8f89d2fc49..f86592554b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,24 +3,7 @@ name: "CodeQL" on: schedule: - cron: '40 21 * * 2' - push: - branches: - - master - - "3.0" - - "2.14" - - "2.13" - paths-ignore: - - "README.md" - - "release-notes/*" - pull_request: - branches: - - master - - "3.0" - - "2.14" - - "2.13" - paths-ignore: - - "README.md" - - "release-notes/*" + # Used to be run on PRs, merges; but too unreliable, removed permissions: contents: read From 17762595577afae81f38956783a2bffc020dbc62 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 30 Jan 2023 19:47:03 -0800 Subject: [PATCH 06/20] Partial revert of javadoc stuff for #3769 --- docs/README.md | 7 +++++++ docs/javadoc/1.9/package-list | 30 ++++++++++++++++++++++++++++++ docs/javadoc/2.0/package-list | 19 +++++++++++++++++++ docs/javadoc/2.1/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.10/package-list | 21 +++++++++++++++++++++ docs/javadoc/2.10/packages | 21 +++++++++++++++++++++ docs/javadoc/2.11.rc1/package-list | 21 +++++++++++++++++++++ docs/javadoc/2.11/package-list | 21 +++++++++++++++++++++ docs/javadoc/2.12/package-list | 22 ++++++++++++++++++++++ docs/javadoc/2.13/package-list | 22 ++++++++++++++++++++++ docs/javadoc/2.14/package-list | 23 +++++++++++++++++++++++ docs/javadoc/2.14/packages | 23 +++++++++++++++++++++++ docs/javadoc/2.2/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.3/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.4/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.5/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.6/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.6/packages | 20 ++++++++++++++++++++ docs/javadoc/2.7/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.8/package-list | 20 ++++++++++++++++++++ docs/javadoc/2.9/package-list | 20 ++++++++++++++++++++ 21 files changed, 430 insertions(+) create mode 100644 docs/README.md create mode 100644 docs/javadoc/1.9/package-list create mode 100644 docs/javadoc/2.0/package-list create mode 100644 docs/javadoc/2.1/package-list create mode 100644 docs/javadoc/2.10/package-list create mode 100644 docs/javadoc/2.10/packages create mode 100644 docs/javadoc/2.11.rc1/package-list create mode 100644 docs/javadoc/2.11/package-list create mode 100644 docs/javadoc/2.12/package-list create mode 100644 docs/javadoc/2.13/package-list create mode 100644 docs/javadoc/2.14/package-list create mode 100644 docs/javadoc/2.14/packages create mode 100644 docs/javadoc/2.2/package-list create mode 100644 docs/javadoc/2.3/package-list create mode 100644 docs/javadoc/2.4/package-list create mode 100644 docs/javadoc/2.5/package-list create mode 100644 docs/javadoc/2.6/package-list create mode 100644 docs/javadoc/2.6/packages create mode 100644 docs/javadoc/2.7/package-list create mode 100644 docs/javadoc/2.8/package-list create mode 100644 docs/javadoc/2.9/package-list diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..c426c0fe1a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,7 @@ +# Empty! + +`/docs/` used to contain Javadocs definitions, but since they can be found from: + + http://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind + +are no longer stored in this repo diff --git a/docs/javadoc/1.9/package-list b/docs/javadoc/1.9/package-list new file mode 100644 index 0000000000..17f79d39c6 --- /dev/null +++ b/docs/javadoc/1.9/package-list @@ -0,0 +1,30 @@ +org.codehaus.jackson +org.codehaus.jackson.annotate +org.codehaus.jackson.format +org.codehaus.jackson.impl +org.codehaus.jackson.io +org.codehaus.jackson.jaxrs +org.codehaus.jackson.map +org.codehaus.jackson.map.annotate +org.codehaus.jackson.map.deser +org.codehaus.jackson.map.deser.impl +org.codehaus.jackson.map.deser.std +org.codehaus.jackson.map.exc +org.codehaus.jackson.map.ext +org.codehaus.jackson.map.introspect +org.codehaus.jackson.map.jsontype +org.codehaus.jackson.map.jsontype.impl +org.codehaus.jackson.map.module +org.codehaus.jackson.map.ser +org.codehaus.jackson.map.ser.impl +org.codehaus.jackson.map.ser.std +org.codehaus.jackson.map.type +org.codehaus.jackson.map.util +org.codehaus.jackson.mrbean +org.codehaus.jackson.node +org.codehaus.jackson.schema +org.codehaus.jackson.smile +org.codehaus.jackson.sym +org.codehaus.jackson.type +org.codehaus.jackson.util +org.codehaus.jackson.xc diff --git a/docs/javadoc/2.0/package-list b/docs/javadoc/2.0/package-list new file mode 100644 index 0000000000..b06c65127c --- /dev/null +++ b/docs/javadoc/2.0/package-list @@ -0,0 +1,19 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.1/package-list b/docs/javadoc/2.1/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.1/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.10/package-list b/docs/javadoc/2.10/package-list new file mode 100644 index 0000000000..866bca6ba2 --- /dev/null +++ b/docs/javadoc/2.10/package-list @@ -0,0 +1,21 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.10/packages b/docs/javadoc/2.10/packages new file mode 100644 index 0000000000..96ee7d5212 --- /dev/null +++ b/docs/javadoc/2.10/packages @@ -0,0 +1,21 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util \ No newline at end of file diff --git a/docs/javadoc/2.11.rc1/package-list b/docs/javadoc/2.11.rc1/package-list new file mode 100644 index 0000000000..866bca6ba2 --- /dev/null +++ b/docs/javadoc/2.11.rc1/package-list @@ -0,0 +1,21 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.11/package-list b/docs/javadoc/2.11/package-list new file mode 100644 index 0000000000..866bca6ba2 --- /dev/null +++ b/docs/javadoc/2.11/package-list @@ -0,0 +1,21 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.12/package-list b/docs/javadoc/2.12/package-list new file mode 100644 index 0000000000..a80c0c399f --- /dev/null +++ b/docs/javadoc/2.12/package-list @@ -0,0 +1,22 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jdk14 +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.13/package-list b/docs/javadoc/2.13/package-list new file mode 100644 index 0000000000..a80c0c399f --- /dev/null +++ b/docs/javadoc/2.13/package-list @@ -0,0 +1,22 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jdk14 +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.14/package-list b/docs/javadoc/2.14/package-list new file mode 100644 index 0000000000..504478f4c2 --- /dev/null +++ b/docs/javadoc/2.14/package-list @@ -0,0 +1,23 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jdk14 +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util +com.fasterxml.jackson.databind.util.internal diff --git a/docs/javadoc/2.14/packages b/docs/javadoc/2.14/packages new file mode 100644 index 0000000000..e33b77e1c2 --- /dev/null +++ b/docs/javadoc/2.14/packages @@ -0,0 +1,23 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.util +com.fasterxml.jackson.databind.util.internal +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.json +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.jdk14 +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl \ No newline at end of file diff --git a/docs/javadoc/2.2/package-list b/docs/javadoc/2.2/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.2/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.3/package-list b/docs/javadoc/2.3/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.3/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.4/package-list b/docs/javadoc/2.4/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.4/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.5/package-list b/docs/javadoc/2.5/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.5/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.6/package-list b/docs/javadoc/2.6/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.6/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.6/packages b/docs/javadoc/2.6/packages new file mode 100644 index 0000000000..295fec0321 --- /dev/null +++ b/docs/javadoc/2.6/packages @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util \ No newline at end of file diff --git a/docs/javadoc/2.7/package-list b/docs/javadoc/2.7/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.7/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.8/package-list b/docs/javadoc/2.8/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.8/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.9/package-list b/docs/javadoc/2.9/package-list new file mode 100644 index 0000000000..8a2cd8be56 --- /dev/null +++ b/docs/javadoc/2.9/package-list @@ -0,0 +1,20 @@ +com.fasterxml.jackson.databind +com.fasterxml.jackson.databind.annotation +com.fasterxml.jackson.databind.cfg +com.fasterxml.jackson.databind.deser +com.fasterxml.jackson.databind.deser.impl +com.fasterxml.jackson.databind.deser.std +com.fasterxml.jackson.databind.exc +com.fasterxml.jackson.databind.ext +com.fasterxml.jackson.databind.introspect +com.fasterxml.jackson.databind.jsonFormatVisitors +com.fasterxml.jackson.databind.jsonschema +com.fasterxml.jackson.databind.jsontype +com.fasterxml.jackson.databind.jsontype.impl +com.fasterxml.jackson.databind.module +com.fasterxml.jackson.databind.node +com.fasterxml.jackson.databind.ser +com.fasterxml.jackson.databind.ser.impl +com.fasterxml.jackson.databind.ser.std +com.fasterxml.jackson.databind.type +com.fasterxml.jackson.databind.util From 568dfbe0e86cea422f55ae73f6a1c1c1049259a6 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 30 Jan 2023 20:22:01 -0800 Subject: [PATCH 07/20] Add javadoc redirects --- docs/javadoc/2.0/index.html | 7 +++++++ docs/javadoc/2.1/index.html | 7 +++++++ docs/javadoc/2.10/index.html | 7 +++++++ docs/javadoc/2.11.rc1/package-list | 21 --------------------- docs/javadoc/2.11/index.html | 7 +++++++ docs/javadoc/2.12/index.html | 7 +++++++ docs/javadoc/2.13/index.html | 7 +++++++ docs/javadoc/2.14/index.html | 7 +++++++ docs/javadoc/2.2/index.html | 7 +++++++ docs/javadoc/2.3/index.html | 7 +++++++ docs/javadoc/2.4/index.html | 7 +++++++ docs/javadoc/2.5/index.html | 7 +++++++ docs/javadoc/2.6/index.html | 7 +++++++ docs/javadoc/2.7/index.html | 7 +++++++ docs/javadoc/2.8/index.html | 7 +++++++ docs/javadoc/2.9/index.html | 7 +++++++ 16 files changed, 105 insertions(+), 21 deletions(-) create mode 100644 docs/javadoc/2.0/index.html create mode 100644 docs/javadoc/2.1/index.html create mode 100644 docs/javadoc/2.10/index.html delete mode 100644 docs/javadoc/2.11.rc1/package-list create mode 100644 docs/javadoc/2.11/index.html create mode 100644 docs/javadoc/2.12/index.html create mode 100644 docs/javadoc/2.13/index.html create mode 100644 docs/javadoc/2.14/index.html create mode 100644 docs/javadoc/2.2/index.html create mode 100644 docs/javadoc/2.3/index.html create mode 100644 docs/javadoc/2.4/index.html create mode 100644 docs/javadoc/2.5/index.html create mode 100644 docs/javadoc/2.6/index.html create mode 100644 docs/javadoc/2.7/index.html create mode 100644 docs/javadoc/2.8/index.html create mode 100644 docs/javadoc/2.9/index.html diff --git a/docs/javadoc/2.0/index.html b/docs/javadoc/2.0/index.html new file mode 100644 index 0000000000..012caaf97b --- /dev/null +++ b/docs/javadoc/2.0/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.1/index.html b/docs/javadoc/2.1/index.html new file mode 100644 index 0000000000..02f5a8f54e --- /dev/null +++ b/docs/javadoc/2.1/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.10/index.html b/docs/javadoc/2.10/index.html new file mode 100644 index 0000000000..5699fcb887 --- /dev/null +++ b/docs/javadoc/2.10/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.11.rc1/package-list b/docs/javadoc/2.11.rc1/package-list deleted file mode 100644 index 866bca6ba2..0000000000 --- a/docs/javadoc/2.11.rc1/package-list +++ /dev/null @@ -1,21 +0,0 @@ -com.fasterxml.jackson.databind -com.fasterxml.jackson.databind.annotation -com.fasterxml.jackson.databind.cfg -com.fasterxml.jackson.databind.deser -com.fasterxml.jackson.databind.deser.impl -com.fasterxml.jackson.databind.deser.std -com.fasterxml.jackson.databind.exc -com.fasterxml.jackson.databind.ext -com.fasterxml.jackson.databind.introspect -com.fasterxml.jackson.databind.json -com.fasterxml.jackson.databind.jsonFormatVisitors -com.fasterxml.jackson.databind.jsonschema -com.fasterxml.jackson.databind.jsontype -com.fasterxml.jackson.databind.jsontype.impl -com.fasterxml.jackson.databind.module -com.fasterxml.jackson.databind.node -com.fasterxml.jackson.databind.ser -com.fasterxml.jackson.databind.ser.impl -com.fasterxml.jackson.databind.ser.std -com.fasterxml.jackson.databind.type -com.fasterxml.jackson.databind.util diff --git a/docs/javadoc/2.11/index.html b/docs/javadoc/2.11/index.html new file mode 100644 index 0000000000..c811244f26 --- /dev/null +++ b/docs/javadoc/2.11/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.12/index.html b/docs/javadoc/2.12/index.html new file mode 100644 index 0000000000..9d3980cc2c --- /dev/null +++ b/docs/javadoc/2.12/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.13/index.html b/docs/javadoc/2.13/index.html new file mode 100644 index 0000000000..8785bd0df5 --- /dev/null +++ b/docs/javadoc/2.13/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.14/index.html b/docs/javadoc/2.14/index.html new file mode 100644 index 0000000000..2732421031 --- /dev/null +++ b/docs/javadoc/2.14/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.2/index.html b/docs/javadoc/2.2/index.html new file mode 100644 index 0000000000..21e1e1914c --- /dev/null +++ b/docs/javadoc/2.2/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.3/index.html b/docs/javadoc/2.3/index.html new file mode 100644 index 0000000000..96837e5b3c --- /dev/null +++ b/docs/javadoc/2.3/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.4/index.html b/docs/javadoc/2.4/index.html new file mode 100644 index 0000000000..ca28faf43e --- /dev/null +++ b/docs/javadoc/2.4/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.5/index.html b/docs/javadoc/2.5/index.html new file mode 100644 index 0000000000..383414e1fd --- /dev/null +++ b/docs/javadoc/2.5/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.6/index.html b/docs/javadoc/2.6/index.html new file mode 100644 index 0000000000..4687f4f1db --- /dev/null +++ b/docs/javadoc/2.6/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.7/index.html b/docs/javadoc/2.7/index.html new file mode 100644 index 0000000000..1677a1e708 --- /dev/null +++ b/docs/javadoc/2.7/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.8/index.html b/docs/javadoc/2.8/index.html new file mode 100644 index 0000000000..afce9b8c9b --- /dev/null +++ b/docs/javadoc/2.8/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + diff --git a/docs/javadoc/2.9/index.html b/docs/javadoc/2.9/index.html new file mode 100644 index 0000000000..c5f3be8f64 --- /dev/null +++ b/docs/javadoc/2.9/index.html @@ -0,0 +1,7 @@ + + + + +

Please follow this link.

+ + From 3061cc9d93d5c76969e5374e1f2d012cbc40781e Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Mon, 30 Jan 2023 20:29:22 -0800 Subject: [PATCH 08/20] Use `Map.putIfAbsent()` as we are on Java 8 --- .../fasterxml/jackson/databind/util/EnumResolver.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java b/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java index f3f1ec83c5..f5425e12dc 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/EnumResolver.java @@ -101,11 +101,8 @@ protected static EnumResolver _constructFor(Class enumCls0, String[] aliases = allAliases[i]; if (aliases != null) { for (String alias : aliases) { - // TODO: JDK 1.8, use Map.putIfAbsent() // Avoid overriding any primary names - if (!map.containsKey(alias)) { - map.put(alias, enumValue); - } + map.putIfAbsent(alias, enumValue); } } } @@ -147,11 +144,8 @@ protected static EnumResolver _constructUsingToString(Class enumCls0, String[] aliases = allAliases[i]; if (aliases != null) { for (String alias : aliases) { - // TODO: JDK 1.8, use Map.putIfAbsent() // Avoid overriding any primary names - if (!map.containsKey(alias)) { - map.put(alias, enumValue); - } + map.putIfAbsent(alias, enumValue); } } } From 1ba4cd03991129304b7163de10c3f8efcc9d7be1 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" Date: Tue, 31 Jan 2023 13:32:40 +0900 Subject: [PATCH 09/20] Fix : Not thread-safe singleton factory methods on EnumResolver and StdKeyDeserializer class (#3768) --- .../databind/deser/std/EnumDeserializer.java | 16 ++++++++-------- .../databind/deser/std/StdKeyDeserializer.java | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java index 879c933fca..05112d272a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java @@ -50,7 +50,7 @@ public class EnumDeserializer * * @since 2.7.3 */ - protected CompactStringObjectMap _lookupByToString; + protected volatile CompactStringObjectMap _lookupByToString; protected final Boolean _caseInsensitive; @@ -397,17 +397,17 @@ protected Class _enumClass() { return handledType(); } - protected CompactStringObjectMap _getToStringLookup(DeserializationContext ctxt) - { + protected CompactStringObjectMap _getToStringLookup(DeserializationContext ctxt) { CompactStringObjectMap lookup = _lookupByToString; - // note: exact locking not needed; all we care for here is to try to - // reduce contention for the initial resolution if (lookup == null) { synchronized (this) { - lookup = EnumResolver.constructUsingToString(ctxt.getConfig(), _enumClass()) - .constructLookup(); + lookup = _lookupByToString; + if (lookup == null) { + lookup = EnumResolver.constructUsingToString(ctxt.getConfig(), _enumClass()) + .constructLookup(); + _lookupByToString = lookup; + } } - _lookupByToString = lookup; } return lookup; } diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java index 5f406f4108..c841f6c098 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java @@ -368,7 +368,7 @@ final static class EnumKD extends StdKeyDeserializer * * @since 2.7.3 */ - protected EnumResolver _byToStringResolver; + protected volatile EnumResolver _byToStringResolver; protected final Enum _enumDefaultValue; @@ -410,9 +410,12 @@ private EnumResolver _getToStringResolver(DeserializationContext ctxt) EnumResolver res = _byToStringResolver; if (res == null) { synchronized (this) { - res = EnumResolver.constructUsingToString(ctxt.getConfig(), + res = _byToStringResolver; + if (res == null) { + res = EnumResolver.constructUsingToString(ctxt.getConfig(), _byNameResolver.getEnumClass()); - _byToStringResolver = res; + _byToStringResolver = res; + } } } return res; From 4ca3952dfb058c7b523162e6b2d14cfff70b1be5 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 31 Jan 2023 05:43:52 +0100 Subject: [PATCH 10/20] use getNumberValueDeferred() to avoid over-eager number parsing in TokenBuffer (#3761) --- .../jackson/databind/util/TokenBuffer.java | 51 +++++++-------- .../databind/deser/UnknownPropertiesTest.java | 65 +++++++++++++++++++ 2 files changed, 87 insertions(+), 29 deletions(-) create mode 100644 src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java diff --git a/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java b/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java index 5c4c0a2e17..5be6dfc730 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java @@ -926,6 +926,14 @@ public void writeNumber(String encodedValue) throws IOException { _appendValue(JsonToken.VALUE_NUMBER_FLOAT, encodedValue); } + private void writeLazyInteger(Object encodedValue) throws IOException { + _appendValue(JsonToken.VALUE_NUMBER_INT, encodedValue); + } + + private void writeLazyDecimal(Object encodedValue) throws IOException { + _appendValue(JsonToken.VALUE_NUMBER_FLOAT, encodedValue); + } + @Override public void writeBoolean(boolean state) throws IOException { _appendValue(state ? JsonToken.VALUE_TRUE : JsonToken.VALUE_FALSE); @@ -1086,31 +1094,14 @@ public void copyCurrentEvent(JsonParser p) throws IOException writeNumber(p.getIntValue()); break; case BIG_INTEGER: - writeNumber(p.getBigIntegerValue()); + writeLazyInteger(p.getNumberValueDeferred()); break; default: writeNumber(p.getLongValue()); } break; case VALUE_NUMBER_FLOAT: - if (_forceBigDecimal) { - // 10-Oct-2015, tatu: Ideally we would first determine whether underlying - // number is already decoded into a number (in which case might as well - // access as number); or is still retained as text (in which case we - // should further defer decoding that may not need BigDecimal): - writeNumber(p.getDecimalValue()); - } else { - switch (p.getNumberType()) { - case BIG_DECIMAL: - writeNumber(p.getDecimalValue()); - break; - case FLOAT: - writeNumber(p.getFloatValue()); - break; - default: - writeNumber(p.getDoubleValue()); - } - } + writeLazyDecimal(p.getNumberValueDeferred()); break; case VALUE_TRUE: writeBoolean(true); @@ -1244,21 +1235,14 @@ private void _copyBufferValue(JsonParser p, JsonToken t) throws IOException writeNumber(p.getIntValue()); break; case BIG_INTEGER: - writeNumber(p.getBigIntegerValue()); + writeLazyInteger(p.getNumberValueDeferred()); break; default: writeNumber(p.getLongValue()); } break; case VALUE_NUMBER_FLOAT: - if (_forceBigDecimal) { - writeNumber(p.getDecimalValue()); - } else { - // 09-Jul-2020, tatu: Used to just copy using most optimal method, but - // issues like [databind#2644] force to use exact, not optimal type - final Number n = p.getNumberValueExact(); - _appendValue(JsonToken.VALUE_NUMBER_FLOAT, n); - } + writeLazyDecimal(p.getNumberValueDeferred()); break; case VALUE_TRUE: writeBoolean(true); @@ -1856,7 +1840,7 @@ public long getLongValue() throws IOException { @Override public NumberType getNumberType() throws IOException { - Number n = getNumberValue(); + Object n = getNumberValueDeferred(); if (n instanceof Integer) return NumberType.INT; if (n instanceof Long) return NumberType.LONG; if (n instanceof Double) return NumberType.DOUBLE; @@ -1864,6 +1848,9 @@ public NumberType getNumberType() throws IOException if (n instanceof BigInteger) return NumberType.BIG_INTEGER; if (n instanceof Float) return NumberType.FLOAT; if (n instanceof Short) return NumberType.INT; // should be SHORT + if (n instanceof String) { + return ((String) n).contains(".") ? NumberType.BIG_DECIMAL : NumberType.BIG_INTEGER; + } return null; } @@ -1872,6 +1859,12 @@ public final Number getNumberValue() throws IOException { return getNumberValue(false); } + @Override + public Object getNumberValueDeferred() throws IOException { + _checkIsNumber(); + return _currentObject(); + } + private Number getNumberValue(final boolean preferBigNumbers) throws IOException { _checkIsNumber(); Object value = _currentObject(); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java new file mode 100644 index 0000000000..c1ef0b11ff --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java @@ -0,0 +1,65 @@ +package com.fasterxml.jackson.databind.deser; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.databind.BaseMapTest; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; + +public class UnknownPropertiesTest extends BaseMapTest +{ + + static class ExtractFieldsNoDefaultConstructor { + private final String s; + private final int i; + + @JsonCreator + public ExtractFieldsNoDefaultConstructor(@JsonProperty("s") String s, @JsonProperty("i") int i) { + this.s = s; + this.i = i; + } + + public String getS() { + return s; + } + + public int getI() { + return i; + } + } + + /* + /********************************************************** + /* Test methods + /********************************************************** + */ + + public void testIgnoreProperty() throws Exception + { + JsonFactory jsonFactory = JsonFactory.builder() + .streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(Integer.MAX_VALUE).build()) + .build(); + ObjectMapper objectMapper = JsonMapper.builder(jsonFactory) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .build(); + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < 1000000; i++) { + stringBuilder.append(7); + } + final String test1000000 = stringBuilder.toString(); + ExtractFieldsNoDefaultConstructor ef = + objectMapper.readValue(genJson(test1000000), ExtractFieldsNoDefaultConstructor.class); + } + + private String genJson(String num) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder + .append("{\"s\":\"s\",\"n\":") + .append(num) + .append(",\"i\":1}"); + return stringBuilder.toString(); + } +} From e2edf366901974c8d94503c97f3d5d69f514d25c Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 31 Jan 2023 19:12:47 +0100 Subject: [PATCH 11/20] remove lgtm links (#3767) --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9fda68c520..2d4f3b92be 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,7 @@ Naming of classes uses word 'JSON' in many places even though there is no actual | Artifact | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.core/jackson-databind/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.fasterxml.jackson.core/jackson-databind) | | OSS Sponsorship | [![Tidelift](https://tidelift.com/badges/package/maven/com.fasterxml.jackson.core:jackson-databind)](https://tidelift.com/subscription/pkg/maven-com-fasterxml-jackson-core-jackson-databind?utm_source=maven-com-fasterxml-jackson-core-jackson-databind&utm_medium=referral&utm_campaign=readme) | | Javadocs | [![Javadoc](https://javadoc.io/badge/com.fasterxml.jackson.core/jackson-databind.svg)](http://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind) | -| Code coverage (2.14) | [![codecov.io](https://codecov.io/github/FasterXML/jackson-databind/coverage.svg?branch=2.14)](https://codecov.io/github/FasterXML/jackson-databind?branch=2.14) | -| CodeQ (LGTM.com) | [![LGTM alerts](https://img.shields.io/lgtm/alerts/g/FasterXML/jackson-databind.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FasterXML/jackson-databind/alerts/) [![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/FasterXML/jackson-databind.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/FasterXML/jackson-databind/context:java) | - +| Code coverage (2.15) | [![codecov.io](https://codecov.io/github/FasterXML/jackson-databind/coverage.svg?branch=2.15)](https://codecov.io/github/FasterXML/jackson-databind?branch=2.15) | # Get it! @@ -32,7 +30,7 @@ Functionality of this package is contained in Java package `com.fasterxml.jackso ... - 2.13.2 + 2.14.2 ... From cd4d8f475992d07d2289175f1fd1772172cfff4f Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 15:22:33 -0800 Subject: [PATCH 12/20] Update release notes wrt #3730 --- release-notes/VERSION-2.x | 2 ++ 1 file changed, 2 insertions(+) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 56d8a133ba..40d829aaa5 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -31,6 +31,8 @@ Project: jackson-databind (reported by João G) #3708: Seems like `java.nio.file.Path` is safe for Android API level 26 (contributed by @pjfanning) +#3730: Add support in `TokenBuffer` for lazily decoded (big) numbers + (contributed by @pjfanning) #3736: Try to avoid auto-detecting Fields for Record types #3742: schemaType of `LongSerializer` is wrong (reported by @luozhenyu) From 41bb276ee0bc245ad963a93958f9b031ea59aac2 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 2 Feb 2023 00:27:57 +0100 Subject: [PATCH 13/20] try to mock NumberInput method and fail if called (#3770) --- .../databind/deser/UnknownPropertiesTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java index c1ef0b11ff..c75a5c6c37 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java @@ -4,11 +4,20 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.StreamReadConstraints; +import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.databind.BaseMapTest; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import static org.powermock.api.mockito.PowerMockito.*; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.fasterxml.jackson.core.io.NumberInput") public class UnknownPropertiesTest extends BaseMapTest { @@ -39,6 +48,11 @@ public int getI() { public void testIgnoreProperty() throws Exception { + mockStatic(NumberInput.class); + when(NumberInput.parseBigInteger(Mockito.anyString())) + .thenThrow(new IllegalStateException("mock: deliberate failure")); + when(NumberInput.parseBigInteger(Mockito.anyString(), Mockito.anyBoolean())) + .thenThrow(new IllegalStateException("mock: deliberate failure")); JsonFactory jsonFactory = JsonFactory.builder() .streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(Integer.MAX_VALUE).build()) .build(); @@ -52,6 +66,7 @@ public void testIgnoreProperty() throws Exception final String test1000000 = stringBuilder.toString(); ExtractFieldsNoDefaultConstructor ef = objectMapper.readValue(genJson(test1000000), ExtractFieldsNoDefaultConstructor.class); + assertNotNull(ef); } private String genJson(String num) { From abaa6fb6611adba1bb20e12d36893e744c7d499b Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 15:39:43 -0800 Subject: [PATCH 14/20] Test refactoring. --- .../LazyIgnoralForNumbers3730Test.java} | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) rename src/test/java/com/fasterxml/jackson/databind/deser/{UnknownPropertiesTest.java => lazy/LazyIgnoralForNumbers3730Test.java} (72%) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java similarity index 72% rename from src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java rename to src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java index c75a5c6c37..b58106317b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java @@ -1,14 +1,15 @@ -package com.fasterxml.jackson.databind.deser; +package com.fasterxml.jackson.databind.deser.lazy; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.StreamReadConstraints; + import com.fasterxml.jackson.core.io.NumberInput; + import com.fasterxml.jackson.databind.BaseMapTest; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; + import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -16,11 +17,14 @@ import static org.powermock.api.mockito.PowerMockito.*; +/** + * Tests to verify that skipping of unknown/unmapped works such that + * "expensive" numbers (all floating-point, {@code BigInteger} is avoided. + */ @RunWith(PowerMockRunner.class) @PrepareForTest(fullyQualifiedNames = "com.fasterxml.jackson.core.io.NumberInput") -public class UnknownPropertiesTest extends BaseMapTest +public class LazyIgnoralForNumbers3730Test extends BaseMapTest { - static class ExtractFieldsNoDefaultConstructor { private final String s; private final int i; @@ -46,26 +50,24 @@ public int getI() { /********************************************************** */ - public void testIgnoreProperty() throws Exception + private final ObjectMapper MAPPER = JsonMapper.builder() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .build(); + + public void testIgnoreBigInteger() throws Exception { mockStatic(NumberInput.class); when(NumberInput.parseBigInteger(Mockito.anyString())) .thenThrow(new IllegalStateException("mock: deliberate failure")); when(NumberInput.parseBigInteger(Mockito.anyString(), Mockito.anyBoolean())) .thenThrow(new IllegalStateException("mock: deliberate failure")); - JsonFactory jsonFactory = JsonFactory.builder() - .streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(Integer.MAX_VALUE).build()) - .build(); - ObjectMapper objectMapper = JsonMapper.builder(jsonFactory) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .build(); StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < 1000000; i++) { + for (int i = 0; i < 999; i++) { stringBuilder.append(7); } - final String test1000000 = stringBuilder.toString(); + final String testBigInteger = stringBuilder.toString(); ExtractFieldsNoDefaultConstructor ef = - objectMapper.readValue(genJson(test1000000), ExtractFieldsNoDefaultConstructor.class); + MAPPER.readValue(genJson(testBigInteger), ExtractFieldsNoDefaultConstructor.class); assertNotNull(ef); } From 82d3d55a1a3acceff63249188482543c664cf5a0 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 15:45:57 -0800 Subject: [PATCH 15/20] Silly git, trying to relink new test class (undo rename) --- ...oralForNumbers3730Test.java => UnknownPropertiesTest.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/test/java/com/fasterxml/jackson/databind/deser/{lazy/LazyIgnoralForNumbers3730Test.java => UnknownPropertiesTest.java} (95%) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java similarity index 95% rename from src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java rename to src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java index b58106317b..c088ed0520 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java @@ -1,4 +1,4 @@ -package com.fasterxml.jackson.databind.deser.lazy; +package com.fasterxml.jackson.databind.deser; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -23,7 +23,7 @@ */ @RunWith(PowerMockRunner.class) @PrepareForTest(fullyQualifiedNames = "com.fasterxml.jackson.core.io.NumberInput") -public class LazyIgnoralForNumbers3730Test extends BaseMapTest +public class UnknownPropertiesTest extends BaseMapTest { static class ExtractFieldsNoDefaultConstructor { private final String s; From d4ba871f39c3bd730bfe6bf7deaccb346fbb4048 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 15:50:38 -0800 Subject: [PATCH 16/20] Test refactoring again (attempt 2) --- .../LazyIgnoralForNumbers3730Test.java} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename src/test/java/com/fasterxml/jackson/databind/deser/{UnknownPropertiesTest.java => lazy/LazyIgnoralForNumbers3730Test.java} (95%) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java similarity index 95% rename from src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java rename to src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java index c088ed0520..b58106317b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/UnknownPropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java @@ -1,4 +1,4 @@ -package com.fasterxml.jackson.databind.deser; +package com.fasterxml.jackson.databind.deser.lazy; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -23,7 +23,7 @@ */ @RunWith(PowerMockRunner.class) @PrepareForTest(fullyQualifiedNames = "com.fasterxml.jackson.core.io.NumberInput") -public class UnknownPropertiesTest extends BaseMapTest +public class LazyIgnoralForNumbers3730Test extends BaseMapTest { static class ExtractFieldsNoDefaultConstructor { private final String s; From 9ccb6e06a1c4f1663fa068bd7721b9c28d52b0b8 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 16:30:24 -0800 Subject: [PATCH 17/20] Improve lazy-number-parsing testing --- .../lazy/LazyIgnoralForNumbers3730Test.java | 131 ++++++++++++++++-- 1 file changed, 123 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java index b58106317b..f42f26e445 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java @@ -6,8 +6,10 @@ import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.databind.BaseMapTest; +import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.json.JsonMapper; import org.junit.runner.RunWith; @@ -17,20 +19,22 @@ import static org.powermock.api.mockito.PowerMockito.*; +import java.math.BigDecimal; + /** * Tests to verify that skipping of unknown/unmapped works such that - * "expensive" numbers (all floating-point, {@code BigInteger} is avoided. + * "expensive" numbers (all floating-point, {@code BigInteger}) is avoided. */ @RunWith(PowerMockRunner.class) @PrepareForTest(fullyQualifiedNames = "com.fasterxml.jackson.core.io.NumberInput") public class LazyIgnoralForNumbers3730Test extends BaseMapTest { - static class ExtractFieldsNoDefaultConstructor { + static class ExtractFieldsNoDefaultConstructor3730 { private final String s; private final int i; @JsonCreator - public ExtractFieldsNoDefaultConstructor(@JsonProperty("s") String s, @JsonProperty("i") int i) { + public ExtractFieldsNoDefaultConstructor3730(@JsonProperty("s") String s, @JsonProperty("i") int i) { this.s = s; this.i = i; } @@ -44,6 +48,26 @@ public int getI() { } } + // Another class to test that we do actually call parse method -- just not + // eagerly + static class ExtractFieldsWithNumberField3730 { + public String s; + public int i; + public Number n; + } + + static class ExtractFieldsWithBigDecimalField3730 { + public String s; + public int i; + public double n; + } + + static class ExtractFieldsWithDoubleField3730 { + public String s; + public int i; + public BigDecimal n; + } + /* /********************************************************** /* Test methods @@ -53,22 +77,107 @@ public int getI() { private final ObjectMapper MAPPER = JsonMapper.builder() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .build(); - + public void testIgnoreBigInteger() throws Exception { + final String MOCK_MSG = "mock: deliberate failure for parseBigInteger"; mockStatic(NumberInput.class); when(NumberInput.parseBigInteger(Mockito.anyString())) - .thenThrow(new IllegalStateException("mock: deliberate failure")); + .thenThrow(new IllegalStateException(MOCK_MSG)); when(NumberInput.parseBigInteger(Mockito.anyString(), Mockito.anyBoolean())) - .thenThrow(new IllegalStateException("mock: deliberate failure")); + .thenThrow(new IllegalStateException(MOCK_MSG)); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < 999; i++) { stringBuilder.append(7); } final String testBigInteger = stringBuilder.toString(); - ExtractFieldsNoDefaultConstructor ef = - MAPPER.readValue(genJson(testBigInteger), ExtractFieldsNoDefaultConstructor.class); + final String json = genJson(testBigInteger); + ExtractFieldsNoDefaultConstructor3730 ef = + MAPPER.readValue(json, ExtractFieldsNoDefaultConstructor3730.class); + assertNotNull(ef); + + // Ok but then let's ensure method IS called, if field is actually mapped + try { + MAPPER.readValue(json, ExtractFieldsWithNumberField3730.class); + fail("Should throw exception with mocking!"); + } catch (DatabindException e) { + verifyMockException(e, MOCK_MSG); + } + } + + public void testIgnoreFPValuesDefault() throws Exception + { + final String MOCK_MSG = "mock: deliberate failure for parseDouble"; + // With default settings we would parse Doubles, so check + mockStatic(NumberInput.class); + when(NumberInput.parseDouble(Mockito.anyString())) + .thenThrow(new IllegalStateException(MOCK_MSG)); + when(NumberInput.parseDouble(Mockito.anyString(), Mockito.anyBoolean())) + .thenThrow(new IllegalStateException(MOCK_MSG)); + final String json = genJson("0.25"); + ExtractFieldsNoDefaultConstructor3730 ef = + MAPPER.readValue(json, ExtractFieldsNoDefaultConstructor3730.class); + assertNotNull(ef); + + // Ok but then let's ensure method IS called, if field is actually mapped + // First, to "Number" + try { + MAPPER.readValue(json, ExtractFieldsWithNumberField3730.class); + fail("Should throw exception with mocking!"); + } catch (DatabindException e) { + verifyMockException(e, MOCK_MSG); + } + + // And then to "double" + // 01-Feb-2023, tatu: Not quite working, yet: + /* + try { + MAPPER.readValue(json, ExtractFieldsWithDoubleField3730.class); + fail("Should throw exception with mocking!"); + } catch (DatabindException e) { + verifyMockException(e, MOCK_MSG); + } + */ + } + + public void testIgnoreFPValuesBigDecimal() throws Exception + { + final String MOCK_MSG = "mock: deliberate failure for parseBigDecimal"; + final ObjectReader reader = MAPPER + .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) + .readerFor(ExtractFieldsNoDefaultConstructor3730.class); + + // Now should get calls to `parseBigDecimal`... eventually + mockStatic(NumberInput.class); + when(NumberInput.parseBigDecimal(Mockito.anyString())) + .thenThrow(new IllegalStateException(MOCK_MSG)); + when(NumberInput.parseBigDecimal(Mockito.anyString(), Mockito.anyBoolean())) + .thenThrow(new IllegalStateException(MOCK_MSG)); + + final String json = genJson("0.25"); + ExtractFieldsNoDefaultConstructor3730 ef = + reader.readValue(genJson(json)); assertNotNull(ef); + + // Ok but then let's ensure method IS called, if field is actually mapped + // First to Number + try { + reader.forType(ExtractFieldsWithNumberField3730.class).readValue(json); + fail("Should throw exception with mocking!"); + } catch (DatabindException e) { + verifyMockException(e, MOCK_MSG); + } + + // And then to "BigDecimal" + // 01-Feb-2023, tatu: Not quite working, yet: + /* + try { + reader.forType(ExtractFieldsWithBigDecimalField3730.class).readValue(json); + fail("Should throw exception with mocking!"); + } catch (DatabindException e) { + verifyMockException(e, MOCK_MSG); + } + */ } private String genJson(String num) { @@ -79,4 +188,10 @@ private String genJson(String num) { .append(",\"i\":1}"); return stringBuilder.toString(); } + + private void verifyMockException(DatabindException e, String expMsg) { + Throwable cause = e.getCause(); + assertEquals(IllegalStateException.class, cause.getClass()); + assertEquals(expMsg, cause.getMessage()); + } } From 30fccea8991bafa2b58281f55d2f60de9b86f597 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Wed, 1 Feb 2023 19:09:55 -0800 Subject: [PATCH 18/20] More improvements to #3730 testing, minor tweaking of `TokenBuffer` & lazy number handling --- .../jackson/databind/util/TokenBuffer.java | 40 ++++++---- .../lazy/LazyIgnoralForNumbers3730Test.java | 75 ++++++++++++------- 2 files changed, 75 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java b/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java index 5be6dfc730..43ab3dc447 100644 --- a/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java +++ b/src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java @@ -1849,7 +1849,8 @@ public NumberType getNumberType() throws IOException if (n instanceof Float) return NumberType.FLOAT; if (n instanceof Short) return NumberType.INT; // should be SHORT if (n instanceof String) { - return ((String) n).contains(".") ? NumberType.BIG_DECIMAL : NumberType.BIG_INTEGER; + return (_currToken == JsonToken.VALUE_NUMBER_FLOAT) + ? NumberType.BIG_DECIMAL : NumberType.BIG_INTEGER; } return null; } @@ -1876,22 +1877,35 @@ private Number getNumberValue(final boolean preferBigNumbers) throws IOException // try to determine Double/BigDecimal preference... if (value instanceof String) { String str = (String) value; - if (str.indexOf('.') >= 0) { - if (preferBigNumbers) { - return NumberInput.parseBigDecimal(str, - isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER)); + final int len = str.length(); + if (_currToken == JsonToken.VALUE_NUMBER_INT) { + if (preferBigNumbers + // 01-Feb-2023, tatu: Not really accurate but we'll err on side + // of not losing accuracy (should really check 19-char case, + // or, with minus sign, 20-char) + || (len >= 19)) { + return NumberInput.parseBigInteger(str, isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER)); } - return NumberInput.parseDouble(str, isEnabled(StreamReadFeature.USE_FAST_DOUBLE_PARSER)); - } else if (preferBigNumbers) { - return NumberInput.parseBigInteger(str, isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER)); + // Otherwise things get trickier; here, too, we should use more accurate + // boundary checks + if (len >= 10) { + return NumberInput.parseLong(str); + } + return NumberInput.parseInt(str); } - return NumberInput.parseLong(str); - } - if (value == null) { - return null; + if (preferBigNumbers) { + BigDecimal dec = NumberInput.parseBigDecimal(str, + isEnabled(StreamReadFeature.USE_FAST_BIG_NUMBER_PARSER)); + // 01-Feb-2023, tatu: This is... weird. Seen during tests, only + if (dec == null) { + throw new IllegalStateException("Internal error: failed to parse number '"+str+"'"); + } + return dec; + } + return NumberInput.parseDouble(str, isEnabled(StreamReadFeature.USE_FAST_DOUBLE_PARSER)); } throw new IllegalStateException("Internal error: entry should be a Number, but is of type " - +value.getClass().getName()); + +ClassUtil.classNameOf(value)); } private final boolean _smallerThanInt(Number n) { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java index f42f26e445..b1c0667d9b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/lazy/LazyIgnoralForNumbers3730Test.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; - +import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.core.io.NumberInput; import com.fasterxml.jackson.databind.BaseMapTest; @@ -49,23 +49,40 @@ public int getI() { } // Another class to test that we do actually call parse method -- just not - // eagerly - static class ExtractFieldsWithNumberField3730 { - public String s; - public int i; - public Number n; + // eagerly. But MUST use "@JsonUnwrapped" to force buffering; creator not enough + static class UnwrappedWithNumber { + @JsonUnwrapped + public Values values; + + static class Values { + public String s; + public int i; + public Number n; + } } - static class ExtractFieldsWithBigDecimalField3730 { - public String s; - public int i; - public double n; + // Same as above + static class UnwrappedWithBigDecimal { + @JsonUnwrapped + public Values values; + + static class Values { + public String s; + public int i; + public BigDecimal n; + } } - static class ExtractFieldsWithDoubleField3730 { - public String s; - public int i; - public BigDecimal n; + // And same here + static class UnwrappedWithDouble { + @JsonUnwrapped + public Values values; + + static class Values { + public String s; + public int i; + public double n; + } } /* @@ -78,6 +95,10 @@ static class ExtractFieldsWithDoubleField3730 { .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .build(); + private final ObjectMapper STRICT_MAPPER = JsonMapper.builder() + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .build(); + public void testIgnoreBigInteger() throws Exception { final String MOCK_MSG = "mock: deliberate failure for parseBigInteger"; @@ -95,11 +116,11 @@ public void testIgnoreBigInteger() throws Exception ExtractFieldsNoDefaultConstructor3730 ef = MAPPER.readValue(json, ExtractFieldsNoDefaultConstructor3730.class); assertNotNull(ef); - - // Ok but then let's ensure method IS called, if field is actually mapped + // Ok but then let's ensure method IS called, if field is actually mapped, + // first to Number try { - MAPPER.readValue(json, ExtractFieldsWithNumberField3730.class); - fail("Should throw exception with mocking!"); + Object ob = STRICT_MAPPER.readValue(json, UnwrappedWithNumber.class); + fail("Should throw exception with mocking: instead got: "+MAPPER.writeValueAsString(ob)); } catch (DatabindException e) { verifyMockException(e, MOCK_MSG); } @@ -122,7 +143,7 @@ public void testIgnoreFPValuesDefault() throws Exception // Ok but then let's ensure method IS called, if field is actually mapped // First, to "Number" try { - MAPPER.readValue(json, ExtractFieldsWithNumberField3730.class); + STRICT_MAPPER.readValue(json, UnwrappedWithNumber.class); fail("Should throw exception with mocking!"); } catch (DatabindException e) { verifyMockException(e, MOCK_MSG); @@ -130,20 +151,19 @@ public void testIgnoreFPValuesDefault() throws Exception // And then to "double" // 01-Feb-2023, tatu: Not quite working, yet: - /* try { - MAPPER.readValue(json, ExtractFieldsWithDoubleField3730.class); + STRICT_MAPPER.readValue(json, UnwrappedWithDouble.class); fail("Should throw exception with mocking!"); } catch (DatabindException e) { + e.printStackTrace(); verifyMockException(e, MOCK_MSG); } - */ } public void testIgnoreFPValuesBigDecimal() throws Exception { final String MOCK_MSG = "mock: deliberate failure for parseBigDecimal"; - final ObjectReader reader = MAPPER + ObjectReader reader = MAPPER .enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) .readerFor(ExtractFieldsNoDefaultConstructor3730.class); @@ -159,10 +179,13 @@ public void testIgnoreFPValuesBigDecimal() throws Exception reader.readValue(genJson(json)); assertNotNull(ef); + // But then ensure we'll fail with unknown (except does it work with unwrapped?) + reader = reader.with(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + // Ok but then let's ensure method IS called, if field is actually mapped // First to Number try { - reader.forType(ExtractFieldsWithNumberField3730.class).readValue(json); + reader.forType(UnwrappedWithNumber.class).readValue(json); fail("Should throw exception with mocking!"); } catch (DatabindException e) { verifyMockException(e, MOCK_MSG); @@ -170,14 +193,12 @@ public void testIgnoreFPValuesBigDecimal() throws Exception // And then to "BigDecimal" // 01-Feb-2023, tatu: Not quite working, yet: - /* try { - reader.forType(ExtractFieldsWithBigDecimalField3730.class).readValue(json); + reader.forType(UnwrappedWithBigDecimal.class).readValue(json); fail("Should throw exception with mocking!"); } catch (DatabindException e) { verifyMockException(e, MOCK_MSG); } - */ } private String genJson(String num) { From fc3eacf17fb92d2fd97838331703235de393443c Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 2 Feb 2023 20:00:08 -0800 Subject: [PATCH 19/20] Remote trailing white space from test sources --- .../failing/RecordUpdate3079Test.java | 2 +- .../jackson/databind/jdk9/Java9ListsTest.java | 2 +- .../records/RecordNamingStrategy2992Test.java | 2 +- .../jackson/databind/BaseMapTest.java | 16 +-- .../fasterxml/jackson/databind/BaseTest.java | 16 +-- .../jackson/databind/MapperViaParserTest.java | 8 +- .../jackson/databind/ObjectMapperTest.java | 4 +- .../jackson/databind/ObjectReaderTest.java | 20 +-- .../jackson/databind/ObjectWriterTest.java | 14 +-- .../jackson/databind/RoundtripTest.java | 4 +- .../jackson/databind/TestFormatSchema.java | 12 +- .../databind/TestHandlerInstantiation.java | 34 ++--- .../databind/TestJDKSerialization.java | 12 +- .../jackson/databind/TestRootName.java | 2 +- .../jackson/databind/TestVersions.java | 2 +- .../databind/access/TestAnyGetterAccess.java | 4 +- .../jackson/databind/big/TestBiggerData.java | 2 +- .../cfg/DeserializationConfigTest.java | 4 +- .../jackson/databind/cfg/SerConfigTest.java | 2 +- .../TestContextAttributeWithDeser.java | 6 +- .../TestContextAttributeWithSer.java | 4 +- .../TestContextualDeserialization.java | 30 ++--- .../contextual/TestContextualKeyTypes.java | 10 +- .../TestContextualSerialization.java | 32 ++--- .../TestContextualWithAnnDeserializer.java | 8 +- .../convert/CoerceContainersTest.java | 10 +- .../convert/CoerceEmptyArrayTest.java | 4 +- .../databind/convert/CoerceEnumTest.java | 4 +- .../convert/CoerceFloatToIntTest.java | 6 +- .../convert/CoerceJDKScalarsTest.java | 4 +- .../convert/CoerceMiscScalarsTest.java | 2 +- .../convert/CoerceNaNStringToNumberTest.java | 6 +- .../databind/convert/CoercePojosTest.java | 2 +- .../convert/CoerceStringToIntsTest.java | 2 +- .../databind/convert/CoerceToBooleanTest.java | 14 +-- .../convert/EmptyStringAsSingleValueTest.java | 4 +- .../convert/ScalarConversionTest.java | 4 +- .../convert/TestArrayConversions.java | 14 +-- .../databind/convert/TestBeanConversions.java | 22 ++-- .../convert/TestConvertingDeserializer.java | 12 +- .../convert/TestConvertingSerializer.java | 10 +- .../databind/convert/TestMapConversions.java | 4 +- .../convert/TestPolymorphicUpdateValue.java | 4 +- .../convert/TestStringConversions.java | 4 +- .../convert/TestUpdateViaObjectReader.java | 6 +- .../databind/convert/UpdateValueTest.java | 2 +- .../jackson/databind/deser/AnySetterTest.java | 32 ++--- .../databind/deser/CyclicTypesDeserTest.java | 8 +- .../deser/DeserializerFactoryTest.java | 2 +- .../databind/deser/IgnoreWithDeserTest.java | 4 +- .../databind/deser/JacksonTypesDeserTest.java | 4 +- .../databind/deser/MergePolymorphicTest.java | 2 +- .../databind/deser/NullHandlingTest.java | 10 +- .../databind/deser/PropertyAliasTest.java | 4 +- .../deser/ReadOnlyListDeser2118Test.java | 2 +- .../databind/deser/TestAnnotationUsing.java | 6 +- .../databind/deser/TestBasicAnnotations.java | 10 +- .../databind/deser/TestBeanDeserializer.java | 36 +++--- .../databind/deser/TestCachingOfDeser.java | 4 +- .../databind/deser/TestConcurrency.java | 8 +- .../deser/TestCustomDeserializers.java | 16 +-- .../deser/TestFieldDeserialization.java | 2 +- .../deser/TestGenericCollectionDeser.java | 2 +- .../jackson/databind/deser/TestGenerics.java | 10 +- .../databind/deser/TestOverloaded.java | 12 +- .../deser/TestSetterlessProperties.java | 2 +- .../jackson/databind/deser/TestStatics.java | 2 +- .../deser/builder/BuilderAdvancedTest.java | 4 +- .../BuilderDeserializationTest2486.java | 2 +- .../deser/builder/BuilderErrorHandling.java | 4 +- .../deser/builder/BuilderFailTest.java | 2 +- .../builder/BuilderInfiniteLoop1978Test.java | 4 +- .../deser/builder/BuilderSimpleTest.java | 26 ++-- .../deser/builder/BuilderWithCreatorTest.java | 20 +-- .../BuilderWithTypeParametersTest.java | 6 +- ...ilderWithUnwrappedSingleArray2608Test.java | 2 +- .../builder/BuilderWithUnwrappedTest.java | 4 +- .../deser/creators/BigCreatorTest.java | 4 +- .../creators/ConstructorDetector1498Test.java | 2 +- .../deser/creators/CreatorPropertiesTest.java | 2 +- .../DelegatingExternalProperty1003Test.java | 2 +- .../deser/creators/DisablingCreatorsTest.java | 2 +- .../deser/creators/EnumCreatorTest.java | 32 ++--- .../FactoryAndConstructor2962Test.java | 2 +- .../creators/ImplicitNameMatch792Test.java | 10 +- .../deser/creators/InnerClassCreatorTest.java | 4 +- .../creators/MultiArgConstructorTest.java | 14 +-- .../NamingStrategyViaCreator556Test.java | 6 +- .../creators/NullValueViaCreatorTest.java | 2 +- .../deser/creators/SingleArgCreatorTest.java | 14 +-- .../databind/deser/creators/TestCreators.java | 14 +-- .../deser/creators/TestCreators2.java | 16 +-- .../deser/creators/TestCreators3.java | 6 +- .../creators/TestCreatorsDelegating.java | 20 +-- .../creators/TestCreatorsWithIdentity.java | 4 +- .../creators/TestCustomValueInstDefaults.java | 4 +- .../creators/TestPolymorphicCreators.java | 4 +- .../creators/TestPolymorphicDelegating.java | 2 +- .../deser/creators/TestValueInstantiator.java | 64 +++++----- .../deser/dos/DeepJsonNodeDeser3397Test.java | 2 +- .../deser/dos/HugeIntegerCoerceTest.java | 6 +- .../deser/enums/EnumDefaultReadTest.java | 18 +-- .../enums/EnumDeserialization3369Test.java | 2 +- .../deser/enums/EnumDeserializationTest.java | 12 +- .../enums/EnumMapDeserializationTest.java | 18 +-- .../filter/IgnorePropertyOnDeserTest.java | 4 +- ...UnknownPropertyUsingPropertyBasedTest.java | 4 +- .../filter/NullConversionsForContentTest.java | 24 ++-- .../filter/NullConversionsForEnumsTest.java | 2 +- .../deser/filter/NullConversionsPojoTest.java | 2 +- .../deser/filter/NullConversionsSkipTest.java | 8 +- .../ProblemHandlerLocation1440Test.java | 2 +- .../deser/filter/ProblemHandlerTest.java | 16 +-- .../deser/filter/ReadOnlyDeser95Test.java | 4 +- .../TestUnknownPropertyDeserialization.java | 10 +- .../deser/impl/BeanPropertyMapTest.java | 2 +- .../inject/InjectableWithoutDeser962Test.java | 2 +- .../deser/inject/TestInjectables.java | 12 +- .../deser/jdk/ArrayDeserializationTest.java | 24 ++-- .../deser/jdk/CharSequenceDeser3305Test.java | 2 +- .../deser/jdk/CollectionDeserTest.java | 2 +- .../jdk/DateDeserializationTZ1153Test.java | 2 +- .../deser/jdk/DateDeserializationTZTest.java | 116 +++++++++--------- .../deser/jdk/DateDeserializationTest.java | 24 ++-- .../deser/jdk/JDKAtomicTypesDeserTest.java | 6 +- .../deser/jdk/JDKCollectionsDeserTest.java | 2 +- .../deser/jdk/JDKNumberDeserTest.java | 8 +- .../deser/jdk/JDKScalarsDeserTest.java | 12 +- .../deser/jdk/JDKStringLikeTypeDeserTest.java | 26 ++-- .../deser/jdk/MapDeserializationTest.java | 28 ++--- .../deser/jdk/MapDeserializerCachingTest.java | 2 +- .../deser/jdk/MapKeyDeserializationTest.java | 2 +- .../deser/jdk/MapRelatedTypesDeserTest.java | 4 +- .../jdk/MapWithGenericValuesDeserTest.java | 4 +- .../deser/jdk/UntypedDeserializationTest.java | 18 +-- .../deser/jdk/UtilCollectionsTypesTest.java | 6 +- .../databind/deser/merge/ArrayMergeTest.java | 4 +- .../databind/deser/merge/MapMergeTest.java | 6 +- .../merge/MapPolymorphicMerge2336Test.java | 4 +- .../deser/merge/MergeWithNullTest.java | 4 +- .../databind/deser/merge/NodeMergeTest.java | 2 +- .../deser/merge/PropertyMergeTest.java | 6 +- .../databind/deser/merge/UpdateValueTest.java | 2 +- .../deser/validate/FullStreamReadTest.java | 8 +- .../databind/exc/BasicExceptionTest.java | 4 +- .../databind/exc/DeserExceptionTypeTest.java | 4 +- .../databind/exc/ExceptionPathTest.java | 2 +- .../exc/ExceptionSerializationTest.java | 2 +- .../databind/ext/DOMTypeReadWriteTest.java | 4 +- .../ext/SqlBlobSerializationTest.java | 2 +- .../ext/SqlDateDeserializationTest.java | 2 +- .../ext/SqlDateSerializationTest.java | 6 +- .../ext/SqlTimestampDeserializationTest.java | 2 +- .../format/CollectionFormatShapeTest.java | 8 +- .../databind/format/EnumFormatShapeTest.java | 4 +- .../databind/format/MapEntryFormatTest.java | 8 +- .../databind/format/MapFormatShapeTest.java | 18 +-- .../databind/interop/TestExternalizable.java | 32 ++--- .../databind/interop/TestFormatDetection.java | 6 +- .../databind/interop/TestJDKProxy.java | 10 +- .../interop/UntypedObjectWithDupsTest.java | 2 +- .../AccessorNamingForBuilderTest.java | 2 +- .../AccessorNamingStrategyTest.java | 8 +- .../introspect/BeanDescriptionTest.java | 4 +- .../databind/introspect/BeanNamingTest.java | 2 +- .../IgnoredCreatorProperty1572Test.java | 2 +- .../introspect/IntrospectorPairTest.java | 8 +- .../introspect/IsGetterRenaming2527Test.java | 8 +- .../POJOPropertiesCollectorTest.java | 38 +++--- .../introspect/PropertyMetadataTest.java | 4 +- .../introspect/SetterConflictTest.java | 4 +- .../introspect/TestAnnotationBundles.java | 10 +- .../introspect/TestAnnotationMerging.java | 8 +- .../introspect/TestBuilderMethods.java | 2 +- .../introspect/TestInferredMutators.java | 4 +- .../TestJacksonAnnotationIntrospector.java | 4 +- .../introspect/TestNameConflicts.java | 16 +-- .../introspect/TestNamingStrategyCustom.java | 20 +-- .../introspect/TestPropertyConflicts.java | 10 +- .../introspect/TestPropertyRename.java | 14 +-- .../TestScalaLikeImplicitProperties.java | 2 +- .../databind/introspect/TransientTest.java | 2 +- .../VisibilityForSerializationTest.java | 2 +- .../databind/jsonschema/NewSchemaTest.java | 10 +- .../jsonschema/TestGenerateJsonSchema.java | 22 ++-- .../jsontype/ExistingPropertyTest.java | 60 ++++----- .../databind/jsontype/Generic1128Test.java | 4 +- .../jsontype/GenericNestedType2331Test.java | 4 +- .../jsontype/GenericTypeId1735Test.java | 2 +- .../JsonTypeInfoCaseInsensitive1983Test.java | 2 +- .../JsonTypeInfoCustomResolver2811Test.java | 16 +-- .../databind/jsontype/NoTypeInfoTest.java | 2 +- .../PolymorphicDeserErrorHandlingTest.java | 2 +- .../jsontype/PolymorphicList1451SerTest.java | 2 +- .../jsontype/PolymorphicViaRefTypeTest.java | 2 +- .../jsontype/SubTypeResolutionTest.java | 2 +- .../jsontype/TestAbstractTypeNames.java | 4 +- .../jsontype/TestCustomTypeIdResolver.java | 12 +- .../TestGenericListSerialization.java | 6 +- .../jsontype/TestOverlappingTypeIdNames.java | 2 +- .../TestPolymorphicWithDefaultImpl.java | 4 +- .../TestPolymorphicWithDefaultImpl1565.java | 2 +- .../jsontype/TestPropertyTypeInfo.java | 14 +-- .../databind/jsontype/TestSubtypes.java | 2 +- .../databind/jsontype/TestTypeNames.java | 6 +- .../jsontype/TestTypedDeserialization.java | 14 +-- .../jsontype/TestTypedSerialization.java | 16 +-- .../databind/jsontype/TestVisibleTypeId.java | 22 ++-- .../databind/jsontype/TestWithGenerics.java | 34 ++--- .../databind/jsontype/TypeResolverTest.java | 2 +- .../DefaultTypeResolverForLong2753Test.java | 2 +- .../DefaultWithBaseType1093Test.java | 2 +- .../deftyping/TestDefaultForArrays.java | 8 +- .../deftyping/TestDefaultForEnums.java | 8 +- .../deftyping/TestDefaultForLists.java | 8 +- .../deftyping/TestDefaultForMaps.java | 8 +- .../deftyping/TestDefaultForObject.java | 22 ++-- .../deftyping/TestDefaultWithCreators.java | 4 +- .../ext/ExternalTypeCustomResolverTest.java | 106 ++++++++-------- .../jsontype/ext/ExternalTypeId2588Test.java | 26 ++-- .../jsontype/ext/ExternalTypeId96Test.java | 4 +- .../jsontype/ext/ExternalTypeIdTest.java | 44 +++---- .../ext/ExternalTypeIdWithCreatorTest.java | 2 +- .../ext/ExternalTypeIdWithEnum1328Test.java | 12 +- .../jsontype/ext/JsonValueExtTypeIdTest.java | 10 +- .../ext/MultipleExternalIds291Test.java | 2 +- ...btypesExternalPropertyMissingProperty.java | 2 +- ...btypesExternalPropertyMissingProperty.java | 2 +- .../jdk/AbstractContainerTypingTest.java | 14 +-- .../databind/jsontype/jdk/EnumTypingTest.java | 8 +- .../jsontype/jdk/ScalarTypingTest.java | 10 +- .../jsontype/jdk/TypedArrayDeserTest.java | 14 +-- .../jsontype/jdk/TypedArraySerTest.java | 8 +- .../jsontype/jdk/TypedContainerSerTest.java | 2 +- .../AnnotatedPolymorphicValidationTest.java | 6 +- .../databind/jsontype/vld/BasicPTVTest.java | 16 +-- .../jsontype/vld/BasicPTVWithArraysTest.java | 4 +- .../jsontype/vld/CustomPTVMatchersTest.java | 2 +- .../vld/ValidatePolymBaseTypeTest.java | 2 +- .../vld/ValidatePolymSubTypeTest.java | 14 +-- .../misc/CaseInsensitiveDeser953Test.java | 10 +- .../misc/CaseInsensitiveDeserTest.java | 6 +- .../databind/misc/ParsingContext2525Test.java | 10 +- .../databind/misc/RaceCondition738Test.java | 6 +- .../jackson/databind/misc/TestJSONP.java | 2 +- .../mixins/MixinsWithBundlesTest.java | 2 +- .../databind/mixins/TestMixinInheritance.java | 4 +- .../databind/mixins/TestMixinMerging.java | 2 +- .../databind/mixins/TestMixinSerForClass.java | 2 +- .../mixins/TestMixinSerForFields.java | 2 +- .../mixins/TestMixinSerForMethods.java | 2 +- .../mixins/TestMixinSerWithViews.java | 14 +-- .../module/SimpleModuleArgCheckTest.java | 2 +- .../databind/module/SimpleModuleTest.java | 18 +-- .../databind/module/TestAbstractTypes.java | 2 +- .../module/TestCustomEnumKeyDeserializer.java | 4 +- .../module/TestDuplicateRegistration.java | 2 +- .../databind/module/TestKeyDeserializers.java | 4 +- .../databind/module/TestTypeModifiers.java | 12 +- .../jackson/databind/node/ArrayNodeTest.java | 16 +-- .../databind/node/EmptyContentAsTreeTest.java | 4 +- .../databind/node/JsonPointerAtNodeTest.java | 8 +- .../databind/node/NodeContext2049Test.java | 30 ++--- .../databind/node/NodeFeaturesTest.java | 4 +- .../node/NodeJDKSerializationTest.java | 2 +- .../jackson/databind/node/NodeTestBase.java | 6 +- .../databind/node/NumberNodesTest.java | 12 +- .../jackson/databind/node/ObjectNodeTest.java | 30 ++--- .../jackson/databind/node/POJONodeTest.java | 2 +- .../databind/node/RequiredAccessorTest.java | 2 +- .../databind/node/TestConversions.java | 26 ++-- .../jackson/databind/node/TestDeepCopy.java | 8 +- .../databind/node/TestFindMethods.java | 2 +- .../jackson/databind/node/TestJsonNode.java | 16 +-- .../jackson/databind/node/TestNullNode.java | 12 +- .../node/TestTreeTraversingParser.java | 10 +- .../databind/node/TestTreeWithType.java | 4 +- .../jackson/databind/node/TextNodeTest.java | 10 +- .../databind/node/ToStringForNodesTest.java | 2 +- .../databind/node/TreeReadViaMapperTest.java | 10 +- .../objectid/AbstractWithObjectIdTest.java | 2 +- .../objectid/AlwaysAsReferenceFirstTest.java | 4 +- .../objectid/JSOGDeserialize622Test.java | 8 +- .../databind/objectid/ObjectId687Test.java | 2 +- .../databind/objectid/ObjectId825BTest.java | 2 +- .../databind/objectid/ObjectId825Test.java | 2 +- .../objectid/ObjectIdWithCreator1261Test.java | 4 +- .../ObjectIdWithInjectables538Test.java | 4 +- .../objectid/ReferentialWithObjectIdTest.java | 4 +- .../databind/objectid/TestObjectId.java | 24 ++-- .../objectid/TestObjectIdDeserialization.java | 24 ++-- .../objectid/TestObjectIdSerialization.java | 34 ++--- .../objectid/TestObjectIdWithEquals.java | 6 +- .../objectid/TestObjectIdWithPolymorphic.java | 22 ++-- .../databind/seq/ReadRecoveryTest.java | 4 +- .../jackson/databind/seq/ReadValuesTest.java | 14 +-- .../databind/seq/SequenceWriterTest.java | 10 +- .../jackson/databind/ser/AnyGetterTest.java | 14 +-- .../ser/BeanSerializerModifierTest.java | 34 ++--- .../databind/ser/CyclicTypeSerTest.java | 2 +- .../databind/ser/EnumAsMapKeyTest.java | 14 +-- .../databind/ser/FieldSerializationTest.java | 6 +- .../ser/GenericTypeSerializationTest.java | 20 +-- .../ser/JsonValueSerializationTest.java | 34 ++--- .../jackson/databind/ser/RawValueTest.java | 8 +- .../ser/SerializationFeaturesTest.java | 10 +- .../jackson/databind/ser/TestAnnotations.java | 10 +- .../databind/ser/TestArraySerialization.java | 6 +- .../databind/ser/TestAutoDetectForSer.java | 2 +- .../jackson/databind/ser/TestConfig.java | 14 +-- .../databind/ser/TestCustomSerializers.java | 10 +- .../jackson/databind/ser/TestEmptyClass.java | 10 +- .../jackson/databind/ser/TestIterable.java | 10 +- .../databind/ser/TestJsonSerialize.java | 8 +- .../databind/ser/TestJsonSerialize2.java | 26 ++-- .../databind/ser/TestJsonSerialize3.java | 4 +- .../databind/ser/TestJsonSerializeAs.java | 2 +- .../jackson/databind/ser/TestRootType.java | 14 +-- .../databind/ser/TestSerializerProvider.java | 2 +- .../jackson/databind/ser/TestSimpleTypes.java | 6 +- .../ser/TestTypedRootValueSerialization.java | 8 +- .../databind/ser/TestVirtualProperties.java | 2 +- .../ser/filter/CurrentObject3160Test.java | 2 +- .../ser/filter/IgnorePropsForSerTest.java | 10 +- .../databind/ser/filter/JsonFilterTest.java | 12 +- .../ser/filter/JsonIncludeArrayTest.java | 2 +- .../ser/filter/JsonIncludeCustomTest.java | 6 +- .../databind/ser/filter/JsonIncludeTest.java | 16 +-- .../ser/filter/MapInclusion2573Test.java | 4 +- .../ser/filter/NullSerializationTest.java | 8 +- .../filter/SerializationIgnore3357Test.java | 2 +- .../databind/ser/filter/TestIgnoredTypes.java | 8 +- .../databind/ser/filter/TestMapFiltering.java | 14 +-- .../filter/TestSimpleSerializationIgnore.java | 2 +- .../ser/jdk/AtomicTypeSerializationTest.java | 2 +- .../ser/jdk/CollectionSerializationTest.java | 6 +- .../ser/jdk/DateSerializationTest.java | 10 +- .../ser/jdk/EnumSerializationTest.java | 10 +- .../ser/jdk/JDKTypeSerializationTest.java | 4 +- .../ser/jdk/MapKeyAnnotationsTest.java | 6 +- .../ser/jdk/MapKeySerializationTest.java | 4 +- .../ser/jdk/MapSerializationTest.java | 12 +- .../databind/ser/jdk/NumberSerTest.java | 4 +- .../ser/jdk/UUIDSerializationTest.java | 6 +- .../ser/jdk/UntypedSerializationTest.java | 24 ++-- .../struct/FormatFeatureAcceptSingleTest.java | 8 +- .../struct/FormatFeatureUnwrapSingleTest.java | 4 +- .../struct/SingleValueAsArrayTest.java | 2 +- .../struct/TestBackRefsWithPolymorphic.java | 2 +- .../databind/struct/TestPOJOAsArray.java | 6 +- .../struct/TestPOJOAsArrayAdvanced.java | 2 +- .../struct/TestPOJOAsArrayWithBuilder.java | 6 +- .../struct/TestParentChildReferences.java | 54 ++++---- .../databind/struct/TestUnwrapped.java | 6 +- .../struct/TestUnwrappedWithPrefix.java | 16 +-- .../struct/TestUnwrappedWithSameName647.java | 2 +- .../struct/TestUnwrappedWithTypeInfo.java | 2 +- .../struct/UnwrapSingleArrayScalarsTest.java | 38 +++--- .../struct/UnwrappedCreatorParam265Test.java | 6 +- .../databind/testutil/BrokenStringWriter.java | 4 +- .../jackson/databind/testutil/MediaItem.java | 18 +-- .../testutil/NoCheckSubTypeValidator.java | 2 +- .../jackson/databind/type/LocalTypeTest.java | 8 +- .../databind/type/NestedTypes1604Test.java | 2 +- .../databind/type/PolymorphicList036Test.java | 12 +- .../databind/type/RecursiveTypeTest.java | 6 +- .../databind/type/TestAnnotatedClass.java | 6 +- .../type/TestGenericFieldInSubtype.java | 2 +- .../databind/type/TestGenericsBounded.java | 8 +- .../jackson/databind/type/TestJavaType.java | 18 +-- .../databind/type/TestTypeBindings.java | 6 +- .../databind/type/TestTypeFactory.java | 30 ++--- .../databind/type/TestTypeFactory1604.java | 2 +- .../databind/type/TestTypeFactory3108.java | 2 +- .../type/TestTypeFactoryWithClassLoader.java | 2 +- .../databind/type/TestTypeResolution.java | 6 +- .../databind/type/TypeAliasesTest.java | 4 +- .../databind/util/ArrayBuildersTest.java | 2 +- .../jackson/databind/util/BeanUtilTest.java | 2 +- .../jackson/databind/util/ClassUtilTest.java | 10 +- .../databind/util/ISO8601DateFormatTest.java | 2 +- .../databind/util/ISO8601UtilsTest.java | 2 +- .../databind/util/TestObjectBuffer.java | 2 +- .../databind/util/TestStdDateFormat.java | 4 +- .../databind/util/TokenBufferTest.java | 40 +++--- .../databind/views/DefaultViewTest.java | 2 +- .../views/TestViewDeserialization.java | 16 +-- .../databind/views/TestViewSerialization.java | 10 +- .../views/TestViewsSerialization2.java | 8 +- .../databind/views/ViewsWithSchemaTest.java | 4 +- .../failing/BackReference1516Test.java | 4 +- .../failing/BuilderWithBackRef2686Test.java | 6 +- .../CyclicRefViaCollection3069Test.java | 2 +- ...gatingCreatorWithAbstractProp2252Test.java | 2 +- .../ExternalTypeIdWithUnwrapped2039Test.java | 2 +- .../failing/JacksonInject2678Test.java | 2 +- .../jackson/failing/JsonSetter2572Test.java | 2 +- .../jackson/failing/KevinFail1410Test.java | 2 +- .../failing/ObjectIdWithBuilder1496Test.java | 6 +- .../ParsingContextExtTypeId2747Test.java | 12 +- .../failing/PolymorphicArrays3194Test.java | 10 +- .../failing/SetterlessList2692Test.java | 2 +- .../TestNonStaticInnerClassInList32.java | 4 +- .../failing/TestObjectIdDeserialization.java | 2 +- .../TestObjectIdWithInjectables639.java | 4 +- .../failing/TestSetterlessProperties501.java | 4 +- .../jackson/failing/TestUnwrappedMap171.java | 2 +- .../failing/UnwrappedCaching2461Test.java | 2 +- src/test/java/perf/ManualReadPerfUntyped.java | 8 +- .../perf/ManualReadPerfUntypedReader.java | 4 +- .../perf/ManualReadPerfUntypedStream.java | 4 +- .../java/perf/ManualReadPerfWithMedia.java | 2 +- .../java/perf/ManualReadPerfWithUUID.java | 6 +- .../perf/ManualReadWithTypeResolution.java | 6 +- .../java/perf/ManualWritePerfWithUUID.java | 4 +- src/test/java/perf/MediaItem.java | 18 +-- src/test/java/perf/NopOutputStream.java | 2 +- src/test/java/perf/NopWriter.java | 2 +- src/test/java/perf/ObjectReaderTestBase.java | 32 ++--- src/test/java/perf/ObjectWriterTestBase.java | 12 +- src/test/java/perf/Record.java | 4 +- src/test/java/perf/RecordAsArray.java | 2 +- 422 files changed, 1897 insertions(+), 1897 deletions(-) diff --git a/src/test-jdk14/java/com/fasterxml/jackson/databind/failing/RecordUpdate3079Test.java b/src/test-jdk14/java/com/fasterxml/jackson/databind/failing/RecordUpdate3079Test.java index 7a8aa43a27..00266b8572 100644 --- a/src/test-jdk14/java/com/fasterxml/jackson/databind/failing/RecordUpdate3079Test.java +++ b/src/test-jdk14/java/com/fasterxml/jackson/databind/failing/RecordUpdate3079Test.java @@ -17,7 +17,7 @@ protected IdNameWrapper() { } } private final ObjectMapper MAPPER = newJsonMapper(); - + // [databind#3079]: Should be able to Record value directly public void testDirectRecordUpdate() throws Exception { diff --git a/src/test-jdk14/java/com/fasterxml/jackson/databind/jdk9/Java9ListsTest.java b/src/test-jdk14/java/com/fasterxml/jackson/databind/jdk9/Java9ListsTest.java index e9d954e934..c1046a40ac 100644 --- a/src/test-jdk14/java/com/fasterxml/jackson/databind/jdk9/Java9ListsTest.java +++ b/src/test-jdk14/java/com/fasterxml/jackson/databind/jdk9/Java9ListsTest.java @@ -52,7 +52,7 @@ public void testJava9ListOf() throws Exception actualJson = MAPPER.writeValueAsString(list); output = MAPPER.readValue(actualJson, List.class); assertEquals(3, output.size()); - + list = List.of(); actualJson = MAPPER.writeValueAsString(list); output = MAPPER.readValue(actualJson, List.class); diff --git a/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordNamingStrategy2992Test.java b/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordNamingStrategy2992Test.java index bf4d34990b..f098009748 100644 --- a/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordNamingStrategy2992Test.java +++ b/src/test-jdk14/java/com/fasterxml/jackson/databind/records/RecordNamingStrategy2992Test.java @@ -14,7 +14,7 @@ record Record2992(String myId, String myValue) {} // [databind#2992] public void testRecordRenaming2992() throws Exception - { + { Record2992 src = new Record2992("id", "value"); String json = MAPPER.writeValueAsString(src); assertEquals(a2q("{'my_id':'id','my_value':'value'}"), json); diff --git a/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java b/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java index 76c6559d75..3e0f006e3e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/BaseMapTest.java @@ -18,7 +18,7 @@ public abstract class BaseMapTest extends BaseTest { private final static Object SINGLETON_OBJECT = new Object(); - + /* /********************************************************** /* Shared helper classes @@ -121,7 +121,7 @@ public MapWrapper(K key, V value) { map.put(key, value); } } - + protected static class ArrayWrapper { public T[] array; @@ -130,7 +130,7 @@ public ArrayWrapper(T[] v) { array = v; } } - + /** * Enumeration type with sub-classes per value. */ @@ -153,7 +153,7 @@ public Point(int x0, int y0) { x = x0; y = y0; } - + @Override public boolean equals(Object o) { if (!(o instanceof Point)) { @@ -204,7 +204,7 @@ public String deserialize(JsonParser p, DeserializationContext ctxt) /* Construction /********************************************************** */ - + protected BaseMapTest() { super(); } /* @@ -233,7 +233,7 @@ protected ObjectWriter objectWriter() { protected ObjectReader objectReader() { return sharedMapper().reader(); } - + protected ObjectReader objectReader(Class cls) { return sharedMapper().readerFor(cls); } @@ -297,7 +297,7 @@ protected Map writeAndMap(ObjectMapper m, Object value) String str = m.writeValueAsString(value); return (Map) m.readValue(str, LinkedHashMap.class); } - + protected String serializeAsString(ObjectMapper m, Object value) throws IOException { @@ -331,7 +331,7 @@ protected String asJSONObjectValueString(ObjectMapper m, Object... args) /* Helper methods, deserialization /********************************************************** */ - + protected T readAndMapFromString(String input, Class cls) throws IOException { diff --git a/src/test/java/com/fasterxml/jackson/databind/BaseTest.java b/src/test/java/com/fasterxml/jackson/databind/BaseTest.java index 1ce8518f52..8ff83b1f89 100644 --- a/src/test/java/com/fasterxml/jackson/databind/BaseTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/BaseTest.java @@ -29,7 +29,7 @@ public abstract class BaseTest protected final static int SAMPLE_SPEC_VALUE_TN_ID3 = 234; protected final static int SAMPLE_SPEC_VALUE_TN_ID4 = 38793; - protected final static String SAMPLE_DOC_JSON_SPEC = + protected final static String SAMPLE_DOC_JSON_SPEC = "{\n" +" \"Image\" : {\n" +" \"Width\" : "+SAMPLE_SPEC_VALUE_WIDTH+",\n" @@ -50,7 +50,7 @@ public abstract class BaseTest /* Helper classes (beans) /********************************************************** */ - + /** * Sample class from Jackson tutorial ("JacksonInFiveMinutes") */ @@ -79,7 +79,7 @@ public boolean equals(Object o) if (o == this) return true; if (o == null || o.getClass() != getClass()) return false; Name other = (Name) o; - return _first.equals(other._first) && _last.equals(other._last); + return _first.equals(other._first) && _last.equals(other._last); } } @@ -97,7 +97,7 @@ public FiveMinuteUser(String first, String last, boolean verified, Gender g, byt _gender = g; _userImage = data; } - + public Name getName() { return _name; } public boolean isVerified() { return _isVerified; } public Gender getGender() { return _gender; } @@ -115,7 +115,7 @@ public boolean equals(Object o) if (o == null || o.getClass() != getClass()) return false; FiveMinuteUser other = (FiveMinuteUser) o; if (_isVerified != other._isVerified) return false; - if (_gender != other._gender) return false; + if (_gender != other._gender) return false; if (!_name.equals(other._name)) return false; byte[] otherImage = other._userImage; if (otherImage.length != _userImage.length) return false; @@ -127,7 +127,7 @@ public boolean equals(Object o) return true; } } - + /* /********************************************************** /* High-level helpers @@ -252,7 +252,7 @@ private void verifyIntToken(JsonToken t, boolean requireNumbers) fail("Expected INT or STRING value, got "+t); } } - + protected void verifyFieldName(JsonParser p, String expName) throws IOException { @@ -340,7 +340,7 @@ protected final static T jdkDeserialize(byte[] raw) throw new UncheckedIOException(e); } } - + /* /********************************************************** /* Additional assertion methods diff --git a/src/test/java/com/fasterxml/jackson/databind/MapperViaParserTest.java b/src/test/java/com/fasterxml/jackson/databind/MapperViaParserTest.java index 28d1bc634f..ad2e357009 100644 --- a/src/test/java/com/fasterxml/jackson/databind/MapperViaParserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/MapperViaParserTest.java @@ -17,14 +17,14 @@ public class MapperViaParserTest extends BaseMapTest final static SerializedString TWO_BYTE_ESCAPED_STRING = new SerializedString("&111;"); final static SerializedString THREE_BYTE_ESCAPED_STRING = new SerializedString("&1111;"); - + final static class Pojo { int _x; public void setX(int x) { _x = x; } } - + /* /******************************************************** /* Helper types @@ -46,7 +46,7 @@ public MyEscapes() { _asciiEscapes['b'] = CharacterEscapes.ESCAPE_STANDARD; // too force "\u0062" _asciiEscapes['d'] = CharacterEscapes.ESCAPE_CUSTOM; } - + @Override public int[] getEscapeCodesForAscii() { return _asciiEscapes; @@ -67,7 +67,7 @@ public SerializableString getEscapeSequence(int ch) return null; } } - + /* /******************************************************** /* Unit tests diff --git a/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java b/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java index 2781264860..bcda31b9e3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ObjectMapperTest.java @@ -23,7 +23,7 @@ public class ObjectMapperTest extends BaseMapTest { static class Bean { int value = 3; - + public void setX(int v) { value = v; } protected Bean() { } @@ -289,7 +289,7 @@ public void testProps() public void testConfigForPropertySorting() throws Exception { ObjectMapper m = new ObjectMapper(); - + // sort-alphabetically is disabled by default: assertFalse(m.isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)); SerializationConfig sc = m.getSerializationConfig(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java b/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java index b360573e17..16bd6349bd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java @@ -180,7 +180,7 @@ public void testFeatureSettings() throws Exception ObjectReader r = MAPPER.reader(); assertFalse(r.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); assertFalse(r.isEnabled(JsonParser.Feature.IGNORE_UNDEFINED)); - + r = r.withoutFeatures(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); assertFalse(r.isEnabled(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES)); @@ -368,7 +368,7 @@ public void testPointerLoadingMappingIteratorOne() throws Exception { assertFalse(itr.hasNext()); itr.close(); } - + public void testPointerLoadingMappingIteratorMany() throws Exception { final String source = "{\"foo\":{\"bar\":{\"caller\":[{\"name\":{\"value\":1234}}, {\"name\":{\"value\":5678}}]}}}"; @@ -381,7 +381,7 @@ public void testPointerLoadingMappingIteratorMany() throws Exception { assertTrue(pojo.name.containsKey("value")); assertEquals(1234, pojo.name.get("value")); assertTrue(itr.hasNext()); - + pojo = itr.next(); assertNotNull(pojo.name); @@ -418,7 +418,7 @@ public void testPointerWithArrays() throws Exception public static class Pojo1637 { public Set set1; public Set set2; - } + } // [databind#2636] public void testCanPassResultToOverloadedMethod() throws Exception { @@ -437,7 +437,7 @@ void process(String pojo) { // do nothing - just used to show that the compiler can choose the correct method overloading to invoke throw new Error(); } - + /* /********************************************************** /* Test methods, ObjectCodec @@ -498,7 +498,7 @@ public void testMissingType() throws Exception public void testSchema() throws Exception { ObjectReader r = MAPPER.readerFor(String.class); - + // Ok to try to set `null` schema, always: r = r.with((FormatSchema) null); @@ -506,7 +506,7 @@ public void testSchema() throws Exception // but not schema that doesn't match format (no schema exists for json) r = r.with(new BogusSchema()) .readValue(q("foo")); - + fail("Should not pass"); } catch (IllegalArgumentException e) { verifyException(e, "Cannot use FormatSchema"); @@ -548,7 +548,7 @@ public void testCustomObjectNode() throws Exception assertEquals(1, point.x); assertEquals(2, point.y); } - + // [databind#3699]: custom array node classes public void testCustomArrayNode() throws Exception { @@ -570,7 +570,7 @@ static class CustomObjectNode extends BaseJsonNode CustomObjectNode(ObjectNode delegate) { this._delegate = delegate; } - + @Override public boolean isObject() { return true; @@ -580,7 +580,7 @@ public boolean isObject() { public int size() { return _delegate.size(); } - + @Override public Iterator> fields() { return _delegate.fields(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ObjectWriterTest.java b/src/test/java/com/fasterxml/jackson/databind/ObjectWriterTest.java index f7bfb3f168..7a66fb2d5b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ObjectWriterTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ObjectWriterTest.java @@ -26,7 +26,7 @@ static class CloseableValue implements Closeable public int x; public boolean closed; - + @Override public void close() throws IOException { closed = true; @@ -42,14 +42,14 @@ static class PolyBase { @JsonTypeName("A") static class ImplA extends PolyBase { public int value; - + public ImplA(int v) { value = v; } } @JsonTypeName("B") static class ImplB extends PolyBase { public int b; - + public ImplB(int v) { b = v; } } @@ -64,7 +64,7 @@ public void testPrettyPrinter() throws Exception ObjectWriter writer = MAPPER.writer(); HashMap data = new HashMap(); data.put("a", 1); - + // default: no indentation assertEquals("{\"a\":1}", writer.writeValueAsString(data)); @@ -91,7 +91,7 @@ public void testPrefetch() throws Exception public void testObjectWriterFeatures() throws Exception { ObjectWriter writer = MAPPER.writer() - .without(JsonWriteFeature.QUOTE_FIELD_NAMES); + .without(JsonWriteFeature.QUOTE_FIELD_NAMES); Map map = new HashMap(); map.put("a", 1); assertEquals("{a:1}", writer.writeValueAsString(map)); @@ -183,7 +183,7 @@ public void testMiscSettings() throws Exception ObjectWriter newW = w.with(Base64Variants.MODIFIED_FOR_URL); assertNotSame(w, newW); assertSame(newW, newW.with(Base64Variants.MODIFIED_FOR_URL)); - + w = w.withAttributes(Collections.emptyMap()); w = w.withAttribute("a", "b"); assertEquals("b", w.getAttributes().getAttribute("a")); @@ -202,7 +202,7 @@ public void testMiscSettings() throws Exception public void testRootValueSettings() throws Exception { ObjectWriter w = MAPPER.writer(); - + // First, root name: ObjectWriter newW = w.withRootName("foo"); assertNotSame(w, newW); diff --git a/src/test/java/com/fasterxml/jackson/databind/RoundtripTest.java b/src/test/java/com/fasterxml/jackson/databind/RoundtripTest.java index 704c5738a2..d389b6531f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/RoundtripTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/RoundtripTest.java @@ -5,7 +5,7 @@ public class RoundtripTest extends BaseMapTest { private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testMedaItemRoundtrip() throws Exception { MediaItem.Content c = new MediaItem.Content(); @@ -22,7 +22,7 @@ public void testMedaItemRoundtrip() throws Exception c.addPerson("Joe Sixp\u00e2ck"); c.addPerson("Ezekiel"); c.addPerson("Sponge-Bob Squarepant\u00DF"); - + MediaItem input = new MediaItem(c); input.addPhoto(new MediaItem.Photo()); input.addPhoto(new MediaItem.Photo()); diff --git a/src/test/java/com/fasterxml/jackson/databind/TestFormatSchema.java b/src/test/java/com/fasterxml/jackson/databind/TestFormatSchema.java index 59d6050672..64b2ea95b5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestFormatSchema.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestFormatSchema.java @@ -26,7 +26,7 @@ static class MySchema implements FormatSchema { @Override public String getSchemaType() { return "test"; } } - + static class FactoryWithSchema extends JsonFactory { @Override @@ -36,7 +36,7 @@ static class FactoryWithSchema extends JsonFactory public boolean canUseSchema(FormatSchema schema) { return (schema instanceof MySchema); } - + private static final long serialVersionUID = 1L; @Override protected JsonParser _createParser(Reader r, IOContext ctxt) @@ -57,12 +57,12 @@ protected JsonGenerator _createGenerator(Writer out, IOContext ctxt) throws IOEx static class SchemaException extends RuntimeException { public final FormatSchema _schema; - + public SchemaException(FormatSchema s) { _schema = s; } } - + static class ParserWithSchema extends ParserBase { public ParserWithSchema(IOContext ioCtxt, int features) @@ -230,13 +230,13 @@ public int writeBinary(Base64Variant b64variant, InputStream data, int dataLengt return -1; } } - + /* /********************************************************************** /* Unit tests /********************************************************************** */ - + public void testFormatForParsers() throws Exception { ObjectMapper mapper = new ObjectMapper(new FactoryWithSchema()); diff --git a/src/test/java/com/fasterxml/jackson/databind/TestHandlerInstantiation.java b/src/test/java/com/fasterxml/jackson/databind/TestHandlerInstantiation.java index 03bc93b8bd..fa1a642a53 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestHandlerInstantiation.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestHandlerInstantiation.java @@ -44,24 +44,24 @@ static class MyMap extends HashMap { } @JsonTypeIdResolver(TestCustomIdResolver.class) static class TypeIdBean { public int x; - + public TypeIdBean() { } public TypeIdBean(int x) { this.x = x; } } static class TypeIdBeanWrapper { public TypeIdBean bean; - + public TypeIdBeanWrapper() { this(null); } public TypeIdBeanWrapper(TypeIdBean b) { bean = b; } } - + /* /********************************************************************** /* Helper classes, serializers/deserializers/resolvers /********************************************************************** */ - + static class MyBeanDeserializer extends JsonDeserializer { public String _prefix = ""; @@ -69,7 +69,7 @@ static class MyBeanDeserializer extends JsonDeserializer public MyBeanDeserializer(String p) { _prefix = p; } - + @Override public MyBean deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException @@ -81,7 +81,7 @@ public MyBean deserialize(JsonParser jp, DeserializationContext ctxt) static class MyKeyDeserializer extends KeyDeserializer { public MyKeyDeserializer() { } - + @Override public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException @@ -89,7 +89,7 @@ public Object deserializeKey(String key, DeserializationContext ctxt) return "KEY"; } } - + static class MyBeanSerializer extends JsonSerializer { public String _prefix = ""; @@ -97,7 +97,7 @@ static class MyBeanSerializer extends JsonSerializer public MyBeanSerializer(String p) { _prefix = p; } - + @Override public void serialize(MyBean value, JsonGenerator jgen, SerializerProvider provider) throws IOException @@ -105,14 +105,14 @@ public void serialize(MyBean value, JsonGenerator jgen, SerializerProvider provi jgen.writeString(_prefix + value.value); } } - + // copied from "TestCustomTypeIdResolver" static class TestCustomIdResolver extends TypeIdResolverBase { static List initTypes; final String _id; - + public TestCustomIdResolver(String idForBean) { _id = idForBean; } @@ -162,15 +162,15 @@ public String idFromBaseType() { /* Helper classes, handler instantiator /********************************************************************** */ - + static class MyInstantiator extends HandlerInstantiator { private final String _prefix; - + public MyInstantiator(String p) { _prefix = p; } - + @Override public JsonDeserializer deserializerInstance(DeserializationConfig config, Annotated annotated, @@ -190,9 +190,9 @@ public KeyDeserializer keyDeserializerInstance(DeserializationConfig config, return new MyKeyDeserializer(); } return null; - + } - + @Override public JsonSerializer serializerInstance(SerializationConfig config, Annotated annotated, Class serClass) @@ -220,7 +220,7 @@ public TypeResolverBuilder typeResolverBuilderInstance(MapperConfig config return null; } } - + /* /********************************************************************** /* Unit tests @@ -243,7 +243,7 @@ public void testKeyDeserializer() throws Exception // easiest to test by just serializing... assertEquals("{\"KEY\":\"b\"}", mapper.writeValueAsString(map)); } - + public void testSerializer() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/TestJDKSerialization.java b/src/test/java/com/fasterxml/jackson/databind/TestJDKSerialization.java index 7a49eb0f73..9dc674ba6a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestJDKSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestJDKSerialization.java @@ -21,13 +21,13 @@ public class TestJDKSerialization extends BaseMapTest static class MyPojo { public int x; protected int y; - + public MyPojo() { } public MyPojo(int x0, int y0) { x = x0; y = y0; } - + public int getY() { return y; } public void setY(int y) { this.y = y; } } @@ -70,14 +70,14 @@ public Map properties() { * let's create a private copy for this class only. */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testConfigs() throws IOException { byte[] base = jdkSerialize(MAPPER.getDeserializationConfig().getBaseSettings()); assertNotNull(jdkDeserialize(base)); // first things first: underlying BaseSettings - + DeserializationConfig origDC = MAPPER.getDeserializationConfig(); SerializationConfig origSC = MAPPER.getSerializationConfig(); byte[] dcBytes = jdkSerialize(origDC); @@ -138,7 +138,7 @@ public void testObjectWriter() throws IOException ObjectWriter writer2 = jdkDeserialize(bytes); assertEquals(EXP_JSON, writer2.writeValueAsString(p)); } - + public void testObjectReader() throws IOException { ObjectReader origReader = MAPPER.readerFor(MyPojo.class); @@ -148,7 +148,7 @@ public void testObjectReader() throws IOException ObjectReader anyReader = MAPPER.readerFor(AnyBean.class); AnyBean any = anyReader.readValue(JSON); assertEquals(Integer.valueOf(2), any.properties().get("y")); - + byte[] readerBytes = jdkSerialize(origReader); ObjectReader reader2 = jdkDeserialize(readerBytes); MyPojo p2 = reader2.readValue(JSON); diff --git a/src/test/java/com/fasterxml/jackson/databind/TestRootName.java b/src/test/java/com/fasterxml/jackson/databind/TestRootName.java index 6a3355171c..72fd712a49 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestRootName.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestRootName.java @@ -15,7 +15,7 @@ public class TestRootName extends BaseMapTest static class Bean { public int a = 3; } - + @JsonRootName("") static class RootBeanWithEmpty { public int a = 2; diff --git a/src/test/java/com/fasterxml/jackson/databind/TestVersions.java b/src/test/java/com/fasterxml/jackson/databind/TestVersions.java index 8471e4650a..386d45b47a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/TestVersions.java +++ b/src/test/java/com/fasterxml/jackson/databind/TestVersions.java @@ -27,7 +27,7 @@ public void testMapperVersions() /* Helper methods /********************************************************** */ - + private void assertVersion(Versioned vers) { Version v = vers.version(); diff --git a/src/test/java/com/fasterxml/jackson/databind/access/TestAnyGetterAccess.java b/src/test/java/com/fasterxml/jackson/databind/access/TestAnyGetterAccess.java index be141ca3af..009ff448f4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/access/TestAnyGetterAccess.java +++ b/src/test/java/com/fasterxml/jackson/databind/access/TestAnyGetterAccess.java @@ -22,7 +22,7 @@ static class DynaBean { public int id; protected HashMap other = new HashMap(); - + @JsonAnyGetter public Map any() { return other; @@ -52,7 +52,7 @@ public Map getProperties() */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testDynaBean() throws Exception { DynaBean b = new DynaBean(); diff --git a/src/test/java/com/fasterxml/jackson/databind/big/TestBiggerData.java b/src/test/java/com/fasterxml/jackson/databind/big/TestBiggerData.java index d0b3dd62f4..254a0c61fa 100644 --- a/src/test/java/com/fasterxml/jackson/databind/big/TestBiggerData.java +++ b/src/test/java/com/fasterxml/jackson/databind/big/TestBiggerData.java @@ -104,7 +104,7 @@ public void testRoundTrip() throws Exception Citm.class); ObjectWriter w = MAPPER.writerWithDefaultPrettyPrinter(); - + String json1 = w.writeValueAsString(citm); Citm citm2 = MAPPER.readValue(json1, Citm.class); String json2 = w.writeValueAsString(citm2); diff --git a/src/test/java/com/fasterxml/jackson/databind/cfg/DeserializationConfigTest.java b/src/test/java/com/fasterxml/jackson/databind/cfg/DeserializationConfigTest.java index d1ac009390..6a2fcc39e0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/cfg/DeserializationConfigTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/cfg/DeserializationConfigTest.java @@ -47,7 +47,7 @@ public void testBasicFeatures() throws Exception DeserializationConfig newConfig = config.with(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); assertNotSame(config, newConfig); config = newConfig; - + // but another attempt with no real change returns same assertSame(config, config.with(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); assertNotSame(config, config.with(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, false)); @@ -86,7 +86,7 @@ public void testFormatFeatures() throws Exception public void testEnumIndexes() { int max = 0; - + for (DeserializationFeature f : DeserializationFeature.values()) { max = Math.max(max, f.ordinal()); } diff --git a/src/test/java/com/fasterxml/jackson/databind/cfg/SerConfigTest.java b/src/test/java/com/fasterxml/jackson/databind/cfg/SerConfigTest.java index 26942fad62..7831de97ed 100644 --- a/src/test/java/com/fasterxml/jackson/databind/cfg/SerConfigTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/cfg/SerConfigTest.java @@ -34,7 +34,7 @@ public void testSerConfig() throws Exception assertNotSame(config, config.with(SerializationFeature.INDENT_OUTPUT, SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS)); - + assertSame(config, config.withRootName((PropertyName) null)); // defaults to 'none' newConfig = config.withRootName(PropertyName.construct("foobar")); diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithDeser.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithDeser.java index 7c5e7b3696..b4e91fce63 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithDeser.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithDeser.java @@ -11,7 +11,7 @@ public class TestContextAttributeWithDeser extends BaseMapTest { final static String KEY = "foobar"; - + @SuppressWarnings("serial") static class PrefixStringDeserializer extends StdScalarDeserializer { @@ -39,7 +39,7 @@ static class TestPOJO @JsonDeserialize(using=PrefixStringDeserializer.class) public String value; } - + /* /********************************************************** /* Test methods @@ -47,7 +47,7 @@ static class TestPOJO */ final ObjectMapper MAPPER = sharedMapper(); - + public void testSimplePerCall() throws Exception { final String INPUT = a2q("[{'value':'a'},{'value':'b'}]"); diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithSer.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithSer.java index eff9741266..cb160f857d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithSer.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextAttributeWithSer.java @@ -41,7 +41,7 @@ static class TestPOJO public TestPOJO(String str) { value = str; } } - + /* /********************************************************** /* Test methods @@ -49,7 +49,7 @@ static class TestPOJO */ final ObjectMapper MAPPER = sharedMapper(); - + public void testSimplePerCall() throws Exception { final String EXP = a2q("[{'value':'0:a'},{'value':'1:b'}]"); diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java index 3992320478..a0c19077e7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java @@ -31,13 +31,13 @@ public class TestContextualDeserialization extends BaseMapTest public @interface Name { public String value(); } - + static class StringValue { protected String value; - + public StringValue(String v) { value = v; } } - + static class ContextualBean { @Name("NameA") @@ -45,7 +45,7 @@ static class ContextualBean @Name("NameB") public StringValue b; } - + static class ContextualCtorBean { protected String a, b; @@ -68,31 +68,31 @@ static class ContextualClassBean @Name("NameB") public StringValue b; } - + static class ContextualArrayBean { @Name("array") public StringValue[] beans; } - + static class ContextualListBean { @Name("list") public List beans; } - + static class ContextualMapBean { @Name("map") public Map beans; } - + static class MyContextualDeserializer extends JsonDeserializer implements ContextualDeserializer { protected final String _fieldName; - + public MyContextualDeserializer() { this(""); } public MyContextualDeserializer(String fieldName) { _fieldName = fieldName; @@ -121,18 +121,18 @@ static class AnnotatedContextualDeserializer implements ContextualDeserializer { protected final String _fieldName; - + public AnnotatedContextualDeserializer() { this(""); } public AnnotatedContextualDeserializer(String fieldName) { _fieldName = fieldName; } - + @Override public StringValue deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { return new StringValue(""+_fieldName+"="+jp.getText()); } - + @Override public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) @@ -173,7 +173,7 @@ static class GenericBean { @JsonDeserialize(contentUsing=GenericStringDeserializer.class) public Map stuff; } - + /* /********************************************************** /* Unit tests @@ -185,7 +185,7 @@ static class GenericBean { .addDeserializer(StringValue.class, new AnnotatedContextualDeserializer() )) .build(); - + public void testSimple() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -226,7 +226,7 @@ public void testSimpleWithClassAnnotations() throws Exception assertEquals("Class=123", bean.a.value); assertEquals("NameB=345", bean.b.value); } - + public void testAnnotatedCtor() throws Exception { ObjectMapper mapper = _mapperWithAnnotatedContextual(); diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java index 13b40ac8d8..f8ef73b469 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java @@ -28,7 +28,7 @@ static class ContextualKeySerializer implements ContextualSerializer { protected final String _prefix; - + public ContextualKeySerializer() { this(""); } public ContextualKeySerializer(String p) { _prefix = p; @@ -55,10 +55,10 @@ static class ContextualDeser implements ContextualKeyDeserializer { protected final String _prefix; - + protected ContextualDeser(String p) { _prefix = p; - } + } @Override public Object deserializeKey(String key, DeserializationContext ctxt) @@ -78,7 +78,7 @@ public KeyDeserializer createContextual(DeserializationContext ctxt, static class MapBean { public Map map; } - + /* /********************************************************** /* Unit tests, serialization @@ -97,7 +97,7 @@ public void testSimpleKeySer() throws Exception .writeValueAsString(input); assertEquals("{\"prefix:a\":3}", json); } - + /* /********************************************************** /* Unit tests, deserialization diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java index fd6f8ed0fe..873e8fa5a2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java @@ -49,23 +49,23 @@ static class AnnotatedContextualBean public AnnotatedContextualBean(String s) { value = s; } } - + @Prefix("wrappedBean:") static class ContextualBeanWrapper { @Prefix("wrapped:") public ContextualBean wrapped; - + public ContextualBeanWrapper(String s) { wrapped = new ContextualBean(s); } } - + static class ContextualArrayBean { @Prefix("array->") public final String[] beans; - + public ContextualArrayBean(String... strings) { beans = strings; } @@ -76,12 +76,12 @@ static class ContextualArrayElementBean @Prefix("elem->") @JsonSerialize(contentUsing=AnnotatedContextualSerializer.class) public final String[] beans; - + public ContextualArrayElementBean(String... strings) { beans = strings; } } - + static class ContextualListBean { @Prefix("list->") @@ -93,13 +93,13 @@ public ContextualListBean(String... strings) { } } } - + static class ContextualMapBean { @Prefix("map->") public final Map beans = new HashMap(); } - + /** * Another bean that has class annotations that should be visible for * contextualizer, too @@ -111,7 +111,7 @@ static class BeanWithClassConfig public BeanWithClassConfig(String v) { value = v; } } - + /** * Annotation-based contextual serializer that simply prepends piece of text. */ @@ -120,7 +120,7 @@ static class AnnotatedContextualSerializer implements ContextualSerializer { protected final String _prefix; - + public AnnotatedContextualSerializer() { this(""); } public AnnotatedContextualSerializer(String p) { _prefix = p; @@ -188,19 +188,19 @@ static class AccumulatingContextual implements ContextualSerializer { protected String desc; - + public AccumulatingContextual() { this(""); } - + public AccumulatingContextual(String newDesc) { desc = newDesc; } - + @Override public void serialize(String value, JsonGenerator g, SerializerProvider provider) throws IOException { g.writeString(desc+"/"+value); } - + @Override public JsonSerializer createContextual(SerializerProvider prov, BeanProperty property) { @@ -216,7 +216,7 @@ public JsonSerializer createContextual(SerializerProvider prov, BeanProperty /* Unit tests /********************************************************** */ - + // Test to verify that contextual serializer can make use of property // (method, field) annotations. public void testMethodAnnotations() throws Exception @@ -247,7 +247,7 @@ public void testWrappedBean() throws Exception mapper.registerModule(module); assertEquals("{\"wrapped\":{\"value\":\"see:xyz\"}}", mapper.writeValueAsString(new ContextualBeanWrapper("xyz"))); } - + // Serializer should get passed property context even if contained in an array. public void testMethodAnnotationInArray() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java index 24951fe610..f932a4a190 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java @@ -20,10 +20,10 @@ public class TestContextualWithAnnDeserializer extends BaseMapTest public @interface Name { public String value(); } - + static class StringValue { protected String value; - + public StringValue(String v) { value = v; } } @@ -33,13 +33,13 @@ static class AnnotatedContextualClassBean @JsonDeserialize(using=AnnotatedContextualDeserializer.class) public StringValue value; } - + static class AnnotatedContextualDeserializer extends JsonDeserializer implements ContextualDeserializer { protected final String _fieldName; - + public AnnotatedContextualDeserializer() { this(""); } public AnnotatedContextualDeserializer(String fieldName) { _fieldName = fieldName; diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceContainersTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceContainersTest.java index abb0946e24..4ad6d91516 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceContainersTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceContainersTest.java @@ -15,7 +15,7 @@ public class CoerceContainersTest extends BaseMapTest private final ObjectMapper VANILLA_MAPPER = sharedMapper(); private final ObjectMapper COERCING_MAPPER = jsonMapperBuilder() - .withCoercionConfigDefaults(cfg -> + .withCoercionConfigDefaults(cfg -> cfg.setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsEmpty)) .build(); @@ -29,10 +29,10 @@ public void testScalarCollections() throws Exception { final JavaType listType = VANILLA_MAPPER.getTypeFactory() .constructType(new TypeReference>() { }); - + // 03-Aug-2022, tatu: Due to [databind#3418] message changed; not // 100% sure how it should work but let's try this - + // _verifyNoCoercion(listType); try { VANILLA_MAPPER.readerFor(listType).readValue(JSON_EMPTY); @@ -42,7 +42,7 @@ public void testScalarCollections() throws Exception verifyException(e, "Cannot deserialize value of type"); verifyException(e, "from String value"); } - + List result = _readWithCoercion(listType); assertNotNull(result); assertEquals(0, result.size()); @@ -157,7 +157,7 @@ public void testPOJOArray() throws Exception assertNotNull(result); assertEquals(0, result.length); } - + /* /******************************************************** /* Helper methods diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEmptyArrayTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEmptyArrayTest.java index 6c9cf766ee..6eef027c83 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEmptyArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEmptyArrayTest.java @@ -230,13 +230,13 @@ private void _verifyToEmptyCoercion(ObjectReader r, Class cls, Object exp) th fail("Expect value ["+exp+"] for "+cls.getName()+", got: "+result); } } - + private void _verifyFailForEmptyArray(ObjectMapper mapper, Class targetType) throws Exception { _verifyFailForEmptyArray(mapper.readerFor(targetType), targetType); } private void _verifyFailForEmptyArray(ObjectReader r, Class targetType) throws Exception - { + { try { r.forType(targetType).readValue(EMPTY_ARRAY); fail("Should not accept Empty Array for "+targetType.getName()+" by default"); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEnumTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEnumTest.java index 511c7cebfe..409d91cac3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEnumTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceEnumTest.java @@ -26,7 +26,7 @@ protected enum EnumCoerce { private final String JSON_BLANK = q(" "); private final EnumCoerce ENUM_DEFAULT = EnumCoerce.DEFAULT; - + /* /******************************************************** /* Test methods, from empty String @@ -42,7 +42,7 @@ public void testLegacyDefaults() throws Exception public void testEnumFromEmptyGlobalConfig() throws Exception { _testEnumFromEmptyGlobalConfig(CoercionInputShape.EmptyString, JSON_EMPTY, null); } - + public void testEnumFromEmptyLogicalTypeConfig() throws Exception { _testEnumFromEmptyLogicalTypeConfig(CoercionInputShape.EmptyString, JSON_EMPTY, null); } diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceFloatToIntTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceFloatToIntTest.java index f289799f2d..30ab689ee5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceFloatToIntTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceFloatToIntTest.java @@ -43,7 +43,7 @@ public class CoerceFloatToIntTest extends BaseMapTest /* Test methods, defaults (legacy) /******************************************************** */ - + public void testLegacyDoubleToIntCoercion() throws Exception { // by default, should be ok @@ -108,7 +108,7 @@ public void testLegacyFailDoubleToOther() throws Exception /* Test methods, legacy, correct exception type /******************************************************** */ - + // [databind#2804] public void testLegacyFail2804() throws Exception { @@ -141,7 +141,7 @@ private void _testLegacyFail2804(String doc, JavaType targetType, fail("Should get subtype, got: "+ex); } } - + /* /******************************************************** /* Test methods, CoerceConfig, to null diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceJDKScalarsTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceJDKScalarsTest.java index d9d3e581ea..15f9344a9a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceJDKScalarsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceJDKScalarsTest.java @@ -24,9 +24,9 @@ static class BooleanPOJO { static class BooleanWrapper { public Boolean wrapper; public boolean primitive; - + protected Boolean ctor; - + @JsonCreator public BooleanWrapper(@JsonProperty("ctor") Boolean foo) { ctor = foo; diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceMiscScalarsTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceMiscScalarsTest.java index e7a23397ee..8e66469cf9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceMiscScalarsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceMiscScalarsTest.java @@ -104,7 +104,7 @@ public void testScalarEmptyToEmpty() throws Exception { _testScalarEmptyToNull(MAPPER_EMPTY_TO_EMPTY, File.class); _testScalarEmptyToNull(MAPPER_EMPTY_TO_EMPTY, URL.class); - + _testScalarEmptyToEmpty(MAPPER_EMPTY_TO_EMPTY, URI.class, URI.create("")); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceNaNStringToNumberTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceNaNStringToNumberTest.java index 8a46becdee..67783daf4a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceNaNStringToNumberTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceNaNStringToNumberTest.java @@ -31,7 +31,7 @@ static class FloatBean { /* this is needed for backwards-compatibility. /********************************************************************** */ - + public void testDoublePrimitiveNonNumeric() throws Exception { // first, simple case: @@ -67,14 +67,14 @@ public void testDoubleWrapperFromNaNCoercionDisabled() throws Exception Double dv = MAPPER_NO_COERCION.readValue(q(String.valueOf(value)), Double.class); assertTrue(dv.isInfinite()); } - + public void testFloatPrimitiveNonNumeric() throws Exception { // bit tricky with binary fps but... float value = Float.POSITIVE_INFINITY; FloatBean result = MAPPER.readValue("{\"v\":\""+value+"\"}", FloatBean.class); assertEquals(value, result._v); - + // should work with arrays too.. float[] array = MAPPER.readValue("[ \"Infinity\" ]", float[].class); assertNotNull(array); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoercePojosTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoercePojosTest.java index 2ae3314956..4c7acf3197 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoercePojosTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoercePojosTest.java @@ -52,7 +52,7 @@ public void testPOJOFromEmptyGlobalConfig() throws Exception { _testPOJOFromEmptyGlobalConfig(CoercionInputShape.EmptyString, JSON_EMPTY, null); } - + public void testPOJOFromEmptyLogicalTypeConfig() throws Exception { _testPOJOFromEmptyLogicalTypeConfig(CoercionInputShape.EmptyString, JSON_EMPTY, null); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceStringToIntsTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceStringToIntsTest.java index 23a93bd241..b001a78917 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceStringToIntsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceStringToIntsTest.java @@ -42,7 +42,7 @@ public class CoerceStringToIntsTest extends BaseMapTest /* Test methods, defaults (legacy) /******************************************************** */ - + public void testLegacyStringToIntCoercion() throws Exception { // by default, should be ok diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceToBooleanTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceToBooleanTest.java index e26f0904f4..36dc810b70 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/CoerceToBooleanTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/CoerceToBooleanTest.java @@ -34,9 +34,9 @@ static class BooleanPrimitiveBean static class BooleanWrapper { public Boolean wrapper; public boolean primitive; - + protected Boolean ctor; - + @JsonCreator public BooleanWrapper(@JsonProperty("ctor") Boolean foo) { ctor = foo; @@ -180,7 +180,7 @@ private void _verifyStringCoerceFail(ObjectMapper nonCoercingMapper, */ public void testIntToBooleanCoercionSuccessPojo() throws Exception - { + { BooleanPOJO p; final ObjectReader r = DEFAULT_MAPPER.readerFor(BooleanPOJO.class); @@ -196,7 +196,7 @@ public void testIntToBooleanCoercionSuccessPojo() throws Exception } public void testIntToBooleanCoercionSuccessRoot() throws Exception - { + { final ObjectReader br = DEFAULT_MAPPER.readerFor(Boolean.class); assertEquals(Boolean.FALSE, br.readValue(" 0")); @@ -207,7 +207,7 @@ public void testIntToBooleanCoercionSuccessRoot() throws Exception final ObjectReader atomicR = DEFAULT_MAPPER.readerFor(AtomicBoolean.class); AtomicBoolean ab; - + ab = atomicR.readValue(" 0"); ab = atomicR.readValue(utf8Bytes(" 0")); assertEquals(false, ab.get()); @@ -318,7 +318,7 @@ public void testIntToEmptyCoercion() throws Exception p = MAPPER_INT_TO_EMPTY.readValue(DOC_WITH_1, BooleanPOJO.class); assertFalse(p.value); } - + public void testIntToTryCoercion() throws Exception { // And "TryCoerce" should do what would be typically expected @@ -414,7 +414,7 @@ private void _verifyFailFromInteger(ObjectMapper m, Class targetType, String private void _verifyFailFromInteger(ObjectMapper m, Class targetType, String doc, Class valueType) throws Exception - { + { try { m.readerFor(targetType).readValue(doc); fail("Should not accept Integer for "+targetType.getName()+" by default"); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/EmptyStringAsSingleValueTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/EmptyStringAsSingleValueTest.java index e8273e4fa3..5e67441ce4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/EmptyStringAsSingleValueTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/EmptyStringAsSingleValueTest.java @@ -15,7 +15,7 @@ import org.junit.Assert; // [databind#3418]: Coercion from empty String to Collection, with -// `DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY` +// `DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY` public class EmptyStringAsSingleValueTest extends BaseMapTest { static final class StringWrapper { @@ -81,7 +81,7 @@ public void testCoercedEmptyToListWrapper() throws Exception { public void testCoercedListToList() throws Exception { // YES coercion + empty LIST input + StringCollectionDeserializer - assertEquals(Collections.emptyList(), + assertEquals(Collections.emptyList(), COERCION_MAPPER.readValue("[]", new TypeReference>() {})); } diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/ScalarConversionTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/ScalarConversionTest.java index 0157f9783a..12d320414e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/ScalarConversionTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/ScalarConversionTest.java @@ -5,7 +5,7 @@ public class ScalarConversionTest extends BaseMapTest { private final ObjectMapper MAPPER = new ObjectMapper(); - + // [databind#1433] public void testConvertValueNullPrimitive() throws Exception { @@ -18,7 +18,7 @@ public void testConvertValueNullPrimitive() throws Exception assertEquals(Character.valueOf('\0'), MAPPER.convertValue(null, Character.TYPE)); assertEquals(Boolean.FALSE, MAPPER.convertValue(null, Boolean.TYPE)); } - + // [databind#1433] public void testConvertValueNullBoxed() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestArrayConversions.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestArrayConversions.java index b96cbb5119..a466a56a3c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestArrayConversions.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestArrayConversions.java @@ -57,7 +57,7 @@ public void testByteArrayFrom() throws Exception byte[] exp = "sure.".getBytes("Ascii"); verifyIntegralArrays(exp, data, exp.length); } - + public void testShortArrayToX() throws Exception { short[] data = shorts(); @@ -85,10 +85,10 @@ public void testLongArrayToX() throws Exception verifyLongArrayConversion(data, byte[].class); verifyLongArrayConversion(data, short[].class); verifyLongArrayConversion(data, int[].class); - + List expNums = _numberList(data, data.length); List actNums = MAPPER.convertValue(data, new TypeReference>() {}); - assertEquals(expNums, actNums); + assertEquals(expNums, actNums); } public void testOverflows() @@ -133,7 +133,7 @@ public void testOverflows() */ // note: all value need to be within byte range - + private byte[] bytes() { return new byte[] { 1, -1, 0, 98, 127 }; } private short[] shorts() { return new short[] { 1, -1, 0, 98, 127 }; } private int[] ints() { return new int[] { 1, -1, 0, 98, 127 }; } @@ -170,7 +170,7 @@ private void verifyDoubleArrayConversion(double[] data, Class arrayType) T result = _convert(data, arrayType); verifyDoubleArrays(data, result, data.length); } - + private T _convert(Object input, Class outputType) { // must be a primitive array, like "int[].class" @@ -191,7 +191,7 @@ private List _numberList(Object numberArray, int size) } return result; } - + /** * Helper method for checking that given collections contain integral Numbers * that essentially contain same values in same order @@ -204,7 +204,7 @@ private void verifyIntegralArrays(Object inputArray, Object outputArray, int siz double value1 = n1.longValue(); double value2 = n2.longValue(); assertEquals("Entry #"+i+"/"+size+" not equal", value1, value2); - } + } } private void verifyDoubleArrays(Object inputArray, Object outputArray, int size) diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestBeanConversions.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestBeanConversions.java index cdc5f52e18..6e4ff0e15c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestBeanConversions.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestBeanConversions.java @@ -69,12 +69,12 @@ static class Leaf { public Leaf() { } public Leaf(int v) { value = v; } } - + // [databind#288] @JsonSerialize(converter = ConvertingBeanConverter.class) - static class ConvertingBean { - public int x, y; + static class ConvertingBean { + public int x, y; public ConvertingBean(int v1, int v2) { x = v1; y = v2; @@ -97,18 +97,18 @@ public DummyBean convert(ConvertingBean cb) { return new DummyBean(cb.x, cb.y); } } - + @JsonDeserialize(using = NullBeanDeserializer.class) static class NullBean { public static final NullBean NULL_INSTANCE = new NullBean(); } - + static class NullBeanDeserializer extends JsonDeserializer { @Override public NullBean getNullValue(final DeserializationContext context) { return NullBean.NULL_INSTANCE; } - + @Override public NullBean deserialize(final JsonParser parser, final DeserializationContext context) { throw new UnsupportedOperationException(); @@ -120,7 +120,7 @@ public NullBean deserialize(final JsonParser parser, final DeserializationContex /* Test methods /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); public void testBeanConvert() @@ -133,7 +133,7 @@ public void testBeanConvert() // z not included in input, will be whatever default constructor provides assertEquals(-13, point.z); } - + // For [JACKSON-371]; verify that we know property that caused issue... // (note: not optimal place for test, but will have to do for now) public void testErrorReporting() throws Exception @@ -240,7 +240,7 @@ public void testIssue11() throws Exception } catch (IllegalArgumentException e) { verifyException(e, "no properties discovered"); } - + ObjectMapper mapper = new ObjectMapper(); mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); try { @@ -260,13 +260,13 @@ public void testConversionIssue288() throws Exception // must be {"a":2,"b":4} assertEquals("{\"a\":2,\"b\":4}", json); } - + // Test null conversions from [databind#1433] public void testConversionIssue1433() throws Exception { assertNull(MAPPER.convertValue(null, Object.class)); assertNull(MAPPER.convertValue(null, PointZ.class)); - + assertSame(NullBean.NULL_INSTANCE, MAPPER.convertValue(null, NullBean.class)); } diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingDeserializer.java index 5db3bdf532..e7af0ead43 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingDeserializer.java @@ -19,11 +19,11 @@ protected ConvertingBean(int x, int y) { this.y = y; } } - + static class Point { protected int x, y; - + public Point(int v1, int v2) { x = v1; y = v2; @@ -47,7 +47,7 @@ public ConvertingBean convert(int[] values) { return new ConvertingBean(values[0], values[1]); } } - + private static class PointConverter extends StdConverter { @Override public Point convert(int[] value) { @@ -64,7 +64,7 @@ public PointWrapper(int x, int y) { value = new Point(x, y); } } - + static class PointListWrapperArray { @JsonDeserialize(contentConverter=PointConverter.class) public Point[] values; @@ -86,7 +86,7 @@ static class LowerCaser extends StdConverter public String convert(String value) { return value.toLowerCase(); } - + } static class LowerCaseText { @@ -100,7 +100,7 @@ static class LowerCaseTextArray { } // for [databind#795] - + static class ToNumberConverter extends StdConverter { @Override diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingSerializer.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingSerializer.java index 238284fc1b..dea85ede3f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingSerializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestConvertingSerializer.java @@ -35,11 +35,11 @@ public Point(int v1, int v2) { y = v2; } } - + static class ConvertingBeanContainer { public List values; - + public ConvertingBeanContainer(ConvertingBean... beans) { values = Arrays.asList(beans); } @@ -59,7 +59,7 @@ static class PointConverter extends StdConverter return new int[] { value.x, value.y }; } } - + static class PointWrapper { @JsonSerialize(converter=PointConverter.class) public Point value; @@ -86,7 +86,7 @@ public PointListWrapperList(int x, int y) { values = Arrays.asList(new Point[] { new Point(x, y), new Point(y, x) }); } } - + static class PointListWrapperMap { @JsonSerialize(contentConverter=PointConverter.class) public Map values; @@ -213,7 +213,7 @@ public void testConverterForList357() throws Exception { String json = objectWriter().writeValueAsString(new ListWrapper()); assertEquals("{\"list\":[[\"Hello world!\"]]}", json); } - + // [databind#359] public void testIssue359() throws Exception { String json = objectWriter().writeValueAsString(new Bean359()); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestMapConversions.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestMapConversions.java index aabe0eaa37..0208e5a36c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestMapConversions.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestMapConversions.java @@ -20,7 +20,7 @@ static class Bean { } // [Issue#287] - + @JsonSerialize(converter=RequestConverter.class) static class Request { public int x() { @@ -38,7 +38,7 @@ public Map convert(final Request value) { return test; } } - + /* /********************************************************** /* Test methods diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestPolymorphicUpdateValue.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestPolymorphicUpdateValue.java index cee3b8f917..c7f8df329d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestPolymorphicUpdateValue.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestPolymorphicUpdateValue.java @@ -22,8 +22,8 @@ abstract static class Parent { public static class Child extends Parent { public int w; public int h; - } - + } + /* /******************************************************** /* Unit tests diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestStringConversions.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestStringConversions.java index 5f874ce935..2db21e96ff 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestStringConversions.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestStringConversions.java @@ -43,7 +43,7 @@ public void testSimple() Ints.add(1); Ints.add(2); Ints.add(3); - + assertArrayEquals(ints, MAPPER.convertValue(Ints, int[].class)); } @@ -68,7 +68,7 @@ public void testBytesToBase64AndBack() throws Exception byte[] result = MAPPER.convertValue(encoded, byte[].class); assertArrayEquals(input, result); } - + public void testBytestoCharArray() throws Exception { byte[] input = new byte[] { 1, 2, 3, 4, 5, 6, 7 }; diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateViaObjectReader.java b/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateViaObjectReader.java index eba0136a61..c824c78ef3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateViaObjectReader.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/TestUpdateViaObjectReader.java @@ -213,7 +213,7 @@ public void testUpdateSequence() throws Exception assertSame(toUpdate, value); assertEquals(16, value.x); // unchanged assertEquals(37, value.y); - + assertFalse(it.hasNext()); } @@ -225,7 +225,7 @@ public void testUpdatingWithViews() throws Exception bean.str = "test"; Updateable result = MAPPER.readerForUpdating(bean) .withView(TextView.class) - .readValue("{\"num\": 10, \"str\":\"foobar\"}"); + .readValue("{\"num\": 10, \"str\":\"foobar\"}"); assertSame(bean, result); assertEquals(100, bean.num); @@ -267,7 +267,7 @@ public void testIssue744() throws IOException assertEquals(1, dbUpdViaNode.da.i); assertEquals(3, dbUpdViaNode.k); - + mapper.readerForUpdating(dbUpdViaNode).readValue(jsonBNode); assertEquals(5, dbUpdViaNode.da.i); assertEquals(13, dbUpdViaNode.k); diff --git a/src/test/java/com/fasterxml/jackson/databind/convert/UpdateValueTest.java b/src/test/java/com/fasterxml/jackson/databind/convert/UpdateValueTest.java index 39953ba3aa..f935c5248a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/convert/UpdateValueTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/convert/UpdateValueTest.java @@ -24,7 +24,7 @@ public void testMapUpdate() throws Exception Map overrides = new LinkedHashMap<>(); overrides.put("xyz", Boolean.TRUE); overrides.put("foo", "bar"); - + Map ob = MAPPER.updateValue(base, overrides); // first: should return first argument assertSame(base, ob); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/AnySetterTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/AnySetterTest.java index 06ff33e1f6..c7f6b543d3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/AnySetterTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/AnySetterTest.java @@ -72,27 +72,27 @@ void addEntry2(String key, Object value) { } static class Ignored { HashMap map = new HashMap(); - + @JsonIgnore public String bogus; - + @JsonAnySetter void addEntry(String key, Object value) { map.put(key, value); - } + } } static class Bean744 { protected Map additionalProperties; - + @JsonAnySetter public void addAdditionalProperty(String key, Object value) { if (additionalProperties == null) additionalProperties = new HashMap(); additionalProperties.put(key,value); } - + public void setAdditionalProperties(Map additionalProperties) { this.additionalProperties = additionalProperties; } @@ -127,7 +127,7 @@ static abstract class Base { } static class Impl extends Base { public String value; - + public Impl() { } public Impl(String v) { value = v; } } @@ -135,7 +135,7 @@ public Impl() { } static class PolyAnyBean { protected Map props = new HashMap(); - + @JsonAnyGetter public Map props() { return props; @@ -183,11 +183,11 @@ static class MyGeneric { private String staticallyMappedProperty; private Map dynamicallyMappedProperties = new HashMap(); - + public String getStaticallyMappedProperty() { return staticallyMappedProperty; } - + @JsonAnySetter public void addDynamicallyMappedProperty(T key, int value) { dynamicallyMappedProperties.put(key, value); @@ -196,7 +196,7 @@ public void addDynamicallyMappedProperty(T key, int value) { public void setStaticallyMappedProperty(String staticallyMappedProperty) { this.staticallyMappedProperty = staticallyMappedProperty; } - + @JsonAnyGetter public Map getDynamicallyMappedProperties() { return dynamicallyMappedProperties; @@ -230,19 +230,19 @@ static class Bean349 { public String type; public int x, y; - + Map props = new HashMap<>(); - + @JsonAnySetter public void addProperty(String key, Object value) { props.put(key, value); } - + @JsonAnyGetter public Map getProperties() { return props; } - + @JsonUnwrapped public IdentityDTO349 identity; } @@ -258,7 +258,7 @@ static class IdentityDTO349 { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testSimpleMapImitation() throws Exception { MapImitator mapHolder = MAPPER.readValue @@ -342,7 +342,7 @@ public void testPolymorphic() throws Exception input.props.put("a", new Impl("xyz")); String json = MAPPER.writeValueAsString(input); - + // System.err.println("JSON: "+json); PolyAnyBean result = MAPPER.readValue(json, PolyAnyBean.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/CyclicTypesDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/CyclicTypesDeserTest.java index dc46641371..3a7d31b60e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/CyclicTypesDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/CyclicTypesDeserTest.java @@ -50,10 +50,10 @@ static class Selfie405 { @JsonIgnoreProperties({ "parent" }) public Selfie405 parent; - + public Selfie405(int id) { this.id = id; } } - + /* /********************************************************** /* Unit tests @@ -61,7 +61,7 @@ static class Selfie405 { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testLinked() throws Exception { Bean first = MAPPER.readValue @@ -106,7 +106,7 @@ public void testIgnoredCycle() throws Exception } catch (InvalidDefinitionException e) { verifyException(e, "Direct self-reference"); } - + ObjectWriter w = MAPPER.writer() .without(SerializationFeature.FAIL_ON_SELF_REFERENCES); String json = w.writeValueAsString(self1); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/DeserializerFactoryTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/DeserializerFactoryTest.java index 3eb5798155..82c988a734 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/DeserializerFactoryTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/DeserializerFactoryTest.java @@ -25,7 +25,7 @@ public void testJDKScalarDeserializerExistence() throws Exception _verifyIsFound(Calendar.class); _verifyIsFound(GregorianCalendar.class); _verifyIsFound(Date.class); - + // "Untyped" as target is actually undefined: we could choose either way. // It is valid target, which would support inclusion... but it is not actual // final target (but convenient marker) and as such never to be included as diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/IgnoreWithDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/IgnoreWithDeserTest.java index e07203e01f..5854baad10 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/IgnoreWithDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/IgnoreWithDeserTest.java @@ -44,7 +44,7 @@ final static class NoYOrZ */ private final ObjectMapper MAPPER = objectMapper(); - + public void testSimpleIgnore() throws Exception { SizeClassIgnore result = MAPPER.readValue("{ \"x\":1, \"y\" : 2 }", @@ -57,7 +57,7 @@ public void testSimpleIgnore() throws Exception public void testFailOnIgnore() throws Exception { ObjectReader r = MAPPER.readerFor(NoYOrZ.class); - + // First, fine to get "x": NoYOrZ result = r.readValue(a2q("{'x':3}")); assertEquals(3, result.x); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/JacksonTypesDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/JacksonTypesDeserTest.java index 36f2523dd3..c6a41e6dbb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/JacksonTypesDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/JacksonTypesDeserTest.java @@ -107,7 +107,7 @@ public void testTokenBufferWithSequence() throws Exception Map map = MAPPER.readValue(buf.asParser(), Map.class); assertEquals(1, map.size()); assertEquals(Boolean.TRUE, map.get("a")); - + assertEquals(JsonToken.END_ARRAY, jp.nextToken()); assertNull(jp.nextToken()); } @@ -138,7 +138,7 @@ public void testDeeplyNestedObjects() throws Exception } } - private String _createNested(int nesting, String open, String middle, String close) + private String _createNested(int nesting, String open, String middle, String close) { StringBuilder sb = new StringBuilder(2 * nesting); for (int i = 0; i < nesting; ++i) { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/MergePolymorphicTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/MergePolymorphicTest.java index 3cdfde6d91..4a44504b67 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/MergePolymorphicTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/MergePolymorphicTest.java @@ -35,7 +35,7 @@ static class ChildB extends Child { private final ObjectMapper MAPPER = JsonMapper.builder() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .build(); - + public void testPolymorphicNewObject() throws Exception { Root root = MAPPER.readValue("{\"child\": { \"@type\": \"ChildA\", \"name\": \"I'm child A\" }}", Root.class); assertTrue(root.child instanceof ChildA); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/NullHandlingTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/NullHandlingTest.java index b33bcc4c32..2e3f038b5c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/NullHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/NullHandlingTest.java @@ -38,7 +38,7 @@ public Map getAny(){ return this.any; } } - + // [databind#1601] static class RootData { public String name; @@ -86,7 +86,7 @@ enum EnumMapTestEnum { private final ObjectMapper CONTENT_NULL_FAIL_MAPPER = JsonMapper.builder() .defaultSetterInfo(JsonSetter.Value.construct(Nulls.AS_EMPTY, Nulls.FAIL)) .build(); - + /* /********************************************************************** /* Test methods @@ -98,8 +98,8 @@ public void testNull() throws Exception // null doesn't really have a type, fake by assuming Object Object result = MAPPER.readValue(" null", Object.class); assertNull(result); - } - + } + public void testAnySetterNulls() throws Exception { ObjectMapper mapper = new ObjectMapper(); SimpleModule module = new SimpleModule("test", Version.unknownVersion()); @@ -136,7 +136,7 @@ public void testCustomRootNulls() throws Exception String str = mapper.readValue("null", String.class); assertNotNull(str); assertEquals("funny", str); - + // as well as via ObjectReader ObjectReader reader = mapper.readerFor(String.class); str = reader.readValue("null"); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/PropertyAliasTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/PropertyAliasTest.java index 6e3f10b6e3..7a725b3bd5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/PropertyAliasTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/PropertyAliasTest.java @@ -25,7 +25,7 @@ public AliasBean(@JsonProperty("a") @JsonAlias("A") int a) { _a = a; } - + @JsonAlias({ "Xyz" }) public void setXyz(int x) { _xyz = x; @@ -100,7 +100,7 @@ public void testSimpleAliases() throws Exception assertEquals("Foobar", bean.name); assertEquals(3, bean._a); assertEquals(37, bean._xyz); - + // and finally, constructor-backed one bean = MAPPER.readValue(a2q("{'name':'Foobar','A':3,'xyz':37}"), AliasBean.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/ReadOnlyListDeser2118Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/ReadOnlyListDeser2118Test.java index 0fb1e5cb95..a4247e89b1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/ReadOnlyListDeser2118Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/ReadOnlyListDeser2118Test.java @@ -47,7 +47,7 @@ public String toString() { } private final ObjectMapper mapper = newJsonMapper(); - + // [databind#2118] public void testAccessReadOnly() throws Exception { String data ="{\"security_group_rules\": [{\"id\": \"id1\"}]}"; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationUsing.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationUsing.java index 8ef5e3c205..2da8149d72 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationUsing.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestAnnotationUsing.java @@ -30,7 +30,7 @@ public class TestAnnotationUsing @JsonDeserialize(using=ValueDeserializer.class) final static class ValueClass { int _a; - + /* we'll test it by not having default no-arg ctor, and leaving * out single-int-arg ctor (because deserializer would use that too) */ @@ -79,7 +79,7 @@ static class MapKeyBean { @JsonDeserialize(keyUsing=MapKeyDeserializer.class, contentUsing=ValueDeserializer.class) static class MapKeyMap extends HashMap { } - + /* /********************************************************************** /* Deserializers @@ -211,7 +211,7 @@ public void testMapKeyUsing() throws Exception assertEquals(String[].class, en.getKey().getClass()); assertEquals(Boolean.TRUE, en.getValue()); } - + // @since 1.8 public void testRootValueWithCustomKey() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestBasicAnnotations.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestBasicAnnotations.java index 4967a0b473..5e5f5d40f0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestBasicAnnotations.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestBasicAnnotations.java @@ -39,7 +39,7 @@ static class Issue442Bean { @JsonUnwrapped protected IntWrapper w = new IntWrapper(13); } - + final static class SizeClassSetter2 { int _x; @@ -89,7 +89,7 @@ final static class EmptyDummy { } static class AnnoBean { int value = 3; - + @JsonProperty("y") public void setX(int v) { value = v; } } @@ -124,13 +124,13 @@ public int[] deserialize(JsonParser jp, DeserializationContext ctxt) */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testSimpleSetter() throws Exception { SizeClassSetter result = MAPPER.readValue ("{ \"other\":3, \"size\" : 2, \"length\" : -999 }", SizeClassSetter.class); - + assertEquals(3, result._other); assertEquals(2, result._size); assertEquals(-999, result._length); @@ -223,5 +223,5 @@ public void testNoAccessOverrides() throws Exception SimpleBean bean = m.readValue("{\"x\":1,\"y\":2}", SimpleBean.class); assertEquals(1, bean.x); assertEquals(2, bean.y); - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java index e6a274df12..e036db64f6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java @@ -36,13 +36,13 @@ public Bean(String a, String b) { static class ModuleImpl extends SimpleModule { protected BeanDeserializerModifier modifier; - + public ModuleImpl(BeanDeserializerModifier modifier) { super("test", Version.unknownVersion()); this.modifier = modifier; } - + @Override public void setupModule(SetupContext context) { @@ -56,9 +56,9 @@ public void setupModule(SetupContext context) static class RemovingModifier extends BeanDeserializerModifier { private final String _removedProperty; - + public RemovingModifier(String remove) { _removedProperty = remove; } - + @Override public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc, BeanDeserializerBuilder builder) { @@ -66,13 +66,13 @@ public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, return builder; } } - + static class ReplacingModifier extends BeanDeserializerModifier { private final JsonDeserializer _deserializer; - + public ReplacingModifier(JsonDeserializer s) { _deserializer = s; } - + @Override public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer deserializer) { @@ -83,12 +83,12 @@ public JsonDeserializer modifyDeserializer(DeserializationConfig config, static class BogusBeanDeserializer extends JsonDeserializer { private final String a, b; - + public BogusBeanDeserializer(String a, String b) { this.a = a; this.b = b; } - + @Override public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException @@ -116,7 +116,7 @@ public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) { propCount++; return this; - } + } } public class Issue476DeserializerModifier extends BeanDeserializerModifier { @Override @@ -126,18 +126,18 @@ public JsonDeserializer modifyDeserializer(DeserializationConfig config, return new Issue476Deserializer((BeanDeserializer)deserializer); } return super.modifyDeserializer(config, beanDesc, deserializer); - } + } } public class Issue476Module extends SimpleModule { public Issue476Module() { super("Issue476Module", Version.unknownVersion()); } - + @Override public void setupModule(SetupContext context) { context.addBeanDeserializerModifier(new Issue476DeserializerModifier()); - } + } } public static class Issue1912Bean { @@ -228,7 +228,7 @@ public void setupModule(SetupContext context) { // [Issue#121], arrays, collections, maps enum EnumABC { A, B, C; } - + static class ArrayDeserializerModifier extends BeanDeserializerModifier { @Override public JsonDeserializer modifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, @@ -303,7 +303,7 @@ public Object deserializeKey(String key, static class UCStringDeserializer extends StdScalarDeserializer { private final JsonDeserializer _deser; - + public UCStringDeserializer(JsonDeserializer orig) { super(String.class); _deser = orig; @@ -338,7 +338,7 @@ public void testAbstractFailure() throws Exception } catch (InvalidDefinitionException e) { verifyException(e, "cannot construct"); } - } + } public void testPropertyRemoval() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -347,7 +347,7 @@ public void testPropertyRemoval() throws Exception assertEquals("2", bean.b); // and 'a' has its default value: assertEquals("a", bean.a); - } + } public void testDeserializerReplacement() throws Exception { @@ -362,7 +362,7 @@ public void testDeserializerReplacement() throws Exception public void testIssue476() throws Exception { final String JSON = "{\"value1\" : {\"name\" : \"fruit\", \"value\" : \"apple\"}, \"value2\" : {\"name\" : \"color\", \"value\" : \"red\"}}"; - + ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Issue476Module()); mapper.readValue(JSON, Issue476Bean.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestCachingOfDeser.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestCachingOfDeser.java index 9ac9dff1b3..b4e6d68773 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestCachingOfDeser.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestCachingOfDeser.java @@ -55,7 +55,7 @@ public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOE final static String MAP_INPUT = "{\"map\":{\"a\":1}}"; final static String LIST_INPUT = "{\"list\":[1]}"; - + // Ok: first, use custom-annotated instance first, then standard public void testCustomMapCaching1() throws Exception { @@ -69,7 +69,7 @@ public void testCustomMapCaching1() throws Exception assertEquals(Integer.valueOf(100), mapC.map.get("a")); assertEquals(Integer.valueOf(1), mapStd.map.get("a")); } - + // And then standard first, custom next public void testCustomMapCaching2() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestConcurrency.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestConcurrency.java index 66b7cc3ca2..9869da542a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestConcurrency.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestConcurrency.java @@ -22,7 +22,7 @@ static class Bean /* Helper classes /********************************************** */ - + /** * Dummy deserializer used for verifying that partially handled (i.e. not yet * resolved) deserializers are not allowed to be used. @@ -32,7 +32,7 @@ static class CustomBeanDeserializer implements ResolvableDeserializer { protected volatile boolean resolved = false; - + @Override public Bean deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @@ -66,7 +66,7 @@ public void testDeserializerResolution() throws Exception * exact science; plus caching plays a role too */ final String JSON = "{\"value\":42}"; - + for (int i = 0; i < 5; ++i) { final ObjectMapper mapper = new ObjectMapper(); Runnable r = new Runnable() { @@ -86,6 +86,6 @@ public void run() { // note: funny deserializer, mangles data.. :) assertEquals(13, b.value); t.join(); - } + } } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java index faba941ff4..d354fe5979 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java @@ -94,7 +94,7 @@ public CustomBean deserialize(JsonParser p, DeserializationContext ctxt) throws public static class Immutable { protected int x, y; - + public Immutable(int x0, int y0) { x = x0; y = y0; @@ -108,7 +108,7 @@ public static class CustomKey { public int getId() { return id; } } - + public static class Model { protected final Map map; @@ -125,7 +125,7 @@ public Map getMap() { return map; } } - + static class CustomKeySerializer extends JsonSerializer { @Override public void serialize(CustomKey value, JsonGenerator g, SerializerProvider provider) throws IOException { @@ -150,7 +150,7 @@ static class Bean375Wrapper { @Negative public Bean375Outer value; } - + static class Bean375Outer { protected Bean375Inner inner; @@ -167,7 +167,7 @@ static class Bean375OuterDeserializer extends StdDeserializer implements ContextualDeserializer { protected BeanProperty prop; - + protected Bean375OuterDeserializer() { this(null); } protected Bean375OuterDeserializer(BeanProperty p) { super(Bean375Outer.class); @@ -191,7 +191,7 @@ static class Bean375InnerDeserializer extends StdDeserializer implements ContextualDeserializer { protected boolean negative; - + protected Bean375InnerDeserializer() { this(false); } protected Bean375InnerDeserializer(boolean n) { super(Bean375Inner.class); @@ -399,7 +399,7 @@ protected JsonDeserializer newDelegatingInstance(JsonDeserializer newDeleg */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testCustomBeanDeserializer() throws Exception { String json = "{\"beans\":[{\"c\":{\"a\":10,\"b\":20},\"d\":\"hello, tatu\"}]}"; @@ -484,7 +484,7 @@ public Immutable convert(JsonNode root, DeserializationContext ctxt) throws IOEx assertEquals(-10, imm.x); assertEquals(3, imm.y); } - + public void testIssue882() throws Exception { Model original = new Model(Collections.singletonMap(new CustomKey(123), "test")); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestFieldDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestFieldDeserialization.java index d541a088a5..e48f73b65e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestFieldDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestFieldDeserialization.java @@ -66,7 +66,7 @@ public static class OkDupFieldBean @SuppressWarnings("hiding") public int y = 11; } - + abstract static class Abstract { } static class Concrete extends Abstract { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestGenericCollectionDeser.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestGenericCollectionDeser.java index a87670e276..67c147f770 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestGenericCollectionDeser.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestGenericCollectionDeser.java @@ -31,7 +31,7 @@ protected static class BooleanElement { @JsonValue public Boolean value() { return b; } } - + /* /********************************************************** /* Tests for sub-classing diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestGenerics.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestGenerics.java index 62571a2cb3..4e26970538 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestGenerics.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestGenerics.java @@ -76,12 +76,12 @@ public void testGenericWrapper() throws Exception SimpleBean bean = (SimpleBean) contents; assertEquals(13, bean.x); } - + public void testGenericWrapperWithSingleElementArray() throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); - + Wrapper result = mapper.readValue ("[{\"value\": [{ \"x\" : 13 }] }]", new TypeReference>() { }); @@ -115,7 +115,7 @@ public void testMultipleWrappers() throws Exception ("{\"value\": 7}", new TypeReference>() { }); assertEquals(new Wrapper(7L), result3); } - + //[databind#381] public void testMultipleWrappersSingleValueArray() throws Exception { @@ -157,13 +157,13 @@ public void testArrayOfGenericWrappers() throws Exception SimpleBean bean = (SimpleBean) contents; assertEquals(9, bean.x); } - + // [Issue#381] public void testArrayOfGenericWrappersSingleValueArray() throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); - + Wrapper[] result = mapper.readValue ("[ {\"value\": [ { \"x\" : [ 9 ] } ] } ]", new TypeReference[]>() { }); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestOverloaded.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestOverloaded.java index 6c06232238..bdc5dc9391 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestOverloaded.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestOverloaded.java @@ -43,14 +43,14 @@ static class WasNumberBean extends NumberBean { static class Overloaded739 { protected Object _value; - + @JsonProperty public void setValue(String str) { _value = str; } // no annotation, should not be chosen: public void setValue(Object o) { throw new UnsupportedOperationException(); } } - + /** * And then a Bean that is conflicting and should not work */ @@ -68,7 +68,7 @@ public void setA(LinkedList a) { } private final ObjectMapper MAPPER = newJsonMapper(); /** - * It should be ok to overload with specialized + * It should be ok to overload with specialized * version; more specific method should be used. */ public void testSpecialization() throws Exception @@ -103,19 +103,19 @@ public void testConflictResolution() throws Exception assertNotNull(bean); assertEquals("abc", bean._value); } - + /* /************************************************************ /* Unit tests, failures /************************************************************ */ - + /** * For genuine setter conflict, an exception is to be thrown. */ public void testSetterConflict() throws Exception { - try { + try { MAPPER.readValue("{ }", ConflictBean.class); } catch (Exception e) { verifyException(e, "Conflicting setter definitions"); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestSetterlessProperties.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestSetterlessProperties.java index 7e7742502e..9f05f063fd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestSetterlessProperties.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestSetterlessProperties.java @@ -36,7 +36,7 @@ static class Dual @JsonProperty("list") protected List values = new ArrayList(); public Dual() { } - + public List getList() { throw new IllegalStateException("Should not get called"); } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestStatics.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestStatics.java index 3ce2441074..5495496b3d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestStatics.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestStatics.java @@ -16,7 +16,7 @@ static class Bean int _x; public static void setX(int value) { throw new Error("Should NOT call static method"); } - + @JsonProperty("x") public void assignX(int x) { _x = x; } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderAdvancedTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderAdvancedTest.java index 7ea94470b4..7c66d34808 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderAdvancedTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderAdvancedTest.java @@ -27,7 +27,7 @@ static class InjectableBuilderXY @JacksonInject protected String stuff; - + public InjectableBuilderXY withX(int x0) { this.x = x0; return this; @@ -57,7 +57,7 @@ public ExternalBean(Object v) { @JsonSubTypes({ @JsonSubTypes.Type(ValueBean.class) }) static class BaseBean { } - + @JsonTypeName("vbean") static class ValueBean extends BaseBean { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderDeserializationTest2486.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderDeserializationTest2486.java index 733016f2e3..8d2041b993 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderDeserializationTest2486.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderDeserializationTest2486.java @@ -95,7 +95,7 @@ public MyPOJOWithPrimitiveCreator build() { } private final ObjectMapper MAPPER = newJsonMapper(); - + // This test passes when the array based @JsonCreator is removed from the // MyPOJOWithArrayCreator.Builder implementation. The presence of the creator // in the case of arrays breaks deserialize from an object. diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderErrorHandling.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderErrorHandling.java index b246b4b7bf..926269740d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderErrorHandling.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderErrorHandling.java @@ -23,7 +23,7 @@ protected ValueClassXY(int x, int y) { static class SimpleBuilderXY { int x, y; - + public SimpleBuilderXY withX(int x0) { this.x = x0; return this; @@ -186,5 +186,5 @@ public void testFailingValidatingBuilderWithoutExceptionWrappingFromTree() throw } catch (ValidatingValue.ValidationException e) { assertEquals("Missing second", e.getMessage()); } - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderFailTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderFailTest.java index ce7e0675d5..67e56fe93a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderFailTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderFailTest.java @@ -21,7 +21,7 @@ protected ValueClassXY(int x, int y) { static class SimpleBuilderXY { public int x, y; - + public SimpleBuilderXY withX(int x0) { this.x = x0; return this; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderInfiniteLoop1978Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderInfiniteLoop1978Test.java index 0a6a0677e3..8c493c8711 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderInfiniteLoop1978Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderInfiniteLoop1978Test.java @@ -55,13 +55,13 @@ static class SubBuilder { private int element1; private String element2; - + @JsonProperty("el1") public SubBuilder withElement1(int e1) { this.element1 = e1; return this; } - + public SubBean build() { SubBean bean = new SubBean(); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderSimpleTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderSimpleTest.java index 6be58ab166..3e4950a7f7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderSimpleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderSimpleTest.java @@ -30,7 +30,7 @@ protected ValueClassXY(int x, int y) { static class SimpleBuilderXY { public int x, y; - + public SimpleBuilderXY withX(int x0) { this.x = x0; return this; @@ -65,7 +65,7 @@ static class BuildABC { public int a; // to be used as is private int b, c; - + @JsonProperty("b") public BuildABC assignB(int b0) { this.b = b0; @@ -91,10 +91,10 @@ static class ValueImmutable final int value; protected ValueImmutable(int v) { value = v; } } - + static class BuildImmutable { private final int value; - + private BuildImmutable() { this(0); } private BuildImmutable(int v) { value = v; @@ -118,7 +118,7 @@ static class ValueFoo @JsonPOJOBuilder(withPrefix="foo", buildMethodName="construct") static class BuildFoo { private int value; - + public BuildFoo fooValue(int v) { value = v; return this; @@ -139,7 +139,7 @@ interface ValueInterface { interface ValueInterface2 { int getX(); } - + static class ValueInterfaceImpl implements ValueInterface { final int _x; @@ -167,7 +167,7 @@ public int getX() { return _x; } } - + static class ValueInterfaceBuilder { public int x; @@ -278,11 +278,11 @@ static class Value2354 protected Value2354(int v) { value = v; } public int value() { return value; } - + @SuppressWarnings("unused") private static class Value2354Builder { private int value; - + public Value2354Builder withValue(int v) { value = v; return this; @@ -343,7 +343,7 @@ public void testSimpleWithIgnores() throws Exception assertEquals(value._x, 2); assertEquals(value._y, 3); } - + public void testMultiAccess() throws Exception { String json = a2q("{'c':3,'a':2,'b':-9}"); @@ -365,7 +365,7 @@ public void testMultiAccess() throws Exception public void testImmutable() throws Exception { final String json = "{\"value\":13}"; - ValueImmutable value = MAPPER.readValue(json, ValueImmutable.class); + ValueImmutable value = MAPPER.readValue(json, ValueImmutable.class); assertEquals(13, value.value); } @@ -373,12 +373,12 @@ public void testImmutable() throws Exception public void testCustomWith() throws Exception { final String json = "{\"value\":1}"; - ValueFoo value = MAPPER.readValue(json, ValueFoo.class); + ValueFoo value = MAPPER.readValue(json, ValueFoo.class); assertEquals(1, value.value); } // for [databind#761] - + public void testBuilderMethodReturnMoreGeneral() throws Exception { final String json = "{\"x\":1}"; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithCreatorTest.java index e3736ce567..f109555955 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithCreatorTest.java @@ -30,7 +30,7 @@ public PropertyCreatorBuilder(@JsonProperty("a") int a, this.a = a; this.b = b; } - + public PropertyCreatorBuilder withC(int v) { c = v; return this; @@ -41,7 +41,7 @@ public PropertyCreatorValue build() { } // With String - + @JsonDeserialize(builder=StringCreatorBuilder.class) static class StringCreatorValue { @@ -64,7 +64,7 @@ public StringCreatorValue build() { } // With boolean - + @JsonDeserialize(builder=BooleanCreatorBuilder.class) static class BooleanCreatorValue { @@ -85,9 +85,9 @@ public BooleanCreatorValue build() { return new BooleanCreatorValue(value); } } - + // With Int - + @JsonDeserialize(builder=IntCreatorBuilder.class) static class IntCreatorValue { @@ -110,7 +110,7 @@ public IntCreatorValue build() { } // With Double - + @JsonDeserialize(builder=DoubleCreatorBuilder.class) static class DoubleCreatorValue { @@ -143,7 +143,7 @@ public DoubleCreatorValue build() { public void testWithPropertiesCreator() throws Exception { final String json = a2q("{'a':1,'c':3,'b':2}"); - PropertyCreatorValue value = MAPPER.readValue(json, PropertyCreatorValue.class); + PropertyCreatorValue value = MAPPER.readValue(json, PropertyCreatorValue.class); assertEquals(1, value.a); assertEquals(2, value.b); assertEquals(3, value.c); @@ -153,7 +153,7 @@ public void testWithDelegatingStringCreator() throws Exception { final int EXP = 139; IntCreatorValue value = MAPPER.readValue(String.valueOf(EXP), - IntCreatorValue.class); + IntCreatorValue.class); assertEquals(EXP, value.value); } @@ -161,7 +161,7 @@ public void testWithDelegatingIntCreator() throws Exception { final double EXP = -3.75; DoubleCreatorValue value = MAPPER.readValue(String.valueOf(EXP), - DoubleCreatorValue.class); + DoubleCreatorValue.class); assertEquals(EXP, value.value); } @@ -169,7 +169,7 @@ public void testWithDelegatingBooleanCreator() throws Exception { final boolean EXP = true; BooleanCreatorValue value = MAPPER.readValue(String.valueOf(EXP), - BooleanCreatorValue.class); + BooleanCreatorValue.class); assertEquals(EXP, value.value); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithTypeParametersTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithTypeParametersTest.java index 6cd363a248..7e50e89a60 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithTypeParametersTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithTypeParametersTest.java @@ -39,7 +39,7 @@ public List getData() { // 28-Apr-2020, tatu: Note that as per [databind#921] the NAME of // type variable here MUST match that of enclosing class. This has - // no semantic meaning to JDK or javac, but internally + // no semantic meaning to JDK or javac, but internally // `MapperFeature.INFER_BUILDER_TYPE_BINDINGS` relies on this -- but // can not really validate it. So user just has to rely on bit of // black magic to use generic types with builders. @@ -60,7 +60,7 @@ public MyGenericPOJO build() { // 05-Sep-2020, tatu: This is not correct and cannot be made to work -- // assumption is that static method binding `T` would somehow refer to // class type parameter `T`: this is not true. -/* +/* public static class MyGenericPOJOWithCreator { List data; @@ -119,7 +119,7 @@ public void testWithBuilderWithoutInferringBindings() throws Exception { } // 05-Sep-2020, tatu: see above for reason why this can not work -/* +/* public void testWithCreator() throws Exception { final ObjectMapper mapper = new ObjectMapper(); final String json = a2q("{ 'data': [ { 'x': 'x', 'y': 'y' } ] }"); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedSingleArray2608Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedSingleArray2608Test.java index 55e50629f5..471e7b23df 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedSingleArray2608Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedSingleArray2608Test.java @@ -47,7 +47,7 @@ static class POJOValue2608 { public POJOValue2608(String s) { subValue = s; } - + @JsonPOJOBuilder(withPrefix = "") public static class POJOValueBuilder { String v; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedTest.java index 44738f3d0e..3548236275 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/builder/BuilderWithUnwrappedTest.java @@ -187,11 +187,11 @@ final static class Builder { Builder() { } - @JsonProperty("animal_id") + @JsonProperty("animal_id") public void setId(long i) { id = i; } - + @JsonUnwrapped void setName(Name name) { this.name = name; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/BigCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/BigCreatorTest.java index 6a85b3a293..3022073b86 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/BigCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/BigCreatorTest.java @@ -44,7 +44,7 @@ public Biggie( } private final ObjectReader BIGGIE_READER = objectReader(Biggie.class); - + public void testBigPartial() throws Exception { Biggie value = BIGGIE_READER.readValue(a2q( @@ -53,7 +53,7 @@ public void testBigPartial() throws Exception int[] stuff = value.stuff; for (int i = 0; i < stuff.length; ++i) { int exp; - + switch (i) { case 6: // These are off-by-one... case 7: diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/ConstructorDetector1498Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/ConstructorDetector1498Test.java index 847e8baa8a..876b0be85a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/ConstructorDetector1498Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/ConstructorDetector1498Test.java @@ -37,7 +37,7 @@ static class SingleArgNotAnnotated { protected int v; SingleArgNotAnnotated() { v = -1; } - + public SingleArgNotAnnotated(@ImplicitName("value") int value) { v = value; } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/CreatorPropertiesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/CreatorPropertiesTest.java index 0fb32e4657..8e1af20aa8 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/CreatorPropertiesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/CreatorPropertiesTest.java @@ -138,7 +138,7 @@ public void testSkipNonScalar3252() throws Exception " ]\n"), new TypeReference>() {}); -//System.err.println("JsON: "+MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(testData)); +//System.err.println("JsON: "+MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(testData)); assertEquals(3, testData.size()); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/DelegatingExternalProperty1003Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/DelegatingExternalProperty1003Test.java index 37cf964e07..83d723c338 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/DelegatingExternalProperty1003Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/DelegatingExternalProperty1003Test.java @@ -40,7 +40,7 @@ static class Superman implements Hero { public String getName() { return name; } - } + } public void testExtrnalPropertyDelegatingCreator() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/DisablingCreatorsTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/DisablingCreatorsTest.java index d078f58503..02412c58c0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/DisablingCreatorsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/DisablingCreatorsTest.java @@ -21,7 +21,7 @@ public ConflictingCreators(@JsonProperty("foo") String foo, static class NonConflictingCreators { public String _value; - + @JsonCreator(mode=JsonCreator.Mode.DELEGATING) public NonConflictingCreators(String foo) { _value = foo; } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/EnumCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/EnumCreatorTest.java index 23e446c47e..ae7e7db036 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/EnumCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/EnumCreatorTest.java @@ -47,13 +47,13 @@ public static EnumWithBDCreator create(BigDecimal bd) { protected enum TestEnumFromInt { ENUM_A(1), ENUM_B(2), ENUM_C(3); - + private final int id; - + private TestEnumFromInt(int id) { this.id = id; } - + @JsonCreator public static TestEnumFromInt fromId(int id) { for (TestEnumFromInt e: values()) { if (e.id == id) return e; @@ -75,12 +75,12 @@ static enum EnumWithPropertiesModeJsonCreator { TEST1, TEST2, TEST3; - + @JsonGetter("name") public String getName() { return name(); } - + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) public static EnumWithPropertiesModeJsonCreator create(@JsonProperty("name") String name) { return EnumWithPropertiesModeJsonCreator.valueOf(name); @@ -102,12 +102,12 @@ public static EnumWithDelegateModeJsonCreator create(JsonNode json) { return EnumWithDelegateModeJsonCreator.valueOf(json.get("name").asText()); } } - + // [databind#324]: exception from creator method protected enum TestEnum324 { A, B; - + @JsonCreator public static TestEnum324 creator(String arg) { throw new RuntimeException("Foobar!"); } @@ -159,7 +159,7 @@ static Enum929 forValues(@JsonProperty("id") int intProp, static enum MyEnum960 { VALUE, BOGUS; - + @JsonCreator public static MyEnum960 getInstance() { return VALUE; @@ -260,21 +260,21 @@ public void testJsonCreatorPropertiesWithEnum() throws Exception { EnumWithPropertiesModeJsonCreator type1 = MAPPER.readValue("{\"name\":\"TEST1\", \"description\":\"TEST\"}", EnumWithPropertiesModeJsonCreator.class); assertSame(EnumWithPropertiesModeJsonCreator.TEST1, type1); - + EnumWithPropertiesModeJsonCreator type2 = MAPPER.readValue("{\"name\":\"TEST3\", \"description\":\"TEST\"}", EnumWithPropertiesModeJsonCreator.class); assertSame(EnumWithPropertiesModeJsonCreator.TEST3, type2); - + } - + public void testJsonCreatorDelagateWithEnum() throws Exception { final ObjectMapper mapper = new ObjectMapper(); - + EnumWithDelegateModeJsonCreator type1 = mapper.readValue("{\"name\":\"TEST1\", \"description\":\"TEST\"}", EnumWithDelegateModeJsonCreator.class); assertSame(EnumWithDelegateModeJsonCreator.TEST1, type1); - + EnumWithDelegateModeJsonCreator type2 = mapper.readValue("{\"name\":\"TEST3\", \"description\":\"TEST\"}", EnumWithDelegateModeJsonCreator.class); assertSame(EnumWithDelegateModeJsonCreator.TEST3, type2); - + } public void testEnumsFromInts() throws Exception @@ -294,7 +294,7 @@ public void testExceptionFromCreator() throws Exception verifyException(e, "foobar"); } } - + // [databind#745] public void testDeserializerForCreatorWithEnumMaps() throws Exception { @@ -311,7 +311,7 @@ public void testMultiArgEnumCreator() throws Exception Enum929 v = MAPPER.readValue("{\"id\":3,\"name\":\"B\"}", Enum929.class); assertEquals(Enum929.B, v); } - + // for [databind#960] public void testNoArgEnumCreator() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/FactoryAndConstructor2962Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/FactoryAndConstructor2962Test.java index c2ebbe7ae5..7691387240 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/FactoryAndConstructor2962Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/FactoryAndConstructor2962Test.java @@ -33,7 +33,7 @@ static class Json2962 { // [databind#2962] public void testImplicitCtorExplicitFactory() throws Exception { - ExampleDto2962 result = MAPPER.readValue("42", ExampleDto2962.class); + ExampleDto2962 result = MAPPER.readValue("42", ExampleDto2962.class); assertEquals(42, result.version); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/ImplicitNameMatch792Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/ImplicitNameMatch792Test.java index ef7f3ec8d2..dc57980fa0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/ImplicitNameMatch792Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/ImplicitNameMatch792Test.java @@ -23,7 +23,7 @@ public String findImplicitPropertyName(AnnotatedMember member) { return super.findImplicitPropertyName(member); } } - + @JsonPropertyOrder({ "first" ,"second", "other" }) static class Issue792Bean { @@ -36,14 +36,14 @@ public Issue792Bean(@JsonProperty("first") String a, } public String getCtor0() { return value; } - + public int getOther() { return 3; } } static class Bean2 { int x = 3; - + @JsonProperty("stuff") private void setValue(int i) { x = i; } @@ -82,7 +82,7 @@ public String asString() { return String.format("[password='%s',value=%d]", password, value); } } - + /* /********************************************************** /* Test methods @@ -90,7 +90,7 @@ public String asString() { */ private final ObjectMapper MAPPER = sharedMapper(); - + public void testBindingOfImplicitCreatorNames() throws Exception { ObjectMapper m = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/InnerClassCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/InnerClassCreatorTest.java index c844c18fe4..a167b9c130 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/InnerClassCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/InnerClassCreatorTest.java @@ -38,7 +38,7 @@ class InnerSomething1502 { @JsonCreator public InnerSomething1502() {} } - } + } static class Outer1503 { public InnerClass1503 innerClass; @@ -70,7 +70,7 @@ public void testIssue1501() throws Exception verifyException(e, "InnerSomething1501"); verifyException(e, "non-static inner classes like this can only by instantiated using default"); } - } + } public void testIssue1502() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/MultiArgConstructorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/MultiArgConstructorTest.java index 947b55aaf2..c9d63aa457 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/MultiArgConstructorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/MultiArgConstructorTest.java @@ -17,7 +17,7 @@ static class MultiArgCtorBean protected int _a, _b; public int c; - + public MultiArgCtorBean(int a, int b) { _a = a; _b = b; @@ -29,13 +29,13 @@ static class MultiArgCtorBeanWithAnnotations protected int _a, _b; public int c; - + public MultiArgCtorBeanWithAnnotations(int a, @JsonProperty("b2") int b) { _a = a; _b = b; } } - + /* Before JDK8, we won't have parameter names available, so let's * fake it before that... */ @@ -56,11 +56,11 @@ public String findImplicitPropertyName(AnnotatedMember param) { return super.findImplicitPropertyName(param); } } - + /* - /********************************************************************** + /********************************************************************** /* Test methods - /********************************************************************** + /********************************************************************** */ public void testMultiArgVisible() throws Exception @@ -87,7 +87,7 @@ public void testMultiArgWithPartialOverride() throws Exception assertEquals(-99, bean._a); assertEquals(222, bean.c); } - + // but let's also ensure that it is possible to prevent use of that constructor // with different visibility public void testMultiArgNotVisible() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/NamingStrategyViaCreator556Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/NamingStrategyViaCreator556Test.java index 7606e059ea..0d6d4afabb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/NamingStrategyViaCreator556Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/NamingStrategyViaCreator556Test.java @@ -32,13 +32,13 @@ private RenamedFactoryBean(int a, String n, boolean foo) { myAge = a; myName = n; } - + @JsonCreator public static RenamedFactoryBean create(int age, String name) { return new RenamedFactoryBean(age, name, true); } } - + @SuppressWarnings("serial") static class MyParamIntrospector extends JacksonAnnotationIntrospector { @@ -63,7 +63,7 @@ public String findImplicitPropertyName(AnnotatedMember param) { .build(); private final static String CTOR_JSON = a2q("{ 'MyAge' : 42, 'MyName' : 'NotMyRealName' }"); - + public void testRenameViaCtor() throws Exception { RenamingCtorBean bean = MAPPER.readValue(CTOR_JSON, RenamingCtorBean.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/NullValueViaCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/NullValueViaCreatorTest.java index d0eacb4716..6759780134 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/NullValueViaCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/NullValueViaCreatorTest.java @@ -111,5 +111,5 @@ public void testCreatorReturningNull() throws IOException { } catch (ValueInstantiationException e) { verifyException(e, "JSON creator returned null"); } - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/SingleArgCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/SingleArgCreatorTest.java index d688eb3733..54d0675e51 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/SingleArgCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/SingleArgCreatorTest.java @@ -36,7 +36,7 @@ public SingleNamedButStillDelegating(@JsonProperty("foobar") String v) { public String getFoobar() { return "x"; } } - + // For [databind#557] static class StringyBean { @@ -65,9 +65,9 @@ public String getValue() { static class MyParamIntrospector extends JacksonAnnotationIntrospector { private final String name; - + public MyParamIntrospector(String n) { name = n; } - + @Override public String findImplicitPropertyName(AnnotatedMember param) { if (param instanceof AnnotatedParameter) { @@ -122,7 +122,7 @@ public static ExplicitFactoryBeanB valueOf(String str) { static class XY { public int x, y; } - + // [databind#1383] static class SingleArgWithImplicit { protected XY _value; @@ -175,7 +175,7 @@ public void testSingleStringArgWithImplicitName() throws Exception mapper.setAnnotationIntrospector(new MyParamIntrospector("value")); StringyBean bean = mapper.readValue(q("foobar"), StringyBean.class); assertEquals("foobar", bean.getValue()); - } + } // [databind#714] public void testSingleImplicitlyNamedNotDelegating() throws Exception @@ -184,7 +184,7 @@ public void testSingleImplicitlyNamedNotDelegating() throws Exception mapper.setAnnotationIntrospector(new MyParamIntrospector("value")); StringyBeanWithProps bean = mapper.readValue("{\"value\":\"x\"}", StringyBeanWithProps.class); assertEquals("x", bean.getValue()); - } + } // [databind#714] public void testSingleExplicitlyNamedButDelegating() throws Exception @@ -229,6 +229,6 @@ public void testMultipleDoubleCreators3062() throws Exception DecVector3062 vector = new DecVector3062(Arrays.asList(1.0, 2.0, 3.0)); String result = MAPPER.writeValueAsString(vector); DecVector3062 deser = MAPPER.readValue(result, DecVector3062.class); - assertEquals(vector.elems, deser.elems); + assertEquals(vector.elems, deser.elems); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators.java index 7947f74050..78d4ab60a1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators.java @@ -52,7 +52,7 @@ protected BooleanConstructorBean2(boolean b) { this.b = b; } } - + static class DoubleConstructorBean { Double d; // cup? @JsonCreator protected DoubleConstructorBean(Double d) { @@ -166,9 +166,9 @@ static class MultiBean { static class NoArgFactoryBean { public int x; public int y; - + public NoArgFactoryBean(int value) { x = value; } - + @JsonCreator public static NoArgFactoryBean create() { return new NoArgFactoryBean(123); } } @@ -319,7 +319,7 @@ static MapWithFactory createIt(@JsonProperty("b") Boolean b) */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testSimpleConstructor() throws Exception { ConstructorBean bean = MAPPER.readValue("{ \"x\" : 42 }", ConstructorBean.class); @@ -333,7 +333,7 @@ public void testNoArgsFactory() throws Exception assertEquals(13, value.y); assertEquals(123, value.x); } - + public void testSimpleDoubleConstructor() throws Exception { Double exp = Double.valueOf("0.25"); @@ -402,7 +402,7 @@ public void testStringFactoryAlt() throws Exception FromStringBean bean = MAPPER.readValue(q(str), FromStringBean.class); assertEquals(str, bean.value); } - + public void testConstructorCreator() throws Exception { CreatorBean bean = MAPPER.readValue @@ -447,7 +447,7 @@ public void testMultipleCreators() throws Exception bean = MAPPER.readValue("0.25", MultiBean.class); assertEquals(Double.valueOf(0.25), bean.value); } - + /* /********************************************************** /* Test methods, valid cases, deferred, no mixins diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators2.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators2.java index 9b33f3fb40..09d7bc5c10 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators2.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators2.java @@ -43,7 +43,7 @@ static class Primitives protected int x = 3; protected double d = -0.5; protected boolean b = true; - + @JsonCreator public Primitives(@JsonProperty("x") int x, @JsonProperty("d") double d, @@ -54,7 +54,7 @@ public Primitives(@JsonProperty("x") int x, this.b = b; } } - + protected static class Test431Container { protected final List items; @@ -62,7 +62,7 @@ protected static class Test431Container { public Test431Container(@JsonProperty("items") final List i) { items = i; } - } + } @JsonIgnoreProperties(ignoreUnknown = true) protected static class Item431 { @@ -86,13 +86,13 @@ public BeanFor438(@JsonProperty("name") String s) { static class BrokenCreatorBean { protected String bar; - + @JsonCreator public BrokenCreatorBean(@JsonProperty("bar") String bar1, @JsonProperty("bar") String bar2) { bar = ""+bar1+"/"+bar2; } } - + // For [JACKSON-541]: should not need @JsonCreator if SerializationFeature.AUTO_DETECT_CREATORS is on. static class AutoDetectConstructorBean { @@ -134,12 +134,12 @@ public static AbstractBase create(Map props) static class AbstractBaseImpl extends AbstractBase { protected Map props; - + public AbstractBaseImpl(Map props) { this.props = props; } } - + static interface Issue700Set extends java.util.Set { } static class Issue700Bean @@ -229,7 +229,7 @@ public void testJackson431() throws Exception "{\"items\":\n" +"[{\"bar\": 0,\n" +"\"id\": \"id123\",\n" - +"\"foo\": 1\n" + +"\"foo\": 1\n" +"}]}", Test431Container.class); assertNotNull(foo); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators3.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators3.java index eb57520e2e..3d9b73a718 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators3.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreators3.java @@ -64,7 +64,7 @@ public long getP() { static class MultiCtor { protected String _a, _b; - + private MultiCtor() { } private MultiCtor(String a, String b, Boolean c) { if (c == null) { @@ -98,7 +98,7 @@ public String findImplicitPropertyName(AnnotatedMember param) { return super.findImplicitPropertyName(param); } } - + // [databind#1853] public static class Product1853 { String name; @@ -132,7 +132,7 @@ public String getName(){ */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testCreator541() throws Exception { ObjectMapper mapper = jsonMapperBuilder() diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsDelegating.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsDelegating.java index b4cbfc71ff..eb369d79a3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsDelegating.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsDelegating.java @@ -19,7 +19,7 @@ static class BooleanBean protected Boolean value; public BooleanBean(Boolean v) { value = v; } - + @JsonCreator protected static BooleanBean create(Boolean value) { return new BooleanBean(value); @@ -31,7 +31,7 @@ static class IntegerBean protected Integer value; public IntegerBean(Integer v) { value = v; } - + @JsonCreator protected static IntegerBean create(Integer value) { return new IntegerBean(value); @@ -43,7 +43,7 @@ static class LongBean protected Long value; public LongBean(Long v) { value = v; } - + @JsonCreator protected static LongBean create(Long value) { return new LongBean(value); @@ -54,7 +54,7 @@ static class CtorBean711 { protected String name; protected int age; - + @JsonCreator public CtorBean711(@JacksonInject String n, int a) { @@ -68,13 +68,13 @@ static class FactoryBean711 protected String name1; protected String name2; protected int age; - + private FactoryBean711(int a, String n1, String n2) { age = a; name1 = n1; name2 = n2; } - + @JsonCreator public static FactoryBean711 create(@JacksonInject String n1, int a, @JacksonInject String n2) { return new FactoryBean711(a, n1, n2); @@ -88,7 +88,7 @@ static class Value592 protected Value592(Object ob, boolean bogus) { stuff = ob; } - + @JsonCreator public static Value592 from(TokenBuffer buffer) { return new Value592(buffer, false); @@ -98,7 +98,7 @@ public static Value592 from(TokenBuffer buffer) { static class MapBean { protected Map map; - + @JsonCreator public MapBean(Map map) { this.map = map; @@ -234,7 +234,7 @@ public void testIssue465() throws Exception Map map = MAPPER.readValue(JSON, Map.class); assertEquals(1, map.size()); assertEquals(Integer.valueOf(12), map.get("A")); - + MapBean bean = MAPPER.readValue(JSON, MapBean.class); assertEquals(1, bean.map.size()); assertEquals(Long.valueOf(12L), bean.map.get("A")); @@ -244,7 +244,7 @@ public void testIssue465() throws Exception map = MAPPER.readValue(EMPTY_JSON, Map.class); assertEquals(0, map.size()); - + bean = MAPPER.readValue(EMPTY_JSON, MapBean.class); assertEquals(0, bean.map.size()); } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsWithIdentity.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsWithIdentity.java index 386802ad8a..4fb260de47 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsWithIdentity.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCreatorsWithIdentity.java @@ -15,10 +15,10 @@ public class TestCreatorsWithIdentity extends BaseMapTest public static class Parent { @JsonProperty("id") String id; - + @JsonProperty String parentProp; - + @JsonCreator public Parent(@JsonProperty("parentProp") String parentProp) { this.parentProp = parentProp; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCustomValueInstDefaults.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCustomValueInstDefaults.java index 5d54ced0e6..d3bfce9de4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCustomValueInstDefaults.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestCustomValueInstDefaults.java @@ -345,7 +345,7 @@ public Object createFromObjectWith(DeserializationContext ctxt, SettableBeanProp } // [databind#1432] - + public static class ClassWith32Module extends SimpleModule { public ClassWith32Module() { super("test", Version.unknownVersion()); @@ -372,7 +372,7 @@ public ValueInstantiator findValueInstantiator(DeserializationConfig config, /* Test methods /********************************************************** */ - + // When all values are in the source, no defaults should be used. public void testAllPresent() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicCreators.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicCreators.java index 16c953f092..2560dba437 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicCreators.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicCreators.java @@ -83,7 +83,7 @@ protected One(String opt) { return 1; } } - + /* /********************************************************** /* Actual tests @@ -91,7 +91,7 @@ protected One(String opt) { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + /** * Simple test to verify that it is possible to implement polymorphic * deserialization manually. diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicDelegating.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicDelegating.java index 656e6eb9bb..d4dad22d95 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicDelegating.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestPolymorphicDelegating.java @@ -6,7 +6,7 @@ public class TestPolymorphicDelegating extends BaseMapTest { // For [databind#580] - + @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) static abstract class Issue580Base { } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestValueInstantiator.java b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestValueInstantiator.java index 7408c3bf6d..7552880e2e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestValueInstantiator.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/creators/TestValueInstantiator.java @@ -61,9 +61,9 @@ public String getValueTypeDesc() { @Override public boolean canCreateUsingDelegate() { return false; } } - + static abstract class PolymorphicBeanBase { } - + static class PolymorphicBean extends PolymorphicBeanBase { public String name; @@ -82,14 +82,14 @@ public MyMap(String name) { put(name, name); } } - + static class MyBeanInstantiator extends InstantiatorBase { @Override public String getValueTypeDesc() { return MyBean.class.getName(); } - + @Override public boolean canCreateUsingDefault() { return true; } @@ -110,10 +110,10 @@ static class PolymorphicBeanInstantiator extends InstantiatorBase public String getValueTypeDesc() { return Object.class.getName(); } - + @Override public boolean canCreateFromObjectWith() { return true; } - + @Override public CreatorProperty[] getFromObjectArguments(DeserializationConfig config) { return new CreatorProperty[] { @@ -133,14 +133,14 @@ public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) { } } } - + static class CreatorMapInstantiator extends InstantiatorBase { @Override public String getValueTypeDesc() { return MyMap.class.getName(); } - + @Override public boolean canCreateFromObjectWith() { return true; } @@ -158,14 +158,14 @@ public Object createFromObjectWith(DeserializationContext ctxt, Object[] args) { return new MyMap((String) args[0]); } } - + static class MyDelegateBeanInstantiator extends ValueInstantiator.Base { public MyDelegateBeanInstantiator() { super(Object.class); } @Override public String getValueTypeDesc() { return "xxx"; } - + @Override public boolean canCreateUsingDelegate() { return true; } @@ -173,20 +173,20 @@ static class MyDelegateBeanInstantiator extends ValueInstantiator.Base public JavaType getDelegateType(DeserializationConfig config) { return config.constructType(Object.class); } - + @Override public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) { return new MyBean(""+delegate, true); } } - + static class MyListInstantiator extends InstantiatorBase { @Override public String getValueTypeDesc() { return MyList.class.getName(); } - + @Override public boolean canCreateUsingDefault() { return true; } @@ -202,7 +202,7 @@ static class MyDelegateListInstantiator extends ValueInstantiator.Base @Override public String getValueTypeDesc() { return "xxx"; } - + @Override public boolean canCreateUsingDelegate() { return true; } @@ -210,7 +210,7 @@ static class MyDelegateListInstantiator extends ValueInstantiator.Base public JavaType getDelegateType(DeserializationConfig config) { return config.constructType(Object.class); } - + @Override public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) { MyList list = new MyList(true); @@ -218,14 +218,14 @@ public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) return list; } } - + static class MyMapInstantiator extends InstantiatorBase { @Override public String getValueTypeDesc() { return MyMap.class.getName(); } - + @Override public boolean canCreateUsingDefault() { return true; } @@ -241,7 +241,7 @@ static class MyDelegateMapInstantiator extends ValueInstantiator.Base @Override public String getValueTypeDesc() { return "xxx"; } - + @Override public boolean canCreateUsingDelegate() { return true; } @@ -249,7 +249,7 @@ static class MyDelegateMapInstantiator extends ValueInstantiator.Base public JavaType getDelegateType(DeserializationConfig config) { return TypeFactory.defaultInstance().constructType(Object.class); } - + @Override public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) { MyMap map = new MyMap(true); @@ -262,7 +262,7 @@ public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) static class AnnotatedBean { protected final String a; protected final int b; - + public AnnotatedBean(String a, int b) { this.a = a; this.b = b; @@ -275,7 +275,7 @@ static class AnnotatedBeanInstantiator extends InstantiatorBase public String getValueTypeDesc() { return AnnotatedBean.class.getName(); } - + @Override public boolean canCreateUsingDefault() { return true; } @@ -309,7 +309,7 @@ static class AnnotatedBeanDelegatingInstantiator extends InstantiatorBase public String getValueTypeDesc() { return AnnotatedBeanDelegating.class.getName(); } - + @Override public boolean canCreateUsingDelegate() { return true; } @@ -322,7 +322,7 @@ public JavaType getDelegateType(DeserializationConfig config) { public AnnotatedWithParams getDelegateCreator() { return null; } - + @Override public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException { return new AnnotatedBeanDelegating(delegate, false); @@ -336,7 +336,7 @@ public Object createUsingDelegate(DeserializationContext ctxt, Object delegate) */ private final ObjectMapper MAPPER = objectMapper(); - + public void testCustomBeanInstantiator() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -365,7 +365,7 @@ public void testCustomMapInstantiator() throws Exception assertEquals(MyMap.class, result.getClass()); assertEquals(1, result.size()); } - + /* /********************************************************** /* Unit tests for delegate creators @@ -390,7 +390,7 @@ public void testDelegateListInstantiator() throws Exception assertEquals(1, result.size()); assertEquals(Integer.valueOf(123), result.get(0)); } - + public void testDelegateMapInstantiator() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -423,7 +423,7 @@ public void testPropertyBasedBeanInstantiator() throws Exception new InstantiatorBase() { @Override public boolean canCreateFromObjectWith() { return true; } - + @Override public CreatorProperty[] getFromObjectArguments(DeserializationConfig config) { return new CreatorProperty[] { @@ -467,7 +467,7 @@ public void testBeanFromString() throws Exception new InstantiatorBase() { @Override public boolean canCreateFromString() { return true; } - + @Override public Object createFromString(DeserializationContext ctxt, String value) { return new MysteryBean(value); @@ -485,7 +485,7 @@ public void testBeanFromInt() throws Exception new InstantiatorBase() { @Override public boolean canCreateFromInt() { return true; } - + @Override public Object createFromInt(DeserializationContext ctxt, int value) { return new MysteryBean(value+1); @@ -503,7 +503,7 @@ public void testBeanFromLong() throws Exception new InstantiatorBase() { @Override public boolean canCreateFromLong() { return true; } - + @Override public Object createFromLong(DeserializationContext ctxt, long value) { return new MysteryBean(value+1L); @@ -539,7 +539,7 @@ public void testBeanFromBoolean() throws Exception new InstantiatorBase() { @Override public boolean canCreateFromBoolean() { return true; } - + @Override public Object createFromBoolean(DeserializationContext ctxt, boolean value) { return new MysteryBean(Boolean.valueOf(value)); @@ -549,7 +549,7 @@ public Object createFromBoolean(DeserializationContext ctxt, boolean value) { assertNotNull(result); assertEquals(Boolean.TRUE, result.value); } - + /* /********************************************************** /* Other tests diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/dos/DeepJsonNodeDeser3397Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/dos/DeepJsonNodeDeser3397Test.java index d65c8e6af6..3a27aace8d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/dos/DeepJsonNodeDeser3397Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/dos/DeepJsonNodeDeser3397Test.java @@ -27,7 +27,7 @@ public void testTreeWithObject() throws Exception JsonNode n = MAPPER.readTree(doc); assertTrue(n.isObject()); } - + private String _nestedDoc(int nesting, String open, String close) { StringBuilder sb = new StringBuilder(nesting * (open.length() + close.length())); for (int i = 0; i < nesting; ++i) { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/dos/HugeIntegerCoerceTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/dos/HugeIntegerCoerceTest.java index 769bb6ce75..8ead1fbdb8 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/dos/HugeIntegerCoerceTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/dos/HugeIntegerCoerceTest.java @@ -18,7 +18,7 @@ public class HugeIntegerCoerceTest extends BaseMapTest } BIG_POS_INTEGER = sb.toString(); } - + public void testMaliciousLongForEnum() throws Exception { JsonFactory f = JsonFactory.builder() @@ -28,7 +28,7 @@ public void testMaliciousLongForEnum() throws Exception // Note: due to [jackson-core#488], fix verified with streaming over multiple // parser types. Here we focus on databind-level - + try { /*ABC value =*/ mapper.readValue(BIG_POS_INTEGER, ABC.class); fail("Should not pass"); @@ -36,5 +36,5 @@ public void testMaliciousLongForEnum() throws Exception verifyException(e, "out of range of int"); verifyException(e, "Integer with "+BIG_NUM_LEN+" digits"); } - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDefaultReadTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDefaultReadTest.java index 28705ca267..6bab1432a4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDefaultReadTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDefaultReadTest.java @@ -19,17 +19,17 @@ enum SimpleEnumWithDefault { ZERO, ONE; } - + enum CustomEnum { ZERO(0), ONE(1); - + private final int number; - + CustomEnum(final int number) { this.number = number; } - + @JsonValue int getNumber() { return this.number; @@ -40,13 +40,13 @@ enum CustomEnumWithDefault { @JsonEnumDefaultValue ZERO(0), ONE(1); - + private final int number; - + CustomEnumWithDefault(final int number) { this.number = number; } - + @JsonValue int getNumber() { return this.number; @@ -195,13 +195,13 @@ public void testWithFailOnNumbersAndReadUnknownAsDefault() _verifyOkDeserialization(r, "0", CustomEnumWithDefault.class, CustomEnumWithDefault.ZERO); _verifyOkDeserialization(r, "1", CustomEnumWithDefault.class, CustomEnumWithDefault.ONE); - // + // // The three tests below fail; Jackson throws an exception on the basis that // "FAIL_ON_NUMBERS_FOR_ENUMS" is enabled. I claim the default value should be returned instead. _verifyOkDeserialization(r, "0", SimpleEnumWithDefault.class, SimpleEnumWithDefault.ZERO); _verifyOkDeserialization(r, "1", SimpleEnumWithDefault.class, SimpleEnumWithDefault.ZERO); _verifyOkDeserialization(r, "2", SimpleEnumWithDefault.class, SimpleEnumWithDefault.ZERO); - + // Fails. Jackson throws an exception on the basis that "FAIL_ON_NUMBERS_FOR_ENUMS" // is enabled, but the default value should have been returned instead. _verifyOkDeserialization(r, "2", CustomEnumWithDefault.class, CustomEnumWithDefault.ZERO); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserialization3369Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserialization3369Test.java index 2ccefa975d..35f8387894 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserialization3369Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserialization3369Test.java @@ -63,7 +63,7 @@ public void testReadEnums3369() throws Exception data = R.readValue("{\"value\" : [\"a\"], \"person\" : \"Jeff\", \"age\" : 30}"); _verify3369(data, null); - data = R.readValue("{\"value\" : {\"a\":{}}, \"person\" : \"Jeff\", \"age\": 30}"); + data = R.readValue("{\"value\" : {\"a\":{}}, \"person\" : \"Jeff\", \"age\": 30}"); _verify3369(data, null); } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserializationTest.java index 65c5560d4a..394a56d838 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumDeserializationTest.java @@ -213,7 +213,7 @@ private Enum2309(String value) { public String toString() { return value; } - } + } // [databind#3006] enum Operation3006 { @@ -290,7 +290,7 @@ public void testComplexEnum() throws Exception TimeUnit result = MAPPER.readValue(json, TimeUnit.class); assertSame(TimeUnit.SECONDS, result); } - + /** * Testing to see that annotation override works */ @@ -409,7 +409,7 @@ public void testAllowUnknownEnumValuesForEnumSets() throws Exception .readValue("[\"NO-SUCH-VALUE\"]"); assertEquals(0, result.size()); } - + public void testAllowUnknownEnumValuesAsMapKeysReadAsNull() throws Exception { ObjectReader reader = MAPPER.reader(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL); @@ -417,7 +417,7 @@ public void testAllowUnknownEnumValuesAsMapKeysReadAsNull() throws Exception .readValue("{\"map\":{\"NO-SUCH-VALUE\":\"val\"}}"); assertTrue(result.map.containsKey(null)); } - + public void testDoNotAllowUnknownEnumValuesAsMapKeysWhenReadAsNullDisabled() throws Exception { assertFalse(MAPPER.isEnabled(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL)); @@ -456,7 +456,7 @@ public void testUnwrappedEnum() throws Exception { .with(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS) .readValue("[" + q("JACKSON") + "]")); } - + public void testUnwrappedEnumException() throws Exception { final ObjectMapper mapper = newJsonMapper(); mapper.disable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); @@ -529,7 +529,7 @@ public void testDeserWithToString1161() throws Exception .readValue(q("A")); assertSame(Enum1161.A, result); } - + public void testEnumWithDefaultAnnotation() throws Exception { final ObjectMapper mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumMapDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumMapDeserializationTest.java index b03d12ecfa..1833e13307 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumMapDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/enums/EnumMapDeserializationTest.java @@ -19,9 +19,9 @@ enum TestEnum { JACKSON, RULES, OK; } enum TestEnumWithDefault { JACKSON, RULES, @JsonEnumDefaultValue - OK; + OK; } - + protected enum LowerCaseEnum { A, B, C; private LowerCaseEnum() { } @@ -29,13 +29,13 @@ private LowerCaseEnum() { } public String toString() { return name().toLowerCase(); } } - static class MySimpleEnumMap extends EnumMap { + static class MySimpleEnumMap extends EnumMap { public MySimpleEnumMap() { super(TestEnum.class); } } - static class FromStringEnumMap extends EnumMap { + static class FromStringEnumMap extends EnumMap { @JsonCreator public FromStringEnumMap(String value) { super(TestEnum.class); @@ -43,7 +43,7 @@ public FromStringEnumMap(String value) { } } - static class FromDelegateEnumMap extends EnumMap { + static class FromDelegateEnumMap extends EnumMap { @JsonCreator public FromDelegateEnumMap(Map stuff) { super(TestEnum.class); @@ -51,7 +51,7 @@ public FromDelegateEnumMap(Map stuff) { } } - static class FromPropertiesEnumMap extends EnumMap { + static class FromPropertiesEnumMap extends EnumMap { int a0, b0; @JsonCreator @@ -140,21 +140,21 @@ public void testToStringEnumMaps() throws Exception public void testCustomEnumMapWithDefaultCtor() throws Exception { MySimpleEnumMap map = MAPPER.readValue(a2q("{'RULES':'waves'}"), - MySimpleEnumMap.class); + MySimpleEnumMap.class); assertEquals(1, map.size()); assertEquals("waves", map.get(TestEnum.RULES)); } public void testCustomEnumMapFromString() throws Exception { - FromStringEnumMap map = MAPPER.readValue(q("kewl"), FromStringEnumMap.class); + FromStringEnumMap map = MAPPER.readValue(q("kewl"), FromStringEnumMap.class); assertEquals(1, map.size()); assertEquals("kewl", map.get(TestEnum.JACKSON)); } public void testCustomEnumMapWithDelegate() throws Exception { - FromDelegateEnumMap map = MAPPER.readValue(a2q("{'foo':'bar'}"), FromDelegateEnumMap.class); + FromDelegateEnumMap map = MAPPER.readValue(a2q("{'foo':'bar'}"), FromDelegateEnumMap.class); assertEquals(1, map.size()); assertEquals("{foo=bar}", map.get(TestEnum.OK)); } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnorePropertyOnDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnorePropertyOnDeserTest.java index 7df8f8c82c..29afe958b2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnorePropertyOnDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnorePropertyOnDeserTest.java @@ -16,7 +16,7 @@ public class IgnorePropertyOnDeserTest extends BaseMapTest @JsonIgnoreProperties({ "userId" }) static class User { public String firstName; - Integer userId; + Integer userId; public Integer getUserId() { return userId; @@ -118,7 +118,7 @@ public void testIgnoreOnProperty1217() throws Exception TestIgnoreObject.class); assertEquals(1, result1.obj.x); assertEquals(30, result1.obj.y); - + assertEquals(20, result1.obj2.x); assertEquals(2, result1.obj2.y); } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnoreUnknownPropertyUsingPropertyBasedTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnoreUnknownPropertyUsingPropertyBasedTest.java index f345da8d90..6bc6798779 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnoreUnknownPropertyUsingPropertyBasedTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/IgnoreUnknownPropertyUsingPropertyBasedTest.java @@ -44,7 +44,7 @@ public Map getProperties() { static class IgnoreUnknownUnwrapped { int a, b; - + @JsonCreator public IgnoreUnknownUnwrapped(@JsonProperty("a") int a, @JsonProperty("b") int b) { this.a = a; @@ -58,7 +58,7 @@ static class UnwrappedChild { public int x, y; } } - + public void testAnySetterWithFailOnUnknownDisabled() throws Exception { IgnoreUnknownAnySetter value = MAPPER.readValue("{\"a\":1, \"b\":2, \"x\":3, \"y\": 4}", IgnoreUnknownAnySetter.class); assertNotNull(value); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForContentTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForContentTest.java index 6b43908828..afb56aa737 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForContentTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForContentTest.java @@ -77,7 +77,7 @@ public void testFailOnNullFromDefaults() throws Exception assertEquals(String.class, e.getTargetType()); } } - + public void testFailOnNullWithCollections() throws Exception { TypeReference>> typeRef = new TypeReference>>() { }; @@ -90,7 +90,7 @@ public void testFailOnNullWithCollections() throws Exception assertNull(result.nullsOk.get(0)); // and then see that nulls are not ok for non-nullable. - + // List final String JSON = a2q("{'noNulls':[null]}"); try { @@ -232,8 +232,8 @@ public void testNullsAsEmptyUsingDefaults() throws Exception result = mapper.readValue(JSON, listType); assertEquals(1, result.values.size()); assertEquals(Integer.valueOf(0), result.values.get(0)); - } - + } + public void testNullsAsEmptyWithArrays() throws Exception { // Note: skip `Object[]`, no default empty value at this point @@ -276,13 +276,13 @@ public void testNullsAsEmptyWithPrimitiveArrays() throws Exception assertEquals(false, result.values[0]); } } - + public void testNullsAsEmptyWithMaps() throws Exception { // Then: Map final String MAP_JSON = a2q("{'values':{'A':null}}"); { - NullContentAsEmpty> result + NullContentAsEmpty> result = MAPPER.readValue(MAP_JSON, new TypeReference>>() { }); assertEquals(1, result.values.size()); assertEquals("A", result.values.entrySet().iterator().next().getKey()); @@ -291,7 +291,7 @@ public void testNullsAsEmptyWithMaps() throws Exception // Then: EnumMap { - NullContentAsEmpty> result + NullContentAsEmpty> result = MAPPER.readValue(MAP_JSON, new TypeReference>>() { }); assertEquals(1, result.values.size()); assertEquals(ABC.A, result.values.entrySet().iterator().next().getKey()); @@ -322,7 +322,7 @@ public void testNullsSkipUsingDefaults() throws Exception .setSetterInfo(JsonSetter.Value.forContentNulls(Nulls.SKIP)); result = mapper.readValue(JSON, listType); assertEquals(0, result.values.size()); - } + } // Test to verify that per-property setting overrides defaults: public void testNullsSkipWithOverrides() throws Exception @@ -342,7 +342,7 @@ public void testNullsSkipWithOverrides() throws Exception .setSetterInfo(JsonSetter.Value.forContentNulls(Nulls.FAIL)); result = mapper.readValue(JSON, listType); assertEquals(0, result.values.size()); - } + } public void testNullsSkipWithCollections() throws Exception { @@ -420,13 +420,13 @@ public void testNullsSkipWithPrimitiveArrays() throws Exception assertEquals(true, result.values[1]); } } - + public void testNullsSkipWithMaps() throws Exception { // Then: Map final String MAP_JSON = a2q("{'values':{'A':'foo','B':null,'C':'bar'}}"); { - NullContentSkip> result + NullContentSkip> result = MAPPER.readValue(MAP_JSON, new TypeReference>>() { }); assertEquals(2, result.values.size()); assertEquals("foo", result.values.get("A")); @@ -435,7 +435,7 @@ public void testNullsSkipWithMaps() throws Exception // Then: EnumMap { - NullContentSkip> result + NullContentSkip> result = MAPPER.readValue(MAP_JSON, new TypeReference>>() { }); assertEquals(2, result.values.size()); assertEquals("foo", result.values.get(ABC.A)); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForEnumsTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForEnumsTest.java index 9926f4aab7..4edefa727a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForEnumsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsForEnumsTest.java @@ -73,7 +73,7 @@ public void testEnumMapNullsAsEmpty() throws Exception /********************************************************** */ - + public void testEnumSetSkipNulls() throws Exception { NullContentSkip> result = MAPPER.readValue(a2q("{'values': [ null ]}"), diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsPojoTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsPojoTest.java index 5a3d70ecd7..290a042eb6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsPojoTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsPojoTest.java @@ -107,7 +107,7 @@ public void testFailOnNullWithDefaults() throws Exception String json = a2q("{'name':null}"); NullsForString def = MAPPER.readValue(json, NullsForString.class); assertNull(def.getName()); - + ObjectMapper mapper = newJsonMapper(); mapper.configOverride(String.class) .setSetterInfo(JsonSetter.Value.forValueNulls(Nulls.FAIL)); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsSkipTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsSkipTest.java index 65039d77b4..8db821d512 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsSkipTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/NullConversionsSkipTest.java @@ -27,7 +27,7 @@ public void setNoNulls(String v) { _noNulls = v; } } - + static class StringValue { String value = "default"; @@ -84,10 +84,10 @@ public void testSkipNullMethod() throws Exception // for [databind#2015] public void testEnumAsNullThenSkip() throws Exception - { + { Pojo2015 p = MAPPER.readerFor(Pojo2015.class) .with(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL) - .readValue("{\"number\":\"THREE\"}"); + .readValue("{\"number\":\"THREE\"}"); assertEquals(NUMS2015.TWO, p.number); } @@ -96,7 +96,7 @@ public void testEnumAsNullThenSkip() throws Exception /* Test methods, defaulting /********************************************************** */ - + public void testSkipNullWithDefaults() throws Exception { String json = a2q("{'value':null}"); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerLocation1440Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerLocation1440Test.java index 78b32ba4ba..e73c83d4c5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerLocation1440Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerLocation1440Test.java @@ -38,7 +38,7 @@ static class DeserializationProblemLogger extends DeserializationProblemHandler public List problems() { return probs.unknownProperties; } - + @Override public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser p, JsonDeserializer deserializer, Object beanOrClass, String propertyName) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerTest.java index 9a5314eec7..d73debae0f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ProblemHandlerTest.java @@ -70,11 +70,11 @@ static class WeirdStringHandler extends DeserializationProblemHandler { protected final Object value; - + public WeirdStringHandler(Object v0) { value = v0; } - + @Override public Object handleWeirdStringValue(DeserializationContext ctxt, Class targetType, String v, @@ -89,7 +89,7 @@ static class InstantiationProblemHandler extends DeserializationProblemHandler { protected final Object value; - + public InstantiationProblemHandler(Object v0) { value = v0; } @@ -150,7 +150,7 @@ static class UnknownTypeIdHandler protected final Class raw; public UnknownTypeIdHandler(Class r) { raw = r; } - + @Override public JavaType handleUnknownTypeId(DeserializationContext ctxt, JavaType baseType, String subTypeId, TypeIdResolver idResolver, @@ -165,9 +165,9 @@ static class MissingTypeIdHandler extends DeserializationProblemHandler { protected final Class raw; - + public MissingTypeIdHandler(Class r) { raw = r; } - + @Override public JavaType handleMissingTypeId(DeserializationContext ctxt, JavaType baseType, TypeIdResolver idResolver, @@ -207,7 +207,7 @@ static class Base2Impl extends Base2 { static class Base2Wrapper { public Base2 value; } - + enum SingleValuedEnum { A; } @@ -312,7 +312,7 @@ public void testMissingClassAsId() throws Exception assertNotNull(w); assertEquals(Base2Impl.class, w.value.getClass()); } - + // verify that by default we get special exception type public void testInvalidTypeIdFail() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ReadOnlyDeser95Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ReadOnlyDeser95Test.java index 2462141945..af8dcffb79 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/ReadOnlyDeser95Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/ReadOnlyDeser95Test.java @@ -12,10 +12,10 @@ public class ReadOnlyDeser95Test extends BaseMapTest static class ReadOnlyBean { public int value = 3; - + public int getComputed() { return 32; } } - + public void testReadOnlyProp() throws Exception { ObjectMapper m = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/filter/TestUnknownPropertyDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/deser/filter/TestUnknownPropertyDeserialization.java index 1d2eccd0cd..fa99780d0f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/filter/TestUnknownPropertyDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/filter/TestUnknownPropertyDeserialization.java @@ -75,7 +75,7 @@ static class IgnoreUnknown { static class IgnoreUnknownAnySetter { Map props = new HashMap<>(); - + @JsonAnySetter public void addProperty(String key, Object value) { props.put(key, value); @@ -89,10 +89,10 @@ public Map getProperties() { @JsonIgnoreProperties(ignoreUnknown=true) static class IgnoreUnknownUnwrapped { - + @JsonUnwrapped UnwrappedChild child; - + static class UnwrappedChild { public int a, b; } @@ -148,7 +148,7 @@ static class Bean987 { private final ObjectMapper MAPPER = newJsonMapper(); final static String JSON_UNKNOWN_FIELD = "{ \"a\" : 1, \"foo\" : [ 1, 2, 3], \"b\" : -1 }"; - + /** * By default we should just get an exception if an unknown property * is encountered @@ -279,7 +279,7 @@ public void testClassWithUnknownAndIgnore() throws Exception // but "d" is not defined, so should still error try { - MAPPER.readValue("{\"a\":1,\"b\":2,\"c\":3,\"d\":4 }", ImplicitIgnores.class); + MAPPER.readValue("{\"a\":1,\"b\":2,\"c\":3,\"d\":4 }", ImplicitIgnores.class); fail("Should not pass"); } catch (MismatchedInputException e) { verifyException(e, "Unrecognized field \"d\""); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMapTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMapTest.java index fed958fe14..871b32d72a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMapTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/impl/BeanPropertyMapTest.java @@ -10,7 +10,7 @@ public class BeanPropertyMapTest extends BaseMapTest { protected final static JavaType BOGUS_TYPE = TypeFactory.unknownType(); - + @SuppressWarnings("serial") static class MyObjectIdReader extends ObjectIdReader { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/inject/InjectableWithoutDeser962Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/inject/InjectableWithoutDeser962Test.java index 00295eb47e..71fbb7108f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/inject/InjectableWithoutDeser962Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/inject/InjectableWithoutDeser962Test.java @@ -23,7 +23,7 @@ public void setA(Integer a) { public void setA(InjectMe a) { this.a = String.valueOf(a); } - + public String getA() { return a; } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/inject/TestInjectables.java b/src/test/java/com/fasterxml/jackson/databind/deser/inject/TestInjectables.java index 20ffa01d2d..c3d326e246 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/inject/TestInjectables.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/inject/TestInjectables.java @@ -14,7 +14,7 @@ static class InjectedBean protected String otherStuff; protected long third; - + public int value; @JacksonInject @@ -26,7 +26,7 @@ public void injectThird(long v) { static class CtorBean { protected String name; protected int age; - + public CtorBean(@JacksonInject String n, @JsonProperty("age") int a) { name = n; @@ -37,7 +37,7 @@ public CtorBean(@JacksonInject String n, @JsonProperty("age") int a) static class CtorBean2 { protected String name; protected Integer age; - + public CtorBean2(@JacksonInject String n, @JacksonInject("number") Integer a) { name = n; @@ -52,7 +52,7 @@ static class TransientBean { public int value; } - + static class Bean471 { protected final Object constructorInjected; @@ -91,7 +91,7 @@ public void setMethodValue(String methodValue) { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testSimple() throws Exception { ObjectMapper mapper = newJsonMapper(); @@ -106,7 +106,7 @@ public void testSimple() throws Exception assertEquals("xyz", bean.otherStuff); assertEquals(37L, bean.third); } - + public void testWithCtors() throws Exception { CtorBean bean = MAPPER.readerFor(CtorBean.class) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/ArrayDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/ArrayDeserializationTest.java index c1f1fef123..bfb39e27b3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/ArrayDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/ArrayDeserializationTest.java @@ -88,7 +88,7 @@ public void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException { } - } + } static class ObjectWrapper { public Object wrapped; @@ -113,15 +113,15 @@ public NonDeserializable[] deserialize(JsonParser jp, DeserializationContext ctx static class NonDeserializable { protected String value; - + public NonDeserializable(String v, boolean bogus) { value = v; } } - static class Product { - public String name; - public List thelist; + static class Product { + public String name; + public List thelist; } static class Things { @@ -141,7 +141,7 @@ static class HiddenBinaryBean890 { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testUntypedArray() throws Exception { @@ -236,8 +236,8 @@ public void testUntypedArrayOfArrays() throws Exception ObjectArrayWrapper aw = MAPPER.readValue("{\"wrapped\":"+JSON+"}", ObjectArrayWrapper.class); assertNotNull(aw); assertNotNull(aw.wrapped); - } - + } + /* /********************************************************** /* Tests for String arrays, char[] @@ -397,7 +397,7 @@ public void testByteArraysWith763() throws Exception assertEquals("b", new String(data[1], "US-ASCII")); assertEquals("c", new String(data[2], "US-ASCII")); } - + public void testShortArray() throws Exception { final int LEN = 31001; // fits in signed 16-bit @@ -556,7 +556,7 @@ public void testBeanArray() /* And special cases for byte array (base64 encoded) /********************************************************** */ - + // for [databind#890] public void testByteArrayTypeOverride890() throws Exception { @@ -566,7 +566,7 @@ public void testByteArrayTypeOverride890() throws Exception assertNotNull(result.someBytes); assertEquals(byte[].class, result.someBytes.getClass()); } - + /* /********************************************************** /* And custom deserializers too @@ -579,7 +579,7 @@ public void testCustomDeserializers() throws Exception SimpleModule testModule = new SimpleModule("test", Version.unknownVersion()); testModule.addDeserializer(NonDeserializable[].class, new CustomNonDeserArrayDeserializer()); mapper.registerModule(testModule); - + NonDeserializable[] result = mapper.readValue("[\"a\"]", NonDeserializable[].class); assertNotNull(result); assertEquals(1, result.length); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CharSequenceDeser3305Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CharSequenceDeser3305Test.java index 8e8316a99a..b280db58fa 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CharSequenceDeser3305Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CharSequenceDeser3305Test.java @@ -45,7 +45,7 @@ public String toString() { private static final String APP_ID = "3074457345618296002"; private final static ObjectMapper MAPPER = newJsonMapper(); - + public void testCharSequenceSerialization() throws Exception { AppId appId = AppId.valueOf(APP_ID); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CollectionDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CollectionDeserTest.java index e57ca9d4f6..0c6caed0ad 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CollectionDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/CollectionDeserTest.java @@ -110,7 +110,7 @@ public CustomException(String s) { */ private final static ObjectMapper MAPPER = newJsonMapper(); - + public void testUntypedList() throws Exception { // to get "untyped" default List, pass Object.class diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZ1153Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZ1153Test.java index c40e6dfdad..036b5bc727 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZ1153Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZ1153Test.java @@ -18,7 +18,7 @@ public void testWithTimezones1153() throws Exception _testWithTimeZone(TimeZone.getTimeZone(tzStr)); } } - + void _testWithTimeZone(TimeZone tz) throws Exception { ObjectReader r = MAPPER.readerFor(Date.class) diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZTest.java index 4ee5e4c726..8393d021fd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTZTest.java @@ -66,7 +66,7 @@ protected void setUp() throws Exception { ObjectMapper m = new ObjectMapper(); m.setTimeZone(TimeZone.getTimeZone(LOCAL_TZ)); MAPPER = m; - + FORMAT.setTimeZone(TimeZone.getTimeZone("UTC")); } @@ -93,16 +93,16 @@ public void testDateUtilISO8601_Timezone() throws Exception // --------------------------------------------------------------------------------------------- // WARNING: - // According to ISO8601, hours and minutes of the offset must be expressed with 2 digits - // (not more, not less), i.e. Z or +hh:mm or -hh:mm. See https://www.w3.org/TR/NOTE-datetime. + // According to ISO8601, hours and minutes of the offset must be expressed with 2 digits + // (not more, not less), i.e. Z or +hh:mm or -hh:mm. See https://www.w3.org/TR/NOTE-datetime. // // The forms below are therefore ILLEGAL and must be refused. // --------------------------------------------------------------------------------------------- - failure( MAPPER, "2000-01-02T03:04:05.678+"); + failure( MAPPER, "2000-01-02T03:04:05.678+"); failure( MAPPER, "2000-01-02T03:04:05.678+1"); - failure( MAPPER, "2000-01-02T03:04:05.678+001"); + failure( MAPPER, "2000-01-02T03:04:05.678+001"); failure( MAPPER, "2000-01-02T03:04:05.678+00:"); failure( MAPPER, "2000-01-02T03:04:05.678+00:001"); failure( MAPPER, "2000-01-02T03:04:05.678+001:001"); @@ -114,8 +114,8 @@ public void testDateUtilISO8601_Timezone() throws Exception /** * Test the millis */ - public void testDateUtilISO8601_DateTimeMillis() throws Exception - { + public void testDateUtilISO8601_DateTimeMillis() throws Exception + { // WITH timezone (from 4 to 0 digits) failure(MAPPER, "2000-01-02T03:04:05.0123456789+01:00"); // at most 9 digits for the millis verify( MAPPER, "2000-01-02T03:04:05.6789+01:00", judate(2000, 1, 2, 3, 4, 5, 678, "GMT+1")); @@ -132,7 +132,7 @@ public void testDateUtilISO8601_DateTimeMillis() throws Exception verify( MAPPER, "2000-01-02T03:04:05.67Z", judate(2000, 1, 2, 3, 4, 5, 670, "UTC")); verify( MAPPER, "2000-01-02T03:04:05.6Z", judate(2000, 1, 2, 3, 4, 5, 600, "UTC")); verify( MAPPER, "2000-01-02T03:04:05Z", judate(2000, 1, 2, 3, 4, 5, 0, "UTC")); - + // WITHOUT timezone (from 4 to 0 digits) failure(MAPPER, "2000-01-02T03:04:05.0123456789"); // at most 9 digits for the millis @@ -141,11 +141,11 @@ public void testDateUtilISO8601_DateTimeMillis() throws Exception verify( MAPPER, "2000-01-02T03:04:05.67", judate(2000, 1, 2, 3, 4, 5, 670, LOCAL_TZ)); verify( MAPPER, "2000-01-02T03:04:05.6", judate(2000, 1, 2, 3, 4, 5, 600, LOCAL_TZ)); verify( MAPPER, "2000-01-02T03:04:05", judate(2000, 1, 2, 3, 4, 5, 000, LOCAL_TZ)); - - + + // --------------------------------------------------------------------------------------------- // WARNING: - // RFC339 includes an Internet profile of the ISO 8601 standard for representation of dates + // RFC339 includes an Internet profile of the ISO 8601 standard for representation of dates // and times using the Gregorian calendar (https://tools.ietf.org/html/rfc3339). // // The RFC defines a partial time with the following BNF notation (chapter 5.6): @@ -160,7 +160,7 @@ public void testDateUtilISO8601_DateTimeMillis() throws Exception // // The forms below are therefore ILLEGAL and must be refused. // --------------------------------------------------------------------------------------------- - + // millis part with only a dot (.) and no digits failure( MAPPER, "2000-01-02T03:04:05.+01:00"); failure( MAPPER, "2000-01-02T03:04:05."); @@ -170,10 +170,10 @@ public void testDateUtilISO8601_DateTimeMillis() throws Exception /** * Date+Time representations - * + * * NOTE: millis are not tested here since they are covered by another test case */ - public void testDateUtilISO8601_DateTime() throws Exception + public void testDateUtilISO8601_DateTime() throws Exception { // Full representation with a timezone verify(MAPPER, "2000-01-02T03:04:05+01:00", judate(2000, 1, 2, 3, 4, 5, 0, "GMT+1")); @@ -187,64 +187,64 @@ public void testDateUtilISO8601_DateTime() throws Exception failure(MAPPER, "2000-01-02T03:"); verify(MAPPER, "2000-01-02T03:04", judate(2000, 1, 2, 3, 4, 0, 0, LOCAL_TZ)); failure(MAPPER, "2000-01-02T03:04:"); - + // Hours, minutes are mandatory but seconds are optional - test with a TZ failure(MAPPER, "2000-01-02T+01:00"); failure(MAPPER, "2000-01-02T03+01:00"); failure(MAPPER, "2000-01-02T03:+01:00"); verify( MAPPER, "2000-01-02T03:04+01:00", judate(2000, 1, 2, 3, 4, 0, 0, "GMT+1")); failure(MAPPER, "2000-01-02T03:04:+01:00"); - + failure(MAPPER, "2000-01-02TZ"); failure(MAPPER, "2000-01-02T03Z"); failure(MAPPER, "2000-01-02T03:Z"); verify(MAPPER, "2000-01-02T03:04Z", judate(2000, 1, 2, 3, 4, 0, 0, "UTC")); failure(MAPPER, "2000-01-02T03:04:Z"); - + // --------------------------------------------------------------------------------------------- // WARNING: - // ISO8601 (https://en.wikipedia.org/wiki/ISO_8601#Times) and its RFC339 profile - // (https://tools.ietf.org/html/rfc3339, chapter 5.6) seem to require 2 DIGITS for + // ISO8601 (https://en.wikipedia.org/wiki/ISO_8601#Times) and its RFC339 profile + // (https://tools.ietf.org/html/rfc3339, chapter 5.6) seem to require 2 DIGITS for // the hours, minutes and seconds. // - // The following forms should therefore be refused but are accepted by Jackson (and + // The following forms should therefore be refused but are accepted by Jackson (and // java.text.SimpleDateFormat). They are verified here to detect any changes in future // releases. // // --------------------------------------------------------------------------------------------- - - // FIXME As highlighted in the tests below, the behaviour is not consistent and largely + + // FIXME As highlighted in the tests below, the behaviour is not consistent and largely // depends on wether a timezone and or millis are specified or not. // The tests assert the behavior with different number of digits for hour, min and sec. // Behavior should be the SAME whatever the timezone and/or the millis. - + // seconds (no TZ) failure( MAPPER, "2000-01-02T03:04:5"); failure( MAPPER, "2000-01-02T03:04:5.000"); failure(MAPPER, "2000-01-02T03:04:005"); - + // seconds (+01:00) failure(MAPPER, "2000-01-02T03:04:5+01:00"); failure(MAPPER, "2000-01-02T03:04:5.000+01:00"); failure(MAPPER, "2000-01-02T03:04:005+01:00"); - + // seconds (Z) failure(MAPPER, "2000-01-02T03:04:5Z"); failure( MAPPER, "2000-01-02T03:04:5.000Z"); failure(MAPPER, "2000-01-02T03:04:005Z"); - + // minutes (no TZ) failure( MAPPER, "2000-01-02T03:4:05"); failure( MAPPER, "2000-01-02T03:4:05.000"); failure(MAPPER, "2000-01-02T03:004:05"); - + // minutes (+01:00) failure(MAPPER, "2000-01-02T03:4:05+01:00"); failure(MAPPER, "2000-01-02T03:4:05.000+01:00"); failure(MAPPER, "2000-01-02T03:004:05+01:00"); - + // minutes (Z) failure( MAPPER, "2000-01-02T03:4:05Z"); failure( MAPPER, "2000-01-02T03:4:05.000Z"); @@ -268,34 +268,34 @@ public void testDateUtilISO8601_DateTime() throws Exception /** * Date-only representations (no Time part) - * + * * NOTE: time part is not tested here since they it is covered by another test case */ public void testDateUtilISO8601_Date() throws Exception { // Date is constructed with the timezone of the ObjectMapper. Time part is set to zero. verify(MAPPER, "2000-01-02", judate(2000, 1, 2, 0, 0, 0, 0, LOCAL_TZ)); - - + + // --------------------------------------------------------------------------------------------- // WARNING: - // ISO8601 (https://en.wikipedia.org/wiki/ISO_8601#Times) and its RFC339 profile - // (https://tools.ietf.org/html/rfc3339, chapter 5.6) seem to require 2 DIGITS for + // ISO8601 (https://en.wikipedia.org/wiki/ISO_8601#Times) and its RFC339 profile + // (https://tools.ietf.org/html/rfc3339, chapter 5.6) seem to require 2 DIGITS for // the month and dayofweek but 4 DIGITS for the year. // - // The following forms should therefore be refused but are accepted by Jackson (and + // The following forms should therefore be refused but are accepted by Jackson (and // java.text.SimpleDateFormat). They are verified here to detect any changes in future // releases. // --------------------------------------------------------------------------------------------- // day - failure( MAPPER, "2000-01-2"); + failure( MAPPER, "2000-01-2"); failure( MAPPER, "2000-01-002"); - + // month failure( MAPPER, "2000-1-02"); failure( MAPPER, "2000-001-02"); - + // year failure( MAPPER, "20000-01-02"); failure( MAPPER, "200-01-02" ); @@ -326,12 +326,12 @@ public void testDateUtil_Numeric() throws Exception verify( MAPPER, now, new java.util.Date(now) ); // as a long verify( MAPPER, Long.toString(now), new java.util.Date(now) ); // as a string } - + // value larger than a long (Long.MAX_VALUE+1) BigInteger tooLarge = BigInteger.valueOf(Long.MAX_VALUE).add( BigInteger.valueOf(1) ); failure(MAPPER, tooLarge, InvalidFormatException.class); failure(MAPPER, tooLarge.toString(), InvalidFormatException.class); - + // decimal value failure(MAPPER, 0.0, MismatchedInputException.class); failure(MAPPER, "0.0", InvalidFormatException.class); @@ -345,8 +345,8 @@ public void testDateUtil_Annotation() throws Exception // Build the input JSON and expected value String json = a2q("{'date':'/2005/05/25/'}"); java.util.Date expected = judate(2005, 05, 25, 0, 0, 0, 0, LOCAL_TZ); - - + + // Read it to make sure the format specified by the annotation is taken into account { DateAsStringBean result = MAPPER.readValue(json, DateAsStringBean.class); @@ -360,7 +360,7 @@ public void testDateUtil_Annotation() throws Exception assertNotNull(result); assertEquals( expected, result.date ); } - + // or, via annotations { DateAsStringBeanGermany result = MAPPER.readerFor(DateAsStringBeanGermany.class) @@ -381,7 +381,7 @@ public void testDateUtil_Annotation_PatternAndLocale() throws Exception ObjectMapper mapper = MAPPER.copy(); mapper.setLocale( Locale.ITALY ); - // Build the JSON string. This is a mixed of ITALIAN and FRENCH (no ENGLISH because this + // Build the JSON string. This is a mixed of ITALIAN and FRENCH (no ENGLISH because this // would be the default). String json = a2q("{ 'pattern': '*1 giu 2000 01:02:03*', 'pattern_FR': '*01 juin 2000 01:02:03*', 'pattern_GMT4': '*1 giu 2000 01:02:03*', 'pattern_FR_GMT4': '*1 juin 2000 01:02:03*'}"); Annot_Pattern result = mapper.readValue(json, Annot_Pattern.class); @@ -403,18 +403,18 @@ public void testDateUtil_Annotation_TimeZone() throws Exception { String json = a2q("{ 'date': '2000-01-02T03:04:05.678' }"); Annot_TimeZone result = MAPPER.readValue(json, Annot_TimeZone.class); - + assertNotNull(result); assertEquals( judate(2000, 1, 2, 3, 4, 5, 678, "GMT+4"), result.date); } - + // WITH timezone // --> the annotation acts as the "default" timezone. The timezone specified // in the JSON should be considered first. { String json = a2q("{ 'date': '2000-01-02T03:04:05.678+01:00' }"); Annot_TimeZone result = MAPPER.readValue(json, Annot_TimeZone.class); - + assertNotNull(result); assertEquals( judate(2000, 1, 2, 3, 4, 5, 678, "GMT+1"), result.date); } @@ -435,26 +435,26 @@ public void testDateUtil_customDateFormat_withoutTZ() throws Exception // This rule remains valid with the @JsonFormat annotation unless it forces // an explicit timezeone, in which case the latter takes precedence. // - // One would expect the same behavior when the StdDateFormat is replaced by a - // custom DateFormat on the ObjectMapper. In other words, the timezone of the + // One would expect the same behavior when the StdDateFormat is replaced by a + // custom DateFormat on the ObjectMapper. In other words, the timezone of the // DateFormat is of no importance: the ObjectMapper's default should be used // whenever it is needed. - - + + // Test first with a non default TZ on the ObjectMapper // --> OK: the mapper's default TZ is used to parse the date. { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'X'HH:mm:ss"); df.setTimeZone( TimeZone.getTimeZone("GMT+4") ); // TZ different from mapper's default - + ObjectMapper mapper = new ObjectMapper(); mapper.setTimeZone( TimeZone.getTimeZone(LOCAL_TZ) ); mapper.setDateFormat(df); - + // The mapper's default TZ is used... verify(mapper, "2000-01-02X04:00:00", judate(2000, 1, 2, 4, 00, 00, 00, LOCAL_TZ)); } - + // Test a second time with the default TZ on the ObjectMapper // Note it is important NOT TO CALL mapper.setTimeZone(...) in this test.. // --> KO: the custom format's TZ is used instead of the mapper's default as above. @@ -462,10 +462,10 @@ public void testDateUtil_customDateFormat_withoutTZ() throws Exception { DateFormat df = new SimpleDateFormat("yyyy-MM-dd'X'HH:mm:ss"); df.setTimeZone( TimeZone.getTimeZone("GMT+4") ); // TZ different from mapper's default - + ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(df); - + // FIXME mapper's default TZ should have been used verify(mapper, "2000-01-02X04:00:00", judate(2000, 1, 2, 4, 00, 00, 00, "GMT+4")); } @@ -494,7 +494,7 @@ public void testDateUtil_customDateFormat_withTZ() throws Exception /** * Create a {@link java.util.Date} with all the fields set to the given value. - * + * * @param year year * @param month month (1-12) * @param day day of month (1-31) @@ -505,7 +505,7 @@ public void testDateUtil_customDateFormat_withTZ() throws Exception * @param tz timezone id as accepted by {@link TimeZone#getTimeZone(String)} * @return a new {@link Date} instance */ - private static Date judate(int year, int month, int day, int hour, int minutes, int seconds, int millis, String tz) + private static Date judate(int year, int month, int day, int hour, int minutes, int seconds, int millis, String tz) { Calendar cal = Calendar.getInstance(); cal.setLenient(false); @@ -518,7 +518,7 @@ private static Date judate(int year, int month, int day, int hour, int minutes, private static void verify(ObjectMapper mapper, Object input, Date expected) throws Exception { // Deserialize using the supplied ObjectMapper Date actual = read(mapper, input, java.util.Date.class); - + // Test against the expected if( expected==null && actual==null) { return; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTest.java index fd8ddd7fef..4ad761f892 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/DateDeserializationTest.java @@ -27,7 +27,7 @@ static class DateAsStringBeanGermany @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="/yyyy/MM/dd/", locale="fr_FR") public Date date; } - + static class CalendarAsStringBean { @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=";yyyy/MM/dd;") @@ -48,7 +48,7 @@ static class LenientCalendarBean { @JsonFormat(lenient=OptBoolean.TRUE) public Calendar value; } - + static class StrictCalendarBean { @JsonFormat(lenient=OptBoolean.FALSE) public Calendar value; @@ -201,7 +201,7 @@ public void testISO8601PartialMilliseconds() throws Exception String inputStr; Date inputDate; Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - + inputStr = "2014-10-03T18:00:00.6-05:00"; inputDate = MAPPER.readValue(q(inputStr), java.util.Date.class); c.setTime(inputDate); @@ -341,7 +341,7 @@ public void testISO8601MissingSeconds() throws Exception public void testDateUtilISO8601NoTimezone() throws Exception { - // Timezone itself is optional as well... + // Timezone itself is optional as well... String inputStr = "1984-11-13T00:00:09"; Date inputDate = MAPPER.readValue(q(inputStr), java.util.Date.class); Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); @@ -393,7 +393,7 @@ public void testDateUtilISO8601NoMilliseconds() throws Exception final String INPUT_STR = "2013-10-31T17:27:00"; Date inputDate; Calendar c; - + inputDate = MAPPER.readValue(q(INPUT_STR), java.util.Date.class); c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); c.setTime(inputDate); @@ -587,13 +587,13 @@ public void testDateEndingWithZNonDefTZ1651() throws Exception // ... but, Travis manages to have fails, so insist on newly created ObjectMapper mapper = newJsonMapper(); Date dateUTC = mapper.readValue(json, Date.class); // 1970-01-01T00:00:00.000+00:00 - + // Mapper with timezone GMT-2 // note: must construct new one, not share mapper = new ObjectMapper(); mapper.setTimeZone(TimeZone.getTimeZone("GMT-2")); Date dateGMT1 = mapper.readValue(json, Date.class); // 1970-01-01T00:00:00.000-02:00 - + // Underlying timestamps should be the same assertEquals(dateUTC.getTime(), dateGMT1.getTime()); } @@ -603,7 +603,7 @@ public void testDateEndingWithZNonDefTZ1651() throws Exception /* Context timezone use (or not) /********************************************************** */ - + // for [databind#204] public void testContextTimezone() throws Exception { @@ -637,7 +637,7 @@ public void testContextTimezone() throws Exception // 23-Jun-2017, tatu: Actually turns out to be hard if not impossible to do ... // problem being SimpleDateFormat does not really retain timezone offset. // But if we match fields... we perhaps could use it? - + // !!! TODO: would not yet pass /* System.err.println("CAL/2 == "+cal); @@ -651,7 +651,7 @@ public void testContextTimezone() throws Exception /* Test(s) for array unwrapping /********************************************************** */ - + public void testCalendarArrayUnwrap() throws Exception { ObjectReader reader = new ObjectMapper() @@ -742,7 +742,7 @@ public void testLenientJDKDateTypesViaGlobal() throws Exception verifyException(e, "from String \"2015-11-32\""); verifyException(e, "expected format"); } - + // Unless we actually had per-type override too mapper = new ObjectMapper(); mapper.configOverride(Calendar.class) @@ -774,7 +774,7 @@ public void testInvalidFormat() throws Exception +InvalidFormatException.class.getName()); } } - + /* /********************************************************** /* Helper methods diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKAtomicTypesDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKAtomicTypesDeserTest.java index b840b2f437..ff74101cf0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKAtomicTypesDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKAtomicTypesDeserTest.java @@ -144,7 +144,7 @@ public AtomicRefWithNodeBean(@JsonProperty("atomic") AtomicReference r */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testAtomicBoolean() throws Exception { AtomicBoolean b = MAPPER.readValue("true", AtomicBoolean.class); @@ -233,7 +233,7 @@ public void testPolymorphicAtomicReference() throws Exception { RefWrapper input = new RefWrapper(13); String json = MAPPER.writeValueAsString(input); - + RefWrapper result = MAPPER.readValue(json, RefWrapper.class); assertNotNull(result.w); Object ob = result.w.get(); @@ -286,7 +286,7 @@ public void testDeserializeWithContentAs() throws Exception assertEquals(WrappedString.class, v.getClass()); assertEquals("abc", ((WrappedString)v).value); } - + // [databind#932]: support unwrapping too public void testWithUnwrapping() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKCollectionsDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKCollectionsDeserTest.java index 272cb9424a..2b6a0c70a2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKCollectionsDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKCollectionsDeserTest.java @@ -28,7 +28,7 @@ public XBean() { } */ private final static ObjectMapper MAPPER = new ObjectMapper(); - + // And then a round-trip test for singleton collections public void testSingletonCollections() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKNumberDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKNumberDeserTest.java index f05fedab10..5ae6b1a54e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKNumberDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKNumberDeserTest.java @@ -81,7 +81,7 @@ static class NestedBigDecimalHolder2784 { /* Helper classes, serializers/deserializers/resolvers /********************************************************************** */ - + static class MyBeanDeserializer extends JsonDeserializer { @Override @@ -99,7 +99,7 @@ public MyBeanValue deserialize(JsonParser jp, DeserializationContext ctxt) */ final ObjectMapper MAPPER = new ObjectMapper(); - + public void testNaN() throws Exception { Float result = MAPPER.readValue(" \"NaN\"", Float.class); @@ -157,7 +157,7 @@ public void testTextualNullAsNumber() throws Exception assertEquals(Long.valueOf(0L), MAPPER.readValue(NULL_JSON, Long.TYPE)); assertEquals(Float.valueOf(0f), MAPPER.readValue(NULL_JSON, Float.TYPE)); assertEquals(Double.valueOf(0d), MAPPER.readValue(NULL_JSON, Double.TYPE)); - + assertNull(MAPPER.readValue(NULL_JSON, BigInteger.class)); assertNull(MAPPER.readValue(NULL_JSON, BigDecimal.class)); @@ -180,7 +180,7 @@ public void testTextualNullAsNumber() throws Exception verifyException(e, "Cannot coerce String value"); } } - + public void testDeserializeDecimalHappyPath() throws Exception { String json = "{\"defaultValue\": { \"value\": 123 } }"; MyBeanHolder result = MAPPER.readValue(json, MyBeanHolder.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsDeserTest.java index 72292c0366..fe03359d01 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKScalarsDeserTest.java @@ -33,9 +33,9 @@ final static class BooleanBean { static class BooleanWrapper { public Boolean wrapper; public boolean primitive; - + protected Boolean ctor; - + @JsonCreator public BooleanWrapper(@JsonProperty("ctor") Boolean foo) { ctor = foo; @@ -61,13 +61,13 @@ final static class FloatBean { float _v; void setV(float v) { _v = v; } } - + final static class CharacterBean { char _v; void setV(char v) { _v = v; } char getV() { return _v; } } - + final static class CharacterWrapperBean { Character _v; void setV(Character v) { _v = v; } @@ -211,7 +211,7 @@ public void testCharacterWrapper() throws Exception // 22-Jun-2020, tatu: one special case turns out to be white space; // need to avoid considering it "blank" value assertEquals(Character.valueOf(' '), MAPPER.readValue(q(" "), Character.class)); - + final CharacterWrapperBean wrapper = MAPPER.readValue("{\"v\":null}", CharacterWrapperBean.class); assertNotNull(wrapper); assertNull(wrapper.getV()); @@ -654,7 +654,7 @@ private void _testNullForPrimitiveArrays(Class cls, Object defValue, verifyException(e, "Cannot coerce `null`"); verifyException(e, "to element of "+SIMPLE_NAME); } - + if (testEmptyString) { ob = readerCoerceOk.forType(cls).readValue(EMPTY_STRING_JSON); assertEquals(1, Array.getLength(ob)); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKStringLikeTypeDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKStringLikeTypeDeserTest.java index 676e59b6f0..275729663e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKStringLikeTypeDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/JDKStringLikeTypeDeserTest.java @@ -41,14 +41,14 @@ static class StackTraceBean { @JsonProperty("Location") @JsonDeserialize(using=MyStackTraceElementDeserializer.class) - protected StackTraceElement location; + protected StackTraceElement location; } @SuppressWarnings("serial") static class MyStackTraceElementDeserializer extends StdDeserializer { public MyStackTraceElementDeserializer() { super(StackTraceElement.class); } - + @Override public StackTraceElement deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { @@ -70,7 +70,7 @@ public void testByteBuffer() throws Exception { byte[] INPUT = new byte[] { 1, 3, 9, -1, 6 }; String exp = MAPPER.writeValueAsString(INPUT); - ByteBuffer result = MAPPER.readValue(exp, ByteBuffer.class); + ByteBuffer result = MAPPER.readValue(exp, ByteBuffer.class); assertNotNull(result); assertEquals(INPUT.length, result.remaining()); for (int i = 0; i < INPUT.length; ++i) { @@ -84,7 +84,7 @@ public void testCharset() throws Exception Charset UTF8 = Charset.forName("UTF-8"); assertSame(UTF8, MAPPER.readValue(q("UTF-8"), Charset.class)); } - + public void testClass() throws IOException { ObjectMapper mapper = new ObjectMapper(); @@ -151,7 +151,7 @@ public void testInetAddress() throws IOException InetAddress address = MAPPER.readValue(q("127.0.0.1"), InetAddress.class); assertEquals("127.0.0.1", address.getHostAddress()); - // should we try resolving host names? That requires connectivity... + // should we try resolving host names? That requires connectivity... final String HOST = "google.com"; address = MAPPER.readValue(q(HOST), InetAddress.class); assertEquals(HOST, address.getHostName()); @@ -218,7 +218,7 @@ public void testStackTraceElement() throws Exception } String json = MAPPER.writeValueAsString(elem); StackTraceElement back = MAPPER.readValue(json, StackTraceElement.class); - + assertEquals("testStackTraceElement", back.getMethodName()); assertEquals(elem.getLineNumber(), back.getLineNumber()); assertEquals(elem.getClassName(), back.getClassName()); @@ -242,13 +242,13 @@ public void testStackTraceElementWithCustom() throws Exception SimpleModule module = new SimpleModule(); module.addDeserializer(StackTraceElement.class, new MyStackTraceElementDeserializer()); mapper.registerModule(module); - + StackTraceElement elem = mapper.readValue("123", StackTraceElement.class); assertNotNull(elem); assertEquals(StackTraceBean.NUM, elem.getLineNumber()); - + // and finally, even as part of real exception - + IOException ioe = mapper.readValue(a2q("{'stackTrace':[ 123, 456 ]}"), IOException.class); assertNotNull(ioe); @@ -380,7 +380,7 @@ public void testUUIDAux() throws Exception try (TokenBuffer buf = new TokenBuffer(null, false)) { buf.writeObject(value); assertSame(value, MAPPER.readValue(buf.asParser(), UUID.class)); - + // and finally from byte[] // oh crap; JDK UUID just... sucks. Not even byte[] accessors or constructors? Huh? ByteArrayOutputStream bytes = new ByteArrayOutputStream(); @@ -390,11 +390,11 @@ public void testUUIDAux() throws Exception out.close(); byte[] data = bytes.toByteArray(); assertEquals(16, data.length); - + buf.writeObject(data); - + UUID value2 = MAPPER.readValue(buf.asParser(), UUID.class); - + assertEquals(value, value2); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java index 1ed8e0681c..afcb9496d3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializationTest.java @@ -48,7 +48,7 @@ public CustomMap deserialize(JsonParser p, DeserializationContext ctxt) static class KeyType { protected String value; - + private KeyType(String v, boolean bogus) { value = v; } @@ -79,7 +79,7 @@ public static enum ConcreteType implements ITestType { } static class ClassStringMap extends HashMap,String> { } - + static class AbstractMapWrapper { public AbstractMap values; } @@ -111,7 +111,7 @@ public void testBigUntypedMap() throws Exception assertEquals(map.size(), ((Map) bound).size()); assertEquals(map, bound); } - + /** * Let's also try another way to express "gimme a Map" deserialization; * this time by specifying a Map class, to reduce need to cast @@ -160,9 +160,9 @@ public void testUntypedMap3() throws Exception "{ \"double\":42.0, \"string\":\"string\"," +"\"boolean\":true, \"list\":[\"list0\"]," +"\"null\":null }"; - + static class ObjectWrapperMap extends HashMap { } - + public void testSpecialMap() throws IOException { final ObjectWrapperMap map = MAPPER.readValue(UNTYPED_MAP_JSON, ObjectWrapperMap.class); @@ -177,7 +177,7 @@ public void testGenericMap() throws IOException new TypeReference>() { }); _doTestUntyped(map); } - + private void _doTestUntyped(final Map map) { ObjectWrapper w = map.get("double"); @@ -190,7 +190,7 @@ private void _doTestUntyped(final Map map) assertNull(map.get("null")); assertEquals(5, map.size()); } - + // [JACKSON-620]: allow "" to mean 'null' for Maps public void testFromEmptyString() throws Exception { @@ -337,7 +337,7 @@ public void testMapWithEnums() throws Exception assertNull(result.get(Key.KEY1)); } - public void testEnumPolymorphicSerializationTest() throws Exception + public void testEnumPolymorphicSerializationTest() throws Exception { ObjectMapper mapper = new ObjectMapper(); List testTypesList = new ArrayList(); @@ -352,7 +352,7 @@ public void testEnumPolymorphicSerializationTest() throws Exception testTypesMap.put(KeyEnum.A, ConcreteType.ONE); testTypesMap.put(KeyEnum.B, ConcreteType.TWO); enumMapContainer.testTypes = testTypesMap; - + json = mapper.writeValueAsString(enumMapContainer); enumMapContainer = mapper.readValue(json, EnumMapContainer.class); } @@ -366,15 +366,15 @@ public void testDateMap() throws Exception { Date date1=new Date(123456000L); DateFormat fmt = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); - + String JSON = "{ \""+ fmt.format(date1)+"\" : \"\", \""+new Date(0).getTime()+"\" : null }"; HashMap result= MAPPER.readValue (JSON, new TypeReference>() { }); - + assertNotNull(result); assertEquals(HashMap.class, result.getClass()); assertEquals(2, result.size()); - + assertTrue(result.containsKey(date1)); assertEquals("", result.get(new Date(123456000L))); @@ -391,7 +391,7 @@ public void testDateMap() throws Exception public void testCalendarMap() throws Exception { // 18-Jun-2015, tatu: Should be safest to use default timezone that mapper would use - TimeZone tz = MAPPER.getSerializationConfig().getTimeZone(); + TimeZone tz = MAPPER.getSerializationConfig().getTimeZone(); Calendar c = Calendar.getInstance(tz); c.setTimeInMillis(123456000L); @@ -505,7 +505,7 @@ public void testMapWithDeserializer() throws Exception public void testMapError() throws Exception { try { - Object result = MAPPER.readValue("[ 1, 2 ]", + Object result = MAPPER.readValue("[ 1, 2 ]", new TypeReference>() { }); fail("Expected an exception, but got result value: "+result); } catch (MismatchedInputException jex) { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializerCachingTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializerCachingTest.java index 5514c73956..4ef181a189 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializerCachingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapDeserializerCachingTest.java @@ -42,7 +42,7 @@ public void testCachedSerialize() throws IOException { assertTrue(ignored.data.containsKey("2nd")); //mapper = new ObjectMapper(); - + MapHolder model2 = mapper.readValue(json, MapHolder.class); if (!model2.data.containsKey("1st (CUSTOM)") || !model2.data.containsKey("2nd (CUSTOM)")) { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapKeyDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapKeyDeserializationTest.java index 1a3f418d58..80b7b6c4ef 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapKeyDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapKeyDeserializationTest.java @@ -114,7 +114,7 @@ public void testBooleanMapKeyDeserialization() throws Exception { TypeReference> type = new TypeReference>() { }; MapWrapper result = MAPPER.readValue(a2q("{'map':{'true':'foobar'}}"), type); - + assertEquals(1, result.map.size()); Assert.assertEquals(Boolean.TRUE, result.map.entrySet().iterator().next().getKey()); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapRelatedTypesDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapRelatedTypesDeserTest.java index ac41e15f5c..d3f7d5648b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapRelatedTypesDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapRelatedTypesDeserTest.java @@ -35,7 +35,7 @@ public void testMapEntryWithStringBean() throws Exception assertEquals(2, stuff.size()); assertNotNull(stuff.get(1)); assertEquals(Integer.valueOf(13), stuff.get(1).getKey()); - + StringWrapper sw = stuff.get(1).getValue(); assertEquals("Bar", sw.str); } @@ -56,7 +56,7 @@ public void testMapEntryFail() throws Exception /* Test methods, other exotic Map types /********************************************************** */ - + // [databind#810] public void testReadProperties() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapWithGenericValuesDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapWithGenericValuesDeserTest.java index db6ad77003..157d72005d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapWithGenericValuesDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapWithGenericValuesDeserTest.java @@ -71,7 +71,7 @@ public static KeyTypeFactory create(String str) { return new KeyTypeFactory(str, true); } } - + /* /********************************************************** /* Test methods for sub-classing @@ -112,7 +112,7 @@ public void testIntermediateTypes() throws Exception assertEquals(value.getClass(), StringWrapper.class); assertEquals("b", ((StringWrapper) value).str); } - + /* /********************************************************** /* Test methods for sub-classing for annotation handling diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java index e6267b9ee8..4f0c9ba0ec 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java @@ -41,7 +41,7 @@ static class CustomNumberDeserializer extends StdScalarDeserializer { protected final Integer value; - + public CustomNumberDeserializer(int nr) { super(Number.class); value = nr; @@ -75,7 +75,7 @@ public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { // For now, we just need to access "untyped" deserializer; not use it. - + /*JsonDeserializer ob = */ ctxt.findContextualValueDeserializer(ctxt.constructType(Object.class), property); return this; @@ -100,7 +100,7 @@ public Map deserialize(JsonParser p, DeserializationContext ctxt) static class DelegatingUntyped { protected Object value; - + @JsonCreator // delegating public DelegatingUntyped(Object v) { value = v; @@ -131,7 +131,7 @@ static class SerContainer { */ private final ObjectMapper MAPPER = newJsonMapper(); - + @SuppressWarnings("unchecked") public void testSampleDoc() throws Exception { @@ -224,7 +224,7 @@ public void testSimpleVanillaStructured() throws IOException List list = (List) MAPPER.readValue("[ 1, 2, 3]", Object.class); assertEquals(Integer.valueOf(1), list.get(0)); } - + public void testNestedUntypes() throws IOException { // 05-Apr-2014, tatu: Odd failures if using shared mapper; so work around: @@ -326,7 +326,7 @@ public void testNestedUntyped989() throws IOException assertTrue(pojo.value instanceof List); pojo = r.readValue("[{}]"); assertTrue(pojo.value instanceof List); - + pojo = r.readValue("{}"); assertTrue(pojo.value instanceof Map); pojo = r.readValue("{\"a\":[]}"); @@ -385,7 +385,7 @@ public void testSerializable() throws Exception /* Test methods, merging /********************************************************** */ - + public void testValueUpdateVanillaUntyped() throws Exception { Map map = new LinkedHashMap<>(); @@ -413,7 +413,7 @@ public void testValueUpdateCustomUntyped() throws Exception .addDeserializer(String.class, new UCStringDeserializer()); final ObjectMapper customMapper = newJsonMapper() .registerModule(m); - + Map map = new LinkedHashMap<>(); map.put("a", 42); @@ -434,7 +434,7 @@ public void testValueUpdateCustomUntyped() throws Exception assertEquals(3, list.size()); assertEquals("FOOBAR", list.get(2)); } - + /* /********************************************************** /* Test methods, polymorphic diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UtilCollectionsTypesTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UtilCollectionsTypesTest.java index 7438350772..a24eb8d66a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UtilCollectionsTypesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UtilCollectionsTypesTest.java @@ -144,7 +144,7 @@ public void testSynchronizedMap() throws Exception { input.put("c", "d"); _verifyMap(Collections.synchronizedMap(input)); } - + /* /********************************************************** /* Unit tests, other @@ -187,12 +187,12 @@ protected void _verifyApproxCollection(Collection exp, fail("Should be subtype of "+expType.getName()+", is: "+actType.getName()); } } - + protected Collection _writeReadCollection(Collection input) throws Exception { final String json = DEFAULT_MAPPER.writeValueAsString(input); return DEFAULT_MAPPER.readValue(json, Collection.class); } - + protected void _verifyMap(Map exp) throws Exception { String json = DEFAULT_MAPPER.writeValueAsString(exp); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/ArrayMergeTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/ArrayMergeTest.java index bde1c229a5..ede4212122 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/ArrayMergeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/ArrayMergeTest.java @@ -19,7 +19,7 @@ static class MergedX public MergedX(T v) { value = v; } protected MergedX() { } } - + /* /******************************************************** /* Test methods @@ -125,7 +125,7 @@ public void testCharArrayMerging() throws Exception assertSame(input, result); Assert.assertArrayEquals(new char[] { 'c' }, result.value); } - + public void testIntArrayMerging() throws Exception { MergedX input = new MergedX(new int[] { 1, 2 }); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapMergeTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapMergeTest.java index 6270074bb0..544ad0753d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapMergeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapMergeTest.java @@ -54,7 +54,7 @@ protected MergedIntMap() { private final ObjectMapper MAPPER_SKIP_NULLS = newJsonMapper() .setDefaultSetterInfo(JsonSetter.Value.forContentNulls(Nulls.SKIP)); ; - + public void testShallowMapMerging() throws Exception { final String JSON = a2q("{'values':{'c':'y','d':null}}"); @@ -85,7 +85,7 @@ public void testShallowNonStringMerging() throws Exception assertEquals("a", v.values.get(Integer.valueOf(13))); assertEquals("b", v.values.get(Integer.valueOf(72))); } - + @SuppressWarnings("unchecked") public void testDeeperMapMerging() throws Exception { @@ -150,7 +150,7 @@ public void testMapMergingWithArray() throws Exception /* Forcing shallow merge of root Maps: /******************************************************** */ - + public void testDefaultDeepMapMerge() throws Exception { // First: deep merge should be enabled by default diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapPolymorphicMerge2336Test.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapPolymorphicMerge2336Test.java index 859bbc9809..a10f1f9dae 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapPolymorphicMerge2336Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MapPolymorphicMerge2336Test.java @@ -95,13 +95,13 @@ public void testPolymorphicMapMerge() throws Exception // now create a reader specifically for merging ObjectReader reader = MAPPER.readerForUpdating(baseValue); - + SomeOtherClass toBeMerged = new SomeOtherClass("house"); toBeMerged.addValue("SOMEKEY", new SomeClassA("jim", null, 2)); String jsonForMerging = MAPPER.writeValueAsString(toBeMerged); assertEquals("fred", baseValue.data.get("SOMEKEY").getName()); - + // now try to do the merge and it blows up SomeOtherClass mergedResult = reader.readValue(jsonForMerging); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MergeWithNullTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MergeWithNullTest.java index 773f9c9fc6..3258adaaba 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/MergeWithNullTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/MergeWithNullTest.java @@ -40,7 +40,7 @@ public ConfigAllowNullOverwrite(int a, int b) { loc = new AB(a, b); } } - + // another variant where all we got is a getter static class NoSetterConfig { AB _value = new AB(2, 3); @@ -119,7 +119,7 @@ public void testBeanMergingWithNullSet() throws Exception assertNotNull(config); assertNull(config.loc); } - + public void testSetterlessMergingWithNull() throws Exception { NoSetterConfig input = new NoSetterConfig(); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/NodeMergeTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/NodeMergeTest.java index 5e5756d8a6..081f2f686c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/NodeMergeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/NodeMergeTest.java @@ -77,7 +77,7 @@ public void testObjectDeepUpdate() throws Exception assertEquals(2, base.size()); ObjectNode resultProps = (ObjectNode) base.get("props"); assertEquals(4, resultProps.size()); - + assertEquals(123, resultProps.path("base").asInt()); assertTrue(resultProps.path("value").asBoolean()); assertEquals(25.5, resultProps.path("extra").asDouble()); diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/PropertyMergeTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/PropertyMergeTest.java index 6ad0539e87..ce09d7e91b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/PropertyMergeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/PropertyMergeTest.java @@ -12,7 +12,7 @@ /** * Tests to make sure that the new "merging" property of * JsonSetter annotation works as expected. - * + * * @since 2.9 */ @SuppressWarnings("serial") @@ -35,7 +35,7 @@ static class NonMergeConfig { // another variant where all we got is a getter static class NoSetterConfig { AB _value = new AB(1, 2); - + @JsonMerge public AB getValue() { return _value; } } @@ -79,7 +79,7 @@ static class MergedX public MergedX(T v) { value = v; } protected MergedX() { } } - + // // // Classes with invalid merge definition(s) static class CantMergeInts { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/merge/UpdateValueTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/merge/UpdateValueTest.java index 15175121fb..157b29d63a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/merge/UpdateValueTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/merge/UpdateValueTest.java @@ -37,7 +37,7 @@ void setB(String b) { } private final ObjectMapper MAPPER = newJsonMapper(); - + // [databind#318] (and Scala module issue #83] public void testValueUpdateWithCreator() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/validate/FullStreamReadTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/validate/FullStreamReadTest.java index 016803fdd1..f1aa728e52 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/validate/FullStreamReadTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/validate/FullStreamReadTest.java @@ -25,7 +25,7 @@ public class FullStreamReadTest extends BaseMapTest private final static String JSON_OK_NULL = " null "; private final static String JSON_OK_NULL_WITH_COMMENT = " null /* stuff */ "; private final static String JSON_FAIL_NULL = JSON_OK_NULL + " false"; - + /* /********************************************************** /* Test methods, config @@ -165,7 +165,7 @@ public void testMapperFailOnTrailingWithNull() throws Exception .readValue(JSON_OK_NULL_WITH_COMMENT); assertNull(ob); } - + public void testReaderAcceptTrailing() throws Exception { ObjectReader R = MAPPER.reader(); @@ -233,7 +233,7 @@ public void testReaderFailOnTrailing() throws Exception // but works if comments enabled etc ObjectReader strictRWithComments = strictR.with(JsonReadFeature.ALLOW_JAVA_COMMENTS); - + _verifyCollection((List)strictRWithComments.forType(List.class).readValue(JSON_OK_ARRAY_WITH_COMMENT)); _verifyArray(strictRWithComments.readTree(JSON_OK_ARRAY_WITH_COMMENT)); } @@ -285,7 +285,7 @@ public void testReaderFailOnTrailingWithNull() throws Exception Object ob = strictRWithComments.forType(List.class).readValue(JSON_OK_NULL_WITH_COMMENT); assertNull(ob); } - + private void _verifyArray(JsonNode n) throws Exception { assertTrue(n.isArray()); diff --git a/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java b/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java index 1459f0447e..23759376f9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/exc/BasicExceptionTest.java @@ -42,7 +42,7 @@ public void testBadDefinition() throws Exception beanDef, (BeanPropertyDefinition) null); assertEquals(beanDef.getType(), e.getType()); assertNotNull(e); - + // and the other constructor too JsonGenerator g = JSON_F.createGenerator(new StringWriter()); e = new InvalidDefinitionException(p, @@ -55,7 +55,7 @@ public void testBadDefinition() throws Exception beanDef, (BeanPropertyDefinition) null); assertEquals(beanDef.getType(), e.getType()); assertNotNull(e); - + g.close(); } diff --git a/src/test/java/com/fasterxml/jackson/databind/exc/DeserExceptionTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/exc/DeserExceptionTypeTest.java index bea06a8b1e..3b3d7c51e5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/exc/DeserExceptionTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/exc/DeserExceptionTypeTest.java @@ -28,7 +28,7 @@ static class NoCreatorsBean { // Constructor that is not detectable as Creator public NoCreatorsBean(boolean foo, int foo2) { } } - + /* /********************************************************** /* Test methods @@ -36,7 +36,7 @@ public NoCreatorsBean(boolean foo, int foo2) { } */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testHandlingOfUnrecognized() throws Exception { UnrecognizedPropertyException exc = null; diff --git a/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionPathTest.java b/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionPathTest.java index ed59b9e71d..fad17e6fee 100644 --- a/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionPathTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionPathTest.java @@ -23,7 +23,7 @@ static class Inner { /* Test methods /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); public void testReferenceChainForInnerClass() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionSerializationTest.java index 409775e197..af6e5205e0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/exc/ExceptionSerializationTest.java @@ -79,7 +79,7 @@ public void testSimpleOther() throws Exception p.close(); assertNotNull(json); } - + // for [databind#877] @SuppressWarnings("unchecked") public void testIgnorals() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/ext/DOMTypeReadWriteTest.java b/src/test/java/com/fasterxml/jackson/databind/ext/DOMTypeReadWriteTest.java index c4fbc30dc8..9451a0f259 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ext/DOMTypeReadWriteTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ext/DOMTypeReadWriteTest.java @@ -18,7 +18,7 @@ public class DOMTypeReadWriteTest extends com.fasterxml.jackson.databind.BaseMap ""; private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testSerializeSimpleNonNS() throws Exception { // Let's just parse first, easiest @@ -81,7 +81,7 @@ public void testDeserializeNonNS() throws Exception assertEquals("instr", pi.getData()); } } - + public void testDeserializeNS() throws Exception { Document doc = MAPPER.readValue(q(SIMPLE_XML_NS), Document.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/ext/SqlBlobSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ext/SqlBlobSerializationTest.java index 65e90acc94..75afefee7a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ext/SqlBlobSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ext/SqlBlobSerializationTest.java @@ -21,7 +21,7 @@ public Blob getSqlBlob1() { public void setSqlBlob1(Blob sqlBlob1) { this.sqlBlob1 = sqlBlob1; } - } + } /* /********************************************************** diff --git a/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateDeserializationTest.java index 9e4d421215..66c01c4d1e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateDeserializationTest.java @@ -29,7 +29,7 @@ public void testDateSql() throws Exception assertEquals(value, MAPPER.readValue(String.valueOf(now), java.sql.Date.class)); // then from default java.sql.Date String serialization: - + java.sql.Date result = MAPPER.readValue(q(value.toString()), java.sql.Date.class); Calendar c = gmtCalendar(result.getTime()); assertEquals(1999, c.get(Calendar.YEAR)); diff --git a/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateSerializationTest.java index baf684b711..84a7e61a8e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ext/SqlDateSerializationTest.java @@ -59,7 +59,7 @@ public void testSqlDate() throws IOException // And also should be able to use String output as need be: ObjectWriter w = MAPPER.writer().without(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - + assertEquals(q("1999-04-01"), w.writeValueAsString(date99)); assertEquals(q(date0.toString()), w.writeValueAsString(date0)); assertEquals(a2q("{'date':'"+date0.toString()+"'}"), @@ -82,7 +82,7 @@ public void testSqlTimestamp() throws IOException assertEquals(MAPPER.writeValueAsString(altTnput), MAPPER.writeValueAsString(input)); } - + public void testPatternWithSqlDate() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -101,7 +101,7 @@ public void testSqlDateConfigOverride() throws Exception ObjectMapper mapper = newJsonMapper(); mapper.setTimeZone(TimeZone.getDefault()); mapper.configOverride(java.sql.Date.class) - .setFormat(JsonFormat.Value.forPattern("yyyy+MM+dd")); + .setFormat(JsonFormat.Value.forPattern("yyyy+MM+dd")); assertEquals("\"1980+04+14\"", mapper.writeValueAsString(java.sql.Date.valueOf("1980-04-14"))); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ext/SqlTimestampDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ext/SqlTimestampDeserializationTest.java index 0bcc976159..33b8676733 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ext/SqlTimestampDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ext/SqlTimestampDeserializationTest.java @@ -31,7 +31,7 @@ public void testTimestampUtilSingleElementArray() throws Exception { final ObjectReader r = MAPPER.readerFor(java.sql.Timestamp.class) .with(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); - + long now = System.currentTimeMillis(); java.sql.Timestamp value = new java.sql.Timestamp(now); diff --git a/src/test/java/com/fasterxml/jackson/databind/format/CollectionFormatShapeTest.java b/src/test/java/com/fasterxml/jackson/databind/format/CollectionFormatShapeTest.java index 43d891c4bd..264c6295d2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/format/CollectionFormatShapeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/format/CollectionFormatShapeTest.java @@ -10,7 +10,7 @@ public class CollectionFormatShapeTest extends BaseMapTest { - // [databind#40]: Allow serialization 'as POJO' (resulting in JSON Object) + // [databind#40]: Allow serialization 'as POJO' (resulting in JSON Object) @JsonPropertyOrder({ "size", "value" }) @JsonFormat(shape=Shape.OBJECT) @JsonIgnoreProperties({ "empty" }) // from 'isEmpty()' @@ -21,7 +21,7 @@ static class CollectionAsPOJO @JsonProperty("size") public int foo() { return size(); } - + public List getValues() { return new ArrayList(this); } @@ -29,7 +29,7 @@ public List getValues() { public void setValues(List v) { addAll(v); } - + // bogus setter to handle "size" property public void setSize(int i) { } } @@ -40,7 +40,7 @@ public void setSize(int i) { } /********************************************************** */ - private final static ObjectMapper MAPPER = newJsonMapper(); + private final static ObjectMapper MAPPER = newJsonMapper(); public void testListAsObjectRoundtrip() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/format/EnumFormatShapeTest.java b/src/test/java/com/fasterxml/jackson/databind/format/EnumFormatShapeTest.java index 902306e0af..8a511a0891 100644 --- a/src/test/java/com/fasterxml/jackson/databind/format/EnumFormatShapeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/format/EnumFormatShapeTest.java @@ -21,7 +21,7 @@ static enum PoNUM { @JsonProperty protected final String value; - + private PoNUM(String v) { value = v; } public String getValue() { return value; } @@ -37,7 +37,7 @@ static class PoNUMContainer { @JsonFormat(shape=Shape.NUMBER) public OK text = OK.V1; } - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) // alias for 'number', as of 2.5 static enum PoAsArray { diff --git a/src/test/java/com/fasterxml/jackson/databind/format/MapEntryFormatTest.java b/src/test/java/com/fasterxml/jackson/databind/format/MapEntryFormatTest.java index c8527ab2bd..c1e1b91db5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/format/MapEntryFormatTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/format/MapEntryFormatTest.java @@ -33,7 +33,7 @@ public MapEntryAsObject(String k, String v) { key = k; value = v; } - + @Override public String getKey() { return key; @@ -86,7 +86,7 @@ public EntryWithNonAbsentWrapper(String key, String value) { entry = map.entrySet().iterator().next(); } } - + static class EmptyEntryWrapper { @JsonInclude(value=JsonInclude.Include.NON_EMPTY, content=JsonInclude.Include.NON_EMPTY) @@ -98,13 +98,13 @@ public EmptyEntryWrapper(String key, String value) { entry = map.entrySet().iterator().next(); } } - + /* /********************************************************************** /* Test methods, basic /********************************************************************** */ - + private final ObjectMapper MAPPER = newJsonMapper(); public void testInclusion() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/format/MapFormatShapeTest.java b/src/test/java/com/fasterxml/jackson/databind/format/MapFormatShapeTest.java index be57d310de..d503291c07 100644 --- a/src/test/java/com/fasterxml/jackson/databind/format/MapFormatShapeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/format/MapFormatShapeTest.java @@ -65,14 +65,14 @@ public Bean476Override(int value) { static class Map1540Implementation implements Map { public int property; public Map map = new LinkedHashMap<>(); - + public Map getMap() { return map; } public void setMap(Map map) { this.map = map; - } + } @Override public Integer put(Integer key, Integer value) { @@ -99,17 +99,17 @@ public boolean containsKey(Object key) { public boolean containsValue(Object value) { return map.containsValue(value); } - + @Override public Integer get(Object key) { return map.get(key); } - + @Override public Integer remove(Object key) { return map.remove(key); } - + @Override public void putAll(Map m) { map.putAll(m); @@ -129,14 +129,14 @@ public Set keySet() { public Collection values() { return map.values(); } - + @Override public Set> entrySet() { return map.entrySet(); } } - + /* /********************************************************** /* Test methods, serialization @@ -154,7 +154,7 @@ public void testSerializeAsPOJOViaClass() throws Exception } // Can't yet use per-property overrides at all, see [databind#1419] - + /* public void testSerializeAsPOJOViaProperty() throws Exception { @@ -193,7 +193,7 @@ public void testRoundTrip() throws Exception assertEquals(result.property, input.property); assertEquals(input.getMap(), input.getMap()); } - + // [databind#1554] public void testDeserializeAsPOJOViaClass() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/interop/TestExternalizable.java b/src/test/java/com/fasterxml/jackson/databind/interop/TestExternalizable.java index 53845dbd9e..dab89c7e78 100644 --- a/src/test/java/com/fasterxml/jackson/databind/interop/TestExternalizable.java +++ b/src/test/java/com/fasterxml/jackson/databind/interop/TestExternalizable.java @@ -7,7 +7,7 @@ /** * Simple test to ensure that we can make POJOs use Jackson * for JDK serialization, via {@link Externalizable} - * + * * @since 2.1 */ public class TestExternalizable extends BaseMapTest @@ -37,12 +37,12 @@ public ExternalizableInput(ObjectInput in) { public int available() throws IOException { return in.available(); } - + @Override public void close() throws IOException { in.close(); } - + @Override public boolean markSupported() { return false; @@ -62,12 +62,12 @@ public int read(byte[] buffer) throws IOException { public int read(byte[] buffer, int offset, int len) throws IOException { return in.read(buffer, offset, len); } - + @Override public long skip(long n) throws IOException { return in.skip(n); } - } + } /** * Helper class we need to adapt {@link ObjectOutput} as @@ -80,7 +80,7 @@ final static class ExternalizableOutput extends OutputStream public ExternalizableOutput(ObjectOutput out) { this.out = out; } - + @Override public void flush() throws IOException { out.flush(); @@ -90,7 +90,7 @@ public void flush() throws IOException { public void close() throws IOException { out.close(); } - + @Override public void write(int ch) throws IOException { out.write(ch); @@ -100,13 +100,13 @@ public void write(int ch) throws IOException { public void write(byte[] data) throws IOException { out.write(data); } - + @Override public void write(byte[] data, int offset, int len) throws IOException { out.write(data, offset, len); } } - + // @com.fasterxml.jackson.annotation.JsonFormat(shape=com.fasterxml.jackson.annotation.JsonFormat.Shape.ARRAY) @SuppressWarnings("resource") static class MyPojo implements Externalizable @@ -142,12 +142,12 @@ public boolean equals(Object o) if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; - + MyPojo other = (MyPojo) o; - + if (other.id != id) return false; if (!other.name.equals(name)) return false; - + if (other.values.length != values.length) return false; for (int i = 0, end = values.length; i < end; ++i) { if (values[i] != other.values[i]) return false; @@ -178,7 +178,7 @@ public MyPojoNative(int id, String name, int[] values) this.values = values; } } - + @SuppressWarnings("unused") public void testSerializeAsExternalizable() throws Exception { @@ -196,7 +196,7 @@ public void testSerializeAsExternalizable() throws Exception if (ix < 0) { fail("Serialization ("+ser.length+") does NOT contain JSON (of "+json.length+")"); } - + // Sanity check: if (false) { bytes = new ByteArrayOutputStream(); @@ -206,13 +206,13 @@ public void testSerializeAsExternalizable() throws Exception obs.close(); System.out.println("Native size: "+bytes.size()+", vs JSON: "+ser.length); } - + // then read back! ObjectInputStream ins = new ObjectInputStream(new ByteArrayInputStream(ser)); MyPojo output = (MyPojo) ins.readObject(); ins.close(); assertNotNull(output); - + assertEquals(input, output); } diff --git a/src/test/java/com/fasterxml/jackson/databind/interop/TestFormatDetection.java b/src/test/java/com/fasterxml/jackson/databind/interop/TestFormatDetection.java index 60998008e8..dddc30219d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/interop/TestFormatDetection.java +++ b/src/test/java/com/fasterxml/jackson/databind/interop/TestFormatDetection.java @@ -9,14 +9,14 @@ public class TestFormatDetection extends BaseMapTest static class POJO { public int x, y; - + public POJO() { } public POJO(int x, int y) { this.x = x; this.y = y; } } - + /* /********************************************************** /* Test methods @@ -47,7 +47,7 @@ public void testSequenceWithJSON() throws Exception pojo = it.nextValue(); assertEquals(2, pojo.x); assertEquals(5, pojo.y); - + assertFalse(it.hasNextValue()); it.close(); diff --git a/src/test/java/com/fasterxml/jackson/databind/interop/TestJDKProxy.java b/src/test/java/com/fasterxml/jackson/databind/interop/TestJDKProxy.java index bf466d37b0..089279e26e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/interop/TestJDKProxy.java +++ b/src/test/java/com/fasterxml/jackson/databind/interop/TestJDKProxy.java @@ -20,27 +20,27 @@ static class Planet implements IPlanet { public Planet() { } public Planet(String s) { name = s; } - + @Override public String getName(){return name;} @Override public String setName(String iName) {name = iName; return name; } - } - + } + /* /******************************************************** /* Test methods /******************************************************** */ - + public void testSimple() throws Exception { IPlanet input = getProxy(IPlanet.class, new Planet("Foo")); String json = MAPPER.writeValueAsString(input); assertEquals("{\"name\":\"Foo\"}", json); - + // and just for good measure Planet output = MAPPER.readValue(json, Planet.class); assertEquals("Foo", output.getName()); diff --git a/src/test/java/com/fasterxml/jackson/databind/interop/UntypedObjectWithDupsTest.java b/src/test/java/com/fasterxml/jackson/databind/interop/UntypedObjectWithDupsTest.java index 999ca23846..239649bba4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/interop/UntypedObjectWithDupsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/interop/UntypedObjectWithDupsTest.java @@ -61,7 +61,7 @@ public void testDocWithDupsAsNonUntypedMap() throws Exception // Helper methods /////////////////////////////////////////////////////////////////////// */ - + /* Method that will verify default JSON behavior of overwriting value * (no merging). */ diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingForBuilderTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingForBuilderTest.java index e24c3b3261..ccd1b7d23d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingForBuilderTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingForBuilderTest.java @@ -42,7 +42,7 @@ public void testAccessorCustomWithMethod() throws Exception { final String json = a2q("{'x':28,'y':72}"); final ObjectMapper vanillaMapper = newJsonMapper(); - + // First: without custom strategy, will fail: try { ValueClassXY xy = vanillaMapper.readValue(json, ValueClassXY.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingStrategyTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingStrategyTest.java index 82dd40aa7b..529fc75da6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingStrategyTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/AccessorNamingStrategyTest.java @@ -37,13 +37,13 @@ static class MixedBean2800_X { public int getY() { return 3; } } - // Bean for checking optional + // Bean for checking optional @JsonPropertyOrder(alphabetic = true) static class FirstLetterVariesBean { // Do we allow lower-case letter as first letter following prefix? public boolean island() { return true; } - // Do we allow non-letter + // Do we allow non-letter public int get4Roses() { return 42; } // But good old upper-case letter is solid always... @@ -142,7 +142,7 @@ public void testFieldNaming() throws Exception /* Test methods, base provider impl /******************************************************** */ - + // Test to verify that the base naming impl works as advertised public void testBaseAccessorNaming() throws Exception { @@ -194,7 +194,7 @@ public void testBaseAccessorCustomSetter() throws Exception /* public boolean island() { return true; } - // Do we allow non-letter + // Do we allow non-letter public int get_lost() { return 42; } // But good old upper-case letter is solid always... diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/BeanDescriptionTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/BeanDescriptionTest.java index 6fbf5ad53b..c98451c0f5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/BeanDescriptionTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/BeanDescriptionTest.java @@ -8,12 +8,12 @@ public class BeanDescriptionTest extends BaseMapTest private final ObjectMapper MAPPER = newJsonMapper(); private final static String CLASS_DESC = "Description, yay!"; - + @JsonClassDescription(CLASS_DESC) static class DocumentedBean { public int x; } - + public void testClassDesc() throws Exception { BeanDescription beanDesc = MAPPER.getDeserializationConfig().introspect(MAPPER.constructType(DocumentedBean.class)); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/BeanNamingTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/BeanNamingTest.java index 27c028d92b..f14c99954f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/BeanNamingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/BeanNamingTest.java @@ -16,7 +16,7 @@ public int getA() { return 3; } } - + public void testSimple() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/IgnoredCreatorProperty1572Test.java b/src/test/java/com/fasterxml/jackson/databind/introspect/IgnoredCreatorProperty1572Test.java index 84d9f2cf19..ed7c91e950 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/IgnoredCreatorProperty1572Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/IgnoredCreatorProperty1572Test.java @@ -19,7 +19,7 @@ static class OuterTest @JsonIgnore String otherOtherStr; - + @JsonCreator public OuterTest(/*@JsonProperty("innerTest")*/ InnerTest inner, /*@JsonProperty("otherOtherStr")*/ String otherStr) { diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java index 750101d2c3..fca19aa1d7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/IntrospectorPairTest.java @@ -116,7 +116,7 @@ public boolean isAnnotationBundle(Annotation ann) { /****************************************************** /* General class annotations /****************************************************** - */ + */ @Override public PropertyName findRootName(AnnotatedClass ac) { @@ -137,7 +137,7 @@ public Boolean isIgnorableType(AnnotatedClass ac) { public Object findFilterId(Annotated ann) { return (Object) values.get("findFilterId"); } - + @Override public Object findNamingStrategy(AnnotatedClass ac) { return (Object) values.get("findNamingStrategy"); @@ -189,7 +189,7 @@ public TypeResolverBuilder findPropertyContentTypeResolver(MapperConfig co { return (TypeResolverBuilder) values.get("findPropertyContentTypeResolver"); } - + @SuppressWarnings("unchecked") @Override public List findSubtypes(Annotated a) @@ -238,7 +238,7 @@ public Boolean hasAnySetter(Annotated a) { /****************************************************** /* Helper methods /****************************************************** - */ + */ private boolean _boolean(String key) { Object ob = values.get(key); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/IsGetterRenaming2527Test.java b/src/test/java/com/fasterxml/jackson/databind/introspect/IsGetterRenaming2527Test.java index 7dc604030f..31b3a40849 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/IsGetterRenaming2527Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/IsGetterRenaming2527Test.java @@ -63,7 +63,7 @@ public PropertyName findRenameByField(MapperConfig config, return null; } } - + private final ObjectMapper MAPPER = jsonMapperBuilder() .annotationIntrospector(new MyIntrospector()) .build(); @@ -76,7 +76,7 @@ public void testIsPropertiesStdKotlin() throws Exception Map props = MAPPER.readValue(json, Map.class); assertEquals(Collections.singletonMap("isEnabled", Boolean.TRUE), props); - + POJO2527 output = MAPPER.readValue(json, POJO2527.class); assertEquals(input.isEnabled, output.isEnabled); } @@ -89,7 +89,7 @@ public void testIsPropertiesWithPublicField() throws Exception Map props = MAPPER.readValue(json, Map.class); assertEquals(Collections.singletonMap("isEnabled", Boolean.TRUE), props); - + POJO2527PublicField output = MAPPER.readValue(json, POJO2527PublicField.class); assertEquals(input.isEnabled, output.isEnabled); } @@ -102,7 +102,7 @@ public void testIsPropertiesViaCreator() throws Exception Map props = MAPPER.readValue(json, Map.class); assertEquals(Collections.singletonMap("isEnabled", Boolean.TRUE), props); - + POJO2527Creator output = MAPPER.readValue(json, POJO2527Creator.class); assertEquals(input.isEnabled, output.isEnabled); } diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollectorTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollectorTest.java index 11b6ee7248..73e1b63cab 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollectorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/POJOPropertiesCollectorTest.java @@ -16,7 +16,7 @@ public class POJOPropertiesCollectorTest { static class Simple { public int value; - + @JsonProperty("value") public void valueSetter(int v) { value = v; } @@ -28,18 +28,18 @@ static class SimpleFieldDeser { @JsonDeserialize String[] values; } - + static class SimpleGetterVisibility { public int getA() { return 0; } protected int getB() { return 1; } @SuppressWarnings("unused") private int getC() { return 2; } } - + // Class for testing 'shared ignore' static class Empty { public int value; - + public void setValue(int v) { value = v; } @JsonIgnore @@ -49,7 +49,7 @@ static class Empty { static class IgnoredSetter { @JsonProperty public int value; - + @JsonIgnore public void setValue(int v) { value = v; } @@ -61,18 +61,18 @@ static class ImplicitIgnores { @JsonIgnore public void setB(int b) { } public int c; } - + // Should find just one setter for "y", due to partial ignore static class IgnoredRenamedSetter { @JsonIgnore public void setY(int value) { } @JsonProperty("y") void foobar(int value) { } } - + // should produce a single property, "x" static class RenamedProperties { @JsonProperty("x") public int value; - + public void setValue(int v) { value = v; } public int getX() { return value; } @@ -84,11 +84,11 @@ static class RenamedProperties2 public int getValue() { return 1; } public void setValue(int x) { } } - + // Testing that we can "merge" properties with renaming static class MergedProperties { public int x; - + @JsonProperty("x") public void setFoobar(int v) { x = v; } } @@ -99,7 +99,7 @@ static class SortedProperties { public int b; public int c; - + public void setD(int value) { } public void setA(int value) { } } @@ -124,9 +124,9 @@ static class Jackson703 location.add(new FoodOrgLocation()); } - public List getLocation() { return location; } + public List getLocation() { return location; } } - + static class FoodOrgLocation { protected Long id; @@ -138,7 +138,7 @@ public FoodOrgLocation() { } public FoodOrgLocation(final Location foodOrg) { } - + public FoodOrgLocation(final Long id, final String name, final Location location) { } public Location getLocation() { return location; } @@ -165,13 +165,13 @@ class Issue701Bean { // important: non-static! static class Issue744Bean { protected Map additionalProperties; - + @JsonAnySetter public void addAdditionalProperty(String key, Object value) { if (additionalProperties == null) additionalProperties = new HashMap(); additionalProperties.put(key,value); } - + public void setAdditionalProperties(Map additionalProperties) { this.additionalProperties = additionalProperties; } @@ -194,7 +194,7 @@ static class PropDescBean public String a; protected int b; - + public String getA() { return a; } public void setA(String a) { this.a = a; } @@ -278,7 +278,7 @@ public void testSimpleGetterVisibility() assertTrue(prop.hasGetter()); assertFalse(prop.hasField()); } - + // Unit test for verifying that a single @JsonIgnore can remove the // whole property, unless explicit property marker exists public void testEmpty() @@ -343,7 +343,7 @@ public void testMergeWithRename() assertFalse(prop.hasGetter()); assertTrue(prop.hasField()); } - + public void testSimpleIgnoreAndRename() { POJOPropertiesCollector coll = collector(MAPPER, diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/PropertyMetadataTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/PropertyMetadataTest.java index 84dcc54cbf..c0f4b5d0a6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/PropertyMetadataTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/PropertyMetadataTest.java @@ -8,7 +8,7 @@ public class PropertyMetadataTest extends BaseMapTest public void testPropertyName() { PropertyName name = PropertyName.NO_NAME; - + assertFalse(name.hasSimpleName()); assertFalse(name.hasNamespace()); assertSame(name, name.internSimpleName()); @@ -73,7 +73,7 @@ public void testPropertyMetadata() md = md.withRequired(null); assertNull(md.getRequired()); assertFalse(md.isRequired()); - + assertFalse(md.hasIndex()); md = md.withIndex(Integer.valueOf(3)); assertTrue(md.hasIndex()); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/SetterConflictTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/SetterConflictTest.java index 30af9bea34..22d25bf4d2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/SetterConflictTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/SetterConflictTest.java @@ -38,7 +38,7 @@ public void setBloop(Object bloop) { // in favor of `String` but code up until 2.12 short-circuited early fail static class DupSetter3125Bean { String str; - + public void setValue(Integer value) { throw new RuntimeException("Integer: wrong!"); } public void setValue(Boolean value) { throw new RuntimeException("Boolean: wrong!"); } public void setValue(String value) { str = value; } @@ -55,7 +55,7 @@ static class DupSetter3125BeanFail { /* Test methods /********************************************************************** */ - + private final ObjectMapper MAPPER = newJsonMapper(); // [databind#1033] diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationBundles.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationBundles.java index fab1abff76..8f73357461 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationBundles.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationBundles.java @@ -28,7 +28,7 @@ public class TestAnnotationBundles extends com.fasterxml.jackson.databind.BaseMa protected final static class Bean { @MyIgnoral public String getIgnored() { return "foo"; } - + @MyRename public int renamed = 13; } @@ -42,7 +42,7 @@ protected final static class Bean { @JsonAutoDetectOff public class NoAutoDetect { public int getA() { return 13; } - + @JsonProperty public int getB() { return 5; } } @@ -82,7 +82,7 @@ static class RecursiveHolder3 { @HolderA public RecursiveHolder3(int x) { this.x = x; } } - + @JsonProperty @JacksonAnnotationsInside @Retention(RetentionPolicy.RUNTIME) @@ -135,7 +135,7 @@ public void testRecursiveBundlesConstructor() throws Exception { assertNotNull(result); assertEquals(17, result.x); } - + public void testBundledIgnore() throws Exception { assertEquals("{\"foobar\":13}", MAPPER.writeValueAsString(new Bean())); @@ -145,7 +145,7 @@ public void testVisibilityBundle() throws Exception { assertEquals("{\"b\":5}", MAPPER.writeValueAsString(new NoAutoDetect())); } - + public void testIssue92() throws Exception { assertEquals("{\"_id\":\"abc\"}", MAPPER.writeValueAsString(new Bean92())); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationMerging.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationMerging.java index 097cc4cada..a6b6c767e6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationMerging.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestAnnotationMerging.java @@ -17,7 +17,7 @@ static class Wrapper public Wrapper() { } public Wrapper(Object o) { value = o; } - + @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) public Object getValue() { return value; } @@ -29,7 +29,7 @@ static class SharedName { protected int value; public SharedName(int v) { value = v; } - + public int getValue() { return value; } } @@ -53,7 +53,7 @@ public TypeWrapper( } public Object getValue() { return value; } } - + /* /********************************************************** /* Unit tests @@ -74,7 +74,7 @@ public void testSharedNamesFromGetterToSetter() throws Exception SharedName2 result = mapper.readValue(json, SharedName2.class); assertNotNull(result); } - + public void testSharedTypeInfo() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestBuilderMethods.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestBuilderMethods.java index 85e350ce07..df2cb8cb97 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestBuilderMethods.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestBuilderMethods.java @@ -23,7 +23,7 @@ public SimpleBuilder withX(int x0) { */ private final ObjectMapper mapper = new ObjectMapper(); - + public void testSimple() { POJOPropertiesCollector coll = collector(SimpleBuilder.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestInferredMutators.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestInferredMutators.java index 6151653185..3253238531 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestInferredMutators.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestInferredMutators.java @@ -9,7 +9,7 @@ public class TestInferredMutators extends BaseMapTest { public static class Point { protected int x; - + public int getX() { return x; } } @@ -43,7 +43,7 @@ public void testFinalFieldIgnoral() throws Exception verifyException(e, "unrecognized field \"x\""); } } - + // for #195 public void testDeserializationInference() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestJacksonAnnotationIntrospector.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestJacksonAnnotationIntrospector.java index be89b54d44..f0f4b4462d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestJacksonAnnotationIntrospector.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestJacksonAnnotationIntrospector.java @@ -144,13 +144,13 @@ public String[] findEnumValues(Class enumType, Enum[] enumValues, String[ return names; } } - + /* /********************************************************** /* Unit tests /********************************************************** */ - + /** * tests getting serializer/deserializer instances. */ diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestNameConflicts.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestNameConflicts.java index 2b46af479f..422596cdf6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestNameConflicts.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestNameConflicts.java @@ -24,21 +24,21 @@ public void setBar(java.io.Serializable bar) { this.bar = bar.toString(); } } - + static class Bean193 { @JsonProperty("val1") private int x; @JsonIgnore private int value2; - + public Bean193(@JsonProperty("val1")int value1, @JsonProperty("val2")int value2) { this.x = value1; this.value2 = value2; } - + @JsonProperty("val2") int x() { @@ -71,13 +71,13 @@ public MultipleTheoreticalGetters() { } public MultipleTheoreticalGetters(@JsonProperty("a") int foo) { ; } - + @JsonProperty public int getA() { return 3; } public int a() { return 5; } } - + /* /********************************************************** /* Test methods @@ -85,7 +85,7 @@ public MultipleTheoreticalGetters(@JsonProperty("a") int foo) { */ private final ObjectMapper MAPPER = objectMapper(); - + // [Issue#193] public void testIssue193() throws Exception { @@ -98,7 +98,7 @@ public void testNonConflict() throws Exception { String json = MAPPER.writeValueAsString(new BogusConflictBean()); assertEquals(a2q("{'prop1':2,'prop2':1}"), json); - } + } public void testHypotheticalGetters() throws Exception { @@ -122,5 +122,5 @@ public void testOverrideName() throws Exception } assertNotNull(result); assertEquals("y", result.bar); - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestNamingStrategyCustom.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestNamingStrategyCustom.java index ed5f5c62a6..3b4936904b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestNamingStrategyCustom.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestNamingStrategyCustom.java @@ -46,7 +46,7 @@ public String nameForSetterMethod(MapperConfig config, return "Set-"+defaultName; } } - + static class CStyleStrategy extends PropertyNamingStrategy { @Override @@ -82,14 +82,14 @@ private String convert(String input) return result.toString(); } } - + static class GetterBean { public int getKey() { return 123; } } static class SetterBean { protected int value; - + public void setKey(int v) { value = v; } @@ -119,7 +119,7 @@ public PersonBean(String f, String l, int a) static class Value { public int intValue; - + public Value() { this(0); } public Value(int v) { intValue = v; } } @@ -143,13 +143,13 @@ public String translate(String propertyName) { return propertyName.toLowerCase(); } } - + static class RenamedCollectionBean { // @JsonDeserialize @JsonProperty private List theValues = Collections.emptyList(); - + // intentionally odd name, to be renamed by naming strategy public List getTheValues() { return theValues; } } @@ -159,17 +159,17 @@ static class RenamedCollectionBean static class BeanWithPrefixNames { protected int a = 3; - + public int getA() { return a; } public void setA(int value) { a = value; } } - + /* /********************************************************************** /* Test methods /********************************************************************** */ - + public void testSimpleGetters() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -205,7 +205,7 @@ public void testCStyleNaming() throws Exception mapper.setPropertyNamingStrategy(new CStyleStrategy()); String json = mapper.writeValueAsString(new PersonBean("Joe", "Sixpack", 42)); assertEquals("{\"first_name\":\"Joe\",\"last_name\":\"Sixpack\",\"age\":42}", json); - + // then deserialize PersonBean result = mapper.readValue(json, PersonBean.class); assertEquals("Joe", result.firstName); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyConflicts.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyConflicts.java index 989898a8b1..cfd546ce9a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyConflicts.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyConflicts.java @@ -23,7 +23,7 @@ protected static class Getters1A { @JsonProperty protected int value = 3; - + public int getValue() { return value+1; } public boolean isValue() { return false; } } @@ -36,7 +36,7 @@ protected static class Getters1B @JsonProperty protected int value = 3; - + public int getValue() { return value+1; } } @@ -96,13 +96,13 @@ public void testFailWithDupProps() throws Exception } catch (InvalidDefinitionException e) { verifyException(e, "Conflicting getter definitions"); } - } + } // [databind#238]: ok to have getter, "isGetter" public void testRegularAndIsGetter() throws Exception { final ObjectWriter writer = objectWriter(); - + // first, serialize without probs: assertEquals("{\"value\":4}", writer.writeValueAsString(new Getters1A())); assertEquals("{\"value\":4}", writer.writeValueAsString(new Getters1B())); @@ -121,7 +121,7 @@ public void testInferredNameConflictsWithGetters() throws Exception String json = mapper.writeValueAsString(new Infernal()); assertEquals(a2q("{'name':'Bob'}"), json); } - + public void testInferredNameConflictsWithSetters() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyRename.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyRename.java index b6b05f9e9e..7a7c1d2382 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyRename.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestPropertyRename.java @@ -9,7 +9,7 @@ */ public class TestPropertyRename extends BaseMapTest { - static class Bean323WithIgnore { + static class Bean323WithIgnore { @JsonIgnore private int a; @@ -21,10 +21,10 @@ public Bean323WithIgnore(@JsonProperty("a") final int a ) { private int getA () { return a; } - } + } @JsonPropertyOrder({ "a","b" }) - static class Bean323WithExplicitCleave1 { + static class Bean323WithExplicitCleave1 { @JsonProperty("a") private int a; @@ -36,10 +36,10 @@ public Bean323WithExplicitCleave1(@JsonProperty("a") final int a ) { private int getA () { return a; } - } + } @JsonPropertyOrder({ "a","b" }) - static class Bean323WithExplicitCleave2 { + static class Bean323WithExplicitCleave2 { @JsonProperty("b") private int a; @@ -51,8 +51,8 @@ public Bean323WithExplicitCleave2(@JsonProperty("a") final int a ) { private int getA () { return a; } - } - + } + /* /********************************************************** /* Test methods diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TestScalaLikeImplicitProperties.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TestScalaLikeImplicitProperties.java index 397db2fa49..04a01c6ba9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TestScalaLikeImplicitProperties.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TestScalaLikeImplicitProperties.java @@ -181,7 +181,7 @@ public void testGetterSetterProperty() throws Exception /* Helper methods /********************************************************** */ - + private ObjectMapper manglingMapper() { ObjectMapper m = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/TransientTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/TransientTest.java index 289268534f..473e5bce72 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/TransientTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/TransientTest.java @@ -28,7 +28,7 @@ static class SimplePrunableTransient { public int a = 1; public transient int b = 2; } - + // for [databind#857] static class BeanTransient { @Transient diff --git a/src/test/java/com/fasterxml/jackson/databind/introspect/VisibilityForSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/introspect/VisibilityForSerializationTest.java index 175a10486d..b6fed73bfc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/introspect/VisibilityForSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/introspect/VisibilityForSerializationTest.java @@ -156,7 +156,7 @@ public void testVisibilityFeatures() throws Exception .configure(MapperFeature.USE_ANNOTATIONS, true) .build(); - JavaType javaType = om.getTypeFactory().constructType(TCls.class); + JavaType javaType = om.getTypeFactory().constructType(TCls.class); BeanDescription desc = (BeanDescription) om.getSerializationConfig().introspect(javaType); List props = desc.findProperties(); if (props.size() != 1) { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java index 75f6f6acf2..9cd9311471 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsonschema/NewSchemaTest.java @@ -22,7 +22,7 @@ public class NewSchemaTest extends BaseMapTest { enum TestEnum { A, B, C; - + @Override public String toString() { return "ToString:"+name(); @@ -31,7 +31,7 @@ public String toString() { enum TestEnumWithJsonValue { A, B, C; - + @JsonValue public String forSerialize() { return "value-"+name(); @@ -110,7 +110,7 @@ static class BogusJsonFormatVisitorWrapper extends JsonFormatVisitorWrapper.Base { // Implement handlers just to get more exercise... - + @Override public JsonObjectFormatVisitor expectObjectFormat(JavaType type) { return new JsonObjectFormatVisitor.Base(getProvider()) { @@ -196,7 +196,7 @@ public JsonAnyFormatVisitor expectAnyFormat(JavaType type) { @Override public JsonMapFormatVisitor expectMapFormat(JavaType type) { return new JsonMapFormatVisitor.Base(); - } + } } /* @@ -296,7 +296,7 @@ public void testJsonValueFormatHandling() throws Exception public void testSimpleNumbers() throws Exception { final StringBuilder sb = new StringBuilder(); - + MAPPER.acceptJsonFormatVisitor(Numbers.class, new JsonFormatVisitorWrapper.Base() { @Override diff --git a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java b/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java index faacf0b2f2..c6afc6dd99 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsonschema/TestGenerateJsonSchema.java @@ -74,7 +74,7 @@ public void setProperty4(Collection property4) { this.property4 = property4; } - + public String getProperty5() { return property5; @@ -115,7 +115,7 @@ static class Numbers { public BigDecimal dec; public BigInteger bigInt; } - + /* /********************************************************** /* Unit tests @@ -123,14 +123,14 @@ static class Numbers { */ private final ObjectMapper MAPPER = newJsonMapper(); - + /** * tests generating json-schema stuff. */ public void testOldSchemaGeneration() throws Exception { JsonSchema jsonSchema = MAPPER.generateJsonSchema(SimpleBean.class); - + assertNotNull(jsonSchema); // test basic equality, and that equals() handles null, other obs @@ -176,23 +176,23 @@ public void testOldSchemaGeneration() throws Exception assertEquals("integer", property6Schema.get("type").asText()); assertEquals(false, property6Schema.path("required").booleanValue()); } - + @JsonFilter("filteredBean") protected static class FilteredBean { - + @JsonProperty private String secret = "secret"; - + @JsonProperty private String obvious = "obvious"; - + public String getSecret() { return secret; } public void setSecret(String s) { secret = s; } - + public String getObvious() { return obvious; } public void setObvious(String s) {obvious = s; } } - + final static FilterProvider secretFilterProvider = new SimpleFilterProvider() .addFilter("filteredBean", SimpleBeanPropertyFilter.filterOutAllExcept(new String[]{"obvious"})); @@ -255,7 +255,7 @@ public void testUnwrapping() throws Exception assertEquals(lastType, "string"); } - // + // public void testNumberTypes() throws Exception { JsonSchema jsonSchema = MAPPER.generateJsonSchema(Numbers.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ExistingPropertyTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ExistingPropertyTest.java index c55d07a154..b2f498c463 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ExistingPropertyTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ExistingPropertyTest.java @@ -21,7 +21,7 @@ public class ExistingPropertyTest extends BaseMapTest visible=true) @JsonSubTypes({ @Type(value = Apple.class, name = "apple") , - @Type(value = Orange.class, name = "orange") + @Type(value = Orange.class, name = "orange") }) static abstract class Fruit { public String name; @@ -70,13 +70,13 @@ public FruitWrapper() {} @JsonTypeInfo(use = Id.NAME, include = As.EXISTING_PROPERTY, property = "type") @JsonSubTypes({ @Type(value = Dog.class, name = "doggie") , - @Type(value = Cat.class, name = "kitty") + @Type(value = Cat.class, name = "kitty") }) static abstract class Animal { public String name; - + protected Animal(String n) { name = n; } - + public abstract String getType(); } @@ -84,34 +84,34 @@ static abstract class Animal { static class Dog extends Animal { public int boneCount; - + private Dog() { super(null); } public Dog(String name, int b) { super(name); boneCount = b; } - + @Override public String getType() { return "doggie"; - } + } } @JsonTypeName("kitty") static class Cat extends Animal { public String furColor; - + private Cat() { super(null); } public Cat(String name, String c) { super(name); furColor = c; } - + @Override public String getType() { return "kitty"; - } + } } static class AnimalWrapper { @@ -126,10 +126,10 @@ public AnimalWrapper() {} @JsonTypeInfo(use = Id.NAME, include = As.EXISTING_PROPERTY, property = "type") @JsonSubTypes({ @Type(value = Accord.class, name = "accord") , - @Type(value = Camry.class, name = "camry") + @Type(value = Camry.class, name = "camry") }) static abstract class Car { - public String name; + public String name; protected Car(String n) { name = n; } } @@ -137,32 +137,32 @@ static abstract class Car { static class Accord extends Car { public int speakerCount; - + private Accord() { super(null); } public Accord(String name, int b) { super(name); speakerCount = b; } - + public String getType() { return "accord"; - } + } } @JsonTypeName("camry") static class Camry extends Car { public String exteriorColor; - + private Camry() { super(null); } public Camry(String name, String c) { super(name); exteriorColor = c; } - + public String getType() { return "camry"; - } + } } static class CarWrapper { @@ -214,8 +214,8 @@ static class DefaultShape3271 extends Shape3271 {} */ private static final Orange mandarin = new Orange("Mandarin Orange", "orange"); - private static final String mandarinJson = "{\"name\":\"Mandarin Orange\",\"color\":\"orange\",\"type\":\"orange\"}"; - private static final Apple pinguo = new Apple("Apple-A-Day", 16); + private static final String mandarinJson = "{\"name\":\"Mandarin Orange\",\"color\":\"orange\",\"type\":\"orange\"}"; + private static final Apple pinguo = new Apple("Apple-A-Day", 16); private static final String pinguoJson = "{\"name\":\"Apple-A-Day\",\"seedCount\":16,\"type\":\"apple\"}"; private static final FruitWrapper pinguoWrapper = new FruitWrapper(pinguo); private static final String pinguoWrapperJson = "{\"fruit\":" + pinguoJson + "}"; @@ -223,7 +223,7 @@ static class DefaultShape3271 extends Shape3271 {} private static final String fruitListJson = "[" + pinguoJson + "," + mandarinJson + "]"; private static final Cat beelzebub = new Cat("Beelzebub", "tabby"); - private static final String beelzebubJson = "{\"name\":\"Beelzebub\",\"furColor\":\"tabby\",\"type\":\"kitty\"}"; + private static final String beelzebubJson = "{\"name\":\"Beelzebub\",\"furColor\":\"tabby\",\"type\":\"kitty\"}"; private static final Dog rover = new Dog("Rover", 42); private static final String roverJson = "{\"name\":\"Rover\",\"boneCount\":42,\"type\":\"doggie\"}"; private static final AnimalWrapper beelzebubWrapper = new AnimalWrapper(beelzebub); @@ -232,7 +232,7 @@ static class DefaultShape3271 extends Shape3271 {} private static final String animalListJson = "[" + beelzebubJson + "," + roverJson + "]"; private static final Camry camry = new Camry("Sweet Ride", "candy-apple-red"); - private static final String camryJson = "{\"name\":\"Sweet Ride\",\"exteriorColor\":\"candy-apple-red\",\"type\":\"camry\"}"; + private static final String camryJson = "{\"name\":\"Sweet Ride\",\"exteriorColor\":\"candy-apple-red\",\"type\":\"camry\"}"; private static final Accord accord = new Accord("Road Rage", 6); private static final String accordJson = "{\"name\":\"Road Rage\",\"speakerCount\":6,\"type\":\"accord\"}"; private static final CarWrapper camryWrapper = new CarWrapper(camry); @@ -258,13 +258,13 @@ public void testExistingPropertySerializationFruits() throws Exception assertEquals(pinguo.name, result.get("name")); assertEquals(pinguo.seedCount, result.get("seedCount")); assertEquals(pinguo.type, result.get("type")); - + result = writeAndMap(MAPPER, mandarin); assertEquals(3, result.size()); assertEquals(mandarin.name, result.get("name")); assertEquals(mandarin.color, result.get("color")); assertEquals(mandarin.type, result.get("type")); - + String pinguoSerialized = MAPPER.writeValueAsString(pinguo); assertEquals(pinguoSerialized, pinguoJson); @@ -304,7 +304,7 @@ public void testSimpleClassAsExistingPropertyDeserializationFruits() throws Exce assertEquals("apple", ((Apple) fruits[0]).type); assertEquals(Orange.class, fruits[1].getClass()); assertEquals("orange", ((Orange) fruits[1]).type); - + List f2 = MAPPER.readValue(fruitListJson, new TypeReference>() { }); assertNotNull(f2); @@ -329,13 +329,13 @@ public void testExistingPropertySerializationAnimals() throws Exception assertEquals(rover.name, result.get("name")); assertEquals(rover.boneCount, result.get("boneCount")); assertEquals(rover.getType(), result.get("type")); - + String beelzebubSerialized = MAPPER.writeValueAsString(beelzebub); assertEquals(beelzebubSerialized, beelzebubJson); - + String roverSerialized = MAPPER.writeValueAsString(rover); assertEquals(roverSerialized, roverJson); - + String animalWrapperSerialized = MAPPER.writeValueAsString(beelzebubWrapper); assertEquals(animalWrapperSerialized, beelzebubWrapperJson); @@ -362,7 +362,7 @@ public void testSimpleClassAsExistingPropertyDeserializationAnimals() throws Exc assertEquals(beelzebub.name, beelzebubExtracted.name); assertEquals(beelzebub.furColor, ((Cat) beelzebubExtracted).furColor); assertEquals(beelzebub.getType(), beelzebubExtracted.getType()); - + @SuppressWarnings("unchecked") List animalListDeserialized = MAPPER.readValue(animalListJson, List.class); assertNotNull(animalListDeserialized); @@ -397,7 +397,7 @@ public void testExistingPropertySerializationCars() throws Exception String accordSerialized = MAPPER.writeValueAsString(accord); assertEquals(accordSerialized, accordJson); - + String carWrapperSerialized = MAPPER.writeValueAsString(camryWrapper); assertEquals(carWrapperSerialized, camryWrapperJson); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/Generic1128Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/Generic1128Test.java index 6f3fe37e30..de1716e582 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/Generic1128Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/Generic1128Test.java @@ -22,7 +22,7 @@ static class DevBase extends HObj { // for some reason, setter is needed to expose this... public void setTag(String t) { tag = t; } - + //public String getTag() { return tag; } } @@ -57,7 +57,7 @@ public void testIssue1128() throws Exception parent.id = 2L; entity.parent = parent; devMContainer1.entity = entity; - + String json = mapper.writeValueAsString(devMContainer1); // System.out.println("serializedContainer = " + json); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericNestedType2331Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericNestedType2331Test.java index 2bfcfa013b..a223094b55 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericNestedType2331Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericNestedType2331Test.java @@ -11,7 +11,7 @@ public class GenericNestedType2331Test extends BaseMapTest { static class SuperNode { } static class SuperTestClass { } - + @SuppressWarnings("serial") static class Node extends SuperNode> implements Serializable { @@ -28,7 +28,7 @@ public Node() { public List>> getChildren() { return children; } - } + } @SuppressWarnings({ "rawtypes", "unchecked" }) public void testGeneric2331() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericTypeId1735Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericTypeId1735Test.java index 75fe94aa80..7ef98b007f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericTypeId1735Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/GenericTypeId1735Test.java @@ -36,7 +36,7 @@ public void setValue(String str) { private final ObjectMapper MAPPER = objectMapper(); private final static String NEF_CLASS = Nefarious1735.class.getName(); - + // Existing checks should kick in fine public void testSimpleTypeCheck1735() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCaseInsensitive1983Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCaseInsensitive1983Test.java index 5796e4bb2b..abac6bf766 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCaseInsensitive1983Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCaseInsensitive1983Test.java @@ -24,7 +24,7 @@ static class NotEqual extends Filter { } // verify failures when exact matching required: private final ObjectMapper MAPPER = newJsonMapper(); - + public void testReadMixedCaseSubclass() throws Exception { final String serialised = "{\"Operation\":\"NoTeQ\"}"; diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCustomResolver2811Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCustomResolver2811Test.java index e8686b5717..b608d368de 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCustomResolver2811Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/JsonTypeInfoCustomResolver2811Test.java @@ -84,7 +84,7 @@ public JsonTypeInfo.Id getMechanism() { .disable(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY) .disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) .build(); - + // [databind#2811] public void testTypeInfoWithCustomResolver2811NoTypeId() throws Exception { @@ -100,13 +100,13 @@ public void testTypeInfoWithCustomResolver2811NoTypeId() throws Exception /* public void testTypeInfoWithCustomResolver2811WithTypeId() throws Exception { - String json = "{\n" + - " \"name\": \"kamil\",\n" + - " \"vehicleType\": \"CAR\",\n" + - " \"vehicle\": {\n" + - " \"wheels\": 4,\n" + - " \"color\": \"red\"\n" + - " }\n" + + String json = "{\n" + + " \"name\": \"kamil\",\n" + + " \"vehicleType\": \"CAR\",\n" + + " \"vehicle\": {\n" + + " \"wheels\": 4,\n" + + " \"color\": \"red\"\n" + + " }\n" + "}" ; Person person = MAPPER.readValue(json, Person.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/NoTypeInfoTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/NoTypeInfoTest.java index 55d60b0180..e5c742412c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/NoTypeInfoTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/NoTypeInfoTest.java @@ -12,7 +12,7 @@ public class NoTypeInfoTest extends BaseMapTest @JsonDeserialize(as=NoType.class) static interface NoTypeInterface { } - + final static class NoType implements NoTypeInterface { public int a = 3; } diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicDeserErrorHandlingTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicDeserErrorHandlingTest.java index b02ba248e0..8facf27153 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicDeserErrorHandlingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicDeserErrorHandlingTest.java @@ -39,7 +39,7 @@ static class Child2 extends Parent2668 { /* Test methods /********************************************************************** */ - + private final ObjectMapper MAPPER = newJsonMapper(); public void testUnknownClassAsSubtype() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicList1451SerTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicList1451SerTest.java index 4afdabfd7a..737ba81958 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicList1451SerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicList1451SerTest.java @@ -34,7 +34,7 @@ public void testCollectionWithTypeInfo() throws Exception { b.a = "a2"; input.add(b); - final TypeReference typeRef = + final TypeReference typeRef = new TypeReference>(){}; ObjectWriter writer = mapper.writerFor(typeRef); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicViaRefTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicViaRefTypeTest.java index ffd2fe68c6..e6141d3e36 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicViaRefTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/PolymorphicViaRefTypeTest.java @@ -11,7 +11,7 @@ public class PolymorphicViaRefTypeTest extends BaseMapTest { - + @JsonSubTypes({ @JsonSubTypes.Type(name = "impl5", value = ImplForAtomic.class) }) diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/SubTypeResolutionTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/SubTypeResolutionTest.java index 7c5def8b90..197894b77d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/SubTypeResolutionTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/SubTypeResolutionTest.java @@ -107,7 +107,7 @@ public void testTypeCompatibility1964() throws Exception Collection values = new HashSet<>(); values.add("ARTIFACTS_RESOLVE"); repoPrivilegesMap.put(key, values); - + AccessModel accessModel = new AccessModel(); accessModel.setRepositoryPrivileges(repoPrivilegesMap); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestAbstractTypeNames.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestAbstractTypeNames.java index 4070ac6752..b9cf9e6b1b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestAbstractTypeNames.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestAbstractTypeNames.java @@ -113,7 +113,7 @@ public void testEmptyCollection() throws Exception mapper = new ObjectMapper(); mapper.registerSubtypes(DefaultEmployee.class); mapper.registerSubtypes(DefaultUser.class); - + User result = mapper.readValue(json, User.class); assertNotNull(result); assertEquals(DefaultEmployee.class, result.getClass()); @@ -123,7 +123,7 @@ public void testEmptyCollection() throws Exception assertEquals(DefaultUser.class, friends.get(0).getClass()); assertEquals(DefaultEmployee.class, friends.get(1).getClass()); } - + // [JACKSON-584]: change anonymous non-static inner type into static type: public void testInnerClassWithType() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestCustomTypeIdResolver.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestCustomTypeIdResolver.java index 25ebfd571d..7a66dd808a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestCustomTypeIdResolver.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestCustomTypeIdResolver.java @@ -19,7 +19,7 @@ static abstract class CustomBean { } static class CustomBeanImpl extends CustomBean { public int x; - + public CustomBeanImpl() { } public CustomBeanImpl(int x) { this.x = x; } } @@ -45,16 +45,16 @@ public void init(JavaType baseType) { } } } - + static abstract class ExtBean { } static class ExtBeanImpl extends ExtBean { public int y; - + public ExtBeanImpl() { } public ExtBeanImpl(int y) { this.y = y; } } - + static class ExtResolver extends TestCustomResolverBase { public ExtResolver() { super(ExtBean.class, ExtBeanImpl.class); @@ -128,7 +128,7 @@ public Resolver1270() { } @Override public void init(JavaType baseType) { } - + @Override public String idFromValue(Object value) { if (value.getClass() == Base1270.class) { @@ -203,7 +203,7 @@ public void testCustomWithExternal() throws Exception ExtBeanWrapper out = MAPPER.readValue(json, ExtBeanWrapper.class); assertNotNull(out); - + assertEquals(12, ((ExtBeanImpl) out.value).y); } diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestGenericListSerialization.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestGenericListSerialization.java index 3f25e3f8e0..aa5bcc6343 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestGenericListSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestGenericListSerialization.java @@ -25,7 +25,7 @@ public T getResult() { public void setResult(T result) { this.result = result; } - } + } @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class") public static class Parent { @@ -60,7 +60,7 @@ public void testSubTypesFor356() throws Exception JavaType rootType = TypeFactory.defaultInstance().constructType(new TypeReference>>() { }); byte[] json = mapper.writerFor(rootType).writeValueAsBytes(input); - + JSONResponse> out = mapper.readValue(json, 0, json.length, rootType); List deserializedContent = out.getResult(); @@ -77,5 +77,5 @@ public void testSubTypesFor356() throws Exception assertEquals("CHILD1", ((Child1) deserializedContent.get(0)).childContent1); assertEquals("CHILD2", ((Child2) deserializedContent.get(1)).childContent2); } - + } diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestOverlappingTypeIdNames.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestOverlappingTypeIdNames.java index 5534a87dfc..7f5ae4ab99 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestOverlappingTypeIdNames.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestOverlappingTypeIdNames.java @@ -40,7 +40,7 @@ public void testOverlappingNameDeser() throws Exception assertNotNull(value); assertEquals(Impl312.class, value.getClass()); assertEquals(7, ((Impl312) value).x); - + value = MAPPER.readValue(a2q("{'type':'b','x':3}"), Base312.class); assertNotNull(value); assertEquals(Impl312.class, value.getClass()); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java index 1761cd2b9b..04f07c1210 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl.java @@ -81,7 +81,7 @@ public static class Good { public static class Bad { public List many; } - + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonSubTypes({@JsonSubTypes.Type(name="sub1", value = GoodSub1.class), @@ -124,7 +124,7 @@ public Event() {} @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "clazz") - abstract static class BaseClass { } + abstract static class BaseClass { } static class BaseWrapper { public BaseClass value; diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl1565.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl1565.java index 8531b7f7ce..e309e071bf 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl1565.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPolymorphicWithDefaultImpl1565.java @@ -22,7 +22,7 @@ public static interface CTestInterface1565 static class CBaseClass1565 implements CTestInterface1565 { private String mName; - + @Override public String getName() { return(mName); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPropertyTypeInfo.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPropertyTypeInfo.java index 5d68ce83b6..c5b07be40b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPropertyTypeInfo.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestPropertyTypeInfo.java @@ -41,21 +41,21 @@ static class FieldWrapperBeanArray { public FieldWrapperBeanArray() { } public FieldWrapperBeanArray(FieldWrapperBean[] beans) { this.beans = beans; } } - + static class MethodWrapperBean { protected Object value; - + @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_ARRAY) public Object getValue() { return value; } @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_ARRAY) public void setValue(Object v) { value = v; } - + public MethodWrapperBean() { } public MethodWrapperBean(Object o) { value = o; } } - + static class MethodWrapperBeanList extends ArrayList { } static class MethodWrapperBeanMap extends HashMap { } static class MethodWrapperBeanArray { @@ -66,7 +66,7 @@ static class MethodWrapperBeanArray { @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_ARRAY) public void setValue(MethodWrapperBean[] v) { beans = v; } - + public MethodWrapperBeanArray() { } public MethodWrapperBeanArray(MethodWrapperBean[] beans) { this.beans = beans; } } @@ -74,7 +74,7 @@ public MethodWrapperBeanArray() { } static class OtherBean { public int x = 1, y = 1; } - + /* /********************************************************** /* Unit tests @@ -169,7 +169,7 @@ public void testSimpleArrayMethod() throws Exception assertEquals(StringWrapper.class, bean.value.getClass()); assertEquals(((StringWrapper) bean.value).str, "A"); } - + public void testSimpleMapField() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestSubtypes.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestSubtypes.java index 72da4b5f32..5a7114eea3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestSubtypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestSubtypes.java @@ -376,7 +376,7 @@ public void testDefaultImplViaModule() throws Exception assertEquals(DefaultImpl505.class, bean.getClass()); assertEquals(0, ((DefaultImpl505) bean).a); } - + public void testErrorMessage() throws Exception { ObjectMapper mapper = new ObjectMapper(); try { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypeNames.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypeNames.java index 735b22d3c7..0c16dceacc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypeNames.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypeNames.java @@ -32,7 +32,7 @@ static class A1616 extends Base1616 { } @JsonTypeName("B") static class B1616 extends Base1616 { } - + /* /********************************************************** /* Unit tests @@ -58,13 +58,13 @@ public void testBaseTypeId1616() throws Exception } } } - + public void testSerialization() throws Exception { // Note: need to use wrapper array just so that we can define // static type on serialization. If we had root static types, // could use those; but at the moment root type is dynamic - + assertEquals("[{\"doggy\":{\"name\":\"Spot\",\"ageInYears\":3}}]", MAPPER.writeValueAsString(new Animal[] { new Dog("Spot", 3) })); assertEquals("[{\"MaineCoon\":{\"name\":\"Belzebub\",\"purrs\":true}}]", diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedDeserialization.java index 15b3c2f0ff..c79697fa87 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedDeserialization.java @@ -26,7 +26,7 @@ public class TestTypedDeserialization @JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY, property="@classy") static abstract class Animal { public String name; - + protected Animal(String n) { name = n; } } @@ -34,7 +34,7 @@ static abstract class Animal { static class Dog extends Animal { public int boneCount; - + @JsonCreator public Dog(@JsonProperty("name") String name) { super(name); @@ -42,7 +42,7 @@ public Dog(@JsonProperty("name") String name) { public void setBoneCount(int i) { boneCount = i; } } - + @JsonTypeName("kitty") static class Cat extends Animal { @@ -106,7 +106,7 @@ static class DummyImpl extends DummyBase { public DummyImpl() { super(true); } } - + @JsonTypeInfo(use=Id.MINIMAL_CLASS, include=As.WRAPPER_OBJECT) interface TypeWithWrapper { } @@ -146,7 +146,7 @@ static class Issue1751PropImpl implements Issue1751PropBase { } */ private final ObjectMapper MAPPER = newJsonMapper(); - + /** * First things first, let's ensure we can serialize using * class name, written as main-level property name @@ -209,7 +209,7 @@ public void testListAsArray() throws Exception +",\n" +asJSONObjectValueString(m, "@classy", Fish.class.getName()) +", null\n]"; - + JavaType expType = TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, Animal.class); List animals = m.readValue(JSON, expType); assertNotNull(animals); @@ -263,7 +263,7 @@ public void testIssue506WithDate() throws Exception Issue506DateBean output = MAPPER.readValue(json, Issue506DateBean.class); assertEquals(input.date, output.date); } - + // [JACKSON-506], wrt Number public void testIssue506WithNumber() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedSerialization.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedSerialization.java index e96a06a244..d846c78579 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestTypedSerialization.java @@ -24,7 +24,7 @@ public class TestTypedSerialization @JsonTypeInfo(use=Id.CLASS, include=As.PROPERTY) static abstract class Animal { public String name; - + protected Animal(String n) { name = n; } } @@ -32,19 +32,19 @@ static abstract class Animal { static class Dog extends Animal { public int boneCount; - + private Dog() { super(null); } public Dog(String name, int b) { super(name); boneCount = b; } } - + @JsonTypeName("kitty") static class Cat extends Animal { public String furColor; - + private Cat() { super(null); } public Cat(String name, String c) { super(name); @@ -54,7 +54,7 @@ public Cat(String name, String c) { public class AnimalWrapper { public Animal animal; - + public AnimalWrapper(Animal a) { animal = a; } } @@ -80,7 +80,7 @@ public class B extends Super {} */ private final ObjectMapper MAPPER = new ObjectMapper(); - + /** * First things first, let's ensure we can serialize using * class name, written as main-level property name @@ -141,7 +141,7 @@ public void testTypeAsArray() throws Exception * being added to Animal entries, because Object.class has no type. * If type information is included, it will not be useful for deserialization, * since static type does not carry through (unlike in serialization). - * + * * But it is not quite clear how type information should be pushed through * array types... */ @@ -152,7 +152,7 @@ public void testInArray() throws Exception ObjectMapper m = new ObjectMapper(); // ... so this should NOT be needed... m.deactivateDefaultTyping(); - + Animal[] animals = new Animal[] { new Cat("Miuku", "white"), new Dog("Murre", 9) }; Map map = new HashMap(); map.put("a", animals); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestVisibleTypeId.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestVisibleTypeId.java index 331bb3dfb4..0b4968e8c7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestVisibleTypeId.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestVisibleTypeId.java @@ -58,7 +58,7 @@ static class ExternalIdBean { } // // // [JACKSON-762]: type id from property - + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type") static class TypeIdFromFieldProperty { @@ -80,7 +80,7 @@ static class TypeIdFromFieldArray { property="type") static class TypeIdFromMethodObject { public int a = 3; - + @JsonTypeId public String getType() { return "SomeType"; } } @@ -123,7 +123,7 @@ public static class I263Impl extends I263Base { @Override public String getName() { return "bob"; } - + public int age = 41; } @@ -131,7 +131,7 @@ public static class I263Impl extends I263Base static class ExternalBeanWithId { protected String _type; - + @JsonTypeInfo(use=Id.NAME, include=As.EXTERNAL_PROPERTY, property="type", visible=true) public ValueBean bean; @@ -148,11 +148,11 @@ public void setType(String t) { @JsonTypeName("vbean") static class ValueBean { public int value; - + public ValueBean() { } public ValueBean(int v) { value = v; } } - + /* /********************************************************** /* Unit tests, success @@ -160,7 +160,7 @@ public ValueBean() { } */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testVisibleWithProperty() throws Exception { String json = MAPPER.writeValueAsString(new PropertyBean()); @@ -219,14 +219,14 @@ public void testTypeIdFromExternal() throws Exception String json = MAPPER.writeValueAsString(new ExternalIdWrapper2()); // Implementation detail: type id written AFTER value, due to constraints assertEquals("{\"bean\":{\"a\":2},\"type\":\"SomeType\"}", json); - + } - + public void testIssue263() throws Exception { // first, serialize: assertEquals("{\"name\":\"bob\",\"age\":41}", MAPPER.writeValueAsString(new I263Impl())); - + // then bring back: I263Base result = MAPPER.readValue("{\"age\":19,\"name\":\"bob\"}", I263Base.class); assertTrue(result instanceof I263Impl); @@ -247,7 +247,7 @@ public void testVisibleTypeId408() throws Exception assertEquals(3, result.bean.value); assertEquals("vbean", result._type); } - + /* /********************************************************** /* Unit tests, fails diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestWithGenerics.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestWithGenerics.java index afebf4bdd5..ba1b486dfa 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TestWithGenerics.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TestWithGenerics.java @@ -19,7 +19,7 @@ public class TestWithGenerics extends BaseMapTest @JsonSubTypes( { @Type(value = Dog.class, name = "doggy") }) static abstract class Animal { public String name; - } + } static class Dog extends Animal { public int boneCount; @@ -44,13 +44,13 @@ static class ContainerWithField { public ContainerWithField(T a) { animal = a; } } - + static class WrappedContainerWithField { public ContainerWithField animalContainer; } // Beans for [JACKSON-387], [JACKSON-430] - + @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@classAttr1") static class MyClass { public List> params = new ArrayList>(); @@ -67,26 +67,26 @@ public MyParam() { } static class SomeObject { public String someValue = UUID.randomUUID().toString(); } - + // Beans for [JACKSON-430] - + static class CustomJsonSerializer extends JsonSerializer implements ResolvableSerializer { private final JsonSerializer beanSerializer; - + public CustomJsonSerializer( JsonSerializer beanSerializer ) { this.beanSerializer = beanSerializer; } - + @Override public void serialize( Object value, JsonGenerator jgen, SerializerProvider provider ) throws IOException { beanSerializer.serialize( value, jgen, provider ); } - + @Override public Class handledType() { return beanSerializer.handledType(); } - + @Override public void serializeWithType( Object value, JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer ) throws IOException @@ -102,7 +102,7 @@ public void resolve(SerializerProvider provider) throws JsonMappingException } } } - + @SuppressWarnings("serial") protected static class CustomJsonSerializerFactory extends BeanSerializerFactory { @@ -112,7 +112,7 @@ protected static class CustomJsonSerializerFactory extends BeanSerializerFactory protected JsonSerializer constructBeanOrAddOnSerializer(SerializerProvider prov, JavaType type, BeanDescription beanDesc, boolean staticTyping) throws JsonMappingException - { + { return new CustomJsonSerializer(super.constructBeanOrAddOnSerializer(prov, type, beanDesc, staticTyping) ); } } @@ -120,7 +120,7 @@ protected JsonSerializer constructBeanOrAddOnSerializer(SerializerProvid // [databind#543] static class ContainerWithTwoAnimals extends ContainerWithField { public V otherAnimal; - + public ContainerWithTwoAnimals(U a1, V a2) { super(a1); otherAnimal = a2; @@ -152,7 +152,7 @@ public void testWrapperWithField() throws Exception fail("polymorphic type not kept, result == "+json+"; should contain 'object-type':'...'"); } } - + public void testWrapperWithExplicitType() throws Exception { Dog dog = new Dog("Fluffy", 3); @@ -163,7 +163,7 @@ public void testWrapperWithExplicitType() throws Exception fail("polymorphic type not kept, result == "+json+"; should contain 'object-type':'...'"); } } - + public void testJackson387() throws Exception { ObjectMapper om = new ObjectMapper(); @@ -178,7 +178,7 @@ public void testJackson387() throws Exception MyParam moc2 = new MyParam("valueX"); SomeObject so = new SomeObject(); - so.someValue = "xxxxxx"; + so.someValue = "xxxxxx"; MyParam moc3 = new MyParam(so); List colist = new ArrayList(); @@ -193,7 +193,7 @@ public void testJackson387() throws Exception mc.params.add( moc4 ); String json = om.writeValueAsString( mc ); - + MyClass mc2 = om.readValue(json, MyClass.class ); assertNotNull(mc2); assertNotNull(mc2.params); @@ -210,7 +210,7 @@ public void testJackson430() throws Exception String str = om.writeValueAsString( mc ); // System.out.println( str ); - + MyClass mc2 = om.readValue( str, MyClass.class ); assertNotNull(mc2); assertNotNull(mc2.params); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/TypeResolverTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/TypeResolverTest.java index 0635129616..c789caf4f9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/TypeResolverTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/TypeResolverTest.java @@ -46,7 +46,7 @@ public static void testSubtypeResolution() throws Exception mapper.registerModule(basicModule); String value = "{\"z\": {\"zz\": {\"a\": 42}}}"; A a = mapper.readValue(value, A.class); - + Map map = a.getMap(); assertEquals(MyMap.class, map.getClass()); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolverForLong2753Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolverForLong2753Test.java index 7971061bb0..835d759022 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolverForLong2753Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolverForLong2753Test.java @@ -34,7 +34,7 @@ protected boolean allowPrimitiveTypes(MapperConfig config, return true; } } - + public void testDefaultTypingWithLong() throws Exception { Data data = new Data(1L); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultWithBaseType1093Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultWithBaseType1093Test.java index bee9701a95..90902aaea3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultWithBaseType1093Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultWithBaseType1093Test.java @@ -41,7 +41,7 @@ private void _testWithDefaultTyping(Point1093 input, ObjectReader r, ObjectWriter w) throws Exception { String json = w.writeValueAsString(input); - + Point1093 result = (Point1093) r.readValue(json); assertEquals(input.x, result.x); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForArrays.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForArrays.java index 11bde67ef7..c97a15e428 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForArrays.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForArrays.java @@ -85,17 +85,17 @@ public void testNodeInArray() throws Exception Object ob = result[0]; assertTrue(ob instanceof JsonNode); } - + @SuppressWarnings("deprecation") public void testNodeInEmptyArray() throws Exception { Map> outerMap = new HashMap>(); outerMap.put("inner", new ArrayList()); ObjectMapper m = new ObjectMapper().disable(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS); JsonNode tree = m.convertValue(outerMap, JsonNode.class); - + String json = m.writeValueAsString(tree); assertEquals("{}", json); - + JsonNode node = new ObjectMapper().readTree("{\"a\":[]}"); m = jsonMapperBuilder() @@ -161,7 +161,7 @@ private void _testArrayTypingForPrimitiveArrays(ObjectMapper mapper, Object v) t /* Helper methods /********************************************************** */ - + protected void _testArraysAs(ObjectMapper mapper, String json, Class type) throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForEnums.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForEnums.java index de474a0d5d..dd63a891dd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForEnums.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForEnums.java @@ -17,7 +17,7 @@ public enum TestEnum { static final class EnumHolder { public Object value; // "untyped" - + public EnumHolder() { } public EnumHolder(TestEnum e) { value = e; } } @@ -36,13 +36,13 @@ public void testSimpleEnumBean() throws Exception { TimeUnitBean bean = new TimeUnitBean(); bean.timeUnit = TimeUnit.SECONDS; - + // First, without type info ObjectMapper m = new ObjectMapper(); String json = m.writeValueAsString(bean); TimeUnitBean result = m.readValue(json, TimeUnitBean.class); assertEquals(TimeUnit.SECONDS, result.timeUnit); - + // then with type info m = JsonMapper.builder() .activateDefaultTyping(NoCheckSubTypeValidator.instance) @@ -52,7 +52,7 @@ public void testSimpleEnumBean() throws Exception assertEquals(TimeUnit.SECONDS, result.timeUnit); } - + public void testSimpleEnumsInObjectArray() throws Exception { ObjectMapper m = JsonMapper.builder() diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForLists.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForLists.java index c2eeb49a48..0ca305c0f0 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForLists.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForLists.java @@ -48,14 +48,14 @@ interface Foo { } static class SetBean { public Set names; - + public SetBean() { } public SetBean(String str) { names = new HashSet(); names.add(str); } } - + /* /********************************************************** /* Unit tests @@ -65,7 +65,7 @@ public SetBean(String str) { private final ObjectMapper POLY_MAPPER = jsonMapperBuilder() .activateDefaultTyping(NoCheckSubTypeValidator.instance) .build(); - + public void testListOfLongs() throws Exception { ListOfLongs input = new ListOfLongs(1L, 2L, 3L); @@ -115,7 +115,7 @@ public void testDateTypes() throws Exception assertTrue(outputList.get(0) instanceof TimeZone); assertTrue(outputList.get(1) instanceof Locale); } - + public void testJackson628() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForMaps.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForMaps.java index 4b04997766..b7057a0030 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForMaps.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForMaps.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.testutil.NoCheckSubTypeValidator; import com.fasterxml.jackson.databind.type.TypeFactory; -public class TestDefaultForMaps +public class TestDefaultForMaps extends BaseMapTest { static class MapKey { @@ -37,7 +37,7 @@ static class MapHolder } // // For #234 - + static class ItemList { public String value; public List childItems = new LinkedList(); @@ -62,13 +62,13 @@ public void addChildItem(String key, ItemMap childItem) { childItems.put(key, items); } } - + /* /********************************************************** /* Unit tests /********************************************************** */ - + public void testJackson428() throws Exception { ObjectMapper serMapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForObject.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForObject.java index f3f7730678..af1b4e358e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForObject.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultForObject.java @@ -18,7 +18,7 @@ public class TestDefaultForObject extends BaseMapTest { static abstract class AbstractBean { } - + static class StringBean extends AbstractBean { // ha, punny! public String name; @@ -40,9 +40,9 @@ enum ComplexChoice { MAYBE(true), PROBABLY_NOT(false); private boolean state; - + private ComplexChoice(boolean b) { state = b; } - + @Override public String toString() { return String.valueOf(state); } } @@ -50,7 +50,7 @@ enum ComplexChoice { static class PolymorphicType { public String foo; public Object bar; - + public PolymorphicType() { } public PolymorphicType(String foo, int bar) { this.foo = foo; @@ -61,7 +61,7 @@ public PolymorphicType(String foo, int bar) { final static class BeanHolder { public AbstractBean bean; - + public BeanHolder() { } public BeanHolder(AbstractBean b) { bean = b; } } @@ -116,7 +116,7 @@ public void testBeanAsObject() throws Exception String str = m.writeValueAsString(new Object[] { new StringBean("abc") }); _verifySerializationAsMap(str); - + // Ok: serialization seems to work as expected. Now deserialize: Object ob = m.readValue(str, Object[].class); assertNotNull(ob); @@ -136,7 +136,7 @@ public void testBeanAsObjectUsingAsProperty() throws Exception .build(); // note: need to wrap, to get declared as Object String json = m.writeValueAsString(new StringBean("abc")); - + // Ok: serialization seems to work as expected. Now deserialize: Object result = m.readValue(json, Object.class); assertNotNull(result); @@ -160,7 +160,7 @@ public void testAsPropertyWithPTV() throws Exception { verifyException(e, "denied resolution of all subtypes of "); } } - + /** * Unit test that verifies that an abstract bean is stored with type information * if default type information is enabled for non-concrete types. @@ -224,7 +224,7 @@ public void testNullValue() throws Exception assertNotNull(result); assertNull(result.bean); } - + public void testEnumAsObject() throws Exception { // wrapping to be declared as object @@ -381,7 +381,7 @@ public void testIssue352() throws Exception assertNotNull(result); assertNotNull(wrapper.myBean); assertSame(DiscussBean.class, wrapper.myBean.getClass()); - } + } // Test to ensure we can also use "As.PROPERTY" inclusion and custom property name public void testFeature432() throws Exception @@ -432,7 +432,7 @@ public void testWithFinalClass() throws Exception /* Helper methods /********************************************************** */ - + @SuppressWarnings("unchecked") private void _verifySerializationAsMap(String str) throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultWithCreators.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultWithCreators.java index ee4bb89608..e50b027541 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultWithCreators.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/TestDefaultWithCreators.java @@ -21,7 +21,7 @@ static class UrlJob extends Job { private final String url; private final int count; - + @JsonCreator public UrlJob(@JsonProperty("id") long id, @JsonProperty("url") String url, @JsonProperty("count") int count) @@ -47,7 +47,7 @@ protected Bean1385Wrapper() { } static class Bean1385 { byte[] raw; - + @JsonCreator(mode=JsonCreator.Mode.DELEGATING) public Bean1385(byte[] raw) { this.raw = raw.clone(); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeCustomResolverTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeCustomResolverTest.java index 3be3a14ae7..7c982575ec 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeCustomResolverTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeCustomResolverTest.java @@ -18,9 +18,9 @@ public class ExternalTypeCustomResolverTest extends BaseMapTest { // [databind#1288] public static class ClassesWithoutBuilder { - + public static class CreditCardDetails implements PaymentDetails { - + protected String cardHolderFirstName; protected String cardHolderLastName; protected String number; @@ -30,9 +30,9 @@ public static class CreditCardDetails implements PaymentDetails { protected String zipCode; protected String city; protected String province; - + protected String countryCode; - + protected String description; public void setCardHolderFirstName(String cardHolderFirstName) { @@ -78,14 +78,14 @@ public void setCountryCode(String countryCode) { public void setDescription(String description) { this.description = description; } - - + + } - + public static class EncryptedCreditCardDetails implements PaymentDetails { - + protected UUID paymentInstrumentID; - + protected String name; public void setPaymentInstrumentID(UUID paymentInstrumentID) { @@ -97,22 +97,22 @@ public void setName (String name) { } } - + public enum FormOfPayment { INDIVIDUAL_CREDIT_CARD (CreditCardDetails.class), COMPANY_CREDIT_CARD ( CreditCardDetails.class), INSTRUMENTED_CREDIT_CARD (EncryptedCreditCardDetails.class); - + private final Class clazz; - + FormOfPayment(final Class clazz) { this.clazz = clazz; } - + @SuppressWarnings("unchecked") public Class getDetailsClass () { return (Class) this.clazz; } - + public static FormOfPayment fromDetailsClass(Class detailsClass) { for (FormOfPayment fop : FormOfPayment.values ()) { if (fop.clazz == detailsClass) { @@ -122,17 +122,17 @@ public static FormOfPayment fromDetailsClass(Class detailsClass) throw new IllegalArgumentException("not found"); } } - + public interface PaymentDetails { public interface Builder { PaymentDetails build(); } } - + public static class PaymentMean { - + FormOfPayment formOfPayment; - + PaymentDetails paymentDetails; public void setFormOfPayment(FormOfPayment formOfPayment) { @@ -145,7 +145,7 @@ public void setPaymentDetails(PaymentDetails paymentDetails) { this.paymentDetails = paymentDetails; } } - + public static class PaymentDetailsTypeIdResolver extends TypeIdResolverBase { @SuppressWarnings("unchecked") @Override @@ -155,7 +155,7 @@ public String idFromValue (Object value) { } return FormOfPayment.fromDetailsClass ((Class) value.getClass ()).name (); } - + @Override public String idFromValueAndType (Object value, Class suggestedType) { return this.idFromValue (value); @@ -170,16 +170,16 @@ public JavaType typeFromId (DatabindContext context, String id) { public String getDescForKnownTypeIds () { return "PaymentDetails"; } - + @Override public Id getMechanism () { return JsonTypeInfo.Id.CUSTOM; } } } - + public static class ClassesWithBuilder { - + @JsonDeserialize (builder = CreditCardDetails.IndividualCreditCardDetailsBuilder.class) public static class CreditCardDetails implements PaymentDetails { @JsonPOJOBuilder(withPrefix = "") @@ -188,34 +188,34 @@ public static class CompanyCreditCardDetailsBuilder implements Builder { private String cardHolderLastName; private String number; private int csc; - + @Override public CreditCardDetails build() { return new CreditCardDetails (cardHolderFirstName, cardHolderLastName, number, csc, "COMPANY CREDIT CARD"); } - + public CompanyCreditCardDetailsBuilder cardHolderFirstName(final String cardHolderFirstName) { this.cardHolderFirstName = cardHolderFirstName; return this; } - + public CompanyCreditCardDetailsBuilder cardHolderLastName(final String cardHolderLastName) { this.cardHolderLastName = cardHolderLastName; return this; } - + public CompanyCreditCardDetailsBuilder csc(final int csc) { this.csc = csc; return this; } - + public CompanyCreditCardDetailsBuilder number(final String number) { this.number = number; return this; } } - + @JsonPOJOBuilder (withPrefix = "") public static class IndividualCreditCardDetailsBuilder implements Builder { private String cardHolderFirstName; @@ -229,12 +229,12 @@ public CreditCardDetails build () { return new CreditCardDetails(cardHolderFirstName, cardHolderLastName, number, csc, description); } - + public IndividualCreditCardDetailsBuilder cardHolderFirstName(final String cardHolderFirstName) { this.cardHolderFirstName = cardHolderFirstName; return this; } - + public IndividualCreditCardDetailsBuilder cardHolderLastName(final String cardHolderLastName) { this.cardHolderLastName = cardHolderLastName; return this; @@ -244,7 +244,7 @@ public IndividualCreditCardDetailsBuilder csc (final int csc) { this.csc = csc; return this; } - + public IndividualCreditCardDetailsBuilder description (final String description) { this.description = description; return this; @@ -255,14 +255,14 @@ public IndividualCreditCardDetailsBuilder number (final String number) { return this; } } - + protected final String cardHolderFirstName; protected final String cardHolderLastName; protected final String number; protected final int csc; - + protected final String description; - + public CreditCardDetails (final String cardHolderFirstName, final String cardHolderLastName, final String number, final int csc, final String description) { @@ -274,24 +274,24 @@ public CreditCardDetails (final String cardHolderFirstName, final String cardHol this.description = description; } } - + @JsonDeserialize (builder = EncryptedCreditCardDetails.InstrumentedCreditCardBuilder.class) public static class EncryptedCreditCardDetails implements PaymentDetails { @JsonPOJOBuilder (withPrefix = "") public static class InstrumentedCreditCardBuilder implements Builder { private UUID paymentInstrumentID; private String name; - + @Override public EncryptedCreditCardDetails build () { return new EncryptedCreditCardDetails (this.paymentInstrumentID, this.name); } - + public InstrumentedCreditCardBuilder name (final String name) { this.name = name; return this; } - + public InstrumentedCreditCardBuilder paymentInstrumentID (final UUID paymentInstrumentID) { this.paymentInstrumentID = paymentInstrumentID; return this; @@ -307,22 +307,22 @@ public InstrumentedCreditCardBuilder paymentInstrumentID (final UUID paymentInst this.name = name; } } - + public enum FormOfPayment { INDIVIDUAL_CREDIT_CARD (CreditCardDetails.IndividualCreditCardDetailsBuilder.class), COMPANY_CREDIT_CARD ( CreditCardDetails.CompanyCreditCardDetailsBuilder.class), INSTRUMENTED_CREDIT_CARD (EncryptedCreditCardDetails.InstrumentedCreditCardBuilder.class); - + private final Class builderClass; - + FormOfPayment(final Class builderClass) { this.builderClass = builderClass; } - + @SuppressWarnings ("unchecked") public Class getDetailsClass() { return (Class) this.builderClass.getEnclosingClass(); } - + public static FormOfPayment fromDetailsClass(Class detailsClass) { for (FormOfPayment fop : FormOfPayment.values()) { if (fop.builderClass.getEnclosingClass() == detailsClass) { @@ -332,13 +332,13 @@ public static FormOfPayment fromDetailsClass(Class detailsClass) throw new IllegalArgumentException("not found"); } } - + public interface PaymentDetails { public interface Builder { PaymentDetails build(); } } - + @JsonDeserialize(builder = PaymentMean.Builder.class) public static class PaymentMean { @JsonPOJOBuilder(withPrefix = "") @@ -346,11 +346,11 @@ public static class PaymentMean { public static class Builder { private FormOfPayment formOfPayment; private PaymentDetails paymentDetails; - + public PaymentMean build () { return new PaymentMean(this.formOfPayment, this.paymentDetails); } - + // if you annotate with @JsonIgnore, it works, but the value // disappears in the constructor public Builder formOfPayment (final FormOfPayment val) { @@ -365,7 +365,7 @@ public Builder paymentDetails (final PaymentDetails val) { return this; } } - + public static Builder create() { return new Builder(); } @@ -379,7 +379,7 @@ public static Builder create() { this.paymentDetails = paymentDetails; } } - + public static class PaymentDetailsTypeIdResolver extends TypeIdResolverBase { @SuppressWarnings ("unchecked") @Override @@ -389,7 +389,7 @@ public String idFromValue (Object value) { } return FormOfPayment.fromDetailsClass ((Class) value.getClass ()).name (); } - + @Override public String idFromValueAndType (Object value, Class suggestedType) { return this.idFromValue (value); @@ -399,12 +399,12 @@ public String idFromValueAndType (Object value, Class suggestedType) { public JavaType typeFromId(DatabindContext context, String id) { return context.getTypeFactory().constructType(FormOfPayment.valueOf (id).getDetailsClass ()); } - + @Override public String getDescForKnownTypeIds() { return "PaymentDetails"; } - + @Override public Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId2588Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId2588Test.java index 0c013e357e..313f1aed7e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId2588Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId2588Test.java @@ -73,26 +73,26 @@ public void testExternalTypeId2588() throws Exception Pet pet; // works? - + pet = mapper.readValue(a2q( -"{\n" + -" 'type': 'cat',\n" + -" 'animal': { },\n" + -" 'ignoredObject\": {\n" + -" 'someField': 'someValue'\n" + +"{\n" + +" 'type': 'cat',\n" + +" 'animal': { },\n" + +" 'ignoredObject\": {\n" + +" 'someField': 'someValue'\n" + " }"+ "}" ), Pet.class); assertNotNull(pet); - + // fails: pet = mapper.readValue(a2q( -"{\n" + -" 'animal\": { },\n" + -" 'ignoredObject': {\n" + -" 'someField': 'someValue'\n" + -" },\n" + -" 'type': 'cat'\n" + +"{\n" + +" 'animal\": { },\n" + +" 'ignoredObject': {\n" + +" 'someField': 'someValue'\n" + +" },\n" + +" 'type': 'cat'\n" + "}" ), Pet.class); assertNotNull(pet); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId96Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId96Test.java index a5d09cdda4..97448da976 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId96Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeId96Test.java @@ -27,7 +27,7 @@ public ExternalBeanWithDefault(int v) { @JsonTypeName("vbean") static class ValueBean { public int value; - + public ValueBean() { } public ValueBean(int v) { value = v; } } @@ -42,7 +42,7 @@ public ValueBean() { } // For [databind#96]: should allow use of default impl, if property missing /* 18-Jan-2013, tatu: Unfortunately this collides with [databind#118], and I don't - * know what the best resolution is. For now at least + * know what the best resolution is. For now at least */ public void testWithDefaultAndMissing() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdTest.java index 53d2f7cb95..db427a0c19 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdTest.java @@ -45,15 +45,15 @@ static class ExternalBean3 { @JsonTypeInfo(use=Id.NAME, include=As.EXTERNAL_PROPERTY, property="extType1") public Object value1; - + @JsonTypeInfo(use=Id.NAME, include=As.EXTERNAL_PROPERTY, property="extType2") public Object value2; public int foo; - + @JsonTypeInfo(use=Id.NAME, include=As.EXTERNAL_PROPERTY, property="extType3") public Object value3; - + public ExternalBean3() { } public ExternalBean3(int v) { value1 = new ValueBean(v); @@ -69,7 +69,7 @@ static class ExternalBeanWithCreator public Object value; public int foo; - + @JsonCreator public ExternalBeanWithCreator(@JsonProperty("foo") int f) { @@ -81,7 +81,7 @@ public ExternalBeanWithCreator(@JsonProperty("foo") int f) @JsonTypeName("vbean") static class ValueBean { public int value; - + public ValueBean() { } public ValueBean(int v) { value = v; } } @@ -99,12 +99,12 @@ static class FunkyExternalBean { interface Base { String getBaseProperty(); } - + static class Derived1 implements Base { private String derived1Property; private String baseProperty; protected Derived1() { throw new IllegalStateException("wrong constructor called"); } - + @JsonCreator public Derived1(@JsonProperty("derived1Property") String d1p, @JsonProperty("baseProperty") String bp) { @@ -143,7 +143,7 @@ public Derived2(@JsonProperty("derived2Property") String d2p, return derived2Property; } } - + static class BaseContainer { protected final Base base; protected final String baseContainerProperty; @@ -183,7 +183,7 @@ public String getPetType() { public void setPetType(String petType) { this.petType = petType; } - } + } // for [databind#118] static class ExternalTypeWithNonPOJO { @@ -200,7 +200,7 @@ static class ExternalTypeWithNonPOJO { public ExternalTypeWithNonPOJO() { } public ExternalTypeWithNonPOJO(Object o) { value = o; } - } + } // for [databind#119] static class AsValueThingy { @@ -208,7 +208,7 @@ static class AsValueThingy { public AsValueThingy(long l) { rawDate = l; } public AsValueThingy() { } - + @JsonValue public Date serialization() { return new Date(rawDate); } @@ -223,7 +223,7 @@ static class Issue222Bean public Issue222BeanB value; public String type = "foo"; - + public Issue222Bean() { } public Issue222Bean(int v) { value = new Issue222BeanB(v); @@ -234,7 +234,7 @@ public Issue222Bean(int v) { static class Issue222BeanB { public int x; - + public Issue222BeanB() { } public Issue222BeanB(int value) { x = value; } } @@ -271,19 +271,19 @@ void setTypeString(String type) { this.typeEnum = Type965.valueOf(type); } - @JsonGetter(value = "objectValue") + @JsonGetter(value = "objectValue") Object getValue() { return value; } @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(name = "BIG_DECIMAL", value = BigDecimal.class) }) - @JsonSetter(value = "objectValue") + @JsonSetter(value = "objectValue") private void setValue(Object value) { this.value = value; } - } - + } + /* /********************************************************** /* Unit tests, serialization @@ -291,7 +291,7 @@ private void setValue(Object value) { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testSimpleSerialization() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -333,7 +333,7 @@ public void testExternalTypeIdWithNull() throws Exception /* Unit tests, deserialization /********************************************************** */ - + public void testSimpleDeserialization() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -382,7 +382,7 @@ public void testExternalTypeWithCreator() throws Exception assertEquals(7, ((ValueBean)result.value).value); assertEquals(7, result.foo); } - + // If trying to use with Class, should just become "PROPERTY" instead: public void testImproperExternalIdDeserialization() throws Exception { @@ -469,7 +469,7 @@ public void testWithNaturalScalar118() throws Exception assertTrue(result.value instanceof String); assertEquals("foobar", result.value); } - + // For [databind#119]... and bit of [#167] as well public void testWithAsValue() throws Exception { @@ -528,7 +528,7 @@ public void testBigDecimal965() throws Exception if (!json.contains(NUM_STR)) { fail("JSON content should contain value '"+NUM_STR+"', does not appear to: "+json); } - + Wrapper965 w2 = MAPPER.readerFor(Wrapper965.class) .with(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS) .readValue(json); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithCreatorTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithCreatorTest.java index e80ce4cb59..8a1018ac30 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithCreatorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithCreatorTest.java @@ -38,7 +38,7 @@ public Message(@JsonProperty("type") String type, } // [databind#1198] - + public enum Attacks { KICK, PUNCH } static class Character { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithEnum1328Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithEnum1328Test.java index 0ce3a65953..367b069e59 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithEnum1328Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/ExternalTypeIdWithEnum1328Test.java @@ -17,7 +17,7 @@ public interface Animal { } public static class Dog implements Animal { public String dogStuff; } - + public enum AnimalType { Dog; } @@ -25,10 +25,10 @@ public enum AnimalType { public static class AnimalAndType { public AnimalType type; - @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, - include = JsonTypeInfo.As.EXTERNAL_PROPERTY, + @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, + include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type") - @JsonTypeIdResolver(AnimalResolver.class) + @JsonTypeIdResolver(AnimalResolver.class) private Animal animal; public AnimalAndType() { } @@ -76,12 +76,12 @@ public String getDescForKnownTypeIds() { @Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; - } + } } public void testExample() throws Exception { ObjectMapper mapper = new ObjectMapper(); - + String json = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(Arrays.asList(new AnimalAndType(AnimalType.Dog, new Dog()))); List list = mapper.readerFor(new TypeReference>() { }) diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/JsonValueExtTypeIdTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/JsonValueExtTypeIdTest.java index b8d25425c2..7839fc5018 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/JsonValueExtTypeIdTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/JsonValueExtTypeIdTest.java @@ -15,7 +15,7 @@ public class JsonValueExtTypeIdTest extends BaseMapTest public static class DecimalValue { private BigDecimal value; public DecimalValue() { value = new BigDecimal("111.1"); } - + @JsonValue public BigDecimal getValue(){ return value; } } @@ -24,7 +24,7 @@ public static class DecimalValue { public static class DecimalEntry { public DecimalEntry() {} public String getKey() { return "num"; } - + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.EXTERNAL_PROPERTY) public DecimalValue getValue(){ return new DecimalValue(); @@ -43,7 +43,7 @@ public List getMetadata() { public static class DoubleValue { private Double value; public DoubleValue() { value = 1234.25; } - + @JsonValue public Double getValue() { return value; } } @@ -52,7 +52,7 @@ public static class DoubleValue { public static class DoubleEntry { public DoubleEntry(){} public String getKey(){ return "num"; } - + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.EXTERNAL_PROPERTY) public DoubleValue getValue(){ return new DoubleValue(); } } @@ -65,7 +65,7 @@ public List getMetadata() { } final ObjectMapper MAPPER = new ObjectMapper(); - + public void testDoubleMetadata() throws IOException { DoubleMetadata doub = new DoubleMetadata(); String expected = "{\"metadata\":[{\"key\":\"num\",\"value\":1234.25,\"@type\":\"doubleValue\"}]}"; diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/MultipleExternalIds291Test.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/MultipleExternalIds291Test.java index 2fb4e45488..4cca094c4e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/MultipleExternalIds291Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/MultipleExternalIds291Test.java @@ -53,7 +53,7 @@ static class ContainerWithExtra extends Container { */ final ObjectMapper MAPPER = objectMapper(); - + // [databind#291] public void testMultipleValuesSingleExtId() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java index 6a05bd023f..e36633f35e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestPropertyCreatorSubtypesExternalPropertyMissingProperty.java @@ -241,4 +241,4 @@ private void checkBoxException(ObjectReader reader, String json) throws Exceptio BaseMapTest.verifyException(e, "Missing property 'fruit' for external type id 'type'"); } } -} +} diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestSubtypesExternalPropertyMissingProperty.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestSubtypesExternalPropertyMissingProperty.java index c63a1d4082..823d8afc4d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestSubtypesExternalPropertyMissingProperty.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/ext/TestSubtypesExternalPropertyMissingProperty.java @@ -254,4 +254,4 @@ private void checkReqBoxDatabindException(ObjectReader r, String json) throws Ex BaseMapTest.verifyException(e, "Missing property 'fruit' for external type id 'type'"); } } -} +} diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/AbstractContainerTypingTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/AbstractContainerTypingTest.java index 7a01a4f994..a12c2ffe4c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/AbstractContainerTypingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/AbstractContainerTypingTest.java @@ -12,9 +12,9 @@ public class AbstractContainerTypingTest extends BaseMapTest { // Polymorphic abstract Map type, wrapper - + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type") - @JsonSubTypes({ + @JsonSubTypes({ @JsonSubTypes.Type(value = MapWrapper.class, name = "wrapper"), }) static class MapWrapper { @@ -22,7 +22,7 @@ static class MapWrapper { } @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="_type_") - @JsonSubTypes({ + @JsonSubTypes({ @JsonSubTypes.Type(value = DataValueMap.class, name = "DataValueMap") }) public interface IDataValueMap extends Map { } @@ -30,7 +30,7 @@ public interface IDataValueMap extends Map { } static class DataValueMap extends HashMap implements IDataValueMap { } @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type") - @JsonSubTypes({ + @JsonSubTypes({ @JsonSubTypes.Type(value = ListWrapper.class, name = "wrapper"), }) static class ListWrapper { @@ -38,7 +38,7 @@ static class ListWrapper { } @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type") - @JsonSubTypes({ + @JsonSubTypes({ @JsonSubTypes.Type(value = DataValueList.class, name = "list") }) public interface IDataValueList extends List { } @@ -52,7 +52,7 @@ static class DataValueList extends LinkedList implements IDataValueList */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testAbstractLists() throws Exception { ListWrapper w = new ListWrapper(); @@ -66,7 +66,7 @@ public void testAbstractLists() throws Exception assertEquals(1, out.list.size()); assertEquals("x", out.list.get(0)); } - + public void testAbstractMaps() throws Exception { MapWrapper w = new MapWrapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/EnumTypingTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/EnumTypingTest.java index ff7cdd38c4..f8742eadf2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/EnumTypingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/EnumTypingTest.java @@ -17,17 +17,17 @@ public interface EnumInterface { } public enum Tag implements EnumInterface { A, B }; - + static class EnumInterfaceWrapper { public EnumInterface value; } - + static class EnumInterfaceList extends ArrayList { } static class TagList extends ArrayList { } static enum TestEnum { A, B, C; } - + static class UntypedEnumBean { @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="__type") @@ -105,7 +105,7 @@ public void testEnumInterfaceList() throws Exception list.add(Tag.A); list.add(Tag.B); String json = MAPPER.writeValueAsString(list); - + EnumInterfaceList result = MAPPER.readValue(json, EnumInterfaceList.class); assertEquals(2, result.size()); assertSame(Tag.A, result.get(0)); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/ScalarTypingTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/ScalarTypingTest.java index 69df8f4c2c..884037cc11 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/ScalarTypingTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/ScalarTypingTest.java @@ -14,7 +14,7 @@ public class ScalarTypingTest extends BaseMapTest private static class DynamicWrapper { @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY) public Object value; - + @SuppressWarnings("unused") public DynamicWrapper() { } public DynamicWrapper(Object v) { value = v; } @@ -25,7 +25,7 @@ static enum TestEnum { A, B; } private static class AbstractWrapper { @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY) public Serializable value; - + @SuppressWarnings("unused") public AbstractWrapper() { } public AbstractWrapper(Serializable v) { value = v; } @@ -50,7 +50,7 @@ public ScalarList add(Object v) { */ final ObjectMapper MAPPER = newJsonMapper(); - + /** * Ensure that per-property dynamic types work, both for "native" types * and others @@ -77,7 +77,7 @@ public void testScalarsWithTyping() throws Exception json = m.writeValueAsString(new DynamicWrapper(Boolean.TRUE)); result = m.readValue(json, DynamicWrapper.class); assertEquals(Boolean.TRUE, result.value); - + // then verify other scalars json = m.writeValueAsString(new DynamicWrapper(Long.valueOf(7L))); result = m.readValue(json, DynamicWrapper.class); @@ -110,7 +110,7 @@ public void testScalarsViaAbstractType() throws Exception json = m.writeValueAsString(new AbstractWrapper(Boolean.TRUE)); result = m.readValue(json, AbstractWrapper.class); assertEquals(Boolean.TRUE, result.value); - + // then verify other scalars json = m.writeValueAsString(new AbstractWrapper(Long.valueOf(7L))); result = m.readValue(json, AbstractWrapper.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArrayDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArrayDeserTest.java index f69188a0e2..b576813451 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArrayDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArrayDeserTest.java @@ -30,11 +30,11 @@ static class TypedList extends ArrayList { } @SuppressWarnings("serial") @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY) static class TypedListAsProp extends ArrayList { } - + @SuppressWarnings("serial") @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_OBJECT) static class TypedListAsWrapper extends LinkedList { } - + // Mix-in to force wrapper for things like primitive arrays @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_OBJECT) interface WrapperMixIn { } @@ -44,13 +44,13 @@ interface WrapperMixIn { } /* Unit tests, Lists /********************************************************** */ - + public void testIntList() throws Exception { ObjectMapper m = new ObjectMapper(); // uses WRAPPER_OBJECT inclusion String JSON = "{\""+TypedListAsWrapper.class.getName()+"\":[4,5, 6]}"; - JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsWrapper.class, Integer.class); + JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsWrapper.class, Integer.class); TypedListAsWrapper result = m.readValue(JSON, type); assertNotNull(result); assertEquals(3, result.size()); @@ -69,7 +69,7 @@ public void testBooleanListAsProp() throws Exception ObjectMapper m = new ObjectMapper(); // tries to use PROPERTY inclusion; but for ARRAYS (and scalars) will become ARRAY_WRAPPER String JSON = "[\""+TypedListAsProp.class.getName()+"\",[true, false]]"; - JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsProp.class, Boolean.class); + JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsProp.class, Boolean.class); TypedListAsProp result = m.readValue(JSON, type); assertNotNull(result); assertEquals(2, result.size()); @@ -81,9 +81,9 @@ public void testLongListAsWrapper() throws Exception { ObjectMapper m = new ObjectMapper(); // uses OBJECT_ARRAY, works just fine - + String JSON = "{\""+TypedListAsWrapper.class.getName()+"\":[1, 3]}"; - JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsWrapper.class, Long.class); + JavaType type = TypeFactory.defaultInstance().constructCollectionType(TypedListAsWrapper.class, Long.class); TypedListAsWrapper result = m.readValue(JSON, type); assertNotNull(result); assertEquals(2, result.size()); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArraySerTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArraySerTest.java index 6abaab7aa0..7ece7dd45a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArraySerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedArraySerTest.java @@ -31,11 +31,11 @@ static class TypedList extends ArrayList { } @SuppressWarnings("serial") @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY) static class TypedListAsProp extends ArrayList { } - + @SuppressWarnings("serial") @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.WRAPPER_OBJECT) static class TypedListAsWrapper extends LinkedList { } - + // Mix-in to force wrapper for things like primitive arrays @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.WRAPPER_OBJECT) interface WrapperMixIn { } @@ -80,7 +80,7 @@ public void testListWithPolymorphic() throws Exception ObjectWriter w = MAPPER.writerWithView(Object.class); assertEquals("{\"beans\":[{\"@type\":\"bean\",\"x\":0}]}", w.writeValueAsString(beans)); } - + public void testIntList() throws Exception { TypedList input = new TypedList(); @@ -90,7 +90,7 @@ public void testIntList() throws Exception assertEquals("[\""+TypedList.class.getName()+"\",[5,13]]", MAPPER.writeValueAsString(input)); } - + // Similar to above, but this time let's request adding type info // as property. That would not work (since there's no JSON Object to // add property in), so it should revert to method used with diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedContainerSerTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedContainerSerTest.java index 47c79dcd4a..1b8e9ace04 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedContainerSerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/jdk/TypedContainerSerTest.java @@ -105,7 +105,7 @@ static class Issue508B extends Issue508A { } /* Test methods /********************************************************** */ - + public void testPolymorphicWithContainer() throws Exception { Dog dog = new Dog("medor"); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/AnnotatedPolymorphicValidationTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/AnnotatedPolymorphicValidationTest.java index c58ae246aa..ad3f56ac67 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/AnnotatedPolymorphicValidationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/AnnotatedPolymorphicValidationTest.java @@ -51,7 +51,7 @@ protected boolean isSafeSubType(MapperConfig config, return baseType.isTypeOrSubTypeOf(Number.class); } } - + /* /********************************************************** /* Test methods @@ -79,12 +79,12 @@ public void testPolymorphicWithUnsafeBaseType() throws IOException .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES) .polymorphicTypeValidator(new NumbersAreOkValidator()) .build(); - + WrappedPolymorphicUntyped w = customMapper.readValue(JSON, WrappedPolymorphicUntyped.class); assertEquals(Integer.valueOf(10), w.value); // but yet again, it is not opening up all types (just as an example) - + try { customMapper.readValue(JSON, WrappedPolymorphicUntypedSer.class); fail("Should not pass"); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVTest.java index 659cf4936f..cf825484cf 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVTest.java @@ -71,7 +71,7 @@ static final class NumberWrapper { protected NumberWrapper() { } public NumberWrapper(Number v) { value = v; } } - + /* /********************************************************************** /* Test methods: by base type, pass @@ -85,7 +85,7 @@ public void testAllowByBaseClass() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withA(42)); @@ -120,7 +120,7 @@ public void testAllowByBaseClassPrefix() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withA(42)); @@ -145,7 +145,7 @@ public void testAllowByBaseClassPattern() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withA(42)); @@ -173,7 +173,7 @@ public void testDenyByBaseClass() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); final String json = mapper.writeValueAsString(new ObjectWrapper(new ValueA(15))); try { mapper.readValue(json, ObjectWrapper.class); @@ -197,7 +197,7 @@ public void testAllowBySubClass() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withB(42)); @@ -221,7 +221,7 @@ public void testAllowBySubClassPrefix() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withB(42)); @@ -245,7 +245,7 @@ public void testAllowBySubClassPattern() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First, test accepted case final String json = mapper.writeValueAsString(BaseValueWrapper.withB(42)); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVWithArraysTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVWithArraysTest.java index dfd56170f3..ec5a7f9744 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVWithArraysTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/BasicPTVWithArraysTest.java @@ -53,7 +53,7 @@ public void testAllowBySubClassInArray() throws Exception { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); final String json = mapper.writeValueAsString(new ObjectWrapper(new Base2534[] { new Good2534(42) })); @@ -73,7 +73,7 @@ public void testAllowBySubClassInArray() throws Exception { .build(); mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); ObjectWrapper w = mapper.readValue(json, ObjectWrapper.class); assertNotNull(w); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/CustomPTVMatchersTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/CustomPTVMatchersTest.java index d561b87f8e..152e936a44 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/CustomPTVMatchersTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/CustomPTVMatchersTest.java @@ -90,7 +90,7 @@ public boolean match(MapperConfig ctxt, Class clazz) { .build(); ObjectMapper mapper = jsonMapperBuilder() .activateDefaultTyping(ptv, DefaultTyping.NON_FINAL) - .build(); + .build(); // First: allow "Good" one: final String goodJson = mapper.writeValueAsString(new ObjectWrapper(new CustomGood(42) )); diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymBaseTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymBaseTypeTest.java index 4281484cd5..e6e4255e36 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymBaseTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymBaseTypeTest.java @@ -118,7 +118,7 @@ public void testAnnotedBad() throws Exception { verifyException(e, "all subtypes of base type"); } } - + /* /********************************************************************** /* Test methods: default typing diff --git a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymSubTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymSubTypeTest.java index 64959a7f3d..6c0835d603 100644 --- a/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymSubTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/vld/ValidatePolymSubTypeTest.java @@ -31,7 +31,7 @@ public boolean equals(Object other) { static class BadValue extends BaseValue { } static class GoodValue extends BaseValue { } static class MehValue extends BaseValue { } - + // // // Wrapper types static class AnnotatedWrapper { @@ -58,7 +58,7 @@ protected DefTypeWrapper() { } } // // // Validator implementations - + static class SimpleNameBasedValidator extends PolymorphicTypeValidator { private static final long serialVersionUID = 1L; @@ -111,7 +111,7 @@ public Validity validateSubType(MapperConfig ctxt, JavaType baseType, JavaTyp } // // // Mappers with Default Typing - + private final ObjectMapper MAPPER_DEF_TYPING_NAME_CHECK = jsonMapperBuilder() .activateDefaultTyping(new SimpleNameBasedValidator()) .build(); @@ -173,7 +173,7 @@ public void testWithDefaultTypingClassDenyDefault() throws Exception { _verifyMehDefaultValue(MAPPER_DEF_TYPING_CLASS_CHECK); } - + /* /********************************************************************** /* Test methods, annotated typing, full class @@ -217,7 +217,7 @@ public void testWithAnnotationClassDenyDefault() throws Exception { _verifyMehAnnotatedValue(MAPPER_EXPLICIT_CLASS_CHECK); } - + /* /********************************************************************** /* Test methods, annotated typing, minimal class name @@ -261,7 +261,7 @@ public void testWithAnnotationMinClassClassDenyDefault() throws Exception { _verifyMehAnnotatedMinValue(MAPPER_EXPLICIT_CLASS_CHECK); } - + /* /********************************************************************** /* Helper methods, round-trip (ok case) @@ -288,7 +288,7 @@ private AnnotatedMinimalWrapper _roundTripAnnotatedMinimal(ObjectMapper mapper, /* Helper methods, failing deser verification /********************************************************************** */ - + private void _verifyBadDefaultValue(ObjectMapper mapper) throws Exception { final String json = mapper.writeValueAsString(new DefTypeWrapper(new BadValue())); _verifyBadValue(mapper, json, DefTypeWrapper.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeser953Test.java b/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeser953Test.java index bd4bd09357..1d45902e2b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeser953Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeser953Test.java @@ -13,12 +13,12 @@ static class Id953 { } private final Locale LOCALE_EN = new Locale("en", "US"); - + private final ObjectMapper INSENSITIVE_MAPPER_EN = jsonMapperBuilder() .enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES) .defaultLocale(LOCALE_EN) .build(); - + private final Locale LOCALE_TR = new Locale("tr", "TR"); private final ObjectMapper INSENSITIVE_MAPPER_TR = jsonMapperBuilder() @@ -33,14 +33,14 @@ public void testTurkishILetterDeserializationWithEn() throws Exception { public void testTurkishILetterDeserializationWithTr() throws Exception { _testTurkishILetterDeserialization(INSENSITIVE_MAPPER_TR, LOCALE_TR); } - + private void _testTurkishILetterDeserialization(ObjectMapper mapper, Locale locale) throws Exception { // Sanity check first assertEquals(locale, mapper.getDeserializationConfig().getLocale()); - + final String ORIGINAL_KEY = "someId"; - + Id953 result; result = mapper.readValue("{\""+ORIGINAL_KEY+"\":1}", Id953.class); assertEquals(1, result.someId); diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeserTest.java b/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeserTest.java index ffd8416d3e..48ff0fcff6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeserTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/CaseInsensitiveDeserTest.java @@ -125,13 +125,13 @@ static class CaseSensitiveRoleContainer { public void testCaseInsensitiveDeserialization() throws Exception { final String JSON = "{\"Value1\" : {\"nAme\" : \"fruit\", \"vALUe\" : \"apple\"}, \"valUE2\" : {\"NAME\" : \"color\", \"value\" : \"red\"}}"; - + // first, verify default settings which do not accept improper case ObjectMapper mapper = new ObjectMapper(); assertFalse(mapper.isEnabled(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES)); try { mapper.readValue(JSON, Issue476Bean.class); - + fail("Should not accept improper case properties by default"); } catch (UnrecognizedPropertyException e) { verifyException(e, "Unrecognized field"); @@ -165,7 +165,7 @@ public void testCaseInsensitiveWithFormat() throws Exception { assertEquals("12", w.role.ID); assertEquals("Foo", w.role.Name); } - + // [databind#1438] public void testCreatorWithInsensitive() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/ParsingContext2525Test.java b/src/test/java/com/fasterxml/jackson/databind/misc/ParsingContext2525Test.java index e148862724..9df3d4ef33 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/ParsingContext2525Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/ParsingContext2525Test.java @@ -14,7 +14,7 @@ public class ParsingContext2525Test extends BaseMapTest private final ObjectMapper MAPPER = sharedMapper(); private final String MINIMAL_ARRAY_DOC = "[ 42 ]"; - + private final String MINIMAL_OBJECT_DOC = "{\"answer\" : 42 }"; private final String FULL_DOC = a2q("{'a':123,'array':[1,2,[3],5,{'obInArray':4}]," @@ -112,7 +112,7 @@ public void testFullDocWithTree() throws Exception /* Shared helper methods /********************************************************************** */ - + private void _testSimpleArrayUsingPathAsPointer(JsonParser p) throws Exception { assertSame(JsonPointer.empty(), p.getParsingContext().pathAsPointer()); @@ -124,7 +124,7 @@ private void _testSimpleArrayUsingPathAsPointer(JsonParser p) throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals("/0", p.getParsingContext().pathAsPointer().toString()); - + assertToken(JsonToken.END_ARRAY, p.nextToken()); assertSame(JsonPointer.empty(), p.getParsingContext().pathAsPointer()); assertTrue(p.getParsingContext().inRoot()); @@ -146,14 +146,14 @@ private void _testSimpleObjectUsingPathAsPointer(JsonParser p) throws Exception assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(42, p.getIntValue()); assertEquals("/answer", p.getParsingContext().pathAsPointer().toString()); - + assertToken(JsonToken.END_OBJECT, p.nextToken()); assertSame(JsonPointer.empty(), p.getParsingContext().pathAsPointer()); assertTrue(p.getParsingContext().inRoot()); assertNull(p.nextToken()); } - + private void _testFullDocUsingPathAsPointer(JsonParser p) throws Exception { // by default should just get "empty" diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/RaceCondition738Test.java b/src/test/java/com/fasterxml/jackson/databind/misc/RaceCondition738Test.java index 3888b37d18..abf36e8875 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/RaceCondition738Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/RaceCondition738Test.java @@ -48,20 +48,20 @@ public HasSubTypes getHasSubTypes() { return hasSubTypes; } } - + /* /********************************************************** /* Test methods /********************************************************** */ - + public void testRepeatedly() throws Exception { final int COUNT = 3000; for (int i = 0; i < COUNT; i++) { runOnce(i, COUNT); } } - + void runOnce(int round, int max) throws Exception { final ObjectMapper mapper = newJsonMapper(); Callable writeJson = new Callable() { diff --git a/src/test/java/com/fasterxml/jackson/databind/misc/TestJSONP.java b/src/test/java/com/fasterxml/jackson/databind/misc/TestJSONP.java index 24249fff1d..83dcbef0d7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/misc/TestJSONP.java +++ b/src/test/java/com/fasterxml/jackson/databind/misc/TestJSONP.java @@ -39,7 +39,7 @@ public void testSimpleBean() throws Exception MAPPER.writeValueAsString(new JSONPObject("xxx", new Impl("123", "456")))); } - + /** * Test to ensure that it is possible to force a static type for wrapped * value. diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/MixinsWithBundlesTest.java b/src/test/java/com/fasterxml/jackson/databind/mixins/MixinsWithBundlesTest.java index 79dc4947e7..dcc04302c5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/MixinsWithBundlesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/MixinsWithBundlesTest.java @@ -33,7 +33,7 @@ public static class Foo { public String getStuff() { return stuff; } - } + } public void testMixinWithBundles() throws Exception { ObjectMapper mapper = new ObjectMapper().addMixIn(Foo.class, FooMixin.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinInheritance.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinInheritance.java index 3fad43c3d3..41138e6573 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinInheritance.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinInheritance.java @@ -41,13 +41,13 @@ static abstract class BeanoMixinSub2 extends BeanoMixinSuper2 { @JsonProperty("id") public abstract int getIdo(); } - + /* /********************************************************** /* Unit tests /********************************************************** */ - + public void testMixinFieldInheritance() throws IOException { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinMerging.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinMerging.java index e9cd75eb8e..dfd3074b44 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinMerging.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinMerging.java @@ -33,7 +33,7 @@ static class PersonMixin extends ContactMixin implements Person {} /* Unit tests /********************************************************** */ - + // for [databind#515] public void testDisappearingMixins515() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForClass.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForClass.java index 3153e5455e..09ade9f652 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForClass.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForClass.java @@ -80,7 +80,7 @@ static class Rename3035Mixin extends Bean3035 { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testClassMixInsTopLevel() throws IOException { Map result; diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForFields.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForFields.java index 2f7bf12b40..5c97f79fee 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForFields.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForFields.java @@ -49,7 +49,7 @@ abstract class MixIn2 { // also: add a dummy field that is NOT to match anything @JsonProperty public String xyz; } - + /* /********************************************************** /* Unit tests diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForMethods.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForMethods.java index 7633c77c46..ed14d301fe 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForMethods.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerForMethods.java @@ -94,7 +94,7 @@ abstract class MixInForSimple */ /** - * Unit test for verifying that leaf-level mix-ins work ok; + * Unit test for verifying that leaf-level mix-ins work ok; * that is, any annotations added properly override all annotations * that masked methods (fields etc) have. */ diff --git a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerWithViews.java b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerWithViews.java index db0caf5b37..34065a47f9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerWithViews.java +++ b/src/test/java/com/fasterxml/jackson/databind/mixins/TestMixinSerWithViews.java @@ -93,7 +93,7 @@ public void setTestDataArray( SimpleTestData[] testDataArray ) { this.testDataArray = testDataArray; } - } + } public interface TestDataJAXBMixin { @@ -122,7 +122,7 @@ public interface TestComplexDataJAXBMixin static class Views { static class View { } } - + public class A { private String name; private int age; @@ -158,7 +158,7 @@ public abstract class AMixInAnnotation { /* Tests /********************************************************** */ - + public void testDataBindingUsage( ) throws Exception { ObjectMapper objectMapper = createObjectMapper(); @@ -167,7 +167,7 @@ public void testDataBindingUsage( ) throws Exception String json = objectWriter.writeValueAsString(object); assertTrue( json.indexOf( "nameHidden" ) == -1 ); assertTrue( json.indexOf( "\"name\" : \"shown\"" ) > 0 ); - } + } public void testIssue560() throws Exception { @@ -182,13 +182,13 @@ public void testIssue560() throws Exception assertTrue(json.indexOf("\"name\"") > 0); } - + /* /********************************************************** /* Helper methods /********************************************************** */ - + private ObjectMapper createObjectMapper() { ObjectMapper objectMapper = jsonMapperBuilder() @@ -196,7 +196,7 @@ private ObjectMapper createObjectMapper() .serializationInclusion(JsonInclude.Include.NON_NULL ) .configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false ) .build(); - + Map, Class> sourceMixins = new HashMap, Class>( ); sourceMixins.put( SimpleTestData.class, TestDataJAXBMixin.class ); sourceMixins.put( ComplexTestData.class, TestComplexDataJAXBMixin.class ); diff --git a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleArgCheckTest.java b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleArgCheckTest.java index 8de27cd85b..896c1b2787 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleArgCheckTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleArgCheckTest.java @@ -60,7 +60,7 @@ public void testInvalidForSerializers() throws Exception } catch (IllegalArgumentException e) { verifyException(e, "Cannot pass `null` as serializer"); } - + try { mod.addKeySerializer(String.class, null); fail("Should not pass"); diff --git a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java index 6352a96cf8..3dab7dc20c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java @@ -22,7 +22,7 @@ final static class CustomBean { protected String str; protected int num; - + public CustomBean(String s, int i) { str = s; num = i; @@ -30,7 +30,7 @@ public CustomBean(String s, int i) { } static enum SimpleEnum { A, B; } - + // Extend SerializerBase to get access to declared handledType static class CustomBeanSerializer extends StdSerializer { @@ -50,7 +50,7 @@ public JsonNode getSchema(SerializerProvider provider, Type typeHint) { return null; } } - + static class CustomBeanDeserializer extends JsonDeserializer { @Override @@ -99,7 +99,7 @@ public SimpleEnum deserialize(JsonParser jp, DeserializationContext ctxt) interface Base { public String getText(); } - + static class Impl1 implements Base { @Override public String getText() { return "1"; } @@ -113,7 +113,7 @@ static class Impl2 extends Impl1 { static class BaseSerializer extends StdScalarSerializer { public BaseSerializer() { super(Base.class); } - + @Override public void serialize(Base value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeString("Base:"+value.getText()); @@ -128,7 +128,7 @@ static class MixableBean { @JsonPropertyOrder({"c", "a", "b"}) static class MixInForOrder { } - + protected static class MySimpleSerializers extends SimpleSerializers { } protected static class MySimpleDeserializers extends SimpleDeserializers { } @@ -256,13 +256,13 @@ public void testSimpleInterfaceSerializer() throws Exception assertEquals(q("Base:1"), mapper.writeValueAsString(new Impl1())); assertEquals(q("Base:2"), mapper.writeValueAsString(new Impl2())); } - + /* /********************************************************** /* Unit tests; simple deserializers /********************************************************** */ - + public void testSimpleBeanDeserializer() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -412,7 +412,7 @@ public void testMixIns() throws Exception public void testAccessToMapper() throws Exception { - ContextVerifierModule module = new ContextVerifierModule(); + ContextVerifierModule module = new ContextVerifierModule(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(module); } diff --git a/src/test/java/com/fasterxml/jackson/databind/module/TestAbstractTypes.java b/src/test/java/com/fasterxml/jackson/databind/module/TestAbstractTypes.java index 44a54bfa51..90a165423b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/TestAbstractTypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/TestAbstractTypes.java @@ -15,7 +15,7 @@ public class TestAbstractTypes extends BaseMapTest static class MyString implements CharSequence { protected String value; - + public MyString(String s) { value = s; } @Override diff --git a/src/test/java/com/fasterxml/jackson/databind/module/TestCustomEnumKeyDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/module/TestCustomEnumKeyDeserializer.java index 8220f1c1c8..63ec7dc348 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/TestCustomEnumKeyDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/TestCustomEnumKeyDeserializer.java @@ -165,7 +165,7 @@ static class SuperType { /* Test methods /********************************************************** */ - + // Test passing with the fix public void testWithEnumKeys() throws Exception { ObjectMapper plainObjectMapper = new ObjectMapper(); @@ -227,7 +227,7 @@ public SuperTypeEnum deserialize(JsonParser p, DeserializationContext deserializ public void testCustomEnumValueAndKeyViaModifier() throws IOException { SimpleModule module = new SimpleModule(); - module.setDeserializerModifier(new BeanDeserializerModifier() { + module.setDeserializerModifier(new BeanDeserializerModifier() { @Override public JsonDeserializer modifyEnumDeserializer(DeserializationConfig config, final JavaType type, BeanDescription beanDesc, diff --git a/src/test/java/com/fasterxml/jackson/databind/module/TestDuplicateRegistration.java b/src/test/java/com/fasterxml/jackson/databind/module/TestDuplicateRegistration.java index 2abe4f0f1f..66432b28eb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/TestDuplicateRegistration.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/TestDuplicateRegistration.java @@ -7,7 +7,7 @@ public class TestDuplicateRegistration extends BaseMapTest { static class MyModule extends com.fasterxml.jackson.databind.Module { public int regCount; - + public MyModule() { super(); } diff --git a/src/test/java/com/fasterxml/jackson/databind/module/TestKeyDeserializers.java b/src/test/java/com/fasterxml/jackson/databind/module/TestKeyDeserializers.java index a9bd0d89f0..81d3b8f277 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/TestKeyDeserializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/TestKeyDeserializers.java @@ -16,10 +16,10 @@ public Foo deserializeKey(String key, DeserializationContext ctxt) return new Foo(key); } } - + static class Foo { public String value; - + public Foo(String v) { value = v; } } diff --git a/src/test/java/com/fasterxml/jackson/databind/module/TestTypeModifiers.java b/src/test/java/com/fasterxml/jackson/databind/module/TestTypeModifiers.java index bb6cde2c21..5414872fed 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/TestTypeModifiers.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/TestTypeModifiers.java @@ -86,7 +86,7 @@ public void serialize(Object value, JsonGenerator jgen, SerializerProvider provi jgen.writeString("xxx:"+value); } } - + interface MapMarker { public K getKey(); public V getValue(); @@ -129,12 +129,12 @@ static class MyMapSerializer extends JsonSerializer> { protected final JsonSerializer _keySerializer; protected final JsonSerializer _valueSerializer; - + public MyMapSerializer(JsonSerializer keySer, JsonSerializer valueSer) { _keySerializer = keySer; _valueSerializer = valueSer; } - + @Override public void serialize(MapMarker value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartObject(); @@ -162,7 +162,7 @@ public MapMarker deserialize(JsonParser jp, DeserializationContext ctxt) th int value = jp.getIntValue(); if (jp.nextToken() != JsonToken.END_OBJECT) throw new IOException("Wrong token: "+jp.currentToken()); return new MyMapLikeType(key, value); - } + } } static class MyCollectionSerializer extends JsonSerializer @@ -183,7 +183,7 @@ public MyCollectionLikeType deserialize(JsonParser jp, DeserializationContext ct int value = jp.getIntValue(); if (jp.nextToken() != JsonToken.END_ARRAY) throw new IOException("Wrong token: "+jp.currentToken()); return new MyCollectionLikeType(value); - } + } } static class MyTypeModifier extends TypeModifier @@ -246,7 +246,7 @@ public void testMapLikeTypeViaParametric() throws Exception } // [databind#2395] Can trigger problem this way too - // NOTE: oddly enough, seems to ONLY fail + // NOTE: oddly enough, seems to ONLY fail public void testTypeResolutionForRecursive() throws Exception { ObjectMapper mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/ArrayNodeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/ArrayNodeTest.java index b077904ec5..9f7686d82c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/ArrayNodeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/ArrayNodeTest.java @@ -26,10 +26,10 @@ public void testDirectCreation() throws IOException assertFalse(n.isBoolean()); assertFalse(n.isTextual()); assertFalse(n.isNumber()); - assertFalse(n.canConvertToInt()); - assertFalse(n.canConvertToLong()); - assertFalse(n.canConvertToExactIntegral()); - + assertFalse(n.canConvertToInt()); + assertFalse(n.canConvertToLong()); + assertFalse(n.canConvertToExactIntegral()); + assertStandardEquals(n); assertFalse(n.elements().hasNext()); assertFalse(n.fieldNames().hasNext()); @@ -53,7 +53,7 @@ public void testDirectCreation() throws IOException assertTrue(n.hasNonNull(0)); assertFalse(n.has(1)); assertFalse(n.hasNonNull(1)); - + // add null node too n.add((JsonNode) null); assertEquals(2, n.size()); @@ -244,7 +244,7 @@ public void testNullAdds() array.add((String) null); assertEquals(10, array.size()); - + for (JsonNode node : array) { assertTrue(node.isNull()); } @@ -286,7 +286,7 @@ public void testNullInserts() array.insert(1, (String) null); assertEquals(10, array.size()); - + for (JsonNode node : array) { assertTrue(node.isNull()); } @@ -349,7 +349,7 @@ public void testNullChecking2() src.add("element"); dest.addAll(src); } - + public void testParser() throws Exception { ArrayNode n = new ArrayNode(JsonNodeFactory.instance); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/EmptyContentAsTreeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/EmptyContentAsTreeTest.java index 22f6acf803..f87f85ba71 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/EmptyContentAsTreeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/EmptyContentAsTreeTest.java @@ -97,7 +97,7 @@ public void testMissingNodeForEOFOtherMapper() throws Exception _assertMissing(MAPPER.readTree(EMPTY1)); _assertMissing(MAPPER.readTree(new StringReader(EMPTY0))); _assertMissing(MAPPER.readTree(new StringReader(EMPTY1))); - + _assertMissing(MAPPER.readTree(EMPTY0_BYTES)); _assertMissing(MAPPER.readTree(EMPTY0_BYTES, 0, EMPTY0_BYTES.length)); _assertMissing(MAPPER.readTree(new ByteArrayInputStream(EMPTY0_BYTES))); @@ -115,7 +115,7 @@ public void testMissingNodeViaObjectReader() throws Exception _assertMissing(MAPPER.reader().readTree(EMPTY1)); _assertMissing(MAPPER.reader().readTree(new StringReader(EMPTY0))); _assertMissing(MAPPER.reader().readTree(new StringReader(EMPTY1))); - + _assertMissing(MAPPER.reader().readTree(EMPTY0_BYTES)); _assertMissing(MAPPER.reader().readTree(EMPTY0_BYTES, 0, EMPTY0_BYTES.length)); _assertMissing(MAPPER.reader().readTree(new ByteArrayInputStream(EMPTY0_BYTES))); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/JsonPointerAtNodeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/JsonPointerAtNodeTest.java index fc599dd82a..4cb4061231 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/JsonPointerAtNodeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/JsonPointerAtNodeTest.java @@ -7,11 +7,11 @@ public class JsonPointerAtNodeTest extends BaseMapTest { private final ObjectMapper MAPPER = newJsonMapper(); - + public void testIt() throws Exception { final JsonNode SAMPLE_ROOT = MAPPER.readTree(SAMPLE_DOC_JSON_SPEC); - + // first: "empty" pointer points to context node: assertSame(SAMPLE_ROOT, SAMPLE_ROOT.at(JsonPointer.compile(""))); // second: "/" is NOT root, but "root property with name of Empty String" @@ -41,12 +41,12 @@ public void testLongNumbers() throws Exception { // First, with small int key JsonNode root = MAPPER.readTree("{\"123\" : 456}"); - JsonNode jn2 = root.at("/123"); + JsonNode jn2 = root.at("/123"); assertEquals(456, jn2.asInt()); // and then with above int-32: root = MAPPER.readTree("{\"35361706045\" : 1234}"); - jn2 = root.at("/35361706045"); + jn2 = root.at("/35361706045"); assertEquals(1234, jn2.asInt()); } diff --git a/src/test/java/com/fasterxml/jackson/databind/node/NodeContext2049Test.java b/src/test/java/com/fasterxml/jackson/databind/node/NodeContext2049Test.java index 27edc7c1c3..7c6c8d55cf 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/NodeContext2049Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/NodeContext2049Test.java @@ -92,7 +92,7 @@ protected JsonDeserializer newDelegatingInstance(JsonDeserializer newDeleg } } - + static class ParentSettingDeserializerContextual extends JsonDeserializer implements ContextualDeserializer { @Override @@ -125,13 +125,13 @@ public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx } } - + /* /********************************************************************** /* Test methods /********************************************************************** */ - + private ObjectMapper objectMapper; { objectMapper = new ObjectMapper(); @@ -151,18 +151,18 @@ public void setupModule(SetupContext context) { }); } - final static String JSON = "{\n" + - " \"children\": [\n" + - " {\n" + - " \"property\": \"value1\"\n" + - " },\n" + - " {\n" + - " \"property\": \"value2\"\n" + - " }\n" + - " ],\n" + - " \"singleChild\": {\n" + - " \"property\": \"value3\"\n" + - " }\n" + + final static String JSON = "{\n" + + " \"children\": [\n" + + " {\n" + + " \"property\": \"value1\"\n" + + " },\n" + + " {\n" + + " \"property\": \"value2\"\n" + + " }\n" + + " ],\n" + + " \"singleChild\": {\n" + + " \"property\": \"value3\"\n" + + " }\n" + "}"; public void testReadNoBuffering() throws IOException { diff --git a/src/test/java/com/fasterxml/jackson/databind/node/NodeFeaturesTest.java b/src/test/java/com/fasterxml/jackson/databind/node/NodeFeaturesTest.java index 109e4d2b18..726b6c44b6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/NodeFeaturesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/NodeFeaturesTest.java @@ -53,13 +53,13 @@ public void testImplicitVsExplicit() assertTrue(dfs.isExplicitlyEnabled(JsonNodeFeature.READ_NULL_PROPERTIES)); assertFalse(dfs.isExplicitlyDisabled(JsonNodeFeature.READ_NULL_PROPERTIES)); } - + /* /********************************************************************** /* ObjectNode property handling /********************************************************************** */ - + // [databind#3421] public void testReadNulls() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/node/NodeJDKSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/node/NodeJDKSerializationTest.java index d0c62d4b82..49f4edf5b1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/NodeJDKSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/NodeJDKSerializationTest.java @@ -66,7 +66,7 @@ private void _testBigArrayNodeSerialization(int expSize) throws Exception g.writeStringField("extra", "none#"+ix); g.writeEndObject(); } while (out.size() < expSize); - + g.writeEndArray(); } diff --git a/src/test/java/com/fasterxml/jackson/databind/node/NodeTestBase.java b/src/test/java/com/fasterxml/jackson/databind/node/NodeTestBase.java index faac4f9823..0de9261b31 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/NodeTestBase.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/NodeTestBase.java @@ -9,9 +9,9 @@ abstract class NodeTestBase extends BaseMapTest protected void assertNodeNumbersForNonNumeric(JsonNode n) { assertFalse(n.isNumber()); - assertFalse(n.canConvertToInt()); - assertFalse(n.canConvertToLong()); - assertFalse(n.canConvertToExactIntegral()); + assertFalse(n.canConvertToInt()); + assertFalse(n.canConvertToLong()); + assertFalse(n.canConvertToExactIntegral()); assertEquals(0, n.asInt()); assertEquals(-42, n.asInt(-42)); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/NumberNodesTest.java b/src/test/java/com/fasterxml/jackson/databind/node/NumberNodesTest.java index 76f1ff075f..a6ad436211 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/NumberNodesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/NumberNodesTest.java @@ -15,7 +15,7 @@ public class NumberNodesTest extends NodeTestBase { private final ObjectMapper MAPPER = objectMapper(); - + public void testShort() { ShortNode n = ShortNode.valueOf((short) 1); @@ -83,7 +83,7 @@ public void testInt() assertEquals("1", n.asText()); // 2.4 assertEquals("1", n.asText("foo")); - + assertNodeNumbers(n, 1, 1.0); assertTrue(IntNode.valueOf(0).canConvertToInt()); @@ -253,7 +253,7 @@ public void testFloat() assertTrue(FloatNode.valueOf(Integer.MAX_VALUE).canConvertToLong()); assertTrue(FloatNode.valueOf(Integer.MIN_VALUE).canConvertToLong()); } - + public void testDecimalNode() throws Exception { DecimalNode n = DecimalNode.valueOf(BigDecimal.ONE); @@ -303,14 +303,14 @@ public void testDecimalNode() throws Exception assertFalse(result.canConvertToExactIntegral()); assertTrue(result.canConvertToInt()); assertTrue(result.canConvertToLong()); - + assertEquals(value, result.numberValue()); assertEquals(value.toString(), result.asText()); // also, equality should work ok assertEquals(result, DecimalNode.valueOf(value)); } - + public void testDecimalNodeEqualsHashCode() { // We want DecimalNodes with equivalent _numeric_ values to be equal; @@ -354,7 +354,7 @@ public void testBigIntegerNode() throws Exception assertNodeNumbers(n, 1, 1.0); BigInteger maxLong = BigInteger.valueOf(Long.MAX_VALUE); - + n = BigIntegerNode.valueOf(maxLong); assertEquals(Long.MAX_VALUE, n.longValue()); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/ObjectNodeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/ObjectNodeTest.java index e891b8bdfe..6ba5bce219 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/ObjectNodeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/ObjectNodeTest.java @@ -29,13 +29,13 @@ public static class DataImpl implements Data public DataImpl(JsonNode n) { root = n; } - + @JsonValue public JsonNode value() { return root; } - + /* public Wrapper(ObjectNode n) { root = n; } - + @JsonValue public ObjectNode value() { return root; } */ @@ -87,10 +87,10 @@ public void testSimpleObject() throws Exception assertFalse(root.isBoolean()); assertFalse(root.isTextual()); assertFalse(root.isNumber()); - assertFalse(root.canConvertToInt()); - assertFalse(root.canConvertToLong()); - assertFalse(root.canConvertToExactIntegral()); - + assertFalse(root.canConvertToInt()); + assertFalse(root.canConvertToLong()); + assertFalse(root.canConvertToExactIntegral()); + Iterator it = root.iterator(); assertNotNull(it); assertTrue(it.hasNext()); @@ -132,13 +132,13 @@ public void testEmptyNodeAsValue() throws Exception Data w = MAPPER.readValue("{}", Data.class); assertNotNull(w); } - + public void testBasics() { ObjectNode n = new ObjectNode(JsonNodeFactory.instance); assertStandardEquals(n); assertTrue(n.isEmpty()); - + assertFalse(n.elements().hasNext()); assertFalse(n.fields().hasNext()); assertFalse(n.fieldNames().hasNext()); @@ -147,7 +147,7 @@ public void testBasics() TextNode text = TextNode.valueOf("x"); assertSame(n, n.set("a", text)); - + assertEquals(1, n.size()); assertTrue(n.elements().hasNext()); assertTrue(n.fields().hasNext()); @@ -168,7 +168,7 @@ public void testBasics() n2.put("b", 13); assertFalse(n.equals(n2)); n.setAll(n2); - + assertEquals(2, n.size()); n.set("null", (JsonNode)null); assertEquals(3, n.size()); @@ -381,7 +381,7 @@ public void testInvalidWithArrayLegacy() throws Exception verifyException(e, "has value that is not"); } } - + public void testSetAll() throws Exception { ObjectNode root = MAPPER.createObjectNode(); @@ -423,12 +423,12 @@ public void testSetAll() throws Exception public void testFailOnDupKeys() throws Exception { final String DUP_JSON = "{ \"a\":1, \"a\":2 }"; - + // first: verify defaults: assertFalse(MAPPER.isEnabled(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY)); ObjectNode root = (ObjectNode) MAPPER.readTree(DUP_JSON); assertEquals(2, root.path("a").asInt()); - + // and then enable checks: try { MAPPER.reader(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY).readTree(DUP_JSON); @@ -459,7 +459,7 @@ public void testEqualityWrtOrder() throws Exception ObjectNode ob2 = MAPPER.createObjectNode(); // same contents, different insertion order; should not matter - + ob1.put("a", 1); ob1.put("b", 2); ob1.put("c", 3); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/POJONodeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/POJONodeTest.java index 457c1fe886..d533cd5851 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/POJONodeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/POJONodeTest.java @@ -45,7 +45,7 @@ public void testPOJONodeCustomSer() throws Exception treeTest.putPOJO("data", data); final String EXP = "{\"data\":{\"aStr\":\"The value is: Hello!\"}}"; - + String mapOut = MAPPER.writer().withAttribute("myAttr", "Hello!").writeValueAsString(mapTest); assertEquals(EXP, mapOut); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/RequiredAccessorTest.java b/src/test/java/com/fasterxml/jackson/databind/node/RequiredAccessorTest.java index 092c2aa314..d530c9e7a3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/RequiredAccessorTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/RequiredAccessorTest.java @@ -26,7 +26,7 @@ public RequiredAccessorTest() throws Exception { public void testIMPORTANT() { _checkRequiredAtFail(TEST_OBJECT, "/data/weird/and/more", "/weird/and/more"); } - + public void testRequiredAtObjectOk() throws Exception { assertNotNull(TEST_OBJECT.requiredAt("/array")); assertNotNull(TEST_OBJECT.requiredAt("/array/0")); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestConversions.java b/src/test/java/com/fasterxml/jackson/databind/node/TestConversions.java index c94f92f68d..2f4b4a524f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestConversions.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestConversions.java @@ -50,14 +50,14 @@ static class Issue467Bean { @JsonSerialize(using=Issue467TreeSerializer.class) static class Issue467Tree { } - + static class Issue467Serializer extends JsonSerializer { @Override public void serialize(Issue467Bean value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeObject(new Issue467TmpBean(value.i)); } - } + } static class Issue467TreeSerializer extends JsonSerializer { @Override @@ -65,8 +65,8 @@ public void serialize(Issue467Tree value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeTree(BooleanNode.TRUE); } - } - + } + static class Issue467TmpBean { public int x; @@ -90,7 +90,7 @@ static class CustomSerializedPojo implements JsonSerializable public void setFoo(final String foo) { node.put("foo", foo); } - + @Override public void serialize(final JsonGenerator jgen, final SerializerProvider provider) throws IOException { @@ -105,9 +105,9 @@ public void serializeWithType(JsonGenerator g, typeSer.writeTypePrefix(g, typeIdDef); serialize(g, provider); typeSer.writeTypePrefix(g, typeIdDef); - } + } } - + /* /********************************************************** /* Unit tests @@ -115,7 +115,7 @@ public void serializeWithType(JsonGenerator g, */ private final ObjectMapper MAPPER = objectMapper(); - + public void testAsInt() throws Exception { assertEquals(9, IntNode.valueOf(9).asInt()); @@ -141,7 +141,7 @@ public void testAsBoolean() throws Exception assertEquals(true, new POJONode(Boolean.TRUE).asBoolean()); } - + // Deserializer to trigger the problem described in [JACKSON-554] public static class LeafDeserializer extends JsonDeserializer { @@ -189,7 +189,7 @@ public void testTreeToValueWithPOJO() throws Exception public void testBase64Text() throws Exception { // let's actually iterate over sets of encoding modes, lengths - + final int[] LENS = { 1, 2, 3, 4, 7, 9, 32, 33, 34, 35 }; final Base64Variant[] VARIANTS = { Base64Variants.MIME, @@ -242,7 +242,7 @@ public void testIssue709() throws Exception String json = MAPPER.writeValueAsString(node); Issue709Bean resultFromString = MAPPER.readValue(json, Issue709Bean.class); Issue709Bean resultFromConvert = MAPPER.convertValue(node, Issue709Bean.class); - + // all methods should work equally well: Assert.assertArrayEquals(inputData, resultFromString.data); Assert.assertArrayEquals(inputData, resultFromConvert.data); @@ -289,7 +289,7 @@ public void testConversionOfPojos() throws Exception { final Issue467Bean input = new Issue467Bean(13); final String EXP = "{\"x\":13}"; - + // first, sanity check String json = MAPPER.writeValueAsString(input); assertEquals(EXP, json); @@ -337,7 +337,7 @@ public void testConversionsOfNull() throws Exception pojo = MAPPER.treeToValue(n, MAPPER.constructType(Root.class)); assertNull(pojo); - + // [databind#2972] AtomicReference result = MAPPER.treeToValue(NullNode.instance, AtomicReference.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestDeepCopy.java b/src/test/java/com/fasterxml/jackson/databind/node/TestDeepCopy.java index 5f033fa8aa..c1993b9bb6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestDeepCopy.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestDeepCopy.java @@ -9,13 +9,13 @@ public class TestDeepCopy extends BaseMapTest { private final ObjectMapper mapper = new ObjectMapper(); - + public void testWithObjectSimple() { ObjectNode root = mapper.createObjectNode(); root.put("a", 3); assertEquals(1, root.size()); - + ObjectNode copy = root.deepCopy(); assertEquals(1, copy.size()); @@ -35,7 +35,7 @@ public void testWithArraySimple() ArrayNode root = mapper.createArrayNode(); root.add("a"); assertEquals(1, root.size()); - + ArrayNode copy = root.deepCopy(); assertEquals(1, copy.size()); @@ -61,7 +61,7 @@ public void testWithNested() assertEquals(1, leafObject.size()); leafArray.add(true); assertEquals(1, leafArray.size()); - + ObjectNode copy = root.deepCopy(); assertNotSame(copy, root); assertEquals(2, copy.size()); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestFindMethods.java b/src/test/java/com/fasterxml/jackson/databind/node/TestFindMethods.java index 743b80e457..fcecb29063 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestFindMethods.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestFindMethods.java @@ -60,7 +60,7 @@ public void testMatchingMultiple() throws Exception assertEquals("3", values.get(0)); assertEquals("42", values.get(1)); } - + private JsonNode _buildTree() throws Exception { final String SAMPLE = "{ \"a\" : { \"value\" : 3 }," diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestJsonNode.java b/src/test/java/com/fasterxml/jackson/databind/node/TestJsonNode.java index 7a311927ab..9fbc348e9d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestJsonNode.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestJsonNode.java @@ -29,9 +29,9 @@ public void testBoolean() throws Exception assertEquals(JsonToken.VALUE_FALSE, f.asToken()); assertFalse(f.isNumber()); - assertFalse(f.canConvertToInt()); - assertFalse(f.canConvertToLong()); - assertFalse(f.canConvertToExactIntegral()); + assertFalse(f.canConvertToInt()); + assertFalse(f.canConvertToLong()); + assertFalse(f.canConvertToExactIntegral()); // and ditto for true BooleanNode t = BooleanNode.getTrue(); @@ -46,7 +46,7 @@ public void testBoolean() throws Exception assertNodeNumbers(f, 0, 0.0); assertNodeNumbers(t, 1, 1.0); - + JsonNode result = objectMapper().readTree("true\n"); assertFalse(result.isNull()); assertFalse(result.isNumber()); @@ -75,9 +75,9 @@ public void testBinary() throws Exception data[1] = (byte) 3; BinaryNode n = BinaryNode.valueOf(data, 1, 1); assertFalse(n.isNumber()); - assertFalse(n.canConvertToInt()); - assertFalse(n.canConvertToLong()); - assertFalse(n.canConvertToExactIntegral()); + assertFalse(n.canConvertToInt()); + assertFalse(n.canConvertToLong()); + assertFalse(n.canConvertToExactIntegral()); data[2] = (byte) 3; BinaryNode n2 = BinaryNode.valueOf(data, 2, 1); @@ -177,7 +177,7 @@ public int compare(JsonNode o1, JsonNode o2) { ArrayNode array3 = MAPPER.createArrayNode(); array3.add(123); - + assertFalse(root2.equals(cmp, nestedArray1)); assertTrue(nestedArray1.equals(cmp, nestedArray1)); assertFalse(nestedArray1.equals(cmp, root2)); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestNullNode.java b/src/test/java/com/fasterxml/jackson/databind/node/TestNullNode.java index a5d4471b8e..74627df982 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestNullNode.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestNullNode.java @@ -19,9 +19,9 @@ final static class CovarianceBean { @SuppressWarnings("serial") static class MyNull extends NullNode { } - + private final ObjectMapper MAPPER = sharedMapper(); - + public void testBasicsWithNullNode() throws Exception { // Let's use something that doesn't add much beyond JsonNode base @@ -37,9 +37,9 @@ public void testBasicsWithNullNode() throws Exception assertFalse(n.isMissingNode()); assertFalse(n.isNumber()); - assertFalse(n.canConvertToInt()); - assertFalse(n.canConvertToLong()); - assertFalse(n.canConvertToExactIntegral()); + assertFalse(n.canConvertToInt()); + assertFalse(n.canConvertToLong()); + assertFalse(n.canConvertToExactIntegral()); // fallback accessors assertFalse(n.booleanValue()); @@ -80,7 +80,7 @@ public void testNullHandling() throws Exception n = objectMapper().readTree("null"); assertNotNull(n); assertTrue(n.isNull()); - + // Then object property ObjectNode root = (ObjectNode) objectReader().readTree("{\"x\":null}"); assertEquals(1, root.size()); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestTreeTraversingParser.java b/src/test/java/com/fasterxml/jackson/databind/node/TestTreeTraversingParser.java index ff406ac2c0..45ebcab41b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestTreeTraversingParser.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestTreeTraversingParser.java @@ -31,7 +31,7 @@ public static class Jackson370Bean { public static class Inner { public String value; } - + /* /********************************************************** /* Test methods @@ -130,7 +130,7 @@ public void testArray() throws Exception assertToken(JsonToken.END_ARRAY, p.nextToken()); p.close(); } - + public void testNested() throws Exception { // For convenience, parse tree from JSON first @@ -154,14 +154,14 @@ public void testNested() throws Exception assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); - + assertToken(JsonToken.END_ARRAY, p.nextToken()); assertToken(JsonToken.END_ARRAY, p.nextToken()); assertToken(JsonToken.END_OBJECT, p.nextToken()); p.close(); } - + /** * Unit test that verifies that we can (re)parse sample document * from JSON specification. @@ -265,7 +265,7 @@ public void testSkipChildrenWrt370() throws Exception n.putObject("unknown").putNull("inner"); Jackson370Bean obj = MAPPER.readValue(n.traverse(), Jackson370Bean.class); assertNotNull(obj.inner); - assertEquals("test", obj.inner.value); + assertEquals("test", obj.inner.value); } // // // Numeric coercion checks, [databind#2189] diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TestTreeWithType.java b/src/test/java/com/fasterxml/jackson/databind/node/TestTreeWithType.java index 5e164e1a29..2133f85d14 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TestTreeWithType.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TestTreeWithType.java @@ -49,8 +49,8 @@ public SavedCookie deserializeWithType(JsonParser jp, DeserializationContext ctx { return (SavedCookie) typeDeserializer.deserializeTypedFromObject(jp, ctxt); } - } - + } + /* /********************************************************** /* Unit tests diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TextNodeTest.java b/src/test/java/com/fasterxml/jackson/databind/node/TextNodeTest.java index 1d6aaa1117..a5c364a767 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TextNodeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TextNodeTest.java @@ -14,16 +14,16 @@ public void testText() assertNodeNumbers(TextNode.valueOf("-3"), -3, -3.0); assertNodeNumbers(TextNode.valueOf("17.75"), 17, 17.75); - + long value = 127353264013893L; TextNode n = TextNode.valueOf(String.valueOf(value)); assertEquals(value, n.asLong()); assertFalse(n.isNumber()); - assertFalse(n.canConvertToInt()); - assertFalse(n.canConvertToLong()); - assertFalse(n.canConvertToExactIntegral()); - + assertFalse(n.canConvertToInt()); + assertFalse(n.canConvertToLong()); + assertFalse(n.canConvertToExactIntegral()); + // and then with non-numeric input n = TextNode.valueOf("foobar"); assertNodeNumbersForNonNumeric(n); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/ToStringForNodesTest.java b/src/test/java/com/fasterxml/jackson/databind/node/ToStringForNodesTest.java index 28513cc7ac..24f7babb13 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/ToStringForNodesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/ToStringForNodesTest.java @@ -28,7 +28,7 @@ public void testBinaryNode() throws Exception { _verifyToStrings(MAPPER.getNodeFactory().binaryNode(new byte[] { 1, 2, 3, 4, 6 })); } - + protected void _verifyToStrings(JsonNode node) throws Exception { assertEquals(MAPPER.writeValueAsString(node), node.toString()); diff --git a/src/test/java/com/fasterxml/jackson/databind/node/TreeReadViaMapperTest.java b/src/test/java/com/fasterxml/jackson/databind/node/TreeReadViaMapperTest.java index c27f9dbcd2..888b7180cc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/node/TreeReadViaMapperTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/node/TreeReadViaMapperTest.java @@ -32,13 +32,13 @@ public void testSimple() throws Exception assertType(result, ObjectNode.class); assertEquals(1, result.size()); assertTrue(result.isObject()); - + ObjectNode main = (ObjectNode) result; assertEquals("Image", main.fieldNames().next()); JsonNode ob = main.elements().next(); assertType(ob, ObjectNode.class); ObjectNode imageMap = (ObjectNode) ob; - + assertEquals(5, imageMap.size()); ob = imageMap.get("Width"); assertTrue(ob.isIntegralNumber()); @@ -47,11 +47,11 @@ public void testSimple() throws Exception ob = imageMap.get("Height"); assertTrue(ob.isIntegralNumber()); assertEquals(SAMPLE_SPEC_VALUE_HEIGHT, ob.intValue()); - + ob = imageMap.get("Title"); assertTrue(ob.isTextual()); assertEquals(SAMPLE_SPEC_VALUE_TITLE, ob.textValue()); - + ob = imageMap.get("Thumbnail"); assertType(ob, ObjectNode.class); ObjectNode tn = (ObjectNode) ob; @@ -64,7 +64,7 @@ public void testSimple() throws Exception ob = tn.get("Width"); assertTrue(ob.isTextual()); assertEquals(SAMPLE_SPEC_VALUE_TN_WIDTH, ob.textValue()); - + ob = imageMap.get("IDs"); assertTrue(ob.isArray()); ArrayNode idList = (ArrayNode) ob; diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/AbstractWithObjectIdTest.java b/src/test/java/com/fasterxml/jackson/databind/objectid/AbstractWithObjectIdTest.java index 928be8cdf7..058e2eb44c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/AbstractWithObjectIdTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/AbstractWithObjectIdTest.java @@ -62,7 +62,7 @@ public void testIssue877() throws Exception // write and print the JSON String json = om.writerWithDefaultPrettyPrinter().writeValueAsString(myList); ListWrapper result; - + result = om.readValue(json, new TypeReference>() { }); assertNotNull(result); diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/AlwaysAsReferenceFirstTest.java b/src/test/java/com/fasterxml/jackson/databind/objectid/AlwaysAsReferenceFirstTest.java index f3a10d9470..0ccadaf8b8 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/AlwaysAsReferenceFirstTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/AlwaysAsReferenceFirstTest.java @@ -27,7 +27,7 @@ static class Bar { static class Value1607 { public int value; - + public Value1607() { this(0); } public Value1607(int v) { value = v; @@ -59,7 +59,7 @@ static class ReallyAlwaysContainer /* Test methods /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); // [databind#1255] diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/JSOGDeserialize622Test.java b/src/test/java/com/fasterxml/jackson/databind/objectid/JSOGDeserialize622Test.java index 34db478696..68427d3b71 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/JSOGDeserialize622Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/JSOGDeserialize622Test.java @@ -127,7 +127,7 @@ public JSOGRef(int val) { public int hashCode() { return ref; } - + @Override public boolean equals(Object other) { return (other instanceof JSOGRef) @@ -186,7 +186,7 @@ public static class Outer { public Inner inner1; public Inner inner2; } - + /* /********************************************************************** /* Test methods @@ -194,7 +194,7 @@ public static class Outer { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + // Basic for [databind#622] public void testStructJSOGRef() throws Exception { @@ -232,7 +232,7 @@ public void testAlterativePolymorphicRoundTrip669() throws Exception outer.inner1 = outer.inner2 = new SubInner("bar", "extra"); String jsog = MAPPER.writeValueAsString(outer); - + Outer back = MAPPER.readValue(jsog, Outer.class); assertSame(back.inner1, back.inner2); diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java index 91eda5e44b..921dc5c0a1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId687Test.java @@ -102,5 +102,5 @@ public void testSerializeDeserializeNoCreator() throws IOException { // also, compare by re-serializing: assertEquals(json, MAPPER.writeValueAsString(result)); - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825BTest.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825BTest.java index f3e4e70216..2ad46b3faa 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825BTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825BTest.java @@ -195,7 +195,7 @@ public void testFull825() throws Exception // also replace package final String newPkg = getClass().getName() + "\\$"; INPUT = INPUT.replaceAll("_PKG_", newPkg); - + CTC result = mapper.readValue(INPUT, CTC.class); assertNotNull(result); } diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825Test.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825Test.java index 343cc427d7..cc465d8647 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectId825Test.java @@ -15,7 +15,7 @@ public static class AbstractEntity { public static class TestA extends AbstractEntity { public TestAbst testAbst; public TestD d; - } + } static class TestAbst extends AbstractEntity { } diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithCreator1261Test.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithCreator1261Test.java index c9a3f6689c..ba3100e91b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithCreator1261Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithCreator1261Test.java @@ -28,7 +28,7 @@ static class Parent public String name; protected Parent() { } - + public Parent(String name, boolean ignored) { children = new TreeMap(); this.name = name; @@ -50,7 +50,7 @@ static class Child public String someNullProperty; protected Child() { } - + @JsonCreator public Child(@JsonProperty("name") String name, @JsonProperty("someNullProperty") String someNullProperty) { diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithInjectables538Test.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithInjectables538Test.java index 8f817d8cb9..7dedea62da 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithInjectables538Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ObjectIdWithInjectables538Test.java @@ -21,14 +21,14 @@ public static class B { @JsonCreator public B(@JacksonInject("i2") String injected) { } - } + } /* /***************************************************** /* Test methods /***************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); public void testWithInjectables538() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/ReferentialWithObjectIdTest.java b/src/test/java/com/fasterxml/jackson/databind/objectid/ReferentialWithObjectIdTest.java index a1915dd581..cc9990d70d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/ReferentialWithObjectIdTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/ReferentialWithObjectIdTest.java @@ -32,7 +32,7 @@ public Employee next(Employee n) { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testAtomicWithObjectId() throws Exception { Employee first = new Employee(); @@ -52,7 +52,7 @@ public void testAtomicWithObjectId() throws Exception String json = MAPPER.writeValueAsString(input); // and back - + EmployeeList result = MAPPER.readValue(json, EmployeeList.class); Employee firstB = result.first.get(); assertNotNull(firstB); diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectId.java b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectId.java index 560484b1d9..bf97e2375e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectId.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectId.java @@ -14,7 +14,7 @@ public class TestObjectId extends BaseMapTest static class Wrapper { public ColumnMetadata a, b; } - + @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") static class ColumnMetadata { private final String name; @@ -45,13 +45,13 @@ public String getType() { @JsonProperty("comment") public String getComment() { return comment; - } + } } /* Problem in which always-as-id reference may prevent initial * serialization of a POJO. */ - + static class Company { public List employees; @@ -67,15 +67,15 @@ public void add(Employee e) { generator=ObjectIdGenerators.PropertyGenerator.class) public static class Employee { public int id; - + public String name; - + @JsonIdentityReference(alwaysAsId=true) public Employee manager; @JsonIdentityReference(alwaysAsId=true) public List reports; - + public Employee() { } public Employee(int id, String name, Employee manager) { this.id = id; @@ -124,9 +124,9 @@ static class JsonJdbcSchema extends JsonSchema { } /* Test methods /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testColumnMetadata() throws Exception { ColumnMetadata col = new ColumnMetadata("Billy", "employee", "comment"); @@ -134,12 +134,12 @@ public void testColumnMetadata() throws Exception w.a = col; w.b = col; String json = MAPPER.writeValueAsString(w); - + Wrapper deserialized = MAPPER.readValue(json, Wrapper.class); assertNotNull(deserialized); assertNotNull(deserialized.a); assertNotNull(deserialized.b); - + assertEquals("Billy", deserialized.a.getName()); assertEquals("employee", deserialized.a.getType()); assertEquals("comment", deserialized.a.getComment()); @@ -159,7 +159,7 @@ public void testMixedRefsIssue188() throws Exception JsonMapper mapper = JsonMapper.builder().enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY).build(); String json = mapper.writeValueAsString(comp); - + assertEquals("{\"employees\":[" +"{\"id\":1,\"manager\":null,\"name\":\"First\",\"reports\":[2]}," +"{\"id\":2,\"manager\":1,\"name\":\"Second\",\"reports\":[]}" @@ -178,7 +178,7 @@ public void testObjectAndTypeId() throws Exception String json = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(inputRoot); - + BaseEntity resultRoot = mapper.readValue(json, BaseEntity.class); assertNotNull(resultRoot); assertTrue(resultRoot instanceof Bar); diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdDeserialization.java index 51dee53ea2..bc213b734b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdDeserialization.java @@ -72,7 +72,7 @@ public IdWrapper(int v) { static class ValueNode { public int value; public IdWrapper next; - + public ValueNode() { this(0); } public ValueNode(int v) { value = v; } } @@ -85,9 +85,9 @@ static class IdentifiableCustom public int value; public int customId; - + public IdentifiableCustom next; - + public IdentifiableCustom() { this(-1, 0); } public IdentifiableCustom(int i, int v) { customId = i; @@ -112,7 +112,7 @@ static class ValueNodeExt public int value; protected int customId; public IdWrapperExt next; - + public ValueNodeExt() { this(0); } public ValueNodeExt(int v) { value = v; } @@ -120,7 +120,7 @@ public void setCustomId(int i) { customId = i; } } - + static class MappedCompany { public Map employees; } @@ -171,7 +171,7 @@ public boolean canUseFor(ObjectIdResolver resolverType) { return resolverType.getClass() == getClass() && _pool != null && !_pool.isEmpty(); } - + @Override public ObjectIdResolver newForDeserialization(Object c) { @@ -210,7 +210,7 @@ public void testMissingObjectId() throws Exception assertNotNull(result.next); assertEquals(29, result.next.value); } - + public void testSimpleUUIDForClassRoundTrip() throws Exception { UUIDNode root = new UUIDNode(1); @@ -241,7 +241,7 @@ public void testSimpleUUIDForClassRoundTrip() throws Exception // Bit more complex, due to extra wrapping etc: private final static String EXP_SIMPLE_INT_PROP = "{\"node\":{\"@id\":1,\"value\":7,\"next\":{\"node\":1}}}"; - + public void testSimpleDeserializationProperty() throws Exception { IdWrapper result = MAPPER.readValue(EXP_SIMPLE_INT_PROP, IdWrapper.class); @@ -322,9 +322,9 @@ public void testForwardReferenceAnySetterCombo() throws Exception { public void testUnresolvedForwardReference() throws Exception { - String json = "{\"employees\":[" + String json = "{\"employees\":[" + "{\"id\":1,\"name\":\"First\",\"manager\":null,\"reports\":[3]}," - + "{\"id\":2,\"name\":\"Second\",\"manager\":3,\"reports\":[]}" + + "{\"id\":2,\"name\":\"Second\",\"manager\":3,\"reports\":[]}" + "]}"; try { MAPPER.readValue(json, Company.class); @@ -407,7 +407,7 @@ public void testCustomDeserializationClass() throws Exception } private final static String EXP_CUSTOM_VIA_PROP = "{\"node\":{\"customId\":3,\"value\":99,\"next\":{\"node\":3}}}"; - + public void testCustomDeserializationProperty() throws Exception { // then bring back... @@ -460,7 +460,7 @@ static class Identifiable public void testNullObjectId() throws Exception { // Ok, so missing Object Id is ok, but so is null. - + Identifiable value = MAPPER.readValue (a2q("{'value':3, 'next':null, 'id':null}"), Identifiable.class); assertNotNull(value); diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdSerialization.java b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdSerialization.java index 903fe30e38..d9ebdce2f9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdSerialization.java @@ -19,7 +19,7 @@ static class Identifiable public int value; public Identifiable next; - + public Identifiable() { this(0); } public Identifiable(int v) { value = v; @@ -32,7 +32,7 @@ static class StringIdentifiable public int value; public StringIdentifiable next; - + public StringIdentifiable() { this(0); } public StringIdentifiable(int v) { value = v; @@ -48,7 +48,7 @@ static class IdentifiableWithProp public int customId; public IdentifiableWithProp next; - + public IdentifiableWithProp() { this(0, 0); } public IdentifiableWithProp(int id, int value) { this.customId = id; @@ -57,7 +57,7 @@ public IdentifiableWithProp(int id, int value) { } // For property reference, need another class: - + static class IdWrapper { @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") @@ -72,13 +72,13 @@ public IdWrapper(int v) { static class ValueNode { public int value; public IdWrapper next; - + public ValueNode() { this(0); } public ValueNode(int v) { value = v; } } // Similarly for property-ref via property: - + protected static class IdWrapperCustom { @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") @@ -96,7 +96,7 @@ protected static class ValueNodeCustom { public IdWrapperCustom next; public int getId() { return id; } - + public ValueNodeCustom() { this(0, 0); } public ValueNodeCustom(int id, int value) { this.id = id; @@ -108,7 +108,7 @@ public ValueNodeCustom(int id, int value) { static class AlwaysAsId { public int value; - + public AlwaysAsId() { this(0); } public AlwaysAsId(int v) { value = v; @@ -121,7 +121,7 @@ static class AlwaysContainer { @JsonIdentityReference(alwaysAsId=true) public AlwaysAsId a = new AlwaysAsId(13); - + @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="id") @JsonIdentityReference(alwaysAsId=true) public Value b = new Value(); @@ -187,14 +187,14 @@ public IdentifiableStringId(int v) { */ private final static String EXP_SIMPLE_INT_CLASS = "{\"id\":1,\"next\":1,\"value\":13}"; - + private final ObjectMapper MAPPER = objectMapper(); public void testSimpleSerializationClass() throws Exception { Identifiable src = new Identifiable(13); src.next = src; - + // First, serialize: JsonMapper mapper = JsonMapper.builder().enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY).build(); String json = mapper.writeValueAsString(src); @@ -204,7 +204,7 @@ public void testSimpleSerializationClass() throws Exception json = mapper.writeValueAsString(src); assertEquals(EXP_SIMPLE_INT_CLASS, json); } - + // Bit more complex, due to extra wrapping etc: private final static String EXP_SIMPLE_INT_PROP = "{\"node\":{\"@id\":1,\"next\":{\"node\":1},\"value\":7}}"; @@ -212,7 +212,7 @@ public void testSimpleSerializationProperty() throws Exception { IdWrapper src = new IdWrapper(7); src.node.next = src; - + // First, serialize: JsonMapper mapper = JsonMapper.builder().enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY).build(); String json = mapper.writeValueAsString(src); @@ -228,7 +228,7 @@ public void testEmptyObjectWithId() throws Exception final ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(new EmptyObject()); assertEquals(a2q("{'@id':1}"), json); - } + } public void testSerializeWithOpaqueStringId() throws Exception { @@ -304,7 +304,7 @@ public void testAlwaysAsId() throws Exception public void testAlwaysIdForTree() throws Exception { - TreeNode root = new TreeNode(null, 1, "root"); + TreeNode root = new TreeNode(null, 1, "root"); TreeNode leaf = new TreeNode(root, 2, "leaf"); root.child = leaf; JsonMapper mapper = JsonMapper.builder().enable(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY).build(); @@ -312,7 +312,7 @@ public void testAlwaysIdForTree() throws Exception assertEquals("{\"id\":1,\"child\":" +"{\"id\":2,\"child\":null,\"name\":\"leaf\",\"parent\":1},\"name\":\"root\",\"parent\":null}", json); - + } //for [databind#1150] @@ -322,7 +322,7 @@ public void testNullStringPropertyId() throws Exception (a2q("{'value':3, 'next':null, 'id':null}"), IdentifiableStringId.class); assertNotNull(value); assertEquals(3, value.value); - } + } /* /***************************************************** diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithEquals.java b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithEquals.java index f5efa57441..e386e06617 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithEquals.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithEquals.java @@ -30,7 +30,7 @@ public Bar() { } public Bar(int i) { id = i; } - + @Override public int hashCode() { return id; @@ -91,7 +91,7 @@ public void testSimpleEquals() throws Exception Bar bar1 = new Bar(1); Bar bar2 = new Bar(2); // this is another bar which is supposed to be "equal" to bar1 - // due to the same ID and + // due to the same ID and // Bar class' equals() method will return true. Bar anotherBar1 = new Bar(1); @@ -103,7 +103,7 @@ public void testSimpleEquals() throws Exception String json = mapper.writeValueAsString(foo); assertEquals("{\"id\":1,\"bars\":[{\"id\":1},{\"id\":2}],\"otherBars\":[1,2]}", json); - Foo foo2 = mapper.readValue(json, Foo.class); + Foo foo2 = mapper.readValue(json, Foo.class); assertNotNull(foo2); assertEquals(foo.id, foo2.id); } diff --git a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithPolymorphic.java b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithPolymorphic.java index 39e70361eb..a34668ea35 100644 --- a/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithPolymorphic.java +++ b/src/test/java/com/fasterxml/jackson/databind/objectid/TestObjectIdWithPolymorphic.java @@ -42,7 +42,7 @@ public Impl(int v, int e) { public static class Base811 { public int id; public Base811 owner; - + protected Base811() {} public Base811(Process owner) { this.owner = owner; @@ -58,10 +58,10 @@ public Base811(Process owner) { public static class Process extends Base811 { protected int childIdCounter = 0; protected List children = new ArrayList(); - + public Process() { super(null); } } - + public static abstract class Activity extends Base811 { protected Activity parent; public Activity(Process owner, Activity parent) { @@ -72,7 +72,7 @@ protected Activity() { super(); } } - + public static class Scope extends Activity { public final List faultHandlers = new ArrayList(); public Scope(Process owner, Activity parent) { @@ -82,17 +82,17 @@ protected Scope() { super(); } } - + public static class FaultHandler extends Base811 { public final List catchBlocks = new ArrayList(); - + public FaultHandler(Process owner) { super(owner); } protected FaultHandler() {} } - + public static class Catch extends Scope { public Catch(Process owner, Activity parent) { super(owner, parent); @@ -114,9 +114,9 @@ public void testPolymorphicRoundtrip() throws Exception Impl in1 = new Impl(123, 456); in1.next = new Impl(111, 222); in1.next.next = in1; - + String json = mapper.writeValueAsString(in1); - + // then bring back... Base result0 = mapper.readValue(json, Base.class); assertNotNull(result0); @@ -137,14 +137,14 @@ public void testIssue811() throws Exception om.enable(SerializationFeature.INDENT_OUTPUT); om.activateDefaultTypingAsProperty(NoCheckSubTypeValidator.instance, DefaultTyping.NON_FINAL, "@class"); - + Process p = new Process(); Scope s = new Scope(p, null); FaultHandler fh = new FaultHandler(p); Catch c = new Catch(p, s); fh.catchBlocks.add(c); s.faultHandlers.add(fh); - + String json = om.writeValueAsString(p); Process restored = om.readValue(json, Process.class); assertNotNull(restored); diff --git a/src/test/java/com/fasterxml/jackson/databind/seq/ReadRecoveryTest.java b/src/test/java/com/fasterxml/jackson/databind/seq/ReadRecoveryTest.java index 7147c7fce9..4745eb88b5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/seq/ReadRecoveryTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/seq/ReadRecoveryTest.java @@ -70,7 +70,7 @@ public void testSimpleRootRecovery() throws Exception assertEquals(2, bean.b); assertFalse(it.hasNextValue()); - + it.close(); } @@ -99,7 +99,7 @@ public void testSimpleArrayRecovery() throws Exception assertEquals(2, bean.b); assertFalse(it.hasNextValue()); - + it.close(); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java b/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java index 23e8761c95..269dff3394 100644 --- a/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/seq/ReadValuesTest.java @@ -168,7 +168,7 @@ public void testRootBeansWithParser() throws Exception { final String JSON = "{\"a\":3}{\"a\":27} "; JsonParser jp = MAPPER.createParser(JSON); - + Iterator it = jp.readValuesAs(Bean.class); assertTrue(it.hasNext()); @@ -188,7 +188,7 @@ public void testRootArraysWithParser() throws Exception // NOTE: We must point JsonParser to the first element; if we tried to // use "managed" accessor, it would try to advance past START_ARRAY. assertToken(JsonToken.START_ARRAY, jp.nextToken()); - + Iterator it = MAPPER.readerFor(int[].class).readValues(jp); assertTrue(it.hasNext()); int[] array = it.next(); @@ -209,7 +209,7 @@ public void testHasNextWithEndArray() throws Exception { // use "managed" accessor, it would try to advance past START_ARRAY. assertToken(JsonToken.START_ARRAY, jp.nextToken()); jp.nextToken(); - + Iterator it = MAPPER.readerFor(Integer.class).readValues(jp); assertTrue(it.hasNext()); int value = it.next(); @@ -252,7 +252,7 @@ public void testNonRootBeans() throws Exception // explicitly passed JsonParser MUST point to the first token of // the first element assertToken(JsonToken.START_OBJECT, jp.nextToken()); - + Iterator it = MAPPER.readerFor(Bean.class).readValues(jp); assertTrue(it.hasNext()); @@ -275,7 +275,7 @@ public void testNonRootMapsWithParser() throws Exception // explicitly passed JsonParser MUST point to the first token of // the first element jp.clearCurrentToken(); - + Iterator> it = MAPPER.readerFor(Map.class).readValues(jp); assertTrue(it.hasNext()); @@ -334,12 +334,12 @@ public void testNonRootArraysUsingParser() throws Exception final String JSON = "[[1],[3]]"; JsonParser p = MAPPER.createParser(JSON); assertToken(JsonToken.START_ARRAY, p.nextToken()); - + // Important: as of 2.1, START_ARRAY can only be skipped if the // target type is NOT a Collection or array Java type. // So we have to explicitly skip it in this particular case. assertToken(JsonToken.START_ARRAY, p.nextToken()); - + Iterator it = MAPPER.readValues(p, int[].class); assertTrue(it.hasNext()); diff --git a/src/test/java/com/fasterxml/jackson/databind/seq/SequenceWriterTest.java b/src/test/java/com/fasterxml/jackson/databind/seq/SequenceWriterTest.java index 09515a46c4..158aa99bf2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/seq/SequenceWriterTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/seq/SequenceWriterTest.java @@ -21,7 +21,7 @@ static class Bean { public int a; public Bean(int value) { a = value; } - + @Override public boolean equals(Object o) { if (o == null || o.getClass() != getClass()) return false; @@ -38,14 +38,14 @@ static class PolyBase { @JsonTypeName("A") static class ImplA extends PolyBase { public int value; - + public ImplA(int v) { value = v; } } @JsonTypeName("B") static class ImplB extends PolyBase { public int b; - + public ImplB(int v) { b = v; } } @@ -64,7 +64,7 @@ static class BareBaseCloseable extends BareBase public int c = 3; boolean closed = false; - + @Override public void close() throws IOException { closed = true; @@ -76,7 +76,7 @@ static class CloseableValue implements Closeable public int x; public boolean closed; - + @Override public void close() throws IOException { closed = true; diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/AnyGetterTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/AnyGetterTest.java index 19dd2b2c85..7d06b9bddc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/AnyGetterTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/AnyGetterTest.java @@ -19,7 +19,7 @@ static class Bean static { extra.put("a", Boolean.TRUE); } - + public int getX() { return 3; } @JsonAnyGetter @@ -47,11 +47,11 @@ public Map any() { public int getValue() { return 42; } } - + static class MapAsAny { protected Map stuff = new LinkedHashMap(); - + @JsonAnyGetter public Map any() { return stuff; @@ -70,7 +70,7 @@ public Issue705Bean(String key, String value) { stuff = new LinkedHashMap(); stuff.put(key, value); } - + @JsonSerialize(using = Issue705Serializer.class) // @JsonSerialize(converter = MyConverter.class) @JsonAnyGetter @@ -109,7 +109,7 @@ public void addAdditionalProperty(String key, String value) { } additionalProperties.put(key,value); } - + public void setAdditionalProperties(Map additionalProperties) { this.additionalProperties = additionalProperties; } @@ -200,7 +200,7 @@ public void testDynaFieldBean() throws Exception */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testSimpleAnyBean() throws Exception { String json = MAPPER.writeValueAsString(new Bean()); @@ -244,7 +244,7 @@ public void testAnyWithNull() throws Exception public void testIssue705() throws Exception { - Issue705Bean input = new Issue705Bean("key", "value"); + Issue705Bean input = new Issue705Bean("key", "value"); String json = MAPPER.writeValueAsString(input); assertEquals("{\"stuff\":\"[key/value]\"}", json); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/BeanSerializerModifierTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/BeanSerializerModifierTest.java index 1609181aa9..1ab2d63405 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/BeanSerializerModifierTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/BeanSerializerModifierTest.java @@ -26,13 +26,13 @@ public class BeanSerializerModifierTest extends BaseMapTest static class SerializerModifierModule extends SimpleModule { protected BeanSerializerModifier modifier; - + public SerializerModifierModule(BeanSerializerModifier modifier) { super("test", Version.unknownVersion()); this.modifier = modifier; } - + @Override public void setupModule(SetupContext context) { @@ -52,9 +52,9 @@ static class Bean { static class RemovingModifier extends BeanSerializerModifier { private final String _removedProperty; - + public RemovingModifier(String remove) { _removedProperty = remove; } - + @Override public List changeProperties(SerializationConfig config, BeanDescription beanDesc, List beanProperties) @@ -69,7 +69,7 @@ public List changeProperties(SerializationConfig config, Bea return beanProperties; } } - + static class ReorderingModifier extends BeanSerializerModifier { @Override @@ -86,9 +86,9 @@ public List orderProperties(SerializationConfig config, Bean static class ReplacingModifier extends BeanSerializerModifier { private final JsonSerializer _serializer; - + public ReplacingModifier(JsonSerializer s) { _serializer = s; } - + @Override public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer serializer) { @@ -99,11 +99,11 @@ public JsonSerializer modifySerializer(SerializationConfig config, BeanDescri static class BuilderModifier extends BeanSerializerModifier { private final JsonSerializer _serializer; - + public BuilderModifier(JsonSerializer ser) { _serializer = ser; } - + @Override public BeanSerializerBuilder updateBuilder(SerializationConfig config, BeanDescription beanDesc, BeanSerializerBuilder builder) { @@ -114,7 +114,7 @@ public BeanSerializerBuilder updateBuilder(SerializationConfig config, static class BogusSerializerBuilder extends BeanSerializerBuilder { private final JsonSerializer _serializer; - + public BogusSerializerBuilder(BeanSerializerBuilder src, JsonSerializer ser) { super(src); @@ -126,13 +126,13 @@ public JsonSerializer build() { return _serializer; } } - + static class BogusBeanSerializer extends JsonSerializer { private final int _value; - + public BogusBeanSerializer(int v) { _value = v; } - + @Override public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException { @@ -177,7 +177,7 @@ public List changeProperties(SerializationConfig config, { return beanProperties; } - + @Override public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer serializer) { @@ -185,7 +185,7 @@ public JsonSerializer modifySerializer(SerializationConfig config, } } // [databind#120], arrays, collections, maps - + static class ArraySerializerModifier extends BeanSerializerModifier { @Override public JsonSerializer modifyArraySerializer(SerializationConfig config, @@ -274,7 +274,7 @@ public void testBuilderReplacement() throws Exception mapper.registerModule(new SerializerModifierModule(new BuilderModifier(new BogusBeanSerializer(17)))); Bean bean = new Bean(); assertEquals("17", mapper.writeValueAsString(bean)); - } + } public void testSerializerReplacement() throws Exception { ObjectMapper mapper = new ObjectMapper(); @@ -313,7 +313,7 @@ public void setupModule(SetupContext context) String json = mapper.writeValueAsString(new EmptyBean()); assertEquals("42", json); } - + // [databind#121] public void testModifyArraySerializer() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/CyclicTypeSerTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/CyclicTypeSerTest.java index 468b2f879a..daf42a1aea 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/CyclicTypeSerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/CyclicTypeSerTest.java @@ -38,7 +38,7 @@ static class Selfie2501 { public int id; public Selfie2501 parent; - + public Selfie2501(int id) { this.id = id; } } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/EnumAsMapKeyTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/EnumAsMapKeyTest.java index 4b22431074..c7f4685fa7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/EnumAsMapKeyTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/EnumAsMapKeyTest.java @@ -15,7 +15,7 @@ public class EnumAsMapKeyTest extends BaseMapTest { static class MapBean { public Map map = new HashMap<>(); - + public void add(ABCEnum key, int value) { map.put(key, Integer.valueOf(value)); } @@ -41,7 +41,7 @@ static enum MyEnum594 { static class MyStuff594 { public Map stuff = new EnumMap(MyEnum594.class); - + public MyStuff594(String value) { stuff.put(MyEnum594.VALUE_WITH_A_REALLY_LONG_NAME_HERE, value); } @@ -66,13 +66,13 @@ enum Foo661 { FOO; public static class Serializer extends JsonSerializer { @Override - public void serialize(Foo661 value, JsonGenerator jgen, SerializerProvider provider) + public void serialize(Foo661 value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeFieldName("X-"+value.name()); } } } - + // [databind#2129] public enum Type { FIRST, @@ -92,7 +92,7 @@ public TypeContainer(Type type, int value) { /* Test methods /********************************************************************** */ - + private final ObjectMapper MAPPER = newJsonMapper(); public void testMapWithEnumKeys() throws Exception @@ -131,7 +131,7 @@ public void testJsonValueForEnumMapKey() throws Exception { assertEquals(a2q("{'stuff':{'longValue':'foo'}}"), MAPPER.writeValueAsString(new MyStuff594("foo"))); } - + // [databind#2129] public void testEnumAsIndexForRootMap() throws Exception { @@ -153,7 +153,7 @@ public void testEnumAsIndexForRootMap() throws Exception .with(SerializationFeature.WRITE_ENUMS_USING_INDEX) .writeValueAsString(input)); } - + // [databind#2129] public void testEnumAsIndexForValueMap() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/FieldSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/FieldSerializationTest.java index 9b09a7688c..f14ea7f05c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/FieldSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/FieldSerializationTest.java @@ -32,7 +32,7 @@ static class SimpleFieldBean // ignored, not detectable either @JsonIgnore public int a; } - + static class SimpleFieldBean2 { @JsonSerialize String[] values; @@ -125,7 +125,7 @@ public Item240(String id, String state) { this.state = state; } } - + /* /********************************************************** /* Main tests, success @@ -206,7 +206,7 @@ public void testIssue240() throws Exception Item240 bean = new Item240("a12", null); assertEquals(MAPPER.writeValueAsString(bean), "{\"id\":\"a12\"}"); } - + /* /********************************************************** /* Main tests, failure cases diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/GenericTypeSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/GenericTypeSerializationTest.java index c1f8e0596d..fabd683ace 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/GenericTypeSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/GenericTypeSerializationTest.java @@ -14,7 +14,7 @@ public class GenericTypeSerializationTest extends BaseMapTest { static class Account { - private Long id; + private Long id; private String name; @JsonCreator @@ -44,19 +44,19 @@ public int hashCode() { static class Key { private final T id; - + public Key(T id) { this.id = id; } - + public T getId() { return id; } public Key getParent() { return null; } } - + static class Person1 { private Long id; private String name; private Key account; - + public Person1(String name) { this.name = name; } public String getName() { @@ -73,14 +73,14 @@ public Long getId() { public void setAccount(Key account) { this.account = account; - } + } } static class Person2 { private Long id; private String name; private List> accounts; - + public Person2(String name) { this.name = name; } @@ -101,7 +101,7 @@ static class GenericBogusWrapper { class Element { public T value; - + public Element(T v) { value = v; } } } @@ -110,7 +110,7 @@ class Element { static class Base727 { public int a; } - + @JsonPropertyOrder(alphabetic=true) static class Impl727 extends Base727 { public int b; @@ -453,7 +453,7 @@ public void testIssue468a() throws Exception { Person1 p1 = new Person1("John"); p1.setAccount(new Key(new Account("something", 42L))); - + // First: ensure we can serialize (pre 1.7 this failed) String json = MAPPER.writeValueAsString(p1); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/JsonValueSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/JsonValueSerializationTest.java index 77cc1ecef5..c475f348d8 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/JsonValueSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/JsonValueSerializationTest.java @@ -38,7 +38,7 @@ static class FieldValueClass public FieldValueClass(T v) { _value = v; } } - + /** * Another test class to check that it is also possible to * force specific serializer to use with @JsonValue annotated @@ -75,7 +75,7 @@ static class ValueBase { static class ValueType extends ValueBase { public String b = "b"; } - + // Finally, let's also test static vs dynamic type static class ValueWrapper { @JsonValue @@ -101,7 +101,7 @@ static class MapFieldBean stuff.put("b", "2"); } } - + static class MapAsNumber extends HashMap { @JsonValue @@ -127,27 +127,27 @@ static class DisabledJsonValue { static class IntExtBean { public List values = new ArrayList(); - + public void add(int v) { values.add(new Internal(v)); } } - + static class Internal { public int value; - + public Internal(int v) { value = v; } - + @JsonValue public External asExternal() { return new External(this); } } - + static class External { public int i; - + External(Internal e) { i = e.value; } } // [databind#167] - + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "boingo") @JsonSubTypes(value = {@JsonSubTypes.Type(name = "boopsy", value = AdditionInterfaceImpl.class) }) @@ -155,21 +155,21 @@ static interface AdditionInterface { public int add(int in); } - + public static class AdditionInterfaceImpl implements AdditionInterface { private final int toAdd; - + @JsonCreator public AdditionInterfaceImpl(@JsonProperty("toAdd") int toAdd) { this.toAdd = toAdd; } - + @JsonProperty public int getToAdd() { return toAdd; } - + @Override public int add(int in) { return in + toAdd; @@ -233,7 +233,7 @@ public B2822(final BigDecimal value ) { this.value = value; } } - + /* /********************************************************************** /* Test cases @@ -241,7 +241,7 @@ public B2822(final BigDecimal value ) { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testSimpleMethodJsonValue() throws Exception { assertEquals("\"abc\"", MAPPER.writeValueAsString(new ValueClass("abc"))); @@ -315,7 +315,7 @@ public void testInList() throws Exception { public void testPolymorphicSerdeWithDelegate() throws Exception { AdditionInterface adder = new AdditionInterfaceImpl(1); - + assertEquals(2, adder.add(1)); String json = MAPPER.writeValueAsString(adder); assertEquals("{\"boingo\":\"boopsy\",\"toAdd\":1}", json); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/RawValueTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/RawValueTest.java index 2500fb1b70..5d48c99009 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/RawValueTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/RawValueTest.java @@ -26,13 +26,13 @@ public class RawValueTest final static class ClassGetter { protected final T _value; - + protected ClassGetter(T value) { _value = value;} - + public T getNonRaw() { return _value; } @JsonProperty("raw") @JsonRawValue public T foobar() { return _value; } - + @JsonProperty @JsonRawValue protected T value() { return _value; } } @@ -54,7 +54,7 @@ public RawWrapped(String str) { */ private final ObjectMapper MAPPER = objectMapper(); - + public void testSimpleStringGetter() throws Exception { String value = "abc"; diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/SerializationFeaturesTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/SerializationFeaturesTest.java index c7c9467bbf..003f471940 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/SerializationFeaturesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/SerializationFeaturesTest.java @@ -29,7 +29,7 @@ public void close() throws IOException { private static class StringListBean { @SuppressWarnings("unused") public Collection values; - + public StringListBean(Collection v) { values = v; } } @@ -68,7 +68,7 @@ public void testCharArrays() throws IOException ObjectMapper m = new ObjectMapper(); // default: serialize as Strings assertEquals(q("abc"), m.writeValueAsString(chars)); - + // new feature: serialize as JSON array: m.configure(SerializationFeature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS, true); assertEquals("[\"a\",\"b\",\"c\"]", m.writeValueAsString(chars)); @@ -145,7 +145,7 @@ public void testSingleElementCollections() throws IOException final Set SET = new HashSet(); SET.add("foo"); assertEquals(EXP_STRINGS, writer.writeValueAsString(new StringListBean(SET))); - + // arrays: assertEquals("true", writer.writeValueAsString(new boolean[] { true })); assertEquals("[true,false]", writer.writeValueAsString(new boolean[] { true, false })); @@ -153,7 +153,7 @@ public void testSingleElementCollections() throws IOException assertEquals("3", writer.writeValueAsString(new short[] { 3 })); assertEquals("[3,2]", writer.writeValueAsString(new short[] { 3, 2 })); - + assertEquals("3", writer.writeValueAsString(new int[] { 3 })); assertEquals("[3,2]", writer.writeValueAsString(new int[] { 3, 2 })); @@ -165,7 +165,7 @@ public void testSingleElementCollections() throws IOException assertEquals("0.5", writer.writeValueAsString(new float[] { 0.5f })); assertEquals("[0.5,2.5]", writer.writeValueAsString(new float[] { 0.5f, 2.5f })); - + assertEquals(q("foo"), writer.writeValueAsString(new String[] { "foo" })); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestAnnotations.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestAnnotations.java index c9ff677f99..23d06162e1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestAnnotations.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestAnnotations.java @@ -104,10 +104,10 @@ static class SubClassBean extends BaseBean { static class GettersWithoutSetters { public int d = 0; - + @JsonCreator public GettersWithoutSetters(@JsonProperty("a") int a) { } - + // included, since there is a constructor property public int getA() { return 3; } @@ -128,7 +128,7 @@ static class GettersWithoutSetters2 @JsonProperty public int getA() { return 123; } } - + /* /********************************************************** /* Other helper classes @@ -163,7 +163,7 @@ public void serialize(Object value, JsonGenerator jgen, SerializerProvider provi */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testSimpleGetter() throws Exception { Map result = writeAndMap(MAPPER, new SizeClassGetter()); @@ -239,7 +239,7 @@ public void testGettersWithoutSetters() throws Exception ObjectMapper m = new ObjectMapper(); GettersWithoutSetters bean = new GettersWithoutSetters(123); assertFalse(m.isEnabled(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS)); - + // by default, all 4 found: assertEquals("{\"a\":3,\"b\":4,\"c\":5,\"d\":6}", m.writeValueAsString(bean)); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestArraySerialization.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestArraySerialization.java index e1cd38d696..7e83e65f0a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestArraySerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestArraySerialization.java @@ -7,7 +7,7 @@ public class TestArraySerialization extends BaseMapTest { private final ObjectMapper MAPPER = sharedMapper(); - + public void testLongStringArray() throws Exception { final int SIZE = 40000; @@ -33,7 +33,7 @@ public void testLongStringArray() throws Exception assertNull(jp.nextToken()); jp.close(); } - + public void testIntArray() throws Exception { String json = MAPPER.writeValueAsString(new int[] { 1, 2, 3, -7 }); @@ -63,7 +63,7 @@ public void testBigIntArray() throws Exception jp.close(); } } - + public void testLongArray() throws Exception { String json = MAPPER.writeValueAsString(new long[] { Long.MIN_VALUE, 0, Long.MAX_VALUE }); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestAutoDetectForSer.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestAutoDetectForSer.java index 78f086912a..a565de0d27 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestAutoDetectForSer.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestAutoDetectForSer.java @@ -74,7 +74,7 @@ public void testPrivateUsingGlobals() throws Exception VisibilityChecker vc = m.getVisibilityChecker(); vc = vc.withFieldVisibility(JsonAutoDetect.Visibility.ANY); m.setVisibility(vc); - + Map result = writeAndMap(m, new FieldBean()); assertEquals(3, result.size()); assertEquals("public", result.get("p1")); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestConfig.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestConfig.java index 33e457bf4a..674f87ba0e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestConfig.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestConfig.java @@ -41,7 +41,7 @@ static class Indentable { public static class SimpleBean { public int x = 1; } - + /* /********************************************************** /* Main tests @@ -57,7 +57,7 @@ public static class SimpleBean { public void testEnumIndexes() { int max = 0; - + for (SerializationFeature f : SerializationFeature.values()) { max = Math.max(max, f.ordinal()); } @@ -65,7 +65,7 @@ public void testEnumIndexes() fail("Max number of SerializationFeature enums reached: "+max); } } - + public void testDefaults() { SerializationConfig cfg = MAPPER.getSerializationConfig(); @@ -83,7 +83,7 @@ public void testDefaults() // since 1.3: assertTrue(cfg.isEnabled(MapperFeature.AUTO_DETECT_IS_GETTERS)); // since 1.4 - + assertTrue(cfg.isEnabled(SerializationFeature.FAIL_ON_EMPTY_BEANS)); // since 1.5 assertTrue(cfg.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)); @@ -134,7 +134,7 @@ public void testAnnotationsDisabled() throws Exception /** * Test for verifying working of [JACKSON-191] */ - public void testProviderConfig() throws Exception + public void testProviderConfig() throws Exception { ObjectMapper mapper = new ObjectMapper(); DefaultSerializerProvider prov = (DefaultSerializerProvider) mapper.getSerializerProvider(); @@ -214,7 +214,7 @@ public void testDateFormatConfig() throws Exception // also better stick via reader/writer as well assertEquals(tz1, mapper.writer().getConfig().getTimeZone()); assertEquals(tz1, mapper.reader().getConfig().getTimeZone()); - + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); f.setTimeZone(tz2); mapper.setDateFormat(f); @@ -225,7 +225,7 @@ public void testDateFormatConfig() throws Exception assertEquals(tz1, mapper.writer().getConfig().getTimeZone()); assertEquals(tz1, mapper.reader().getConfig().getTimeZone()); } - + private final static String getLF() { return System.getProperty("line.separator"); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java index 0fb2aeb65a..1334b38bfb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestCustomSerializers.java @@ -38,7 +38,7 @@ public void serialize(Element value, JsonGenerator gen, SerializerProvider provi gen.writeString("element"); } } - + @JsonSerialize(using = ElementSerializer.class) public static class ElementMixin {} @@ -59,7 +59,7 @@ public CustomEscapes() { _asciiEscapes['a'] = 'A'; // to basically give us "\A" instead of 'a' _asciiEscapes['b'] = CharacterEscapes.ESCAPE_STANDARD; // too force "\u0062" } - + @Override public int[] getEscapeCodesForAscii() { return _asciiEscapes; @@ -78,7 +78,7 @@ static class LikeNumber extends Number { public int x; public LikeNumber(int value) { x = value; } - + @Override public double doubleValue() { return x; @@ -255,7 +255,7 @@ public void testCustomEscapes() throws Exception assertEquals(q("foo\\u0062\\Ar"), MAPPER.writer(new CustomEscapes()).writeValueAsString("foobar")); } - + public void testNumberSubclass() throws Exception { assertEquals(a2q("{'x':42}"), @@ -276,7 +276,7 @@ public void testWithCustomElements() throws Exception MAPPER.writeValueAsString(wr)); // and then per-type registration - + SimpleModule module = new SimpleModule("test", Version.unknownVersion()); module.addSerializer(String.class, new UCStringSerializer()); ObjectMapper mapper = new ObjectMapper() diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestEmptyClass.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestEmptyClass.java index 654755e1cf..9c78613dc3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestEmptyClass.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestEmptyClass.java @@ -19,19 +19,19 @@ static class EmptyWithAnno { } @JsonSerialize(using=NonZeroSerializer.class) static class NonZero { public int nr; - + public NonZero(int i) { nr = i; } } @JsonInclude(JsonInclude.Include.NON_EMPTY) static class NonZeroWrapper { public NonZero value; - + public NonZeroWrapper(int i) { value = new NonZero(i); } } - + static class NonZeroSerializer extends JsonSerializer { @Override @@ -46,7 +46,7 @@ public boolean isEmpty(SerializerProvider provider, NonZero value) { return (value.nr == 0); } } - + /* /********************************************************** /* Test methods @@ -54,7 +54,7 @@ public boolean isEmpty(SerializerProvider provider, NonZero value) { */ protected final ObjectMapper mapper = new ObjectMapper(); - + /** * Test to check that [JACKSON-201] works if there is a recognized * annotation (which indicates type is serializable) diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestIterable.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestIterable.java index 5e098341cb..6edb39dea3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestIterable.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestIterable.java @@ -15,13 +15,13 @@ final static class IterableWrapper implements Iterable { List _ints = new ArrayList(); - + public IterableWrapper(int[] values) { for (int i : values) { _ints.add(Integer.valueOf(i)); } } - + @Override public Iterator iterator() { return _ints.iterator(); @@ -79,7 +79,7 @@ public void remove() { } public int getX() { return 13; } } - + // [databind#358] static class A { public String unexpected = "Bye."; @@ -123,7 +123,7 @@ public void testIterator() throws IOException l.add(null); l.add(-9); l.add(0); - + assertEquals("[1,null,-9,0]", MAPPER.writeValueAsString(l.iterator())); l.clear(); assertEquals("[]", MAPPER.writeValueAsString(l.iterator())); @@ -142,7 +142,7 @@ public void testWithIterable() throws IOException assertEquals("[1,2,3]", STATIC_MAPPER.writeValueAsString(new IntIterable())); } - + public void testWithIterator() throws IOException { assertEquals("{\"values\":[\"itValue\"]}", diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize.java index ecfc798558..269bdc6f0d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize.java @@ -87,7 +87,7 @@ static class ValueMap extends HashMap { } static class ValueList extends ArrayList { } @SuppressWarnings("serial") static class ValueLinkedList extends LinkedList { } - + // Classes for [JACKSON-294] static class Foo294 { @@ -132,7 +132,7 @@ public void serialize(Bar294 bar, JsonGenerator jgen, */ final ObjectMapper MAPPER = objectMapper(); - + @SuppressWarnings("unchecked") public void testSimpleValueDefinition() throws Exception { @@ -216,7 +216,7 @@ public void testStaticTypingWithLinkedList() throws Exception list.add(new ValueClass()); assertEquals("[{\"x\":3}]", serializeAsString(m, list)); } - + public void testStaticTypingWithArray() throws Exception { ObjectMapper m = jsonMapperBuilder() @@ -248,7 +248,7 @@ public void testWithIsGetter() throws Exception .setVisibility(PropertyAccessor.FIELD, Visibility.ANY) .setVisibility(PropertyAccessor.CREATOR, Visibility.NONE) .setVisibility(PropertyAccessor.IS_GETTER, Visibility.NONE) - .setVisibility(PropertyAccessor.SETTER, Visibility.NONE); + .setVisibility(PropertyAccessor.SETTER, Visibility.NONE); final String JSON = m.writeValueAsString(new Response()); assertEquals(a2q("{'a':'x','something':true}"), JSON); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java index 494003eb29..87f3fbbea6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize2.java @@ -16,15 +16,15 @@ public class TestJsonSerialize2 { static class SimpleKey { protected final String key; - + public SimpleKey(String str) { key = str; } - + @Override public String toString() { return "toString:"+key; } } static class SimpleValue { public final String value; - + public SimpleValue(String str) { value = str; } } @@ -32,7 +32,7 @@ static class SimpleValue { static class ActualValue extends SimpleValue { public final String other = "123"; - + public ActualValue(String str) { super(str); } } @@ -63,12 +63,12 @@ static class SimpleValueListWithSerializer extends ArrayList { } @JsonSerialize(keyUsing=SimpleKeySerializer.class, contentUsing=SimpleValueSerializer.class) static class SimpleValueMapWithSerializer extends HashMap { } - + static class ListWrapperSimple { @JsonSerialize(contentAs=SimpleValue.class) public final ArrayList values = new ArrayList(); - + public ListWrapperSimple(String value) { values.add(new ActualValue(value)); } @@ -78,17 +78,17 @@ static class ListWrapperWithSerializer { @JsonSerialize(contentUsing=SimpleValueSerializer.class) public final ArrayList values = new ArrayList(); - + public ListWrapperWithSerializer(String value) { values.add(new ActualValue(value)); } } - + static class MapWrapperSimple { @JsonSerialize(contentAs=SimpleValue.class) public final HashMap values = new HashMap(); - + public MapWrapperSimple(String key, String value) { values.put(new SimpleKey(key), new ActualValue(value)); } @@ -98,7 +98,7 @@ static class MapWrapperWithSerializer { @JsonSerialize(keyUsing=SimpleKeySerializer.class, contentUsing=SimpleValueSerializer.class) public final HashMap values = new HashMap(); - + public MapWrapperWithSerializer(String key, String value) { values.put(new SimpleKey(key), new ActualValue(value)); } @@ -117,7 +117,7 @@ static class NullBean */ private final ObjectMapper MAPPER = new ObjectMapper(); - + // test value annotation applied to List value class public void testSerializedAsListWithClassAnnotations() throws IOException { @@ -148,7 +148,7 @@ public void testSerializedAsListWithPropertyAnnotations() throws IOException ListWrapperSimple input = new ListWrapperSimple("bar"); assertEquals("{\"values\":[{\"value\":\"bar\"}]}", MAPPER.writeValueAsString(input)); } - + public void testSerializedAsMapWithClassSerializer() throws IOException { SimpleValueMapWithSerializer map = new SimpleValueMapWithSerializer(); @@ -162,7 +162,7 @@ public void testSerializedAsMapWithPropertyAnnotations() throws IOException assertEquals("{\"values\":{\"toString:a\":{\"value\":\"b\"}}}", MAPPER.writeValueAsString(input)); } - + public void testSerializedAsListWithPropertyAnnotations2() throws IOException { ListWrapperWithSerializer input = new ListWrapperWithSerializer("abc"); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize3.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize3.java index 9512acf3b3..866e7626a7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize3.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerialize3.java @@ -26,13 +26,13 @@ public void serialize(String value, JsonGenerator jgen, SerializerProvider provi static class MyObject { @JsonSerialize(contentUsing = FooToBarSerializer.class) List list; - } + } /* /********************************************************** /* Test methods /********************************************************** */ - + public void testCustomContentSerializer() throws Exception { ObjectMapper m = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerializeAs.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerializeAs.java index 4355bb7e5c..d6145d6d14 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerializeAs.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestJsonSerializeAs.java @@ -26,7 +26,7 @@ static class FooImplNoAnno implements Fooable { public int getFoo() { return 42; } public int getBar() { return 15; } } - + public class Fooables { public FooImpl[] getFoos() { return new FooImpl[] { new FooImpl() }; diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestRootType.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestRootType.java index da198b8dfd..d77adccc1c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestRootType.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestRootType.java @@ -30,7 +30,7 @@ public class TestRootType interface BaseInterface { int getB(); } - + static class BaseType implements BaseInterface { @@ -42,7 +42,7 @@ static class BaseType static class SubType extends BaseType { public String a2 = "x"; - + public boolean getB2() { return true; } } @@ -52,7 +52,7 @@ public abstract static class BaseClass398 { } public static class TestClass398 extends BaseClass398 { public String property = "aa"; } - + @JsonRootName("root") static class WithRootName { public int a = 3; @@ -66,7 +66,7 @@ static class TestCommandParent { } static class TestCommandChild extends TestCommandParent { } - + /* /********************************************************** /* Main tests @@ -77,7 +77,7 @@ static class TestCommandChild extends TestCommandParent { } { WRAP_ROOT_MAPPER.configure(SerializationFeature.WRAP_ROOT_VALUE, true); } - + @SuppressWarnings("unchecked") public void testSuperClass() throws Exception { @@ -126,7 +126,7 @@ public void testInArray() throws Exception // should propagate interface type through due to root declaration; static typing assertEquals("[{\"b\":3}]", json); } - + /** * Unit test to ensure that proper exception is thrown if declared * root type is not compatible with given value instance. @@ -162,7 +162,7 @@ public void testJackson398() throws Exception typedList.add(new TestClass398()); final String EXP = "[{\"beanClass\":\"TestRootType$TestClass398\",\"property\":\"aa\"}]"; - + // First simplest way: String json = mapper.writerFor(collectionType).writeValueAsString(typedList); assertEquals(EXP, json); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestSerializerProvider.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestSerializerProvider.java index 0dbad6c3a5..0f274f3f20 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestSerializerProvider.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestSerializerProvider.java @@ -14,7 +14,7 @@ static class MyBean { static class NoPropsBean { } - + public void testFindExplicit() throws IOException { ObjectMapper mapper = newJsonMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestSimpleTypes.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestSimpleTypes.java index 1509a53037..8b175a9e1f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestSimpleTypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestSimpleTypes.java @@ -14,7 +14,7 @@ public class TestSimpleTypes extends BaseMapTest { private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testBoolean() throws Exception { assertEquals("true", serializeAsString(MAPPER, Boolean.TRUE)); @@ -45,7 +45,7 @@ public void testByteArray() throws Exception public void testBase64Variants() throws Exception { final byte[] INPUT = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890X".getBytes("UTF-8"); - + // default encoding is "MIME, no linefeeds", so: assertEquals(q("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwWA=="), MAPPER.writeValueAsString(INPUT)); assertEquals(q("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwWA=="), @@ -60,7 +60,7 @@ public void testBase64Variants() throws Exception assertEquals(q("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwYWJjZGVmZ2hpamts\\nbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwWA=="), MAPPER.writer(Base64Variants.PEM).writeValueAsString(INPUT)); } - + public void testShortArray() throws Exception { assertEquals("[0,1]", serializeAsString(MAPPER, new short[] { 0, 1 })); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestTypedRootValueSerialization.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestTypedRootValueSerialization.java index ba43470833..4ba4dbc9dc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestTypedRootValueSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestTypedRootValueSerialization.java @@ -30,22 +30,22 @@ public void testTypedSerialization() throws Exception // start with specific value case: assertEquals("{\"a\":3}", singleJson); } - + // [JACKSON-822]: ensure that type can be coerced public void testTypedArrays() throws Exception { ObjectMapper mapper = new ObjectMapper(); -// Work-around when real solution not yet implemented: +// Work-around when real solution not yet implemented: // mapper.enable(MapperFeature.USE_STATIC_TYPING); assertEquals("[{\"a\":3}]", mapper.writerFor(Issue822Interface[].class).writeValueAsString( new Issue822Interface[] { new Issue822Impl() })); } - + // [JACKSON-822]: ensure that type can be coerced public void testTypedLists() throws Exception { ObjectMapper mapper = new ObjectMapper(); - // Work-around when real solution not yet implemented: + // Work-around when real solution not yet implemented: // mapper.enable(MapperFeature.USE_STATIC_TYPING); List list = new ArrayList(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/TestVirtualProperties.java b/src/test/java/com/fasterxml/jackson/databind/ser/TestVirtualProperties.java index adf09f3b25..5cfd885d93 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/TestVirtualProperties.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/TestVirtualProperties.java @@ -80,7 +80,7 @@ static class CustomVBean { public int value = 72; } - + /* /********************************************************** /* Test methods diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/CurrentObject3160Test.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/CurrentObject3160Test.java index e37ac4f7e5..f1809ad870 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/CurrentObject3160Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/CurrentObject3160Test.java @@ -28,7 +28,7 @@ public Item3160(Collection set, String id) { } } - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(name = "Foo", value = Foo.class) }) interface Strategy { } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/IgnorePropsForSerTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/IgnorePropsForSerTest.java index 3530e494d7..73176c1075 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/IgnorePropsForSerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/IgnorePropsForSerTest.java @@ -28,7 +28,7 @@ static class WrapperWithPropIgnore @JsonIgnoreProperties("y") public XY value = new XY(); } - + static class XY { public int x = 1; public int y = 2; @@ -80,7 +80,7 @@ static class IgnoreForListValuesXYZ { public IgnoreForListValuesXYZ() { coordinates = Arrays.asList(new XYZ()); } - } + } /* /**************************************************************** @@ -89,7 +89,7 @@ public IgnoreForListValuesXYZ() { */ private final ObjectMapper MAPPER = objectMapper(); - + public void testExplicitIgnoralWithBean() throws Exception { IgnoreSome value = new IgnoreSome(); @@ -129,12 +129,12 @@ public void testIgnoreViaPropForUntyped() throws Exception assertEquals("{\"value\":{\"z\":3}}", MAPPER.writeValueAsString(new WrapperWithPropIgnoreUntyped())); } - + public void testIgnoreWithMapProperty() throws Exception { assertEquals("{\"value\":{\"b\":2}}", MAPPER.writeValueAsString(new MapWrapper())); } - + public void testIgnoreViaPropsAndClass() throws Exception { assertEquals("{\"value\":{\"y\":2}}", diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonFilterTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonFilterTest.java index 06ce23f7c4..a81fcd5787 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonFilterTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonFilterTest.java @@ -90,7 +90,7 @@ public java.lang.String getUserPassword() { public void setUserPassword(String value) { this.userPassword = value; } - } + } // [Issue#306]: JsonFilter for properties, too! @@ -104,7 +104,7 @@ static class FilteredProps @JsonFilter("b") public Bean second = new Bean(); } - + /* /********************************************************** /* Unit tests @@ -131,7 +131,7 @@ public void testIncludeAllFilter() throws Exception SimpleBeanPropertyFilter.serializeAll()); assertEquals("{\"a\":\"a\",\"b\":\"b\"}", MAPPER.writer(prov).writeValueAsString(new Bean())); } - + public void testSimpleExclusionFilter() throws Exception { FilterProvider prov = new SimpleFilterProvider().addFilter("RootFilter", @@ -149,7 +149,7 @@ public void testMissingFilter() throws Exception } catch (InvalidDefinitionException e) { // should be resolved to this (internally may be something else) verifyException(e, "Cannot resolve PropertyFilter with id 'RootFilter'"); } - + // but when changing behavior, should work difference SimpleFilterProvider fp = new SimpleFilterProvider().setFailOnUnknownId(false); ObjectMapper mapper = new ObjectMapper(); @@ -157,14 +157,14 @@ public void testMissingFilter() throws Exception String json = mapper.writeValueAsString(new Bean()); assertEquals("{\"a\":\"a\",\"b\":\"b\"}", json); } - + // defaulting, as per [JACKSON-449] public void testDefaultFilter() throws Exception { FilterProvider prov = new SimpleFilterProvider().setDefaultFilter(SimpleBeanPropertyFilter.filterOutAllExcept("b")); assertEquals("{\"b\":\"b\"}", MAPPER.writer(prov).writeValueAsString(new Bean())); } - + // [databind#89] combining @JsonIgnore, @JsonProperty public void testIssue89() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeArrayTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeArrayTest.java index 4a48cf71c2..43fa2a208b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeArrayTest.java @@ -29,7 +29,7 @@ static class NonEmptyCharArray { public NonEmptyCharArray(char... v) { value = v; } } - + static class NonEmptyIntArray { @JsonInclude(JsonInclude.Include.NON_EMPTY) public int[] value; diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeCustomTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeCustomTest.java index 41232d3d2f..2cae3ebc50 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeCustomTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeCustomTest.java @@ -32,7 +32,7 @@ public boolean equals(Object other) { return false; } } - + static class FooBean { @JsonInclude(value=JsonInclude.Include.CUSTOM, valueFilter=FooFilter.class) @@ -78,7 +78,7 @@ static class CountingFooBean { public CountingFooBean(String v) { value = v; } } - + /* /********************************************************** /* Test methods, success @@ -125,7 +125,7 @@ public void testRepeatedCalls() throws Exception /* Test methods, fail handling /********************************************************** */ - + public void testBrokenFilter() throws Exception { try { diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java index 6c0a028d04..f0660d9d77 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/JsonIncludeTest.java @@ -23,7 +23,7 @@ static class SimpleBean public String getA() { return "a"; } public String getB() { return null; } } - + @JsonInclude(JsonInclude.Include.ALWAYS) // just to ensure default static class NoNullsBean { @@ -60,7 +60,7 @@ static class NonDefaultBeanXYZ this.z = z; } } - + @JsonInclude(JsonInclude.Include.NON_DEFAULT) static class MixedBean { @@ -241,7 +241,7 @@ public void testNonDefaultByClassNoCtor() throws IOException String json = MAPPER.writeValueAsString(bean); assertEquals(a2q("{'x':1,'y':2}"), json); } - + public void testMixedMethod() throws IOException { MixedBean bean = new MixedBean(); @@ -322,12 +322,12 @@ public void testIssue1351() throws Exception public void testInclusionOfDate() throws Exception { final Date input = new Date(0L); - assertEquals(a2q("{'value':0}"), + assertEquals(a2q("{'value':0}"), MAPPER.writeValueAsString(new NonEmptyDate(input))); - assertEquals("{}", + assertEquals("{}", MAPPER.writeValueAsString(new NonDefaultDate(input))); - + } // [databind#1550] @@ -335,9 +335,9 @@ public void testInclusionOfCalendar() throws Exception { final Calendar input = new GregorianCalendar(); input.setTimeInMillis(0L); - assertEquals(a2q("{'value':0}"), + assertEquals(a2q("{'value':0}"), MAPPER.writeValueAsString(new NonEmptyCalendar(input))); - assertEquals("{}", + assertEquals("{}", MAPPER.writeValueAsString(new NonDefaultCalendar(input))); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java index d6db1e1dab..1d473acb75 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/MapInclusion2573Test.java @@ -36,13 +36,13 @@ static class Car private final JsonInclude.Value BOTH_NON_NULL = JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL); - + // final private ObjectMapper MAPPER = objectMapper(); // [databind#2572] public void test2572MapDefault() throws Exception { - + ObjectMapper mapper = JsonMapper.builder() .defaultPropertyInclusion(BOTH_NON_NULL) .build(); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/NullSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/NullSerializationTest.java index d1cf0836b5..ee81699c81 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/NullSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/NullSerializationTest.java @@ -29,7 +29,7 @@ static class Bean1 { static class Bean2 { public String type = null; } - + @SuppressWarnings("serial") static class MyNullProvider extends DefaultSerializerProvider { @@ -43,7 +43,7 @@ public MyNullProvider(MyNullProvider base, SerializationConfig config, Serialize public DefaultSerializerProvider copy() { return this; } - + @Override public DefaultSerializerProvider createInstance(SerializationConfig config, SerializerFactory jsf) { return new MyNullProvider(this, config, jsf); @@ -70,7 +70,7 @@ static class BeanWithNullProps @JsonSerialize(nullsUsing=NullSerializer.class) static class NullValuedType { } */ - + /* /********************************************************** /* Test methods @@ -78,7 +78,7 @@ static class NullValuedType { } */ private final ObjectMapper MAPPER = objectMapper(); - + public void testSimple() throws Exception { assertEquals("null", MAPPER.writeValueAsString(null)); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/SerializationIgnore3357Test.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/SerializationIgnore3357Test.java index 862f39b502..6711ea7239 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/SerializationIgnore3357Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/SerializationIgnore3357Test.java @@ -36,5 +36,5 @@ public void testPropertyVsIgnore3357() throws Exception String json = MAPPER.writeValueAsString(new IgnoreAndProperty3357()); assertEquals("{\"toInclude\":2}", json); } - + } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestIgnoredTypes.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestIgnoredTypes.java index 6e11e52a8c..e418698c72 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestIgnoredTypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestIgnoredTypes.java @@ -27,7 +27,7 @@ static class NonIgnoredType } // // And test for mix-in annotations - + @JsonIgnoreType static class Person { public String name; @@ -41,7 +41,7 @@ static class PersonWrapper { public int value = 1; public Person person = new Person("Foo"); } - + @JsonIgnoreType static abstract class PersonMixin { } @@ -72,7 +72,7 @@ static class ContainsIgnorable { public int x = 13; } - + /* /********************************************************** /* Unit tests @@ -104,7 +104,7 @@ public void testSingleWithMixins() throws Exception { String json = mapper.writeValueAsString(input); assertEquals("{\"value\":1}", json); } - + public void testListWithMixins() throws Exception { SimpleModule module = new SimpleModule(); module.setMixInAnnotation(Person.class, PersonMixin.class); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java index 6d1f1c1a94..dfceadab41 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestMapFiltering.java @@ -33,7 +33,7 @@ static class MapBean { @JsonFilter("filterX") @CustomOffset(1) public Map values; - + public MapBean() { values = new LinkedHashMap(); values.put("a", 1); @@ -45,7 +45,7 @@ public MapBean() { static class MapBeanNoOffset { @JsonFilter("filterX") public Map values; - + public MapBeanNoOffset() { values = new LinkedHashMap(); values.put("a", 1); @@ -53,7 +53,7 @@ public MapBeanNoOffset() { values.put("c", 3); } } - + static class TestMapFilter implements PropertyFilter { @Override @@ -104,7 +104,7 @@ public void depositSchemaProperty(PropertyWriter writer, static class NoNullValuesMapContainer { @JsonInclude(content=JsonInclude.Include.NON_NULL) public Map stuff = new LinkedHashMap(); - + public NoNullValuesMapContainer add(String key, String value) { stuff.put(key, value); return this; @@ -161,7 +161,7 @@ public StringMap497 add(String key, String value) { */ final ObjectMapper MAPPER = objectMapper(); - + public void testMapFilteringViaProps() throws Exception { FilterProvider prov = new SimpleFilterProvider().addFilter("filterX", @@ -190,7 +190,7 @@ public void testNonNullValueMapViaProp() throws IOException .add("c", "bar")); assertEquals(a2q("{'stuff':{'a':'foo','c':'bar'}}"), json); } - + // [databind#522] public void testMapFilteringWithAnnotations() throws Exception { @@ -245,7 +245,7 @@ public void testMapNullSerialization() throws IOException assertEquals("{\"a\":null}", m.writeValueAsString(map)); // but not if explicitly asked not to (note: config value is dynamic here) - m = new ObjectMapper(); + m = new ObjectMapper(); m.disable(SerializationFeature.WRITE_NULL_MAP_VALUES); assertEquals("{}", m.writeValueAsString(map)); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestSimpleSerializationIgnore.java b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestSimpleSerializationIgnore.java index 602883fc84..1dcac3552a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestSimpleSerializationIgnore.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/filter/TestSimpleSerializationIgnore.java @@ -59,7 +59,7 @@ static class IgnoredType { } static class NonIgnoredType { public int value = 13; - + public IgnoredType ignored = new IgnoredType(); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/AtomicTypeSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/AtomicTypeSerializationTest.java index dd4637b1c7..727d90ecb6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/AtomicTypeSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/AtomicTypeSerializationTest.java @@ -78,7 +78,7 @@ static class MyBean2565 { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testAtomicBoolean() throws Exception { assertEquals("true", MAPPER.writeValueAsString(new AtomicBoolean(true))); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/CollectionSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/CollectionSerializationTest.java index 4ec8bfddf7..00b5e64e0b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/CollectionSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/CollectionSerializationTest.java @@ -40,7 +40,7 @@ public EnumMapBean(EnumMap m) * Class needed for testing [JACKSON-220] */ @SuppressWarnings("serial") - @JsonSerialize(using=ListSerializer.class) + @JsonSerialize(using=ListSerializer.class) static class PseudoList extends ArrayList { public PseudoList(String... values) { @@ -75,7 +75,7 @@ public StaticListWrapper(String ... v) { list = new ArrayList(Arrays.asList(v)); } protected StaticListWrapper() { } - + public List getList( ) { return list; } public void setList(List l) { list = l; } } @@ -122,7 +122,7 @@ public void testCollections() throws IOException value = c; } String json = MAPPER.writeValueAsString(value); - + // and then need to verify: JsonParser jp = new JsonFactory().createParser(json); assertToken(JsonToken.START_ARRAY, jp.nextToken()); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java index 7fbf854375..ac67a97b49 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java @@ -25,7 +25,7 @@ public class DateSerializationTest { static class TimeZoneBean { private TimeZone tz; - + public TimeZoneBean(String name) { tz = TimeZone.getTimeZone(name); } @@ -70,7 +70,7 @@ static class DateAsDefaultBean { public Date date; public DateAsDefaultBean(long l) { date = new java.util.Date(l); } } - + static class DateAsDefaultBeanWithEmptyJsonFormat { @JsonFormat public Date date; @@ -189,7 +189,7 @@ public void testDateISO8601_colonInTZ() throws IOException ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.setDateFormat(dateFormat); - + serialize(mapper, judate(1970, 1, 1, 02, 00, 00, 0, "GMT+2"), "1970-01-01T00:00:00.000+0000"); serialize(mapper, judate(1970, 1, 1, 00, 00, 00, 0, "UTC"), "1970-01-01T00:00:00.000+0000"); } @@ -243,7 +243,7 @@ public void testDatesAsMapKeys() throws IOException map.put(new Date(0L), Integer.valueOf(1)); // by default will serialize as ISO-8601 values... assertEquals("{\"1970-01-01T00:00:00.000+"+zoneOffset("0000")+"\":1}", mapper.writeValueAsString(map)); - + // but can change to use timestamps too mapper.configure(SerializationFeature.WRITE_DATE_KEYS_AS_TIMESTAMPS, true); assertEquals("{\"0\":1}", mapper.writeValueAsString(map)); @@ -267,7 +267,7 @@ public void testDateWithJsonFormat() throws Exception // and with different DateFormat; CET is one hour ahead of GMT json = mapper.writeValueAsString(new DateInCETBean(0L)); assertEquals("{\"date\":\"1970-01-01,01:00\"}", json); - + // and for [Issue#423] as well: json = mapper.writer().with(getUTCTimeZone()).writeValueAsString(new CalendarAsStringBean(0L)); assertEquals("{\"value\":\"1970-01-01\"}", json); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/EnumSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/EnumSerializationTest.java index 4cebf62391..531b323b72 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/EnumSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/EnumSerializationTest.java @@ -89,14 +89,14 @@ private LowerCaseEnum() { } static class MapBean { public Map map = new HashMap(); - + public void add(TestEnum key, int value) { map.put(key, Integer.valueOf(value)); } } static enum NOT_OK { - V1("v1"); + V1("v1"); protected String key; // any runtime-persistent annotation is fine NOT_OK(@JsonProperty String key) { this.key = key; } @@ -157,7 +157,7 @@ private EnumWithJsonKey(String n) { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testSimple() throws Exception { assertEquals("\"B\"", MAPPER.writeValueAsString(TestEnum.B)); @@ -273,7 +273,7 @@ public void testEnumMapSerDefault() throws Exception { m.put(LC749Enum.A, "value"); assertEquals("{\"A\":\"value\"}", mapper.writeValueAsString(m)); } - + public void testEnumMapSerDisableToString() throws Exception { final ObjectMapper mapper = new ObjectMapper(); ObjectWriter w = mapper.writer().without(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); @@ -334,7 +334,7 @@ public void testEnumWithJsonKey() throws Exception // [JACKSON-757], non-inner enum enum NOT_OK2 { - V2("v2"); + V2("v2"); protected String key; // any runtime-persistent annotation is fine NOT_OK2(@JsonProperty String key) { this.key = key; } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/JDKTypeSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/JDKTypeSerializationTest.java index 6e6f4f507a..9bbf116cf4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/JDKTypeSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/JDKTypeSerializationTest.java @@ -41,7 +41,7 @@ public void testBigDecimal() throws Exception String str = MAPPER.writeValueAsString(map); assertEquals("{\"pi\":3.14159265}", str); } - + public void testBigDecimalAsPlainString() throws Exception { final ObjectMapper mapper = new ObjectMapper(); @@ -60,7 +60,7 @@ public void testFile() throws IOException File f = new File(new File("/tmp"), "foo.text"); String str = MAPPER.writeValueAsString(f); // escape backslashes (for portability with windows) - String escapedAbsPath = f.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\"); + String escapedAbsPath = f.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\"); assertEquals(q(escapedAbsPath), str); } diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeyAnnotationsTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeyAnnotationsTest.java index e2d3b43b8b..88097f4bfc 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeyAnnotationsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeyAnnotationsTest.java @@ -39,7 +39,7 @@ public String toString() { @SuppressWarnings("serial") static class WatMap extends HashMap { } - + // [databind#943] static class UCString { private String value; @@ -72,7 +72,7 @@ public JsonValue2306Key(String id) { this.id = id; } } - + // [databind#2871] static class Inner { @JsonKey @@ -127,7 +127,7 @@ public void testMapJsonValueKey47() throws Exception String json = MAPPER.writeValueAsString(input); assertEquals(a2q("{'3':true}"), json); - } + } // [databind#943] public void testDynamicMapKeys() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeySerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeySerializationTest.java index 3cbc18c40c..2765ddb9d3 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeySerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapKeySerializationTest.java @@ -175,7 +175,7 @@ public void testCustomNullSerializers() throws IOException json = mapper.writeValueAsString(new Object[] { 1, null, true }); assertEquals("[1,\"NULL\",true]", json); } - + public void testCustomEnumInnerMapKey() throws Exception { Map outerMap = new HashMap(); Map> map = new EnumMap>(ABC.class); @@ -264,7 +264,7 @@ public void testMapsWithBinaryKeys() throws Exception // First, using wrapper MapWrapper input = new MapWrapper<>(binary, "stuff"); String expBase64 = Base64Variants.MIME.encode(binary); - + assertEquals(a2q("{'map':{'"+expBase64+"':'stuff'}}"), MAPPER.writeValueAsString(input)); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapSerializationTest.java index 619bfe8ca6..a8f159d50d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/MapSerializationTest.java @@ -16,7 +16,7 @@ @SuppressWarnings("serial") public class MapSerializationTest extends BaseMapTest { - @JsonSerialize(using=PseudoMapSerializer.class) + @JsonSerialize(using=PseudoMapSerializer.class) static class PseudoMap extends LinkedHashMap { public PseudoMap(String... values) { @@ -41,7 +41,7 @@ public void serialize(Map value, static class MapOrderingBean { @JsonPropertyOrder(alphabetic=true) public LinkedHashMap map; - + public MapOrderingBean(String... keys) { map = new LinkedHashMap(); int ix = 1; @@ -173,7 +173,7 @@ public void testOrderByKeyViaProperty() throws IOException MapOrderingBean input = new MapOrderingBean("c", "b", "a"); String json = MAPPER.writeValueAsString(input); assertEquals(a2q("{'map':{'a':3,'b':2,'c':1}}"), json); - } + } // [Databind#565] public void testMapEntry() throws IOException @@ -192,7 +192,7 @@ public void testMapEntry() throws IOException json = mapper.writeValueAsString(input); assertEquals(a2q("['"+StringIntMapEntry.class.getName()+"',{'answer':42}]"), json); - } + } public void testMapEntryWrapper() throws IOException { @@ -212,13 +212,13 @@ public void testNullJsonMapping691() throws Exception assertEquals(a2q("{'@type':'mymap','id':'Test','NULL':null}"), json); - } + } // [databind#691] public void testNullJsonInTypedMap691() throws Exception { Map map = new HashMap(); map.put("NULL", null); - + ObjectMapper mapper = new ObjectMapper(); mapper.addMixIn(Object.class, Mixin691.class); String json = mapper.writeValueAsString(map); diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/NumberSerTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/NumberSerTest.java index 646d4128d2..4be9b884eb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/NumberSerTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/NumberSerTest.java @@ -66,7 +66,7 @@ static class BigDecimalAsString { public BigDecimalAsString() { this(BigDecimal.valueOf(0.25)); } public BigDecimalAsString(BigDecimal v) { value = v; } } - + static class NumberWrapper { // ensure it will use `Number` as statically force type, when looking for serializer @JsonSerialize(as=Number.class) @@ -74,7 +74,7 @@ static class NumberWrapper { public NumberWrapper(Number v) { value = v; } } - + /* /********************************************************** /* Test methods diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UUIDSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UUIDSerializationTest.java index 6bf33c2d20..e716a66bb4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UUIDSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UUIDSerializationTest.java @@ -22,7 +22,7 @@ static class UUIDWrapperBinary { public UUIDWrapperBinary(UUID u) { uuid = u; } } - + private final ObjectMapper MAPPER = sharedMapper(); // Verify that efficient UUID codec won't mess things up: @@ -45,7 +45,7 @@ public void testBasicUUIDs() throws IOException String str = MAPPER.convertValue(uuid, String.class); assertEquals(value, str); } - + // then use templating; note that these are not exactly valid UUIDs // wrt spec (type bits etc), but JDK UUID should deal ok final String TEMPL = "00000000-0000-0000-0000-000000000000"; @@ -71,7 +71,7 @@ public void testShapeOverrides() throws Exception // but that without one we'd get String assertEquals("{\"uuid\":\""+nullUUIDStr+"\"}", MAPPER.writeValueAsString(new UUIDWrapperVanilla(nullUUID))); - + // but can also override by type final ObjectMapper m = jsonMapperBuilder() .withConfigOverride(UUID.class, diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UntypedSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UntypedSerializationTest.java index 8494c40e50..f528162eac 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UntypedSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/UntypedSerializationTest.java @@ -35,29 +35,29 @@ public void testFromArray() throws Exception try (JsonParser p = MAPPER.createParser(str)) { assertEquals(JsonToken.START_ARRAY, p.nextToken()); - + assertEquals(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("Elem1", getAndVerifyText(p)); - + assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(3, p.getIntValue()); - + assertEquals(JsonToken.START_OBJECT, p.nextToken()); assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("first", getAndVerifyText(p)); - + assertEquals(JsonToken.VALUE_TRUE, p.nextToken()); assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("Second", getAndVerifyText(p)); - + if (p.nextToken() != JsonToken.START_ARRAY) { fail("Expected START_ARRAY: JSON == '"+str+"'"); } assertEquals(JsonToken.END_ARRAY, p.nextToken()); assertEquals(JsonToken.END_OBJECT, p.nextToken()); - + assertEquals(JsonToken.VALUE_FALSE, p.nextToken()); - + assertEquals(JsonToken.END_ARRAY, p.nextToken()); assertNull(p.nextToken()); } @@ -77,24 +77,24 @@ public void testFromMap() throws Exception try (JsonParser p = MAPPER.createParser(str)) { assertEquals(JsonToken.START_OBJECT, p.nextToken()); - + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("a1", getAndVerifyText(p)); assertEquals(JsonToken.VALUE_STRING, p.nextToken()); assertEquals("\"text\"", getAndVerifyText(p)); - + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("int", getAndVerifyText(p)); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(137, p.getIntValue()); - + assertEquals(JsonToken.FIELD_NAME, p.nextToken()); assertEquals("foo bar", getAndVerifyText(p)); assertEquals(JsonToken.VALUE_NUMBER_INT, p.nextToken()); assertEquals(1234567890L, p.getLongValue()); - + assertEquals(JsonToken.END_OBJECT, p.nextToken()); - + assertNull(p.nextToken()); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureAcceptSingleTest.java b/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureAcceptSingleTest.java index 0880a63edf..6f3247bfda 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureAcceptSingleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureAcceptSingleTest.java @@ -20,7 +20,7 @@ static class StringArrayNotAnnoted { protected StringArrayNotAnnoted() { } public StringArrayNotAnnoted(String ... v) { values = v; } } - + static class StringArrayWrapper { @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) public String[] values; @@ -45,7 +45,7 @@ static class FloatArrayWrapper { @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) public float[] values; } - + static class DoubleArrayWrapper { @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) public double[] values; @@ -87,7 +87,7 @@ static class EnumSetWrapper { @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) public EnumSet values; } - + static class RolesInArray { @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) public Role[] roles; @@ -224,7 +224,7 @@ public void testSingleFloatArrayRead() throws Exception { assertEquals(1, result.values.length); assertEquals(0.25f, result.values[0]); } - + public void testSingleElementArrayRead() throws Exception { String json = a2q( "{ 'roles': { 'Name': 'User', 'ID': '333' } }"); diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureUnwrapSingleTest.java b/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureUnwrapSingleTest.java index b756a26be9..ee5de2650c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureUnwrapSingleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/FormatFeatureUnwrapSingleTest.java @@ -97,12 +97,12 @@ public UnwrapCollection(String... values) { v = new LinkedHashSet(Arrays.asList(values)); } } - + static class UnwrapStringLike { @JsonFormat(with={ JsonFormat.Feature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED }) public URI[] v = { URI.create("http://foo") }; } - + @JsonPropertyOrder( { "strings", "ints", "bools", "enums" }) static class WrapWriteWithCollections { diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/SingleValueAsArrayTest.java b/src/test/java/com/fasterxml/jackson/databind/struct/SingleValueAsArrayTest.java index d952b0cc19..7be1f0ac71 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/SingleValueAsArrayTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/SingleValueAsArrayTest.java @@ -63,7 +63,7 @@ public Bean1421B(T value) { /* Unit tests /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); { MAPPER.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestBackRefsWithPolymorphic.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestBackRefsWithPolymorphic.java index 33f3eca557..b7af13c7c4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestBackRefsWithPolymorphic.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestBackRefsWithPolymorphic.java @@ -204,7 +204,7 @@ static class YetAnotherClass extends StringPropertyImpl { } +"\"" +CLASS_NAME+ "$StringPropertyImpl\",\"id\":0,\"name\":\"p1name\",\"value\":\"p1value\"}," +"\"p2name\":{\"@class\":\""+CLASS_NAME+"$StringPropertyImpl\",\"id\":0," +"\"name\":\"p2name\",\"value\":\"p2value\"}}}"; - + private final ObjectMapper MAPPER = new ObjectMapper(); public void testDeserialize() throws IOException diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArray.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArray.java index fa74a5e2ad..73f17bc2e1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArray.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArray.java @@ -34,7 +34,7 @@ public NonAnnotatedXY(int x0, int y0) { y = y0; } } - + // note: must be serialized/deserialized alphabetically; fields NOT declared in that order @JsonPropertyOrder(alphabetic=true) static class PojoAsArray @@ -133,7 +133,7 @@ public CreatorWithIndex(@JsonProperty(index=0, value="a") int a, */ private final static ObjectMapper MAPPER = new ObjectMapper(); - + /** * Test that verifies that property annotation works */ @@ -160,7 +160,7 @@ public void testReadSimpleRootValue() throws Exception assertEquals(1, p.x); assertEquals(2, p.y); } - + /** * Test that verifies that property annotation works */ diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayAdvanced.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayAdvanced.java index d2e6ddd1ba..28f57e3e2a 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayAdvanced.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayAdvanced.java @@ -44,7 +44,7 @@ public CreatorAsArrayShuffled(@JsonProperty("x") int x, @JsonProperty("y") int y static class ViewA { } static class ViewB { } - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) @JsonPropertyOrder(alphabetic=true) static class AsArrayWithView diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java index f80374007d..46da861f71 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestPOJOAsArrayWithBuilder.java @@ -40,7 +40,7 @@ protected SimpleBuilderXY(int x0, int y0) { x = x0; y = y0; } - + public SimpleBuilderXY withX(int x0) { this.x = x0; return this; @@ -85,7 +85,7 @@ public CreatorBuilder(@JsonProperty("a") int a, this.a = a; this.b = b; } - + @JsonView(String.class) public CreatorBuilder withC(int v) { c = v; @@ -134,7 +134,7 @@ public void testBuilderWithUpdate() throws Exception /* Creator test(s) /***************************************************** */ - + // test to ensure @JsonCreator also works public void testWithCreator() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestParentChildReferences.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestParentChildReferences.java index 1a6a264114..f8569f399e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestParentChildReferences.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestParentChildReferences.java @@ -22,7 +22,7 @@ public class TestParentChildReferences static class SimpleTreeNode { public String name; - + // Reference back to parent; reference, ignored during ser, // re-constructed during deser @JsonBackReference @@ -55,7 +55,7 @@ static class SimpleTreeNode2 public SimpleTreeNode2 getChild() { return child; } public void setChild(SimpleTreeNode2 c) { child = c; } } - + /** * Then nodes with two separate linkages; parent/child * and prev/next-sibling @@ -75,7 +75,7 @@ static class FullTreeNode public FullTreeNode next; @JsonBackReference("sibling") protected FullTreeNode prev; - + public FullTreeNode() { this(null); } public FullTreeNode(String name) { this.name = name; @@ -94,14 +94,14 @@ static class NodeArray static class ArrayNode { public String name; - + @JsonBackReference("arr") public NodeArray parent; public ArrayNode() { this(null); } public ArrayNode(String n) { name = n; } } - + /** * Class for testing managed references via Collections */ @@ -114,14 +114,14 @@ static class NodeList static class NodeForList { public String name; - + @JsonBackReference public NodeList parent; public NodeForList() { this(null); } public NodeForList(String n) { name = n; } } - + static class NodeMap { @JsonManagedReference @@ -131,7 +131,7 @@ static class NodeMap static class NodeForMap { public String name; - + @JsonBackReference public NodeMap parent; @@ -167,7 +167,7 @@ public static class Child { static abstract class AbstractNode { public String id; - + @JsonManagedReference public AbstractNode next; @JsonBackReference public AbstractNode prev; } @@ -177,10 +177,10 @@ static class ConcreteNode extends AbstractNode { public ConcreteNode() { } public ConcreteNode(String id) { this.id = id; } } - + // [JACKSON-708] static class Model708 { } - + static class Advertisement708 extends Model708 { public String title; @JsonManagedReference public List photos; @@ -190,7 +190,7 @@ static class Photo708 extends Model708 { public int id; @JsonBackReference public Advertisement708 advertisement; } - + /* /********************************************************** /* Unit tests @@ -198,16 +198,16 @@ static class Photo708 extends Model708 { */ private final ObjectMapper MAPPER = objectMapper(); - + public void testSimpleRefs() throws Exception { SimpleTreeNode root = new SimpleTreeNode("root"); SimpleTreeNode child = new SimpleTreeNode("kid"); root.child = child; child.parent = root; - + String json = MAPPER.writeValueAsString(root); - + SimpleTreeNode resultNode = MAPPER.readValue(json, SimpleTreeNode.class); assertEquals("root", resultNode.name); SimpleTreeNode resultChild = resultNode.child; @@ -223,9 +223,9 @@ public void testSimpleRefsWithGetter() throws Exception SimpleTreeNode2 child = new SimpleTreeNode2("kid"); root.child = child; child.parent = root; - + String json = MAPPER.writeValueAsString(root); - + SimpleTreeNode2 resultNode = MAPPER.readValue(json, SimpleTreeNode2.class); assertEquals("root", resultNode.name); SimpleTreeNode2 resultChild = resultNode.child; @@ -233,7 +233,7 @@ public void testSimpleRefsWithGetter() throws Exception assertEquals("kid", resultChild.name); assertSame(resultChild.parent, resultNode); } - + public void testFullRefs() throws Exception { FullTreeNode root = new FullTreeNode("root"); @@ -243,9 +243,9 @@ public void testFullRefs() throws Exception child1.parent = root; child1.next = child2; child2.prev = child1; - + String json = MAPPER.writeValueAsString(root); - + FullTreeNode resultNode = MAPPER.readValue(json, FullTreeNode.class); assertEquals("root", resultNode.name); FullTreeNode resultChild = resultNode.firstChild; @@ -269,7 +269,7 @@ public void testArrayOfRefs() throws Exception ArrayNode node2 = new ArrayNode("b"); root.nodes = new ArrayNode[] { node1, node2 }; String json = MAPPER.writeValueAsString(root); - + NodeArray result = MAPPER.readValue(json, NodeArray.class); ArrayNode[] kids = result.nodes; assertNotNull(kids); @@ -287,7 +287,7 @@ public void testListOfRefs() throws Exception NodeForList node2 = new NodeForList("b"); root.nodes = Arrays.asList(node1, node2); String json = MAPPER.writeValueAsString(root); - + NodeList result = MAPPER.readValue(json, NodeList.class); List kids = result.nodes; assertNotNull(kids); @@ -308,7 +308,7 @@ public void testMapOfRefs() throws Exception nodes.put("b2", node2); root.nodes = nodes; String json = MAPPER.writeValueAsString(root); - + NodeMap result = MAPPER.readValue(json, NodeMap.class); Map kids = result.nodes; assertNotNull(kids); @@ -342,14 +342,14 @@ public void testAbstract368() throws Exception assertEquals("c", leaf.id); assertSame(root, leaf.prev); } - + public void testIssue693() throws Exception { Parent parent = new Parent(); parent.addChild(new Child("foo")); parent.addChild(new Child("bar")); byte[] bytes = MAPPER.writeValueAsBytes(parent); - Parent value = MAPPER.readValue(bytes, Parent.class); + Parent value = MAPPER.readValue(bytes, Parent.class); for (Child child : value.children) { assertEquals(value, child.getParent()); } @@ -357,7 +357,7 @@ public void testIssue693() throws Exception public void testIssue708() throws Exception { - Advertisement708 ad = MAPPER.readValue("{\"title\":\"Hroch\",\"photos\":[{\"id\":3}]}", Advertisement708.class); + Advertisement708 ad = MAPPER.readValue("{\"title\":\"Hroch\",\"photos\":[{\"id\":3}]}", Advertisement708.class); assertNotNull(ad); - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrapped.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrapped.java index 84db268d11..50fc2eb97b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrapped.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrapped.java @@ -34,7 +34,7 @@ public Location(int x, int y) { this.y = y; } } - + static class DeepUnwrapping { @JsonUnwrapped @@ -45,7 +45,7 @@ public DeepUnwrapping(String str, int x, int y) { unwrapped = new Unwrapping(str, x, y); } } - + static class UnwrappingWithCreator { public String name; @@ -107,7 +107,7 @@ static class Address { public String street; public String addon; public String zip; - public String town; + public String town; public String country; } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithPrefix.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithPrefix.java index 233466681d..2d247e54b4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithPrefix.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithPrefix.java @@ -56,7 +56,7 @@ public PrefixUnwrap(String str, int x, int y) { location = new Location(x, y); } } - + static class DeepPrefixUnwrap { @JsonUnwrapped(prefix="u.") @@ -74,7 +74,7 @@ static class ConfigRoot { @JsonUnwrapped(prefix="general.") public ConfigGeneral general = new ConfigGeneral(); - + @JsonUnwrapped(prefix="misc.") public ConfigMisc misc = new ConfigMisc(); @@ -90,12 +90,12 @@ static class ConfigAlternate { @JsonUnwrapped public ConfigGeneral general = new ConfigGeneral(); - + @JsonUnwrapped(prefix="misc.") public ConfigMisc misc = new ConfigMisc(); public int id; - + public ConfigAlternate() { } public ConfigAlternate(int id, String name, int value) { @@ -109,7 +109,7 @@ static class ConfigGeneral { @JsonUnwrapped(prefix="names.") public ConfigNames names = new ConfigNames(); - + public ConfigGeneral() { } public ConfigGeneral(String name) { names.name = name; @@ -184,7 +184,7 @@ public void testPrefixedUnwrapping() throws Exception assertEquals(4, bean.location.x); assertEquals(7, bean.location.y); } - + public void testDeepPrefixedUnwrappingDeserialize() throws Exception { DeepPrefixUnwrap bean = MAPPER.readValue("{\"u.name\":\"Bubba\",\"u._x\":2,\"u._y\":3}", @@ -195,7 +195,7 @@ public void testDeepPrefixedUnwrappingDeserialize() throws Exception assertEquals(3, bean.unwrapped.location.y); assertEquals("Bubba", bean.unwrapped.name); } - + public void testHierarchicConfigDeserialize() throws Exception { ConfigRoot root = MAPPER.readValue("{\"general.names.name\":\"Bob\",\"misc.value\":3}", @@ -245,7 +245,7 @@ public void testIssue226() throws Exception assertNotNull(output.c1.sc1); assertNotNull(output.c2.sc1); - + assertEquals("a", output.c1.sc1.value); assertEquals("b", output.c2.sc1.value); } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithSameName647.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithSameName647.java index 37b9582a2f..aa86dc0ff4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithSameName647.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithSameName647.java @@ -13,7 +13,7 @@ static class MailHolder { @JsonUnwrapped public Mail mail; } - + static class Mail { public String mail; } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithTypeInfo.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithTypeInfo.java index 882743cb55..e94414f713 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithTypeInfo.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestUnwrappedWithTypeInfo.java @@ -35,7 +35,7 @@ static class Inner { public void setP2(String p2) { this.p2 = p2; } } - + /* /********************************************************** /* Tests, serialization diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java b/src/test/java/com/fasterxml/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java index 11bdfda5cf..0161a14915 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/UnwrapSingleArrayScalarsTest.java @@ -42,7 +42,7 @@ static class DoubleBean { /* Tests for boolean /********************************************************** */ - + public void testBooleanPrimitiveArrayUnwrap() throws Exception { // [databind#381] @@ -55,11 +55,11 @@ public void testBooleanPrimitiveArrayUnwrap() throws Exception result = r.readValue("{\"v\":[null]}"); assertNotNull(result); assertFalse(result.v); - + result = r.readValue("[{\"v\":[null]}]"); assertNotNull(result); assertFalse(result.v); - + boolean[] array = UNWRAPPING_READER.forType(boolean[].class) .readValue(new StringReader("[ [ null ] ]")); assertNotNull(array); @@ -86,17 +86,17 @@ public void testIntPrimitiveArrayUnwrap() throws Exception ObjectReader r = UNWRAPPING_READER.forType(IntBean.class); IntBean result = r.readValue("{\"v\":[3]}"); assertEquals(3, result.v); - + result = r.readValue("[{\"v\":[3]}]"); assertEquals(3, result.v); - + try { r.readValue("[{\"v\":[3,3]}]"); fail("Did not throw exception while reading a value from a multi value array with UNWRAP_SINGLE_VALUE_ARRAY feature enabled"); } catch (MismatchedInputException e) { verifyException(e, "more than one value"); } - + result = r.readValue("{\"v\":[null]}"); assertNotNull(result); assertEquals(0, result.v); @@ -105,14 +105,14 @@ public void testIntPrimitiveArrayUnwrap() throws Exception assertNotNull(array); assertEquals(1, array.length); assertEquals(0, array[0]); - + } public void testLongPrimitiveArrayUnwrap() throws Exception { final ObjectReader unwrapR = UNWRAPPING_READER.forType(LongBean.class); final ObjectReader noUnwrapR = NO_UNWRAPPING_READER.forType(LongBean.class); - + try { noUnwrapR.readValue("{\"v\":[3]}"); fail("Did not throw exception when reading a value from a single value array"); @@ -122,7 +122,7 @@ public void testLongPrimitiveArrayUnwrap() throws Exception LongBean result = unwrapR.readValue("{\"v\":[3]}"); assertEquals(3, result.v); - + result = unwrapR.readValue("[{\"v\":[3]}]"); assertEquals(3, result.v); @@ -132,7 +132,7 @@ public void testLongPrimitiveArrayUnwrap() throws Exception } catch (MismatchedInputException e) { verifyException(e, "more than one value"); } - + result = unwrapR.readValue("{\"v\":[null]}"); assertNotNull(result); assertEquals(0, result.v); @@ -156,20 +156,20 @@ public void testDoubleAsArray() throws Exception } catch (MismatchedInputException e) { verifyException(e, "Cannot deserialize value of type `double`"); } - + DoubleBean result = unwrapR.readValue("{\"v\":[" + value + "]}"); assertEquals(value, result.v); - + result = unwrapR.readValue("[{\"v\":[" + value + "]}]"); assertEquals(value, result.v); - + try { unwrapR.readValue("[{\"v\":[" + value + "," + value + "]}]"); fail("Did not throw exception while reading a value from a multi value array"); } catch (MismatchedInputException e) { verifyException(e, "more than one value"); } - + result = unwrapR.readValue("{\"v\":[null]}"); assertNotNull(result); assertEquals(0d, result.v); @@ -361,7 +361,7 @@ public void testSingleStringWrapped() throws Exception } catch (MismatchedInputException exp) { _verifyNoDeserFromArray(exp); } - + try { UNWRAPPING_READER.forType(String.class) .readValue("[\""+value+"\",\""+value+"\"]"); @@ -390,7 +390,7 @@ public void testBigDecimal() throws Exception r = UNWRAPPING_READER.forType(BigDecimal.class); result = r.readValue("[" + value.toString() + "]"); assertEquals(value, result); - + try { r.readValue("[" + value.toString() + "," + value.toString() + "]"); fail("Exception was not thrown when attempting to read a muti value array of BigDecimal when UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled"); @@ -414,13 +414,13 @@ public void testBigInteger() throws Exception result = UNWRAPPING_READER.readValue("[" + value.toString() + "]", BigInteger.class); assertEquals(value, result); - + try { UNWRAPPING_READER.readValue("[" + value.toString() + "," + value.toString() + "]", BigInteger.class); fail("Exception was not thrown when attempting to read a multi-value array of BigInteger when UNWRAP_SINGLE_VALUE_ARRAYS feature is enabled"); } catch (MismatchedInputException exp) { verifyException(exp, "Attempted to unwrap"); - } + } } public void testClassAsArray() throws Exception @@ -455,7 +455,7 @@ public void testURIAsArray() throws Exception } catch (MismatchedInputException e) { _verifyNoDeserFromArray(e); } - + _verifyMultiValueArrayFail("[\""+value.toString()+"\",\""+value.toString()+"\"]", URI.class); } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/UnwrappedCreatorParam265Test.java b/src/test/java/com/fasterxml/jackson/databind/struct/UnwrappedCreatorParam265Test.java index 62010d8ab1..494205ea5f 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/UnwrappedCreatorParam265Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/UnwrappedCreatorParam265Test.java @@ -26,7 +26,7 @@ static class JPersonWithoutName public String name; protected JAddress _address; - + @JsonCreator public JPersonWithoutName(@JsonProperty("name") String name, @JsonUnwrapped JAddress address) @@ -44,7 +44,7 @@ static class JPersonWithName public String name; protected JAddress _address; - + @JsonCreator public JPersonWithName(@JsonProperty("name") String name, @JsonUnwrapped @@ -58,7 +58,7 @@ public JPersonWithName(@JsonProperty("name") String name, @JsonUnwrapped public JAddress getAddress() { return _address; } } - + /* /********************************************************** /* Test methods diff --git a/src/test/java/com/fasterxml/jackson/databind/testutil/BrokenStringWriter.java b/src/test/java/com/fasterxml/jackson/databind/testutil/BrokenStringWriter.java index 036233266e..584afb32be 100644 --- a/src/test/java/com/fasterxml/jackson/databind/testutil/BrokenStringWriter.java +++ b/src/test/java/com/fasterxml/jackson/databind/testutil/BrokenStringWriter.java @@ -17,13 +17,13 @@ public void write(char[] cbuf, int off, int len) throws IOException { throw new IOException(_message); } - + @Override public void write(int c) throws IOException { throw new IOException(_message); } - + @Override public void write(String str, int off, int len) throws IOException { diff --git a/src/test/java/com/fasterxml/jackson/databind/testutil/MediaItem.java b/src/test/java/com/fasterxml/jackson/databind/testutil/MediaItem.java index a619ce846b..3400e75708 100644 --- a/src/test/java/com/fasterxml/jackson/databind/testutil/MediaItem.java +++ b/src/test/java/com/fasterxml/jackson/databind/testutil/MediaItem.java @@ -28,7 +28,7 @@ public void addPhoto(Photo p) { } _photos.add(p); } - + public List getImages() { return _photos; } public void setImages(List p) { _photos = p; } @@ -40,7 +40,7 @@ public void addPhoto(Photo p) { /* Helper types /********************************************************** */ - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) @JsonPropertyOrder({"uri","title","width","height","size"}) public static class Photo @@ -50,7 +50,7 @@ public static class Photo private int _width; private int _height; private Size _size; - + public Photo() {} public Photo(String uri, String title, int w, int h, Size s) { @@ -60,20 +60,20 @@ public Photo(String uri, String title, int w, int h, Size s) _height = h; _size = s; } - + public String getUri() { return _uri; } public String getTitle() { return _title; } public int getWidth() { return _width; } public int getHeight() { return _height; } public Size getSize() { return _size; } - + public void setUri(String u) { _uri = u; } public void setTitle(String t) { _title = t; } public void setWidth(int w) { _width = w; } public void setHeight(int h) { _height = h; } public void setSize(Size s) { _size = s; } } - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) @JsonPropertyOrder({"uri","title","width","height","format","duration","size","bitrate","persons","player","copyright"}) public static class Content @@ -89,7 +89,7 @@ public static class Content private int _bitrate; private List _persons; private String _copyright; - + public Content() { } public void addPerson(String p) { @@ -98,7 +98,7 @@ public void addPerson(String p) { } _persons.add(p); } - + public Player getPlayer() { return _player; } public String getUri() { return _uri; } public String getTitle() { return _title; } @@ -110,7 +110,7 @@ public void addPerson(String p) { public int getBitrate() { return _bitrate; } public List getPersons() { return _persons; } public String getCopyright() { return _copyright; } - + public void setPlayer(Player p) { _player = p; } public void setUri(String u) { _uri = u; } public void setTitle(String t) { _title = t; } diff --git a/src/test/java/com/fasterxml/jackson/databind/testutil/NoCheckSubTypeValidator.java b/src/test/java/com/fasterxml/jackson/databind/testutil/NoCheckSubTypeValidator.java index 2ef64e20bc..a417e276e9 100644 --- a/src/test/java/com/fasterxml/jackson/databind/testutil/NoCheckSubTypeValidator.java +++ b/src/test/java/com/fasterxml/jackson/databind/testutil/NoCheckSubTypeValidator.java @@ -13,7 +13,7 @@ public final class NoCheckSubTypeValidator { private static final long serialVersionUID = 1L; - public final static NoCheckSubTypeValidator instance = new NoCheckSubTypeValidator(); + public final static NoCheckSubTypeValidator instance = new NoCheckSubTypeValidator(); @Override public Validity validateBaseType(MapperConfig config, JavaType baseType) { diff --git a/src/test/java/com/fasterxml/jackson/databind/type/LocalTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/type/LocalTypeTest.java index a0a6c9d498..7a8da5ea2d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/LocalTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/LocalTypeTest.java @@ -7,7 +7,7 @@ public class LocalTypeTest extends BaseMapTest // [databind#609] static class EntityContainer { RuleForm entity; - + @SuppressWarnings("unchecked") public T getEntity() { return (T) entity; } public void setEntity(T e) { entity = e; } @@ -23,11 +23,11 @@ public RuleForm() { } // [databind#609] public void testLocalPartialType609() throws Exception { ObjectMapper mapper = new ObjectMapper(); - - EntityContainer input = new EntityContainer(); + + EntityContainer input = new EntityContainer(); input.entity = new RuleForm(12); String json = mapper.writeValueAsString(input); - + EntityContainer output = mapper.readValue(json, EntityContainer.class); assertEquals(12, output.getEntity().value); } diff --git a/src/test/java/com/fasterxml/jackson/databind/type/NestedTypes1604Test.java b/src/test/java/com/fasterxml/jackson/databind/type/NestedTypes1604Test.java index e6adf5cc6a..b49956debd 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/NestedTypes1604Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/NestedTypes1604Test.java @@ -90,7 +90,7 @@ public DataList getInner() { } private final ObjectMapper objectMapper = newJsonMapper(); - + public void testIssue1604Simple() throws Exception { List inners = new ArrayList<>(); diff --git a/src/test/java/com/fasterxml/jackson/databind/type/PolymorphicList036Test.java b/src/test/java/com/fasterxml/jackson/databind/type/PolymorphicList036Test.java index 168b63608f..75dda08bfe 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/PolymorphicList036Test.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/PolymorphicList036Test.java @@ -21,7 +21,7 @@ public StringyList(Collection src) { public StringyList() { _stuff = new ArrayList(); } - + @Override public boolean add(T arg) { return _stuff.add(arg); @@ -89,21 +89,21 @@ public X[] toArray(X[] arg) { } private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testPolymorphicWithOverride() throws Exception { JavaType type = MAPPER.getTypeFactory().constructCollectionType(StringyList.class, String.class); - + StringyList list = new StringyList(); list.add("value 1"); list.add("value 2"); - + String serialized = MAPPER.writeValueAsString(list); // System.out.println(serialized); - + StringyList deserialized = MAPPER.readValue(serialized, type); // System.out.println(deserialized); - + assertNotNull(deserialized); } } diff --git a/src/test/java/com/fasterxml/jackson/databind/type/RecursiveTypeTest.java b/src/test/java/com/fasterxml/jackson/databind/type/RecursiveTypeTest.java index 36b27f22f5..5bbe2d4c13 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/RecursiveTypeTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/RecursiveTypeTest.java @@ -45,7 +45,7 @@ public R getValue() { public R setValue(final R value) { throw new UnsupportedOperationException(); } - + static ImmutablePair of(final L left, final R right) { return new ImmutablePair(left, right); } @@ -58,7 +58,7 @@ public void testRecursiveType() JavaType type = tf.constructType(HashTree.class); assertNotNull(type); } - + // for [databind#1301] @SuppressWarnings("serial") static class DataDefinition extends HashMap { @@ -68,7 +68,7 @@ static class DataDefinition extends HashMap { public boolean required; public String type; } - + private final ObjectMapper MAPPER = new ObjectMapper(); // [databind#938] diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestAnnotatedClass.java b/src/test/java/com/fasterxml/jackson/databind/type/TestAnnotatedClass.java index cfd11aa2bf..374165ac5b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestAnnotatedClass.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestAnnotatedClass.java @@ -66,7 +66,7 @@ static class FieldBean // for [databind#1005] static class Bean1005 { // private to force creation of a synthetic constructor to avoid access issues - Bean1005(int i) {} + Bean1005(int i) {} } /* @@ -76,7 +76,7 @@ static class Bean1005 { */ private final ObjectMapper MAPPER = new ObjectMapper(); - + public void testFieldIntrospection() { SerializationConfig config = MAPPER.getSerializationConfig(); @@ -113,7 +113,7 @@ public void testArrayTypeIntrospection() throws Exception assertFalse(ac.memberMethods().iterator().hasNext()); assertFalse(ac.fields().iterator().hasNext()); } - + public void testIntrospectionWithRawClass() throws Exception { AnnotatedClass ac = AnnotatedClassResolver.resolveWithoutSuperTypes(MAPPER.getSerializationConfig(), diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestGenericFieldInSubtype.java b/src/test/java/com/fasterxml/jackson/databind/type/TestGenericFieldInSubtype.java index b14cbce195..290350419c 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestGenericFieldInSubtype.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestGenericFieldInSubtype.java @@ -29,7 +29,7 @@ public void testInnerType() throws Exception class Result677 { public static class Success677 extends Result677 { public K value; - + public Success677() { } public Success677(K k) { value = k; } } diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestGenericsBounded.java b/src/test/java/com/fasterxml/jackson/databind/type/TestGenericsBounded.java index 863607cd58..b7088ed5c6 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestGenericsBounded.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestGenericsBounded.java @@ -34,7 +34,7 @@ static class DoubleRange extends Range { public DoubleRange() { } public DoubleRange(Double s, Double e) { super(s, e); } } - + static class BoundedWrapper { public List values; @@ -117,7 +117,7 @@ public void testLowerBound() throws Exception assertEquals(IntBean.class, result.wrapped.getClass()); assertEquals(3, result.wrapped.x); } - + // Test related to type bound handling problem within [JACKSON-190] public void testBounded() throws Exception { @@ -156,7 +156,7 @@ public void testIssue778() throws Exception JavaType rowType = resultSetType.containedType(0); assertNotNull(rowType); assertEquals(RowWithDoc.class, rowType.getRawClass()); - + assertEquals(1, rowType.containedTypeCount()); JavaType docType = rowType.containedType(0); assertEquals(MyDoc.class, docType.getRawClass()); @@ -164,7 +164,7 @@ public void testIssue778() throws Exception // type passed is correct, but somehow it gets mangled when passed... ResultSetWithDoc rs = MAPPER.readValue(json, type); Document d = rs.rows.iterator().next().d; - + assertEquals(MyDoc.class, d.getClass()); //expected MyDoc but was Document } diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestJavaType.java b/src/test/java/com/fasterxml/jackson/databind/type/TestJavaType.java index 14fc076722..2944e50c42 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestJavaType.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestJavaType.java @@ -17,7 +17,7 @@ public class TestJavaType static class BaseType { } static class SubType extends BaseType { } - + static enum MyEnum { A, B; } static enum MyEnum2 { A(1), B(2); @@ -27,12 +27,12 @@ private MyEnum2(int value) { } static enum MyEnumSub { A(1) { - @Override public String toString() { + @Override public String toString() { return "a"; } }, B(2) { - @Override public String toString() { + @Override public String toString() { return "b"; } } @@ -40,7 +40,7 @@ static enum MyEnumSub { private MyEnumSub(int value) { } } - + // [databind#728] static class Issue728 { public C method(C input) { return null; } @@ -54,13 +54,13 @@ public interface Generic1194 { @SuppressWarnings("serial") static class AtomicStringReference extends AtomicReference { } - + /* /********************************************************** /* Test methods /********************************************************** */ - + public void testLocalType728() throws Exception { TypeFactory tf = TypeFactory.defaultInstance(); @@ -122,7 +122,7 @@ public void testDeprecated() JavaType sub = baseType.forcedNarrowBy(SubType.class); assertTrue(sub.hasRawClass(SubType.class)); } - + public void testArrayType() { TypeFactory tf = TypeFactory.defaultInstance(); @@ -159,7 +159,7 @@ public void testMapType() assertEquals("Ljava/util/HashMap;", mapT.getGenericSignature()); assertEquals("Ljava/util/HashMap;", mapT.getErasedSignature()); - + assertTrue(mapT.equals(mapT)); assertFalse(mapT.equals(null)); Object bogus = "xyz"; @@ -233,7 +233,7 @@ public void testGenericSignature1194() throws Exception t = tf.constructType(m.getGenericReturnType()); assertEquals("Ljava/util/List;", t.getGenericSignature()); assertEquals("Ljava/util/List;", t.getErasedSignature()); - + m = Generic1194.class.getMethod("getMap"); t = tf.constructType(m.getGenericReturnType()); assertEquals("Ljava/util/Map;", diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeBindings.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeBindings.java index 6216842a3d..a7bb3e0dda 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeBindings.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeBindings.java @@ -11,9 +11,9 @@ */ public class TestTypeBindings extends BaseMapTest -{ +{ static class AbstractType { } - + static class LongStringType extends AbstractType { } static class InnerGenericTyping extends AbstractMap> @@ -75,7 +75,7 @@ public void testBindingsBasics() assertFalse(b.equals("foo")); } - + public void testInvalidBindings() { JavaType unknown = TypeFactory.unknownType(); diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java index d32c2bb24e..9f0b6f2b69 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java @@ -32,7 +32,7 @@ abstract static class IntermediateList implements List { } @SuppressWarnings("serial") static class GenericList extends ArrayList { } - + interface MapInterface extends Cloneable, IntermediateInterfaceMap { } interface IntermediateInterfaceMap extends Map { } @@ -56,7 +56,7 @@ static class SneakyBean2 { // self-reference; should be resolved as "Comparable" public > T getFoobar() { return null; } } - + @SuppressWarnings("serial") public static class LongValuedMap extends HashMap { } @@ -80,7 +80,7 @@ static class Wrapper1297 { /* Unit tests /********************************************************** */ - + public void testSimpleTypes() { Class[] classes = new Class[] { @@ -139,7 +139,7 @@ public void testProperties() assertSame(String.class, mt.getKeyType().getRawClass()); assertSame(String.class, mt.getContentType().getRawClass()); } - + public void testIterator() { TypeFactory tf = TypeFactory.defaultInstance(); @@ -223,7 +223,7 @@ public void testInvalidParametricTypes() verifyException(e, "Cannot create TypeBindings for class "); } } - + /** * Test for checking that canonical name handling works ok */ @@ -360,7 +360,7 @@ public void testCollectionTypesRefined() /* Unit tests: map type parameter resolution /********************************************************** */ - + public void testMaps() { TypeFactory tf = newTypeFactory(); @@ -410,7 +410,7 @@ public void testMapTypesRefined() assertEquals(Integer.class, mapType.getContentType().getContentType().getRawClass()); // No super-class, since it's an interface: assertNull(type.getSuperClass()); - + // But then refine to reflect sub-classing JavaType subtype = tf.constructSpecializedType(type, LinkedHashMap.class); assertEquals(LinkedHashMap.class, subtype.getRawClass()); @@ -455,7 +455,7 @@ public void testMapTypesRaw() assertEquals(MapType.class, type.getClass()); MapType mapType = (MapType) type; assertEquals(tf.constructType(Object.class), mapType.getKeyType()); - assertEquals(tf.constructType(Object.class), mapType.getContentType()); + assertEquals(tf.constructType(Object.class), mapType.getContentType()); } public void testMapTypesAdvanced() @@ -466,7 +466,7 @@ public void testMapTypesAdvanced() MapType mapType = (MapType) type; assertEquals(tf.constructType(String.class), mapType.getKeyType()); assertEquals(tf.constructType(Long.class), mapType.getContentType()); - + type = tf.constructType(MapInterface.class); mapType = (MapType) type; @@ -491,8 +491,8 @@ public void testMapTypesSneaky() MapType mapType = (MapType) type; assertEquals(tf.constructType(Integer.class), mapType.getKeyType()); assertEquals(tf.constructType(Long.class), mapType.getContentType()); - } - + } + /** * Plus sneaky types may be found via introspection as well. */ @@ -511,8 +511,8 @@ public void testSneakyFieldTypes() throws Exception assertTrue(type instanceof CollectionType); CollectionType collectionType = (CollectionType) type; assertEquals(tf.constructType(Long.class), collectionType.getContentType()); - } - + } + /** * Looks like type handling actually differs for properties, too. */ @@ -557,7 +557,7 @@ public void testAtomicArrayRefParameters() } static abstract class StringIntMapEntry implements Map.Entry { } - + public void testMapEntryResolution() { TypeFactory tf = TypeFactory.defaultInstance(); @@ -617,7 +617,7 @@ public void testRawMaps() /* Unit tests: other /********************************************************** */ - + public void testMoreSpecificType() { TypeFactory tf = TypeFactory.defaultInstance(); diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory1604.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory1604.java index 01c5cf4abb..3c7395c0c5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory1604.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory1604.java @@ -134,7 +134,7 @@ public void testResolveGenericPartialSubtypes() JavaType righty = tf.constructSpecializedType(base, Right.class); assertEquals(Right.class, righty.getRawClass()); - + params = tf.findTypeParameters(righty, Either.class); assertEquals(2, params.length); assertEquals(Void.class, params[0].getRawClass()); diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory3108.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory3108.java index db89db8540..f618b5e38e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory3108.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory3108.java @@ -14,7 +14,7 @@ public class TestTypeFactory3108 static class StringList3108 extends ArrayList {} static class StringStringMap3108 extends HashMap {} - + static class ParamType3108 {} static class ConcreteType3108 extends ParamType3108 {} diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactoryWithClassLoader.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactoryWithClassLoader.java index fa787baaa6..0602d89514 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactoryWithClassLoader.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactoryWithClassLoader.java @@ -33,7 +33,7 @@ public static void beforeClass() { threadClassLoader = Thread.currentThread().getContextClassLoader(); Assert.assertNotNull(threadClassLoader); } - + @Before public void before() { mapper = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeResolution.java b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeResolution.java index c2c2bede44..e001e62804 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TestTypeResolution.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TestTypeResolution.java @@ -41,7 +41,7 @@ public void testMaps() MapType type = (MapType) t; assertSame(LongValuedMap.class, type.getRawClass()); assertEquals(tf.constructType(String.class), type.getKeyType()); - assertEquals(tf.constructType(Long.class), type.getContentType()); + assertEquals(tf.constructType(Long.class), type.getContentType()); } public void testListViaTypeRef() @@ -50,7 +50,7 @@ public void testListViaTypeRef() JavaType t = tf.constructType(new TypeReference>() {}); CollectionType type = (CollectionType) t; assertSame(MyLongList.class, type.getRawClass()); - assertEquals(tf.constructType(Long.class), type.getContentType()); + assertEquals(tf.constructType(Long.class), type.getContentType()); } public void testListViaClass() @@ -59,7 +59,7 @@ public void testListViaClass() JavaType t = tf.constructType(LongList.class); JavaType type = (CollectionType) t; assertSame(LongList.class, type.getRawClass()); - assertEquals(tf.constructType(Long.class), type.getContentType()); + assertEquals(tf.constructType(Long.class), type.getContentType()); } public void testGeneric() diff --git a/src/test/java/com/fasterxml/jackson/databind/type/TypeAliasesTest.java b/src/test/java/com/fasterxml/jackson/databind/type/TypeAliasesTest.java index 703bd6c089..da49e0e2d5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/type/TypeAliasesTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/type/TypeAliasesTest.java @@ -18,7 +18,7 @@ public static abstract class Base { public static abstract class BaseData { public T dataObj; } - + public static class Child extends Base { public static class ChildData extends BaseData> { } } @@ -34,7 +34,7 @@ public void testAliasResolutionIssue743() throws Exception { String s3 = "{\"dataObj\" : [ \"one\", \"two\", \"three\" ] }"; ObjectMapper m = new ObjectMapper(); - + Child.ChildData d = m.readValue(s3, Child.ChildData.class); assertNotNull(d.dataObj); assertEquals(3, d.dataObj.size()); diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ArrayBuildersTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ArrayBuildersTest.java index bae028549d..1524a99621 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/ArrayBuildersTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/ArrayBuildersTest.java @@ -21,7 +21,7 @@ public void testInsertInListNoDup() { String [] arr = new String[]{"me", "you", "him"}; String [] newarr; - + newarr = ArrayBuilders.insertInListNoDup(arr, "you"); Assert.assertArrayEquals(new String[]{"you", "me", "him"}, newarr); diff --git a/src/test/java/com/fasterxml/jackson/databind/util/BeanUtilTest.java b/src/test/java/com/fasterxml/jackson/databind/util/BeanUtilTest.java index a7d43dce9f..1af2de2456 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/BeanUtilTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/BeanUtilTest.java @@ -34,7 +34,7 @@ public void testGetDefaultValue() // primitive/wrappers have others assertEquals(Integer.valueOf(0), BeanUtil.getDefaultValue(tf.constructType(Integer.class))); - + // but POJOs have no real default assertNull(BeanUtil.getDefaultValue(tf.constructType(getClass()))); diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ClassUtilTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ClassUtilTest.java index ea55256e39..b9bccf750e 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/ClassUtilTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/ClassUtilTest.java @@ -60,7 +60,7 @@ static abstract class SubClass static abstract class ConcreteAndAbstract { public abstract void a(); - + public void c() { } } @@ -122,7 +122,7 @@ public void testExceptionHelpers() } catch (Error errAct) { assertSame(err, errAct); } - + try { ClassUtil.unwrapAndThrowAsIAE(wrapper); fail("Shouldn't get this far"); @@ -166,7 +166,7 @@ public void testPrimitiveDefaultValue() assertEquals(Float.valueOf(0.0f), ClassUtil.defaultValue(Float.TYPE)); assertEquals(Boolean.FALSE, ClassUtil.defaultValue(Boolean.TYPE)); - + try { ClassUtil.defaultValue(String.class); } catch (IllegalArgumentException e) { @@ -186,7 +186,7 @@ public void testPrimitiveWrapperType() assertEquals(Float.class, ClassUtil.wrapperType(Float.TYPE)); assertEquals(Boolean.class, ClassUtil.wrapperType(Boolean.TYPE)); - + try { ClassUtil.wrapperType(String.class); fail("Should not pass"); @@ -205,7 +205,7 @@ public void testWrapperToPrimitiveType() assertEquals(Float.TYPE, ClassUtil.primitiveType(Float.class)); assertEquals(Double.TYPE, ClassUtil.primitiveType(Double.class)); assertEquals(Boolean.TYPE, ClassUtil.primitiveType(Boolean.class)); - + assertNull(ClassUtil.primitiveType(String.class)); } diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java index 8c3ff9f41a..0d3d8d00f4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601DateFormatTest.java @@ -45,7 +45,7 @@ public void testPartialParse() throws Exception { java.text.ParsePosition pos = new java.text.ParsePosition(0); String timestamp = "2007-08-13T19:51:23Z"; Date result = df.parse(timestamp + "hello", pos); - + assertEquals(date, result); assertEquals(timestamp.length(), pos.getIndex()); } diff --git a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java index 5ce6751362..769c85ccf7 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java @@ -28,7 +28,7 @@ public void setUp() { dateZeroMillis = cal.getTime(); cal.set(Calendar.SECOND, 0); dateZeroSecondAndMillis = cal.getTime(); - + cal = new GregorianCalendar(2007, 8 - 1, 13, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); cal.setTimeZone(TimeZone.getTimeZone("GMT")); diff --git a/src/test/java/com/fasterxml/jackson/databind/util/TestObjectBuffer.java b/src/test/java/com/fasterxml/jackson/databind/util/TestObjectBuffer.java index 8d1a4cce8a..afb3593a05 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/TestObjectBuffer.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/TestObjectBuffer.java @@ -53,7 +53,7 @@ private void _testObjectBuffer(Class clz) } Object[] result; - + if (clz == null) { result = thisBuf.completeAndClearBuffer(chunk, ix); } else { diff --git a/src/test/java/com/fasterxml/jackson/databind/util/TestStdDateFormat.java b/src/test/java/com/fasterxml/jackson/databind/util/TestStdDateFormat.java index fd2e4936cb..205528a63b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/TestStdDateFormat.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/TestStdDateFormat.java @@ -89,7 +89,7 @@ public void testISO8601RegexpFull() throws Exception assertEquals(2, m.groupCount()); assertEquals(".2", m.group(1)); assertEquals("+03:00", m.group(2)); - + m = p.matcher("1972-12-28T00:00:00.01-0300"); assertTrue(m.matches()); assertEquals(".01", m.group(1)); @@ -129,7 +129,7 @@ public void testLenientParsing() throws Exception dt = f.parse("2015-11-32"); assertNotNull(dt); } - + public void testInvalid() { StdDateFormat std = new StdDateFormat(); try { diff --git a/src/test/java/com/fasterxml/jackson/databind/util/TokenBufferTest.java b/src/test/java/com/fasterxml/jackson/databind/util/TokenBufferTest.java index 9bed034e8a..29b57685d1 100644 --- a/src/test/java/com/fasterxml/jackson/databind/util/TokenBufferTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/util/TokenBufferTest.java @@ -295,7 +295,7 @@ public void testSimpleArray() throws IOException p.close(); buf.close(); } - + public void testSimpleObject() throws IOException { TokenBuffer buf = new TokenBuffer(null, false); @@ -333,7 +333,7 @@ public void testSimpleObject() throws IOException // and override should also work: p.overrideCurrentName("bah"); assertEquals("bah", p.currentName()); - + assertToken(JsonToken.VALUE_NUMBER_FLOAT, p.nextToken()); assertEquals(1.25, p.getDoubleValue()); // should still have access to (overridden) name @@ -367,7 +367,7 @@ public void testWithJSONSampleDoc() throws Exception tb.close(); p.close(); - + // 19-Oct-2016, tatu: Just for fun, trigger `toString()` for code coverage String desc = tb.toString(); assertNotNull(desc); @@ -379,14 +379,14 @@ public void testAppend() throws IOException buf1.writeStartObject(); buf1.writeFieldName("a"); buf1.writeBoolean(true); - + TokenBuffer buf2 = new TokenBuffer(null, false); buf2.writeFieldName("b"); buf2.writeNumber(13); buf2.writeEndObject(); - + buf1.append(buf2); - + // and verify that we got it all... JsonParser p = buf1.asParser(); assertToken(JsonToken.START_OBJECT, p.nextToken()); @@ -419,7 +419,7 @@ public void testWithUUID() throws IOException UUID uuid = UUID.fromString(value); MAPPER.writeValue(buf, uuid); buf.close(); - + // and bring it back UUID out = MAPPER.readValue(buf.asParser(), UUID.class); assertEquals(uuid.toString(), out.toString()); @@ -445,17 +445,17 @@ public void testOutputContext() throws IOException TokenBuffer buf = new TokenBuffer(null, false); // no ObjectCodec StringWriter w = new StringWriter(); JsonGenerator gen = MAPPER.createGenerator(w); - + // test content: [{"a":1,"b":{"c":2}},{"a":2,"b":{"c":3}}] buf.writeStartArray(); gen.writeStartArray(); _verifyOutputContext(buf, gen); - + buf.writeStartObject(); gen.writeStartObject(); _verifyOutputContext(buf, gen); - + buf.writeFieldName("a"); gen.writeFieldName("a"); _verifyOutputContext(buf, gen); @@ -471,7 +471,7 @@ public void testOutputContext() throws IOException buf.writeStartObject(); gen.writeStartObject(); _verifyOutputContext(buf, gen); - + buf.writeFieldName("c"); gen.writeFieldName("c"); _verifyOutputContext(buf, gen); @@ -491,7 +491,7 @@ public void testOutputContext() throws IOException buf.writeEndArray(); gen.writeEndArray(); _verifyOutputContext(buf, gen); - + buf.close(); gen.close(); } @@ -536,7 +536,7 @@ public void testParentSiblingContext() throws IOException TokenBuffer buf = new TokenBuffer(null, false); // no ObjectCodec // {"a":{},"b":{"c":"cval"}} - + buf.writeStartObject(); buf.writeFieldName("a"); buf.writeStartObject(); @@ -561,7 +561,7 @@ public void testBasicSerialize() throws IOException buf = new TokenBuffer(MAPPER, false); assertEquals("", MAPPER.writeValueAsString(buf)); buf.close(); - + buf = new TokenBuffer(MAPPER, false); buf.writeStartArray(); buf.writeBoolean(true); @@ -591,7 +591,7 @@ public void testBasicSerialize() throws IOException /* Tests to verify interaction of TokenBuffer and JsonParserSequence /********************************************************** */ - + public void testWithJsonParserSequenceSimple() throws IOException { // Let's join a TokenBuffer with JsonParser first @@ -599,12 +599,12 @@ public void testWithJsonParserSequenceSimple() throws IOException buf.writeStartArray(); buf.writeString("test"); JsonParser p = createParserUsingReader("[ true, null ]"); - + JsonParserSequence seq = JsonParserSequence.createFlattened(false, buf.asParser(), p); assertEquals(2, seq.containedParsersCount()); assertFalse(p.isClosed()); - + assertFalse(seq.hasCurrentToken()); assertNull(seq.currentToken()); assertNull(seq.currentName()); @@ -613,7 +613,7 @@ public void testWithJsonParserSequenceSimple() throws IOException assertToken(JsonToken.VALUE_STRING, seq.nextToken()); assertEquals("test", seq.getText()); // end of first parser input, should switch over: - + assertToken(JsonToken.START_ARRAY, seq.nextToken()); assertToken(JsonToken.VALUE_TRUE, seq.nextToken()); assertToken(JsonToken.VALUE_NULL, seq.nextToken()); @@ -636,7 +636,7 @@ public void testWithJsonParserSequenceSimple() throws IOException buf.close(); seq.close(); } - + /** * Test to verify that TokenBuffer and JsonParserSequence work together * as expected. @@ -666,7 +666,7 @@ public void testWithMultipleJsonParserSequences() throws IOException assertToken(JsonToken.VALUE_NUMBER_INT, combo.nextToken()); assertEquals(13, combo.getIntValue()); assertToken(JsonToken.END_ARRAY, combo.nextToken()); - assertNull(combo.nextToken()); + assertNull(combo.nextToken()); buf1.close(); buf2.close(); buf3.close(); diff --git a/src/test/java/com/fasterxml/jackson/databind/views/DefaultViewTest.java b/src/test/java/com/fasterxml/jackson/databind/views/DefaultViewTest.java index 9307b1ac76..cefa9a31df 100644 --- a/src/test/java/com/fasterxml/jackson/databind/views/DefaultViewTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/views/DefaultViewTest.java @@ -28,7 +28,7 @@ static class Defaulting { /********************************************************** /* Unit tests /********************************************************** - */ + */ private final ObjectMapper MAPPER = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/views/TestViewDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/views/TestViewDeserialization.java index 14908c6fb5..a01db1ab12 100644 --- a/src/test/java/com/fasterxml/jackson/databind/views/TestViewDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/views/TestViewDeserialization.java @@ -13,7 +13,7 @@ static class ViewA { } static class ViewAA extends ViewA { } static class ViewB { } static class ViewBB extends ViewB { } - + static class Bean { @JsonView(ViewA.class) @@ -23,7 +23,7 @@ static class Bean public String aa; protected int b; - + @JsonView(ViewB.class) public void setB(int value) { b = value; } } @@ -54,13 +54,13 @@ public ViewsAndCreatorBean(@JsonProperty("a") int a, } /* - /************************************************************************ + /************************************************************************ /* Tests - /************************************************************************ + /************************************************************************ */ private final ObjectMapper mapper = new ObjectMapper(); - + public void testSimple() throws Exception { // by default, should have it all... @@ -69,7 +69,7 @@ public void testSimple() throws Exception assertEquals(3, bean.a); assertEquals("foo", bean.aa); assertEquals(9, bean.b); - + // but with different views, different contents bean = mapper.readerWithView(ViewAA.class) .forType(Bean.class) @@ -86,7 +86,7 @@ public void testSimple() throws Exception assertEquals(1, bean.a); assertNull(bean.aa); assertEquals(0, bean.b); - + bean = mapper.readerFor(Bean.class) .withView(ViewB.class) .readValue("{\"a\":-3, \"aa\":\"y\", \"b\": 2 }"); @@ -118,7 +118,7 @@ public void testWithoutDefaultInclusion() throws Exception public void testWithCreatorAndViews() throws Exception { - ViewsAndCreatorBean result; + ViewsAndCreatorBean result; result = mapper.readerFor(ViewsAndCreatorBean.class) .withView(ViewA.class) diff --git a/src/test/java/com/fasterxml/jackson/databind/views/TestViewSerialization.java b/src/test/java/com/fasterxml/jackson/databind/views/TestViewSerialization.java index 5cccb66013..424d1781f5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/views/TestViewSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/views/TestViewSerialization.java @@ -19,7 +19,7 @@ static class ViewA { } static class ViewAA extends ViewA { } static class ViewB { } static class ViewBB extends ViewB { } - + static class Bean { @JsonView(ViewA.class) @@ -57,10 +57,10 @@ static class ImplicitBean { static class VisibilityBean { @JsonProperty protected String id = "id"; - + @JsonView(ViewA.class) public String value = "x"; - } + } public static class WebView { } public static class OtherView { } @@ -73,7 +73,7 @@ public static class Foo { /********************************************************** /* Unit tests /********************************************************** - */ + */ private final ObjectMapper MAPPER = objectMapper(); @@ -185,5 +185,5 @@ public void test868() throws IOException mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT); String json = mapper.writerWithView(OtherView.class).writeValueAsString(new Foo()); assertEquals(json, "{}"); - } + } } diff --git a/src/test/java/com/fasterxml/jackson/databind/views/TestViewsSerialization2.java b/src/test/java/com/fasterxml/jackson/databind/views/TestViewsSerialization2.java index 382947c491..0d001806eb 100644 --- a/src/test/java/com/fasterxml/jackson/databind/views/TestViewsSerialization2.java +++ b/src/test/java/com/fasterxml/jackson/databind/views/TestViewsSerialization2.java @@ -19,7 +19,7 @@ static class Views public interface View { } public interface ExtendedView extends View { } } - + static class ComplexTestData { String nameNull = null; @@ -116,11 +116,11 @@ public void setNameHidden( String nameHidden ) } /* - /************************************************************************ + /************************************************************************ /* Tests - /************************************************************************ + /************************************************************************ */ - + public void testDataBindingUsage( ) throws Exception { ObjectMapper mapper = createMapper(); diff --git a/src/test/java/com/fasterxml/jackson/databind/views/ViewsWithSchemaTest.java b/src/test/java/com/fasterxml/jackson/databind/views/ViewsWithSchemaTest.java index b804faf0f3..b2c07a724d 100644 --- a/src/test/java/com/fasterxml/jackson/databind/views/ViewsWithSchemaTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/views/ViewsWithSchemaTest.java @@ -18,7 +18,7 @@ static class POJO { @JsonView({ ViewAB.class, ViewBC.class }) public int b; - + @JsonView({ ViewBC.class }) public int c; } @@ -49,7 +49,7 @@ public void optionalProperty(String name, /* Test methods /********************************************************** */ - + private final ObjectMapper MAPPER = new ObjectMapper(); public void testSchemaWithViews() throws Exception diff --git a/src/test/java/com/fasterxml/jackson/failing/BackReference1516Test.java b/src/test/java/com/fasterxml/jackson/failing/BackReference1516Test.java index 7ac3225866..ba43da8b3d 100644 --- a/src/test/java/com/fasterxml/jackson/failing/BackReference1516Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/BackReference1516Test.java @@ -39,7 +39,7 @@ public ChildObject1(String id, String name, this.parent = parent; } } - + static class ParentWithoutCreator { public String id, name; @@ -76,7 +76,7 @@ public ChildObject2(String id, String name, " 'name': 'Bob',\n"+ " 'child': { 'id': 'def', 'name':'Bert' }\n"+ "}"); - + public void testWithParentCreator() throws Exception { ParentWithCreator result = MAPPER.readValue(PARENT_CHILD_JSON, diff --git a/src/test/java/com/fasterxml/jackson/failing/BuilderWithBackRef2686Test.java b/src/test/java/com/fasterxml/jackson/failing/BuilderWithBackRef2686Test.java index 09795e751c..97bf4e876f 100644 --- a/src/test/java/com/fasterxml/jackson/failing/BuilderWithBackRef2686Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/BuilderWithBackRef2686Test.java @@ -45,7 +45,7 @@ public static class Content { private Container back; private String contentValue; - + @ConstructorProperties({ "back", "contentValue" }) public Content(Container back, String contentValue) { this.back = back; @@ -76,7 +76,7 @@ Builder contentValue(String cv) { this.contentValue = cv; return this; } - + Content build() { return new Content(back, contentValue); } @@ -91,7 +91,7 @@ public void testBuildWithBackRefs2686() throws Exception container.containerValue = "containerValue"; Content content = new Content(container, "contentValue"); container.forward = content; - + String json = MAPPER.writeValueAsString(container); Container result = MAPPER.readValue(json, Container.class); // Exception here diff --git a/src/test/java/com/fasterxml/jackson/failing/CyclicRefViaCollection3069Test.java b/src/test/java/com/fasterxml/jackson/failing/CyclicRefViaCollection3069Test.java index 2773236533..25e6c88c47 100644 --- a/src/test/java/com/fasterxml/jackson/failing/CyclicRefViaCollection3069Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/CyclicRefViaCollection3069Test.java @@ -107,7 +107,7 @@ private List abc() { return Arrays.asList(a, b, c); } - + public void testSerializationCollection(final ObjectMapper mapper, final Collection collection) throws Exception { assertEquals(getExpectedResult(), mapper.writeValueAsString(collection)); diff --git a/src/test/java/com/fasterxml/jackson/failing/DelegatingCreatorWithAbstractProp2252Test.java b/src/test/java/com/fasterxml/jackson/failing/DelegatingCreatorWithAbstractProp2252Test.java index fea2e44c60..a12c8ebef2 100644 --- a/src/test/java/com/fasterxml/jackson/failing/DelegatingCreatorWithAbstractProp2252Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/DelegatingCreatorWithAbstractProp2252Test.java @@ -20,7 +20,7 @@ public void setNeverUsed(MyAbstractList bogus) { } } // NOTE! Abstract POJO is fine, only Map/Collection causes issues for some reason - + // static abstract class MyAbstractMap extends AbstractMap { } @SuppressWarnings("serial") diff --git a/src/test/java/com/fasterxml/jackson/failing/ExternalTypeIdWithUnwrapped2039Test.java b/src/test/java/com/fasterxml/jackson/failing/ExternalTypeIdWithUnwrapped2039Test.java index 6867e1a9b7..fadf628518 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ExternalTypeIdWithUnwrapped2039Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ExternalTypeIdWithUnwrapped2039Test.java @@ -33,7 +33,7 @@ public static class SubType2039 { } public static class SubA2039 extends SubType2039 { @JsonProperty public boolean bool; } - + public void testExternalWithUnwrapped2039() throws Exception { final ObjectMapper mapper = newJsonMapper(); diff --git a/src/test/java/com/fasterxml/jackson/failing/JacksonInject2678Test.java b/src/test/java/com/fasterxml/jackson/failing/JacksonInject2678Test.java index d0cf6c7082..16f3c43bc8 100644 --- a/src/test/java/com/fasterxml/jackson/failing/JacksonInject2678Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/JacksonInject2678Test.java @@ -23,7 +23,7 @@ public Some(@JsonProperty("field1") final String field1, @JsonProperty("field2") @JacksonInject(value = "defaultValueForField2", useInput = OptBoolean.TRUE) final String field2) { -//System.err.println("CTOR: setField2 as ["+field2+"]"); +//System.err.println("CTOR: setField2 as ["+field2+"]"); this.field1 = Objects.requireNonNull(field1); this.field2 = Objects.requireNonNull(field2); } diff --git a/src/test/java/com/fasterxml/jackson/failing/JsonSetter2572Test.java b/src/test/java/com/fasterxml/jackson/failing/JsonSetter2572Test.java index ac3c25478a..9c024642e9 100644 --- a/src/test/java/com/fasterxml/jackson/failing/JsonSetter2572Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/JsonSetter2572Test.java @@ -45,6 +45,6 @@ public void testSetterWithEmpty() throws Exception { assertNotNull(result); assertNotNull(result.inner); // converted to "empty" bean -//System.err.println("Final -> "+mapper.writeValueAsString(result)); +//System.err.println("Final -> "+mapper.writeValueAsString(result)); } } diff --git a/src/test/java/com/fasterxml/jackson/failing/KevinFail1410Test.java b/src/test/java/com/fasterxml/jackson/failing/KevinFail1410Test.java index 4d73e96711..73be96fa3a 100644 --- a/src/test/java/com/fasterxml/jackson/failing/KevinFail1410Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/KevinFail1410Test.java @@ -7,7 +7,7 @@ public class KevinFail1410Test extends BaseMapTest { enum EnvironmentEventSource { BACKEND; } - + @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="source") @JsonSubTypes({ @JsonSubTypes.Type(value = BackendEvent.class, name = "BACKEND") diff --git a/src/test/java/com/fasterxml/jackson/failing/ObjectIdWithBuilder1496Test.java b/src/test/java/com/fasterxml/jackson/failing/ObjectIdWithBuilder1496Test.java index 64df1f8397..2f56027f2f 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ObjectIdWithBuilder1496Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ObjectIdWithBuilder1496Test.java @@ -24,7 +24,7 @@ static class POJO @Override public String toString() { return "id: " + id + ", var: " + var; } } - + @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id") @JsonPOJOBuilder(withPrefix = "", buildMethodName="readFromCacheOrBuild") static final class POJOBuilder { @@ -36,7 +36,7 @@ static final class POJOBuilder { public POJOBuilder var(int _var) { var = _var; return this; } public POJO build() { return new POJO(id, var); } - + // Special build method for jackson deserializer that caches objects already deserialized private final static ConcurrentHashMap cache = new ConcurrentHashMap<>(); public POJO readFromCacheOrBuild() { @@ -59,7 +59,7 @@ public POJO readFromCacheOrBuild() { */ private final ObjectMapper MAPPER = newJsonMapper(); - + public void testBuilderId1496() throws Exception { POJO input = new POJOBuilder().id(123L).var(456).build(); diff --git a/src/test/java/com/fasterxml/jackson/failing/ParsingContextExtTypeId2747Test.java b/src/test/java/com/fasterxml/jackson/failing/ParsingContextExtTypeId2747Test.java index 3bc900f5a7..bea3e0f8c8 100644 --- a/src/test/java/com/fasterxml/jackson/failing/ParsingContextExtTypeId2747Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/ParsingContextExtTypeId2747Test.java @@ -15,13 +15,13 @@ static class Wrapper { @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", include = JsonTypeInfo.As.EXTERNAL_PROPERTY) public Tag wrapped; - + public String type; } - + @JsonSubTypes(@JsonSubTypes.Type(Location.class)) interface Tag {} - + @JsonTypeName("location") @JsonDeserialize(using = LocationDeserializer.class) static class Location implements Tag @@ -31,7 +31,7 @@ static class Location implements Tag protected Location() { } Location(String v) { value = v; } } - + static class LocationDeserializer extends JsonDeserializer { @Override @@ -46,13 +46,13 @@ static String getCurrentLocationAsString(JsonParser p) { // This suffices to give actual path return p.getParsingContext().pathAsPointer().toString(); - } + } // [databind#2747] public void testLocationAccessWithExtTypeId() throws Exception { ObjectReader objectReader = newJsonMapper().readerFor(Wrapper.class); - + Wrapper wrapper = objectReader.readValue("{" + "\"type\":\"location\"," + "\"wrapped\": 1" + diff --git a/src/test/java/com/fasterxml/jackson/failing/PolymorphicArrays3194Test.java b/src/test/java/com/fasterxml/jackson/failing/PolymorphicArrays3194Test.java index 87865e1ba0..ad4d5a1de5 100644 --- a/src/test/java/com/fasterxml/jackson/failing/PolymorphicArrays3194Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/PolymorphicArrays3194Test.java @@ -32,16 +32,16 @@ public void testTwoDimensionalArrayMapping() throws Exception String json = mapper // .writerWithDefaultPrettyPrinter() .writeValueAsString(instance); - + // Note: we'll see something like: - // + // // { // "value" : [ "[[Ljava.lang.String;", [ [ "[Ljava.lang.String;", [ "1.1", "1.2" ] ], [ "[Ljava.lang.String;", [ "2.1", "2.2" ] ] ] ] // } - // that is, type ids for both array levels. - -// System.err.println("JSON:\n"+json); + // that is, type ids for both array levels. + +// System.err.println("JSON:\n"+json); SomeBean result = mapper.readValue(json, SomeBean.class); // fails assertEquals(String[][].class, result.value.getClass()); assertEquals(String[].class, result.value[0].getClass()); diff --git a/src/test/java/com/fasterxml/jackson/failing/SetterlessList2692Test.java b/src/test/java/com/fasterxml/jackson/failing/SetterlessList2692Test.java index 6957dce318..1cdf3dccce 100644 --- a/src/test/java/com/fasterxml/jackson/failing/SetterlessList2692Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/SetterlessList2692Test.java @@ -22,7 +22,7 @@ public DataBean(@JsonProperty(value = "val") String val) { public String getVal() { return val; } - + public List getList(){ return new ArrayList<>(); } diff --git a/src/test/java/com/fasterxml/jackson/failing/TestNonStaticInnerClassInList32.java b/src/test/java/com/fasterxml/jackson/failing/TestNonStaticInnerClassInList32.java index eaaab0f7fb..0c50ec745f 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestNonStaticInnerClassInList32.java +++ b/src/test/java/com/fasterxml/jackson/failing/TestNonStaticInnerClassInList32.java @@ -17,13 +17,13 @@ public class Leg { public int length; } } - + /* /********************************************************** /* Tests /********************************************************** */ - + // core/[Issue#32] public void testInnerList() throws Exception { diff --git a/src/test/java/com/fasterxml/jackson/failing/TestObjectIdDeserialization.java b/src/test/java/com/fasterxml/jackson/failing/TestObjectIdDeserialization.java index 338d7e9f84..e17027cca4 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestObjectIdDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/failing/TestObjectIdDeserialization.java @@ -48,7 +48,7 @@ public void setReports(List reports) } private final ObjectMapper mapper = new ObjectMapper(); - + /* /***************************************************** /* Unit tests, external id deserialization diff --git a/src/test/java/com/fasterxml/jackson/failing/TestObjectIdWithInjectables639.java b/src/test/java/com/fasterxml/jackson/failing/TestObjectIdWithInjectables639.java index 3d85f2c32b..842d90559e 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestObjectIdWithInjectables639.java +++ b/src/test/java/com/fasterxml/jackson/failing/TestObjectIdWithInjectables639.java @@ -5,7 +5,7 @@ // This is probably impossible to handle, in general case, since // there is a cycle for Parent2/Child2... unless special handling -// could be made to ensure that +// could be made to ensure that public class TestObjectIdWithInjectables639 extends BaseMapTest { public static final class Context { } @@ -28,7 +28,7 @@ public Child1(@JsonProperty("parent") Parent1 parent) { this.parent = parent; } } - + @JsonIdentityInfo(generator = ObjectIdGenerators.IntSequenceGenerator.class) public static final class Parent2 { diff --git a/src/test/java/com/fasterxml/jackson/failing/TestSetterlessProperties501.java b/src/test/java/com/fasterxml/jackson/failing/TestSetterlessProperties501.java index d29ddd1792..4be127ed49 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestSetterlessProperties501.java +++ b/src/test/java/com/fasterxml/jackson/failing/TestSetterlessProperties501.java @@ -26,7 +26,7 @@ public Issue501Bean(String key, Poly value) { m.put(key, value); l.add(value); } - + @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) public List getList(){ return l; @@ -40,7 +40,7 @@ public Map getMap() { // public void setMap(Map m) { this.m = m; } // public void setList(List l) { this.l = l; } } - + /* /********************************************************** /* Unit tests diff --git a/src/test/java/com/fasterxml/jackson/failing/TestUnwrappedMap171.java b/src/test/java/com/fasterxml/jackson/failing/TestUnwrappedMap171.java index dc462329fc..d555d4d7b0 100644 --- a/src/test/java/com/fasterxml/jackson/failing/TestUnwrappedMap171.java +++ b/src/test/java/com/fasterxml/jackson/failing/TestUnwrappedMap171.java @@ -20,7 +20,7 @@ public MapUnwrap(String key, Object value) { @JsonUnwrapped(prefix="map.") public Map map; } - + // // // Reuse mapper to keep tests bit faster private final ObjectMapper MAPPER = new ObjectMapper(); diff --git a/src/test/java/com/fasterxml/jackson/failing/UnwrappedCaching2461Test.java b/src/test/java/com/fasterxml/jackson/failing/UnwrappedCaching2461Test.java index ab7bde9a01..faa127f576 100644 --- a/src/test/java/com/fasterxml/jackson/failing/UnwrappedCaching2461Test.java +++ b/src/test/java/com/fasterxml/jackson/failing/UnwrappedCaching2461Test.java @@ -39,7 +39,7 @@ public void testUnwrappedCaching() throws Exception { final String EXP_INNER = "{\"base.id\":\"12345\"}"; final String EXP_OUTER = "{\"container.base.id\":\"12345\"}"; - + final ObjectMapper mapperOrder1 = newJsonMapper(); assertEquals(EXP_OUTER, mapperOrder1.writeValueAsString(outer)); assertEquals(EXP_INNER, mapperOrder1.writeValueAsString(inner)); diff --git a/src/test/java/perf/ManualReadPerfUntyped.java b/src/test/java/perf/ManualReadPerfUntyped.java index 6a49ca3d64..f5de47bd59 100644 --- a/src/test/java/perf/ManualReadPerfUntyped.java +++ b/src/test/java/perf/ManualReadPerfUntyped.java @@ -10,7 +10,7 @@ public class ManualReadPerfUntyped extends ObjectReaderTestBase { @Override protected int targetSizeMegs() { return 10; } - + public static void main(String[] args) throws Exception { if (args.length != 1) { @@ -24,12 +24,12 @@ public static void main(String[] args) throws Exception .configure(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES, doIntern) .configure(JsonFactory.Feature.INTERN_FIELD_NAMES, doIntern) .build(); - + JsonMapper m = new JsonMapper(f); - + // Either Object or Map final Class UNTYPED = Map.class; - + Object input1 = m.readValue(data, UNTYPED); JsonNode input2 = m.readTree(data); diff --git a/src/test/java/perf/ManualReadPerfUntypedReader.java b/src/test/java/perf/ManualReadPerfUntypedReader.java index 08a03e85a0..f796da28df 100644 --- a/src/test/java/perf/ManualReadPerfUntypedReader.java +++ b/src/test/java/perf/ManualReadPerfUntypedReader.java @@ -25,7 +25,7 @@ public static void main(String[] args) throws Exception .configure(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES, doIntern) .configure(JsonFactory.Feature.INTERN_FIELD_NAMES, doIntern) .build(); - + JsonMapper m = new JsonMapper(f); Object input1 = m.readValue(data, Object.class); JsonNode input2 = m.readTree(data); @@ -48,7 +48,7 @@ protected double testDeser1(int reps, String input, ObjectReader reader) throws protected double testDeser2(int reps, String input, ObjectReader reader) throws IOException { return _testRawDeser(reps, input, reader); } - + protected final double _testRawDeser(int reps, String json, ObjectReader reader) throws IOException { long start = System.nanoTime(); diff --git a/src/test/java/perf/ManualReadPerfUntypedStream.java b/src/test/java/perf/ManualReadPerfUntypedStream.java index cab09f3f44..b2b3a73c79 100644 --- a/src/test/java/perf/ManualReadPerfUntypedStream.java +++ b/src/test/java/perf/ManualReadPerfUntypedStream.java @@ -10,7 +10,7 @@ public class ManualReadPerfUntypedStream extends ObjectReaderTestBase { @Override protected int targetSizeMegs() { return 15; } - + public static void main(String[] args) throws Exception { if (args.length != 1) { @@ -48,7 +48,7 @@ protected double testDeser1(int reps, byte[] input, ObjectReader reader) throws protected double testDeser2(int reps, byte[] input, ObjectReader reader) throws IOException { return _testRawDeser(reps, input, reader); } - + protected final double _testRawDeser(int reps, byte[] json, ObjectReader reader) throws IOException { long start = System.nanoTime(); diff --git a/src/test/java/perf/ManualReadPerfWithMedia.java b/src/test/java/perf/ManualReadPerfWithMedia.java index 4c9e6b1e1d..ed8387faea 100644 --- a/src/test/java/perf/ManualReadPerfWithMedia.java +++ b/src/test/java/perf/ManualReadPerfWithMedia.java @@ -9,7 +9,7 @@ public class ManualReadPerfWithMedia extends ObjectReaderTestBase { @Override protected int targetSizeMegs() { return 8; } - + public static void main(String[] args) throws Exception { if (args.length != 0) { diff --git a/src/test/java/perf/ManualReadPerfWithUUID.java b/src/test/java/perf/ManualReadPerfWithUUID.java index 8b3f280225..a889d139e5 100644 --- a/src/test/java/perf/ManualReadPerfWithUUID.java +++ b/src/test/java/perf/ManualReadPerfWithUUID.java @@ -18,7 +18,7 @@ public UUIDNative() { } @Override protected int targetSizeMegs() { return 8; } - + @SuppressWarnings("serial") static class SlowDeser extends FromStringDeserializer { @@ -31,14 +31,14 @@ protected UUID _deserialize(String id, DeserializationContext ctxt) return UUID.fromString(id); } } - + static class UUIDWithJdk { @JsonDeserialize(contentUsing=SlowDeser.class) public UUID[] ids; public UUIDWithJdk() { } public UUIDWithJdk(UUID[] ids) { this.ids = ids; } } - + public static void main(String[] args) throws Exception { if (args.length != 0) { diff --git a/src/test/java/perf/ManualReadWithTypeResolution.java b/src/test/java/perf/ManualReadWithTypeResolution.java index 174be9ae00..3748284a97 100644 --- a/src/test/java/perf/ManualReadWithTypeResolution.java +++ b/src/test/java/perf/ManualReadWithTypeResolution.java @@ -47,7 +47,7 @@ private ManualReadWithTypeResolution() throws IOException { _inputType = Map.class; _inputTypeRef = new TypeReference>() { }; */ - + REPS = (int) ((double) (15 * 1000 * 1000) / (double) _input.length); } @@ -72,7 +72,7 @@ private void doTest() throws Exception String msg; double msesc; - + switch (type) { case 0: msesc = testDeser(REPS, _input, _mapper, _inputType); @@ -112,7 +112,7 @@ protected final double testDeser(int reps, byte[] json, ObjectMapper mapper, Typ hash = result.hashCode(); return _msecsFromNanos(System.nanoTime() - start); } - + private void updateStats(int type, boolean doGc, String msg, double msecs) throws Exception { diff --git a/src/test/java/perf/ManualWritePerfWithUUID.java b/src/test/java/perf/ManualWritePerfWithUUID.java index 917d09252d..5676a6b9b7 100644 --- a/src/test/java/perf/ManualWritePerfWithUUID.java +++ b/src/test/java/perf/ManualWritePerfWithUUID.java @@ -15,7 +15,7 @@ public class ManualWritePerfWithUUID { @Override protected int targetSizeMegs() { return 10; } - + public static void main(String[] args) throws Exception { if (args.length != 0) { @@ -43,7 +43,7 @@ class UUIDSlow { @JsonSerialize(contentUsing=SlowSer.class) public final UUID[] values; - + public UUIDSlow(UUID[] v) { values = v; } } diff --git a/src/test/java/perf/MediaItem.java b/src/test/java/perf/MediaItem.java index 9e09c28f2e..ea70185387 100644 --- a/src/test/java/perf/MediaItem.java +++ b/src/test/java/perf/MediaItem.java @@ -28,7 +28,7 @@ public void addPhoto(Photo p) { } _photos.add(p); } - + public List getImages() { return _photos; } public void setImages(List p) { _photos = p; } @@ -40,7 +40,7 @@ public void addPhoto(Photo p) { /* Helper types /********************************************************** */ - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) @JsonPropertyOrder({"uri","title","width","height","size"}) public static class Photo @@ -50,7 +50,7 @@ public static class Photo private int _width; private int _height; private Size _size; - + public Photo() {} public Photo(String uri, String title, int w, int h, Size s) { @@ -60,20 +60,20 @@ public Photo(String uri, String title, int w, int h, Size s) _height = h; _size = s; } - + public String getUri() { return _uri; } public String getTitle() { return _title; } public int getWidth() { return _width; } public int getHeight() { return _height; } public Size getSize() { return _size; } - + public void setUri(String u) { _uri = u; } public void setTitle(String t) { _title = t; } public void setWidth(int w) { _width = w; } public void setHeight(int h) { _height = h; } public void setSize(Size s) { _size = s; } } - + @JsonFormat(shape=JsonFormat.Shape.ARRAY) @JsonPropertyOrder({"uri","title","width","height","format","duration","size","bitrate","persons","player","copyright"}) public static class Content @@ -89,7 +89,7 @@ public static class Content private int _bitrate; private List _persons; private String _copyright; - + public Content() { } public void addPerson(String p) { @@ -98,7 +98,7 @@ public void addPerson(String p) { } _persons.add(p); } - + public Player getPlayer() { return _player; } public String getUri() { return _uri; } public String getTitle() { return _title; } @@ -110,7 +110,7 @@ public void addPerson(String p) { public int getBitrate() { return _bitrate; } public List getPersons() { return _persons; } public String getCopyright() { return _copyright; } - + public void setPlayer(Player p) { _player = p; } public void setUri(String u) { _uri = u; } public void setTitle(String t) { _title = t; } diff --git a/src/test/java/perf/NopOutputStream.java b/src/test/java/perf/NopOutputStream.java index 4ef7f92c17..b80950657b 100644 --- a/src/test/java/perf/NopOutputStream.java +++ b/src/test/java/perf/NopOutputStream.java @@ -6,7 +6,7 @@ public class NopOutputStream extends OutputStream { protected int size = 0; - + public NopOutputStream() { } @Override diff --git a/src/test/java/perf/NopWriter.java b/src/test/java/perf/NopWriter.java index 848bb729bc..729e2c42e8 100644 --- a/src/test/java/perf/NopWriter.java +++ b/src/test/java/perf/NopWriter.java @@ -5,7 +5,7 @@ public class NopWriter extends Writer { protected int size = 0; - + public NopWriter() { } @Override diff --git a/src/test/java/perf/ObjectReaderTestBase.java b/src/test/java/perf/ObjectReaderTestBase.java index d973b2e89e..eec73933d6 100644 --- a/src/test/java/perf/ObjectReaderTestBase.java +++ b/src/test/java/perf/ObjectReaderTestBase.java @@ -9,7 +9,7 @@ abstract class ObjectReaderTestBase protected final static int WARMUP_ROUNDS = 5; protected String _desc1, _desc2; - + protected int hash; protected long startMeasure = System.currentTimeMillis() + 5000L; protected int roundsDone = 0; @@ -17,7 +17,7 @@ abstract class ObjectReaderTestBase private double[] timeMsecs; protected abstract int targetSizeMegs(); - + protected void testFromBytes(ObjectMapper mapper1, String desc1, Object inputValue1, Class inputClass1, ObjectMapper mapper2, String desc2, @@ -36,10 +36,10 @@ protected void testFromBytes(ObjectMapper mapper1, String desc1, _desc1 = String.format("%s (%d bytes)", desc1, byteInput1.length); _desc2 = String.format("%s (%d bytes)", desc2, byteInput2.length); - + doTest(mapper1, byteInput1, inputClass1, mapper2, byteInput2, inputClass2); } - + protected void testFromString(ObjectMapper mapper1, String desc1, Object inputValue1, Class inputClass1, ObjectMapper mapper2, String desc2, @@ -57,10 +57,10 @@ protected void testFromString(ObjectMapper mapper1, String desc1, /*T1 back1 =*/ mapper1.readValue(input1, inputClass1); /*T2 back2 =*/ mapper2.readValue(input2, inputClass2); System.out.println("Input successfully round-tripped for both styles..."); - + doTest(mapper1, input1, inputClass1, mapper2, input2, inputClass2); } - + protected void doTest(ObjectMapper mapper1, byte[] byteInput1, Class inputClass1, ObjectMapper mapper2, byte[] byteInput2, Class inputClass2) throws Exception @@ -73,19 +73,19 @@ protected void doTest(ObjectMapper mapper1, byte[] byteInput1, Class inputCla .forType(inputClass1); final ObjectReader arrayReader = mapper2.reader() .forType(inputClass2); - + int i = 0; final int TYPES = 2; timeMsecs = new double[TYPES]; - + while (true) { Thread.sleep(100L); final int type = (i++ % TYPES); String msg; double msesc; - + switch (type) { case 0: msg = _desc1; @@ -116,7 +116,7 @@ protected void doTest(ObjectMapper mapper1, String input1, Class inputClass1, final ObjectReader arrayReader = mapper2.reader() .with(DeserializationFeature.EAGER_DESERIALIZER_FETCH) .forType(inputClass2); - + int i = 0; final int TYPES = 2; @@ -127,7 +127,7 @@ protected void doTest(ObjectMapper mapper1, String input1, Class inputClass1, int type = (i++ % TYPES); String msg; double msecs; - + switch (type) { case 0: msg = _desc1; @@ -143,7 +143,7 @@ protected void doTest(ObjectMapper mapper1, String input1, Class inputClass1, updateStats(type, (i % 17) == 0, msg, msecs); } } - + private void updateStats(int type, boolean doGc, String msg, double msecs) throws Exception { @@ -188,7 +188,7 @@ protected double testDeser1(int reps, byte[] input, ObjectReader reader) throws protected double testDeser2(int reps, byte[] input, ObjectReader reader) throws Exception { return _testDeser(reps, input, reader); } - + protected final double _testDeser(int reps, byte[] input, ObjectReader reader) throws Exception { long start = System.nanoTime(); @@ -208,7 +208,7 @@ protected double testDeser1(int reps, String input, ObjectReader reader) throws protected double testDeser2(int reps, String input, ObjectReader reader) throws Exception { return _testDeser(reps, input, reader); } - + protected final double _testDeser(int reps, String input, ObjectReader reader) throws Exception { long start = System.nanoTime(); @@ -223,7 +223,7 @@ protected final double _testDeser(int reps, String input, ObjectReader reader) t protected final double _msecsFromNanos(long nanos) { return (nanos / 1000000.0); } - + protected static byte[] readAll(String filename) throws IOException { File f = new File(filename); @@ -231,7 +231,7 @@ protected static byte[] readAll(String filename) throws IOException byte[] buffer = new byte[4000]; int count; FileInputStream in = new FileInputStream(f); - + while ((count = in.read(buffer)) > 0) { bytes.write(buffer, 0, count); } diff --git a/src/test/java/perf/ObjectWriterTestBase.java b/src/test/java/perf/ObjectWriterTestBase.java index c7e087814e..f054ca9373 100644 --- a/src/test/java/perf/ObjectWriterTestBase.java +++ b/src/test/java/perf/ObjectWriterTestBase.java @@ -19,7 +19,7 @@ protected void test(ObjectMapper mapper, { final byte[] input1 = mapper.writeValueAsBytes(inputValue1); final byte[] input2 = mapper.writeValueAsBytes(inputValue2); - + // Let's try to guestimate suitable size, N megs of output REPS = (int) ((double) (targetSizeMegs() * 1000 * 1000) / (double) input1.length); System.out.printf("Read %d bytes to bind (%d as array); will do %d repetitions\n", @@ -29,7 +29,7 @@ protected void test(ObjectMapper mapper, final ObjectWriter writer0 = mapper.writer().with(SerializationFeature.EAGER_SERIALIZER_FETCH); final ObjectWriter writer1 = writer0.forType(inputClass1); final ObjectWriter writer2 = writer0.forType(inputClass2); - + int i = 0; int roundsDone = 0; final int TYPES = 2; @@ -37,9 +37,9 @@ protected void test(ObjectMapper mapper, // Skip first 5 seconds long startMeasure = System.currentTimeMillis() + 5000L; System.out.print("Warming up"); - + final double[] timesMsec = new double[TYPES]; - + while (true) { final int round = (i % TYPES); final boolean lf = (++i % TYPES) == 0; @@ -86,13 +86,13 @@ protected void test(ObjectMapper mapper, System.gc(); Thread.sleep(100L); } - + System.out.printf("Test '%s' [hash: 0x%s] -> %.1f msecs\n", msg, hash, msecs); Thread.sleep(50L); if (!lf) { continue; } - + if ((++roundsDone % 3) == 0) { double den = (double) roundsDone; System.out.printf("Averages after %d rounds (%s/%s): %.1f / %.1f msecs\n", diff --git a/src/test/java/perf/Record.java b/src/test/java/perf/Record.java index a7a7d00bff..76d211b6f2 100644 --- a/src/test/java/perf/Record.java +++ b/src/test/java/perf/Record.java @@ -1,12 +1,12 @@ package perf; /** - * Simple test class + * Simple test class */ final class Record extends RecordBase { protected Record() { super(); } - + public Record(int a, String fn, String ln, char g, boolean ins) { super(a, fn, ln, g, ins); diff --git a/src/test/java/perf/RecordAsArray.java b/src/test/java/perf/RecordAsArray.java index af76bc32b9..bb820df8b1 100644 --- a/src/test/java/perf/RecordAsArray.java +++ b/src/test/java/perf/RecordAsArray.java @@ -6,7 +6,7 @@ final class RecordAsArray extends RecordBase { protected RecordAsArray() { super(); } - + public RecordAsArray(int a, String fn, String ln, char g, boolean ins) { super(a, fn, ln, g, ins); From de62c677b12c02967c9620a11c1c5208f701cfef Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Thu, 2 Feb 2023 20:02:11 -0800 Subject: [PATCH 20/20] Remove trailing ws from non-test sources too --- .../databind/AbstractTypeResolver.java | 2 +- .../databind/AnnotationIntrospector.java | 146 ++++----- .../jackson/databind/BeanDescription.java | 12 +- .../jackson/databind/BeanProperty.java | 24 +- .../jackson/databind/DatabindContext.java | 16 +- .../databind/DeserializationConfig.java | 18 +- .../databind/DeserializationContext.java | 104 +++---- .../databind/DeserializationFeature.java | 40 +-- .../jackson/databind/InjectableValues.java | 6 +- .../fasterxml/jackson/databind/JavaType.java | 38 +-- .../jackson/databind/JsonDeserializer.java | 24 +- .../databind/JsonMappingException.java | 6 +- .../fasterxml/jackson/databind/JsonNode.java | 86 +++--- .../jackson/databind/JsonSerializer.java | 20 +- .../jackson/databind/MapperFeature.java | 20 +- .../jackson/databind/MappingIterator.java | 38 +-- .../jackson/databind/MappingJsonFactory.java | 4 +- .../fasterxml/jackson/databind/Module.java | 52 ++-- .../jackson/databind/ObjectMapper.java | 288 +++++++++--------- .../jackson/databind/ObjectReader.java | 146 ++++----- .../jackson/databind/ObjectWriter.java | 66 ++-- .../jackson/databind/PropertyMetadata.java | 12 +- .../jackson/databind/PropertyName.java | 26 +- .../databind/PropertyNamingStrategies.java | 24 +- .../databind/PropertyNamingStrategy.java | 28 +- .../jackson/databind/SequenceWriter.java | 14 +- .../jackson/databind/SerializationConfig.java | 16 +- .../databind/SerializationFeature.java | 12 +- .../jackson/databind/SerializerProvider.java | 76 ++--- .../databind/annotation/JsonAppend.java | 4 +- .../databind/annotation/JsonDeserialize.java | 6 +- .../databind/annotation/JsonNaming.java | 2 +- .../databind/annotation/JsonSerialize.java | 16 +- .../jackson/databind/cfg/BaseSettings.java | 26 +- .../jackson/databind/cfg/CoercionConfigs.java | 2 +- .../databind/cfg/CoercionInputShape.java | 2 +- .../jackson/databind/cfg/ConfigFeature.java | 4 +- .../jackson/databind/cfg/ConfigOverride.java | 6 +- .../jackson/databind/cfg/ConfigOverrides.java | 6 +- .../databind/cfg/ConstructorDetector.java | 2 +- .../databind/cfg/ContextAttributes.java | 24 +- .../databind/cfg/DatatypeFeatures.java | 8 +- .../cfg/DeserializerFactoryConfig.java | 18 +- .../databind/cfg/HandlerInstantiator.java | 32 +- .../jackson/databind/cfg/JsonNodeFeature.java | 2 +- .../jackson/databind/cfg/MapperBuilder.java | 8 +- .../jackson/databind/cfg/MapperConfig.java | 36 +-- .../databind/cfg/MapperConfigBase.java | 30 +- .../databind/cfg/SerializerFactoryConfig.java | 8 +- .../databind/deser/AbstractDeserializer.java | 8 +- .../deser/BasicDeserializerFactory.java | 76 ++--- .../databind/deser/BeanDeserializer.java | 6 +- .../databind/deser/BeanDeserializerBase.java | 60 ++-- .../deser/BeanDeserializerBuilder.java | 14 +- .../deser/BeanDeserializerFactory.java | 30 +- .../deser/BeanDeserializerModifier.java | 10 +- .../deser/BuilderBasedDeserializer.java | 8 +- .../deser/ContextualDeserializer.java | 8 +- .../deser/ContextualKeyDeserializer.java | 6 +- .../databind/deser/CreatorProperty.java | 18 +- .../databind/deser/DataFormatReaders.java | 50 +-- .../deser/DefaultDeserializationContext.java | 16 +- .../deser/DeserializationProblemHandler.java | 4 +- .../databind/deser/DeserializerCache.java | 16 +- .../databind/deser/DeserializerFactory.java | 18 +- .../jackson/databind/deser/Deserializers.java | 48 +-- .../databind/deser/NullValueProvider.java | 2 +- .../deser/ResolvableDeserializer.java | 2 +- .../databind/deser/SettableAnyProperty.java | 10 +- .../databind/deser/SettableBeanProperty.java | 36 +-- .../deser/UnresolvedForwardReference.java | 4 +- .../jackson/databind/deser/UnresolvedId.java | 4 +- .../databind/deser/ValueInstantiator.java | 2 +- .../databind/deser/ValueInstantiators.java | 4 +- .../impl/BeanAsArrayBuilderDeserializer.java | 14 +- .../deser/impl/BeanAsArrayDeserializer.java | 18 +- .../databind/deser/impl/BeanPropertyMap.java | 18 +- .../databind/deser/impl/CreatorCollector.java | 10 +- .../deser/impl/ErrorThrowingDeserializer.java | 2 +- .../deser/impl/ExternalTypeHandler.java | 8 +- .../deser/impl/FailingDeserializer.java | 2 +- .../databind/deser/impl/FieldProperty.java | 2 +- .../deser/impl/InnerClassProperty.java | 4 +- .../JavaUtilCollectionsDeserializers.java | 14 +- .../deser/impl/ManagedReferenceProperty.java | 2 +- .../databind/deser/impl/MethodProperty.java | 8 +- .../deser/impl/NullsConstantProvider.java | 6 +- .../databind/deser/impl/ObjectIdReader.java | 14 +- .../deser/impl/ObjectIdReferenceProperty.java | 2 +- .../deser/impl/ObjectIdValueProperty.java | 2 +- .../deser/impl/PropertyBasedCreator.java | 8 +- .../impl/PropertyBasedObjectIdGenerator.java | 2 +- .../databind/deser/impl/PropertyValue.java | 12 +- .../deser/impl/PropertyValueBuffer.java | 16 +- .../databind/deser/impl/ReadableObjectId.java | 6 +- .../deser/impl/SetterlessProperty.java | 4 +- .../deser/impl/TypeWrappedDeserializer.java | 4 +- .../impl/UnsupportedTypeDeserializer.java | 2 +- .../deser/impl/UnwrappedPropertyHandler.java | 2 +- .../databind/deser/impl/package-info.java | 2 +- .../jackson/databind/deser/package-info.java | 2 +- .../deser/std/ByteBufferDeserializer.java | 2 +- .../deser/std/CollectionDeserializer.java | 6 +- .../deser/std/ContainerDeserializerBase.java | 4 +- .../databind/deser/std/DateDeserializers.java | 4 +- .../deser/std/DelegatingDeserializer.java | 6 +- .../databind/deser/std/EnumDeserializer.java | 12 +- .../deser/std/EnumMapDeserializer.java | 12 +- .../deser/std/EnumSetDeserializer.java | 14 +- .../std/FactoryBasedEnumDeserializer.java | 12 +- .../deser/std/FromStringDeserializer.java | 8 +- .../deser/std/JsonLocationInstantiator.java | 2 +- .../deser/std/JsonNodeDeserializer.java | 2 +- .../databind/deser/std/MapDeserializer.java | 26 +- .../deser/std/MapEntryDeserializer.java | 2 +- .../deser/std/NullifyingDeserializer.java | 2 +- .../deser/std/NumberDeserializers.java | 20 +- .../deser/std/ObjectArrayDeserializer.java | 8 +- .../std/PrimitiveArrayDeserializers.java | 22 +- .../deser/std/ReferenceTypeDeserializer.java | 4 +- .../std/StackTraceElementDeserializer.java | 2 +- .../deser/std/StdDelegatingDeserializer.java | 14 +- .../databind/deser/std/StdDeserializer.java | 8 +- .../deser/std/StdKeyDeserializer.java | 12 +- .../deser/std/StdKeyDeserializers.java | 6 +- .../deser/std/StdNodeBasedDeserializer.java | 6 +- .../deser/std/StringArrayDeserializer.java | 4 +- .../std/StringCollectionDeserializer.java | 12 +- .../deser/std/ThrowableDeserializer.java | 8 +- .../deser/std/TokenBufferDeserializer.java | 2 +- .../databind/deser/std/UUIDDeserializer.java | 4 +- .../deser/std/UntypedObjectDeserializer.java | 6 +- .../std/UntypedObjectDeserializerNR.java | 10 +- .../exc/IgnoredPropertyException.java | 4 +- .../databind/exc/InvalidFormatException.java | 2 +- .../exc/PropertyBindingException.java | 12 +- .../exc/UnrecognizedPropertyException.java | 2 +- .../databind/ext/CoreXMLSerializers.java | 2 +- .../jackson/databind/ext/DOMDeserializer.java | 6 +- .../databind/ext/Java7HandlersImpl.java | 4 +- .../jackson/databind/ext/Java7Support.java | 2 +- .../databind/ext/OptionalHandlerFactory.java | 8 +- .../introspect/AccessorNamingStrategy.java | 2 +- .../databind/introspect/Annotated.java | 2 +- .../databind/introspect/AnnotatedClass.java | 10 +- .../introspect/AnnotatedClassResolver.java | 8 +- .../introspect/AnnotatedConstructor.java | 12 +- .../introspect/AnnotatedCreatorCollector.java | 6 +- .../databind/introspect/AnnotatedField.java | 14 +- .../databind/introspect/AnnotatedMember.java | 4 +- .../databind/introspect/AnnotatedMethod.java | 14 +- .../introspect/AnnotatedMethodCollector.java | 2 +- .../introspect/AnnotatedParameter.java | 16 +- .../introspect/AnnotationCollector.java | 8 +- .../AnnotationIntrospectorPair.java | 48 +-- .../databind/introspect/AnnotationMap.java | 10 +- .../introspect/BasicBeanDescription.java | 20 +- .../introspect/BasicClassIntrospector.java | 2 +- .../introspect/BeanPropertyDefinition.java | 24 +- .../introspect/ClassIntrospector.java | 2 +- .../databind/introspect/CollectorBase.java | 2 +- .../introspect/ConcreteBeanPropertyBase.java | 2 +- .../DefaultAccessorNamingStrategy.java | 18 +- .../JacksonAnnotationIntrospector.java | 36 +-- .../databind/introspect/ObjectIdInfo.java | 2 +- .../introspect/POJOPropertiesCollector.java | 26 +- .../introspect/POJOPropertyBuilder.java | 48 +-- .../introspect/SimpleMixInResolver.java | 2 +- .../introspect/VirtualAnnotatedMember.java | 8 +- .../introspect/VisibilityChecker.java | 30 +- .../jackson/databind/json/JsonMapper.java | 2 +- .../JsonArrayFormatVisitor.java | 4 +- .../jsonFormatVisitors/JsonFormatTypes.java | 4 +- .../JsonFormatVisitable.java | 2 +- ...onFormatVisitorWithSerializerProvider.java | 2 +- .../JsonFormatVisitorWrapper.java | 2 +- .../JsonMapFormatVisitor.java | 2 +- .../jsonFormatVisitors/JsonValueFormat.java | 2 +- .../databind/jsonschema/JsonSchema.java | 4 +- .../jsonschema/JsonSerializableSchema.java | 8 +- .../databind/jsonschema/SchemaAware.java | 2 +- .../BasicPolymorphicTypeValidator.java | 10 +- .../DefaultBaseTypeLimitingValidator.java | 2 +- .../jackson/databind/jsontype/NamedType.java | 4 +- .../jsontype/PolymorphicTypeValidator.java | 8 +- .../databind/jsontype/SubtypeResolver.java | 26 +- .../databind/jsontype/TypeDeserializer.java | 9 +- .../databind/jsontype/TypeIdResolver.java | 6 +- .../jsontype/TypeResolverBuilder.java | 26 +- .../databind/jsontype/TypeSerializer.java | 6 +- .../impl/AsArrayTypeDeserializer.java | 16 +- .../jsontype/impl/AsArrayTypeSerializer.java | 2 +- .../impl/AsExternalTypeSerializer.java | 4 +- .../impl/AsPropertyTypeDeserializer.java | 8 +- .../impl/AsPropertyTypeSerializer.java | 2 +- .../impl/AsWrapperTypeDeserializer.java | 10 +- .../impl/AsWrapperTypeSerializer.java | 4 +- .../impl/LaissezFaireSubTypeValidator.java | 2 +- .../impl/MinimalClassNameIdResolver.java | 2 +- .../jsontype/impl/StdSubtypeResolver.java | 22 +- .../jsontype/impl/StdTypeResolverBuilder.java | 10 +- .../jsontype/impl/SubTypeValidator.java | 6 +- .../jsontype/impl/TypeDeserializerBase.java | 16 +- .../jsontype/impl/TypeIdResolverBase.java | 2 +- .../jsontype/impl/TypeNameIdResolver.java | 8 +- .../jsontype/impl/TypeSerializerBase.java | 2 +- .../module/SimpleAbstractTypeResolver.java | 6 +- .../databind/module/SimpleDeserializers.java | 12 +- .../module/SimpleKeyDeserializers.java | 2 +- .../jackson/databind/module/SimpleModule.java | 22 +- .../databind/module/SimpleSerializers.java | 26 +- .../module/SimpleValueInstantiators.java | 6 +- .../jackson/databind/node/BaseJsonNode.java | 4 +- .../jackson/databind/node/BigIntegerNode.java | 10 +- .../jackson/databind/node/BooleanNode.java | 4 +- .../jackson/databind/node/ContainerNode.java | 2 +- .../jackson/databind/node/DecimalNode.java | 12 +- .../jackson/databind/node/DoubleNode.java | 6 +- .../jackson/databind/node/FloatNode.java | 8 +- .../jackson/databind/node/IntNode.java | 14 +- .../databind/node/InternalNodeMapper.java | 4 +- .../databind/node/JsonNodeCreator.java | 4 +- .../databind/node/JsonNodeFactory.java | 4 +- .../jackson/databind/node/JsonNodeType.java | 2 +- .../jackson/databind/node/LongNode.java | 8 +- .../jackson/databind/node/MissingNode.java | 16 +- .../jackson/databind/node/NodeCursor.java | 12 +- .../databind/node/NodeSerialization.java | 2 +- .../jackson/databind/node/NullNode.java | 6 +- .../jackson/databind/node/NumericNode.java | 4 +- .../jackson/databind/node/ObjectNode.java | 118 +++---- .../jackson/databind/node/POJONode.java | 14 +- .../jackson/databind/node/ShortNode.java | 8 +- .../jackson/databind/node/TextNode.java | 18 +- .../databind/node/TreeTraversingParser.java | 2 +- .../jackson/databind/node/ValueNode.java | 4 +- .../jackson/databind/package-info.java | 2 +- .../databind/ser/BasicSerializerFactory.java | 52 ++-- .../databind/ser/BeanPropertyFilter.java | 18 +- .../databind/ser/BeanPropertyWriter.java | 20 +- .../jackson/databind/ser/BeanSerializer.java | 6 +- .../databind/ser/BeanSerializerBuilder.java | 22 +- .../databind/ser/BeanSerializerFactory.java | 44 +-- .../databind/ser/BeanSerializerModifier.java | 18 +- .../databind/ser/ContainerSerializer.java | 10 +- .../databind/ser/ContextualSerializer.java | 6 +- .../ser/DefaultSerializerProvider.java | 34 +-- .../jackson/databind/ser/FilterProvider.java | 10 +- .../jackson/databind/ser/PropertyBuilder.java | 8 +- .../jackson/databind/ser/PropertyFilter.java | 20 +- .../jackson/databind/ser/PropertyWriter.java | 12 +- .../jackson/databind/ser/SerializerCache.java | 4 +- .../databind/ser/SerializerFactory.java | 18 +- .../jackson/databind/ser/Serializers.java | 10 +- .../ser/VirtualBeanPropertyWriter.java | 10 +- .../ser/impl/AttributePropertyWriter.java | 8 +- .../ser/impl/BeanAsArraySerializer.java | 8 +- .../databind/ser/impl/FailingSerializer.java | 4 +- .../ser/impl/FilteredBeanPropertyWriter.java | 16 +- .../ser/impl/IndexedListSerializer.java | 8 +- .../ser/impl/IndexedStringListSerializer.java | 4 +- .../databind/ser/impl/IteratorSerializer.java | 6 +- .../databind/ser/impl/MapEntrySerializer.java | 8 +- .../databind/ser/impl/ObjectIdWriter.java | 8 +- .../impl/PropertyBasedObjectIdGenerator.java | 4 +- .../ser/impl/PropertySerializerMap.java | 36 +-- .../impl/ReadOnlyClassToSerializerMap.java | 8 +- .../ser/impl/SimpleBeanPropertyFilter.java | 20 +- .../ser/impl/SimpleFilterProvider.java | 20 +- .../ser/impl/StringArraySerializer.java | 14 +- .../ser/impl/StringCollectionSerializer.java | 8 +- .../impl/UnwrappingBeanPropertyWriter.java | 6 +- .../ser/impl/UnwrappingBeanSerializer.java | 6 +- .../databind/ser/impl/WritableObjectId.java | 2 +- .../databind/ser/impl/package-info.java | 2 +- .../jackson/databind/ser/package-info.java | 2 +- .../databind/ser/std/ArraySerializerBase.java | 4 +- .../ser/std/AsArraySerializerBase.java | 8 +- .../databind/ser/std/BeanSerializerBase.java | 42 +-- .../databind/ser/std/BooleanSerializer.java | 2 +- .../databind/ser/std/ByteArraySerializer.java | 4 +- .../databind/ser/std/ClassSerializer.java | 2 +- .../ser/std/CollectionSerializer.java | 6 +- .../databind/ser/std/DateSerializer.java | 4 +- .../ser/std/DateTimeSerializerBase.java | 4 +- .../databind/ser/std/EnumSerializer.java | 16 +- .../databind/ser/std/EnumSetSerializer.java | 6 +- .../databind/ser/std/FileSerializer.java | 2 +- .../databind/ser/std/IterableSerializer.java | 6 +- .../databind/ser/std/JsonValueSerializer.java | 10 +- .../jackson/databind/ser/std/MapProperty.java | 8 +- .../databind/ser/std/MapSerializer.java | 38 +-- .../ser/std/NonTypedScalarSerializerBase.java | 2 +- .../databind/ser/std/NullSerializer.java | 6 +- .../databind/ser/std/NumberSerializer.java | 8 +- .../ser/std/ObjectArraySerializer.java | 4 +- .../databind/ser/std/RawSerializer.java | 2 +- .../ser/std/ReferenceTypeSerializer.java | 8 +- .../databind/ser/std/SqlDateSerializer.java | 2 +- .../databind/ser/std/SqlTimeSerializer.java | 2 +- .../ser/std/StaticListSerializerBase.java | 2 +- .../databind/ser/std/StdArraySerializers.java | 44 +-- .../ser/std/StdDelegatingSerializer.java | 14 +- .../databind/ser/std/StdJdkSerializers.java | 14 +- .../databind/ser/std/StdKeySerializers.java | 6 +- .../databind/ser/std/StdScalarSerializer.java | 2 +- .../databind/ser/std/StdSerializer.java | 22 +- .../databind/ser/std/ToStringSerializer.java | 2 +- .../ser/std/TokenBufferSerializer.java | 4 +- .../jackson/databind/type/ArrayType.java | 4 +- .../jackson/databind/type/ClassKey.java | 4 +- .../databind/type/CollectionLikeType.java | 14 +- .../jackson/databind/type/CollectionType.java | 2 +- .../jackson/databind/type/MapLikeType.java | 2 +- .../jackson/databind/type/MapType.java | 8 +- .../databind/type/PlaceholderForType.java | 2 +- .../jackson/databind/type/ReferenceType.java | 8 +- .../databind/type/ResolvedRecursiveType.java | 6 +- .../jackson/databind/type/SimpleType.java | 22 +- .../jackson/databind/type/TypeBase.java | 10 +- .../jackson/databind/type/TypeBindings.java | 22 +- .../jackson/databind/type/TypeFactory.java | 58 ++-- .../jackson/databind/type/TypeModifier.java | 4 +- .../jackson/databind/type/TypeParser.java | 6 +- .../jackson/databind/util/ArrayBuilders.java | 8 +- .../jackson/databind/util/ArrayIterator.java | 4 +- .../jackson/databind/util/BeanUtil.java | 12 +- .../util/ByteBufferBackedInputStream.java | 2 +- .../jackson/databind/util/ClassUtil.java | 20 +- .../databind/util/CompactStringObjectMap.java | 6 +- .../jackson/databind/util/Converter.java | 8 +- .../jackson/databind/util/EnumResolver.java | 10 +- .../jackson/databind/util/EnumValues.java | 4 +- .../jackson/databind/util/ISO8601Utils.java | 18 +- .../databind/util/IgnorePropertiesUtil.java | 4 +- .../jackson/databind/util/JSONPObject.java | 8 +- .../databind/util/JSONWrappedObject.java | 8 +- .../jackson/databind/util/LRUMap.java | 2 +- .../jackson/databind/util/LinkedNode.java | 14 +- .../databind/util/NameTransformer.java | 8 +- .../jackson/databind/util/ObjectBuffer.java | 2 +- .../databind/util/PrimitiveArrayBuilder.java | 2 +- .../jackson/databind/util/RawValue.java | 8 +- .../jackson/databind/util/RootNameLookup.java | 2 +- .../util/SimpleBeanPropertyDefinition.java | 6 +- .../jackson/databind/util/StdConverter.java | 4 +- .../jackson/databind/util/StdDateFormat.java | 26 +- .../jackson/databind/util/TokenBuffer.java | 86 +++--- .../databind/util/TokenBufferReadContext.java | 2 +- .../jackson/databind/util/TypeKey.java | 10 +- .../jackson/databind/util/ViewMatcher.java | 6 +- 351 files changed, 2415 insertions(+), 2416 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java b/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java index 44f31ab159..8f92a35d1b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java +++ b/src/main/java/com/fasterxml/jackson/databind/AbstractTypeResolver.java @@ -57,7 +57,7 @@ public JavaType resolveAbstractType(DeserializationConfig config, * * @param config Configuration in use * @param typeDesc Description of the POJO type to resolve - * + * * @return Resolved concrete type (which should retain generic * type parameters of input type, if any), if resolution succeeds; * null if resolver does not know how to resolve given type diff --git a/src/main/java/com/fasterxml/jackson/databind/AnnotationIntrospector.java b/src/main/java/com/fasterxml/jackson/databind/AnnotationIntrospector.java index bed08b655c..0dd972ff1c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/AnnotationIntrospector.java +++ b/src/main/java/com/fasterxml/jackson/databind/AnnotationIntrospector.java @@ -81,7 +81,7 @@ public ReferenceProperty(Type t, String n) { public static ReferenceProperty managed(String name) { return new ReferenceProperty(Type.MANAGED_REFERENCE, name); } public static ReferenceProperty back(String name) { return new ReferenceProperty(Type.BACK_REFERENCE, name); } - + public Type getType() { return _type; } public String getName() { return _name; } @@ -153,7 +153,7 @@ public interface XmlExtensions /* Factory methods /********************************************************************** */ - + /** * Factory method for accessing "no operation" implementation * of introspector: instance that will never find any annotation-based @@ -192,7 +192,7 @@ public static AnnotationIntrospector pair(AnnotationIntrospector a1, AnnotationI public Collection allIntrospectors() { return Collections.singletonList(this); } - + /** * Method that can be used to collect all "real" introspectors that * this introspector contains, if any; or this introspector @@ -212,7 +212,7 @@ public Collection allIntrospectors(Collection allIntrospectors(Collection + *

* NOTE: method signature changed in 2.1, to return {@link PropertyName} * instead of String. * @@ -307,9 +307,9 @@ public PropertyName findRootName(AnnotatedClass ac) { * Method for checking whether properties that have specified type * (class, not generics aware) should be completely ignored for * serialization and deserialization purposes. - * + * * @param ac Annotated class to introspect - * + * * @return Boolean.TRUE if properties of type should be ignored; * Boolean.FALSE if they are not to be ignored, null for default * handling (which is 'do not ignore') @@ -361,7 +361,7 @@ public JsonIncludeProperties.Value findPropertyInclusionByName(MapperConfig c * to return id that is used to locate filter. * * @param ann Annotated entity to introspect - * + * * @return Id of the filter to use for filtering properties of annotated * class, if any; or null if none found. */ @@ -377,7 +377,7 @@ public JsonIncludeProperties.Value findPropertyInclusionByName(MapperConfig c * * @return Sub-class or instance of {@link PropertyNamingStrategy}, if one * is specified for given class; null if not. - * + * * @since 2.1 */ public Object findNamingStrategy(AnnotatedClass ac) { return null; } @@ -390,9 +390,9 @@ public JsonIncludeProperties.Value findPropertyInclusionByName(MapperConfig c * is not defined. * * @param ac Annotated class to introspect - * + * * @return Human-readable description, if any. - * + * * @since 2.7 */ public String findClassDescription(AnnotatedClass ac) { return null; } @@ -462,13 +462,13 @@ public VisibilityChecker findAutoDetectVisibility(AnnotatedClass ac, VisibilityChecker checker) { return checker; } - + /* /********************************************************** /* Annotations for Polymorphic type handling /********************************************************** */ - + /** * Method for checking if given class has annotations that indicate * that specific type resolver is to be used for handling instances. @@ -480,7 +480,7 @@ public VisibilityChecker findAutoDetectVisibility(AnnotatedClass ac, * @param config Configuration settings in effect (for serialization or deserialization) * @param ac Annotated class to check for annotations * @param baseType Base java type of value for which resolver is to be found - * + * * @return Type resolver builder for given type, if one found; null if none */ public TypeResolverBuilder findTypeResolver(MapperConfig config, @@ -495,11 +495,11 @@ public TypeResolverBuilder findTypeResolver(MapperConfig config, * instantiating resolver builder, but also configuring it based on * relevant annotations (not including ones checked with a call to * {@link #findSubtypes} - * + * * @param config Configuration settings in effect (for serialization or deserialization) * @param am Annotated member (field or method) to check for annotations * @param baseType Base java type of property for which resolver is to be found - * + * * @return Type resolver builder for properties of given entity, if one found; * null if none */ @@ -517,14 +517,14 @@ public TypeResolverBuilder findPropertyTypeResolver(MapperConfig config, * instantiating resolver builder, but also configuring it based on * relevant annotations (not including ones checked with a call to * {@link #findSubtypes} - * + * * @param config Configuration settings in effect (for serialization or deserialization) * @param am Annotated member (field or method) to check for annotations * @param containerType Type of property for which resolver is to be found (must be a container type) - * + * * @return Type resolver builder for values contained in properties of given entity, * if one found; null if none - */ + */ public TypeResolverBuilder findPropertyContentTypeResolver(MapperConfig config, AnnotatedMember am, JavaType containerType) { return null; @@ -536,7 +536,7 @@ public TypeResolverBuilder findPropertyContentTypeResolver(MapperConfig co * a list of directly * declared subtypes, no recursive processing is guarantees (i.e. caller * has to do it if/as necessary) - * + * * @param a Annotated entity (class, field/method) to check for annotations * * @return List of subtype definitions found if any; {@code null} if none @@ -556,7 +556,7 @@ public TypeResolverBuilder findPropertyContentTypeResolver(MapperConfig co * Method for checking whether given accessor claims to represent * type id: if so, its value may be used as an override, * instead of generated type id. - * + * * @param am Annotated accessor (field/method/constructor parameter) to check for annotations * * @return Boolean to indicate whether member is a type id or not, if annotation @@ -602,9 +602,9 @@ public TypeResolverBuilder findPropertyContentTypeResolver(MapperConfig co * Type if identifier needs to be compatible with provider of * values (of type {@link InjectableValues}); often a simple String * id is used. - * + * * @param m Member to check - * + * * @return Identifier of value to inject, if any; null if no injection * indicator is found * @@ -638,7 +638,7 @@ public JacksonInject.Value findInjectableValue(AnnotatedMember m) { *

* Since 2.9 this method may also be called to find "default view(s)" for * {@link AnnotatedClass} - * + * * @param a Annotated property (represented by a method, field or ctor parameter) * @return Array of views (represented by classes) that the property is included in; * if null, always included (same as returning array containing Object.class) @@ -650,7 +650,7 @@ public JacksonInject.Value findInjectableValue(AnnotatedMember m) { * Return value is typically used by serializers and/or * deserializers to customize presentation aspects of the * serialized value. - * + * * @since 2.1 */ public JsonFormat.Value findFormat(Annotated memberOrClass) { @@ -662,10 +662,10 @@ public JsonFormat.Value findFormat(Annotated memberOrClass) { * that it should be wrapped in an element; and if so, name to use. * Note that not all serializers and deserializers support use this method: * currently (2.1) it is only used by XML-backed handlers. - * + * * @return Wrapper name to use, if any, or {@link PropertyName#USE_DEFAULT} * to indicate that no wrapper element should be used. - * + * * @since 2.1 */ public PropertyName findWrapperName(Annotated ann) { return null; } @@ -685,9 +685,9 @@ public JsonFormat.Value findFormat(Annotated memberOrClass) { * or mutator) defines human-readable description to use for documentation. * There are no further definitions for contents; for example, whether * these may be marked up using HTML is not defined. - * + * * @return Human-readable description, if any. - * + * * @since 2.3 */ public String findPropertyDescription(Annotated ann) { return null; } @@ -698,9 +698,9 @@ public JsonFormat.Value findFormat(Annotated memberOrClass) { * Possible use cases for index values included use by underlying data format * (some binary formats mandate use of index instead of name) and ordering * of properties (for documentation, or during serialization). - * + * * @since 2.4 - * + * * @return Explicitly specified index for the property, if any */ public Integer findPropertyIndex(Annotated ann) { return null; } @@ -715,14 +715,14 @@ public JsonFormat.Value findFormat(Annotated memberOrClass) { * parameters (which may or may not be available and cannot be detected * by standard databind); or to provide alternate name mangling for * fields, getters and/or setters. - * + * * @since 2.4 */ public String findImplicitPropertyName(AnnotatedMember member) { return null; } /** * Method called to find if given property has alias(es) defined. - * + * * @return `null` if member has no information; otherwise a `List` (possibly * empty) of aliases to use. * @@ -839,7 +839,7 @@ public Object findContentSerializer(Annotated am) { /** * Method for getting a serializer definition for serializer to use * for nulls (null values) of associated property or type. - * + * * @since 2.3 */ public Object findNullSerializer(Annotated am) { @@ -873,10 +873,10 @@ public JsonSerialize.Typing findSerializationTyping(Annotated a) { * Note also that this feature does not necessarily work well with polymorphic * type handling, or object identity handling; if such features are needed * an explicit serializer is usually better way to handle serialization. - * + * * @param a Annotated property (field, method) or class to check for * annotations - * + * * @since 2.2 */ public Object findSerializationConverter(Annotated a) { @@ -896,9 +896,9 @@ public Object findSerializationConverter(Annotated a) { * type is used for actual serialization. *

* Other notes are same as those for {@link #findSerializationConverter} - * + * * @param a Annotated property (field, method) to check. - * + * * @since 2.2 */ public Object findSerializationContentConverter(AnnotatedMember a) { @@ -931,7 +931,7 @@ public JsonInclude.Value findPropertyInclusion(Annotated a) { * * @return Enumerated value indicating which properties to include * in serialization - * + * * @deprecated Since 2.7 Use {@link #findPropertyInclusion} instead */ @Deprecated // since 2.7 @@ -995,7 +995,7 @@ public Class findSerializationKeyType(Annotated am, JavaType baseType) { public Class findSerializationContentType(Annotated am, JavaType baseType) { return null; } - + /* /********************************************************** /* Serialization: class annotations @@ -1022,12 +1022,12 @@ public Boolean findSerializationSortAlphabetically(Annotated ann) { /** * Method for adding possible virtual properties to be serialized along * with regular properties. - * + * * @since 2.5 */ public void findAndAddVirtualProperties(MapperConfig config, AnnotatedClass ac, List properties) { } - + /* /********************************************************** /* Serialization: property annotations @@ -1041,11 +1041,11 @@ public void findAndAddVirtualProperties(MapperConfig config, AnnotatedClass a * Should return null if no annotation * is found; otherwise a non-null name (possibly * {@link PropertyName#USE_DEFAULT}, which means "use default heuristics"). - * + * * @param a Property accessor to check - * + * * @return Name to use if found; null if not. - * + * * @since 2.1 */ public PropertyName findNameForSerialization(Annotated a) { @@ -1079,7 +1079,7 @@ public Boolean hasAsKey(MapperConfig config, Annotated a) { * {@link Boolean#FALSE} if disabled annotation (block) is found (to indicate * accessor is definitely NOT to be used "as value"); or `null` if no * information found. - * + * * @since 2.9 */ public Boolean hasAsValue(Annotated a) { @@ -1099,7 +1099,7 @@ public Boolean hasAsValue(Annotated a) { * properties, often bound with matching "any setter" method. * * @param ann Annotated entity to check - * + * * @return True if such annotation is found (and is not disabled), * false otherwise * @@ -1136,7 +1136,7 @@ public String[] findEnumValues(Class enumType, Enum[] enumValues, String[] /** * Method that is related to {@link #findEnumValues} but is called to check if - * there are alternative names (aliased) that can be accepted for entries, in + * there are alternative names (aliased) that can be accepted for entries, in * addition to primary names introspected earlier. * If so, these aliases should be returned in {@code aliases} {@link List} passed * as argument (and initialized for proper size by caller). @@ -1186,7 +1186,7 @@ public String findEnumValue(Enum value) { /** * @param am Annotated method to check - * + * * @deprecated Since 2.9 Use {@link #hasAsValue(Annotated)} instead. */ @Deprecated // since 2.9 @@ -1196,14 +1196,14 @@ public boolean hasAsValueAnnotation(AnnotatedMethod am) { /** * @param am Annotated method to check - * + * * @deprecated Since 2.9 Use {@link #hasAnyGetter} instead */ @Deprecated public boolean hasAnyGetterAnnotation(AnnotatedMethod am) { return false; } - + /* /********************************************************** /* Deserialization: general annotations @@ -1262,10 +1262,10 @@ public Object findContentDeserializer(Annotated am) { * Note also that this feature does not necessarily work well with polymorphic * type handling, or object identity handling; if such features are needed * an explicit deserializer is usually better way to handle deserialization. - * + * * @param a Annotated property (field, method) or class to check for * annotations - * + * * @since 2.2 */ public Object findDeserializationConverter(Annotated a) { @@ -1285,9 +1285,9 @@ public Object findDeserializationConverter(Annotated a) { * needs to convert this into its target type to be set as property value. *

* Other notes are same as those for {@link #findDeserializationConverter} - * + * * @param a Annotated property (field, method) to check. - * + * * @since 2.2 */ public Object findDeserializationContentConverter(AnnotatedMember a) { @@ -1330,12 +1330,12 @@ public JavaType refineDeserializationType(final MapperConfig config, public Class findDeserializationType(Annotated ann, JavaType baseType) { return null; } - + /** * Method for accessing additional narrowing type definition that a * method can have, to define more specific key type to use. * It should be only be used with {@link java.util.Map} types. - * + * * @param ann Annotated entity to introspect * @param baseKeyType Assumed key type before considering annotations * @@ -1354,7 +1354,7 @@ public Class findDeserializationKeyType(Annotated ann, JavaType baseKeyType) * method can have, to define more specific content type to use; * content refers to Map values and Collection/array elements. * It should be only be used with Map, Collection and array types. - * + * * @param ann Annotated entity to introspect * @param baseContentType Assumed content (value) type before considering annotations * @@ -1403,7 +1403,7 @@ public Object findValueInstantiator(AnnotatedClass ac) { * @param ac Annotated class to introspect * * @return Builder class to use, if annotation found; {@code null} if not. - * + * * @since 2.0 */ public Class findPOJOBuilder(AnnotatedClass ac) { @@ -1434,7 +1434,7 @@ public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) { * Should return null if no annotation * is found; otherwise a non-null name (possibly * {@link PropertyName#USE_DEFAULT}, which means "use default heuristics"). - * + * * @param ann Annotated entity to check * * @return Name to use if found; {@code null} if not. @@ -1444,13 +1444,13 @@ public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) { public PropertyName findNameForDeserialization(Annotated ann) { return null; } - + /** * Method for checking whether given method has an annotation * that suggests that the method is to serve as "any setter"; * method to be used for setting values of any properties for * which no dedicated setter method is found. - * + * * @param ann Annotated entity to check * * @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit @@ -1465,7 +1465,7 @@ public Boolean hasAnySetter(Annotated ann) { /** * Method for finding possible settings for property, given annotations * on an accessor. - * + * * @param ann Annotated entity to check * * @return Setter info value found, if any; @@ -1479,7 +1479,7 @@ public JsonSetter.Value findSetterInfo(Annotated ann) { /** * Method for finding merge settings for property, if any. - * + * * @param ann Annotated entity to check * * @return {@code Boolean.TRUE} or {@code Boolean.FALSE} if explicit @@ -1527,7 +1527,7 @@ public JsonCreator.Mode findCreatorAnnotation(MapperConfig config, Annotated * that suggests that the method is a "creator" (aka factory) * method to be used for construct new instances of deserialized * values. - * + * * @param ann Annotated entity to check * * @return True if such annotation is found (and is not disabled), @@ -1545,11 +1545,11 @@ public boolean hasCreatorAnnotation(Annotated ann) { * a creator (something for which {@link #hasCreatorAnnotation} returns * true), for cases where there may be ambiguity (currently: single-argument * creator with implicit but no explicit name for the argument). - * + * * @param ann Annotated entity to check * * @return Creator mode found, if any; {@code null} if none - * + * * @since 2.5 * @deprecated Since 2.9 use {@link #findCreatorAnnotation} instead. */ @@ -1580,7 +1580,7 @@ public boolean hasAnySetterAnnotation(AnnotatedMethod am) { /** * Method that should be used by sub-classes for ALL * annotation access; - * overridable so + * overridable so * that sub-classes may, if they choose to, mangle actual access to * block access ("hide" annotations) or perhaps change it. *

@@ -1618,7 +1618,7 @@ protected A _findAnnotation(Annotated ann, * @param annoClass Type of annotation to find * * @return {@code true} if specified annotation exists in given entity; {@code false} if not - * + * * @since 2.5 */ protected boolean _hasAnnotation(Annotated ann, Class annoClass) { diff --git a/src/main/java/com/fasterxml/jackson/databind/BeanDescription.java b/src/main/java/com/fasterxml/jackson/databind/BeanDescription.java index cc5ff2e5a5..9170f68049 100644 --- a/src/main/java/com/fasterxml/jackson/databind/BeanDescription.java +++ b/src/main/java/com/fasterxml/jackson/databind/BeanDescription.java @@ -75,7 +75,7 @@ public boolean isNonStaticInnerClass() { * be used for this POJO type, if any. */ public abstract ObjectIdInfo getObjectIdInfo(); - + /** * Method for checking whether class being described has any * annotations recognized by registered annotation introspector. @@ -258,7 +258,7 @@ public AnnotatedMember findJsonKeyAccessor() { @Deprecated // since 2.9 public abstract AnnotatedMethod findJsonValueMethod(); - + /** * @deprecated Since 2.9: use {@link #findAnySetterAccessor} instead */ @@ -304,7 +304,7 @@ public AnnotatedMember findAnySetterField() { * Method for checking what is the expected format for POJO, as * defined by defaults and possible annotations. * Note that this may be further refined by per-property annotations. - * + * * @since 2.1 */ public abstract JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue); @@ -312,7 +312,7 @@ public AnnotatedMember findAnySetterField() { /** * Method for finding {@link Converter} used for serializing instances * of this class. - * + * * @since 2.2 */ public abstract Converter findSerializationConverter(); @@ -320,7 +320,7 @@ public AnnotatedMember findAnySetterField() { /** * Method for finding {@link Converter} used for serializing instances * of this class. - * + * * @since 2.2 */ public abstract Converter findDeserializationConverter(); @@ -358,7 +358,7 @@ public AnnotatedMember findAnySetterField() { * Method called to create a "default instance" of the bean, currently * only needed for obtaining default field values which may be used for * suppressing serialization of fields that have "not changed". - * + * * @param fixAccess If true, method is allowed to fix access to the * default constructor (to be able to call non-public constructor); * if false, has to use constructor as is. diff --git a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java index fe6e5ce61d..58f456b930 100644 --- a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java @@ -49,7 +49,7 @@ public interface BeanProperty extends Named * Method for getting full name definition, including possible * format-specific additional properties (such as namespace when * using XML backend). - * + * * @since 2.3 */ public PropertyName getFullName(); @@ -62,20 +62,20 @@ public interface BeanProperty extends Named /** * If property is indicated to be wrapped, name of * wrapper element to use. - * + * * @since 2.2 */ public PropertyName getWrapperName(); /** * Accessor for additional optional information about property. - * + * * @since 2.3 - * + * * @return Metadata about property; never null. */ public PropertyMetadata getMetadata(); - + /** * Whether value for property is marked as required using * annotations or associated schema. @@ -83,7 +83,7 @@ public interface BeanProperty extends Named * * getMetadata().isRequired() * - * + * * @since 2.2 */ public boolean isRequired(); @@ -91,7 +91,7 @@ public interface BeanProperty extends Named /** * Accessor for checking whether there is an actual physical property * behind this property abstraction or not. - * + * * @since 2.7 */ public boolean isVirtual(); @@ -101,7 +101,7 @@ public interface BeanProperty extends Named /* Access to annotation information /********************************************************** */ - + /** * Method for finding annotation associated with this property; * meaning annotation associated with one of entities used to @@ -141,7 +141,7 @@ public interface BeanProperty extends Named * use {@link #findPropertyFormat} if such defaults would be useful. * * @since 2.6 - * + * * @deprecated since 2.8 use {@link #findPropertyFormat} instead. */ @Deprecated @@ -192,9 +192,9 @@ public interface BeanProperty extends Named * NOTE: Starting with 2.7, takes explicit {@link SerializerProvider} * argument to reduce the need to rely on provider visitor may or may not * have assigned. - * + * * @param objectVisitor Visitor to used as the callback handler - * + * * @since 2.2 (although signature did change in 2.7) */ public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor, @@ -296,7 +296,7 @@ public JsonFormat.Value findPropertyFormat(MapperConfig config, Class base } return v0.withOverrides(v); } - + @Override public JsonInclude.Value findPropertyInclusion(MapperConfig config, Class baseType) { diff --git a/src/main/java/com/fasterxml/jackson/databind/DatabindContext.java b/src/main/java/com/fasterxml/jackson/databind/DatabindContext.java index e0081c02cf..be2fd7d428 100644 --- a/src/main/java/com/fasterxml/jackson/databind/DatabindContext.java +++ b/src/main/java/com/fasterxml/jackson/databind/DatabindContext.java @@ -23,7 +23,7 @@ * process. Designed so that some of implementations can rely on shared * aspects like access to secondary contextual objects like type factories * or handler instantiators. - * + * * @since 2.2 */ public abstract class DatabindContext @@ -126,10 +126,10 @@ public abstract class DatabindContext * Per-call attributes have highest precedence; attributes set * via {@link ObjectReader} or {@link ObjectWriter} have lower * precedence. - * + * * @param key Key of the attribute to get * @return Value of the attribute, if any; null otherwise - * + * * @since 2.3 */ public abstract Object getAttribute(Object key); @@ -138,12 +138,12 @@ public abstract class DatabindContext * Method for setting per-call value of given attribute. * This will override any previously defined value for the * attribute within this context. - * + * * @param key Key of the attribute to set * @param value Value to set attribute to - * + * * @return This context object, to allow chaining - * + * * @since 2.3 */ public abstract DatabindContext setAttribute(Object key, Object value); @@ -355,7 +355,7 @@ public ObjectIdResolver objectIdResolverInstance(Annotated annotated, ObjectIdIn /** * Helper method to use to construct a {@link Converter}, given a definition * that may be either actual converter instance, or Class for instantiating one. - * + * * @since 2.2 */ @SuppressWarnings("unchecked") @@ -453,7 +453,7 @@ protected String _quotedString(String desc) { // !!! should we quote it? (in case there are control chars, linefeeds) return String.format("\"%s\"", _truncate(desc)); } - + /** * @since 2.9 */ diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java index f07324d534..7543e33feb 100644 --- a/src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java +++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationConfig.java @@ -62,7 +62,7 @@ public final class DeserializationConfig /* /********************************************************** - /* Deserialization features + /* Deserialization features /********************************************************** */ @@ -435,7 +435,7 @@ public DeserializationConfig withFeatures(DeserializationFeature... features) _parserFeatures, _parserFeaturesToChange, _formatReadFeatures, _formatReadFeaturesToChange); } - + /** * Fluent factory method that will construct and return a new configuration * object instance with specified feature disabled. @@ -524,7 +524,7 @@ public DeserializationConfig withFeatures(JsonParser.Feature... features) newSet, newMask, _formatReadFeatures, _formatReadFeaturesToChange); } - + /** * Fluent factory method that will construct and return a new configuration * object instance with specified feature disabled. @@ -612,7 +612,7 @@ public DeserializationConfig withFeatures(FormatFeature... features) _parserFeatures, _parserFeaturesToChange, newSet, newMask); } - + /** * Fluent factory method that will construct and return a new configuration * object instance with specified feature disabled. @@ -775,7 +775,7 @@ public DeserializationConfig withNoProblemHandlers() { * Method called by {@link ObjectMapper} and {@link ObjectReader} * to modify those {@link com.fasterxml.jackson.core.JsonParser.Feature} settings * that have been configured via this config instance. - * + * * @since 2.5 */ public JsonParser initialize(JsonParser p) { @@ -842,7 +842,7 @@ public final boolean isEnabled(JsonParser.Feature f, JsonFactory factory) { /** * Bulk access method for checking that all features specified by * mask are enabled. - * + * * @since 2.3 */ public final boolean hasDeserializationFeatures(int featureMask) { @@ -852,7 +852,7 @@ public final boolean hasDeserializationFeatures(int featureMask) { /** * Bulk access method for checking that at least one of features specified by * mask is enabled. - * + * * @since 2.6 */ public final boolean hasSomeOfFeatures(int featureMask) { @@ -974,12 +974,12 @@ public BeanDescription introspectForBuilder(JavaType type) { /* Support for polymorphic type handling /********************************************************** */ - + /** * Helper method that is needed to properly handle polymorphic referenced * types, such as types referenced by {@link java.util.concurrent.atomic.AtomicReference}, * or various "optional" types. - * + * * @since 2.4 */ public TypeDeserializer findTypeDeserializer(JavaType baseType) diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java index 7b263c13c7..3f49122757 100644 --- a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java +++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java @@ -120,13 +120,13 @@ public abstract class DeserializationContext * when content is buffered. */ protected transient JsonParser _parser; - + /** * Object used for resolving references to injectable * values. */ protected final InjectableValues _injectableValues; - + /* /********************************************************** /* Per-operation reusable helper objects (not for blueprints) @@ -141,7 +141,7 @@ public abstract class DeserializationContext /** * Lazily-constructed holder for per-call attributes. - * + * * @since 2.3 */ protected transient ContextAttributes _attributes; @@ -154,7 +154,7 @@ public abstract class DeserializationContext * @since 2.5 */ protected LinkedNode _currentType; - + /* /********************************************************** /* Life-cycle @@ -164,7 +164,7 @@ public abstract class DeserializationContext protected DeserializationContext(DeserializerFactory df) { this(df, null); } - + protected DeserializationContext(DeserializerFactory df, DeserializerCache cache) { @@ -189,7 +189,7 @@ protected DeserializationContext(DeserializationContext src, { _cache = src._cache; _factory = factory; - + _config = src._config; _featureFlags = src._featureFlags; _readCapabilities = src._readCapabilities; @@ -233,7 +233,7 @@ protected DeserializationContext(DeserializationContext src, _cache = src._cache; _factory = src._factory; _readCapabilities = null; - + _config = config; _featureFlags = config.getDeserializationFeatures(); _view = null; @@ -255,7 +255,7 @@ protected DeserializationContext(DeserializationContext src) { _view = src._view; _injectableValues = null; } - + /* /********************************************************** /* DatabindContext implementation @@ -362,7 +362,7 @@ public DeserializationContext setAttribute(Object key, Object value) * do not get passed (or do not retain) type information when being * constructed: happens for example for deserializers constructed * from annotations. - * + * * @since 2.5 * * @return Type of {@link ContextualDeserializer} being contextualized, @@ -384,7 +384,7 @@ public JavaType getContextualType() { public DeserializerFactory getFactory() { return _factory; } - + /** * Convenience method for checking whether specified on/off * feature is enabled @@ -417,11 +417,11 @@ public final boolean isEnabled(StreamReadCapability cap) { public final int getDeserializationFeatures() { return _featureFlags; } - + /** * Bulk access method for checking that all features specified by * mask are enabled. - * + * * @since 2.3 */ public final boolean hasDeserializationFeatures(int featureMask) { @@ -431,13 +431,13 @@ public final boolean hasDeserializationFeatures(int featureMask) { /** * Bulk access method for checking that at least one of features specified by * mask is enabled. - * + * * @since 2.6 */ public final boolean hasSomeOfFeatures(int featureMask) { return (_featureFlags & featureMask) != 0; } - + /** * Method for accessing the currently active parser. * May be different from the outermost parser @@ -609,7 +609,7 @@ public boolean hasValueDeserializerFor(JavaType type, AtomicReference } return false; } - + /** * Method for finding a value deserializer, and creating a contextual * version if necessary, for value reached via specified property. @@ -643,7 +643,7 @@ public final JsonDeserializer findNonContextualValueDeserializer(JavaTyp { return _cache.findValueDeserializer(this, _factory, type); } - + /** * Method for finding a deserializer for root-level value. */ @@ -707,7 +707,7 @@ public final KeyDeserializer findKeyDeserializer(JavaType keyType, /** * Method called to ensure that every object id encounter during processing * are resolved. - * + * * @throws UnresolvedForwardReference */ public abstract void checkUnresolvedObjectId() @@ -718,7 +718,7 @@ public abstract void checkUnresolvedObjectId() /* Public API, type handling /********************************************************** */ - + /** * Convenience method, functionally equivalent to: *
@@ -769,7 +769,7 @@ public final ObjectBuffer leaseObjectBuffer()
     /**
      * Method to call to return object buffer previously leased with
      * {@link #leaseObjectBuffer}.
-     * 
+     *
      * @param buf Returned object buffer
      */
     public final void returnObjectBuffer(ObjectBuffer buf)
@@ -821,9 +821,9 @@ public abstract KeyDeserializer keyDeserializerInstance(Annotated annotated,
      * directly created to deserialize values of a POJO property),
      * to handle details of resolving
      * {@link ContextualDeserializer} with given property context.
-     * 
+     *
      * @param prop Property for which the given primary deserializer is used; never null.
-     * 
+     *
      * @since 2.5
      */
     public JsonDeserializer handlePrimaryContextualization(JsonDeserializer deser,
@@ -851,10 +851,10 @@ public JsonDeserializer handlePrimaryContextualization(JsonDeserializer de
      * Given that these deserializers are not directly related to given property
      * (or, in case of root value property, to any property), annotations
      * accessible may or may not be relevant.
-     * 
+     *
      * @param prop Property for which deserializer is used, if any; null
      *    when deserializing root values
-     * 
+     *
      * @since 2.5
      */
     public JsonDeserializer handleSecondaryContextualization(JsonDeserializer deser,
@@ -923,7 +923,7 @@ public Calendar constructCalendar(Date d) {
      * but a Scalar value (potentially coercible from String value) is expected.
      * This would typically be used to deserializer a Number, Boolean value or some other
      * "simple" unstructured value type.
-     * 
+     *
      * @param p Actual parser to read content from
      * @param deser Deserializer that needs extracted String value
      * @param scalarType Immediate type of scalar to extract; usually type deserializer
@@ -957,7 +957,7 @@ public String extractScalarFromObject(JsonParser p, JsonDeserializer deser,
      * NOTE: when deserializing values of properties contained in composite types,
      * rather use {@link #readPropertyValue(JsonParser, BeanProperty, Class)};
      * this method does not allow use of contextual annotations.
-     * 
+     *
      * @since 2.4
      */
     public  T readValue(JsonParser p, Class type) throws IOException {
@@ -986,7 +986,7 @@ public  T readValue(JsonParser p, JavaType type) throws IOException {
      * @param p Parser that points to the first token of the value to read
      * @param prop Logical property of a POJO being type
      * @return Value of type {@code type} that was read
-     * 
+     *
      * @since 2.4
      */
     public  T readPropertyValue(JsonParser p, BeanProperty prop, Class type) throws IOException {
@@ -1112,7 +1112,7 @@ private TreeTraversingParser _treeAsTokens(JsonNode n) throws IOException
      * property (and once that is not explicitly designed as ignorable), to
      * inform possibly configured {@link DeserializationProblemHandler}s and
      * let it handle the problem.
-     * 
+     *
      * @return True if there was a configured problem handler that was able to handle the
      *   problem
      */
@@ -1155,7 +1155,7 @@ public boolean handleUnknownProperty(JsonParser p, JsonDeserializer deser,
      * @return Key value to use
      *
      * @throws IOException To indicate unrecoverable problem, usually based on msg
-     * 
+     *
      * @since 2.8
      */
     public Object handleWeirdKey(Class keyClass, String keyValue,
@@ -1201,7 +1201,7 @@ public Object handleWeirdKey(Class keyClass, String keyValue,
      * @return Property value to use
      *
      * @throws IOException To indicate unrecoverable problem, usually based on msg
-     * 
+     *
      * @since 2.8
      */
     public Object handleWeirdStringValue(Class targetClass, String value,
@@ -1247,7 +1247,7 @@ public Object handleWeirdStringValue(Class targetClass, String value,
      * @return Property value to use
      *
      * @throws IOException To indicate unrecoverable problem, usually based on msg
-     * 
+     *
      * @since 2.8
      */
     public Object handleWeirdNumberValue(Class targetClass, Number value,
@@ -1417,7 +1417,7 @@ public Object handleInstantiationProblem(Class instClass, Object argument,
      * cannot handle). This could occur, for example, if a Number deserializer
      * encounter {@link JsonToken#START_ARRAY} instead of
      * {@link JsonToken#VALUE_NUMBER_INT} or {@link JsonToken#VALUE_NUMBER_FLOAT}.
-     * 
+     *
      * @param instClass Type that was to be instantiated
      * @param p Parser that points to the JSON value to decode
      *
@@ -1437,7 +1437,7 @@ public Object handleUnexpectedToken(Class instClass, JsonParser p)
      * cannot handle). This could occur, for example, if a Number deserializer
      * encounter {@link JsonToken#START_ARRAY} instead of
      * {@link JsonToken#VALUE_NUMBER_INT} or {@link JsonToken#VALUE_NUMBER_FLOAT}.
-     * 
+     *
      * @param instClass Type that was to be instantiated
      * @param t Token encountered that does match expected
      * @param p Parser that points to the JSON value to decode
@@ -1649,13 +1649,13 @@ protected boolean _isCompatible(Class target, Object value)
      */
 
     /**
-     * Method for deserializers to call 
+     * Method for deserializers to call
      * when the token encountered was of type different than what should
      * be seen at that position, usually within a sequence of expected tokens.
      * Note that this method will throw a {@link JsonMappingException} and no
      * recovery is attempted (via {@link DeserializationProblemHandler}, as
      * problem is considered to be difficult to recover from, in general.
-     * 
+     *
      * @since 2.9
      */
     public void reportWrongTokenException(JsonDeserializer deser,
@@ -1665,15 +1665,15 @@ public void reportWrongTokenException(JsonDeserializer deser,
         msg = _format(msg, msgArgs);
         throw wrongTokenException(getParser(), deser.handledType(), expToken, msg);
     }
-    
+
     /**
-     * Method for deserializers to call 
+     * Method for deserializers to call
      * when the token encountered was of type different than what should
      * be seen at that position, usually within a sequence of expected tokens.
      * Note that this method will throw a {@link JsonMappingException} and no
      * recovery is attempted (via {@link DeserializationProblemHandler}, as
      * problem is considered to be difficult to recover from, in general.
-     * 
+     *
      * @since 2.9
      */
     public void reportWrongTokenException(JavaType targetType,
@@ -1685,13 +1685,13 @@ public void reportWrongTokenException(JavaType targetType,
     }
 
     /**
-     * Method for deserializers to call 
+     * Method for deserializers to call
      * when the token encountered was of type different than what should
      * be seen at that position, usually within a sequence of expected tokens.
      * Note that this method will throw a {@link JsonMappingException} and no
      * recovery is attempted (via {@link DeserializationProblemHandler}, as
      * problem is considered to be difficult to recover from, in general.
-     * 
+     *
      * @since 2.9
      */
     public void reportWrongTokenException(Class targetType,
@@ -1801,7 +1801,7 @@ public  T reportPropertyInputMismatch(JavaType targetType, String propertyNam
             String msg, Object... msgArgs) throws JsonMappingException
     {
         return reportPropertyInputMismatch(targetType.getRawClass(), propertyName, msg, msgArgs);
-    }    
+    }
 
     /**
      * Helper method used to indicate a problem with input in cases where specific
@@ -1836,10 +1836,10 @@ public void reportWrongTokenException(JsonParser p,
         msg = _format(msg, msgArgs);
         throw wrongTokenException(p, expToken, msg);
     }
-    
+
     /**
      * Helper method for reporting a problem with unhandled unknown property.
-     * 
+     *
      * @param instanceOrClass Either value being populated (if one has been
      *   instantiated), or Class that indicates type that would be (or
      *   have been) instantiated
@@ -1877,7 +1877,7 @@ public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappi
     /* is not considered possible: POJO definition problems
     /**********************************************************
      */
-    
+
     /**
      * Helper method called to indicate problem in POJO (serialization) definitions or settings
      * regarding specific Java type, unrelated to actual JSON content to map.
@@ -1958,7 +1958,7 @@ public JsonMappingException wrongTokenException(JsonParser p, Class targetTyp
         msg = _colonConcat(msg, extra);
         return MismatchedInputException.from(p, targetType, msg);
     }
-    
+
     @Deprecated // since 2.9
     public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken,
             String msg)
@@ -1988,11 +1988,11 @@ public JsonMappingException weirdKeyException(Class keyClass, String keyValue
      * Note that most of the time this method should NOT be called; instead,
      * {@link #handleWeirdStringValue} should be called which will call this method
      * if necessary.
-     * 
+     *
      * @param value String value from input being deserialized
      * @param instClass Type that String should be deserialized into
      * @param msgBase Message that describes specific problem
-     * 
+     *
      * @since 2.1
      */
     public JsonMappingException weirdStringException(String value, Class instClass,
@@ -2134,13 +2134,13 @@ public JsonMappingException endOfInputException(Class instClass) {
     /* ones.
     /**********************************************************
      */
-    
+
     /**
      * Fallback method that may be called if no other reportXxx
      * is applicable -- but only in that case.
      *
      * @since 2.8
-     * 
+     *
      * @deprecated Since 2.9: use a more specific method, or {@link #reportBadDefinition(JavaType, String)},
      *    or {@link #reportInputMismatch} instead
      */
@@ -2157,9 +2157,9 @@ public void reportMappingException(String msg, Object... msgArgs)
      * Note that application code should almost always call
      * one of handleXxx methods, or {@link #reportMappingException(String, Object...)}
      * instead.
-     * 
+     *
      * @since 2.6
-     * 
+     *
      * @deprecated Since 2.9 use more specific error reporting methods instead
      */
     @Deprecated
@@ -2173,7 +2173,7 @@ public JsonMappingException mappingException(String message) {
      * Note that application code should almost always call
      * one of handleXxx methods, or {@link #reportMappingException(String, Object...)}
      * instead.
-     * 
+     *
      * @since 2.6
      *
      * @deprecated Since 2.9 use more specific error reporting methods instead
@@ -2185,7 +2185,7 @@ public JsonMappingException mappingException(String msg, Object... msgArgs) {
 
     /**
      * Helper method for constructing generic mapping exception for specified type
-     * 
+     *
      * @deprecated Since 2.8 use {@link #handleUnexpectedToken(Class, JsonParser)} instead
      */
     @Deprecated
diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationFeature.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationFeature.java
index 00a1528479..2a3d82ec33 100644
--- a/src/main/java/com/fasterxml/jackson/databind/DeserializationFeature.java
+++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationFeature.java
@@ -82,11 +82,11 @@ public enum DeserializationFeature implements ConfigFeature
      * Feature is disabled by default, meaning that "untyped" integral
      * numbers will by default be deserialized using {@link java.lang.Integer}
      * if value fits.
-     * 
+     *
      * @since 2.6
      */
     USE_LONG_FOR_INTS(false),
-    
+
     /**
      * Feature that determines whether JSON Array is mapped to
      * Object[] or {@code List} when binding
@@ -153,7 +153,7 @@ public enum DeserializationFeature implements ConfigFeature
      *

* Feature is enabled by default so that exception is thrown for missing or invalid * type information. - * + * * @since 2.2 */ FAIL_ON_INVALID_SUBTYPE(true), @@ -170,7 +170,7 @@ public enum DeserializationFeature implements ConfigFeature * keys. New features may be added to control additional cases. *

* Feature is disabled by default so that no exception is thrown. - * + * * @since 2.3 */ FAIL_ON_READING_DUP_TREE_KEY(false), @@ -197,7 +197,7 @@ public enum DeserializationFeature implements ConfigFeature *

* Feature is enabled by default, so that unknown Object Ids will result in an * exception being thrown, at the end of deserialization. - * + * * @since 2.5 */ FAIL_ON_UNRESOLVED_OBJECT_IDS(true), @@ -218,7 +218,7 @@ public enum DeserializationFeature implements ConfigFeature *

* Feature is disabled by default, so that no exception is thrown for missing creator * property values, unless they are explicitly marked as `required`. - * + * * @since 2.6 */ FAIL_ON_MISSING_CREATOR_PROPERTIES(false), @@ -269,7 +269,7 @@ public enum DeserializationFeature implements ConfigFeature * @since 2.9 */ FAIL_ON_TRAILING_TOKENS(false), - + /** * Feature that determines whether Jackson code should catch * and wrap {@link Exception}s (but never {@link Error}s!) @@ -311,7 +311,7 @@ public enum DeserializationFeature implements ConfigFeature * Feature is disabled by default. */ ACCEPT_SINGLE_VALUE_AS_ARRAY(false), - + /** * Feature that determines whether it is acceptable to coerce single value array (in JSON) * values to the corresponding value type. This is basically the opposite of the {@link #ACCEPT_SINGLE_VALUE_AS_ARRAY} @@ -319,7 +319,7 @@ public enum DeserializationFeature implements ConfigFeature *

* NOTE: only single wrapper Array is allowed: if multiple attempted, exception * will be thrown. - * + * * Feature is disabled by default. * @since 2.4 */ @@ -342,7 +342,7 @@ public enum DeserializationFeature implements ConfigFeature /* Value conversion features /****************************************************** */ - + /** * Feature that can be enabled to allow JSON empty String * value ("") to be bound as `null` for POJOs and other structured @@ -372,7 +372,7 @@ public enum DeserializationFeature implements ConfigFeature * to be equivalent of JSON null. *

* Feature is disabled by default. - * + * * @since 2.5 */ ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT(false), @@ -386,7 +386,7 @@ public enum DeserializationFeature implements ConfigFeature * will be thrown. *

* Feature is enabled by default. - * + * * @since 2.6 */ ACCEPT_FLOAT_AS_INT(true), @@ -405,16 +405,16 @@ public enum DeserializationFeature implements ConfigFeature READ_ENUMS_USING_TO_STRING(false), /** - * Feature that allows unknown Enum values to be parsed as null values. + * Feature that allows unknown Enum values to be parsed as null values. * If disabled, unknown Enum values will throw exceptions. *

* Note that in some cases this will in effect ignore unknown {@code Enum} values, - * e.g. when the unknown values are used as keys of {@link java.util.EnumMap} + * e.g. when the unknown values are used as keys of {@link java.util.EnumMap} * or values of {@link java.util.EnumSet}: this because these data structures cannot * store {@code null} values. *

* Feature is disabled by default. - * + * * @since 2.0 */ READ_UNKNOWN_ENUM_VALUES_AS_NULL(false), @@ -443,7 +443,7 @@ public enum DeserializationFeature implements ConfigFeature * This is the counterpart to {@link SerializationFeature#WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS}. *

* Feature is enabled by default, to support most accurate time values possible. - * + * * @since 2.2 */ READ_DATE_TIMESTAMPS_AS_NANOSECONDS(true), @@ -467,7 +467,7 @@ public enum DeserializationFeature implements ConfigFeature *

* Taking above into account, this feature is supported only by extension modules for * Joda and Java 8 date/time datatypes. - * + * * @since 2.2 */ ADJUST_DATES_TO_CONTEXT_TIME_ZONE(true), @@ -489,16 +489,16 @@ public enum DeserializationFeature implements ConfigFeature * feature: only consider that if there are actual perceived problems. *

* Feature is enabled by default. - * + * * @since 2.1 */ EAGER_DESERIALIZER_FETCH(true) - + ; private final boolean _defaultState; private final int _mask; - + private DeserializationFeature(boolean defaultState) { _defaultState = defaultState; _mask = (1 << ordinal()); diff --git a/src/main/java/com/fasterxml/jackson/databind/InjectableValues.java b/src/main/java/com/fasterxml/jackson/databind/InjectableValues.java index 9f773c3ab8..9d170c3458 100644 --- a/src/main/java/com/fasterxml/jackson/databind/InjectableValues.java +++ b/src/main/java/com/fasterxml/jackson/databind/InjectableValues.java @@ -16,7 +16,7 @@ public abstract class InjectableValues * POJO instance in which value will be injected if it is available * (will be available when injected via field or setter; not available * when injected via constructor or factory method argument). - * + * * @param valueId Object that identifies value to inject; may be a simple * name or more complex identifier object, whatever provider needs * @param ctxt Deserialization context @@ -44,7 +44,7 @@ public static class Std private static final long serialVersionUID = 1L; protected final Map _values; - + public Std() { this(new HashMap()); } @@ -62,7 +62,7 @@ public Std addValue(Class classKey, Object value) { _values.put(classKey.getName(), value); return this; } - + @Override public Object findInjectableValue(Object valueId, DeserializationContext ctxt, BeanProperty forProperty, Object beanInstance) throws JsonMappingException diff --git a/src/main/java/com/fasterxml/jackson/databind/JavaType.java b/src/main/java/com/fasterxml/jackson/databind/JavaType.java index 5c5695d8f9..01407051d7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JavaType.java +++ b/src/main/java/com/fasterxml/jackson/databind/JavaType.java @@ -37,7 +37,7 @@ public abstract class JavaType protected final int _hash; /** - * Optional handler (codec) that can be attached to indicate + * Optional handler (codec) that can be attached to indicate * what to use for handling (serializing, deserializing) values of * this specific type. *

@@ -58,7 +58,7 @@ public abstract class JavaType /** * Whether entities defined with this type should be handled using * static typing (as opposed to dynamic runtime type) or not. - * + * * @since 2.2 */ protected final boolean _asStatic; @@ -74,7 +74,7 @@ public abstract class JavaType * * @param raw "Raw" (type-erased) class for this type * @param additionalHash Additional hash code to use, in addition - * to hash code of the class name + * to hash code of the class name * @param valueHandler internal handler (serializer/deserializer) * to apply for this type * @param typeHandler internal type handler (type serializer/deserializer) @@ -97,7 +97,7 @@ protected JavaType(Class raw, int additionalHash, * * @since 2.7 */ - protected JavaType(JavaType base) + protected JavaType(JavaType base) { _class = base._class; _hash = base._hash; @@ -116,7 +116,7 @@ protected JavaType(JavaType base) * If type does not have a content type (which is the case with * SimpleType), {@link IllegalArgumentException} * will be thrown. - * + * * @return Newly created type instance * * @since 2.7 @@ -131,7 +131,7 @@ protected JavaType(JavaType base) * The main use case is to allow forcing of specific root value serialization type, * and specifically in resolving serializers for contained types (element types * for arrays, Collections and Maps). - * + * * @since 2.2 */ public abstract JavaType withStaticTyping(); @@ -176,7 +176,7 @@ protected JavaType(JavaType base) *

* This mutant factory method will construct a new instance that is identical to * this instance, except that it will have specified value handler assigned. - * + * * @param h Handler to pass to new instance created * @return Newly created type instance with same type information, specified handler */ @@ -235,7 +235,7 @@ public JavaType withHandlersFrom(JavaType src) { */ public abstract JavaType refine(Class rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces); - + /** * Legacy method used for forcing sub-typing of this type into * type specified by specific type erasure. @@ -405,7 +405,7 @@ public final boolean isRecordType() { * this type should use static typing (as opposed to dynamic typing). * Note that while value of 'true' does mean that static typing is to * be used, value of 'false' may still be overridden by other settings. - * + * * @since 2.2 */ public final boolean useStaticType() { return _asStatic; } @@ -433,7 +433,7 @@ public final boolean isRecordType() { @Override public abstract JavaType containedType(int index); - + @Deprecated // since 2.7 @Override public abstract String containedTypeName(int index); @@ -449,7 +449,7 @@ public Class getParameterSource() { /* Extended API beyond ResolvedType /********************************************************************** */ - + // NOTE: not defined in Resolved type /** * Convenience method that is functionally same as: @@ -557,7 +557,7 @@ public JavaType containedTypeOrUnknown(int index) { * * @since 2.7 */ - public Object getContentTypeHandler() { return null; } + public Object getContentTypeHandler() { return null; } /** * @since 2.6 @@ -581,7 +581,7 @@ public boolean hasHandlers() { /* Support for producing signatures /********************************************************************** */ - + //public abstract String toCanonical(); /** @@ -595,18 +595,18 @@ public boolean hasHandlers() { public String getGenericSignature() { StringBuilder sb = new StringBuilder(40); getGenericSignature(sb); - return sb.toString(); + return sb.toString(); } /** - * + * * @param sb StringBuilder to append signature to - * + * * @return StringBuilder that was passed in; returned to allow * call chaining */ public abstract StringBuilder getGenericSignature(StringBuilder sb); - + /** * Method for accessing signature without generic * type information, in form compatible with all versions @@ -624,9 +624,9 @@ public String getErasedSignature() { * type information, in form compatible with all versions * of JVM, and specifically used for type descriptions * when generating byte code. - * + * * @param sb StringBuilder to append signature to - * + * * @return StringBuilder that was passed in; returned to allow * call chaining */ diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java index 75e5164d14..108f999954 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java @@ -52,14 +52,14 @@ public abstract class JsonDeserializer /* Main deserialization methods /********************************************************** */ - + /** * Method that can be called to ask implementation to deserialize * JSON content into the value type this serializer handles. * Returned instance is to be constructed by method itself. *

* Pre-condition for this method is that the parser points to the - * first event that is part of value to deserializer (and which + * first event that is part of value to deserializer (and which * is never JSON 'null' literal, more on this below): for simple * types it may be the only value; and for structured types the * Object start marker or a FIELD_NAME. @@ -141,14 +141,14 @@ public T deserialize(JsonParser p, DeserializationContext ctxt, T intoValue) * should not rely on current default implementation. * Implementation is mostly provided to avoid compilation errors with older * code. - * + * * @param typeDeserializer Deserializer to use for handling type information */ public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException, JacksonException { - // We could try calling + // We could try calling return typeDeserializer.deserializeTypedFromAny(p, ctxt); } @@ -193,7 +193,7 @@ public JsonDeserializer unwrappingDeserializer(NameTransformer unwrapper) { * delegate anything; or it does not want any changes), should either * throw {@link UnsupportedOperationException} (if operation does not * make sense or is not allowed); or return this deserializer as is. - * + * * @since 2.1 */ public JsonDeserializer replaceDelegatee(JsonDeserializer delegatee) { @@ -257,10 +257,10 @@ public JsonDeserializer replaceDelegatee(JsonDeserializer delegatee) { * another deserializer for actual deserialization, by delegating * calls. If so, will return immediate delegate (which itself may * delegate to further deserializers); otherwise will return null. - * + * * @return Deserializer this deserializer delegates calls to, if null; * null otherwise. - * + * * @since 2.1 */ public JsonDeserializer getDelegatee() { @@ -276,7 +276,7 @@ public JsonDeserializer getDelegatee() { * This is only to be used for error reporting and diagnostics * purposes (most commonly, to accompany "unknown property" * exception). - * + * * @since 2.0 */ public Collection getKnownPropertyNames() { @@ -300,7 +300,7 @@ public Collection getKnownPropertyNames() { * {@link #getNullAccessPattern()} returns. *

* Default implementation simply returns null. - * + * * @since 2.6 Added to replace earlier no-arguments variant */ @Override @@ -405,11 +405,11 @@ public AccessPattern getEmptyAccessPattern() { * {@link com.fasterxml.jackson.databind.deser.BeanDeserializer}) * do implement this feature, and may return reader instance, depending on exact * configuration of instance (which is based on type, and referring property). - * + * * @return ObjectIdReader used for resolving possible Object Identifier * value, instead of full value serialization, if deserializer can do that; * null if no Object Id is expected. - * + * * @since 2.0 */ public ObjectIdReader getObjectIdReader() { return null; } @@ -417,7 +417,7 @@ public AccessPattern getEmptyAccessPattern() { /** * Method needed by {@link BeanDeserializerFactory} to properly link * managed- and back-reference pairs. - * + * * @since 2.2 (was moved out of BeanDeserializerBase) */ public SettableBeanProperty findBackReference(String refName) diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java index e71f086322..44f43ace31 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonMappingException.java @@ -330,7 +330,7 @@ public static JsonMappingException from(SerializerProvider ctxt, String msg, Thr private static JsonGenerator _generator(SerializerProvider ctxt) { return (ctxt == null) ? null : ctxt.getGenerator(); } - + /** * Factory method used when "upgrading" an {@link IOException} into * {@link JsonMappingException}: usually only needed to comply with @@ -445,7 +445,7 @@ public StringBuilder getPathReference(StringBuilder sb) _appendPathDesc(sb); return sb; } - + /** * Method called to prepend a reference information in front of * current path @@ -492,7 +492,7 @@ public void prependPath(Reference r) public String getLocalizedMessage() { return _buildMessage(); } - + /** * Method is overridden so that we can properly inject description * of problem path, if such is defined. diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonNode.java b/src/main/java/com/fasterxml/jackson/databind/JsonNode.java index 9cf727ea75..6a80c40cb6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonNode.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonNode.java @@ -64,7 +64,7 @@ public enum OverwriteMode { /** * Mode in which explicit {@code NullNode}s may be replaced but no other - * node types. + * node types. */ NULLS, @@ -86,7 +86,7 @@ public enum OverwriteMode { /* Construction, related /********************************************************** */ - + protected JsonNode() { } /** @@ -100,9 +100,9 @@ protected JsonNode() { } * Note: return type is guaranteed to have same type as the * node method is called on; which is why method is declared * with local generic type. - * + * * @since 2.0 - * + * * @return Node that is either a copy of this node (and all non-leaf * children); or, for immutable leaf nodes, node itself. */ @@ -237,12 +237,12 @@ public Iterator fieldNames() { /** * Method for locating node specified by given JSON pointer instances. - * Method will never return null; if no matching node exists, + * Method will never return null; if no matching node exists, * will return a node for which {@link #isMissingNode()} returns true. - * + * * @return Node that matches given JSON Pointer: if no match exists, * will return a node for which {@link #isMissingNode()} returns true. - * + * * @since 2.3 */ @Override @@ -268,13 +268,13 @@ public final JsonNode at(JsonPointer ptr) * Note that if the same expression is used often, it is preferable to construct * {@link JsonPointer} instance once and reuse it: this method will not perform * any caching of compiled expressions. - * + * * @param jsonPtrExpr Expression to compile as a {@link JsonPointer} * instance - * + * * @return Node that matches given JSON Pointer: if no match exists, * will return a node for which {@link TreeNode#isMissingNode()} returns true. - * + * * @since 2.3 */ @Override @@ -331,7 +331,7 @@ public final boolean isNumber() { } /** - * + * * @return True if this node represents an integral (integer) * numeric JSON value */ @@ -350,7 +350,7 @@ public final boolean isNumber() { * is possible that conversion would be possible from other numeric * types -- to check if this is possible, use * {@link #canConvertToInt()} instead. - * + * * @return True if the value contained by this node is stored as Java short */ public boolean isShort() { return false; } @@ -362,7 +362,7 @@ public final boolean isNumber() { * is possible that conversion would be possible from other numeric * types -- to check if this is possible, use * {@link #canConvertToInt()} instead. - * + * * @return True if the value contained by this node is stored as Java int */ public boolean isInt() { return false; } @@ -374,7 +374,7 @@ public final boolean isNumber() { * is possible that conversion would be possible from other numeric * types -- to check if this is possible, use * {@link #canConvertToLong()} instead. - * + * * @return True if the value contained by this node is stored as Java long */ public boolean isLong() { return false; } @@ -435,7 +435,7 @@ public final boolean isBinary() { * from JSON String into Number; so even if this method returns false, * it is possible that {@link #asInt} could still succeed * if node is a JSON String representing integral number, or boolean. - * + * * @since 2.0 */ public boolean canConvertToInt() { return false; } @@ -451,7 +451,7 @@ public final boolean isBinary() { * from JSON String into Number; so even if this method returns false, * it is possible that {@link #asLong} could still succeed * if node is a JSON String representing integral number, or boolean. - * + * * @since 2.0 */ public boolean canConvertToLong() { return false; } @@ -630,14 +630,14 @@ public byte[] binaryValue() throws IOException { * defaultValue in cases where null value would be returned; * either for missing nodes (trying to access missing property, or element * at invalid item for array) or explicit nulls. - * + * * @since 2.4 */ public String asText(String defaultValue) { String str = asText(); return (str == null) ? defaultValue : str; } - + /** * Method that will try to convert value of this node to a Java int. * Numbers are coerced using default Java rules; booleans convert to 0 (false) @@ -679,7 +679,7 @@ public int asInt(int defaultValue) { public long asLong() { return asLong(0L); } - + /** * Method that will try to convert value of this node to a Java long. * Numbers are coerced using default Java rules; booleans convert to 0 (false) @@ -693,7 +693,7 @@ public long asLong() { public long asLong(long defaultValue) { return defaultValue; } - + /** * Method that will try to convert value of this node to a Java double. * Numbers are coerced using default Java rules; booleans convert to 0.0 (false) @@ -707,7 +707,7 @@ public long asLong(long defaultValue) { public double asDouble() { return asDouble(0.0); } - + /** * Method that will try to convert value of this node to a Java double. * Numbers are coerced using default Java rules; booleans convert to 0.0 (false) @@ -735,7 +735,7 @@ public double asDouble(double defaultValue) { public boolean asBoolean() { return asBoolean(false); } - + /** * Method that will try to convert value of this node to a Java boolean. * JSON booleans map naturally; integer numbers other than 0 map to true, and @@ -919,7 +919,7 @@ public final JsonNode requiredAt(final JsonPointer path) throws IllegalArgumentE * method will return true for such properties. * * @param fieldName Name of element to check - * + * * @return True if this node is a JSON Object node, and has a property * entry with specified name (with any value, including null value) */ @@ -945,7 +945,7 @@ public boolean has(String fieldName) { * null values. * * @param index Index to check - * + * * @return True if this node is a JSON Object node, and has a property * entry with specified name (with any value, including null value) */ @@ -961,7 +961,7 @@ public boolean has(int index) { *

      *   node.get(fieldName) != null && !node.get(fieldName).isNull()
      *
- * + * * @since 2.1 */ public boolean hasNonNull(String fieldName) { @@ -977,7 +977,7 @@ public boolean hasNonNull(String fieldName) { *
      *   node.get(index) != null && !node.get(index).isNull()
      *
- * + * * @since 2.1 */ public boolean hasNonNull(int index) { @@ -1027,9 +1027,9 @@ public Iterator> fields() { * Method for finding a JSON Object field with specified name in this * node or its child nodes, and returning value it has. * If no matching field is found in this node or its descendants, returns null. - * + * * @param fieldName Name of field to look for - * + * * @return Value of first matching node found, if any; null if none */ public abstract JsonNode findValue(String fieldName); @@ -1040,7 +1040,7 @@ public Iterator> fields() { * so possible children of result nodes are not included. * If no matching fields are found in this node or its descendants, returns * an empty List. - * + * * @param fieldName Name of field to look for */ public final List findValues(String fieldName) @@ -1064,28 +1064,28 @@ public final List findValuesAsText(String fieldName) } return result; } - + /** * Method similar to {@link #findValue}, but that will return a * "missing node" instead of null if no field is found. Missing node * is a specific kind of node for which {@link #isMissingNode} * returns true; and all value access methods return empty or * missing value. - * + * * @param fieldName Name of field to look for - * + * * @return Value of first matching node found; or if not found, a * "missing node" (non-null instance that has no value) */ public abstract JsonNode findPath(String fieldName); - + /** * Method for finding a JSON Object that contains specified field, * within this node or its descendants. * If no matching field is found in this node or its descendants, returns null. - * + * * @param fieldName Name of field to look for - * + * * @return Value of first matching node found, if any; null if none */ public abstract JsonNode findParent(String fieldName); @@ -1094,9 +1094,9 @@ public final List findValuesAsText(String fieldName) * Method for finding a JSON Object that contains specified field, * within this node or its descendants. * If no matching field is found in this node or its descendants, returns null. - * + * * @param fieldName Name of field to look for - * + * * @return Value of first matching node found, if any; null if none */ public final List findParents(String fieldName) @@ -1256,7 +1256,7 @@ public ObjectNode withObject(JsonPointer ptr, *

* NOTE: before Jackson 2.14 behavior was always that of non-expression usage; * that is, {@code exprOrProperty} was always considered as a simple property name. - * + * * @deprecated Since 2.14 use {@code withObject(String)} instead */ @Deprecated // since 2.14 @@ -1407,8 +1407,8 @@ public ArrayNode withArray(JsonPointer ptr, * Default implementation simply delegates to passed in comparator, * with this as the first argument, and other as * the second argument. - * - * @param comparator Object called to compare two scalar {@link JsonNode} + * + * @param comparator Object called to compare two scalar {@link JsonNode} * instances, and return either 0 (are equals) or non-zero (not equal) * * @since 2.6 @@ -1416,13 +1416,13 @@ public ArrayNode withArray(JsonPointer ptr, public boolean equals(Comparator comparator, JsonNode other) { return comparator.compare(this, other) == 0; } - + /* /********************************************************** /* Overridden standard methods /********************************************************** */ - + /** * Method that will produce (as of Jackson 2.10) valid JSON using * default settings of databind, as String. @@ -1450,7 +1450,7 @@ public boolean equals(Comparator comparator, JsonNode other) { public String toPrettyString() { return toString(); } - + /** * Equality for node objects is defined as full (deep) value * equality. This means that it is possible to compare complete diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java index 11c01b24a4..b45b48061e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java @@ -37,7 +37,7 @@ *

* In addition, to support per-property annotations (to configure aspects * of serialization on per-property basis), serializers may want - * to implement + * to implement * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer}, * which allows specialization of serializers: call to * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer#createContextual} @@ -69,7 +69,7 @@ public abstract class JsonSerializer *

* Default implementation just returns serializer as-is, * indicating that no unwrapped variant exists - * + * * @param unwrapper Name transformation to use to convert between names * of unwrapper properties */ @@ -83,7 +83,7 @@ public JsonSerializer unwrappingSerializer(NameTransformer unwrapper) { * delegate anything; or it does not want any changes), should either * throw {@link UnsupportedOperationException} (if operation does not * make sense or is not allowed); or return this serializer as is. - * + * * @since 2.1 */ public JsonSerializer replaceDelegatee(JsonSerializer delegatee) { @@ -187,7 +187,7 @@ public void serializeWithType(T value, JsonGenerator gen, SerializerProvider ser * of empty values). *

* Default implementation will consider only null values to be empty. - * + * * @deprecated Since 2.5 Use {@link #isEmpty(SerializerProvider, Object)} instead; * will be removed from 3.0 */ @@ -204,13 +204,13 @@ public boolean isEmpty(T value) { * Default implementation will consider only null values to be empty. *

* NOTE: replaces {@link #isEmpty(Object)}, which was deprecated in 2.5 - * + * * @since 2.5 */ public boolean isEmpty(SerializerProvider provider, T value) { return (value == null); } - + /** * Method that can be called to see whether this serializer instance * will use Object Id to handle cyclic references. @@ -228,16 +228,16 @@ public boolean usesObjectId() { public boolean isUnwrappingSerializer() { return false; } - + /** * Accessor that can be used to determine if this serializer uses * another serializer for actual serialization, by delegating * calls. If so, will return immediate delegate (which itself may * delegate to further serializers); otherwise will return null. - * + * * @return Serializer this serializer delegates calls to, if null; * null otherwise. - * + * * @since 2.1 */ public JsonSerializer getDelegatee() { @@ -266,7 +266,7 @@ public Iterator properties() { /** * Default implementation simply calls {@link JsonFormatVisitorWrapper#expectAnyFormat(JavaType)}. - * + * * @since 2.1 */ @Override diff --git a/src/main/java/com/fasterxml/jackson/databind/MapperFeature.java b/src/main/java/com/fasterxml/jackson/databind/MapperFeature.java index 9128be37b0..c48ff1df26 100644 --- a/src/main/java/com/fasterxml/jackson/databind/MapperFeature.java +++ b/src/main/java/com/fasterxml/jackson/databind/MapperFeature.java @@ -84,7 +84,7 @@ public enum MapperFeature implements ConfigFeature * Feature is enabled by default. */ AUTO_DETECT_CREATORS(true), - + /** * Feature that determines whether non-static fields are recognized as * properties. @@ -99,12 +99,12 @@ public enum MapperFeature implements ConfigFeature * Feature is enabled by default. */ AUTO_DETECT_FIELDS(true), - + /** * Feature that determines whether regular "getter" methods are * automatically detected based on standard Bean naming convention * or not. If yes, then all public zero-argument methods that - * start with prefix "get" + * start with prefix "get" * are considered as getters. * If disabled, only methods explicitly annotated are considered getters. *

@@ -333,7 +333,7 @@ public enum MapperFeature implements ConfigFeature /* View-related features /****************************************************** */ - + /** * Feature that determines whether properties that have no view * annotations are included in JSON serialization views (see @@ -351,7 +351,7 @@ public enum MapperFeature implements ConfigFeature * Feature is enabled by default. */ DEFAULT_VIEW_INCLUSION(true), - + /* /****************************************************** /* Generic output features @@ -411,7 +411,7 @@ public enum MapperFeature implements ConfigFeature * letters. Overhead for names that are already lower-case should be negligible. *

* Feature is disabled by default. - * + * * @since 2.5 */ ACCEPT_CASE_INSENSITIVE_PROPERTIES(false), @@ -440,7 +440,7 @@ public enum MapperFeature implements ConfigFeature * setting instead. *

* Feature is disabled by default. - * + * * @since 2.10 */ ACCEPT_CASE_INSENSITIVE_VALUES(false), @@ -454,7 +454,7 @@ public enum MapperFeature implements ConfigFeature * If disabled, wrapper name is only used for wrapping (if anything). *

* Feature is disabled by default. - * + * * @since 2.1 */ USE_WRAPPER_NAME_AS_PROPERTY_NAME(false), @@ -577,7 +577,7 @@ public enum MapperFeature implements ConfigFeature *

* Feature is disabled by default in 2.x for backwards compatibility reasons: it will become * default setting (and feature likely removed) in 3.0. - * + * * @since 2.11 */ BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES(false), @@ -614,7 +614,7 @@ private MapperFeature(boolean defaultState) { _defaultState = defaultState; _mask = (1L << ordinal()); } - + @Override public boolean enabledByDefault() { return _defaultState; } diff --git a/src/main/java/com/fasterxml/jackson/databind/MappingIterator.java b/src/main/java/com/fasterxml/jackson/databind/MappingIterator.java index 3b55f75c07..d36a8f408a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/MappingIterator.java +++ b/src/main/java/com/fasterxml/jackson/databind/MappingIterator.java @@ -26,12 +26,12 @@ public class MappingIterator implements Iterator, Closeable * State in which iterator is closed */ protected final static int STATE_CLOSED = 0; - + /** * State in which value read failed */ protected final static int STATE_NEED_RESYNC = 1; - + /** * State in which no recovery is needed, but "hasNextValue()" needs * to be called first @@ -77,13 +77,13 @@ public class MappingIterator implements Iterator, Closeable * but caller wants to try to read more elements. */ protected final JsonStreamContext _seqContext; - + /** * If not null, "value to update" instead of creating a new instance * for each call. */ protected final T _updatedValue; - + /** * Flag that indicates whether input {@link JsonParser} should be closed * when we are done or not; generally only called when caller did not @@ -96,7 +96,7 @@ public class MappingIterator implements Iterator, Closeable /* Parsing state /********************************************************** */ - + /** * State of the iterator */ @@ -107,7 +107,7 @@ public class MappingIterator implements Iterator, Closeable /* Construction /********************************************************** */ - + /** * @param managedParser Whether we "own" the {@link JsonParser} passed or not: * if true, it was created by {@link ObjectReader} and code here needs to @@ -190,7 +190,7 @@ public boolean hasNext() return (Boolean) _handleIOException(e); } } - + @SuppressWarnings("unchecked") @Override public T next() @@ -208,7 +208,7 @@ public T next() public void remove() { throw new UnsupportedOperationException(); } - + @Override public void close() throws IOException { if (_state != STATE_CLOSED) { @@ -300,9 +300,9 @@ public T nextValue() throws IOException /** * Convenience method for reading all entries accessible via * this iterator; resulting container will be a {@link java.util.ArrayList}. - * + * * @return List of entries read - * + * * @since 2.2 */ public List readAll() throws IOException { @@ -312,9 +312,9 @@ public List readAll() throws IOException { /** * Convenience method for reading all entries accessible via * this iterator - * + * * @return List of entries read (same as passed-in argument) - * + * * @since 2.2 */ public > L readAll(L resultList) throws IOException @@ -328,7 +328,7 @@ public > L readAll(L resultList) throws IOException /** * Convenience method for reading all entries accessible via * this iterator - * + * * @since 2.5 */ public > C readAll(C results) throws IOException @@ -338,7 +338,7 @@ public > C readAll(C results) throws IOException } return results; } - + /* /********************************************************** /* Extended API, accessors @@ -347,7 +347,7 @@ public > C readAll(C results) throws IOException /** * Accessor for getting underlying parser this iterator uses. - * + * * @since 2.2 */ public JsonParser getParser() { @@ -358,7 +358,7 @@ public JsonParser getParser() { * Accessor for accessing {@link FormatSchema} that the underlying parser * (as per {@link #getParser}) is using, if any; only parser of schema-aware * formats use schemas. - * + * * @since 2.2 */ public FormatSchema getParserSchema() { @@ -370,9 +370,9 @@ public FormatSchema getParserSchema() { * * iterator.getParser().getCurrentLocation() * - * + * * @return Location of the input stream of the underlying parser - * + * * @since 2.2.1 */ public JsonLocation getCurrentLocation() { @@ -411,7 +411,7 @@ protected void _resync() throws IOException protected R _throwNoSuchElement() { throw new NoSuchElementException(); } - + protected R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } diff --git a/src/main/java/com/fasterxml/jackson/databind/MappingJsonFactory.java b/src/main/java/com/fasterxml/jackson/databind/MappingJsonFactory.java index a7939f63e1..5151641831 100644 --- a/src/main/java/com/fasterxml/jackson/databind/MappingJsonFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/MappingJsonFactory.java @@ -55,13 +55,13 @@ public JsonFactory copy() // note: as with base class, must NOT copy mapper reference return new MappingJsonFactory(this, null); } - + /* /********************************************************** /* Format detection functionality (since 1.8) /********************************************************** */ - + /** * Sub-classes need to override this method */ diff --git a/src/main/java/com/fasterxml/jackson/databind/Module.java b/src/main/java/com/fasterxml/jackson/databind/Module.java index 3ae41f0767..12463fdb88 100644 --- a/src/main/java/com/fasterxml/jackson/databind/Module.java +++ b/src/main/java/com/fasterxml/jackson/databind/Module.java @@ -30,7 +30,7 @@ public abstract class Module /* Simple accessors /********************************************************** */ - + /** * Method that returns a display that can be used by Jackson * for informational purposes, as well as in associating extensions with @@ -61,13 +61,13 @@ public abstract class Module public Object getTypeId() { return getClass().getName(); } - + /* /********************************************************** /* Life-cycle: registration /********************************************************** */ - + /** * Method called by {@link ObjectMapper} when module is registered. * It is called to let module register functionality it provides, @@ -107,9 +107,9 @@ public static interface SetupContext /* Simple accessors /********************************************************** */ - + /** - * Method that returns version information about {@link ObjectMapper} + * Method that returns version information about {@link ObjectMapper} * that implements this context. Modules can use this to choose * different settings or initialization order; or even decide to fail * set up completely if version is compatible with module. @@ -132,7 +132,7 @@ public static interface SetupContext * however, instance will always be of that type. * This is why return value is declared generic, to allow caller to * specify context to often avoid casting. - * + * * @since 2.0 */ public C getOwner(); @@ -143,19 +143,19 @@ public static interface SetupContext *

* NOTE: since it is possible that other modules might change or replace * TypeFactory, use of this method adds order-dependency for registrations. - * + * * @since 2.0 */ public TypeFactory getTypeFactory(); - + public boolean isEnabled(MapperFeature f); - + public boolean isEnabled(DeserializationFeature f); public boolean isEnabled(SerializationFeature f); public boolean isEnabled(JsonFactory.Feature f); - + public boolean isEnabled(JsonParser.Feature f); public boolean isEnabled(JsonGenerator.Feature f); @@ -184,17 +184,17 @@ public static interface SetupContext * @since 2.8 */ public MutableConfigOverride configOverride(Class type); - + /* /********************************************************** /* Handler registration; serializers/deserializers /********************************************************** */ - + /** * Method that module can use to register additional deserializers to use for * handling types. - * + * * @param d Object that can be called to find deserializer for types supported * by module (null returned for non-supported types) */ @@ -206,11 +206,11 @@ public static interface SetupContext * they are always serialized from String values) */ public void addKeyDeserializers(KeyDeserializers s); - + /** * Method that module can use to register additional serializers to use for * handling types. - * + * * @param s Object that can be called to find serializer for types supported * by module (null returned for non-supported types) */ @@ -228,11 +228,11 @@ public static interface SetupContext /* Handler registration; other /********************************************************** */ - + /** * Method that module can use to register additional modifier objects to * customize configuration and construction of bean deserializers. - * + * * @param mod Modifier to register */ public void addBeanDeserializerModifier(BeanDeserializerModifier mod); @@ -240,7 +240,7 @@ public static interface SetupContext /** * Method that module can use to register additional modifier objects to * customize configuration and construction of bean serializers. - * + * * @param mod Modifier to register */ public void addBeanSerializerModifier(BeanSerializerModifier mod); @@ -249,7 +249,7 @@ public static interface SetupContext * Method that module can use to register additional * {@link AbstractTypeResolver} instance, to handle resolution of * abstract to concrete types (either by defaulting, or by materializing). - * + * * @param resolver Resolver to add. */ public void addAbstractTypeResolver(AbstractTypeResolver resolver); @@ -258,16 +258,16 @@ public static interface SetupContext * Method that module can use to register additional * {@link TypeModifier} instance, which can augment {@link com.fasterxml.jackson.databind.JavaType} * instances constructed by {@link com.fasterxml.jackson.databind.type.TypeFactory}. - * + * * @param modifier to add */ public void addTypeModifier(TypeModifier modifier); /** * Method that module can use to register additional {@link com.fasterxml.jackson.databind.deser.ValueInstantiator}s, - * by adding {@link ValueInstantiators} object that gets called when + * by adding {@link ValueInstantiators} object that gets called when * instantatiator is needed by a deserializer. - * + * * @param instantiators Object that can provide {@link com.fasterxml.jackson.databind.deser.ValueInstantiator}s for * constructing POJO values during deserialization */ @@ -287,7 +287,7 @@ public static interface SetupContext * Method for registering specified {@link AnnotationIntrospector} as the highest * priority introspector (will be chained with existing introspector(s) which * will be used as fallbacks for cases this introspector does not handle) - * + * * @param ai Annotation introspector to register. */ public void insertAnnotationIntrospector(AnnotationIntrospector ai); @@ -296,7 +296,7 @@ public static interface SetupContext * Method for registering specified {@link AnnotationIntrospector} as the lowest * priority introspector, chained with existing introspector(s) and called * as fallback for cases not otherwise handled. - * + * * @param ai Annotation introspector to register. */ public void appendAnnotationIntrospector(AnnotationIntrospector ai); @@ -320,7 +320,7 @@ public static interface SetupContext * @since 2.9 */ public void registerSubtypes(Collection> subtypes); - + /** * Method used for defining mix-in annotations to use for augmenting * specified class or interface. @@ -351,7 +351,7 @@ public static interface SetupContext /** * Method that may be used to override naming strategy that is used * by {@link ObjectMapper}. - * + * * @since 2.3 */ public void setNamingStrategy(PropertyNamingStrategy naming); diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java index d16d83a39f..d606d028e7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java @@ -68,7 +68,7 @@ // Or if you prefer JSON Tree representation: JsonNode root = mapper.readTree(newState); // and find values by, for example, using a {@link com.fasterxml.jackson.core.JsonPointer} expression: - int age = root.at("/personal/age").getValueAsInt(); + int age = root.at("/personal/age").getValueAsInt(); *

* The main conversion API is defined in {@link ObjectCodec}, so that @@ -77,7 +77,7 @@ * however, usually only for cases where dependency to {@link ObjectMapper} is * either not possible (from Streaming API), or undesireable (when only relying * on Streaming API). - *

+ *

* Mapper instances are fully thread-safe provided that ALL configuration of the * instance occurs before ANY read or write calls. If configuration of a mapper instance * is modified after first usage, changes may or may not take effect, and configuration @@ -114,7 +114,7 @@ *

* Notes on security: use "default typing" feature (see {@link #enableDefaultTyping()}) * is a potential security risk, if used with untrusted content (content generated by - * untrusted external parties). If so, you may want to construct a custom + * untrusted external parties). If so, you may want to construct a custom * {@link TypeResolverBuilder} implementation to limit possible types to instantiate, * (using {@link #setDefaultTyping}). */ @@ -309,7 +309,7 @@ public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection subtypes) { - return useForType(baseType) ? super.buildTypeSerializer(config, baseType, subtypes) : null; + return useForType(baseType) ? super.buildTypeSerializer(config, baseType, subtypes) : null; } /** @@ -454,7 +454,7 @@ public boolean useForType(JavaType t) * same field or method. They can be further masked by sub-classes: * you can think of it as injecting annotations between the target * class and its sub-classes (or interfaces) - * + * * @since 2.6 (earlier was a simple {@link java.util.Map} */ protected SimpleMixInResolver _mixIns; @@ -518,7 +518,7 @@ public boolean useForType(JavaType t) * registered; kept track of iff {@link MapperFeature#IGNORE_DUPLICATE_MODULE_REGISTRATIONS} * is enabled, so that duplicate registration calls can be ignored * (to avoid adding same handlers multiple times, mostly). - * + * * @since 2.5 */ protected Set _registeredModuleTypes; @@ -587,7 +587,7 @@ public ObjectMapper(JsonFactory jf) { /** * Copy-constructor, mostly used to support {@link #copy}. - * + * * @since 2.1 */ protected ObjectMapper(ObjectMapper src) @@ -595,7 +595,7 @@ protected ObjectMapper(ObjectMapper src) this(src, null); } - + /** * Copy-constructor, mostly used to support {@link #copyWith(JsonFactory)}. * @since 2.14 @@ -637,7 +637,7 @@ protected ObjectMapper(ObjectMapper src, JsonFactory factory) * for constructing necessary {@link JsonParser}s and/or * {@link JsonGenerator}s, and uses given providers for accessing * serializers and deserializers. - * + * * @param jf JsonFactory to use: if null, a new {@link MappingJsonFactory} will be constructed * @param sp SerializerProvider to use: if null, a {@link SerializerProvider} will be constructed * @param dc Blueprint deserialization context instance to use for creating @@ -680,7 +680,7 @@ public ObjectMapper(JsonFactory jf, if (needOrder ^ _serializationConfig.isEnabled(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY)) { configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, needOrder); } - + _serializerProvider = (sp == null) ? new DefaultSerializerProvider.Impl() : sp; _deserializationContext = (dc == null) ? new DefaultDeserializationContext.Impl(BeanDeserializerFactory.instance) : dc; @@ -692,7 +692,7 @@ public ObjectMapper(JsonFactory jf, /** * Overridable helper method used to construct default {@link ClassIntrospector} * to use. - * + * * @since 2.5 */ protected ClassIntrospector defaultClassIntrospector() { @@ -704,7 +704,7 @@ protected ClassIntrospector defaultClassIntrospector() { /* Methods sub-classes MUST override /********************************************************** */ - + /** * Method for creating a new {@link ObjectMapper} instance that * has same initial configuration as this instance. Note that this @@ -717,7 +717,7 @@ protected ClassIntrospector defaultClassIntrospector() { * are NOT shared, which means that the new instance may be re-configured * before use; meaning that it behaves the same way as if an instance * was constructed from scratch. - * + * * @since 2.1 */ public ObjectMapper copy() { @@ -757,11 +757,11 @@ protected void _checkInvalidCopy(Class exp) /* ObjectReader/ObjectWriter implementations /********************************************************** */ - + /** * Factory method sub-classes must override, to produce {@link ObjectReader} * instances of proper sub-type - * + * * @since 2.5 */ protected ObjectReader _newReader(DeserializationConfig config) { @@ -771,7 +771,7 @@ protected ObjectReader _newReader(DeserializationConfig config) { /** * Factory method sub-classes must override, to produce {@link ObjectReader} * instances of proper sub-type - * + * * @since 2.5 */ protected ObjectReader _newReader(DeserializationConfig config, @@ -783,7 +783,7 @@ protected ObjectReader _newReader(DeserializationConfig config, /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type - * + * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config) { @@ -793,7 +793,7 @@ protected ObjectWriter _newWriter(SerializationConfig config) { /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type - * + * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config, FormatSchema schema) { @@ -803,7 +803,7 @@ protected ObjectWriter _newWriter(SerializationConfig config, FormatSchema schem /** * Factory method sub-classes must override, to produce {@link ObjectWriter} * instances of proper sub-type - * + * * @since 2.5 */ protected ObjectWriter _newWriter(SerializationConfig config, @@ -836,13 +836,13 @@ public Version version() { * Method for registering a module that can extend functionality * provided by this mapper; for example, by adding providers for * custom serializers and deserializers. - * + * * @param module Module to register */ public ObjectMapper registerModule(Module module) { _assertNotNull("module", module); - // Let's ensure we have access to name and version information, + // Let's ensure we have access to name and version information, // even if we do not have immediate use for either. This way we know // that they will be available from beginning String name = module.getModuleName(); @@ -896,7 +896,7 @@ public C getOwner() { public TypeFactory getTypeFactory() { return _typeFactory; } - + @Override public boolean isEnabled(MapperFeature f) { return ObjectMapper.this.isEnabled(f); @@ -953,9 +953,9 @@ public void addBeanDeserializerModifier(BeanDeserializerModifier modifier) { DeserializerFactory df = _deserializationContext._factory.withDeserializerModifier(modifier); _deserializationContext = _deserializationContext.with(df); } - + // // // Methods for registering handlers: serializers - + @Override public void addSerializers(Serializers s) { _serializerFactory = _serializerFactory.withAdditionalSerializers(s); @@ -965,14 +965,14 @@ public void addSerializers(Serializers s) { public void addKeySerializers(Serializers s) { _serializerFactory = _serializerFactory.withAdditionalKeySerializers(s); } - + @Override public void addBeanSerializerModifier(BeanSerializerModifier modifier) { _serializerFactory = _serializerFactory.withSerializerModifier(modifier); } // // // Methods for registering handlers: other - + @Override public void addAbstractTypeResolver(AbstractTypeResolver resolver) { DeserializerFactory df = _deserializationContext._factory.withAbstractTypeResolver(resolver); @@ -1003,7 +1003,7 @@ public void insertAnnotationIntrospector(AnnotationIntrospector ai) { _deserializationConfig = _deserializationConfig.withInsertedAnnotationIntrospector(ai); _serializationConfig = _serializationConfig.withInsertedAnnotationIntrospector(ai); } - + @Override public void appendAnnotationIntrospector(AnnotationIntrospector ai) { _deserializationConfig = _deserializationConfig.withAppendedAnnotationIntrospector(ai); @@ -1029,7 +1029,7 @@ public void registerSubtypes(Collection> subtypes) { public void setMixInAnnotations(Class target, Class mixinSource) { addMixIn(target, mixinSource); } - + @Override public void addDeserializationProblemHandler(DeserializationProblemHandler handler) { addHandler(handler); @@ -1052,7 +1052,7 @@ public void setNamingStrategy(PropertyNamingStrategy naming) { * registerModule(module); * } * - * + * * @since 2.2 */ public ObjectMapper registerModules(Module... modules) @@ -1071,7 +1071,7 @@ public ObjectMapper registerModules(Module... modules) * registerModule(module); * } * - * + * * @since 2.2 */ public ObjectMapper registerModules(Iterable modules) @@ -1108,7 +1108,7 @@ public Set getRegisteredModuleIds() *

* Note that method does not do any caching, so calls should be considered * potentially expensive. - * + * * @since 2.2 */ public static List findModules() { @@ -1121,7 +1121,7 @@ public static List findModules() { *

* Note that method does not do any caching, so calls should be considered * potentially expensive. - * + * * @since 2.2 */ public static List findModules(ClassLoader classLoader) @@ -1425,7 +1425,7 @@ public SerializationConfig getSerializationConfig() { public DeserializationConfig getDeserializationConfig() { return _deserializationConfig; } - + /** * Method for getting current {@link DeserializationContext}. *

@@ -1442,7 +1442,7 @@ public DeserializationContext getDeserializationContext() { /* Configuration: ser/deser factory, provider access /********************************************************** */ - + /** * Method for setting specific {@link SerializerFactory} to use * for constructing (bean) serializers. @@ -1562,7 +1562,7 @@ public ObjectMapper setMixInResolver(ClassIntrospector.MixInResolver resolver) } return this; } - + public Class findMixInClassFor(Class cls) { return _mixIns.findMixInClassFor(cls); } @@ -1610,7 +1610,7 @@ public VisibilityChecker getVisibilityChecker() { * This default checker is used as the base visibility: * per-class overrides (both via annotations and per-type config overrides) * can further change these settings. - * + * * @since 2.6 */ public ObjectMapper setVisibility(VisibilityChecker vc) { @@ -1634,11 +1634,11 @@ public ObjectMapper setVisibility(VisibilityChecker vc) { * * which would make all member fields serializable without further annotations, * instead of just public fields (default setting). - * + * * @param forMethod Type of property descriptor affected (field, getter/isGetter, * setter, creator) * @param visibility Minimum visibility to require for the property descriptors of type - * + * * @return Modified mapper instance (that is, "this"), to allow chaining * of configuration calls */ @@ -1674,7 +1674,7 @@ public ObjectMapper setSubtypeResolver(SubtypeResolver str) { * may lead to unavailability of core Jackson annotations. * If you want to combine handling of multiple introspectors, * have a look at {@link com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair}. - * + * * @see com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair */ public ObjectMapper setAnnotationIntrospector(AnnotationIntrospector ai) { @@ -1688,14 +1688,14 @@ public ObjectMapper setAnnotationIntrospector(AnnotationIntrospector ai) { * by this mapper instance for serialization and deserialization, * specifying them separately so that different introspection can be * used for different aspects - * + * * @since 2.1 - * + * * @param serializerAI {@link AnnotationIntrospector} to use for configuring * serialization * @param deserializerAI {@link AnnotationIntrospector} to use for configuring * deserialization - * + * * @see com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair */ public ObjectMapper setAnnotationIntrospectors(AnnotationIntrospector serializerAI, @@ -1736,11 +1736,11 @@ public ObjectMapper setAccessorNaming(AccessorNamingStrategy.Provider s) { /** * Method for specifying {@link PrettyPrinter} to use when "default pretty-printing" * is enabled (by enabling {@link SerializationFeature#INDENT_OUTPUT}) - * + * * @param pp Pretty printer to use by default. - * + * * @return This mapper, useful for call-chaining - * + * * @since 2.6 */ public ObjectMapper setDefaultPrettyPrinter(PrettyPrinter pp) { @@ -1787,7 +1787,7 @@ public PolymorphicTypeValidator getPolymorphicTypeValidator() { /* Configuration: global-default/per-type override settings /********************************************************** */ - + /** * Convenience method, equivalent to calling: *

@@ -1990,7 +1990,7 @@ public ObjectMapper activateDefaultTyping(PolymorphicTypeValidator ptv,
         if (includeAs == JsonTypeInfo.As.EXTERNAL_PROPERTY) {
             throw new IllegalArgumentException("Cannot use includeAs of "+includeAs);
         }
-        
+
         TypeResolverBuilder typer = _constructDefaultTypeResolverBuilder(applicability, ptv);
         // we'll always use full class name, when using defaulting
         typer = typer.init(JsonTypeInfo.Id.CLASS, null);
@@ -2067,7 +2067,7 @@ public ObjectMapper setDefaultTyping(TypeResolverBuilder typer) {
     /* Default typing (automatic polymorphic types): deprecated (pre-2.10)
     /**********************************************************
      */
-    
+
     /**
      * @deprecated Since 2.10 use {@link #activateDefaultTyping(PolymorphicTypeValidator)} instead
      */
@@ -2295,7 +2295,7 @@ public ObjectMapper clearProblemHandlers() {
      * by-passing some of checks applied to other configuration methods.
      * Also keep in mind that as with all configuration of {@link ObjectMapper},
      * this is only thread-safe if done before calling any deserialization methods.
-     * 
+     *
      * @since 2.4
      */
     public ObjectMapper setConfig(DeserializationConfig config) {
@@ -2326,7 +2326,7 @@ public void setFilters(FilterProvider filterProvider) {
      * however, sometimes
      * this method is more convenient. For example, some frameworks only allow configuring
      * of ObjectMapper instances and not {@link ObjectWriter}s.
-     * 
+     *
      * @since 2.6
      */
     public ObjectMapper setFilterProvider(FilterProvider filterProvider) {
@@ -2337,11 +2337,11 @@ public ObjectMapper setFilterProvider(FilterProvider filterProvider) {
     /**
      * Method that will configure default {@link Base64Variant} that
      * byte[] serializers and deserializers will use.
-     * 
+     *
      * @param v Base64 variant to use
-     * 
+     *
      * @return This mapper, for convenience to allow chaining
-     * 
+     *
      * @since 2.1
      */
     public ObjectMapper setBase64Variant(Base64Variant v) {
@@ -2361,7 +2361,7 @@ public ObjectMapper setBase64Variant(Base64Variant v) {
      * by-passing some of checks applied to other configuration methods.
      * Also keep in mind that as with all configuration of {@link ObjectMapper},
      * this is only thread-safe if done before calling any serialization methods.
-     * 
+     *
      * @since 2.4
      */
     public ObjectMapper setConfig(SerializationConfig config) {
@@ -2369,7 +2369,7 @@ public ObjectMapper setConfig(SerializationConfig config) {
         _serializationConfig = config;
         return this;
     }
-    
+
     /*
     /**********************************************************
     /* Configuration, other
@@ -2424,7 +2424,7 @@ public DateFormat getDateFormat() {
         // arbitrary choice but let's do:
         return _serializationConfig.getDateFormat();
     }
-    
+
     /**
      * Method for configuring {@link HandlerInstantiator} to use for creating
      * instances of handlers (such as serializers, deserializers, type and type
@@ -2438,7 +2438,7 @@ public Object setHandlerInstantiator(HandlerInstantiator hi)
         _serializationConfig = _serializationConfig.with(hi);
         return this;
     }
-    
+
     /**
      * Method for configuring {@link InjectableValues} which used to find
      * values to inject.
@@ -2577,7 +2577,7 @@ public ObjectMapper enable(SerializationFeature first,
         _serializationConfig = _serializationConfig.with(first, f);
         return this;
     }
-    
+
     /**
      * Method for disabling specified {@link DeserializationConfig} features.
      * Modifies and returns this instance; no new object is created.
@@ -2724,7 +2724,7 @@ public ObjectMapper enable(JsonParser.Feature... features) {
         }
         return this;
     }
-    
+
     /**
      * Method for disabling specified {@link com.fasterxml.jackson.core.JsonParser.Feature}s
      * for parser instances this object mapper creates.
@@ -2743,7 +2743,7 @@ public ObjectMapper disable(JsonParser.Feature... features) {
         }
         return this;
     }
-    
+
     /*
     /**********************************************************
     /* Configuration, simple features: JsonGenerator.Feature
@@ -2813,7 +2813,7 @@ public ObjectMapper disable(JsonGenerator.Feature... features) {
     /* Configuration, simple features: JsonFactory.Feature
     /**********************************************************
      */
-    
+
     /**
      * Convenience method, equivalent to:
      *
@@ -2843,7 +2843,7 @@ public boolean isEnabled(StreamReadFeature f) {
     public boolean isEnabled(StreamWriteFeature f) {
         return isEnabled(f.mappedFeature());
     }
-    
+
     /*
     /**********************************************************
     /* Public API (from ObjectCodec): deserialization
@@ -2860,7 +2860,7 @@ public boolean isEnabled(StreamWriteFeature f) {
      * container ({@link java.util.Collection} or {@link java.util.Map}.
      * The reason is that due to type erasure, key and value types
      * cannot be introspected when using this method.
-     * 
+     *
      * @throws IOException if a low-level I/O problem (unexpected end-of-input,
      *   network error) occurs (passed through as-is without additional wrapping -- note
      *   that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
@@ -2883,9 +2883,9 @@ public  T readValue(JsonParser p, Class valueType)
      * Method to deserialize JSON content into a Java type, reference
      * to which is passed as argument. Type is passed using so-called
      * "super type token" (see )
-     * and specifically needs to be used if the root type is a 
+     * and specifically needs to be used if the root type is a
      * parameterized (generic) container type.
-     * 
+     *
      * @throws IOException if a low-level I/O problem (unexpected end-of-input,
      *   network error) occurs (passed through as-is without additional wrapping -- note
      *   that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
@@ -2906,10 +2906,10 @@ public  T readValue(JsonParser p, TypeReference valueTypeRef)
 
     /**
      * Method to deserialize JSON content into a Java type, reference
-     * to which is passed as argument. Type is passed using 
+     * to which is passed as argument. Type is passed using
      * Jackson specific type; instance of which can be constructed using
      * {@link TypeFactory}.
-     * 
+     *
      * @throws IOException if a low-level I/O problem (unexpected end-of-input,
      *   network error) occurs (passed through as-is without additional wrapping -- note
      *   that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
@@ -2930,7 +2930,7 @@ public final  T readValue(JsonParser p, ResolvedType valueType)
 
     /**
      * Type-safe overloaded method, basically alias for {@link #readValue(JsonParser, Class)}.
-     * 
+     *
      * @throws IOException if a low-level I/O problem (unexpected end-of-input,
      *   network error) occurs (passed through as-is without additional wrapping -- note
      *   that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
@@ -2947,7 +2947,7 @@ public  T readValue(JsonParser p, JavaType valueType)
         _assertNotNull("p", p);
         return (T) _readValue(getDeserializationConfig(), p, valueType);
     }
-    
+
     /**
      * Method to deserialize JSON content as a tree {@link JsonNode}.
      * Returns {@link JsonNode} that represents the root of the resulting tree, if there
@@ -2957,13 +2957,13 @@ public  T readValue(JsonParser p, JavaType valueType)
      * NOTE! Behavior with end-of-input (no more content) differs between this
      * {@code readTree} method, and all other methods that take input source: latter
      * will return "missing node", NOT {@code null}
-     * 
+     *
      * @return a {@link JsonNode}, if valid JSON content found; null
      *   if input has no content to bind -- note, however, that if
      *   JSON null token is found, it will be represented
      *   as a non-null {@link JsonNode} (one that returns true
      *   for {@link JsonNode#isNull()}
-     * 
+     *
      * @throws IOException if a low-level I/O problem (unexpected end-of-input,
      *   network error) occurs (passed through as-is without additional wrapping -- note
      *   that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS}
@@ -3064,7 +3064,7 @@ public  MappingIterator readValues(JsonParser p, TypeReference valueTyp
     {
         return readValues(p, _typeFactory.constructType(valueTypeRef));
     }
-    
+
     /*
     /**********************************************************
     /* Public API not included in ObjectCodec: deserialization
@@ -3085,16 +3085,16 @@ public  MappingIterator readValues(JsonParser p, TypeReference valueTyp
      * {@link StreamReadException} will be thrown.
      * If no content is found from input (end-of-input), Java
      * null will be returned.
-     * 
+     *
      * @param in Input stream used to read JSON content
      *   for building the JSON tree.
-     * 
+     *
      * @return a {@link JsonNode}, if valid JSON content found; null
      *   if input has no content to bind -- note, however, that if
      *   JSON null token is found, it will be represented
      *   as a non-null {@link JsonNode} (one that returns true
      *   for {@link JsonNode#isNull()}
-     *   
+     *
      * @throws StreamReadException if underlying input contains invalid content
      *    of type {@link JsonParser} supports (JSON for default case)
      */
@@ -3229,7 +3229,7 @@ public void writeTree(JsonGenerator g, TreeNode rootNode)
             g.flush();
         }
     }
-    
+
     /**
      * Method to serialize given JSON Tree, using generator
      * provided.
@@ -3244,7 +3244,7 @@ public void writeTree(JsonGenerator g, JsonNode rootNode)
             g.flush();
         }
     }
-    
+
     /**
      *

* Note: return type is co-variant, as basic ObjectCodec @@ -3252,7 +3252,7 @@ public void writeTree(JsonGenerator g, JsonNode rootNode) * part of core package, whereas impls are part of mapper * package) */ - @Override + @Override public ObjectNode createObjectNode() { return _deserializationConfig.getNodeFactory().objectNode(); } @@ -3282,7 +3282,7 @@ public JsonNode nullNode() { /** * Method for constructing a {@link JsonParser} out of JSON tree * representation. - * + * * @param n Root node of the tree that resulting parser will read from */ @Override @@ -3406,7 +3406,7 @@ public T treeToValue(TreeNode n, JavaType valueType) * are not re-constructed through actual format representation. So if transformation * requires actual materialization of encoded content, * it will be necessary to do actual serialization. - * + * * @param Actual node type; usually either basic {@link JsonNode} or * {@link com.fasterxml.jackson.databind.node.ObjectNode} * @param fromValue Java value to convert @@ -3427,7 +3427,7 @@ public T valueToTree(Object fromValue) // first: disable wrapping when writing final SerializationConfig config = getSerializationConfig().without(SerializationFeature.WRAP_ROOT_VALUE); final DefaultSerializerProvider context = _serializerProvider(config); - + // Then create TokenBuffer to use as JsonGenerator TokenBuffer buf = context.bufferForValueConversion(this); if (isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)) { @@ -3472,13 +3472,13 @@ public boolean canSerialize(Class type) { * Method similar to {@link #canSerialize(Class)} but that can return * actual {@link Throwable} that was thrown when trying to construct * serializer: this may be useful in figuring out what the actual problem is. - * + * * @since 2.3 */ public boolean canSerialize(Class type, AtomicReference cause) { return _serializerProvider(getSerializationConfig()).hasSerializerFor(type, cause); } - + /** * Method that can be called to check whether mapper thinks * it could deserialize an Object of given type. @@ -3506,7 +3506,7 @@ public boolean canDeserialize(JavaType type) * Method similar to {@link #canDeserialize(JavaType)} but that can return * actual {@link Throwable} that was thrown when trying to construct * serializer: this may be useful in figuring out what the actual problem is. - * + * * @since 2.3 */ public boolean canDeserialize(JavaType type, AtomicReference cause) @@ -3524,7 +3524,7 @@ public boolean canDeserialize(JavaType type, AtomicReference cause) /** * Method to deserialize JSON content from given file into given Java type. - * + * * @throws IOException if a low-level I/O problem (unexpected end-of-input, * network error) occurs (passed through as-is without additional wrapping -- note * that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS} @@ -3540,11 +3540,11 @@ public T readValue(File src, Class valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueType)); - } + } /** * Method to deserialize JSON content from given file into given Java type. - * + * * @throws IOException if a low-level I/O problem (unexpected end-of-input, * network error) occurs (passed through as-is without additional wrapping -- note * that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS} @@ -3560,11 +3560,11 @@ public T readValue(File src, TypeReference valueTypeRef) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueTypeRef)); - } + } /** * Method to deserialize JSON content from given file into given Java type. - * + * * @throws IOException if a low-level I/O problem (unexpected end-of-input, * network error) occurs (passed through as-is without additional wrapping -- note * that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS} @@ -3590,7 +3590,7 @@ public T readValue(File src, JavaType valueType) * calls {@link java.net.URL#openStream()}, meaning no special handling * is done. If different HTTP connection options are needed you will need * to create {@link java.io.InputStream} separately. - * + * * @throws IOException if a low-level I/O problem (unexpected end-of-input, * network error) occurs (passed through as-is without additional wrapping -- note * that this is one case where {@link DeserializationFeature#WRAP_EXCEPTIONS} @@ -3606,7 +3606,7 @@ public T readValue(URL src, Class valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueType)); - } + } /** * Same as {@link #readValue(java.net.URL, Class)} except that target specified by {@link TypeReference}. @@ -3617,7 +3617,7 @@ public T readValue(URL src, TypeReference valueTypeRef) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueTypeRef)); - } + } /** * Same as {@link #readValue(java.net.URL, Class)} except that target specified by {@link JavaType}. @@ -3643,7 +3643,7 @@ public T readValue(String content, Class valueType) { _assertNotNull("content", content); return readValue(content, _typeFactory.constructType(valueType)); - } + } /** * Method to deserialize JSON content from given JSON content String. @@ -3658,7 +3658,7 @@ public T readValue(String content, TypeReference valueTypeRef) { _assertNotNull("content", content); return readValue(content, _typeFactory.constructType(valueTypeRef)); - } + } /** * Method to deserialize JSON content from given JSON content String. @@ -3680,7 +3680,7 @@ public T readValue(String content, JavaType valueType) } catch (IOException e) { // shouldn't really happen but being declared need to throw JsonMappingException.fromUnexpectedIOE(e); } - } + } @SuppressWarnings("unchecked") public T readValue(Reader src, Class valueType) @@ -3688,7 +3688,7 @@ public T readValue(Reader src, Class valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueType)); - } + } @SuppressWarnings({ "unchecked" }) public T readValue(Reader src, TypeReference valueTypeRef) @@ -3696,7 +3696,7 @@ public T readValue(Reader src, TypeReference valueTypeRef) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueTypeRef)); - } + } @SuppressWarnings("unchecked") public T readValue(Reader src, JavaType valueType) @@ -3704,7 +3704,7 @@ public T readValue(Reader src, JavaType valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), valueType); - } + } @SuppressWarnings("unchecked") public T readValue(InputStream src, Class valueType) @@ -3712,7 +3712,7 @@ public T readValue(InputStream src, Class valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueType)); - } + } @SuppressWarnings({ "unchecked" }) public T readValue(InputStream src, TypeReference valueTypeRef) @@ -3720,7 +3720,7 @@ public T readValue(InputStream src, TypeReference valueTypeRef) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueTypeRef)); - } + } @SuppressWarnings("unchecked") public T readValue(InputStream src, JavaType valueType) @@ -3728,7 +3728,7 @@ public T readValue(InputStream src, JavaType valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), valueType); - } + } @SuppressWarnings("unchecked") public T readValue(byte[] src, Class valueType) @@ -3736,16 +3736,16 @@ public T readValue(byte[] src, Class valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueType)); - } - + } + @SuppressWarnings("unchecked") - public T readValue(byte[] src, int offset, int len, + public T readValue(byte[] src, int offset, int len, Class valueType) throws IOException, StreamReadException, DatabindException { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src, offset, len), _typeFactory.constructType(valueType)); - } + } @SuppressWarnings({ "unchecked" }) public T readValue(byte[] src, TypeReference valueTypeRef) @@ -3753,15 +3753,15 @@ public T readValue(byte[] src, TypeReference valueTypeRef) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), _typeFactory.constructType(valueTypeRef)); - } - + } + @SuppressWarnings({ "unchecked" }) public T readValue(byte[] src, int offset, int len, TypeReference valueTypeRef) throws IOException, StreamReadException, DatabindException { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src, offset, len), _typeFactory.constructType(valueTypeRef)); - } + } @SuppressWarnings("unchecked") public T readValue(byte[] src, JavaType valueType) @@ -3769,7 +3769,7 @@ public T readValue(byte[] src, JavaType valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src), valueType); - } + } @SuppressWarnings("unchecked") public T readValue(byte[] src, int offset, int len, JavaType valueType) @@ -3777,7 +3777,7 @@ public T readValue(byte[] src, int offset, int len, JavaType valueType) { _assertNotNull("src", src); return (T) _readMapAndClose(_jsonFactory.createParser(src, offset, len), valueType); - } + } @SuppressWarnings("unchecked") public T readValue(DataInput src, Class valueType) throws IOException @@ -3933,7 +3933,7 @@ public ObjectWriter writer(SerializationFeature first, SerializationFeature... other) { return _newWriter(getSerializationConfig().with(first, other)); } - + /** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified {@link DateFormat}; or, if @@ -3942,7 +3942,7 @@ public ObjectWriter writer(SerializationFeature first, public ObjectWriter writer(DateFormat df) { return _newWriter(getSerializationConfig().with(df)); } - + /** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified JSON View (filter). @@ -3950,7 +3950,7 @@ public ObjectWriter writer(DateFormat df) { public ObjectWriter writerWithView(Class serializationView) { return _newWriter(getSerializationConfig().withView(serializationView)); } - + /** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified root type, instead of actual @@ -3959,7 +3959,7 @@ public ObjectWriter writerWithView(Class serializationView) { * Main reason for using this method is performance, as writer is able * to pre-fetch serializer to use before write, and if writer is used * more than once this avoids addition per-value serializer lookups. - * + * * @since 2.5 */ public ObjectWriter writerFor(Class rootType) { @@ -3976,7 +3976,7 @@ public ObjectWriter writerFor(Class rootType) { * Main reason for using this method is performance, as writer is able * to pre-fetch serializer to use before write, and if writer is used * more than once this avoids addition per-value serializer lookups. - * + * * @since 2.5 */ public ObjectWriter writerFor(TypeReference rootType) { @@ -3993,7 +3993,7 @@ public ObjectWriter writerFor(TypeReference rootType) { * Main reason for using this method is performance, as writer is able * to pre-fetch serializer to use before write, and if writer is used * more than once this avoids addition per-value serializer lookups. - * + * * @since 2.5 */ public ObjectWriter writerFor(JavaType rootType) { @@ -4011,7 +4011,7 @@ public ObjectWriter writer(PrettyPrinter pp) { } return _newWriter(getSerializationConfig(), /*root type*/ null, pp); } - + /** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using the default pretty printer for indentation @@ -4021,7 +4021,7 @@ public ObjectWriter writerWithDefaultPrettyPrinter() { return _newWriter(config, /*root type*/ null, config.getDefaultPrettyPrinter()); } - + /** * Factory method for constructing {@link ObjectWriter} that will * serialize objects using specified filter provider. @@ -4029,12 +4029,12 @@ public ObjectWriter writerWithDefaultPrettyPrinter() { public ObjectWriter writer(FilterProvider filterProvider) { return _newWriter(getSerializationConfig().withFilters(filterProvider)); } - + /** * Factory method for constructing {@link ObjectWriter} that will * pass specific schema object to {@link JsonGenerator} used for * writing content. - * + * * @param schema Schema to pass to generator */ public ObjectWriter writer(FormatSchema schema) { @@ -4045,7 +4045,7 @@ public ObjectWriter writer(FormatSchema schema) { /** * Factory method for constructing {@link ObjectWriter} that will * use specified Base64 encoding variant for Base64-encoded binary data. - * + * * @since 2.1 */ public ObjectWriter writer(Base64Variant defaultBase64) { @@ -4055,7 +4055,7 @@ public ObjectWriter writer(Base64Variant defaultBase64) { /** * Factory method for constructing {@link ObjectReader} that will * use specified character escaping details for output. - * + * * @since 2.3 */ public ObjectWriter writer(CharacterEscapes escapes) { @@ -4065,7 +4065,7 @@ public ObjectWriter writer(CharacterEscapes escapes) { /** * Factory method for constructing {@link ObjectWriter} that will * use specified default attributes. - * + * * @since 2.3 */ public ObjectWriter writer(ContextAttributes attrs) { @@ -4101,7 +4101,7 @@ public ObjectWriter writerWithType(TypeReference rootType) { public ObjectWriter writerWithType(JavaType rootType) { return _newWriter(getSerializationConfig(), rootType, /*PrettyPrinter*/null); } - + /* /********************************************************** /* Extended Public API: constructing ObjectReaders @@ -4140,7 +4140,7 @@ public ObjectReader reader(DeserializationFeature first, DeserializationFeature... other) { return _newReader(getDeserializationConfig().with(first, other)); } - + /** * Factory method for constructing {@link ObjectReader} that will * update given Object (usually Bean, but can be a Collection or Map @@ -4161,7 +4161,7 @@ public ObjectReader readerForUpdating(Object valueToUpdate) { /** * Factory method for constructing {@link ObjectReader} that will * read or update instances of specified type - * + * * @since 2.6 */ public ObjectReader readerFor(JavaType type) { @@ -4172,7 +4172,7 @@ public ObjectReader readerFor(JavaType type) { /** * Factory method for constructing {@link ObjectReader} that will * read or update instances of specified type - * + * * @since 2.6 */ public ObjectReader readerFor(Class type) { @@ -4184,7 +4184,7 @@ public ObjectReader readerFor(Class type) { /** * Factory method for constructing {@link ObjectReader} that will * read or update instances of specified type - * + * * @since 2.6 */ public ObjectReader readerFor(TypeReference typeRef) { @@ -4257,7 +4257,7 @@ public ObjectReader reader(JsonNodeFactory nodeFactory) { * Factory method for constructing {@link ObjectReader} that will * pass specific schema object to {@link JsonParser} used for * reading content. - * + * * @param schema Schema to pass to parser */ public ObjectReader reader(FormatSchema schema) { @@ -4270,7 +4270,7 @@ public ObjectReader reader(FormatSchema schema) { /** * Factory method for constructing {@link ObjectReader} that will * use specified injectable values. - * + * * @param injectableValues Injectable values to use */ public ObjectReader reader(InjectableValues injectableValues) { @@ -4289,7 +4289,7 @@ public ObjectReader readerWithView(Class view) { /** * Factory method for constructing {@link ObjectReader} that will * use specified Base64 encoding variant for Base64-encoded binary data. - * + * * @since 2.1 */ public ObjectReader reader(Base64Variant defaultBase64) { @@ -4299,7 +4299,7 @@ public ObjectReader reader(Base64Variant defaultBase64) { /** * Factory method for constructing {@link ObjectReader} that will * use specified default attributes. - * + * * @since 2.3 */ public ObjectReader reader(ContextAttributes attrs) { @@ -4368,7 +4368,7 @@ public ObjectReader reader(TypeReference type) { * Finally, this functionality is not designed to support "advanced" use * cases, such as conversion of polymorphic values, or cases where Object Identity * is used. - * + * * @throws IllegalArgumentException If conversion fails due to incompatible type; * if so, root cause will contain underlying checked exception data binding * functionality threw @@ -4378,7 +4378,7 @@ public T convertValue(Object fromValue, Class toValueType) throws IllegalArgumentException { return (T) _convert(fromValue, _typeFactory.constructType(toValueType)); - } + } /** * See {@link #convertValue(Object, Class)} @@ -4388,7 +4388,7 @@ public T convertValue(Object fromValue, TypeReference toValueTypeRef) throws IllegalArgumentException { return (T) _convert(fromValue, _typeFactory.constructType(toValueTypeRef)); - } + } /** * See {@link #convertValue(Object, Class)} @@ -4398,7 +4398,7 @@ public T convertValue(Object fromValue, JavaType toValueType) throws IllegalArgumentException { return (T) _convert(fromValue, toValueType); - } + } /** * Actual conversion implementation: instead of using existing read @@ -4416,7 +4416,7 @@ protected Object _convert(Object fromValue, JavaType toValueType) // first: disable wrapping when writing final SerializationConfig config = getSerializationConfig().without(SerializationFeature.WRAP_ROOT_VALUE); final DefaultSerializerProvider context = _serializerProvider(config); - + // Then create TokenBuffer to use as JsonGenerator TokenBuffer buf = context.bufferForValueConversion(this); if (isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)) { @@ -4452,7 +4452,7 @@ protected Object _convert(Object fromValue, JavaType toValueType) /** * Convenience method similar to {@link #convertValue(Object, JavaType)} but one - * in which + * in which *

* Implementation is approximately as follows: *

    @@ -4476,13 +4476,13 @@ protected Object _convert(Object fromValue, JavaType toValueType) * @param valueToUpdate Object to update * @param overrides Object to conceptually serialize and merge into value to * update; can be thought of as a provider for overrides to apply. - * + * * @return Either the first argument (`valueToUpdate`), if it is mutable; or a result of * creating new instance that is result of "merging" values (for example, "updating" a * Java array will create a new array) * * @throws JsonMappingException if there are structural incompatibilities that prevent update. - * + * * @since 2.9 */ @SuppressWarnings("resource") @@ -4527,7 +4527,7 @@ public T updateValue(T valueToUpdate, Object overrides) * * @param t The class to generate schema for * @return Constructed JSON schema. - * + * * @deprecated Since 2.6 use external JSON Schema generator (https://github.com/FasterXML/jackson-module-jsonSchema) * (which under the hood calls {@link #acceptJsonFormatVisitor(JavaType, JsonFormatVisitorWrapper)}) */ @@ -4545,7 +4545,7 @@ public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(C * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) - * + * * @since 2.1 */ public void acceptJsonFormatVisitor(Class type, JsonFormatVisitorWrapper visitor) @@ -4563,7 +4563,7 @@ public void acceptJsonFormatVisitor(Class type, JsonFormatVisitorWrapper visi * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) - * + * * @since 2.1 */ public void acceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor) @@ -4752,7 +4752,7 @@ protected JsonNode _readTreeAndClose(JsonParser p0) throws IOException DeserializationConfig cfg = getDeserializationConfig(); // 27-Oct-2016, tatu: Need to inline `_initForReading()` due to // special requirements by tree reading (no fail on eof) - + cfg.initialize(p); // since 2.5 JsonToken t = p.currentToken(); if (t == null) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java b/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java index b64a0527ee..b6e14c83bd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectReader.java @@ -77,11 +77,11 @@ public class ObjectReader protected final boolean _unwrapRoot; /** - * Filter to be consider for JsonParser. + * Filter to be consider for JsonParser. * Default value to be null as filter not considered. */ private final TokenFilter _filter; - + /* /********************************************************** /* Configuration that can be changed during building @@ -103,11 +103,11 @@ public class ObjectReader * is known, and if so, reuse it afterwards. * This allows avoiding further deserializer lookups and increases * performance a bit on cases where readers are reused. - * + * * @since 2.1 */ protected final JsonDeserializer _rootDeserializer; - + /** * Instance to update with data binding; if any. If null, * a new instance is created, if non-null, properties of @@ -138,7 +138,7 @@ public class ObjectReader * because format-detection only works on byte-sources. Also, if format * cannot be detect reliably (as per detector settings), * a {@link StreamReadException} will be thrown). - * + * * @since 2.1 */ protected final DataFormatReaders _dataFormatReaders; @@ -159,7 +159,7 @@ public class ObjectReader * Lazily resolved {@link JavaType} for {@link JsonNode} */ protected transient JavaType _jsonNodeType; - + /* /********************************************************** /* Life-cycle, construction @@ -192,10 +192,10 @@ protected ObjectReader(ObjectMapper mapper, DeserializationConfig config, _unwrapRoot = config.useRootWrapping(); _rootDeserializer = _prefetchRootDeserializer(valueType); - _dataFormatReaders = null; + _dataFormatReaders = null; _filter = null; } - + /** * Copy constructor used for building variations. */ @@ -240,7 +240,7 @@ protected ObjectReader(ObjectReader base, DeserializationConfig config) _dataFormatReaders = base._dataFormatReaders; _filter = base._filter; } - + protected ObjectReader(ObjectReader base, JsonFactory f) { // may need to override ordering, based on data format capabilities @@ -260,7 +260,7 @@ protected ObjectReader(ObjectReader base, JsonFactory f) _dataFormatReaders = base._dataFormatReaders; _filter = base._filter; } - + protected ObjectReader(ObjectReader base, TokenFilter filter) { _config = base._config; _context = base._context; @@ -275,7 +275,7 @@ protected ObjectReader(ObjectReader base, TokenFilter filter) { _dataFormatReaders = base._dataFormatReaders; _filter = filter; } - + /** * Method that will return version information stored in and read from jar * that contains this class. @@ -295,7 +295,7 @@ public Version version() { /** * Overridable factory method called by various "withXxx()" methods - * + * * @since 2.5 */ protected ObjectReader _new(ObjectReader base, JsonFactory f) { @@ -304,7 +304,7 @@ protected ObjectReader _new(ObjectReader base, JsonFactory f) { /** * Overridable factory method called by various "withXxx()" methods - * + * * @since 2.5 */ protected ObjectReader _new(ObjectReader base, DeserializationConfig config) { @@ -313,7 +313,7 @@ protected ObjectReader _new(ObjectReader base, DeserializationConfig config) { /** * Overridable factory method called by various "withXxx()" methods - * + * * @since 2.5 */ protected ObjectReader _new(ObjectReader base, DeserializationConfig config, @@ -327,7 +327,7 @@ protected ObjectReader _new(ObjectReader base, DeserializationConfig config, /** * Factory method used to create {@link MappingIterator} instances; * either default, or custom subtype. - * + * * @since 2.5 */ protected MappingIterator _newIterator(JsonParser p, DeserializationContext ctxt, @@ -370,7 +370,7 @@ protected JsonToken _initForReading(DeserializationContext ctxt, JsonParser p) * but need to do other initialization. *

    * Base implementation only sets configured {@link FormatSchema}, if any, on parser. - * + * * @since 2.8 */ protected void _initForMultiRead(DeserializationContext ctxt, JsonParser p) @@ -401,7 +401,7 @@ public ObjectReader with(DeserializationFeature first, DeserializationFeature... other) { return _with(_config.with(first, other)); - } + } /** * Method for constructing a new reader instance that is configured @@ -409,14 +409,14 @@ public ObjectReader with(DeserializationFeature first, */ public ObjectReader withFeatures(DeserializationFeature... features) { return _with(_config.withFeatures(features)); - } + } /** * Method for constructing a new reader instance that is configured * with specified feature disabled. */ public ObjectReader without(DeserializationFeature feature) { - return _with(_config.without(feature)); + return _with(_config.without(feature)); } /** @@ -426,7 +426,7 @@ public ObjectReader without(DeserializationFeature feature) { public ObjectReader without(DeserializationFeature first, DeserializationFeature... other) { return _with(_config.without(first, other)); - } + } /** * Method for constructing a new reader instance that is configured @@ -434,7 +434,7 @@ public ObjectReader without(DeserializationFeature first, */ public ObjectReader withoutFeatures(DeserializationFeature... features) { return _with(_config.withoutFeatures(features)); - } + } /* /********************************************************************** @@ -460,7 +460,7 @@ public ObjectReader with(DatatypeFeature feature) { */ public ObjectReader withFeatures(DatatypeFeature... features) { return _with(_config.withFeatures(features)); - } + } /** * Method for constructing a new reader instance that is configured @@ -469,7 +469,7 @@ public ObjectReader withFeatures(DatatypeFeature... features) { * @since 2.14 */ public ObjectReader without(DatatypeFeature feature) { - return _with(_config.without(feature)); + return _with(_config.without(feature)); } /** @@ -480,7 +480,7 @@ public ObjectReader without(DatatypeFeature feature) { */ public ObjectReader withoutFeatures(DatatypeFeature... features) { return _with(_config.withoutFeatures(features)); - } + } /* /********************************************************** @@ -511,7 +511,7 @@ public ObjectReader with(JsonParser.Feature feature) { */ public ObjectReader withFeatures(JsonParser.Feature... features) { return _with(_config.withFeatures(features)); - } + } /** * Method for constructing a new reader instance that is configured @@ -522,7 +522,7 @@ public ObjectReader withFeatures(JsonParser.Feature... features) { * @return Reader instance with specified feature disabled */ public ObjectReader without(JsonParser.Feature feature) { - return _with(_config.without(feature)); + return _with(_config.without(feature)); } /** @@ -591,7 +591,7 @@ public ObjectReader with(FormatFeature feature) { */ public ObjectReader withFeatures(FormatFeature... features) { return _with(_config.withFeatures(features)); - } + } /** * Method for constructing a new reader instance that is configured @@ -600,7 +600,7 @@ public ObjectReader withFeatures(FormatFeature... features) { * @since 2.7 */ public ObjectReader without(FormatFeature feature) { - return _with(_config.without(feature)); + return _with(_config.without(feature)); } /** @@ -612,7 +612,7 @@ public ObjectReader without(FormatFeature feature) { public ObjectReader withoutFeatures(FormatFeature... features) { return _with(_config.withoutFeatures(features)); } - + /* /********************************************************** /* Life-cycle, fluent factory methods, other @@ -620,8 +620,8 @@ public ObjectReader withoutFeatures(FormatFeature... features) { */ /** - * Convenience method to bind from {@link JsonPointer}. - * {@link JsonPointerBasedFilter} is registered and will be used for parsing later. + * Convenience method to bind from {@link JsonPointer}. + * {@link JsonPointerBasedFilter} is registered and will be used for parsing later. * @since 2.6 */ public ObjectReader at(final String pointerExpr) { @@ -648,7 +648,7 @@ public ObjectReader at(final JsonPointer pointer) { */ public ObjectReader with(DeserializationConfig config) { return _with(config); - } + } /** * Method for constructing a new instance with configuration that uses @@ -687,7 +687,7 @@ public ObjectReader with(JsonNodeFactory f) { * (that is, ones that return false for * {@link JsonFactory#requiresCustomCodec()}) can be used: trying * to use one that requires custom codec will throw exception - * + * * @since 2.1 */ public ObjectReader with(JsonFactory f) { @@ -701,7 +701,7 @@ public ObjectReader with(JsonFactory f) { } return r; } - + /** * Method for constructing a new instance with configuration that * specifies what root name to expect for "root name unwrapping". @@ -721,7 +721,7 @@ public ObjectReader withRootName(String rootName) { public ObjectReader withRootName(PropertyName rootName) { return _with(_config.withRootName(rootName)); } - + /** * Convenience method that is same as calling: * @@ -729,13 +729,13 @@ public ObjectReader withRootName(PropertyName rootName) { * * which will forcibly prevent use of root name wrapping when writing * values with this {@link ObjectReader}. - * + * * @since 2.6 */ public ObjectReader withoutRootName() { return _with(_config.withRootName(PropertyName.NO_NAME)); } - + /** * Method for constructing a new instance with configuration that * passes specified {@link FormatSchema} to {@link JsonParser} that @@ -760,7 +760,7 @@ public ObjectReader with(FormatSchema schema) *

    * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. - * + * * @since 2.5 */ public ObjectReader forType(JavaType valueType) @@ -776,7 +776,7 @@ public ObjectReader forType(JavaType valueType) } return _new(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); - } + } /** * Method for constructing a new reader instance that is configured @@ -789,7 +789,7 @@ public ObjectReader forType(JavaType valueType) */ public ObjectReader forType(Class valueType) { return forType(_config.constructType(valueType)); - } + } /** * Method for constructing a new reader instance that is configured @@ -802,7 +802,7 @@ public ObjectReader forType(Class valueType) { */ public ObjectReader forType(TypeReference valueTypeRef) { return forType(_config.getTypeFactory().constructType(valueTypeRef.getType())); - } + } /** * @deprecated since 2.5 Use {@link #forType(JavaType)} instead @@ -818,7 +818,7 @@ public ObjectReader withType(JavaType valueType) { @Deprecated public ObjectReader withType(Class valueType) { return forType(_config.constructType(valueType)); - } + } /** * @deprecated since 2.5 Use {@link #forType(Class)} instead @@ -834,11 +834,11 @@ public ObjectReader withType(java.lang.reflect.Type valueType) { @Deprecated public ObjectReader withType(TypeReference valueTypeRef) { return forType(_config.getTypeFactory().constructType(valueTypeRef.getType())); - } + } /** * Method for constructing a new instance with configuration that - * updates passed Object (as root value), instead of constructing + * updates passed Object (as root value), instead of constructing * a new value. *

    * Note that the method does NOT change state of this reader, but @@ -854,7 +854,7 @@ public ObjectReader withValueToUpdate(Object value) _schema, _injectableValues, _dataFormatReaders); } JavaType t; - + /* no real benefit from pre-fetching, as updating readers are much * less likely to be reused, and value type may also be forced * with a later chained call... @@ -909,12 +909,12 @@ public ObjectReader with(Base64Variant defaultBase64) { * Note: not all {@link JsonFactory} types can be passed: specifically, ones that * require "custom codec" (like XML factory) will not work. Instead, use * method that takes {@link ObjectReader} instances instead of factories. - * + * * @param readers Data formats accepted, in decreasing order of priority (that is, * matches checked in listed order, first match wins) - * + * * @return Newly configured writer instance - * + * * @since 2.1 */ public ObjectReader withFormatDetection(ObjectReader... readers) { @@ -929,11 +929,11 @@ public ObjectReader withFormatDetection(ObjectReader... readers) { * NOTE: since format detection only works with byte sources, it is possible to * get a failure from some 'readValue()' methods. Also, if input cannot be reliably * (enough) detected as one of specified types, an exception will be thrown. - * + * * @param readers DataFormatReaders to use for detecting underlying format. - * + * * @return Newly configured writer instance - * + * * @since 2.1 */ public ObjectReader withFormatDetection(DataFormatReaders readers) { @@ -974,7 +974,7 @@ public ObjectReader withoutAttribute(Object key) { /* Overridable factory methods may override /********************************************************** */ - + protected ObjectReader _with(DeserializationConfig newConfig) { if (newConfig == _config) { return this; @@ -985,13 +985,13 @@ protected ObjectReader _with(DeserializationConfig newConfig) { } return r; } - + /* /********************************************************** /* Simple accessors /********************************************************** */ - + public boolean isEnabled(DeserializationFeature f) { return _config.isEnabled(f); } @@ -1024,7 +1024,7 @@ public boolean isEnabled(StreamReadFeature f) { public DeserializationConfig getConfig() { return _config; } - + /** * @since 2.1 */ @@ -1463,7 +1463,7 @@ public void writeTree(JsonGenerator g, TreeNode rootNode) { /* Deserialization methods; others similar to what ObjectMapper has /********************************************************** */ - + /** * Method that binds content read from given input source, * using configuration of this reader. @@ -1768,7 +1768,7 @@ public T readValue(DataInput content, Class valueType) throws IOException /* Deserialization methods; JsonNode ("tree") /********************************************************** */ - + /** * Method that reads content from given input source, * using configuration of this reader, and binds it as JSON Tree. @@ -1793,7 +1793,7 @@ public JsonNode readTree(InputStream src) throws IOException } return _bindAndCloseAsTree(_considerFilter(createParser(src), false)); } - + /** * Same as {@link #readTree(InputStream)} except content accessed through * passed-in {@link Reader} @@ -1836,7 +1836,7 @@ public JsonNode readTree(byte[] json) throws IOException } return _bindAndCloseAsTree(_considerFilter(createParser(json), false)); } - + /** * Same as {@link #readTree(InputStream)} except content read from * passed-in byte array. @@ -1866,7 +1866,7 @@ public JsonNode readTree(DataInput src) throws IOException /* Deserialization methods; reading sequence of values /********************************************************** */ - + /** * Method for reading sequence of Objects from parser stream. *

    @@ -1885,7 +1885,7 @@ public MappingIterator readValues(JsonParser p) throws IOException // false -> do not close as caller gave parser instance return _newIterator(p, ctxt, _findRootDeserializer(ctxt), false); } - + /** * Method for reading sequence of Objects from parser stream. *

    @@ -1911,10 +1911,10 @@ public MappingIterator readValues(InputStream src) throws IOException if (_dataFormatReaders != null) { return _detectBindAndReadValues(_dataFormatReaders.findFormat(src), false); } - + return _bindAndReadValues(_considerFilter(createParser(src), true)); } - + /** * Overloaded version of {@link #readValue(InputStream)}. */ @@ -1929,10 +1929,10 @@ public MappingIterator readValues(Reader src) throws IOException p.nextToken(); return _newIterator(p, ctxt, _findRootDeserializer(ctxt), true); } - + /** * Overloaded version of {@link #readValue(InputStream)}. - * + * * @param json String that contains JSON content to parse */ public MappingIterator readValues(String json) throws IOException @@ -1966,7 +1966,7 @@ public final MappingIterator readValues(byte[] src) throws IOException { _assertNotNull("src", src); return readValues(src, 0, src.length); } - + /** * Overloaded version of {@link #readValue(InputStream)}. */ @@ -1987,7 +1987,7 @@ public MappingIterator readValues(File src) throws IOException * calls {@link java.net.URL#openStream()}, meaning no special handling * is done. If different HTTP connection options are needed you will need * to create {@link java.io.InputStream} separately. - * + * * @param src URL to read to access JSON content to parse. */ public MappingIterator readValues(URL src) throws IOException @@ -2125,7 +2125,7 @@ protected final JsonNode _bindAsTree(JsonParser p) throws IOException if (_valueToUpdate != null) { return (JsonNode) _bind(p, _valueToUpdate); } - + // Need to inline `_initForReading()` due to tree reading handling end-of-input specially _config.initialize(p); if (_schema != null) { @@ -2208,7 +2208,7 @@ protected MappingIterator _bindAndReadValues(JsonParser p) throws IOExcep } /** - * Consider filter when creating JsonParser. + * Consider filter when creating JsonParser. */ protected JsonParser _considerFilter(final JsonParser p, boolean multiValue) { // 26-Mar-2016, tatu: Need to allow multiple-matches at least if we have @@ -2259,7 +2259,7 @@ protected Object _detectBindAndClose(DataFormatReaders.Match match, boolean forc _reportUnkownFormat(_dataFormatReaders, match); } JsonParser p = match.createParserWithMatch(); - // One more thing: we Own the input stream now; and while it's + // One more thing: we Own the input stream now; and while it's // not super clean way to do it, we must ensure closure so: if (forceClosing) { p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); @@ -2275,7 +2275,7 @@ protected MappingIterator _detectBindAndReadValues(DataFormatReaders.Matc _reportUnkownFormat(_dataFormatReaders, match); } JsonParser p = match.createParserWithMatch(); - // One more thing: we Own the input stream now; and while it's + // One more thing: we Own the input stream now; and while it's // not super clean way to do it, we must ensure closure so: if (forceClosing) { p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); @@ -2294,7 +2294,7 @@ protected JsonNode _detectBindAndCloseAsTree(InputStream in) throws IOException p.enable(JsonParser.Feature.AUTO_CLOSE_SOURCE); return match.getReader()._bindAndCloseAsTree(p); } - + /** * Method called to indicate that format detection failed to detect format * of given input @@ -2360,7 +2360,7 @@ protected void _reportUndetectableSource(Object src) throws StreamReadException /* Helper methods, locating deserializers etc /********************************************************** */ - + /** * Method called to locate deserializer for the passed root-level value. */ diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java index 744d17f395..506d7ab3ed 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectWriter.java @@ -86,7 +86,7 @@ public class ObjectWriter * @since 2.5 */ protected final Prefetch _prefetch; - + /* /********************************************************** /* Life-cycle, constructors @@ -147,7 +147,7 @@ protected ObjectWriter(ObjectMapper mapper, SerializationConfig config, : new GeneratorSettings(null, s, null, null); _prefetch = Prefetch.empty; } - + /** * Copy constructor used for building variations. */ @@ -213,7 +213,7 @@ public Version version() { /** * Overridable factory method called by various "withXxx()" methods - * + * * @since 2.5 */ protected ObjectWriter _new(ObjectWriter base, JsonFactory f) { @@ -222,7 +222,7 @@ protected ObjectWriter _new(ObjectWriter base, JsonFactory f) { /** * Overridable factory method called by various "withXxx()" methods - * + * * @since 2.5 */ protected ObjectWriter _new(ObjectWriter base, SerializationConfig config) { @@ -236,7 +236,7 @@ protected ObjectWriter _new(ObjectWriter base, SerializationConfig config) { * Overridable factory method called by various "withXxx()" methods. * It assumes `this` as base for settings other than those directly * passed in. - * + * * @since 2.5 */ protected ObjectWriter _new(GeneratorSettings genSettings, Prefetch prefetch) { @@ -249,7 +249,7 @@ protected ObjectWriter _new(GeneratorSettings genSettings, Prefetch prefetch) { /** * Overridable factory method called by {@link #writeValues(OutputStream)} * method (and its various overrides), and initializes it as necessary. - * + * * @since 2.5 */ @SuppressWarnings("resource") @@ -282,7 +282,7 @@ public ObjectWriter with(SerializationFeature feature) { */ public ObjectWriter with(SerializationFeature first, SerializationFeature... other) { return _new(this, _config.with(first, other)); - } + } /** * Method for constructing a new instance that is configured @@ -290,15 +290,15 @@ public ObjectWriter with(SerializationFeature first, SerializationFeature... oth */ public ObjectWriter withFeatures(SerializationFeature... features) { return _new(this, _config.withFeatures(features)); - } - + } + /** * Method for constructing a new instance that is configured * with specified feature disabled. */ public ObjectWriter without(SerializationFeature feature) { return _new(this, _config.without(feature)); - } + } /** * Method for constructing a new instance that is configured @@ -306,7 +306,7 @@ public ObjectWriter without(SerializationFeature feature) { */ public ObjectWriter without(SerializationFeature first, SerializationFeature... other) { return _new(this, _config.without(first, other)); - } + } /** * Method for constructing a new instance that is configured @@ -463,7 +463,7 @@ public ObjectWriter withoutFeatures(FormatFeature... features) { *

    * Note that method does NOT change state of this reader, but * rather construct and returns a newly configured instance. - * + * * @since 2.5 */ public ObjectWriter forType(JavaType rootType) { @@ -474,7 +474,7 @@ public ObjectWriter forType(JavaType rootType) { * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. - * + * * @since 2.5 */ public ObjectWriter forType(Class rootType) { @@ -485,7 +485,7 @@ public ObjectWriter forType(Class rootType) { * Method that will construct a new instance that uses specific type * as the root type for serialization, instead of runtime dynamic * type of the root object itself. - * + * * @since 2.5 */ public ObjectWriter forType(TypeReference rootType) { @@ -521,7 +521,7 @@ public ObjectWriter withType(TypeReference rootType) { /* Life-cycle, fluent factories, other /********************************************************** */ - + /** * Fluent factory method that will construct a new writer instance that will * use specified date format for serializing dates; or if null passed, one @@ -568,7 +568,7 @@ public ObjectWriter with(PrettyPrinter pp) { *

    * Note that method does NOT change state of this reader, but * rather construct and returns a newly configured instance. - * + * * @param rootName Root name to use, if non-empty; `null` for "use defaults", * and empty String ("") for "do NOT add root wrapper" */ @@ -590,13 +590,13 @@ public ObjectWriter withRootName(PropertyName rootName) { * * which will forcibly prevent use of root name wrapping when writing * values with this {@link ObjectWriter}. - * + * * @since 2.6 */ public ObjectWriter withoutRootName() { return _new(this, _config.withRootName(PropertyName.NO_NAME)); } - + /** * Method that will construct a new instance that uses specific format schema * for serialization. @@ -627,7 +627,7 @@ public ObjectWriter withSchema(FormatSchema schema) { */ public ObjectWriter withView(Class view) { return _new(this, _config.withView(view)); - } + } public ObjectWriter with(Locale l) { return _new(this, _config.with(l)); @@ -640,7 +640,7 @@ public ObjectWriter with(TimeZone tz) { /** * Method that will construct a new instance that uses specified default * {@link Base64Variant} for base64 encoding - * + * * @since 2.1 */ public ObjectWriter with(Base64Variant b64variant) { @@ -659,7 +659,7 @@ public ObjectWriter with(CharacterEscapes escapes) { */ public ObjectWriter with(JsonFactory f) { return (f == _generatorFactory) ? this : _new(this, f); - } + } /** * @since 2.3 @@ -1002,7 +1002,7 @@ public SerializationConfig getConfig() { public JsonFactory getFactory() { return _generatorFactory; } - + public TypeFactory getTypeFactory() { return _config.getTypeFactory(); } @@ -1012,7 +1012,7 @@ public TypeFactory getTypeFactory() { * has pre-fetched serializer to use: pre-fetching improves performance * when writer instances are reused as it avoids a per-call serializer * lookup. - * + * * @since 2.2 */ public boolean hasPrefetchedSerializer() { @@ -1025,7 +1025,7 @@ public boolean hasPrefetchedSerializer() { public ContextAttributes getAttributes() { return _config.getAttributes(); } - + /* /********************************************************** /* Serialization methods; ones from ObjectCodec first @@ -1133,7 +1133,7 @@ public void writeValue(DataOutput out, Object value) */ public String writeValueAsString(Object value) throws JsonProcessingException - { + { // alas, we have to pull the recycler directly here... SegmentedStringWriter sw = new SegmentedStringWriter(_generatorFactory._getBufferRecycler()); try { @@ -1186,7 +1186,7 @@ public byte[] writeValueAsBytes(Object value) * instance for specified type. * * @param type Type to generate schema for (possibly with generic signature) - * + * * @since 2.2 */ public void acceptJsonFormatVisitor(JavaType type, JsonFormatVisitorWrapper visitor) @@ -1216,7 +1216,7 @@ public boolean canSerialize(Class type) { /** * Method for checking whether instances of given type can be serialized, * and optionally why (as per {@link Throwable} returned). - * + * * @since 2.3 */ public boolean canSerialize(Class type, AtomicReference cause) { @@ -1301,7 +1301,7 @@ private final void _writeCloseable(JsonGenerator gen, Object value) /** * Helper method called to set or override settings of passed-in * {@link JsonGenerator} - * + * * @since 2.5 */ protected final JsonGenerator _configureGenerator(JsonGenerator gen) @@ -1318,7 +1318,7 @@ protected final void _assertNotNull(String paramName, Object src) { throw new IllegalArgumentException(String.format("argument \"%s\" is null", paramName)); } } - + /* /********************************************************** /* Helper classes for configuration @@ -1329,7 +1329,7 @@ protected final void _assertNotNull(String paramName, Object src) { * Helper class used for containing settings specifically related * to (re)configuring {@link JsonGenerator} constructed for * writing output. - * + * * @since 2.5 */ public final static class GeneratorSettings @@ -1456,7 +1456,7 @@ public void initialize(JsonGenerator gen) * As a minor optimization, we will make an effort to pre-fetch a serializer, * or at least relevant TypeSerializer, if given enough * information. - * + * * @since 2.5 */ public final static class Prefetch @@ -1465,7 +1465,7 @@ public final static class Prefetch private static final long serialVersionUID = 1L; public final static Prefetch empty = new Prefetch(null, null, null); - + /** * Specified root serialization type to use; can be same * as runtime type, but usually one of its super types @@ -1486,7 +1486,7 @@ public final static class Prefetch * serializer, but can pre-fetch {@link TypeSerializer}. */ private final TypeSerializer typeSerializer; - + private Prefetch(JavaType rootT, JsonSerializer ser, TypeSerializer typeSer) { diff --git a/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java b/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java index 9b57186c2f..ede8109138 100644 --- a/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java +++ b/src/main/java/com/fasterxml/jackson/databind/PropertyMetadata.java @@ -8,7 +8,7 @@ * properties. Carved out to reduce number of distinct properties that * actual property implementations and place holders need to store; * since instances are immutable, they can be freely shared. - * + * * @since 2.3 */ public class PropertyMetadata @@ -74,7 +74,7 @@ public static MergeInfo createForPropertyOverride(AnnotatedMember getter) { /** * Optional index of the property within containing Object. - * + * * @since 2.4 */ protected final Integer _index; @@ -94,7 +94,7 @@ public static MergeInfo createForPropertyOverride(AnnotatedMember getter) { * NOTE: transient since it is assumed that this information is only * relevant during initial setup and not needed after full initialization. * May be changed if this proves necessary. - * + * * @since 2.9 */ protected final transient MergeInfo _mergeInfo; @@ -103,7 +103,7 @@ public static MergeInfo createForPropertyOverride(AnnotatedMember getter) { * Settings regarding handling of incoming `null`s, both for value itself * and, for structured types, content values (array/Collection elements, * Map values). - * + * * @since 2.9 */ protected Nulls _valueNulls, _contentNulls; @@ -205,12 +205,12 @@ public PropertyMetadata withDefaultValue(String def) { return new PropertyMetadata(_required, _description, _index, def, _mergeInfo, _valueNulls, _contentNulls); } - + public PropertyMetadata withIndex(Integer index) { return new PropertyMetadata(_required, _description, index, _defaultValue, _mergeInfo, _valueNulls, _contentNulls); } - + public PropertyMetadata withRequired(Boolean b) { if (b == null) { if (_required == null) { diff --git a/src/main/java/com/fasterxml/jackson/databind/PropertyName.java b/src/main/java/com/fasterxml/jackson/databind/PropertyName.java index ac6e5ed718..6473caca30 100644 --- a/src/main/java/com/fasterxml/jackson/databind/PropertyName.java +++ b/src/main/java/com/fasterxml/jackson/databind/PropertyName.java @@ -9,7 +9,7 @@ /** * Simple value class used for containing names of properties as defined * by annotations (and possibly other configuration sources). - * + * * @since 2.1 */ public class PropertyName @@ -34,7 +34,7 @@ public class PropertyName * commonly this value disables behavior for which name would be needed. */ public final static PropertyName NO_NAME = new PropertyName(new String(_NO_NAME), null); - + /** * Basic name of the property. */ @@ -52,11 +52,11 @@ public class PropertyName * NOTE: not defined as volatile to avoid performance problem with * concurrent access in multi-core environments; due to statelessness * of {@link SerializedString} at most leads to multiple instantiations. - * + * * @since 2.4 */ protected SerializableString _encodedSimple; - + public PropertyName(String simpleName) { this(simpleName, null); } @@ -132,7 +132,7 @@ public PropertyName withSimpleName(String simpleName) } return new PropertyName(simpleName, _namespace); } - + /** * Fluent factory method for constructing an instance with different * namespace. @@ -147,13 +147,13 @@ public PropertyName withNamespace(String ns) { } return new PropertyName(_simpleName, ns); } - + /* /********************************************************** /* Accessors /********************************************************** */ - + public String getSimpleName() { return _simpleName; } @@ -161,7 +161,7 @@ public String getSimpleName() { /** * Accessor that may be used to get lazily-constructed efficient * representation of the simple name. - * + * * @since 2.4 */ public SerializableString simpleAsEncoded(MapperConfig config) { @@ -176,7 +176,7 @@ public SerializableString simpleAsEncoded(MapperConfig config) { } return sstr; } - + public String getNamespace() { return _namespace; } @@ -192,7 +192,7 @@ public boolean hasSimpleName(String str) { // _simpleName never null so... return _simpleName.equals(str); } - + public boolean hasNamespace() { return _namespace != null; } @@ -202,7 +202,7 @@ public boolean hasNamespace() { *
          *   !hasSimpleName() << !hasNamespace();
          *
    - * + * * @since 2.4 */ public boolean isEmpty() { @@ -239,7 +239,7 @@ public boolean equals(Object o) } return _namespace.equals(other._namespace); } - + @Override public int hashCode() { if (_namespace == null) { @@ -247,7 +247,7 @@ public int hashCode() { } return _namespace.hashCode() ^ _simpleName.hashCode(); } - + @Override public String toString() { if (_namespace == null) { diff --git a/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategies.java b/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategies.java index dd523ef93e..5e8048dfe8 100644 --- a/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategies.java +++ b/src/main/java/com/fasterxml/jackson/databind/PropertyNamingStrategies.java @@ -24,7 +24,7 @@ public abstract class PropertyNamingStrategies /* Static instances that may be referenced /********************************************************************** */ - + /** * Naming convention used in Java, where words other than first are capitalized * and no separator is used between words. Since this is the native Java naming convention, @@ -137,13 +137,13 @@ protected String translateLowerCaseWithSeparator(final String input, final char if (length == 0) { return input; } - + final StringBuilder result = new StringBuilder(length + (length >> 1)); int upperCount = 0; for (int i = 0; i < length; ++i) { char ch = input.charAt(i); char lc = Character.toLowerCase(ch); - + if (lc == ch) { // lower-case letter means we can get new word // but need to check for multi-letter upper-case (acronym), where assumption // is that the last upper-case char is start of a new word @@ -170,7 +170,7 @@ protected String translateLowerCaseWithSeparator(final String input, final char /* Standard implementations /********************************************************************** */ - + /** * A {@link PropertyNamingStrategy} that translates typical camel case Java * property names to lower case JSON element names, separated by @@ -178,7 +178,7 @@ protected String translateLowerCaseWithSeparator(final String input, final char * provides some additional translations beyond strictly translating from * camel case only. In particular, the following translations are applied * by this PropertyNamingStrategy. - * + * *