Drop all usages of Callbacks.ConstantAffectionResolver

This commit fixes deprecation API usage (deprecated in intellij) which is actually
an error (because of -Werror)

KotlinJavaBuilderExtension implements only one method (getConstantSearch) which is
deprecated and the method is actually not called in since 202 IDEA (minimum
supported IDEA right now is 203).

KotlinJavaBuilderExtension originally appeared in 39f7ecc9a3
in order to fix KT-16091. The fact that we ignored the depreaction caused the issue
regression. Luckily, we already fixes the issue again but this API usage is useless so
can be safely droped
This commit is contained in:
Nikita Bobko
2021-12-23 17:38:48 +01:00
parent 01df50e175
commit 59abe71f56
4 changed files with 0 additions and 120 deletions
@@ -1,64 +0,0 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.jps.build
import org.jetbrains.jps.api.BasicFuture
import org.jetbrains.jps.builders.java.JavaBuilderExtension
import org.jetbrains.jps.builders.java.dependencyView.Callbacks
import org.jetbrains.jps.incremental.CompileContext
import org.jetbrains.kotlin.incremental.LookupSymbol
import java.io.File
import java.util.concurrent.Executors
import java.util.concurrent.Future
import java.util.concurrent.TimeUnit
class KotlinJavaBuilderExtension : JavaBuilderExtension() {
override fun getConstantSearch(context: CompileContext): Callbacks.ConstantAffectionResolver {
return KotlinLookupConstantSearch(context)
}
}
private class KotlinLookupConstantSearch(context: CompileContext) : Callbacks.ConstantAffectionResolver {
private val pool = Executors.newSingleThreadExecutor()
private val kotlinContext by lazy { context.kotlin }
override fun request(
ownerClassName: String,
fieldName: String,
accessFlags: Int,
fieldRemoved: Boolean,
accessChanged: Boolean
): Future<Callbacks.ConstantAffection> {
val future = object : BasicFuture<Callbacks.ConstantAffection>() {
@Volatile
private var result: Callbacks.ConstantAffection = Callbacks.ConstantAffection.EMPTY
fun result(files: Collection<File>) {
result = Callbacks.ConstantAffection(files)
setDone()
}
override fun get(): Callbacks.ConstantAffection {
super.get()
return result
}
override fun get(timeout: Long, unit: TimeUnit): Callbacks.ConstantAffection {
super.get(timeout, unit)
return result
}
}
pool.submit {
if (!future.isCancelled) {
kotlinContext.lookupStorageManager.withLookupStorage { storage ->
val paths = storage.get(LookupSymbol(name = fieldName, scope = ownerClassName))
future.result(paths.map { File(it) })
}
}
}
return future
}
}