Skip to content

Commit

Permalink
#51 core: MutableRegistry.create() is marked protected, as it should …
Browse files Browse the repository at this point in the history
…not be used directly. Use `require<MyClass>()` instead.
  • Loading branch information
angryziber committed Apr 2, 2024
1 parent 6513abe commit 8ea2b40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
* core: MutableRegistry.create() is marked protected, as it should not be used directly. Use `require<MyClass>()` 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
Expand Down
2 changes: 1 addition & 1 deletion core/src/Registry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ open class SimpleRegistry: MutableRegistry {
override fun <T: Any> require(type: KClass<T>) = optional(type) ?: create(type).also { register(type, it) }
override fun <T: Any> requireAll(type: KClass<T>): List<T> = instances.values.filter { type.java.isAssignableFrom(it.javaClass) }.distinct() as List<T>

open fun <T: Any> create(type: KClass<T>): T = type.createInstance()
protected open fun <T: Any> create(type: KClass<T>): T = type.createInstance()
}

/**
Expand Down

0 comments on commit 8ea2b40

Please sign in to comment.