Skip to content

Lib can not be used with Jackson 2.10.0 or later #27

Open
@grimsa

Description

@grimsa

Jackson 2.10 was released 2019-09-26.
It contains a fix for FasterXML/jackson-core#502, which makes snapshot building fail with the following exception:

io.github.jsonSnapshot.SnapshotMatchException: Failed `createInstance()`: io.github.jsonSnapshot.SnapshotMatcher$1 does not override method; it has to

	at io.github.jsonSnapshot.SnapshotMatcher.lambda$defaultJsonFunction$0(SnapshotMatcher.java:116)
	at io.github.jsonSnapshot.Snapshot.takeSnapshot(Snapshot.java:87)
	at io.github.jsonSnapshot.Snapshot.toMatchSnapshot(Snapshot.java:43)

The cause of this is io.github.jsonSnapshot.SnapshotMatcher#buildDefaultPrettyPrinter where DefaultPrettyPrinter is extended, but now required createInstance method is not overridden.

This makes serializing JSON fail with the following stack trace:

java.lang.IllegalStateException: Failed `createInstance()`: io.github.jsonSnapshot.SnapshotMatcher$1 does not override method; it has to
	at com.fasterxml.jackson.core.util.DefaultPrettyPrinter.createInstance(DefaultPrettyPrinter.java:256)
	at com.fasterxml.jackson.core.util.DefaultPrettyPrinter.createInstance(DefaultPrettyPrinter.java:15)
	at com.fasterxml.jackson.databind.ObjectWriter$GeneratorSettings.initialize(ObjectWriter.java:1299)
	at com.fasterxml.jackson.databind.ObjectWriter._configureGenerator(ObjectWriter.java:1174)
	at com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1129)
	at com.fasterxml.jackson.databind.ObjectWriter.writeValueAsString(ObjectWriter.java:1005)
	at io.github.jsonSnapshot.SnapshotMatcher.lambda$defaultJsonFunction$0(SnapshotMatcher.java:114)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions