Fix [JACKSON-703]
diff --git a/release-notes/VERSION b/release-notes/VERSION
index 9a85901..6848038 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -11,12 +11,14 @@
* [JACKSON-700] Type problems with properties that have different types
for constructor property, setter and/or field
(reported by Ben H)
+ * [JACKSON-703] 'SerializationConfig.isEnabled(...)',
+ 'DeserializationConfig.isEnabled(...)' incompatible due to signature change
------------------------------------------------------------------------
=== History: ===
------------------------------------------------------------------------
-1.9.0 [23-Oct-2011]
+1.9.1 [23-Oct-2011]
Fixes:
diff --git a/src/mapper/java/org/codehaus/jackson/map/DeserializationConfig.java b/src/mapper/java/org/codehaus/jackson/map/DeserializationConfig.java
index 24c9c94..beaadb1 100644
--- a/src/mapper/java/org/codehaus/jackson/map/DeserializationConfig.java
+++ b/src/mapper/java/org/codehaus/jackson/map/DeserializationConfig.java
@@ -598,7 +598,7 @@
/* MapperConfig implementation
/**********************************************************
*/
-
+
/**
* Method that checks class annotations that the argument Object has,
* and modifies settings of this configuration object accordingly,
@@ -729,6 +729,64 @@
}
return vchecker;
}
+
+ /*
+ /**********************************************************
+ /* MapperConfig overrides for 1.8 backwards compatibility
+ /**********************************************************
+ */
+
+ /* NOTE: these are overloads we MUST have, but that were missing
+ * from 1.9.0 and 1.9.1. Type erasure can bite in the ass...
+ *<p>
+ * NOTE: will remove either these variants, or base class one, in 2.0.
+ */
+
+ /**
+ * An overload for {@link MapperConfig#isEnabled(MapperConfig.ConfigFeature)},
+ * needed for backwards-compatibility.
+ *<p>
+ * NOTE: will remove either this variant, or base class one, in 2.0./
+ *
+ * @since 1.0 However, note that version 1.9.0 and 1.9.1 accidentally missed
+ * this overloaded variant
+ */
+ public boolean isEnabled(DeserializationConfig.Feature f) {
+ return (_featureFlags & f.getMask()) != 0;
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #with} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void enable(DeserializationConfig.Feature f) {
+ super.enable(f);
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #without} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void disable(DeserializationConfig.Feature f) {
+ super.disable(f);
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #without} and {@link #with} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void set(DeserializationConfig.Feature f, boolean state) {
+ super.set(f, state);
+ }
/*
/**********************************************************
diff --git a/src/mapper/java/org/codehaus/jackson/map/JsonSerializer.java b/src/mapper/java/org/codehaus/jackson/map/JsonSerializer.java
index 9d07991..53a3beac 100644
--- a/src/mapper/java/org/codehaus/jackson/map/JsonSerializer.java
+++ b/src/mapper/java/org/codehaus/jackson/map/JsonSerializer.java
@@ -8,6 +8,11 @@
* Abstract class that defines API used by {@link ObjectMapper} (and
* other chained {@link JsonSerializer}s too) to serialize Objects of
* arbitrary types into JSON, using provided {@link JsonGenerator}.
+ *<p>
+ * NOTE: it is recommended that custom serializers extend
+ * {@link org.codehaus.jackson.map.ser.std.SerializerBase} instead
+ * of this class, since it will implement many of optional
+ * methods of this class.
*/
public abstract class JsonSerializer<T>
{
diff --git a/src/mapper/java/org/codehaus/jackson/map/MapperConfig.java b/src/mapper/java/org/codehaus/jackson/map/MapperConfig.java
index 34c19e7..b5e2436 100644
--- a/src/mapper/java/org/codehaus/jackson/map/MapperConfig.java
+++ b/src/mapper/java/org/codehaus/jackson/map/MapperConfig.java
@@ -1084,11 +1084,20 @@
/**********************************************************
*/
+ /* NOTE: this method was added in 1.9, but should be
+ * removed from 2.0 -- overloads do not work nicely with
+ * enums, so we better not try
+ *<p>
+ * Also note that we can NOT use type variable CFG here, because
+ * non-generic base class had to use base type.
+ *
+ * @Deprecated
+ */
@Override
public boolean isEnabled(MapperConfig.ConfigFeature f) {
return (_featureFlags & f.getMask()) != 0;
}
-
+
/*
/**********************************************************
/* Configuration: deprecated methods
@@ -1103,7 +1112,7 @@
* creating a new one (as the goal is to make this class immutable)
*/
@Deprecated
- public final void enable(CFG f) {
+ public void enable(CFG f) {
_featureFlags |= f.getMask();
}
@@ -1115,7 +1124,7 @@
* creating a new one (as the goal is to make this class immutable)
*/
@Deprecated
- public final void disable(CFG f) {
+ public void disable(CFG f) {
_featureFlags &= ~f.getMask();
}
@@ -1129,7 +1138,7 @@
*/
@SuppressWarnings("deprecation")
@Deprecated
- public final void set(CFG f, boolean state)
+ public void set(CFG f, boolean state)
{
if (state) {
enable(f);
diff --git a/src/mapper/java/org/codehaus/jackson/map/SerializationConfig.java b/src/mapper/java/org/codehaus/jackson/map/SerializationConfig.java
index d81dd05..578f8f5 100644
--- a/src/mapper/java/org/codehaus/jackson/map/SerializationConfig.java
+++ b/src/mapper/java/org/codehaus/jackson/map/SerializationConfig.java
@@ -714,10 +714,10 @@
/*
/**********************************************************
- /* MapperConfig implementation
+ /* MapperConfig implementation/overrides
/**********************************************************
*/
-
+
/**
* Method that checks class annotations that the argument Object has,
* and modifies settings of this configuration object accordingly,
@@ -844,6 +844,61 @@
}
return vchecker;
}
+
+ /*
+ /**********************************************************
+ /* MapperConfig overrides for 1.8 backwards compatibility
+ /**********************************************************
+ */
+
+ /* NOTE: these are overloads we MUST have, but that were missing
+ * from 1.9.0 and 1.9.1. Type erasure can bite in the ass...
+ *<p>
+ * NOTE: will remove either these variants, or base class one, in 2.0.
+ */
+
+ /**
+ * Alias for {@link MapperConfig#isEnabled(org.codehaus.jackson.map.MapperConfig.ConfigFeature)}.
+ *
+ * @since 1.0 However, note that version 1.9.0 and 1.9.1 accidentally missed
+ * this overloaded variant
+ */
+ public boolean isEnabled(SerializationConfig.Feature f) {
+ return (_featureFlags & f.getMask()) != 0;
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #with} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void enable(SerializationConfig.Feature f) {
+ super.enable(f);
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #without} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void disable(SerializationConfig.Feature f) {
+ super.disable(f);
+ }
+
+ /**
+ * @deprecated Since 1.9, it is preferable to use {@link #without} and {@link #with} instead;
+ * this method is deprecated as it modifies current instance instead of
+ * creating a new one (as the goal is to make this class immutable)
+ */
+ @Deprecated
+ @Override
+ public void set(SerializationConfig.Feature f, boolean state) {
+ super.set(f, state);
+ }
/*
/**********************************************************