Code cleanup: type parameters can have in / out variance
This commit is contained in:
@@ -26,7 +26,7 @@ interface FunctionHandle {
|
||||
fun getOverridden(): Iterable<FunctionHandle>
|
||||
}
|
||||
|
||||
data class Bridge<Signature>(
|
||||
data class Bridge<out Signature>(
|
||||
val from: Signature,
|
||||
val to: Signature
|
||||
) {
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import org.jetbrains.kotlin.utils.singletonOrEmptyList
|
||||
import java.util.*
|
||||
|
||||
class BridgeForBuiltinSpecial<Signature : Any>(
|
||||
class BridgeForBuiltinSpecial<out Signature : Any>(
|
||||
val from: Signature, val to: Signature,
|
||||
val isSpecial: Boolean = false,
|
||||
val isDelegateToSuper: Boolean = false
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodInsnNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
|
||||
abstract class ObjectTransformer<T : TransformationInfo>(@JvmField val transformationInfo: T, val state: GenerationState) {
|
||||
abstract class ObjectTransformer<out T : TransformationInfo>(@JvmField val transformationInfo: T, val state: GenerationState) {
|
||||
|
||||
abstract fun doTransform(parentRemapper: FieldRemapper): InlineResult
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class TryCatchPosition {
|
||||
INNER
|
||||
}
|
||||
|
||||
class SplitPair<T: Interval>(val patchedPart: T, val newPart: T)
|
||||
class SplitPair<out T: Interval>(val patchedPart: T, val newPart: T)
|
||||
|
||||
class SimpleInterval(override val startLabel: LabelNode, override val endLabel: LabelNode ) : Interval
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class JvmDependenciesIndex(_roots: List<JavaRoot>) {
|
||||
return result
|
||||
}
|
||||
|
||||
private data class HandleResult<T : Any>(val result: T?, val continueSearch: Boolean)
|
||||
private data class HandleResult<out T : Any>(val result: T?, val continueSearch: Boolean)
|
||||
|
||||
private fun <T : Any> search(
|
||||
request: SearchRequest,
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ interface CompileService : Remote {
|
||||
|
||||
sealed class CallResult<out R> : Serializable {
|
||||
|
||||
class Good<R>(val result: R) : CallResult<R>() {
|
||||
class Good<out R>(val result: R) : CallResult<R>() {
|
||||
override fun get(): R = result
|
||||
override fun equals(other: Any?): Boolean = other is Good<*> && this.result == other.result
|
||||
override fun hashCode(): Int = this.javaClass.hashCode() + (result?.hashCode() ?: 1)
|
||||
|
||||
+23
-23
@@ -55,13 +55,13 @@ val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() =
|
||||
val CLASSPATH_ID_DIGEST = "MD5"
|
||||
|
||||
|
||||
open class PropMapper<C, V, P : KMutableProperty1<C, V>>(val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null) {
|
||||
open class PropMapper<C, V, out P : KMutableProperty1<C, V>>(val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null) {
|
||||
open fun toArgs(prefix: String = COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX): List<String> =
|
||||
when {
|
||||
skipIf(prop.get(dest)) -> listOf<String>()
|
||||
@@ -73,34 +73,34 @@ open class PropMapper<C, V, P : KMutableProperty1<C, V>>(val dest: C,
|
||||
}
|
||||
|
||||
|
||||
class NullablePropMapper<C, V : Any?, P : KMutableProperty1<C, V>>(dest: C,
|
||||
prop: P,
|
||||
names: List<String> = listOf(),
|
||||
fromString: ((String) -> V),
|
||||
toString: ((V) -> String?) = { it.toString() },
|
||||
skipIf: ((V) -> Boolean) = { it == null },
|
||||
mergeDelimiter: String? = null)
|
||||
class NullablePropMapper<C, V : Any?, out P : KMutableProperty1<C, V>>(dest: C,
|
||||
prop: P,
|
||||
names: List<String> = listOf(),
|
||||
fromString: ((String) -> V),
|
||||
toString: ((V) -> String?) = { it.toString() },
|
||||
skipIf: ((V) -> Boolean) = { it == null },
|
||||
mergeDelimiter: String? = null)
|
||||
: PropMapper<C, V, P>(dest = dest, prop = prop, names = if (names.any()) names else listOf(prop.name),
|
||||
fromString = fromString, toString = toString, skipIf = skipIf, mergeDelimiter = mergeDelimiter)
|
||||
|
||||
|
||||
class StringPropMapper<C, P : KMutableProperty1<C, String>>(dest: C,
|
||||
prop: P,
|
||||
names: List<String> = listOf(),
|
||||
fromString: ((String) -> String) = { it },
|
||||
toString: ((String) -> String?) = { it.toString() },
|
||||
skipIf: ((String) -> Boolean) = { it.isEmpty() },
|
||||
mergeDelimiter: String? = null)
|
||||
class StringPropMapper<C, out P : KMutableProperty1<C, String>>(dest: C,
|
||||
prop: P,
|
||||
names: List<String> = listOf(),
|
||||
fromString: ((String) -> String) = { it },
|
||||
toString: ((String) -> String?) = { it.toString() },
|
||||
skipIf: ((String) -> Boolean) = { it.isEmpty() },
|
||||
mergeDelimiter: String? = null)
|
||||
: PropMapper<C, String, P>(dest = dest, prop = prop, names = if (names.any()) names else listOf(prop.name),
|
||||
fromString = fromString, toString = toString, skipIf = skipIf, mergeDelimiter = mergeDelimiter)
|
||||
|
||||
|
||||
class BoolPropMapper<C, P : KMutableProperty1<C, Boolean>>(dest: C, prop: P, names: List<String> = listOf())
|
||||
class BoolPropMapper<C, out P : KMutableProperty1<C, Boolean>>(dest: C, prop: P, names: List<String> = listOf())
|
||||
: PropMapper<C, Boolean, P>(dest = dest, prop = prop, names = if (names.any()) names else listOf(prop.name),
|
||||
fromString = { true }, toString = { null }, skipIf = { !prop.get(dest) })
|
||||
|
||||
|
||||
class RestPropMapper<C, P : KMutableProperty1<C, MutableCollection<String>>>(dest: C, prop: P)
|
||||
class RestPropMapper<C, out P : KMutableProperty1<C, MutableCollection<String>>>(dest: C, prop: P)
|
||||
: PropMapper<C, MutableCollection<String>, P>(dest = dest, prop = prop, toString = { null }, fromString = { arrayListOf() }) {
|
||||
override fun toArgs(prefix: String): List<String> = prop.get(dest).map { prefix + it }
|
||||
override fun apply(s: String) = add(s)
|
||||
|
||||
@@ -170,7 +170,7 @@ private fun <I : ControlFlowInfo<*>> updateEdgeDataForInstruction(
|
||||
}
|
||||
}
|
||||
|
||||
data class Edges<T>(val incoming: T, val outgoing: T)
|
||||
data class Edges<out T>(val incoming: T, val outgoing: T)
|
||||
|
||||
enum class TraverseInstructionResult {
|
||||
CONTINUE,
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.jumps.*
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.*
|
||||
import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.*
|
||||
|
||||
abstract class InstructionVisitorWithResult<R>() {
|
||||
abstract class InstructionVisitorWithResult<out R>() {
|
||||
abstract fun visitInstruction(instruction: Instruction): R
|
||||
|
||||
open fun visitAccessInstruction(instruction: AccessValueInstruction): R {
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
|
||||
open class PositioningStrategy<E : PsiElement> {
|
||||
open class PositioningStrategy<in E : PsiElement> {
|
||||
open fun markDiagnostic(diagnostic: ParametrizedDiagnostic<out E>): List<TextRange> {
|
||||
return mark(diagnostic.psiElement)
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.diagnostics.*
|
||||
sealed class RenderingContext {
|
||||
abstract operator fun <T> get(key: Key<T>): T
|
||||
|
||||
abstract class Key<T>(val name: String) {
|
||||
abstract class Key<out T>(val name: String) {
|
||||
abstract fun compute(objectsToRender: Collection<Any?>): T
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class DelegationResolver<T : CallableMemberDescriptor> private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
interface MemberExtractor<T : CallableMemberDescriptor> {
|
||||
interface MemberExtractor<out T : CallableMemberDescriptor> {
|
||||
fun getMembersByType(type: KotlinType): Collection<T>
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ object NonExpansiveInheritanceRestrictionChecker {
|
||||
}
|
||||
}
|
||||
|
||||
private data class ExpansiveEdge<T>(val from: T, val to: T)
|
||||
private data class ExpansiveEdge<out T>(val from: T, val to: T)
|
||||
|
||||
private interface Graph<T> {
|
||||
fun getNeighbors(node: T): Collection<T>
|
||||
|
||||
+2
-2
@@ -896,8 +896,8 @@ internal fun <A> unaryOperation(
|
||||
checker: Function1<Long, Long>
|
||||
) = UnaryOperationKey(a, functionName) to Pair(operation, checker) as Pair<Function1<Any?, Any>, Function1<Long, Long>>
|
||||
|
||||
internal data class BinaryOperationKey<A, B>(val f: CompileTimeType<out A>, val s: CompileTimeType<out B>, val functionName: String)
|
||||
internal data class UnaryOperationKey<A>(val f: CompileTimeType<out A>, val functionName: String)
|
||||
internal data class BinaryOperationKey<out A, out B>(val f: CompileTimeType<out A>, val s: CompileTimeType<out B>, val functionName: String)
|
||||
internal data class UnaryOperationKey<out A>(val f: CompileTimeType<out A>, val functionName: String)
|
||||
|
||||
fun ConstantValue<*>.isStandaloneOnlyConstant(): Boolean {
|
||||
return this is KClassValue || this is EnumValue || this is AnnotationValue || this is ArrayValue
|
||||
|
||||
@@ -19,7 +19,9 @@ package org.jetbrains.kotlin.resolve
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
|
||||
abstract class ImportedFromObjectCallableDescriptor<TCallable : CallableDescriptor>(val callableFromObject: TCallable) : CallableDescriptor {
|
||||
abstract class ImportedFromObjectCallableDescriptor<out TCallable : CallableDescriptor>(
|
||||
val callableFromObject: TCallable
|
||||
) : CallableDescriptor {
|
||||
val containingObject = callableFromObject.containingDeclaration as ClassDescriptor
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||
import java.util.*
|
||||
|
||||
abstract class AbstractLazyMemberScope<D : DeclarationDescriptor, DP : DeclarationProvider>
|
||||
abstract class AbstractLazyMemberScope<out D : DeclarationDescriptor, out DP : DeclarationProvider>
|
||||
protected constructor(
|
||||
protected val c: LazyClassContext,
|
||||
protected val declarationProvider: DP,
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ open class LazyClassMemberScope(
|
||||
return result
|
||||
}
|
||||
|
||||
private interface MemberExtractor<T : CallableMemberDescriptor> {
|
||||
private interface MemberExtractor<out T : CallableMemberDescriptor> {
|
||||
fun extract(extractFrom: KotlinType, name: Name): Collection<T>
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
open class MappedExtensionProvider<T, R>
|
||||
open class MappedExtensionProvider<T, out R>
|
||||
protected constructor(
|
||||
private val epName: ExtensionPointName<T>,
|
||||
private val map: (List<T>) -> R
|
||||
|
||||
@@ -21,10 +21,10 @@ import com.intellij.psi.PsiNamedElement
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
|
||||
interface KtLightElement<T : KtElement, D : PsiElement> : PsiNamedElement {
|
||||
interface KtLightElement<out T : KtElement, out D : PsiElement> : PsiNamedElement {
|
||||
val kotlinOrigin: T?
|
||||
|
||||
val clsDelegate: D
|
||||
}
|
||||
|
||||
interface KtLightDeclaration<T: KtDeclaration, D: PsiElement>: KtLightElement<T, D>
|
||||
interface KtLightDeclaration<out T: KtDeclaration, out D: PsiElement>: KtLightElement<T, D>
|
||||
+2
-2
@@ -27,14 +27,14 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.check
|
||||
|
||||
|
||||
class KnownResultProcessor<C>(
|
||||
class KnownResultProcessor<out C>(
|
||||
val result: Collection<C>
|
||||
): ScopeTowerProcessor<C> {
|
||||
override fun process(data: TowerData)
|
||||
= if (data == TowerData.Empty) listOfNotNull(result.check { it.isNotEmpty() }) else emptyList()
|
||||
}
|
||||
|
||||
class CompositeScopeTowerProcessor<C>(
|
||||
class CompositeScopeTowerProcessor<out C>(
|
||||
vararg val processors: ScopeTowerProcessor<C>
|
||||
) : ScopeTowerProcessor<C> {
|
||||
override fun process(data: TowerData): List<Collection<C>> = processors.flatMap { it.process(data) }
|
||||
|
||||
@@ -38,7 +38,7 @@ interface Candidate<out D : CallableDescriptor> {
|
||||
val status: ResolutionCandidateStatus
|
||||
}
|
||||
|
||||
interface TowerContext<D : CallableDescriptor, C: Candidate<D>> {
|
||||
interface TowerContext<D : CallableDescriptor, out C: Candidate<D>> {
|
||||
val name: Name
|
||||
val scopeTower: ScopeTower
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ val CandidateWithBoundDispatchReceiver<*>.requiresExtensionReceiver: Boolean
|
||||
|
||||
fun DataFlowDecorator.getAllPossibleTypes(receiver: ReceiverValue) = getSmartCastTypes(receiver) + receiver.type
|
||||
|
||||
internal class CandidateWithBoundDispatchReceiverImpl<D : CallableDescriptor>(
|
||||
internal class CandidateWithBoundDispatchReceiverImpl<out D : CallableDescriptor>(
|
||||
override val dispatchReceiver: ReceiverValue?,
|
||||
override val descriptor: D,
|
||||
override val diagnostics: List<ResolutionDiagnostic>
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.utils
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class CachedValueProperty<TValue : Any, TTimestamp : Any>(
|
||||
class CachedValueProperty<out TValue : Any, TTimestamp : Any>(
|
||||
private val calculator: () -> TValue,
|
||||
private val timestampCalculator: () -> TTimestamp
|
||||
) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.utils.concurrent.block
|
||||
|
||||
class LockedClearableLazyValue<T: Any>(val lock: Any, val init: () -> T) {
|
||||
class LockedClearableLazyValue<out T: Any>(val lock: Any, val init: () -> T) {
|
||||
@Volatile private var value: T? = null
|
||||
|
||||
fun get(): T {
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ private fun List<Annotations>.compositeAnnotationsOrSingle() = when (size) {
|
||||
|
||||
private fun TypeComponentPosition.shouldEnhance() = this != TypeComponentPosition.INFLEXIBLE
|
||||
|
||||
private data class EnhancementResult<T>(val result: T, val enhancementAnnotations: Annotations?)
|
||||
private data class EnhancementResult<out T>(val result: T, val enhancementAnnotations: Annotations?)
|
||||
private fun <T> T.noChange() = EnhancementResult(this, null)
|
||||
private fun <T> T.enhancedNullability() = EnhancementResult(this, ENHANCED_NULLABILITY_ANNOTATIONS)
|
||||
private fun <T> T.enhancedMutability() = EnhancementResult(this, ENHANCED_MUTABILITY_ANNOTATIONS)
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ abstract class AbstractBinaryClassAnnotationAndConstantLoader<A : Any, C : Any,
|
||||
}
|
||||
}
|
||||
|
||||
private class Storage<A, C>(
|
||||
private class Storage<out A, out C>(
|
||||
val memberAnnotations: Map<MemberSignature, List<A>>,
|
||||
val propertyConstants: Map<MemberSignature, C>
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.builtins
|
||||
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
class BuiltInsInitializer<T : KotlinBuiltIns>(
|
||||
class BuiltInsInitializer<out T : KotlinBuiltIns>(
|
||||
private val constructor: () -> T
|
||||
) {
|
||||
@Volatile private var instance: T? = null
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class ConstantValue<out T>(open val value: T) {
|
||||
override fun toString() = value.toString()
|
||||
}
|
||||
|
||||
abstract class IntegerValueConstant<T> protected constructor(value: T) : ConstantValue<T>(value)
|
||||
abstract class IntegerValueConstant<out T> protected constructor(value: T) : ConstantValue<T>(value)
|
||||
|
||||
class AnnotationValue(value: AnnotationDescriptor) : ConstantValue<AnnotationDescriptor>(value) {
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.checker.KotlinTypeChecker
|
||||
import org.jetbrains.kotlin.types.typeUtil.builtIns
|
||||
import java.util.*
|
||||
|
||||
data class ApproximationBounds<T>(
|
||||
data class ApproximationBounds<out T>(
|
||||
val lower: T,
|
||||
val upper: T
|
||||
)
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
// The MessageLite instance everywhere should be Constructor, Function or Property
|
||||
// TODO: simplify this interface
|
||||
interface AnnotationAndConstantLoader<A : Any, C : Any, T : Any> {
|
||||
interface AnnotationAndConstantLoader<out A : Any, out C : Any, out T : Any> {
|
||||
fun loadClassAnnotations(
|
||||
container: ProtoContainer.Class
|
||||
): List<A>
|
||||
|
||||
@@ -18,20 +18,20 @@ package org.jetbrains.kotlin.storage
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
interface MemoizedFunctionToNotNull<P, R : Any> : Function1<P, R> {
|
||||
interface MemoizedFunctionToNotNull<in P, out R : Any> : Function1<P, R> {
|
||||
fun isComputed(key: P): Boolean
|
||||
}
|
||||
|
||||
interface MemoizedFunctionToNullable<P, R : Any> : Function1<P, R?> {
|
||||
interface MemoizedFunctionToNullable<in P, out R : Any> : Function1<P, R?> {
|
||||
fun isComputed(key: P): Boolean
|
||||
}
|
||||
|
||||
interface NotNullLazyValue<T : Any> : Function0<T> {
|
||||
interface NotNullLazyValue<out T : Any> : Function0<T> {
|
||||
fun isComputed(): Boolean
|
||||
fun isComputing(): Boolean
|
||||
}
|
||||
|
||||
interface NullableLazyValue<T : Any> : Function0<T?> {
|
||||
interface NullableLazyValue<out T : Any> : Function0<T?> {
|
||||
fun isComputed(): Boolean
|
||||
fun isComputing(): Boolean
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class NotInitialized(override val asmType: Type): Value {
|
||||
override fun toString() = "NotInitialized: $asmType"
|
||||
}
|
||||
|
||||
abstract class AbstractValueBase<V>(
|
||||
abstract class AbstractValueBase<out V>(
|
||||
override val asmType: Type
|
||||
) : Value {
|
||||
override val valid = true
|
||||
|
||||
@@ -108,7 +108,7 @@ sealed class CallType<TReceiver : KtElement?>(val descriptorKindFilter: Descript
|
||||
}
|
||||
}
|
||||
|
||||
sealed class CallTypeAndReceiver<TReceiver : KtElement?, TCallType : CallType<TReceiver>>(
|
||||
sealed class CallTypeAndReceiver<TReceiver : KtElement?, out TCallType : CallType<TReceiver>>(
|
||||
val callType: TCallType,
|
||||
val receiver: TReceiver
|
||||
) {
|
||||
|
||||
+1
-1
@@ -544,7 +544,7 @@ class KotlinPsiUnifier(
|
||||
decl2: KtClassOrObject,
|
||||
desc1: ClassDescriptor,
|
||||
desc2: ClassDescriptor): Status? {
|
||||
class OrderInfo<T>(
|
||||
class OrderInfo<out T>(
|
||||
val orderSensitive: List<T>,
|
||||
val orderInsensitive: List<T>
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.idea.caches
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
|
||||
data class CachedAttributeData<T>(val value: T, val timeStamp: Long)
|
||||
data class CachedAttributeData<out T>(val value: T, val timeStamp: Long)
|
||||
|
||||
interface FileAttributeService {
|
||||
fun register(id: String, version: Int) {}
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.util.CachedValuesManager
|
||||
import com.intellij.psi.util.CachedValueProvider
|
||||
|
||||
class SynchronizedCachedValue<V>(project: Project, provider: () -> CachedValueProvider.Result<V>, trackValue: Boolean = true) {
|
||||
class SynchronizedCachedValue<out V>(project: Project, provider: () -> CachedValueProvider.Result<V>, trackValue: Boolean = true) {
|
||||
private val cachedValue = CachedValuesManager.getManager(project).createCachedValue(
|
||||
provider,
|
||||
trackValue
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.utils.keysToMap
|
||||
|
||||
data class DecompiledText(val text: String, val index: DecompiledTextIndex)
|
||||
|
||||
interface DecompiledTextIndexer<T: Any> {
|
||||
interface DecompiledTextIndexer<out T: Any> {
|
||||
fun indexDescriptor(descriptor: DeclarationDescriptor): Collection<T>
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class ShortenReferences(val options: (KtElement) -> Options = { Options.DEFAULT
|
||||
return visitor.getDescriptorsToImport()
|
||||
}
|
||||
|
||||
private abstract class ShorteningVisitor<T : KtElement>(
|
||||
private abstract class ShorteningVisitor<in T : KtElement>(
|
||||
protected val file: KtFile,
|
||||
protected val elementFilter: (PsiElement) -> FilterResult,
|
||||
protected val failedToImportDescriptors: Set<DeclarationDescriptor>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ object ConfigureKotlinNotificationManager: KotlinSingleNotificationManager<Confi
|
||||
}
|
||||
}
|
||||
|
||||
interface KotlinSingleNotificationManager<T: Notification> {
|
||||
interface KotlinSingleNotificationManager<in T: Notification> {
|
||||
fun notify(project: Project, notification: T) {
|
||||
val notificationsManager = NotificationsManager.getNotificationsManager() ?: return
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
abstract class KotlinQuickFixAction<T : PsiElement>(protected val element: T) : IntentionAction {
|
||||
abstract class KotlinQuickFixAction<out T : PsiElement>(protected val element: T) : IntentionAction {
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||
return element.isValid &&
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinParameterInfo
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
|
||||
data class CreateParameterData<E : KtElement>(
|
||||
data class CreateParameterData<out E : KtElement>(
|
||||
val context: BindingContext,
|
||||
val parameterInfo: KotlinParameterInfo,
|
||||
val originalExpression: E
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
||||
import java.util.*
|
||||
|
||||
abstract class CallableRefactoring<T: CallableDescriptor>(
|
||||
abstract class CallableRefactoring<out T: CallableDescriptor>(
|
||||
val project: Project,
|
||||
val callableDescriptor: T,
|
||||
val commandName: String) {
|
||||
|
||||
@@ -104,7 +104,7 @@ class TypeConverter(val converter: Converter) {
|
||||
}
|
||||
}
|
||||
|
||||
private abstract inner class TypeFlavor<T>(val default: T) {
|
||||
private abstract inner class TypeFlavor<out T>(val default: T) {
|
||||
private val cache = HashMap<PsiElement, T>()
|
||||
private val typesBeingCalculated = HashSet<PsiElement>()
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.dart.compiler.backend.js.ast.JsNode
|
||||
import org.jetbrains.kotlin.js.inline.util.IdentitySet
|
||||
import java.util.*
|
||||
|
||||
internal class ReferenceTracker<Reference, RemoveCandidate : JsNode> {
|
||||
internal class ReferenceTracker<in Reference, RemoveCandidate : JsNode> {
|
||||
private val reachable = IdentityHashMap<Reference, Boolean>()
|
||||
private val removableCandidates = IdentityHashMap<Reference, RemoveCandidate>()
|
||||
private val referenceFromTo = IdentityHashMap<Reference, MutableSet<Reference>>()
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ fun computeExplicitReceiversForInvoke(
|
||||
}
|
||||
}
|
||||
|
||||
abstract class CallCase<I : CallInfo> {
|
||||
abstract class CallCase<in I : CallInfo> {
|
||||
|
||||
protected open fun I.unsupported(message: String = "") : Nothing = throw IllegalStateException("this case unsupported. $this")
|
||||
|
||||
@@ -186,7 +186,7 @@ abstract class FunctionCallCase : CallCase<FunctionCallInfo>()
|
||||
|
||||
abstract class VariableAccessCase : CallCase<VariableAccessInfo>()
|
||||
|
||||
interface DelegateIntrinsic<I : CallInfo> {
|
||||
interface DelegateIntrinsic<in I : CallInfo> {
|
||||
fun I.canBeApply(): Boolean = true
|
||||
fun I.getDescriptor(): CallableDescriptor
|
||||
fun I.getArgs(): List<JsExpression>
|
||||
|
||||
Reference in New Issue
Block a user