Skip to content

Commit

Permalink
make create() public again as it may be needed in mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Keks, Myroslava Stavnycha committed Apr 5, 2024
1 parent 39edb0d commit 886b610
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Unreleased
* core: MutableRegistry.create() is marked protected, as it should not be used directly. Use `require<MyClass>()` instead.
* server: ErrorHandler now supports finding of handlers using exception super classes

# 1.6.7
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>

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

/**
Expand Down

0 comments on commit 886b610

Please sign in to comment.