Remove default import "kotlin.reflect"

Basic reflection is usable without any imports (with :: literals)

This reverts commit 9503056dd5.
This commit is contained in:
Alexander Udalov
2014-07-01 17:42:35 +04:00
parent d32a02f21a
commit a38a396a43
67 changed files with 122 additions and 4 deletions
@@ -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 {
@@ -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 {
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A {
fun main() {
val x = ::A
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A
class B
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A
class B {
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A
fun main() {
@@ -12,6 +12,8 @@ class A {
package other
import kotlin.reflect.*
import first.A
fun main() {
@@ -12,6 +12,8 @@ fun A.baz() {}
package other
import kotlin.reflect.KExtensionFunction0
import first.A
import first.foo
@@ -10,6 +10,8 @@ fun baz() = "OK"
package other
import kotlin.reflect.*
import first.foo
import first.bar
import first.baz
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun main() {
val x = ::foo
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun A.main() {
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class B
class A {
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun A.foo() {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun foo() {}
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
class A<T>(val t: T) {
fun foo(): T = t
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
class A {
inner class Inner
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
class A {
inner class Inner
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
class A {
inner class Inner
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
fun main() {
class A
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
fun main() {
class A
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
fun main() {
class A
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
fun main() {
class A
@@ -1,3 +1,5 @@
import kotlin.reflect.*
fun main() {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun main() {
@@ -1,3 +1,5 @@
import kotlin.reflect.*
fun main() {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun main() {
@@ -8,6 +8,8 @@ class D {
// FILE: b.kt
import kotlin.reflect.KMemberFunction0
fun main() {
val x = a.b.c.D::foo
@@ -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
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A {
class Nested
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A {
class Nested
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KFunction0
class A {
class Nested
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
class A {
fun foo() = 42
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberFunction0
fun foo() {}
class A {
@@ -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
@@ -1,3 +1,5 @@
import kotlin.reflect.*
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
fun baz() = "OK"
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun foo() {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A
fun foo() {}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
fun foo() {}
fun bar(<!UNUSED_PARAMETER!>x<!>: Int) {}
fun baz() = "OK"
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberProperty
trait Base {
val x: Any
}
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberProperty
open class Base {
val foo: Int = 42
}
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A(var g: A) {
val f: Int = 0
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
fun test() {
::foo : KExtensionProperty<A, String>
@@ -1,3 +1,5 @@
import kotlin.reflect.*
val String.countCharacters: Int
get() = length
@@ -1,3 +1,5 @@
import kotlin.reflect.KMemberProperty
class A<T>(val t: T) {
val foo: T = t
}
@@ -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>
@@ -15,6 +15,8 @@ public class JavaClass {
import JavaClass.*
import kotlin.reflect.*
fun test() {
::publicFinal : KTopLevelProperty<String>
::publicMutable : KMutableTopLevelProperty<Any?>
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
val foo: Unit = Unit.VALUE
var bar: String = ""
@@ -1,3 +1,5 @@
import kotlin.reflect.*
class A {
val foo: Int = 42
var bar: String = ""
@@ -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() {