{"record":{"id":"3cf3b8696b2807c8","repo":"FasterXML/jackson-databind","slug":"cannot-call-createparameterobject-on-getclass","errorCode":null,"errorMessage":"Cannot call createParameterObject() on ${getClass().getName()}","messagePattern":"Cannot call createParameterObject\\(\\) on (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/deser/SettableAnyProperty.java","lineNumber":177,"sourceCode":"     *\n     * @since 2.18.1\n     */\n    public boolean isFieldType() { return _setterIsField; }\n\n    /**\n     * Method called to check whether this property is method\n     *\n     * @return 2.18.2\n     */\n    public boolean isSetterType() { return _setter instanceof AnnotatedMethod; }\n\n    /**\n     * Create an instance of value to pass through Creator parameter.\n     *\n     * @since 2.18\n     */\n    public Object createParameterObject() {\n        throw new UnsupportedOperationException(\"Cannot call createParameterObject() on \" + getClass().getName());\n    }\n\n    /*\n    /**********************************************************************\n    /* Public API, deserialization\n    /**********************************************************************\n     */\n\n    /**\n     * Method called to deserialize appropriate value, given parser (and\n     * context), and set it using appropriate method (a setter method).\n     */\n    public void deserializeAndSet(JsonParser p, DeserializationContext ctxt,\n            Object instance, String propName)\n        throws JacksonException\n    {\n        try {\n            Object key = (_keyDeserializer == null) ? propName","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/deser/SettableAnyProperty.java#L159-L195","documentation":"createParameterObject() on the base SettableAnyProperty throws UnsupportedOperationException because only specific subclasses (e.g. the creator/parameter variant) know how to instantiate the any-setter's target object. The base implementation exists so that subclasses which never participate in property-based creators fail loudly rather than silently return null.","triggerScenarios":"A @JsonAnySetter bound to a constructor/factory parameter where the SettableAnyProperty variant does not override createParameterObject(); a custom BeanDeserializerFactory wiring the base SettableAnyProperty into a property-based creator; reflection-based tests or frameworks invoking createParameterObject() directly on the base type.","commonSituations":"Mixing @JsonAnySetter with @JsonCreator on records/builders in a way the introspector did not map to a parameter-capable any-setter; subclassing SettableAnyProperty without overriding the method; a custom module replacing the any-setter implementation.","solutions":["Bind @JsonAnySetter to a Map field or setter method instead of a creator parameter if you do not need the parameter variant.","If subclassing SettableAnyProperty for a creator parameter, override createParameterObject() to return the empty container (e.g. new LinkedHashMap<>()).","Ensure your @JsonCreator and @JsonAnySetter are on compatible members (constructor parameter typed as Map)."],"exampleFix":"// before\npublic class Foo {\n    @JsonAnySetter\n    public void add(String k, Object v) { ... } // method any-setter\n}\nfooDeserializer.createParameterObject(); // throws\n\n// after (creator/parameter variant)\npublic record Foo(@JsonAnySetter Map<String,Object> extra) {}\n// the framework constructs ParameterAnyProperty which overrides createParameterObject()","handlingStrategy":"validation","validationCode":"if (anyProp.getClass() == SettableAnyProperty.class) {\n    throw new IllegalStateException(\n        \"Base SettableAnyProperty cannot back a creator parameter; bind @JsonAnySetter to a Map.\");\n}","typeGuard":"static boolean supportsParameterObject(SettableAnyProperty p) {\n    return p.getClass() != SettableAnyProperty.class; // subclass must override\n}","tryCatchPattern":"try { anyProp.createParameterObject(); }\ncatch (UnsupportedOperationException e) {\n    // rebind @JsonAnySetter to a Map-typed constructor parameter\n}","preventionTips":["Prefer Map<String,Object> any-setter targets when using @JsonCreator/@JsonAnySetter together.","Override createParameterObject() in any custom SettableAnyProperty subclass used for creator parameters."],"tags":["deserialization","any-setter","creator","unsupported-operation"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}