jackson-module-kotlin: Upgrading to 2.10.1 results in "Cannot construct instance of `kotlin.text.Regex`"

When upgrading Jackson from 20.10.0 to 2.10.1 in https://github.com/heremaps/oss-review-toolkit (see the jackson-upgrade branch) we started to get:

com.here.ort.model.OrtResultTest > com.here.ort.model.OrtResultTest > executionError FAILED
    com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `kotlin.text.Regex` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('testAnnotationProcessor')
     at [Source: (File); line: 20, column: 15] (through reference chain: com.here.ort.model.OrtResult["repository"]->com.here.ort.model.Repository["config"]->com.here.ort.model.config.RepositoryConfiguration["excludes"]->com.here.ort.model.config.Excludes["scopes"]->java.util.ArrayList[0]->com.here.ort.model.config.ScopeExclude["name"])
        at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
        at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1429)
        at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1059)
        at com.fasterxml.jackson.databind.deser.ValueInstantiator._createFromStringFallbacks(ValueInstantiator.java:371)
        at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:323)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromString(BeanDeserializerBase.java:1373)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:171)
        at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)

Needless to say, of course kotlin.text.Regex does have a String-argument constructor.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@sschuberth I think I have this fixed in the current 2.10 branch, I’ll check your latest test case as well. The deserializer I added will deserialize from a string or from the object (pattern/options). Serialization would be the object unless you add the string serializer. But I’ll check your updated test cases to be sure. more coverage on this is better!

@sschuberth I can take a look at this