From 8ea2b40c9f6bf838b4a16948b9f68110c534e8b5 Mon Sep 17 00:00:00 2001 From: Anton Keks Date: Tue, 2 Apr 2024 22:14:13 +0300 Subject: [PATCH] #51 core: MutableRegistry.create() is marked protected, as it should not be used directly. Use `require()` instead. --- CHANGELOG.md | 3 +++ core/src/Registry.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01b59c6d..b02d1fc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# Unreleased +* core: MutableRegistry.create() is marked protected, as it should not be used directly. Use `require()` instead. + # 1.6.7 * core: Converter can now force initialize type arguments' companion objects * core: Decimal.absoluteValue and Decimal.sign introduced, like other numeric types in Kotlin diff --git a/core/src/Registry.kt b/core/src/Registry.kt index a2369a78..0ce9ad10 100644 --- a/core/src/Registry.kt +++ b/core/src/Registry.kt @@ -44,7 +44,7 @@ open class SimpleRegistry: MutableRegistry { override fun require(type: KClass) = optional(type) ?: create(type).also { register(type, it) } override fun requireAll(type: KClass): List = instances.values.filter { type.java.isAssignableFrom(it.javaClass) }.distinct() as List - open fun create(type: KClass): T = type.createInstance() + protected open fun create(type: KClass): T = type.createInstance() } /**