-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Jackson Release 2.10
Version 2.10 is under development, as of late-October 2018. It will potentially be the last 2.x minor release.
No changes to minimum JDK baselines for use, but 2.10 will include JDK 9+ compliant module-info.class which should improve forward-compatibility.
JDK 8 will be required to build all components, however, as module info inclusion plug-in requires it (note: publishing to Maven Central also requires JDK 8)
With 2.10.0.pr1 we have released following problem reports
I just tried to run my tests. When my application server tried to start, I got errors:
Suppressed: java.lang.RuntimeException: Error scanning entry module-info.class from jar file:/home/ruwen/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.10.0.pr1/jackson-core-2.10.0.pr1.jar
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:913)
at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:831)
at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:548)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:973)
at org.eclipse.jetty.annotations.AnnotationParser.parseJarEntry(AnnotationParser.java:956)
at org.eclipse.jetty.annotations.AnnotationParser.parseJar(AnnotationParser.java:909)
... 6 more
11:05 xxx@yyy:~$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-2~deb9u1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
The blame was on an older version of Jetty. Since this was used only in test, the version was quite old. But other people might get similar problems with byte-code manipulating libraries.
First official version of the jackson-datatype-eclipse-collections (for Eclipse Collections was introduced in 2.10 (preview version included since 2.9.5)
Much of additional functionality mirrors changes that 3.0 developments are making, in form that will get some of the benefits, and should ease migration to 3.0.
Due to numerous CVEs for one specific kind of Polymorphic Deserialization (see this blog post for details), block-list approach has proven insufficient to prevent issues.
As a result, #2195 -- add abstraction PolymorphicTypeValidator, for limiting allowed polymorphic subtypes -- was added.
Although full moved to immutable factories, mappers, by (only) using builder-style construction will only be included in 3.0, 2.10 does introduce builder-pattern itself (but does not force strict immutability beyond what 2.x API supports). The main benefits of this addition are:
- Easier migration to 3.0 since change to builder-based construction can be made in 2.10 already
- More convenient configurability; ability to expose format-specific configuration beyond simple on/off features
Example of builder style:
// TO BE WRITTENAnother change geared towards 3.0 compatibility is the creation of 4 new format feature types, to replace 2 existing features (JsonParser.Feature, JsonGenerator.Feature):
-
StreamReadFeature: format-agnostic (general) features for stream readers (parsers) -
StreamWriteFeature: format-agnostic (general) features for stream writers (generators) -
JsonReadFeature: JSON-specific stream reader (parser) features -
JsonWriteFeature: JSON-specific stream writer (generator) features
For 2.10 these features will act as aliases to matching JsonParser.Features and JsonGenerator.Features: in 3.0 they will be the only stream-level features (JsonParser.Features, JsonGenerator.Feature being removed)
Example of using new configuration features:
// TO BE WRITTENAll standard components will include module-info.class, generated using Moditect Maven plug-in.
Resulting jars will therefore have proper module information for Java 9 and beyond but still be usable on JDK 7 (or, in case of jackson-core and jackson-annotations, JDK 6)
- #151: Add basic Java 9+ module info
- #433: Add Builder pattern for creating configured Stream factories
-
#464: Add "maximum unescaped char" configuration option for
JsonFactoryvia builder -
#467: Create
JsonReadFeatureto move JSON-specificJsonParser.Features to -
#480:
SerializableStringvalue can not directly render to Writer -
#481: Create
JsonWriteFeatureto move JSON-specificJsonGenerator.Features to -
#484: Implement
UTF8JsonGenerator.writeRawValue(SerializableString)(andwriteRaw(..)) more efficiently -
#495: Create
StreamReadFeatureto move non-json specificJsonParser.Features to -
#496: Create
StreamWriteFeatureto take over non-json-specificJsonGenerator.Features -
#502: Make
DefaultPrettyPrinter.createInstance()to fail for sub-classes -
#506: Add missing type parameter for
TypeReferenceinObjectCodec -
#508: Add new exception type
InputCoercionExceptionto be used for failed coercions like overflow forint - #527: Add simple module-info for JDK9+, using Moditect
- #533: UTF-8 BOM not accounted for in JsonLocation.getByteOffset()
-
#539: Reduce max size of recycled byte[]/char[] blocks by
TextBuffer,ByteArrayBuilder
-
#18: Make
JsonNodeserializable -
#1675: Remove "impossible"
IOExceptioninreadTree()andreadValue()ObjectMappermethods which accept Strings -
#1954: Add Builder pattern for creating configured
ObjectMapperinstances- also add
JsonMapperas explicit type, through which builders are created and that exposes JSON-specific configuration
- also add
-
#1995: Limit size of
DeserializerCache, auto-flush on exceeding -
#2059 Remove
finalmodifier forTypeFactory -
#2115: Support naive deserialization of
Serializablevalues as "untyped", same asjava.lang.Object - #2116: Make NumberSerializers.Base public and its inherited classes not final
-
#2126:
DeserializationContext.instantiationException()throwsInvalidDefinitionException -
#2153: Add
JsonMapperto replace genericObjectMapperusage -
#2187: Make
JsonNode.toString()use sharedObjectMapperto produce valid json -
#2195: Add abstraction
PolymorphicTypeValidator, for limiting subtypes allowed by default typing,@JsonTypeInfo -
#2204: Add
JsonNode.isEmpty()as convenience alias -
#2211: Change of behavior (2.8 -> 2.9) with
ObjectMapper.readTree(input)with no content -
#2220: Force serialization always for
convertValue(); avoid short-cuts -
#2223: Add
missingNode()method inJsonNodeFactory -
#2230:
WRITE_BIGDECIMAL_AS_PLAINis ignored if@JsonFormatis used -
#2236: Type id not provided on
Double.NaN,Infinitywith@JsonTypeInfo -
#2241: Add
PropertyNamingStrategy.LOWER_DOT_CASEfor dot-delimited names - #2273: Add basic Java 9+ module info
-
#2331:
JsonMappingExceptionthrough nested getter with generic wildcard return type
- #139: Incorrect decimal fraction representation
- #155: Inconsistent support for FLUSH_PASSED_TO_STREAM
-
#108: Add new
CsvParser.Feature.ALLOW_COMMENTSto replace use of deprecatedJsonParser.Feature.ALLOW_YAML_COMMENTS -
#134:
CSVParserBootstrappercreatesUTF8Readerwhich is incorrectly not auto-closed (reported by iuliu-b@github)
- #100: Add an option to specify properties prefix
- #336: WRITE_BIGDECIMAL_AS_PLAIN Not Used When Writing Pretty
- #350: Wrap Xerces/Stax (JDK-bundled) exceptions during parser initialization
- #351: XmlBeanSerializer serializes AnyGetters field even with FilterExceptFilter
- #50: Empty string serialized without quotes if MINIMIZE_QUOTES is enabled
- #101: Use latest SnakeYAML version 1.24 and get rid of deprecated methods
- #116: Error handling "null" String when Feature.MINIMIZE_QUOTES is active
- #129: Convert YAML string issue
- #34: (guava) Allow use of Guava versions up to 25 (from 22)
- #37: (eclipse-collections) Implement pair deserialization
- #48: (all) Add simple module-info for JDK9+, using Moditect
-
#53: (guava) GuavaImmutableCollectionDeserializer
cannot deserialize an emptyOptional` from null
-
#125: Ignore missing entities when lazy loading is enabled, if newly added
Feature.WRITE_MISSING_ENTITIES_AS_NULLis enabled
-
#239: Auto-detect sealed classes (similar to
@JsonSubTypes)
-
#75: (datetime) Use
SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPSfor configuringDurationserialization - #82: (datetime) Typo in YearMothKeyDeserializer class name
-
#105:
LocalTimeshould generate "time" schema instead of "date-time" -
#121: Array representation of
MonthDaycan not be deserialized - #126: Change auto-registration in 2.10 to provide "new" (JavaTimeModule) instead of legacy module
- #52: Interfaces may have non-abstract methods (since java8)
- #111: AnnotationBundleKey equality fails for Parameter Annotations
-
#63: Change default for
JSON.Feature.USE_FIELDStotrue(from false) in 2.10