Remove old 'get' delegate convention in interfaces
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
|||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.NO_REFLECTION_IN_CLASS_PATH
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm.NO_REFLECTION_IN_CLASS_PATH
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.findClassAcrossModuleDependencies
|
import org.jetbrains.kotlin.serialization.deserialization.findClassAcrossModuleDependencies
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.get
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget.*
|
|||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.get
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This class lazily splits Annotations into several different Annotations according to declaration site target priority on property.
|
This class lazily splits Annotations into several different Annotations according to declaration site target priority on property.
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ import com.intellij.openapi.util.UserDataHolder
|
|||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
|
||||||
public class UserDataProperty<in R: UserDataHolder, T : Any>(val key: Key<T>, val default: T? = null) {
|
public class UserDataProperty<in R: UserDataHolder, T : Any>(val key: Key<T>, val default: T? = null) {
|
||||||
fun get(thisRef: R, desc: kotlin.PropertyMetadata) = getValue(thisRef, desc)
|
|
||||||
fun set(thisRef: R, desc: kotlin.PropertyMetadata, value: T?) = setValue(thisRef, desc, value)
|
|
||||||
|
|
||||||
fun getValue(thisRef: R, desc: kotlin.PropertyMetadata): T? {
|
fun getValue(thisRef: R, desc: kotlin.PropertyMetadata): T? {
|
||||||
return thisRef.getUserData(key)
|
return thisRef.getUserData(key)
|
||||||
}
|
}
|
||||||
@@ -35,9 +32,6 @@ public class UserDataProperty<in R: UserDataHolder, T : Any>(val key: Key<T>, va
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class NotNullableUserDataProperty<in R: UserDataHolder, T : Any>(val key: Key<T>, val defaultValue: T) {
|
public class NotNullableUserDataProperty<in R: UserDataHolder, T : Any>(val key: Key<T>, val defaultValue: T) {
|
||||||
fun get(thisRef: R, desc: kotlin.PropertyMetadata) = getValue(thisRef, desc)
|
|
||||||
fun set(thisRef: R, desc: kotlin.PropertyMetadata, value: T) = setValue(thisRef, desc, value)
|
|
||||||
|
|
||||||
fun getValue(thisRef: R, desc: kotlin.PropertyMetadata): T {
|
fun getValue(thisRef: R, desc: kotlin.PropertyMetadata): T {
|
||||||
return thisRef.getUserData(key) ?: defaultValue
|
return thisRef.getUserData(key) ?: defaultValue
|
||||||
}
|
}
|
||||||
@@ -48,9 +42,6 @@ public class NotNullableUserDataProperty<in R: UserDataHolder, T : Any>(val key:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class CopyableUserDataProperty<in R: PsiElement, T : Any>(val key: Key<T>, val default: T? = null) {
|
public class CopyableUserDataProperty<in R: PsiElement, T : Any>(val key: Key<T>, val default: T? = null) {
|
||||||
fun get(thisRef: R, desc: kotlin.PropertyMetadata) = getValue(thisRef, desc)
|
|
||||||
fun set(thisRef: R, desc: kotlin.PropertyMetadata, value: T?) = setValue(thisRef, desc, value)
|
|
||||||
|
|
||||||
fun getValue(thisRef: R, property: PropertyMetadata): T? {
|
fun getValue(thisRef: R, property: PropertyMetadata): T? {
|
||||||
return thisRef.getCopyableUserData(key)
|
return thisRef.getCopyableUserData(key)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.*
|
|||||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.get
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.utils.sure
|
import org.jetbrains.kotlin.utils.sure
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class CachedValueProperty<TValue : Any, TTimestamp : Any>(
|
|||||||
private var value: TValue? = null
|
private var value: TValue? = null
|
||||||
private var timestamp: TTimestamp? = null
|
private var timestamp: TTimestamp? = null
|
||||||
|
|
||||||
public override fun get(thisRef: Any?, desc: PropertyMetadata): TValue {
|
public override fun getValue(thisRef: Any?, desc: PropertyMetadata): TValue {
|
||||||
val currentTimestamp = timestampCalculator()
|
val currentTimestamp = timestampCalculator()
|
||||||
if (value == null || timestamp != currentTimestamp) {
|
if (value == null || timestamp != currentTimestamp) {
|
||||||
value = calculator()
|
value = calculator()
|
||||||
|
|||||||
-1
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.load.java.structure.JavaPackage
|
|||||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinarySourceElement
|
||||||
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils
|
import org.jetbrains.kotlin.load.kotlin.PackageClassUtils
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.storage.get
|
|
||||||
|
|
||||||
class LazyJavaPackageFragment(
|
class LazyJavaPackageFragment(
|
||||||
private val c: LazyJavaResolverContext,
|
private val c: LazyJavaResolverContext,
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class ReflectionTypes(private val module: ModuleDescriptor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private object ClassLookup {
|
private object ClassLookup {
|
||||||
fun get(types: ReflectionTypes, property: PropertyMetadata) = getValue(types, property)
|
|
||||||
fun getValue(types: ReflectionTypes, property: PropertyMetadata): ClassDescriptor {
|
fun getValue(types: ReflectionTypes, property: PropertyMetadata): ClassDescriptor {
|
||||||
return types.find(property.name.capitalize())
|
return types.find(property.name.capitalize())
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -27,7 +27,6 @@ import org.jetbrains.kotlin.resolve.scopes.JetScope
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.LazyScopeAdapter
|
import org.jetbrains.kotlin.resolve.scopes.LazyScopeAdapter
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.storage.get
|
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
|
|
||||||
public class LazyPackageViewDescriptorImpl(
|
public class LazyPackageViewDescriptorImpl(
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
|
|||||||
if (field.getModifiers().and(Modifier.STATIC) != 0) continue
|
if (field.getModifiers().and(Modifier.STATIC) != 0) continue
|
||||||
field.setAccessible(true)
|
field.setAccessible(true)
|
||||||
val property = field.get(this) as? ObservableProperty<*> ?: continue
|
val property = field.get(this) as? ObservableProperty<*> ?: continue
|
||||||
val value = property.get(this, PropertyMetadataImpl("")/* not used*/)
|
val value = property.getValue(this, PropertyMetadataImpl("")/* not used*/)
|
||||||
field.set(copy, copy.property(value as Any))
|
field.set(copy, copy.property(value as Any))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.serialization.SerializedResourcePaths
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPackageMemberScope
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.storage.get
|
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|||||||
-1
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.serialization.ProtoBuf
|
|||||||
import org.jetbrains.kotlin.serialization.deserialization.DeserializationComponents
|
import org.jetbrains.kotlin.serialization.deserialization.DeserializationComponents
|
||||||
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
import org.jetbrains.kotlin.storage.get
|
|
||||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||||
|
|
||||||
public open class DeserializedPackageMemberScope(
|
public open class DeserializedPackageMemberScope(
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ public interface NullableLazyValue<T : Any> : Function0<T?> {
|
|||||||
public fun isComputed(): Boolean
|
public fun isComputed(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T : Any> NotNullLazyValue<T>.get(_this: Any?, p: PropertyMetadata): T = invoke()
|
|
||||||
|
|
||||||
public fun <T : Any> NullableLazyValue<T>.get(_this: Any?, p: PropertyMetadata): T? = invoke()
|
|
||||||
|
|
||||||
public fun <T : Any> NotNullLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T = invoke()
|
public fun <T : Any> NotNullLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T = invoke()
|
||||||
|
|
||||||
public fun <T : Any> NullableLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T? = invoke()
|
public fun <T : Any> NullableLazyValue<T>.getValue(_this: Any?, p: PropertyMetadata): T? = invoke()
|
||||||
|
|||||||
Vendored
+1
@@ -1,4 +1,5 @@
|
|||||||
// "Create class 'Foo'" "true"
|
// "Create class 'Foo'" "true"
|
||||||
|
// ERROR: <html>Class 'Foo' must be declared abstract or implement abstract member<br/><b>public</b> <b>abstract</b> <b>fun</b> getValue(thisRef: A<T>, property: kotlin.PropertyMetadata): B <i>defined in</i> kotlin.properties.ReadOnlyProperty</html>
|
||||||
|
|
||||||
open class B
|
open class B
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,6 +1,7 @@
|
|||||||
import kotlin.properties.ReadOnlyProperty
|
import kotlin.properties.ReadOnlyProperty
|
||||||
|
|
||||||
// "Create class 'Foo'" "true"
|
// "Create class 'Foo'" "true"
|
||||||
|
// ERROR: <html>Class 'Foo' must be declared abstract or implement abstract member<br/><b>public</b> <b>abstract</b> <b>fun</b> getValue(thisRef: A<T>, property: kotlin.PropertyMetadata): B <i>defined in</i> kotlin.properties.ReadOnlyProperty</html>
|
||||||
|
|
||||||
open class B
|
open class B
|
||||||
|
|
||||||
|
|||||||
-13
@@ -1,5 +1,3 @@
|
|||||||
import kotlin.Deprecated;
|
|
||||||
import kotlin.PropertyMetadata;
|
|
||||||
import kotlin.properties.ReadOnlyProperty;
|
import kotlin.properties.ReadOnlyProperty;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -8,16 +6,5 @@ class J {
|
|||||||
public static class Foo<T> implements ReadOnlyProperty<A<T>, B> {
|
public static class Foo<T> implements ReadOnlyProperty<A<T>, B> {
|
||||||
public Foo(T t, @NotNull String s) {
|
public Foo(T t, @NotNull String s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Deprecated
|
|
||||||
public B get(@NotNull A<T> thisRef, @NotNull PropertyMetadata property) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public B getValue(@NotNull A<T> thisRef, @NotNull PropertyMetadata property) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
-3
@@ -17,9 +17,6 @@
|
|||||||
package com.google.dart.compiler.backend.js.ast.metadata
|
package com.google.dart.compiler.backend.js.ast.metadata
|
||||||
|
|
||||||
internal class MetadataProperty<in T : HasMetadata, R>(val default: R) {
|
internal class MetadataProperty<in T : HasMetadata, R>(val default: R) {
|
||||||
fun get(thisRef: T, desc: kotlin.PropertyMetadata) = getValue(thisRef, desc)
|
|
||||||
fun set(thisRef: T, desc: kotlin.PropertyMetadata, value: R) = setValue(thisRef, desc, value)
|
|
||||||
|
|
||||||
fun getValue(thisRef: T, desc: PropertyMetadata): R {
|
fun getValue(thisRef: T, desc: PropertyMetadata): R {
|
||||||
if (!thisRef.hasData(desc.name)) return default
|
if (!thisRef.hasData(desc.name)) return default
|
||||||
return thisRef.getData<R>(desc.name)
|
return thisRef.getData<R>(desc.name)
|
||||||
|
|||||||
@@ -260,8 +260,6 @@ public abstract class MapVar<T, K, V>() : MapVal<T, K, V>(), ReadWriteProperty<T
|
|||||||
map.put(key(property), value)
|
map.put(key(property), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun get(thisRef: T, property: PropertyMetadata) = getValue(thisRef, property)
|
|
||||||
|
|
||||||
override fun getValue(thisRef: T, property: PropertyMetadata): V {
|
override fun getValue(thisRef: T, property: PropertyMetadata): V {
|
||||||
return super<MapVal>.getValue(thisRef, property)
|
return super<MapVal>.getValue(thisRef, property)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,7 @@ public interface ReadOnlyProperty<in R, out T> {
|
|||||||
* @param property the metadata for the property.
|
* @param property the metadata for the property.
|
||||||
* @return the property value.
|
* @return the property value.
|
||||||
*/
|
*/
|
||||||
public fun getValue(thisRef: R, property: PropertyMetadata): T = get(thisRef, property)
|
public fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||||
|
|
||||||
//TODO drop after bootstrap
|
|
||||||
@Deprecated("Use getValue() instead.", ReplaceWith("getValue(thisRef, property)"))
|
|
||||||
public fun get(thisRef: R, property: PropertyMetadata): T = getValue(thisRef, property)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,11 +36,7 @@ public interface ReadWriteProperty<in R, T> {
|
|||||||
* @param property the metadata for the property.
|
* @param property the metadata for the property.
|
||||||
* @return the property value.
|
* @return the property value.
|
||||||
*/
|
*/
|
||||||
public fun getValue(thisRef: R, property: PropertyMetadata): T = get(thisRef, property)
|
public fun getValue(thisRef: R, property: PropertyMetadata): T
|
||||||
|
|
||||||
//TODO drop after bootstrap
|
|
||||||
@Deprecated("Use getValue() instead.", ReplaceWith("getValue(thisRef, property)"))
|
|
||||||
public fun get(thisRef: R, property: PropertyMetadata): T = getValue(thisRef, property)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value of the property for the given object.
|
* Sets the value of the property for the given object.
|
||||||
@@ -52,11 +44,5 @@ public interface ReadWriteProperty<in R, T> {
|
|||||||
* @param property the metadata for the property.
|
* @param property the metadata for the property.
|
||||||
* @param value the value to set.
|
* @param value the value to set.
|
||||||
*/
|
*/
|
||||||
public fun setValue(thisRef: R, property: PropertyMetadata, value: T) {
|
public fun setValue(thisRef: R, property: PropertyMetadata, value: T)
|
||||||
set(thisRef, property, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO drop after bootstrap
|
|
||||||
@Deprecated("Use setValue() instead.", ReplaceWith("setValue(thisRef, property, value)"))
|
|
||||||
public fun set(thisRef: R, property: PropertyMetadata, value: T) = setValue(thisRef, property, value)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ package kotlin.properties
|
|||||||
*/
|
*/
|
||||||
public fun <V> Map<in String, *>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
public fun <V> Map<in String, *>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
||||||
|
|
||||||
@Deprecated("Use getValue() instead")
|
|
||||||
public fun <V> Map<in String, *>.get(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the property for the given object from this mutable map.
|
* Returns the value of the property for the given object from this mutable map.
|
||||||
* @param thisRef the object for which the value is requested (not used).
|
* @param thisRef the object for which the value is requested (not used).
|
||||||
@@ -27,10 +24,6 @@ public fun <V> Map<in String, *>.get(thisRef: Any?, property: PropertyMetadata):
|
|||||||
@kotlin.jvm.JvmName("getVar")
|
@kotlin.jvm.JvmName("getVar")
|
||||||
public fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
public fun <V> MutableMap<in String, in V>.getValue(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
||||||
|
|
||||||
@Deprecated("Use getValue() instead")
|
|
||||||
@kotlin.jvm.JvmName("getVarDeprecated")
|
|
||||||
public fun <V> MutableMap<in String, in V>.get(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the value of the property for the given object in this mutable map.
|
* Stores the value of the property for the given object in this mutable map.
|
||||||
* @param thisRef the object for which the value is requested (not used).
|
* @param thisRef the object for which the value is requested (not used).
|
||||||
@@ -39,9 +32,4 @@ public fun <V> MutableMap<in String, in V>.get(thisRef: Any?, property: Property
|
|||||||
*/
|
*/
|
||||||
public fun <V> MutableMap<in String, in V>.setValue(thisRef: Any?, property: PropertyMetadata, value: V) {
|
public fun <V> MutableMap<in String, in V>.setValue(thisRef: Any?, property: PropertyMetadata, value: V) {
|
||||||
this.put(property.name, value)
|
this.put(property.name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated("Use setValue() instead")
|
|
||||||
public fun <V> MutableMap<in String, in V>.set(thisRef: Any?, property: PropertyMetadata, value: V) {
|
|
||||||
this.put(property.name, value)
|
|
||||||
}
|
|
||||||
@@ -76,9 +76,6 @@ public fun lazy<T>(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLazy
|
|||||||
*/
|
*/
|
||||||
public fun <T> Lazy<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
public fun <T> Lazy<T>.getValue(thisRef: Any?, property: PropertyMetadata): T = value
|
||||||
|
|
||||||
@Deprecated("Use getValue() instead")
|
|
||||||
public fun <T> Lazy<T>.get(thisRef: Any?, property: PropertyMetadata): T = value
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies how a [Lazy] instance synchronizes access among multiple threads.
|
* Specifies how a [Lazy] instance synchronizes access among multiple threads.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user