FasterXML/jackson-databind · error · UnsupportedOperationException

Class ${getClass().getName()} does not override `withBeanPro

Error message

Class ${getClass().getName()} does not override `withBeanProperties()`, needs to

What it means

BeanDeserializerBase.withBeanProperties is a mutant factory that concrete BeanDeserializer subclasses must override; the base throws if not overridden. The base implementation exists only for backwards compatibility with subclasses that predate the method, so calling it on a subclass that did not override it is a contract violation.

Source

Thrown at src/main/java/tools/jackson/databind/deser/bean/BeanDeserializerBase.java:491

        _serializationShape = src._serializationShape;

        _vanillaProcessing = src._vanillaProcessing;

        _externalTypeIdHandler = src._externalTypeIdHandler;
    }

    public abstract BeanDeserializerBase withObjectIdReader(ObjectIdReader oir);

    public abstract BeanDeserializerBase withByNameInclusion(Set<String> ignorableProps, Set<String> includableProps);

    public abstract BeanDeserializerBase withIgnoreAllUnknown(boolean ignoreUnknown);

    /**
     * Mutant factory method that custom sub-classes must override; not left as
     * abstract to prevent more drastic backwards compatibility problems.
     */
    public BeanDeserializerBase withBeanProperties(BeanPropertyMap props) {
        throw new UnsupportedOperationException("Class "+getClass().getName()
                +" does not override `withBeanProperties()`, needs to");
    }

    @Override
    public abstract ValueDeserializer<Object> unwrappingDeserializer(DeserializationContext ctxt,
            NameTransformer unwrapper);

    /**
     * Fluent factory for creating a variant that can handle
     * POJO output as a JSON Array. Implementations may ignore this request
     * if no such input is possible.
     */
    protected abstract BeanDeserializerBase asArrayDeserializer();

    // @since 3.0
    protected abstract void initNameMatcher(DeserializationContext ctxt);

    /*

View on GitHub (pinned to 87876ca5c0)

Solutions

  1. If you subclass BeanDeserializerBase, override withBeanProperties to reconstruct the deserializer with the new BeanPropertyMap.
  2. Upgrade the third-party module that ships the subclass so it overrides withBeanProperties.
  3. Avoid the code path that triggers the mutation (e.g. do not apply withByNameInclusion after construction on the uncooperative subclass).

Example fix

// before
public class MyBeanDeserializer extends BeanDeserializerBase {
    // missing withBeanProperties override -> throws when mutated
}

// after
public class MyBeanDeserializer extends BeanDeserializerBase {
    @Override
    public BeanDeserializerBase withBeanProperties(BeanPropertyMap props) {
        // reconstruct using the copy constructor that accepts the new props
        return new MyBeanDeserializer(this, props);
    }
}
Defensive patterns

Strategy: type-guard

Validate before calling

BeanDeserializerBase d = ...;
if (d.getClass().getMethod("withBeanProperties", BeanPropertyMap.class)
        .getDeclaringClass() == BeanDeserializerBase.class) {
    // not overridden; do not call withBeanProperties
}

Type guard

static boolean overridesWithBeanProperties(BeanDeserializerBase d) {
    try {
        return d.getClass().getMethod("withBeanProperties", BeanPropertyMap.class)
                   .getDeclaringClass() != BeanDeserializerBase.class;
    } catch (NoSuchMethodException e) { return false; }
}

Try / catch

try { d.withBeanProperties(props); }
catch (UnsupportedOperationException e) {
    // subclass needs to override withBeanProperties; upgrade it
}

Prevention

When it happens

Trigger: A third-party or custom BeanDeserializer subclass that extends BeanDeserializerBase but does not override withBeanProperties, being used with a code path that mutates the bean property map (e.g. ignoreUnknown, name-based inclusion filters applied post-construction).

Common situations: Upgrading Jackson to a version that added withBeanProperties and finding an old custom BeanDeserializer subclass no longer cooperates; using a third-party module whose deserializer subclass is out of date; code that calls withBeanProperties directly via reflection/generics.

Related errors


AI-assisted analysis of FasterXML/jackson-databind@87876ca5c0 (2026-08-11). Data as JSON: /api/errors/a55b201d7d2535d6. Report an issue: GitHub.