Declare ObjectCodec variables as ObjectReadContext or ObjectWriteContext

Apache 2.0

Jackson 3 removes ObjectCodec. JsonParser.getCodec() becomes objectReadContext(), which returns an ObjectReadContext, and JsonGenerator.getCodec() becomes objectWriteContext(), which returns an ObjectWriteContext. This recipe changes the declared type of variables initialized from those calls, so the declaration still compiles after the migration.

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

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