-
Notifications
You must be signed in to change notification settings - Fork 3
Jackson3 Changes
NOTE: (20-Aug-2017) -- will be moved to https://github.com/FasterXML/jackson3-dev Very Soon Now.
- Jackson 3.x will require and be based on Java 8
- with possible exception of
jackson-coreandjackson-annotations(?)
- with possible exception of
- Embed some/all Java8 modules
- Embed "parameter names", "datatypes" (
Optional) - Need to think of Java 8 date/time module (size)
- Embed "parameter names", "datatypes" (
- Should we combine
databindwith "base modules" (mr-bean, afterburner, jaxb-annotations) for easier tracking of API change effects?
Plan is to immediately remove all things deprecated (but not yet removed) by version 2.9, including things that are part of Public API (which have been retained throughout whole 2.x cycle, unlike internal/package APIs).
This includes:
- Old JSON Schema generation that builds
JsonNode(already deprecated)- Not actively maintained since at least 2.4, deprecated by visitor-based approach since then
- May want to rewrite visitor-introspection interface as well; too JSON Schema centric
Following are things that are thought to be removed as of now:
- Dataformat auto-detection (most in streaming, some in databind)
- supported by some formats, but complicated to make work at higher level
- Ability to re-configure
ObjectMapperwith different codec factory (JsonFactory)- If codec factory is fixed since construction, allows databind/core to be more optimized, esp. for binary formats where name is not decoded from input but inferred from schema (
protobuf,avro) -- could lead to non-trivial performance improvements
- If codec factory is fixed since construction, allows databind/core to be more optimized, esp. for binary formats where name is not decoded from input but inferred from schema (
Further following features are up for discussion
- Serializability of components (from
ObjectMapperon)- Original justification was to allow "thaw"/"unthaw" for Android, but it is questionable whether observed improvement was due to use of JDK serialization, or something else (perf problem in setup)
- In general, idea of serializing active components is not a good idea: and making it explicit these are not serializable can even help resolve problems on systems like distributed data streaming processors (Spark, Storm etc)
- Lots of bits of extra code, removal of which would clean up codebase a bit; but more importantly, less code to maintain, test
- May still want to offer some level of explicit support for passing configuration of
ObjectMapper/ObjectReader/ObjectWriter? That is, allow some form of externalizing settings, if possible (but may not be... perhaps only for some of settings)
MapperFeature:
-
USE_STD_BEAN_NAMING: should always be used, no need for old slightly differing algorithm -
AUTO_DETECT_xxx: old limited settings superceded by more granular settings -- can be deleted, frees up 5 features
DeserializationFeature:
- Although all features still make sense, would make sense to try to combine some, and/or create new type of configuration to use instead of feature -- for example
-
FAIL_xxxare all kind of similar.DeserializationFail, or "check" or... ? -
READ_xxx_as_yyy, similarly -
ACCEPT_xxx_as_yyy, similarly
-
SerializationFeature:
- Most if not all features seem to make sense, but there are groups that could use unification of some kind
FAIL_ON_xxxWRITE_xxx_as_yyy
-
ContextualSerializer/ContextualDeserializer,ResolvableSerializer/ResolvableDeserializer- just embed as part of
JsonSerializer/JsonDeserializer, with no-op implementation
- just embed as part of
In general, we would want to reduce mentions of "json" in cases where API is not JSON-specific.
This is pretty much of all jackson-databind, and most of jackson-core too -- after all, other dataformats
use same abstractions and there should be separate JSON implementation.
However: some of existing entities with json in their name -- say, JsonProcessingException, JsonParser and JsonGenerator -- are so widely used that renaming would cause so much work that it is questionable whether change would be worth the trouble. So, question becomes: what are the places where we could improve naming with limited amount of compatibility breakage (small amount is fine: 3.0 is backwards-incompatible).
-
JsonFactory->StreamFactory? (alts: "CodecFactory", "StreamingFactory"?)- Unlike
JsonParserandJsonGenerator, factory itself is not exposed in all that many places - Additional change: current
JsonFactorywould be split in two parts: general-purpose abstractStreamFactory, and JSON-specificJsonStreamFactory-- we do want to get rid ofJsonFactoryto avoid/reduce collision (since the new version is NOT a base class of other factories any more)
- Unlike
- Possibly rename exceptions, esp.
JsonProcessingException(StreamException?) -- base type not that often used-
JsonParseException->StreamDecodingException? -
JsonGenerationException->StreamEncodingException?
-
-
JsonNodeneeds major rework; can do binary-incompatible return value changes
(will require wiki sub-page)
-
MapperFeature-
SORT_PROPERTIES_ALPHABETICALLY: default totrue(falsereally doesn't make much sense since it is unstable, and arbitrary based on JVM/JDK)
-
-
DeserializationFeature-
READ_ENUMS_USING_TO_STRING: default totrue(instead offalsethat relies onname()) -
FAIL_ON_UNKNOWN_PROPERTIES: default tofalse? (TOP REQUEST by users)
-
-
SerializationFeature-
FAIL_ON_EMPTY_BEANS: default tofalse
-
- Other
- Date/time
- Disable
lenientsetting (that is: default to "strict") - Check defaults of date/time handling
- Disable
- Date/time
-
JsonStreamContext: implement "currentValue" access in base class (remove from sub-classes)