Skip to content

Commit

Permalink
RenderConfigReader/OpenVRHMD/ScreenConfig: Replace deprecated jackson…
Browse files Browse the repository at this point in the history
… KotlinModule() call with current KotlinBuilder()
  • Loading branch information
skalarproduktraum committed Apr 9, 2024
1 parent d703bd5 commit 68b9dc4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ class RenderConfigReader {
mapper.registerModule(
KotlinModule.Builder()
.withReflectionCacheSize(512)
.configure(KotlinFeature.NullToEmptyCollection, false)
.configure(KotlinFeature.NullToEmptyMap, false)
.configure(KotlinFeature.NullToEmptyCollection, true)
.configure(KotlinFeature.NullToEmptyMap, true)
.configure(KotlinFeature.NullIsSameAsDefault, false)
.configure(KotlinFeature.SingletonSupport, false)
.configure(KotlinFeature.StrictNullChecks, false)
.configure(KotlinFeature.SingletonSupport, true)
.configure(KotlinFeature.StrictNullChecks, true)
.build()
)

Expand Down
11 changes: 10 additions & 1 deletion src/main/kotlin/graphics/scenery/controls/OpenVRHMD.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.fasterxml.jackson.module.kotlin.KotlinFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import graphics.scenery.*
import graphics.scenery.backends.Display
Expand Down Expand Up @@ -1271,7 +1272,15 @@ open class OpenVRHMD(val seated: Boolean = false, val useCompositor: Boolean = t
compositeFile.exists() && compositeFile.length() > 1024 -> {
logger.info("Loading model from composite JSON, ${compositeFile.absolutePath}")
val mapper = ObjectMapper(YAMLFactory())
mapper.registerModule(KotlinModule())
mapper.registerModule(
KotlinModule.Builder()
.configure(KotlinFeature.NullToEmptyCollection, true)
.configure(KotlinFeature.NullToEmptyMap, true)
.configure(KotlinFeature.NullIsSameAsDefault, false)
.configure(KotlinFeature.SingletonSupport, true)
.configure(KotlinFeature.StrictNullChecks, true)
.build()
)
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false)

Expand Down
11 changes: 10 additions & 1 deletion src/main/kotlin/graphics/scenery/controls/ScreenConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.joml.Vector3f
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.fasterxml.jackson.module.kotlin.KotlinFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import graphics.scenery.utils.JsonDeserialisers
import graphics.scenery.utils.lazyLogger
Expand Down Expand Up @@ -142,7 +143,15 @@ class ScreenConfig {
*/
@JvmStatic fun loadFromFile(path: String): ScreenConfig.Config {
val mapper = ObjectMapper(YAMLFactory())
mapper.registerModule(KotlinModule())
mapper.registerModule(
KotlinModule.Builder()
.configure(KotlinFeature.NullToEmptyCollection, true)
.configure(KotlinFeature.NullToEmptyMap, true)
.configure(KotlinFeature.NullIsSameAsDefault, false)
.configure(KotlinFeature.SingletonSupport, true)
.configure(KotlinFeature.StrictNullChecks, true)
.build()
)

var stream = ScreenConfig::class.java.getResourceAsStream(path)

Expand Down

0 comments on commit 68b9dc4

Please sign in to comment.