Move all NoLookupLocation instances to the one place to make them more discoverable and close constructor
This commit is contained in:
@@ -18,6 +18,7 @@ package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.classId
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.classLoader
|
||||
import org.jetbrains.kotlin.load.java.structure.reflect.createArrayType
|
||||
@@ -105,7 +106,7 @@ abstract class KCallableContainerImpl : DeclarationContainerImpl {
|
||||
|
||||
fun findPropertyDescriptor(name: String, signature: String): PropertyDescriptor {
|
||||
val properties = scope
|
||||
.getProperties(Name.guess(name), NO_LOCATION_FROM_REFLECTION)
|
||||
.getProperties(Name.guess(name), NoLookupLocation.FROM_REFLECTION)
|
||||
.filter { descriptor ->
|
||||
descriptor is PropertyDescriptor &&
|
||||
RuntimeTypeMapper.mapPropertySignature(descriptor).asString() == signature
|
||||
@@ -123,7 +124,7 @@ abstract class KCallableContainerImpl : DeclarationContainerImpl {
|
||||
}
|
||||
|
||||
fun findFunctionDescriptor(name: String, signature: String): FunctionDescriptor {
|
||||
val functions = (if (name == "<init>") constructorDescriptors.toList() else scope.getFunctions(Name.guess(name), NO_LOCATION_FROM_REFLECTION))
|
||||
val functions = (if (name == "<init>") constructorDescriptors.toList() else scope.getFunctions(Name.guess(name), NoLookupLocation.FROM_REFLECTION))
|
||||
.filter { descriptor ->
|
||||
RuntimeTypeMapper.mapSignature(descriptor).asString() == signature
|
||||
}
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import kotlin.reflect.IllegalCallableAccessException
|
||||
|
||||
internal val PLATFORM_STATIC = FqName("kotlin.platform.platformStatic")
|
||||
|
||||
internal val NO_LOCATION_FROM_REFLECTION = NoLookupLocation.create("from reflection")
|
||||
|
||||
// TODO: wrap other exceptions
|
||||
internal inline fun <R> reflectionCall(block: () -> R): R =
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user