Cleanup RC deprecations in compiler and plugin.

This commit is contained in:
Ilya Gorbunov
2016-01-26 21:53:07 +03:00
parent c7a0375c25
commit 744a7a83f7
68 changed files with 92 additions and 86 deletions
@@ -80,7 +80,7 @@ class LazyJavaAnnotationDescriptor(
val constructors = getAnnotationClass().constructors
if (constructors.isEmpty()) return mapOf()
val nameToArg = javaAnnotation.arguments.toMapBy { it.name }
val nameToArg = javaAnnotation.arguments.associateBy { it.name }
return constructors.first().valueParameters.keysToMapExceptNulls { valueParameter ->
var javaAnnotationArgument = nameToArg[valueParameter.getName()]
@@ -604,11 +604,11 @@ class LazyJavaClassMemberScope(
}
private val nestedClassIndex = c.storageManager.createLazyValue {
jClass.innerClasses.toMapBy { c -> c.name }
jClass.innerClasses.associateBy { c -> c.name }
}
private val enumEntryIndex = c.storageManager.createLazyValue {
jClass.fields.filter { it.isEnumEntry }.toMapBy { f -> f.name }
jClass.fields.filter { it.isEnumEntry }.associateBy { f -> f.name }
}
private val nestedClasses = c.storageManager.createMemoizedFunctionWithNullableValues {
@@ -58,7 +58,7 @@ open class ClassMemberIndex(val jClass: JavaClass, val memberFilter: (JavaMember
}
private val methods = jClass.methods.asSequence().filter(methodFilter).groupBy { m -> m.name }
private val fields = jClass.fields.asSequence().filter(memberFilter).toMapBy { m -> m.name }
private val fields = jClass.fields.asSequence().filter(memberFilter).associateBy { m -> m.name }
override fun findMethodsByName(name: Name): Collection<JavaMethod> = methods[name] ?: listOf()
override fun getMethodNames(nameFilter: (Name) -> Boolean): Collection<Name> =
@@ -131,7 +131,7 @@ class JvmNameResolver(
"kotlin/collections/ListIterator", "kotlin/collections/MutableListIterator"
)
private val PREDEFINED_STRINGS_MAP = PREDEFINED_STRINGS.withIndex().toMapBy({ it.value }, { it.index })
private val PREDEFINED_STRINGS_MAP = PREDEFINED_STRINGS.withIndex().associateBy({ it.value }, { it.index })
fun getPredefinedStringIndex(string: String): Int? = PREDEFINED_STRINGS_MAP[string]
}
@@ -37,7 +37,7 @@ class KotlinClassHeader(
MULTIFILE_CLASS_PART(5);
companion object {
private val entryById = values().toMapBy(Kind::id)
private val entryById = values().associateBy(Kind::id)
@JvmStatic
fun getById(id: Int) = entryById[id] ?: UNKNOWN
@@ -45,7 +45,7 @@ class ReflectJavaClassifierType(public override val type: Type) : ReflectJavaTyp
override fun isRaw(): Boolean = with(type) { this is Class<*> && getTypeParameters().isNotEmpty() }
override fun getTypeArguments(): List<JavaType> {
return sequence({type as? ParameterizedType}, { it.ownerType as? ParameterizedType }).flatMap {
return generateSequence({type as? ParameterizedType}, { it.ownerType as? ParameterizedType }).flatMap {
it.actualTypeArguments.asSequence().map { ReflectJavaType.create(it) }
}.toList()
}
@@ -52,7 +52,7 @@ class BuiltinsPackageFragment(
override val nameResolver = NameResolverImpl(builtinsMessage.strings, builtinsMessage.qualifiedNames)
override val classIdToProto =
builtinsMessage.classList.toMapBy { klass ->
builtinsMessage.classList.associateBy { klass ->
nameResolver.getClassId(klass.fqName)
}
@@ -192,7 +192,7 @@ fun Annotated.getAnnotationRetention(): KotlinRetention? {
}
val DeclarationDescriptor.parentsWithSelf: Sequence<DeclarationDescriptor>
get() = sequence(this, { it.containingDeclaration })
get() = generateSequence(this, { it.containingDeclaration })
val DeclarationDescriptor.parents: Sequence<DeclarationDescriptor>
get() = parentsWithSelf.drop(1)
@@ -127,6 +127,8 @@ open class DelegatingFlexibleType protected constructor(
if (lowerBound == upperBound) return lowerBound
return DelegatingFlexibleType(lowerBound, upperBound, extraCapabilities)
}
internal val ASSERTIONS_ENABLED = DelegatingFlexibleType::class.java.desiredAssertionStatus()
}
// These assertions are needed for checking invariants of flexible types.
@@ -49,7 +49,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor) {
if (proto.argumentCount != 0 && !ErrorUtils.isError(annotationClass) && DescriptorUtils.isAnnotationClass(annotationClass)) {
val constructor = annotationClass.constructors.singleOrNull()
if (constructor != null) {
val parameterByName = constructor.valueParameters.toMapBy { it.name }
val parameterByName = constructor.valueParameters.associateBy { it.name }
arguments = proto.argumentList.map { resolveArgument(it, parameterByName, nameResolver) }.filterNotNull().toMap()
}
}
@@ -287,7 +287,7 @@ class DeserializedClassDescriptor(
}
private inner class EnumEntryClassDescriptors {
private val enumEntryProtos = classProto.enumEntryList.toMapBy { c.nameResolver.getName(it.name) }
private val enumEntryProtos = classProto.enumEntryList.associateBy { c.nameResolver.getName(it.name) }
private val protoContainer =
ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, (containingDeclaration as? ClassDescriptor)?.kind)
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.utils
import java.util.*
fun <K, V> Iterable<K>.keysToMap(value: (K) -> V): Map<K, V> {
return toMapBy({ it }, value)
return associateBy({ it }, value)
}
fun <K, V: Any> Iterable<K>.keysToMapExceptNulls(value: (K) -> V?): Map<K, V> {