Migrate ObjectMapper.readValue(node.traverse(), ...) to treeToValue(node, ...)

Apache 2.0

In Jackson 3.x, TreeNode.traverse() requires an ObjectReadContext, so mapper.readValue(node.traverse(), type) no longer compiles. Rewrite it to mapper.treeToValue(node, type), which reads the tree directly and exists in Jackson 2.x and 3.x alike.

org.openrewrite.java.jackson.ReadValueTraverseToTreeToValue
mod run . --recipe=org.openrewrite.java.jackson.ReadValueTraverseToTreeToValue

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.