diff --git a/mrbean/dependency-reduced-pom.xml b/mrbean/dependency-reduced-pom.xml
new file mode 100644
index 00000000..82cf7782
--- /dev/null
+++ b/mrbean/dependency-reduced-pom.xml
@@ -0,0 +1,91 @@
+
+
+
+ jackson-modules-base
+ com.fasterxml.jackson.module
+ 3.0.0-SNAPSHOT
+
+ 4.0.0
+ foobar-shaded
+ bundle
+ Jackson module: Mr Bean
+ Functionality for implementing interfaces and abstract types
+dynamically ("bean materialization"), integrated with Jackson (although usable externally as well)
+ https://github.com/FasterXML/jackson-modules-base
+
+
+
+ com.google.code.maven-replacer-plugin
+ replacer
+
+
+ maven-shade-plugin
+
+
+ package
+
+ shade
+
+
+ false
+ foobar-shaded
+
+
+ net.bytebuddy:byte-buddy
+
+
+
+
+ net.bytebuddy
+ com.fasterxml.jackson.module.mrbean.bytebuddy
+
+
+
+
+
+
+
+ org.moditect
+ moditect-maven-plugin
+
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 3.0.0-SNAPSHOT
+ compile
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 3.0.0-SNAPSHOT
+ compile
+
+
+ org.ow2.asm
+ asm
+ 9.0
+ test
+
+
+ junit
+ junit
+ 4.13.1
+ test
+
+
+ hamcrest-core
+ org.hamcrest
+
+
+
+
+
+ net.bytebuddy.*
+ com/fasterxml/jackson/module/mrbean
+ ${project.groupId}.mrbean
+ ${project.groupId}.mrbean.*;version=${project.version}
+
+
diff --git a/mrbean/src/main/java/com/fasterxml/jackson/module/mrbean/AbstractTypeMaterializer.java b/mrbean/src/main/java/com/fasterxml/jackson/module/mrbean/AbstractTypeMaterializer.java
index 42b64f08..d347e213 100644
--- a/mrbean/src/main/java/com/fasterxml/jackson/module/mrbean/AbstractTypeMaterializer.java
+++ b/mrbean/src/main/java/com/fasterxml/jackson/module/mrbean/AbstractTypeMaterializer.java
@@ -1,7 +1,6 @@
package com.fasterxml.jackson.module.mrbean;
import java.lang.reflect.Modifier;
-import java.util.*;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.core.Versioned;
@@ -94,16 +93,15 @@ protected static int collectDefaults() {
protected String _defaultPackage = DEFAULT_PACKAGE_FOR_GENERATED;
/*
- /**********************************************************
+ /**********************************************************************
/* Construction, configuration
- /**********************************************************
+ /**********************************************************************
*/
public AbstractTypeMaterializer() {
this(null);
}
-
/**
* @param parentClassLoader Class loader to use for generated classes; if
* null, will use class loader that loaded materializer itself.
@@ -168,11 +166,11 @@ public void setDefaultPackage(String defPkg)
}
_defaultPackage = defPkg;
}
-
+
/*
- /**********************************************************
+ /**********************************************************************
/* Public API
- /**********************************************************
+ /**********************************************************************
*/
/**
@@ -198,29 +196,6 @@ public JavaType resolveAbstractType(DeserializationConfig config, BeanDescriptio
}
return config.constructType(materializedType);
}
-
- /**
- * Older variant of {@link #resolveAbstractType(DeserializationConfig, BeanDescription)},
- * obsoleted in 2.7. Kept around in 2.7 for backwards compatibility.
- *
- * TODO: remove from 2.9
- */
- @Override
- @Deprecated
- public JavaType resolveAbstractType(DeserializationConfig config, JavaType type)
- {
- if (!_suitableType(type)) {
- return null;
- }
- Class> materializedType;
- if (type.hasGenericTypes()) {
- materializedType = materializeGenericType(config, type);
- } else {
- materializedType = materializeRawType(config,
- AnnotatedClassResolver.resolve(config, type, config));
- }
- return config.constructType(materializedType);
- }
/**
* @since 2.4
@@ -267,8 +242,27 @@ protected Class> _materializeRawType(MapperConfig> config, AnnotatedClass ty
protected Class> _loadAndResolve(String className, byte[] bytecode, Class> rawType) {
return _classLoader.loadAndResolve(className, bytecode, rawType);
}
-
- // private until 2.9.9
+
+ /**
+ * Overridable helper method called to check if given non-concrete type
+ * should be materialized.
+ *
+ * Default implementation will blocks all
+ *
+ * - primitive types
+ * - {@code Enums}
+ * - Container types (Collections, Maps; as per Jackson "container type")
+ * - Reference types (Jackson definition
+ *
+ *
+ * Jackson 2.12 and earlier enumerated a small set of other types under
+ * {@link java.lang} and {@link java.util}: 2.13 and later simply block
+ * all types in {@code java.*}.
+ *
+ * @param type Type that we are asked to materialize
+ *
+ * @return True if materialization should proceed; {@code false} if not.
+ */
protected boolean _suitableType(JavaType type)
{
// Future plans may include calling of this method for all kinds of abstract types.
@@ -278,16 +272,21 @@ protected boolean _suitableType(JavaType type)
|| type.isEnumType() || type.isPrimitive()) {
return false;
}
- Class> cls = type.getRawClass();
+ final Class> cls = type.getRawClass();
+
+ // In Jackson 2.12 we had:
+ /*
if ((cls == Number.class)
// 22-Jun-2016, tatu: As per [#12], avoid these too
|| (cls == Date.class) || (cls == Calendar.class)
|| (cls == CharSequence.class) || (cls == Iterable.class) || (cls == Iterator.class)
// 06-Feb-2019, tatu: [modules-base#74] and:
|| (cls == java.io.Serializable.class)
- // 23-Apr-2021, tatu: [modules-base#132] minimal patch
- || (cls == java.util.TimeZone.class)
- ) {
+ || (cls == java.util.TimeZone.class)) {
+ ) {
+ */
+ // 23-Apr-2021, tatu: Jackson 2.13, as per [modules-base#132], do this:
+ if (cls.getName().startsWith("java.")) {
return false;
}
@@ -303,9 +302,9 @@ protected boolean _suitableType(JavaType type)
}
/*
- /**********************************************************
+ /**********************************************************************
/* Helper classes
- /**********************************************************
+ /**********************************************************************
*/
/**
@@ -331,7 +330,7 @@ public Class> loadAndResolve(String className, byte[] byteCode, Class> targe
if (old != null && targetClass.isAssignableFrom(old)) {
return old;
}
-
+
Class> impl;
try {
impl = defineClass(className, byteCode, 0, byteCode.length);