Happens in 2.9.9.
When you change ObjectMapper to use a different naming strategy, i.e:
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
When serialising/using writeToString(Object value) for an object such as:
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum Foo
{
BAR("Foo", 0),
...
"declaring_class" will be added to the JSON payload.
Normally this is removed at:
com/fasterxml/jackson/databind/ser/BasicSerializerFactory.java:1139 but because in
com.fasterxml.jackson.databind.introspect.BasicBeanDescription#removeProperty (It's only usage as far as I can see) we aren't using InternalName, declaringClass is not removed. Potential fix here is to change prop.getName() to prop.getInternalName(), a quick test of that seemed to work in my case.