Remove default import "kotlin.reflect"
Basic reflection is usable without any imports (with :: literals)
This reverts commit 9503056dd5.
This commit is contained in:
+1
-2
@@ -57,8 +57,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
new ImportPath("java.lang.*"),
|
||||
new ImportPath("kotlin.*"),
|
||||
new ImportPath("kotlin.jvm.*"),
|
||||
new ImportPath("kotlin.io.*"),
|
||||
new ImportPath("kotlin.reflect.*")
|
||||
new ImportPath("kotlin.io.*")
|
||||
);
|
||||
|
||||
public static class JvmSetup extends BasicSetup {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
|
||||
class A {
|
||||
class object {
|
||||
val ref: KMemberProperty<A, String> = A::foo
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
import kotlin.reflect.jvm.accessible
|
||||
|
||||
class Result {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import kotlin.reflect.KMutableMemberProperty
|
||||
import kotlin.reflect.jvm.accessible
|
||||
|
||||
class A {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
fun main() {
|
||||
val x = ::A
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A
|
||||
|
||||
class B {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A
|
||||
|
||||
fun main() {
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ class A {
|
||||
|
||||
package other
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
import first.A
|
||||
|
||||
fun main() {
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ fun A.baz() {}
|
||||
|
||||
package other
|
||||
|
||||
import kotlin.reflect.KExtensionFunction0
|
||||
|
||||
import first.A
|
||||
import first.foo
|
||||
|
||||
|
||||
+2
@@ -10,6 +10,8 @@ fun baz() = "OK"
|
||||
|
||||
package other
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
import first.foo
|
||||
import first.bar
|
||||
import first.baz
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun main() {
|
||||
val x = ::foo
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun A.main() {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class B
|
||||
|
||||
class A {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun A.foo() {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class A<T>(val t: T) {
|
||||
fun foo(): T = t
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class A {
|
||||
inner class Inner
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class A {
|
||||
inner class Inner
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class A {
|
||||
inner class Inner
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
fun main() {
|
||||
class A
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
fun main() {
|
||||
class A
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
fun main() {
|
||||
class A
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
fun main() {
|
||||
class A
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun main() {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun main() {
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun main() {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun main() {
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ class D {
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
fun main() {
|
||||
val x = a.b.c.D::foo
|
||||
|
||||
|
||||
+2
@@ -8,6 +8,8 @@ class D<E, F> {
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
import kotlin.reflect.KMemberFunction2
|
||||
|
||||
fun main() {
|
||||
val x = a.b.c.D<String, Int>::foo
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
class Nested
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
class Nested
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KFunction0
|
||||
|
||||
class A {
|
||||
class Nested
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
class A {
|
||||
fun foo() = 42
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberFunction0
|
||||
|
||||
fun foo() {}
|
||||
|
||||
class A {
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ fun A.baz(<!UNUSED_PARAMETER!>x<!>: String) {}
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
import other.foo as foofoo
|
||||
import other.A as AA
|
||||
import other.baz as bazbaz
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
fun baz() = "OK"
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun foo() {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A
|
||||
|
||||
fun foo() {}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun foo() {}
|
||||
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
fun baz() = "OK"
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
|
||||
trait Base {
|
||||
val x: Any
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
|
||||
open class Base {
|
||||
val foo: Int = 42
|
||||
}
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A(var g: A) {
|
||||
val f: Int = 0
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
fun test() {
|
||||
::foo : KExtensionProperty<A, String>
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
val String.countCharacters: Int
|
||||
get() = length
|
||||
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
|
||||
class A<T>(val t: T) {
|
||||
val foo: T = t
|
||||
}
|
||||
|
||||
+2
@@ -13,6 +13,8 @@ public class JavaClass {
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun test() {
|
||||
JavaClass::publicFinal : KMemberProperty<JavaClass, Int>
|
||||
JavaClass::publicMutable : KMutableMemberProperty<JavaClass, Long>
|
||||
|
||||
+2
@@ -15,6 +15,8 @@ public class JavaClass {
|
||||
|
||||
import JavaClass.*
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun test() {
|
||||
::publicFinal : KTopLevelProperty<String>
|
||||
::publicMutable : KMutableTopLevelProperty<Any?>
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
val foo: Unit = Unit.VALUE
|
||||
var bar: String = ""
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
class A {
|
||||
val foo: Int = 42
|
||||
var bar: String = ""
|
||||
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
import kotlin.reflect.*
|
||||
|
||||
var x: Int = 42
|
||||
val y: String get() = "y"
|
||||
|
||||
|
||||
@@ -16,4 +16,6 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.reflect.KCallable
|
||||
|
||||
trait KCallableImpl<out R> : KCallable<R>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
enum class KClassOrigin {
|
||||
BUILT_IN
|
||||
KOTLIN
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.reflect.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
open class KForeignMemberProperty<T : Any, out R>(
|
||||
public override val name: String,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.reflect.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
// TODO: properties of built-in classes
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
import kotlin.reflect.*
|
||||
|
||||
class KPackageImpl(
|
||||
val jClass: Class<*>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.reflect.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
trait KPropertyImpl<out R> : KProperty<R>, KCallableImpl<R> {
|
||||
val field: Field?
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.reflect.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
open class KTopLevelExtensionPropertyImpl<T, out R>(
|
||||
public override val name: String,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import java.lang.reflect.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
open class KTopLevelVariableImpl<out R>(
|
||||
public override val name: String,
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
trait KVariableImpl<out R> : KVariable<R>, KPropertyImpl<R>
|
||||
|
||||
trait KMutableVariableImpl<R> : KMutableVariable<R>, KVariableImpl<R>, KMutablePropertyImpl<R>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.reflect.*
|
||||
|
||||
fun <T> kClass(jClass: Class<T>): KClassImpl<T> =
|
||||
KClassImpl<T>(jClass)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package kotlin.reflect.jvm
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.jvm.internal.*
|
||||
|
||||
public var <R> KProperty<R>.accessible: Boolean
|
||||
|
||||
@@ -49,8 +49,7 @@ public final class AnalyzerFacadeForJS {
|
||||
public static final List<ImportPath> DEFAULT_IMPORTS = ImmutableList.of(
|
||||
new ImportPath("js.*"),
|
||||
new ImportPath("java.lang.*"),
|
||||
new ImportPath("kotlin.*"),
|
||||
new ImportPath("kotlin.reflect.*")
|
||||
new ImportPath("kotlin.*")
|
||||
);
|
||||
|
||||
private AnalyzerFacadeForJS() {
|
||||
|
||||
Reference in New Issue
Block a user