Implemented #425, to migrate from "NoClass.class" to using "Void"
diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotationIntrospectorPair.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotationIntrospectorPair.java
index f2b6450..39d4fcd 100644
--- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotationIntrospectorPair.java
+++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotationIntrospectorPair.java
@@ -11,10 +11,10 @@
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.annotation.NoClass;
import com.fasterxml.jackson.databind.cfg.MapperConfig;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
+import com.fasterxml.jackson.databind.util.ClassUtil;
import com.fasterxml.jackson.databind.util.NameTransformer;
/**
@@ -286,30 +286,29 @@
@Override
public Object findSerializer(Annotated am) {
Object r = _primary.findSerializer(am);
- return (r == null) ? _secondary.findSerializer(am) : r;
+ return _isExplicitClassOrOb(r, JsonSerializer.None.class)
+ ? r : _secondary.findSerializer(am);
}
@Override
public Object findKeySerializer(Annotated a) {
Object r = _primary.findKeySerializer(a);
- return (r == null || r == JsonSerializer.None.class || r == NoClass.class) ?
- _secondary.findKeySerializer(a) : r;
+ return _isExplicitClassOrOb(r, JsonSerializer.None.class)
+ ? r : _secondary.findKeySerializer(a);
}
@Override
public Object findContentSerializer(Annotated a) {
- Object r = _primary.findContentSerializer(a);
- return (r == null || r == JsonSerializer.None.class || r == NoClass.class) ?
- _secondary.findContentSerializer(a) : r;
+ Object r = _primary.findContentSerializer(a);
+ return _isExplicitClassOrOb(r, JsonSerializer.None.class)
+ ? r : _secondary.findContentSerializer(a);
}
@Override
public Object findNullSerializer(Annotated a) {
- Object result = _primary.findNullSerializer(a);
- if (result == null || result == JsonSerializer.None.class || result == NoClass.class) {
- result = _secondary.findNullSerializer(a);
- }
- return result;
+ Object r = _primary.findNullSerializer(a);
+ return _isExplicitClassOrOb(r, JsonSerializer.None.class)
+ ? r : _secondary.findNullSerializer(a);
}
@Override
@@ -499,27 +498,28 @@
@Override
public Object findDeserializer(Annotated am) {
Object r = _primary.findDeserializer(am);
- return (r == null) ? _secondary.findDeserializer(am) : r;
+ return _isExplicitClassOrOb(r, JsonDeserializer.None.class)
+ ? r : _secondary.findDeserializer(am);
}
@Override
public Object findKeyDeserializer(Annotated am) {
- Object result = _primary.findKeyDeserializer(am);
- return (result == null || result == KeyDeserializer.None.class || result == NoClass.class) ?
- _secondary.findKeyDeserializer(am) : result;
+ Object r = _primary.findKeyDeserializer(am);
+ return _isExplicitClassOrOb(r, KeyDeserializer.None.class)
+ ? r : _secondary.findKeyDeserializer(am);
}
@Override
public Object findContentDeserializer(Annotated am) {
- Object result = _primary.findContentDeserializer(am);
- return (result == null || result == JsonDeserializer.None.class || result == NoClass.class) ?
- _secondary.findContentDeserializer(am) : result;
+ Object r = _primary.findContentDeserializer(am);
+ return _isExplicitClassOrOb(r, JsonDeserializer.None.class)
+ ? r : _secondary.findContentDeserializer(am);
}
@Override
public Class<?> findDeserializationType(Annotated am, JavaType baseType) {
- Class<?> result = _primary.findDeserializationType(am, baseType);
- return (result == null) ? _secondary.findDeserializationType(am, baseType) : result;
+ Class<?> r = _primary.findDeserializationType(am, baseType);
+ return (r != null) ? r : _secondary.findDeserializationType(am, baseType);
}
@Override
@@ -598,4 +598,15 @@
public boolean hasCreatorAnnotation(Annotated a) {
return _primary.hasCreatorAnnotation(a) || _secondary.hasCreatorAnnotation(a);
}
- }
+
+ protected boolean _isExplicitClassOrOb(Object maybeCls, Class<?> implicit) {
+ if (maybeCls == null) {
+ return false;
+ }
+ if (!(maybeCls instanceof Class<?>)) {
+ return true;
+ }
+ Class<?> cls = (Class<?>) maybeCls;
+ return (cls != implicit && !ClassUtil.isBogusClass(cls));
+ }
+}
diff --git a/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java b/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java
index a860690..8ddb4f4 100644
--- a/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java
+++ b/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeDeserializerBase.java
@@ -189,7 +189,7 @@
protected final JsonDeserializer<Object> _findDefaultImplDeserializer(DeserializationContext ctxt) throws IOException
{
/* 06-Feb-2013, tatu: As per [Issue#148], consider default implementation value of
- * {@link NoClass} to mean "serialize as null"; as well as DeserializationFeature
+ * {@link java.lang.Void} to mean "serialize as null"; as well as DeserializationFeature
* to do swift mapping to null
*/
if (_defaultImpl == null) {