Cleanup RC deprecations in compiler and plugin.
This commit is contained in:
@@ -40,7 +40,7 @@ abstract class ArgumentGenerator {
|
||||
|
||||
val actualArgsWithDeclIndex = actualArgs.filter { it !is DefaultValueArgument }.map {
|
||||
ArgumentAndDeclIndex(it, arg2Index[it]!!)
|
||||
}.toArrayList()
|
||||
}.toMutableList()
|
||||
|
||||
valueArgumentsByIndex.withIndex().forEach {
|
||||
if (it.value is DefaultValueArgument) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ class DefaultImplsClassContext(
|
||||
override fun getAccessors(): Collection<AccessorForCallableDescriptor<*>> {
|
||||
val accessors = super.getAccessors()
|
||||
val alreadyExistKeys = accessors.map ({ Pair(it.calleeDescriptor, it.superCallTarget) })
|
||||
val filtered = interfaceContext.accessors.toMapBy({ Pair(it.calleeDescriptor, it.superCallTarget) }, { it }) - alreadyExistKeys
|
||||
val filtered = interfaceContext.accessors.associateByTo(linkedMapOf()) { Pair(it.calleeDescriptor, it.superCallTarget) }.apply { keys -= alreadyExistKeys }
|
||||
return accessors + filtered.values
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ object PluginCliParser {
|
||||
javaClass.classLoader
|
||||
)
|
||||
|
||||
val componentRegistrars = ServiceLoader.load(ComponentRegistrar::class.java, classLoader).toArrayList()
|
||||
val componentRegistrars = ServiceLoader.load(ComponentRegistrar::class.java, classLoader).toMutableList()
|
||||
componentRegistrars.addAll(BundledCompilerPlugins.componentRegistrars)
|
||||
configuration.addAll(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS, componentRegistrars)
|
||||
|
||||
@@ -55,11 +55,11 @@ object PluginCliParser {
|
||||
it.pluginId
|
||||
} ?: mapOf()
|
||||
|
||||
val commandLineProcessors = ServiceLoader.load(CommandLineProcessor::class.java, classLoader).toArrayList()
|
||||
val commandLineProcessors = ServiceLoader.load(CommandLineProcessor::class.java, classLoader).toMutableList()
|
||||
commandLineProcessors.addAll(BundledCompilerPlugins.commandLineProcessors)
|
||||
|
||||
for (processor in commandLineProcessors) {
|
||||
val declaredOptions = processor.pluginOptions.toMapBy { it.name }
|
||||
val declaredOptions = processor.pluginOptions.associateBy { it.name }
|
||||
val optionsToValues = MultiMap<CliOption, CliOptionValue>()
|
||||
|
||||
for (optionValue in optionValuesByPlugin[processor.pluginId].orEmpty()) {
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ interface Conditional {
|
||||
|
||||
|
||||
companion object {
|
||||
val ANNOTATIONS: Map<String, Parser> = listOf<Parser>(JvmVersion, JsVersion, TargetName).toMapBy { it.name }
|
||||
val ANNOTATIONS: Map<String, Parser> = listOf<Parser>(JvmVersion, JsVersion, TargetName).associateBy { it.name }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ data class Modification(val range: TextRange, val apply: (String) -> String)
|
||||
class CollectModificationsVisitor(evaluators: List<Evaluator>) : KtTreeVisitorVoid() {
|
||||
|
||||
val elementModifications: Map<Evaluator, MutableList<Modification>> =
|
||||
evaluators.toMapBy(selector = { it }, transform = { arrayListOf<Modification>() })
|
||||
evaluators.associateBy(keySelector = { it }, valueTransform = { arrayListOf<Modification>() })
|
||||
|
||||
override fun visitDeclaration(declaration: KtDeclaration) {
|
||||
super.visitDeclaration(declaration)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ fun createJvmProfile(targetRoot: File, version: Int): Profile = Profile("JVM$ver
|
||||
fun createJsProfile(targetRoot: File): Profile = Profile("JS", JsPlatformEvaluator(), File(targetRoot, "js"))
|
||||
|
||||
val profileEvaluators: Map<String, () -> Evaluator> =
|
||||
listOf(6, 7, 8).toMapBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } }) + ("JS" to { JsPlatformEvaluator() })
|
||||
listOf(6, 7, 8).associateBy({ version -> "JVM$version" }, { version -> { JvmPlatformEvaluator(version) } }) + ("JS" to { JsPlatformEvaluator() })
|
||||
|
||||
fun createProfile(name: String, targetRoot: File): Profile {
|
||||
val (profileName, evaluator) = profileEvaluators.entries.firstOrNull { it.key.equals(name, ignoreCase = true) } ?: throw IllegalArgumentException("Profile with name '$name' is not supported")
|
||||
|
||||
@@ -102,7 +102,7 @@ private fun collectInterfacesRecursive(type: Type, result: MutableSet<Type>) {
|
||||
private fun getRegistrations(klass: Class<*>): List<Type> {
|
||||
val registrations = ArrayList<Type>()
|
||||
|
||||
val superClasses = sequence<Type>(klass) {
|
||||
val superClasses = generateSequence<Type>(klass) {
|
||||
when (it) {
|
||||
is Class<*> -> it.genericSuperclass
|
||||
is ParameterizedType -> (it.rawType as? Class<*>)?.genericSuperclass
|
||||
|
||||
+2
-1
@@ -28,6 +28,7 @@ import java.io.PrintStream
|
||||
import java.rmi.server.UnicastRemoteObject
|
||||
import java.util.concurrent.Semaphore
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.comparisons.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
|
||||
@@ -216,7 +217,7 @@ object KotlinCompilerClient {
|
||||
val memBefore = daemon.getUsedMemory().get() / 1024
|
||||
val startTime = System.nanoTime()
|
||||
|
||||
val res = daemon.remoteCompile(CompileService.NO_SESSION, CompileService.TargetPlatform.JVM, filteredArgs.toArrayList().toTypedArray(), servicesFacade, outStrm, CompileService.OutputFormat.PLAIN, outStrm, null)
|
||||
val res = daemon.remoteCompile(CompileService.NO_SESSION, CompileService.TargetPlatform.JVM, filteredArgs.toList().toTypedArray(), servicesFacade, outStrm, CompileService.OutputFormat.PLAIN, outStrm, null)
|
||||
|
||||
val endTime = System.nanoTime()
|
||||
println("Compilation result code: $res")
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
import java.util.logging.Level
|
||||
import java.util.logging.Logger
|
||||
import kotlin.comparisons.*
|
||||
import kotlin.concurrent.read
|
||||
import kotlin.concurrent.schedule
|
||||
import kotlin.concurrent.write
|
||||
@@ -303,7 +304,7 @@ class CompileServiceImpl(
|
||||
synchronized(state.sessions) {
|
||||
// 2. check if any session hanged - clean
|
||||
// making copy of the list before calling release
|
||||
state.sessions.filterValues { !it.isAlive }.keys.toArrayList()
|
||||
state.sessions.filterValues { !it.isAlive }.keys.toList()
|
||||
}.forEach { releaseCompileSession(it) }
|
||||
|
||||
// 3. check if in graceful shutdown state and all sessions are closed
|
||||
|
||||
@@ -47,7 +47,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
|
||||
private data class FileId(val file: File, val lastModified: Long, val digest: ByteArray)
|
||||
|
||||
private val fileIdsLock = Semaphore(1) // a barrier for ensuring ids are initialized, using semaphore to allow modifications from another thread
|
||||
private var fileIds: ArrayList<FileId>? = null
|
||||
private var fileIds: List<FileId>? = null
|
||||
private val lastChangedStatus = AtomicBoolean(false)
|
||||
private val lastUpdate = AtomicLong(0)
|
||||
private val lastDigestUpdate = AtomicLong(0)
|
||||
@@ -63,7 +63,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
|
||||
.asSequence()
|
||||
.flatMap { it.walk().filter(::isClasspathFile) }
|
||||
.map { FileId(it, it.lastModified(), it.md5Digest()) }
|
||||
.toArrayList()
|
||||
.toList()
|
||||
val nowMs = TimeUnit.MILLISECONDS.toMillis(System.nanoTime())
|
||||
lastUpdate.set(nowMs)
|
||||
lastDigestUpdate.set(nowMs)
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : SyntheticScope
|
||||
sourceFunction.original.source)
|
||||
descriptor.sourceFunction = sourceFunction
|
||||
|
||||
val sourceTypeParams = (sourceFunction.typeParameters).toArrayList()
|
||||
val sourceTypeParams = (sourceFunction.typeParameters).toMutableList()
|
||||
val ownerClass = sourceFunction.containingDeclaration as ClassDescriptor
|
||||
//TODO: should we go up parents for getters/setters too?
|
||||
//TODO: non-inner classes
|
||||
|
||||
@@ -69,7 +69,7 @@ fun KtSimpleNameExpression.getQualifiedElement(): KtElement {
|
||||
}
|
||||
|
||||
fun KtSimpleNameExpression.getTopmostParentQualifiedExpressionForSelector(): KtQualifiedExpression? {
|
||||
return sequence<KtExpression>(this) {
|
||||
return generateSequence<KtExpression>(this) {
|
||||
val parentQualified = it.parent as? KtQualifiedExpression
|
||||
if (parentQualified?.selectorExpression == it) parentQualified else null
|
||||
}.last() as? KtQualifiedExpression
|
||||
|
||||
@@ -60,7 +60,7 @@ fun PsiElement.siblings(forward: Boolean = true, withItself: Boolean = true): Se
|
||||
}
|
||||
|
||||
val PsiElement.parentsWithSelf: Sequence<PsiElement>
|
||||
get() = sequence(this) { if (it is PsiFile) null else it.parent }
|
||||
get() = generateSequence(this) { if (it is PsiFile) null else it.parent }
|
||||
|
||||
val PsiElement.parents: Sequence<PsiElement>
|
||||
get() = parentsWithSelf.drop(1)
|
||||
@@ -72,10 +72,10 @@ fun PsiElement.nextLeaf(skipEmptyElements: Boolean = false): PsiElement?
|
||||
= PsiTreeUtil.nextLeaf(this, skipEmptyElements)
|
||||
|
||||
val PsiElement.prevLeafs: Sequence<PsiElement>
|
||||
get() = sequence({ prevLeaf() }, { it.prevLeaf() })
|
||||
get() = generateSequence({ prevLeaf() }, { it.prevLeaf() })
|
||||
|
||||
val PsiElement.nextLeafs: Sequence<PsiElement>
|
||||
get() = sequence({ nextLeaf() }, { it.nextLeaf() })
|
||||
get() = generateSequence({ nextLeaf() }, { it.nextLeaf() })
|
||||
|
||||
fun PsiElement.prevLeaf(filter: (PsiElement) -> Boolean): PsiElement? {
|
||||
var leaf = prevLeaf()
|
||||
|
||||
@@ -45,7 +45,7 @@ fun KtReturnExpression.getTargetFunctionDescriptor(context: BindingContext): Fun
|
||||
val containingFunctionDescriptor = DescriptorUtils.getParentOfType(declarationDescriptor, FunctionDescriptor::class.java, false)
|
||||
if (containingFunctionDescriptor == null) return null
|
||||
|
||||
return sequence(containingFunctionDescriptor) { DescriptorUtils.getParentOfType(it, FunctionDescriptor::class.java) }
|
||||
return generateSequence(containingFunctionDescriptor) { DescriptorUtils.getParentOfType(it, FunctionDescriptor::class.java) }
|
||||
.dropWhile { it is AnonymousFunctionDescriptor }
|
||||
.firstOrNull()
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ class TypeResolver(
|
||||
}
|
||||
|
||||
private fun ClassifierDescriptor?.classDescriptorChain(): List<ClassDescriptor>
|
||||
= sequence({ this as? ClassDescriptor }, { it.containingDeclaration as? ClassDescriptor }).toList()
|
||||
= generateSequence({ this as? ClassDescriptor }, { it.containingDeclaration as? ClassDescriptor }).toList()
|
||||
|
||||
private fun TypeParameterDescriptor.isDeclaredInScope(c: TypeResolutionContext): Boolean {
|
||||
assert(containingDeclaration is ClassDescriptor) { "This function is implemented for classes only, but $containingDeclaration was given" }
|
||||
@@ -499,7 +499,7 @@ class TypeResolver(
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptor.isInsideOfClass(classDescriptor: ClassDescriptor)
|
||||
= sequence(this, { it.containingDeclaration }).any { it.original == classDescriptor }
|
||||
= generateSequence(this, { it.containingDeclaration }).any { it.original == classDescriptor }
|
||||
|
||||
|
||||
private fun resolveTypeProjectionsWithErrorConstructor(
|
||||
|
||||
@@ -105,7 +105,7 @@ fun Call.getValueArgumentForExpression(expression: KtExpression): ValueArgument?
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
fun KtElement.isParenthesizedExpression() = sequence(this) { it.deparenthesizeStructurally() }.any { it == expression }
|
||||
fun KtElement.isParenthesizedExpression() = generateSequence(this) { it.deparenthesizeStructurally() }.any { it == expression }
|
||||
return valueArguments.firstOrNull { it?.getArgumentExpression()?.isParenthesizedExpression() ?: false }
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.util.collectionUtils.concat
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
|
||||
val HierarchicalScope.parentsWithSelf: Sequence<HierarchicalScope>
|
||||
get() = sequence(this) { it.parent }
|
||||
get() = generateSequence(this) { it.parent }
|
||||
|
||||
val HierarchicalScope.parents: Sequence<HierarchicalScope>
|
||||
get() = parentsWithSelf.drop(1)
|
||||
|
||||
@@ -34,7 +34,7 @@ class TestStdlibWithDxTest {
|
||||
private fun doTest(file: File) {
|
||||
val zip = ZipInputStream(FileInputStream(file))
|
||||
zip.use {
|
||||
sequence { zip.nextEntry }.forEach {
|
||||
generateSequence { zip.nextEntry }.forEach {
|
||||
if (it.name.endsWith(".class")) {
|
||||
DxChecker.checkFileWithDx(zip.readBytes(), it.name)
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ interface AbstractSMAPBaseTest {
|
||||
}.map {
|
||||
val smap = it.value.mapNotNull { it.smap?.replaceHash() }.joinToString("\n")
|
||||
SMAPAndFile(if (smap.isNotEmpty()) smap else null, it.key)
|
||||
}.toMapBy { it.sourceFile }
|
||||
}.associateBy { it.sourceFile }
|
||||
|
||||
for (source in sourceData) {
|
||||
val data = compiledData[source.sourceFile]
|
||||
|
||||
Reference in New Issue
Block a user