AvaloniaRider icon indicating copy to clipboard operation
AvaloniaRider copied to clipboard

Migrate to new JsonMapper API

Open ForNeVeR opened this issue 4 years ago • 0 comments

Replace this (which happens to use a deprecated method):

        private val objectMapper = ObjectMapper(BsonFactory()).apply {
            configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
            configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
        }

with this:

        private val objectMapper = JsonMapper.builder(BsonFactory())
            .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true)
            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .build()

I've tried to do that, but got an exception:

2021-11-29 00:33:55,424 [  33404]  ERROR - oniaPreviewerSessionController - loader constraint violation: when resolving method 'com.fasterxml.jackson.databind.json.JsonMapper$Builder com.fasterxml.jackson.databind.json.JsonMapper.builder(com.fasterxml.jackson.core.JsonFactory)' the class loader com.intellij.ide.plugins.cl.PluginClassLoader @2bcfec5b of the current class, me/fornever/avaloniarider/bson/BsonStreamReader, and the class loader com.intellij.util.lang.PathClassLoader @2812cbfa for the method's defining class, com/fasterxml/jackson/databind/json/JsonMapper, have different Class objects for the type com/fasterxml/jackson/core/JsonFactory used in the signature (me.fornever.avaloniarider.bson.BsonStreamReader is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @2bcfec5b, parent loader 'bootstrap'; com.fasterxml.jackson.databind.json.JsonMapper is in unnamed module of loader com.intellij.util.lang.PathClassLoader @2812cbfa, parent loader 'platform') 
java.lang.LinkageError: loader constraint violation: when resolving method 'com.fasterxml.jackson.databind.json.JsonMapper$Builder com.fasterxml.jackson.databind.json.JsonMapper.builder(com.fasterxml.jackson.core.JsonFactory)' the class loader com.intellij.ide.plugins.cl.PluginClassLoader @2bcfec5b of the current class, me/fornever/avaloniarider/bson/BsonStreamReader, and the class loader com.intellij.util.lang.PathClassLoader @2812cbfa for the method's defining class, com/fasterxml/jackson/databind/json/JsonMapper, have different Class objects for the type com/fasterxml/jackson/core/JsonFactory used in the signature (me.fornever.avaloniarider.bson.BsonStreamReader is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @2bcfec5b, parent loader 'bootstrap'; com.fasterxml.jackson.databind.json.JsonMapper is in unnamed module of loader com.intellij.util.lang.PathClassLoader @2812cbfa, parent loader 'platform')
	at me.fornever.avaloniarider.bson.BsonStreamReader.<clinit>(BsonStreamReader.kt:18)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSession.processSocketMessages(AvaloniaPreviewerSession.kt:64)
	at me.fornever.avaloniarider.previewer.AvaloniaPreviewerSessionController$executePreviewerAsync$sessionJob$1.invokeSuspend(AvaloniaPreviewerSessionController.kt:274)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)

Need to investigate.

ForNeVeR avatar Nov 28 '21 17:11 ForNeVeR