Cleanup 193 compatibility fixes

This commit is contained in:
Vyacheslav Gerasimov
2020-11-06 02:53:05 +03:00
parent 8620d26a8a
commit 3feff16a77
118 changed files with 305 additions and 715 deletions

View File

@@ -40,9 +40,7 @@ dependencies {
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}

View File

@@ -168,9 +168,8 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.kotlinx-coroutines-core"] = "1.3.7"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.7"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
@@ -868,8 +867,8 @@ tasks {
":compiler:test",
":js:js.tests:test"
)
if (Ide.IJ193.orHigher())
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")

View File

@@ -34,9 +34,7 @@ dependencies {
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
Platform[192].orHigher {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
}

View File

@@ -57,14 +57,9 @@ dependencies {
testCompileOnly(project(it))
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompileOnly(intellijDep()) { includeJars("idea", "idea_rt", "util", "asm-all", rootProject = rootProject) }
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(intellijPluginDep("java"))
testRuntime(project(":kotlin-reflect"))
testRuntime(androidDxJar())

View File

@@ -102,6 +102,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor(
@@ -536,7 +537,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
)
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
FileSystems.getDefault().getPath(pluginRoot.path),
configFilePath,
Extensions.getRootArea()
)
}
@JvmStatic

View File

@@ -106,6 +106,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil
import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor(
@@ -534,7 +535,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})"
)
registerExtensionPointAndExtensionsEx(pluginRoot, configFilePath, Extensions.getRootArea())
CoreApplicationEnvironment.registerExtensionPointAndExtensions(
FileSystems.getDefault().getPath(pluginRoot.path),
configFilePath,
Extensions.getRootArea()
)
}
@JvmStatic

View File

@@ -1,18 +0,0 @@
/*
* Copyright 2010-2020 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.cli.jvm.compiler
import com.intellij.core.CoreApplicationEnvironment
import com.intellij.openapi.extensions.ExtensionsArea
import java.io.File
import java.nio.file.FileSystems
// FIX ME WHEN BUNCH 193 REMOVED
fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) {
val pluginRoot = FileSystems.getDefault().getPath(pluginFile.path)
@Suppress("MissingRecentApi")
CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginRoot, fileName, area)
}

View File

@@ -25,10 +25,8 @@ dependencies {
testRuntime(project(":kotlin-reflect"))
testRuntime(project(":core:descriptors.runtime"))
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -30,10 +30,8 @@ dependencies {
testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":core:descriptors.runtime"))
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -17,10 +17,8 @@ dependencies {
includeJars("extensions", "idea_rt", "util", "asm-all", "platform-util-ex", rootProject = rootProject)
}
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api") }
testRuntimeOnly(intellijPluginDep("java"))
}
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api") }
testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijDep())

View File

@@ -37,10 +37,8 @@ dependencies {
implementation("org.openjdk.jmh", "jmh-generator-bytecode", jmhVersion)
implementation("org.openjdk.jmh", "jmh-generator-annprocess", jmhVersion)
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -27,10 +27,8 @@ dependencies {
testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":core:descriptors.runtime"))
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -16,10 +16,8 @@ dependencies {
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) }
Platform[192].orHigher {
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
sourceSets {

View File

@@ -23,9 +23,7 @@ dependencies {
includeJars("trove4j", rootProject = rootProject)
}
Platform[192].orHigher {
runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
}
runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
}
val writeCopyright by task<WriteCopyrightToFile> {

View File

@@ -11,10 +11,8 @@ dependencies {
compile(project(":compiler:frontend.java"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[192].orHigher {
compileOnly(intellijDep()) { includeJars("platform-core-ui", "platform-util-ui") }
}
compileOnly(intellijDep()) { includeJars("platform-core-ui", "platform-util-ui") }
compileOnly(intellijDep()) { includeJars("asm-all", "trove4j", "guava", rootProject = rootProject) }
}

View File

@@ -92,13 +92,8 @@ dependencies {
isTransitive = false
}
Platform[192].orHigher {
testCompile(intellijDep()) { includeJars("platform-util-ui", "platform-concurrency", "platform-objectSerializer") }
}
Platform[193].orHigher {
testCompile(intellijDep()) { includeJars("platform-ide-util-io") }
}
testCompile(intellijDep()) { includeJars("platform-util-ui", "platform-concurrency", "platform-objectSerializer") }
testCompile(intellijDep()) { includeJars("platform-ide-util-io") }
}
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {

View File

@@ -1,109 +0,0 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
testCompile(project(":kotlin-scripting-compiler"))
testCompile(project(":core:descriptors"))
testCompile(project(":core:descriptors.jvm"))
testCompile(project(":core:deserialization"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:tests-mutes"))
testCompile(project(":compiler:backend"))
testCompile(project(":compiler:ir.tree.impl"))
testCompile(project(":compiler:fir:tree"))
testCompile(project(":compiler:fir:raw-fir:psi2fir"))
testCompile(project(":compiler:fir:raw-fir:light-tree2fir"))
testCompile(project(":compiler:fir:fir2ir"))
testCompile(project(":compiler:fir:jvm"))
testCompile(project(":compiler:fir:fir2ir:jvm-backend"))
testCompile(project(":compiler:fir:fir-serialization"))
testCompile(project(":compiler:fir:fir-deserialization"))
testCompile(project(":compiler:fir:cones"))
testCompile(project(":compiler:fir:resolve"))
testCompile(project(":compiler:fir:checkers"))
testCompile(project(":compiler:fir:java"))
testCompile(project(":compiler:fir:entrypoint"))
testCompile(project(":compiler:ir.ir2cfg"))
testCompile(project(":compiler:frontend"))
testCompile(project(":compiler:frontend.java"))
testCompile(project(":compiler:util"))
testCompile(project(":compiler:cli-common"))
testCompile(project(":compiler:cli"))
testCompile(project(":compiler:cli-js"))
testCompile(project(":compiler:light-classes"))
testCompile(project(":compiler:serialization"))
testCompile(project(":kotlin-preloader"))
testCompile(project(":compiler:cli-common"))
testCompile(project(":daemon-common"))
testCompile(project(":daemon-common-new"))
testCompile(project(":js:js.serializer"))
testCompile(project(":js:js.frontend"))
testCompile(project(":js:js.translator"))
testCompile(project(":native:frontend.native"))
testCompileOnly(project(":plugins:android-extensions-compiler"))
testCompile(project(":kotlin-test:kotlin-test-jvm"))
testCompile(projectTests(":compiler:tests-common-jvm6"))
testCompile(project(":kotlin-scripting-compiler-impl"))
testCompile(commonDep("junit:junit"))
testCompile(androidDxJar()) { isTransitive = false }
testCompile(commonDep("com.android.tools:r8"))
testCompileOnly(project(":kotlin-reflect-api"))
testCompileOnly(toolsJar())
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", "picocontainer", rootProject = rootProject) }
}
Platform[201].orHigher {
testCompile(intellijDep()) {
includeJars(
"testFramework",
"testFramework.core",
rootProject = rootProject
)
}
}
testCompile(intellijDep()) {
includeJars(
"jps-model",
"extensions",
"util",
"platform-api",
"platform-impl",
"idea",
"idea_rt",
"guava",
"trove4j",
"asm-all",
"log4j",
"jdom",
"streamex",
"bootstrap",
rootProject = rootProject
)
isTransitive = false
}
Platform[192].orHigher {
testCompile(intellijDep()) { includeJars("platform-util-ui", "platform-concurrency", "platform-objectSerializer") }
}
Platform[193].orHigher {
testCompile(intellijDep()) { includeJars("platform-ide-util-io") }
}
if (Platform.P202.orHigher()) {
testCompile(intellijDep()) {
includeJars("intellij-deps-fastutil-8.3.1-1")
isTransitive = false
}
}
}
sourceSets {
"main" { }
"test" { projectDefault() }
}
testsJar {}

View File

@@ -13,9 +13,7 @@ dependencies {
testRuntime(project(":kotlin-reflect"))
testRuntimeOnly(toolsJar())
testRuntime(intellijDep())
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(intellijPluginDep("java"))
if (System.getProperty("idea.active") != null) testRuntimeOnly(files("${rootProject.projectDir}/dist/kotlinc/lib/kotlin-reflect.jar"))
}

View File

@@ -5,16 +5,14 @@ plugins {
dependencies {
testCompile(projectTests(":compiler"))
Platform[192].orHigher {
testCompileOnly(intellijDep()) {
includeJars("groovy-all", rootProject = rootProject)
}
testCompile(intellijDep()) {
includeJars("gson", rootProject = rootProject)
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijPluginDep("java"))
testCompileOnly(intellijDep()) {
includeJars("groovy-all", rootProject = rootProject)
}
testCompile(intellijDep()) {
includeJars("gson", rootProject = rootProject)
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijPluginDep("java"))
compile("org.jsoup:jsoup:1.10.3")
if (System.getProperty("idea.active") != null) testRuntimeOnly(files("${rootProject.projectDir}/dist/kotlinc/lib/kotlin-reflect.jar"))
testRuntime(project(":kotlin-reflect"))

View File

@@ -14,10 +14,8 @@ dependencies {
testCompile(projectTests(":generators:test-generator"))
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[192].orHigher {
testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency") }
testRuntimeOnly(jpsStandalone()) { includeJars("jps-model") }
}
testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency") }
testRuntimeOnly(jpsStandalone()) { includeJars("jps-model") }
}
sourceSets {

View File

@@ -95,17 +95,14 @@ dependencies {
compileOnly(project(":kotlin-daemon-client"))
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
Platform[193].orHigher {
implementation(commonDep("org.jetbrains.intellij.deps.completion", "completion-ranking-kotlin"))
Ide.IJ {
implementation(intellijPluginDep("stats-collector"))
}
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
implementation(commonDep("org.jetbrains.intellij.deps.completion", "completion-ranking-kotlin"))
Ide.IJ {
implementation(intellijPluginDep("stats-collector"))
}
compileOnly(commonDep("org.jetbrains", "markdown"))

View File

@@ -8,9 +8,7 @@ dependencies {
compile(project(":compiler:util"))
compile(project(":compiler:frontend"))
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -49,13 +49,13 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Classes
override fun processAllClassNames(processor: StringProcessor): Boolean {
override fun processAllClassNames(processor: Processor<in String>): Boolean {
if (disableSearch.get()) return true
return KotlinClassShortNameIndex.getInstance().processAllKeys(project, processor) &&
KotlinFileFacadeShortNameIndex.INSTANCE.processAllKeys(project, processor)
}
override fun processAllClassNames(processor: StringProcessor, scope: GlobalSearchScope, filter: IdFilter?): Boolean {
override fun processAllClassNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?): Boolean {
if (disableSearch.get()) return true
return processAllClassNames(processor)
}
@@ -150,7 +150,11 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Methods
override fun processAllMethodNames(processor: StringProcessor, scope: GlobalSearchScope, filter: IdFilter?): Boolean {
override fun processAllMethodNames(
processor: Processor<in String>,
scope: GlobalSearchScope,
filter: IdFilter?
): Boolean {
if (disableSearch.get()) return true
return processAllMethodNames(processor)
}
@@ -162,7 +166,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
}
}
private fun processAllMethodNames(processor: StringProcessor): Boolean {
private fun processAllMethodNames(processor: Processor<in String>): Boolean {
if (disableSearch.get()) return true
if (!KotlinFunctionShortNameIndex.getInstance().processAllKeys(project, processor)) {
return false
@@ -245,7 +249,11 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
}
}
override fun processMethodsWithName(name: String, scope: GlobalSearchScope, processor: PsiMethodProcessor): Boolean {
override fun processMethodsWithName(
name: String,
scope: GlobalSearchScope,
processor: Processor<in PsiMethod>
): Boolean {
if (disableSearch.get()) return true
return ContainerUtil.process(getMethodsByName(name, scope), processor)
}
@@ -253,7 +261,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Fields
override fun processAllFieldNames(processor: StringProcessor, scope: GlobalSearchScope, filter: IdFilter?): Boolean {
override fun processAllFieldNames(processor: Processor<in String>, scope: GlobalSearchScope, filter: IdFilter?): Boolean {
if (disableSearch.get()) return true
return processAllFieldNames(processor)
}
@@ -265,7 +273,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
}
}
private fun processAllFieldNames(processor: StringProcessor): Boolean {
private fun processAllFieldNames(processor: Processor<in String>): Boolean {
if (disableSearch.get()) return true
return KotlinPropertyShortNameIndex.getInstance().processAllKeys(project, processor)
}

View File

@@ -1,14 +0,0 @@
/*
* Copyright 2010-2020 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.idea.caches
import com.intellij.psi.PsiMethod
import com.intellij.util.Processor
// FIX ME WHEN BUNCH 193 REMOVED
typealias StringProcessor = Processor<in String>
typealias PsiMethodProcessor = Processor<in PsiMethod>

View File

@@ -6,10 +6,7 @@
package org.jetbrains.kotlin.idea.completion.test.handlers
import com.intellij.codeInsight.completion.CompletionType
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.codeInsight.lookup.LookupElementPresentation
import com.intellij.codeInsight.lookup.LookupEvent
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.*
import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.openapi.project.Project
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
@@ -136,7 +133,7 @@ abstract class CompletionHandlerTestBase : KotlinLightCodeInsightFixtureTestCase
if (lookup.currentItem != item) { // do not touch selection if not changed - important for char filter tests
lookup.currentItem = item
}
lookup.setFocusedFocusDegree()
lookup.lookupFocusDegree = LookupFocusDegree.FOCUSED
if (LookupEvent.isSpecialCompletionChar(completionChar)) {
lookup.finishLookup(completionChar)
} else {

View File

@@ -1,14 +0,0 @@
/*
* Copyright 2010-2020 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.idea.completion.test.handlers
import com.intellij.codeInsight.lookup.LookupFocusDegree
import com.intellij.codeInsight.lookup.impl.LookupImpl
// FIX ME WHEN BUNCH 193 REMOVED
fun LookupImpl.setFocusedFocusDegree() {
this.lookupFocusDegree = LookupFocusDegree.FOCUSED
}

View File

@@ -31,10 +31,8 @@ dependencies {
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("gradle"))
}

View File

@@ -24,7 +24,7 @@ import com.intellij.psi.impl.java.stubs.index.JavaShortClassNameIndex
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.PsiShortNamesCache
import com.intellij.psi.stubs.StubIndex
import org.jetbrains.kotlin.idea.caches.PsiMethodProcessor
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
// Allow searching java classes in jars in script dependencies, this is needed for stuff like completion and autoimport
@@ -47,7 +47,11 @@ class JavaClassesInScriptDependenciesShortNameCache(private val project: Project
override fun getMethodsByNameIfNotMoreThan(name: String, scope: GlobalSearchScope, maxCount: Int): Array<PsiMethod> = PsiMethod.EMPTY_ARRAY
override fun processMethodsWithName(name: String, scope: GlobalSearchScope, processor: PsiMethodProcessor) = true
override fun processMethodsWithName(
name: String,
scope: GlobalSearchScope,
processor: Processor<in PsiMethod>
) = true
override fun getAllFieldNames() = emptyArray<String>()

View File

@@ -29,9 +29,7 @@ dependencies {
testCompileOnly(intellijDep())
testRuntime(intellijDep())
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -25,9 +25,7 @@ dependencies {
testCompileOnly(intellijDep())
testRuntime(intellijDep())
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -13,14 +13,7 @@ dependencies {
compileOnly(project(":compiler:psi"))
compileOnly(intellijCoreDep())
compileOnly(intellijDep())
Platform[191].orLower {
compileOnly(intellijDep()) { includeJars("java-api", "java-impl") }
}
Platform[192].orHigher {
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
sourceSets {

View File

@@ -33,9 +33,7 @@ dependencies {
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit"))
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -36,9 +36,7 @@ dependencies {
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit"))
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -19,14 +19,7 @@ dependencies {
compileOnly(intellijCoreDep())
compileOnly(intellijDep())
compileOnly(project(":compiler:light-classes"))
Platform[191].orLower {
compileOnly(intellijDep()) { includeJars("java-api", "java-impl") }
}
Platform[192].orHigher {
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
sourceSets {

View File

@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.idea.util.application.getServiceSafe
/**
* Tested in OutOfBlockModificationTestGenerated
*/
// FIX ME WHEN BUNCH 193 REMOVED
class KotlinCodeBlockModificationListener(project: Project) : KotlinCodeBlockModificationListenerCompat(project) {
init {

View File

@@ -41,7 +41,6 @@ val KOTLIN_CONSOLE_KEY = Key.create<Boolean>("kotlin.console")
/**
* Tested in OutOfBlockModificationTestGenerated
*/
// FIX ME WHEN BUNCH 193 REMOVED
abstract class KotlinCodeBlockModificationListenerCompat(protected val project: Project) : PsiTreeChangePreprocessor, Disposable {
protected val modificationTrackerImpl: PsiModificationTrackerImpl =
PsiModificationTracker.SERVICE.getInstance(project) as PsiModificationTrackerImpl

View File

@@ -24,6 +24,8 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiParameter
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.findUsages.KotlinCallableFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory
import org.jetbrains.kotlin.idea.util.application.runReadAction
@@ -73,7 +75,11 @@ class DelegatingFindMemberUsagesHandler(
return kotlinHandler.getFindUsagesOptions(dataContext)
}
override fun processElementUsages(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Boolean {
override fun processElementUsages(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Boolean {
val (handler, handlerOptions) = runReadAction { getHandlerAndOptions(element, options) } ?: return true
return handler.processElementUsages(element, processor, handlerOptions!!)
}

View File

@@ -26,6 +26,7 @@ import com.intellij.psi.search.PsiElementProcessor
import com.intellij.psi.search.PsiElementProcessorAdapter
import com.intellij.psi.search.searches.MethodReferencesSearch
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.usageView.UsageInfo
import com.intellij.util.FilteredQuery
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.asJava.LightClassProvider.Companion.providedToLightClass
@@ -66,12 +67,16 @@ class KotlinFindClassUsagesHandler(
)
}
override fun createSearcher(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Searcher {
override fun createSearcher(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Searcher {
return MySearcher(element, processor, options)
}
private class MySearcher(
element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions
element: PsiElement, processor: Processor<in UsageInfo>, options: FindUsagesOptions
) : Searcher(element, processor, options) {
private val kotlinOptions = options as KotlinClassFindUsagesOptions

View File

@@ -27,6 +27,7 @@ import com.intellij.psi.PsiReference
import com.intellij.psi.search.SearchScope
import com.intellij.psi.search.searches.MethodReferencesSearch
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.usageView.UsageInfo
import com.intellij.util.*
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.asJava.LightClassProvider.Companion.providedToLightMethods
@@ -101,7 +102,11 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
factory: KotlinFindUsagesHandlerFactory
) : KotlinFindMemberUsagesHandler<KtNamedDeclaration>(propertyDeclaration, elementsToSearch, factory) {
override fun processElementUsages(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Boolean {
override fun processElementUsages(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Boolean {
if (ApplicationManager.getApplication().isUnitTestMode ||
!isPropertyOfDataClass ||
@@ -199,12 +204,16 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
}
}
override fun createSearcher(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Searcher {
override fun createSearcher(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Searcher {
return MySearcher(element, processor, options)
}
private inner class MySearcher(
element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions
element: PsiElement, processor: Processor<in UsageInfo>, options: FindUsagesOptions
) : Searcher(element, processor, options) {
private val kotlinOptions = options as KotlinCallableFindUsagesOptions

View File

@@ -55,7 +55,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
elementsToSearch.toTypedArray()
}
private fun searchTextOccurrences(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Boolean {
private fun searchTextOccurrences(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Boolean {
if (!options.isSearchForTextOccurrences) return true
val scope = options.searchScope
@@ -71,13 +75,17 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return true
}
override fun processElementUsages(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Boolean {
override fun processElementUsages(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Boolean {
return searchReferences(element, processor, options, forHighlight = false) && searchTextOccurrences(element, processor, options)
}
private fun searchReferences(
element: PsiElement,
processor: UsageInfoProcessor,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions,
forHighlight: Boolean
): Boolean {
@@ -86,7 +94,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return searcher.executeTasks()
}
protected abstract fun createSearcher(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Searcher
protected abstract fun createSearcher(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Searcher
override fun findReferencesToHighlight(target: PsiElement, searchScope: SearchScope): Collection<PsiReference> {
val results = Collections.synchronizedList(arrayListOf<PsiReference>())
@@ -102,7 +114,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return results
}
protected abstract class Searcher(val element: PsiElement, val processor: UsageInfoProcessor, val options: FindUsagesOptions) {
protected abstract class Searcher(
val element: PsiElement,
val processor: Processor<in UsageInfo>,
val options: FindUsagesOptions
) {
private val tasks = ArrayList<() -> Boolean>()
/**
@@ -128,7 +144,7 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
companion object {
val LOG = Logger.getInstance(KotlinFindUsagesHandler::class.java)
internal fun processUsage(processor: UsageInfoProcessor, ref: PsiReference): Boolean =
internal fun processUsage(processor: Processor<in UsageInfo>, ref: PsiReference): Boolean =
processor.processIfNotNull {
when {
ref is LightMemberReference -> KotlinReferencePreservingUsageInfo(ref)
@@ -137,16 +153,19 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
}
}
internal fun processUsage(processor: UsageInfoProcessor, element: PsiElement): Boolean =
internal fun processUsage(
processor: Processor<in UsageInfo>,
element: PsiElement
): Boolean =
processor.processIfNotNull { if (element.isValid) UsageInfo(element) else null }
private fun UsageInfoProcessor.processIfNotNull(callback: () -> UsageInfo?): Boolean {
private fun Processor<in UsageInfo>.processIfNotNull(callback: () -> UsageInfo?): Boolean {
ProgressManager.checkCanceled()
val usageInfo = runReadAction(callback)
return if (usageInfo != null) process(usageInfo) else true
}
internal fun createReferenceProcessor(usageInfoProcessor: UsageInfoProcessor): Processor<PsiReference> {
internal fun createReferenceProcessor(usageInfoProcessor: Processor<in UsageInfo>): Processor<PsiReference> {
val uniqueProcessor = CommonProcessors.UniqueProcessor(usageInfoProcessor)
return Processor { processUsage(uniqueProcessor, it) }

View File

@@ -21,6 +21,8 @@ import com.intellij.find.findUsages.FindUsagesOptions
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.psi.PsiElement
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinTypeParameterFindUsagesDialog
import org.jetbrains.kotlin.psi.KtNamedDeclaration
@@ -37,7 +39,11 @@ class KotlinTypeParameterFindUsagesHandler(
)
}
override fun createSearcher(element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions): Searcher {
override fun createSearcher(
element: PsiElement,
processor: Processor<in UsageInfo>,
options: FindUsagesOptions
): Searcher {
return object : Searcher(element, processor, options) {
override fun buildTaskList(forHighlight: Boolean): Boolean {
addTask {

View File

@@ -1,14 +0,0 @@
/*
* Copyright 2010-2020 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.idea.findUsages.handlers
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
// FIX ME WHEN BUNCH 193 REMOVED
typealias UsageInfoProcessor = Processor<in UsageInfo>
typealias SliceUsageProcessor = Processor<in SliceUsage>

View File

@@ -23,9 +23,7 @@ dependencies {
testCompile(projectTests(":idea:idea-gradle"))
compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher {
compileOnly(intellijPluginDep("gradle-java"))
}
compileOnly(intellijPluginDep("gradle-java"))
compileOnly(intellijPluginDep("Groovy"))
compileOnly(intellijDep())
@@ -36,9 +34,7 @@ dependencies {
testCompileOnly(intellijPluginDep("Groovy"))
testCompileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))
@@ -61,9 +57,7 @@ dependencies {
testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
Platform[193].orHigher {
testRuntime(intellijPluginDep("gradle-java"))
}
testRuntime(intellijPluginDep("gradle-java"))
testRuntime(intellijPluginDep("Groovy"))
testRuntime(intellijPluginDep("coverage"))
if (Ide.IJ()) {

View File

@@ -1,26 +0,0 @@
plugins {
kotlin("jvm")
id("jps-compatible")
}
jvmTarget = "1.6"
// FIX ME WHEN BUNCH 193 REMOVED: this module is no longer needed since IDEA 2020.1
Platform[193].orLower {
dependencies {
compileOnly(intellijPluginDep("gradle"))
}
sourceSets {
"main" { projectDefault() }
"test" { projectDefault() }
}
runtimeJar()
sourcesJar()
javadocJar()
apply(from = "$rootDir/gradle/kotlinPluginPublication.gradle.kts")
}

View File

@@ -20,9 +20,7 @@ dependencies {
compileOnly(intellijDep())
compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher {
compileOnly(intellijPluginDep("gradle-java"))
}
compileOnly(intellijPluginDep("gradle-java"))
compileOnly(intellijPluginDep("Groovy"))
compileOnly(intellijPluginDep("junit"))
compileOnly(intellijPluginDep("testng"))
@@ -30,19 +28,15 @@ dependencies {
compileOnly(project(":kotlin-gradle-statistics"))
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
testCompile(projectTests(":idea"))
testCompile(projectTests(":idea:idea-test-framework"))
testCompile(intellijPluginDep("gradle"))
Platform[193].orHigher {
testCompile(intellijPluginDep("gradle-java"))
}
testCompile(intellijPluginDep("gradle-java"))
testCompileOnly(intellijPluginDep("Groovy"))
testCompileOnly(intellijDep())
@@ -71,9 +65,7 @@ dependencies {
testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
Platform[193].orHigher {
testRuntime(intellijPluginDep("gradle-java"))
}
testRuntime(intellijPluginDep("gradle-java"))
testRuntime(intellijPluginDep("Groovy"))
testRuntime(intellijPluginDep("coverage"))
if (Ide.IJ()) {

View File

@@ -11,7 +11,6 @@ import com.intellij.openapi.externalSystem.model.project.ProjectData
import org.gradle.tooling.model.idea.IdeaModule
import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension
// FIX ME WHEN BUNCH 193 REMOVED
abstract class AbstractProjectResolverExtensionCompat : AbstractProjectResolverExtension() {
override fun createModule(gradleModule: IdeaModule, projectDataNode: DataNode<ProjectData>): DataNode<ModuleData>? {
return super.createModule(gradleModule, projectDataNode)?.also {

View File

@@ -8,10 +8,7 @@ dependencies {
compile(project(":idea:idea-core"))
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -14,9 +14,7 @@ dependencies {
compileOnly(intellijDep())
compileOnly(commonDep("com.google.code.findbugs", "jsr305"))
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("junit"))
compileOnly(intellijPluginDep("testng"))

View File

@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.idea.liveTemplates;
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider;
// FIX ME WHEN BUNCH 193 REMOVED
public class KotlinLiveTemplatesProvider implements DefaultLiveTemplatesProvider {
@Override
public String[] getDefaultLiveTemplateFiles() {

View File

@@ -28,7 +28,7 @@ class LiveTemplatesTest : KotlinLightCodeInsightFixtureTestCase() {
override fun setUp() {
super.setUp()
myFixture.testDataPath = File(TEST_DATA_BASE_PATH).path + File.separator
setTemplateTestingCompat(module.project, testRootDisposable)
TemplateManagerImpl.setTemplateTesting(testRootDisposable)
}
fun testSout() {

View File

@@ -1,15 +0,0 @@
/*
* Copyright 2010-2020 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.idea.liveTemplates
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import com.intellij.openapi.Disposable
import com.intellij.openapi.project.Project
// FIX ME WHEN BUNCH 193 REMOVED
fun setTemplateTestingCompat(project: Project, disposable: Disposable) {
TemplateManagerImpl.setTemplateTesting(disposable)
}

View File

@@ -18,13 +18,11 @@ dependencies {
compile(project(":idea:idea-jps-common"))
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java-ide-customization"))
}
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java-ide-customization"))
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) }
excludeInAndroidStudio(rootProject) {

View File

@@ -12,9 +12,7 @@ dependencies {
compile(project(":native:frontend.native"))
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijDep())
testRuntimeOnly(intellijDep())

View File

@@ -13,9 +13,7 @@ dependencies {
compileOnly(intellijCoreDep())
compileOnly(intellijDep())
compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher {
compileOnly(intellijPluginDep("gradle-java"))
}
compileOnly(intellijPluginDep("gradle-java"))
testImplementation(projectTests(":idea"))
testImplementation(project(":libraries:tools:new-project-wizard:new-project-wizard-cli"))

View File

@@ -15,9 +15,7 @@ dependencies {
testCompileOnly(project(":kotlin-reflect-api"))
testCompile(commonDep("junit:junit"))
testCompileOnly(intellijDep())
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java"))
}
testCompileOnly(intellijPluginDep("java"))
}
sourceSets {

View File

@@ -9,7 +9,7 @@ import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupManager
// FIX ME WHEN BUNCH 193 REMOVED
// FIX ME WHEN BUNCH 201 REMOVED
fun runPostStartupActivitiesOnce(project: Project) {
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically()
}

View File

@@ -7,6 +7,5 @@ package org.jetbrains.kotlin.idea.test
import com.intellij.openapi.project.Project
// FIX ME WHEN BUNCH 193 REMOVED
fun runPostStartupActivitiesOnce(project: Project) {
}

View File

@@ -14,9 +14,7 @@ dependencies {
compileOnly(toolsJarApi())
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("stream-debugger"))

View File

@@ -10,9 +10,7 @@ dependencies {
compileOnly(toolsJarApi())
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit"))

View File

@@ -11,9 +11,7 @@ dependencies {
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
compileOnly(toolsJarApi())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijDep())

View File

@@ -9,9 +9,7 @@ dependencies {
compileOnly(toolsJarApi())
compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("stream-debugger"))

View File

@@ -20,10 +20,8 @@ dependencies {
testCompile(intellijPluginDep("stream-debugger"))
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl", "aether-dependency-resolver") }
testRuntime(intellijPluginDep("java"))
}
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl", "aether-dependency-resolver") }
testRuntime(intellijPluginDep("java"))
testRuntime(project(":nj2k:nj2k-services")) { isTransitive = false }
testRuntime(project(":idea:idea-jvm"))

View File

@@ -13,9 +13,7 @@ dependencies {
compileOnly(toolsJarApi())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("java"))
compileOnly(intellijDep())

View File

@@ -12,9 +12,6 @@ dependencies {
compileOnly(intellijPluginDep("gradle"))
compileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") }
Platform[193].orLower {
compile(project(":idea:idea-gradle-tooling-api"))
}
}
sourceSets {

View File

@@ -22,9 +22,6 @@ dependencies {
testRuntimeOnly(project(":nj2k:nj2k-services"))
testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":idea:kotlin-gradle-tooling"))
Platform[193].orLower {
testRuntimeOnly(project(":idea:idea-gradle-tooling-api"))
}
testRuntimeOnly(project(":kotlin-gradle-statistics"))
testImplementation(intellijPluginDep("gradle"))
@@ -40,22 +37,14 @@ dependencies {
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.+")
testImplementation("khttp:khttp:1.0.0")
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
Platform[193].orHigher {
testImplementation(intellijPluginDep("gradle-java"))
testRuntimeOnly(intellijPluginDep("gradle-java"))
}
testImplementation(intellijPluginDep("gradle-java"))
testRuntimeOnly(intellijPluginDep("gradle-java"))
testCompileOnly(intellijDep())
testCompileOnly(project(":nj2k"))
Platform[193].orLower {
testCompileOnly(project(":idea:idea-gradle-tooling-api"))
}
testCompileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") }
}

View File

@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.idea.perf.util.ProfileTools.Companion.initDefaultPro
import org.jetbrains.kotlin.idea.perf.util.logMessage
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
import org.jetbrains.kotlin.idea.testFramework.*
import org.jetbrains.kotlin.idea.testFramework.TestApplicationManager
import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.cleanupCaches
import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.close
import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.isAKotlinScriptFile

View File

@@ -26,10 +26,10 @@ import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.impl.search.IndexPatternBuilder
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
import com.intellij.psi.xml.XmlFileNSInfoProvider
import com.intellij.testFramework.TestApplicationManager
import com.intellij.xml.XmlSchemaProvider
import org.jetbrains.kotlin.idea.framework.KotlinSdkType
import org.jetbrains.kotlin.idea.perf.util.TeamCity
import org.jetbrains.kotlin.idea.testFramework.TestApplicationManager
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
import java.io.File

View File

@@ -43,7 +43,6 @@ import org.jetbrains.kotlin.idea.perf.util.ProfileTools.Companion.initDefaultPro
import org.jetbrains.kotlin.idea.test.GradleProcessOutputInterceptor
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
import org.jetbrains.kotlin.idea.testFramework.*
import org.jetbrains.kotlin.idea.testFramework.TestApplicationManager
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
import java.io.File

View File

@@ -1,18 +0,0 @@
/*
* Copyright 2010-2020 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.idea.testFramework
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectManagerEx
// FIX ME WHEN BUNCH 193 REMOVED
fun ProjectManagerEx.forceCloseProjectEx(project: Project, dispose: Boolean): Boolean {
if (!dispose) error("dispose should be true")
return this.forceCloseProject(project)
}
// FIX ME WHEN BUNCH 193 REMOVED
typealias TestApplicationManager = com.intellij.testFramework.TestApplicationManager

View File

@@ -23,6 +23,7 @@ import com.intellij.openapi.startup.StartupManager
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.TestApplicationManager
import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.perf.util.logMessage
@@ -84,8 +85,7 @@ fun TestApplicationManager.closeProject(project: Project) {
logMessage { "project '$name' is about to be closed" }
dispatchAllInvocationEvents()
val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProjectEx(project, true)
projectManagerEx.forceCloseProject(project)
logMessage { "project '$name' successfully closed" }
}

View File

@@ -25,6 +25,7 @@ import com.intellij.platform.PlatformProjectOpenProcessor
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.TestApplicationManager
import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.perf.util.logMessage
@@ -85,8 +86,7 @@ fun TestApplicationManager.closeProject(project: Project) {
logMessage { "project '$name' is about to be closed" }
dispatchAllInvocationEvents()
val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProjectEx(project, true)
projectManagerEx.forceCloseProject(project)
logMessage { "project '$name' successfully closed" }
}

View File

@@ -31,10 +31,8 @@ dependencies {
testRuntime(project(":idea:idea-android")) { isTransitive = false }
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))

View File

@@ -8,8 +8,10 @@ package org.jetbrains.kotlin.idea.hierarchy.calls
import com.intellij.ide.hierarchy.HierarchyNodeDescriptor
import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor
import com.intellij.ide.hierarchy.call.CalleeMethodsTreeStructure
import com.intellij.ide.util.treeView.NodeDescriptor
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMember
import com.intellij.psi.PsiMethod
import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.asJava.unwrapped
@@ -40,7 +42,7 @@ class KotlinCalleeTreeStructure(
override fun buildChildren(nodeDescriptor: HierarchyNodeDescriptor): Array<Any> {
if (nodeDescriptor is CallHierarchyNodeDescriptor) {
val psiMethod = nodeDescriptor.enclosingElement as? PsiMethod ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
return createCalleeMethodsTreeStructure(myProject, psiMethod, scopeType).getChildElements(nodeDescriptor)
return CalleeMethodsTreeStructure(myProject, psiMethod as PsiMember, scopeType).getChildElements(nodeDescriptor)
}
val element = nodeDescriptor.psiElement as? KtElement ?: return ArrayUtil.EMPTY_OBJECT_ARRAY

View File

@@ -9,6 +9,7 @@ import com.intellij.find.findUsages.JavaFindUsagesOptions
import com.intellij.ide.hierarchy.HierarchyNodeDescriptor
import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor
import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure
import com.intellij.ide.util.treeView.NodeDescriptor
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMember
@@ -67,7 +68,7 @@ class KotlinCallerTreeStructure(
): Collection<Any> {
if (nodeDescriptor is CallHierarchyNodeDescriptor) {
val psiMethod = nodeDescriptor.enclosingElement as? PsiMethod ?: return emptyList()
return createCallerMethodsTreeStructure(myProject, psiMethod, scopeType).getChildElements(nodeDescriptor).toList()
return CallerMethodsTreeStructure(myProject, psiMethod as PsiMember, scopeType).getChildElements(nodeDescriptor).toList()
}
if (element !is KtDeclaration) return emptyList()

View File

@@ -1,24 +0,0 @@
/*
* Copyright 2010-2020 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.
*/
@file:Suppress("TYPEALIAS_EXPANSION_DEPRECATION", "DEPRECATION")
package org.jetbrains.kotlin.idea.hierarchy.calls
import com.intellij.ide.hierarchy.call.CalleeMethodsTreeStructure
import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiMember
import com.intellij.psi.PsiMethod
// FIX ME WHEN BUNCH 193 REMOVED
fun createCallerMethodsTreeStructure(project: Project, method: PsiMethod, scopeType: String): CallerMethodsTreeStructure {
return CallerMethodsTreeStructure(project, method as PsiMember, scopeType)
}
// FIX ME WHEN BUNCH 193 REMOVED
fun createCalleeMethodsTreeStructure(project: Project, method: PsiMethod, scopeType: String): CalleeMethodsTreeStructure {
return CalleeMethodsTreeStructure(project, method as PsiMember, scopeType)
}

View File

@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.idea.KotlinIconProviderBase
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.psi.KtFile
// FIX ME WHEN BUNCH 193 REMOVED
abstract class AbstractNavBarModelExtensionCompatBase : StructureAwareNavBarModelExtension() {
protected abstract fun adjustElementImpl(psiElement: PsiElement?): PsiElement?

View File

@@ -1,11 +0,0 @@
/*
* Copyright 2010-2020 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.idea.projectView
import com.intellij.ide.util.treeView.AbstractTreeNode
// FIX ME WHEN BUNCH 193 REMOVED
typealias AbstractTreeNodeAny = AbstractTreeNode<*>

View File

@@ -28,8 +28,8 @@ class KotlinExpandNodeProjectViewProvider : TreeStructureProvider, DumbAware {
// should be called after ClassesTreeStructureProvider
override fun modify(
parent: AbstractTreeNodeAny,
children: Collection<AbstractTreeNodeAny>,
parent: AbstractTreeNode<*>,
children: Collection<AbstractTreeNode<*>>,
settings: ViewSettings
): Collection<AbstractTreeNode<out Any>> {
val result = ArrayList<AbstractTreeNode<out Any>>()
@@ -60,16 +60,16 @@ class KotlinExpandNodeProjectViewProvider : TreeStructureProvider, DumbAware {
else -> null
}
override fun getData(selected: Collection<AbstractTreeNodeAny>, dataName: String): Any? = null
override fun getData(selected: Collection<AbstractTreeNode<*>>, dataName: String): Any? = null
}
class KotlinSelectInProjectViewProvider(private val project: Project) : SelectableTreeStructureProvider, DumbAware {
override fun getData(selected: Collection<AbstractTreeNodeAny>, dataName: String): Any? = null
override fun getData(selected: Collection<AbstractTreeNode<*>>, dataName: String): Any? = null
override fun modify(
parent: AbstractTreeNodeAny,
children: Collection<AbstractTreeNodeAny>,
parent: AbstractTreeNode<*>,
children: Collection<AbstractTreeNode<*>>,
settings: ViewSettings
): Collection<AbstractTreeNode<out Any>> {
return ArrayList(children)

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.ComboBox
import com.intellij.psi.PsiDocumentManager
import com.intellij.refactoring.BaseRefactoringProcessor
import com.intellij.refactoring.ui.RefactoringDialog

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2010-2020 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.idea.refactoring.changeSignature.ui
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.Messages.OkCancelResult
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import javax.swing.Icon
// FIX ME WHEN BUNCH 193 REMOVED
@OkCancelResult
fun showOkCancelDialog(
project: Project?,
message: String?,
title: String,
icon: Icon?
): Int {
return Messages.showOkCancelDialog(
project,
message,
title,
Messages.getOkButton(),
Messages.getCancelButton(),
icon
)
}
typealias ComboBox = com.intellij.openapi.ui.ComboBox<DescriptorVisibility>

View File

@@ -332,12 +332,15 @@ class KotlinChangeSignatureDialog(
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false, reanalyse = true).type == null
) {
if (showOkCancelDialog(
if (Messages.showOkCancelDialog(
myProject,
KotlinBundle.message("message.text.return.type.cannot.be.resolved",
myReturnTypeCodeFragment?.text.toString()
),
KotlinBundle.message(
"message.text.return.type.cannot.be.resolved",
myReturnTypeCodeFragment?.text.toString()
),
RefactoringBundle.message("changeSignature.refactoring.name"),
Messages.getOkButton(),
Messages.getCancelButton(),
Messages.getWarningIcon()
) != Messages.OK
) {
@@ -351,13 +354,16 @@ class KotlinChangeSignatureDialog(
KotlinBundle.message("text.parameter.0", item.parameter.name)
else
KotlinBundle.message("text.receiver")
if (showOkCancelDialog(
if (Messages.showOkCancelDialog(
myProject,
KotlinBundle.message("message.type.for.cannot.be.resolved",
item.typeCodeFragment.text,
paramText
),
KotlinBundle.message(
"message.type.for.cannot.be.resolved",
item.typeCodeFragment.text,
paramText
),
RefactoringBundle.message("changeSignature.refactoring.name"),
Messages.getOkButton(),
Messages.getCancelButton(),
Messages.getWarningIcon()
) != Messages.OK
) {

View File

@@ -9,6 +9,7 @@ import com.intellij.psi.PsiCall
import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.search.SearchScope
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor
@@ -22,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.idea.findUsages.processAllUsages
import org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinValVar
import org.jetbrains.kotlin.idea.refactoring.changeSignature.toValVar
@@ -45,7 +45,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
class InflowSlicer(
element: KtElement,
processor: SliceUsageProcessor,
processor: Processor<in SliceUsage>,
parentUsage: KotlinSliceUsage
) : Slicer(element, processor, parentUsage) {

View File

@@ -5,7 +5,8 @@
package org.jetbrains.kotlin.idea.slicer
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
@@ -34,7 +35,11 @@ data class KotlinSliceAnalysisMode(val behaviourStack: List<Behaviour>, val inli
get() = behaviourStack.lastOrNull()
interface Behaviour {
fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor)
fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
)
val slicePresentationPrefix: String
val testPresentationPrefix: String

View File

@@ -27,7 +27,7 @@ import com.intellij.psi.PsiElement
import com.intellij.slicer.SliceAnalysisParams
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import com.intellij.util.Processor
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.endOffset
@@ -98,7 +98,10 @@ open class KotlinSliceUsage : SliceUsage {
override fun canBeLeaf() = element != null && mode == KotlinSliceAnalysisMode.Default
public override fun processUsagesFlownDownTo(element: PsiElement, uniqueProcessor: SliceUsageProcessor) {
public override fun processUsagesFlownDownTo(
element: PsiElement,
uniqueProcessor: Processor<in SliceUsage>
) {
val ktElement = element as? KtElement ?: return
val behaviour = mode.currentBehaviour
if (behaviour != null) {
@@ -108,7 +111,10 @@ open class KotlinSliceUsage : SliceUsage {
}
}
public override fun processUsagesFlownFromThe(element: PsiElement, uniqueProcessor: SliceUsageProcessor) {
public override fun processUsagesFlownFromThe(
element: PsiElement,
uniqueProcessor: Processor<in SliceUsage>
) {
val ktElement = element as? KtElement ?: return
val behaviour = mode.currentBehaviour
if (behaviour != null) {

View File

@@ -9,11 +9,14 @@ import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement
data class LambdaCallsBehaviour(private val sliceProducer: SliceProducer) : KotlinSliceAnalysisMode.Behaviour {
override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) {
override fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
) {
val processor = object : Processor<SliceUsage> {
override fun process(sliceUsage: SliceUsage): Boolean {
if (sliceUsage is KotlinSliceUsage && sliceUsage.mode.currentBehaviour === this@LambdaCallsBehaviour) {

View File

@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer
import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement
data class LambdaParameterInflowBehaviour(val parameterIndex: Int) : KotlinSliceAnalysisMode.Behaviour {
override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) {
override fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
) {
InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
}

View File

@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer
import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement
object LambdaReceiverInflowBehaviour : KotlinSliceAnalysisMode.Behaviour {
override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) {
override fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
) {
InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
}

View File

@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer
import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement
object LambdaResultInflowBehaviour : KotlinSliceAnalysisMode.Behaviour {
override fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) {
override fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
) {
InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
}

View File

@@ -11,7 +11,9 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.util.parentOfType
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.builtins.isExtensionFunctionType
import org.jetbrains.kotlin.builtins.isFunctionType
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue
@@ -24,7 +26,6 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.idea.search.declarationsSearch.forEachOverridingElement
import org.jetbrains.kotlin.idea.search.ideaExtensions.KotlinReadWriteAccessDetector
import org.jetbrains.kotlin.idea.util.actualsForExpected
@@ -36,7 +37,7 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
class OutflowSlicer(
element: KtElement,
processor: SliceUsageProcessor,
processor: Processor<in SliceUsage>,
parentUsage: KotlinSliceUsage
) : Slicer(element, processor, parentUsage) {

View File

@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.slicer
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import com.intellij.util.Processor
interface SliceProducer {
fun produce(usage: UsageInfo, mode: KotlinSliceAnalysisMode, parent: SliceUsage): Collection<SliceUsage>?
@@ -34,7 +34,7 @@ fun SliceProducer.produceAndProcess(
sliceUsage: SliceUsage,
mode: KotlinSliceAnalysisMode,
parentUsage: SliceUsage,
processor: SliceUsageProcessor
processor: Processor<in SliceUsage>
): Boolean {
val result = produce(sliceUsage.usageInfo, mode, parentUsage) ?: listOf(sliceUsage)
for (usage in result) {

View File

@@ -12,7 +12,9 @@ import com.intellij.psi.PsiMethod
import com.intellij.psi.search.SearchScope
import com.intellij.psi.util.parentOfType
import com.intellij.slicer.JavaSliceUsage
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.asJava.namedUnwrappedElement
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode
@@ -29,7 +31,6 @@ import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.idea.findUsages.processAllExactUsages
import org.jetbrains.kotlin.idea.findUsages.processAllUsages
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
@@ -54,7 +55,7 @@ import java.util.*
abstract class Slicer(
protected val element: KtElement,
protected val processor: SliceUsageProcessor,
protected val processor: Processor<in SliceUsage>,
protected val parentUsage: KotlinSliceUsage
) {
abstract fun processChildren(forcedExpressionMode: Boolean)

View File

@@ -25,7 +25,7 @@ abstract class KotlinHierarchyViewTestBase : KotlinLightCodeInsightFixtureTestCa
) {
myFixture.configureByFiles(*fileNames)
val expectedStructure = loadExpectedStructure()
doHierarchyTestCompat(hierarchyFixture, treeStructureComputable, expectedStructure)
HierarchyViewTestFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
}
@Throws(IOException::class)

View File

@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.idea.codeInsight.postfix
import org.jetbrains.kotlin.idea.liveTemplates.setTemplateTestingCompat
import com.intellij.codeInsight.template.impl.TemplateManagerImpl
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.test.InTextDirectivesUtils
@@ -30,7 +30,7 @@ abstract class AbstractPostfixTemplateProviderTest : KotlinLightCodeInsightFixtu
myFixture.configureByFile(fileName)
val template = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TEMPLATE:")
if (template != null) {
setTemplateTestingCompat(project, testRootDisposable)
TemplateManagerImpl.setTemplateTesting(testRootDisposable)
myFixture.type(template.replace("\\t", "\t"))
} else {
myFixture.type('\t')

View File

@@ -5,22 +5,9 @@
package org.jetbrains.kotlin.idea
import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.util.Computable
import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture
// FIX ME WHEN BUNCH 193 REMOVED
@Suppress("UNUSED_PARAMETER")
fun doHierarchyTestCompat(
hierarchyFixture: HierarchyViewTestFixture,
treeStructureComputable: Computable<out HierarchyTreeStructure>,
expectedStructure: String,
) {
HierarchyViewTestFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
}
fun <T> maskExtensions(
pointName: ExtensionPointName<T>,

View File

@@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.hierarchy
import com.intellij.ide.hierarchy.*
import com.intellij.ide.hierarchy.actions.BrowseHierarchyActionBase
import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure
import com.intellij.ide.hierarchy.type.SubtypesHierarchyTreeStructure
import com.intellij.ide.hierarchy.type.SupertypesHierarchyTreeStructure
import com.intellij.ide.hierarchy.type.TypeHierarchyTreeStructure
@@ -15,10 +16,7 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider
import com.intellij.openapi.util.Computable
import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.*
import com.intellij.refactoring.util.CommonRefactoringUtil.RefactoringErrorHintException
import com.intellij.rt.execution.junit.ComparisonDetailsExtractor
import com.intellij.testFramework.LightProjectDescriptor
@@ -29,7 +27,6 @@ import junit.framework.TestCase
import org.jetbrains.kotlin.idea.KotlinHierarchyViewTestBase
import org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCalleeTreeStructure
import org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCallerTreeStructure
import org.jetbrains.kotlin.idea.hierarchy.calls.createCallerMethodsTreeStructure
import org.jetbrains.kotlin.idea.hierarchy.overrides.KotlinOverrideTreeStructure
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.psi.KtCallableDeclaration
@@ -124,10 +121,9 @@ abstract class AbstractHierarchyTest : KotlinHierarchyViewTestBase() {
private val callerJavaHierarchyStructure: Computable<HierarchyTreeStructure>
get() = Computable {
createCallerMethodsTreeStructure(
CallerMethodsTreeStructure(
project,
(getElementAtCaret(LanguageCallHierarchy.INSTANCE) as PsiMethod),
HierarchyBrowserBaseEx.SCOPE_PROJECT
(getElementAtCaret(LanguageCallHierarchy.INSTANCE) as PsiMethod) as PsiMember, HierarchyBrowserBaseEx.SCOPE_PROJECT
)
}

View File

@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.util.ArrayUtil
import com.intellij.util.PathUtil
import junit.framework.ComparisonFailure
@@ -335,7 +336,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
TestCase.fail("Action '$text' is available (but must not) in test $testFilePath")
}
invokeIntentionCompat(action, file, editor)
CodeInsightTestFixtureImpl.invokeIntention(action, file, editor)
if (!shouldBeAvailableAfterExecution) {
val afterAction = findActionByPattern(pattern, getAvailableActions())

View File

@@ -1,16 +0,0 @@
/*
* Copyright 2010-2020 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.idea.quickfix
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.openapi.editor.Editor
import com.intellij.psi.PsiFile
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
// FIX ME WHEN BUNCH 193 REMOVED
fun invokeIntentionCompat(action: IntentionAction, file: PsiFile, editor: Editor) {
CodeInsightTestFixtureImpl.invokeIntention(action, file, editor)
}

View File

@@ -15,7 +15,6 @@ import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import com.intellij.testFramework.fixtures.CodeInsightTestUtil
import junit.framework.TestCase
import org.jetbrains.kotlin.idea.liveTemplates.setTemplateTestingCompat
import org.jetbrains.kotlin.idea.refactoring.rename.KotlinMemberInplaceRenameHandler
import org.jetbrains.kotlin.idea.refactoring.rename.KotlinVariableInplaceRenameHandler
import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinImplicitLambdaParameter
@@ -202,7 +201,7 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
val project = editor.project!!
setTemplateTestingCompat(project, testRootDisposable)
TemplateManagerImpl.setTemplateTesting(testRootDisposable)
object : WriteCommandAction.Simple<Any>(project) {
override fun run() {

View File

@@ -24,10 +24,8 @@ dependencies {
testCompileOnly(intellijDep())
Platform[192].orHigher {
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
testCompile(project(":idea:idea-native")) { isTransitive = false }
testCompile(project(":idea:idea-gradle-native")) { isTransitive = false }

View File

@@ -44,9 +44,7 @@ dependencies {
testRuntime(project(it))
}
Platform[192].orHigher {
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect"))

Some files were not shown because too many files have changed in this diff Show More