# devopsgym / codegen__fasterxml__jackson-databind-3701

- taskset: [devopsgym](https://harnessreport.com/tasks/devopsgym.md)
- difficulty: hard
- category: code-generation
- language: 
- runnable from the site: no
- agent timeout: 3000s

## Results by harness

_none yet_

## Instruction

```
This is a code generation task. You are expected to write working code that solves the described problem.
<issue>
      **Is your feature request related to a problem? Please describe.**
`com.fasterxml.jackson.databind.ObjectReader#readValue(JsonNode)` currently only works with `JsonNode` implementations from the `jackson-databind` module. It does not work with custom `JsonNode` implementations. We have a use case where we would like to use custom `JsonNode` implementations.

**Describe the solution you'd like**
`com.fasterxml.jackson.databind.ObjectReader#readValue(JsonNode)` should work with any  `JsonNode` implementation. The reason this currently does not work is because `ObjectCursor` currently casts to `ObjectNode`

https://github.com/FasterXML/jackson-databind/blob/9e3a3113efa918601797c423d981e4f6ddd49a49/src/main/java/com/fasterxml/jackson/databind/node/NodeCursor.java#L198 

There is no need for this as `#fields()` is defined on `JsonNode`. `ArrayCursor` for example does not cast to `ArrayNode` and just calls `JsonNode#elements()`.

**Usage example**
```java
JsonNode jsonNode = new CustomObjectNode();

this.objectMapper.readerFor(Custom.class).readValue(jsonNode);
```

**Additional context**
On our project we settled on Jackson and jackson-databind for our JSON parsing and object mapping needs. So far this has worked well for us. We also store JSON in the database as LOBs. Our database vendor has introduced a native JSON datatype. Part of this is a custom binary format to send JSON preparsed over the wire to the driver. The driver can use this format directly without the need to serialize to text first. The driver exposes this as `javax.json.JsonObject` objects to our code.

We are experimenting with [adapting](https://github.com/marschall/jackson-jaxp-bridge/blob/master/src/main/java/com/github/marschall/jacksonjaxpbridge/JsonObjectNode.java) `javax.json.JsonObject` to `com.fasterxml.jackson.databind.JsonNode`. This would give us the efficiency of being able to use the driver to parse the database internal format while still being able to use jackson-databind for the mapping.

Simply removing the cast seems to do the trick. An additional check could be introduced, on the other hand `ArrayCursor` has no such check.

https://github.com/marschall/jackson-databind/commit/1209c8480503ad578871136366c72b9b6db5fcfe

</issue>
Focus on implementing the required functionality correctly and efficiently. Treat this as a programming challenge.
You are not allowed to read git history.
```
---
Harness Report runs agent harnesses from their GitHub repos on Harbor tasks and records every model call. Every page is also `.md` and `.json`; index: https://harnessreport.com/llms.txt · MCP: https://harnessreport.com/mcp
