Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit a23db0f

Browse files
committed
privateなファクトリメソッドに対して呼び出すとアクセシビリティで落ちる問題を修正
1 parent f2e7559 commit a23db0f

File tree

1 file changed

+5
-1
lines changed
  • src/main/kotlin/com/wrongwrong/mapk/core

1 file changed

+5
-1
lines changed

src/main/kotlin/com/wrongwrong/mapk/core/KMapper.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ internal fun <T : Any> getTarget(clazz: KClass<T>): KFunction<T> {
117117
clazz.companionObjectInstance?.let { companionObject ->
118118
companionObject::class.functions
119119
.filter { it.annotations.any { annotation -> annotation is KConstructor } }
120-
.map { CompanionKFunction(it, companionObject) as KFunction<T> }
120+
.map {
121+
// isAccessibleの書き換えはKotlinの都合で先に行う必要が有る
122+
it.isAccessible = true
123+
CompanionKFunction(it, companionObject) as KFunction<T>
124+
}
121125
} ?: emptyList()
122126

123127
val constructors: List<KFunction<T>> = factoryConstructor + clazz.constructors

0 commit comments

Comments
 (0)