Drop KPackage and deprecated stuff from Reflection/ReflectionFactory
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package kotlin.reflect
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a package and provides introspection capabilities.
|
|
||||||
*/
|
|
||||||
@Deprecated("This class will be deleted soon because reflection on packages is going to be redesigned " +
|
|
||||||
"after the introduction of new kinds of runtime representations of packages on JVM.")
|
|
||||||
public interface KPackage : KDeclarationContainer
|
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("DEPRECATION")
|
|
||||||
package kotlin.reflect.jvm.internal
|
package kotlin.reflect.jvm.internal
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||||
@@ -26,9 +25,8 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||||
import kotlin.jvm.internal.KotlinPackage
|
import kotlin.jvm.internal.KotlinPackage
|
||||||
import kotlin.reflect.KCallable
|
import kotlin.reflect.KCallable
|
||||||
import kotlin.reflect.KPackage
|
|
||||||
|
|
||||||
internal class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl(), KPackage {
|
internal class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl() {
|
||||||
private val descriptor = ReflectProperties.lazySoft {
|
private val descriptor = ReflectProperties.lazySoft {
|
||||||
with(moduleData) {
|
with(moduleData) {
|
||||||
packageFacadeProvider.registerModule(moduleName)
|
packageFacadeProvider.registerModule(moduleName)
|
||||||
@@ -44,7 +42,6 @@ internal class KPackageImpl(override val jClass: Class<*>, val moduleName: Strin
|
|||||||
override val constructorDescriptors: Collection<ConstructorDescriptor>
|
override val constructorDescriptors: Collection<ConstructorDescriptor>
|
||||||
get() = emptyList()
|
get() = emptyList()
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
override fun getProperties(name: Name): Collection<PropertyDescriptor> =
|
override fun getProperties(name: Name): Collection<PropertyDescriptor> =
|
||||||
scope.getContributedVariables(name, NoLookupLocation.FROM_REFLECTION)
|
scope.getContributedVariables(name, NoLookupLocation.FROM_REFLECTION)
|
||||||
|
|
||||||
|
|||||||
@@ -87,16 +87,4 @@ public class ReflectionFactoryImpl extends ReflectionFactory {
|
|||||||
public KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
public KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
||||||
return p instanceof MutablePropertyReference2Impl ? new KMutableProperty2Augmented(p) : new KMutableProperty2FromReferenceImpl(p);
|
return p instanceof MutablePropertyReference2Impl ? new KMutableProperty2Augmented(p) : new KMutableProperty2FromReferenceImpl(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public KClass foreignKotlinClass(Class javaClass) {
|
|
||||||
return getOrCreateKotlinClass(javaClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public KPackage createKotlinPackage(Class javaClass, String moduleName) {
|
|
||||||
return new KPackageImpl(javaClass, moduleName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import kotlin.reflect.*;
|
|||||||
* This class serves as a facade to the actual reflection implementation. JVM back-end generates calls to static methods of this class
|
* This class serves as a facade to the actual reflection implementation. JVM back-end generates calls to static methods of this class
|
||||||
* on any reflection-using construct.
|
* on any reflection-using construct.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class Reflection {
|
public class Reflection {
|
||||||
private static final ReflectionFactory factory;
|
private static final ReflectionFactory factory;
|
||||||
|
|
||||||
@@ -104,22 +105,4 @@ public class Reflection {
|
|||||||
public static KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
public static KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
||||||
return factory.mutableProperty2(p);
|
return factory.mutableProperty2(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
// TODO: drop before 1.0
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static KPackage createKotlinPackage(Class javaClass, String moduleName) {
|
|
||||||
return (KPackage) factory.getOrCreateKotlinPackage(javaClass, moduleName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static KClass foreignKotlinClass(Class javaClass) {
|
|
||||||
return getOrCreateKotlinClass(javaClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static KClass[] foreignKotlinClasses(Class[] javaClasses) {
|
|
||||||
return getOrCreateKotlinClasses(javaClasses);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,16 +70,4 @@ public class ReflectionFactory {
|
|||||||
public KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
public KMutableProperty2 mutableProperty2(MutablePropertyReference2 p) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public KClass foreignKotlinClass(Class javaClass) {
|
|
||||||
return new ClassReference(javaClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public KPackage createKotlinPackage(Class javaClass, String moduleName) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user