This repository was archived by the owner on Jan 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
src/main/kotlin/com/mapk/core Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -88,16 +88,19 @@ class KFunctionForCall<T> internal constructor(
8888
8989@Suppress(" UNCHECKED_CAST" )
9090internal fun <T : Any > KClass<T>.toKConstructor (parameterNameConverter : ParameterNameConverter ): KFunctionForCall <T > {
91- val factoryConstructor: List <KFunctionForCall <T >> =
92- this .companionObjectInstance?.let { companionObject ->
93- companionObject::class .functions
94- .filter { it.annotations.any { annotation -> annotation is KConstructor } }
95- .map { KFunctionForCall (it, parameterNameConverter, companionObject) as KFunctionForCall <T > }
96- } ? : emptyList()
97-
98- val constructors: List <KFunctionForCall <T >> = factoryConstructor + this .constructors
91+ val constructors = ArrayList <KFunctionForCall <T >>()
92+
93+ this .companionObjectInstance?.let { companionObject ->
94+ companionObject::class .functions
95+ .filter { it.annotations.any { annotation -> annotation is KConstructor } }
96+ .forEach {
97+ constructors.add(KFunctionForCall (it, parameterNameConverter, companionObject) as KFunctionForCall <T >)
98+ }
99+ }
100+
101+ this .constructors
99102 .filter { it.annotations.any { annotation -> annotation is KConstructor } }
100- .map { KFunctionForCall (it, parameterNameConverter) }
103+ .forEach { constructors.add( KFunctionForCall (it, parameterNameConverter) ) }
101104
102105 if (constructors.size == 1 ) return constructors.single()
103106
You can’t perform that action at this time.
0 commit comments