Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Nifty class for pulling implementations of classes out of thin air.
*<p>
* ... friends call him Mister Bean... :-)
*
*
* @author tatu
* @author sunny
*/
Expand All @@ -46,7 +46,7 @@ public enum Feature {
* NOTE: defaults to `true` since 3.0 (earlier defaulted to `false`)
*/
FAIL_ON_UNMATERIALIZED_METHOD(true),

/**
* Feature that determines what happens when attempt is made to
* generate implementation of non-public class or interface.
Expand All @@ -68,7 +68,7 @@ protected static int collectDefaults() {
}
return flags;
}

private Feature(boolean defaultState) { _defaultState = defaultState; }
public boolean enabledByDefault() { return _defaultState; }
public int getMask() { return (1 << ordinal()); }
Expand All @@ -84,7 +84,7 @@ protected static int collectDefaults() {
* Default package to use for generated classes.
*/
public final static String DEFAULT_PACKAGE_FOR_GENERATED = "com.fasterxml.jackson.module.mrbean.generated.";

/**
* We will use per-materializer class loader for now; would be nice
* to find a way to reduce number of class loaders (and hence
Expand All @@ -101,18 +101,18 @@ protected static int collectDefaults() {
* Package name to use as prefix for generated classes.
*/
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.
Expand All @@ -133,7 +133,7 @@ public AbstractTypeMaterializer(ClassLoader parentClassLoader)
public Version version() {
return PackageVersion.VERSION;
}

/**
* Method for checking whether given feature is enabled or not
*/
Expand Down Expand Up @@ -203,7 +203,7 @@ public JavaType resolveAbstractType(DeserializationConfig config, BeanDescriptio
// might want to skip proxies, local types too... but let them be for now:
//if (intr.findTypeResolver(beanDesc.getClassInfo(), type) == null) {
Class<?> materializedType;

if (type.hasGenericTypes()) {
materializedType = materializeGenericType(config, type);
} else {
Expand Down Expand Up @@ -308,15 +308,15 @@ protected boolean _suitableType(JavaType type)
* To support actual dynamic loading of bytecode we need a simple
* custom classloader.
*/
private static class MyClassLoader extends ClassLoader
static class MyClassLoader extends ClassLoader
{
public MyClassLoader(ClassLoader parent)
{
super(parent);
}

/**
* @param targetClass Interface or abstract class that class to load should extend or
* @param targetClass Interface or abstract class that class to load should extend or
* implement
*/
public Class<?> loadAndResolve(String className, byte[] byteCode, Class<?> targetClass)
Expand All @@ -327,7 +327,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public BeanBuilder implement(boolean failOnUnrecognized)
for (Method m : impl.getRawClass().getDeclaredMethods()) {
// 15-Sep-2015, tatu: As per [module-mrbean#25], make sure to ignore static
// methods.
if (Modifier.isStatic(m.getModifiers())) {
if (Modifier.isStatic(m.getModifiers())
// Looks like generics can introduce hidden bridge and/or synthetic methods.
// I don't think we want to consider those...
|| m.isSynthetic() || m.isBridge()) {
continue;
}
String methodName = m.getName();
Expand Down Expand Up @@ -240,7 +243,7 @@ protected final static boolean returnsBoolean(Method m)
Class<?> rt = m.getReturnType();
return (rt == Boolean.class || rt == Boolean.TYPE);
}

/*
/**********************************************************
/* Internal methods, bytecode generation
Expand Down Expand Up @@ -288,7 +291,7 @@ private DynamicType.Builder<?> createSetter(DynamicType.Builder<?> builder,
/* Internal methods, other
/**********************************************************
*/

protected String decap(String name) {
char c = name.charAt(0);
if (name.length() > 1
Expand Down
Loading