Make "reflection not found" a warning, provide a quick fix
Reporting the warning on each "::", as ReflectionNotFoundInspection did, is not correct anymore, because for example name/get/set on properties works perfectly without kotlin-reflect.jar in the classpath. So instead we report the warning on calls to functions from reflection interfaces. This is not perfect either because it's wrong in projects with custom implementations of reflection interfaces, but this case is so rare that the users can suppress the warning there anyway #KT-7176 Fixed
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class Foo(val prop: Any) {
|
||||
fun func() {}
|
||||
}
|
||||
|
||||
fun n01() = Foo::prop
|
||||
fun n02() = Foo::func
|
||||
fun n03() = Foo::class
|
||||
fun n04(p: KProperty0<Int>) = p.get()
|
||||
fun n05(p: KMutableProperty0<String>) = p.set("")
|
||||
fun n06(p: KProperty0<Int>) = p.get()
|
||||
fun n07(p: KFunction<String>) = p.name
|
||||
fun n08(p: KProperty1<String, Int>) = p[""]
|
||||
fun n09(p: KProperty2<String, String, Int>) = p["", ""]
|
||||
fun n10() = (Foo::func).invoke(Foo(""))
|
||||
fun n11() = (Foo::func)(Foo(""))
|
||||
|
||||
fun y01() = Foo::prop.<!NO_REFLECTION_IN_CLASS_PATH!>getter<!>
|
||||
fun y02() = Foo::class.<!NO_REFLECTION_IN_CLASS_PATH!>properties<!>
|
||||
fun y03() = Foo::class.<!NO_REFLECTION_IN_CLASS_PATH!>simpleName<!>
|
||||
Reference in New Issue
Block a user