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
+1 -3
View File
@@ -40,9 +40,7 @@ dependencies {
compile(project(":compiler:cli")) compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") } compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") } compile(jpsStandalone()) { includeJars("jps-model") }
Platform[192].orHigher { compile(intellijPluginDep("java"))
compile(intellijPluginDep("java"))
}
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) } compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version") compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
} }
+4 -5
View File
@@ -168,9 +168,8 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6" extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2" extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1" extra["versions.android"] = "2.3.1"
val coroutinesVersion = if (Platform[192].orHigher()) "1.3.7" else "1.1.1" extra["versions.kotlinx-coroutines-core"] = "1.3.7"
extra["versions.kotlinx-coroutines-core"] = coroutinesVersion extra["versions.kotlinx-coroutines-jdk8"] = "1.3.7"
extra["versions.kotlinx-coroutines-jdk8"] = coroutinesVersion
extra["versions.json"] = "20160807" extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14" extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0" extra["versions.ant-launcher"] = "1.8.0"
@@ -868,8 +867,8 @@ tasks {
":compiler:test", ":compiler:test",
":js:js.tests: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()) if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test") dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
+1 -3
View File
@@ -34,9 +34,7 @@ dependencies {
Platform[201].orLower { Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) } 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(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest()) testCompile(jpsBuildTest())
} }
+1 -6
View File
@@ -57,14 +57,9 @@ dependencies {
testCompileOnly(project(it)) testCompileOnly(project(it))
} }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } 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) } 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(project(":kotlin-reflect"))
testRuntime(androidDxJar()) testRuntime(androidDxJar())
@@ -102,6 +102,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil import org.jetbrains.kotlin.utils.PathUtil
import java.io.File import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor( class KotlinCoreEnvironment private constructor(
@@ -536,7 +537,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})" "(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 @JvmStatic
@@ -106,6 +106,7 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin import org.jetbrains.kotlin.serialization.DescriptorSerializerPlugin
import org.jetbrains.kotlin.utils.PathUtil import org.jetbrains.kotlin.utils.PathUtil
import java.io.File import java.io.File
import java.nio.file.FileSystems
import java.util.zip.ZipFile import java.util.zip.ZipFile
class KotlinCoreEnvironment private constructor( class KotlinCoreEnvironment private constructor(
@@ -534,7 +535,11 @@ class KotlinCoreEnvironment private constructor(
"(cp:\n ${(Thread.currentThread().contextClassLoader as? UrlClassLoader)?.urls?.joinToString("\n ") { it.file }})" "(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 @JvmStatic
@@ -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)
}
+2 -4
View File
@@ -25,10 +25,8 @@ dependencies {
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))
testRuntime(project(":core:descriptors.runtime")) testRuntime(project(":core:descriptors.runtime"))
Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
} }
sourceSets { sourceSets {
+2 -4
View File
@@ -30,10 +30,8 @@ dependencies {
testRuntimeOnly(project(":kotlin-reflect")) testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":core:descriptors.runtime")) testRuntimeOnly(project(":core:descriptors.runtime"))
Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
} }
sourceSets { sourceSets {
@@ -17,10 +17,8 @@ dependencies {
includeJars("extensions", "idea_rt", "util", "asm-all", "platform-util-ex", rootProject = rootProject) includeJars("extensions", "idea_rt", "util", "asm-all", "platform-util-ex", rootProject = rootProject)
} }
Platform[192].orHigher { testCompileOnly(intellijPluginDep("java")) { includeJars("java-api") }
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api") } testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(intellijDep()) testRuntimeOnly(intellijDep())
@@ -37,10 +37,8 @@ dependencies {
implementation("org.openjdk.jmh", "jmh-generator-bytecode", jmhVersion) implementation("org.openjdk.jmh", "jmh-generator-bytecode", jmhVersion)
implementation("org.openjdk.jmh", "jmh-generator-annprocess", jmhVersion) implementation("org.openjdk.jmh", "jmh-generator-annprocess", jmhVersion)
Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
} }
sourceSets { sourceSets {
@@ -27,10 +27,8 @@ dependencies {
testRuntimeOnly(project(":kotlin-reflect")) testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":core:descriptors.runtime")) testRuntimeOnly(project(":core:descriptors.runtime"))
Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
} }
sourceSets { sourceSets {
@@ -16,10 +16,8 @@ dependencies {
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } compileOnly(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) }
Platform[192].orHigher { testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
}
} }
sourceSets { sourceSets {
@@ -23,9 +23,7 @@ dependencies {
includeJars("trove4j", rootProject = rootProject) includeJars("trove4j", rootProject = rootProject)
} }
Platform[192].orHigher { runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
runtimeOnly(intellijCoreDep()) { includeJars("jdom") }
}
} }
val writeCopyright by task<WriteCopyrightToFile> { val writeCopyright by task<WriteCopyrightToFile> {
+1 -3
View File
@@ -11,9 +11,7 @@ dependencies {
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") } 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) } compileOnly(intellijDep()) { includeJars("asm-all", "trove4j", "guava", rootProject = rootProject) }
} }
+2 -7
View File
@@ -92,13 +92,8 @@ dependencies {
isTransitive = false isTransitive = false
} }
Platform[192].orHigher { testCompile(intellijDep()) { includeJars("platform-util-ui", "platform-concurrency", "platform-objectSerializer") }
testCompile(intellijDep()) { includeJars("platform-util-ui", "platform-concurrency", "platform-objectSerializer") } testCompile(intellijDep()) { includeJars("platform-ide-util-io") }
}
Platform[193].orHigher {
testCompile(intellijDep()) { includeJars("platform-ide-util-io") }
}
} }
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> { tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
-109
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 {}
+1 -3
View File
@@ -13,9 +13,7 @@ dependencies {
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))
testRuntimeOnly(toolsJar()) testRuntimeOnly(toolsJar())
testRuntime(intellijDep()) 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")) if (System.getProperty("idea.active") != null) testRuntimeOnly(files("${rootProject.projectDir}/dist/kotlinc/lib/kotlin-reflect.jar"))
} }
+7 -9
View File
@@ -5,16 +5,14 @@ plugins {
dependencies { dependencies {
testCompile(projectTests(":compiler")) testCompile(projectTests(":compiler"))
Platform[192].orHigher { testCompileOnly(intellijDep()) {
testCompileOnly(intellijDep()) { includeJars("groovy-all", rootProject = rootProject)
includeJars("groovy-all", rootProject = rootProject)
}
testCompile(intellijDep()) {
includeJars("gson", rootProject = rootProject)
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijPluginDep("java"))
} }
testCompile(intellijDep()) {
includeJars("gson", rootProject = rootProject)
}
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(intellijPluginDep("java"))
compile("org.jsoup:jsoup:1.10.3") compile("org.jsoup:jsoup:1.10.3")
if (System.getProperty("idea.active") != null) testRuntimeOnly(files("${rootProject.projectDir}/dist/kotlinc/lib/kotlin-reflect.jar")) if (System.getProperty("idea.active") != null) testRuntimeOnly(files("${rootProject.projectDir}/dist/kotlinc/lib/kotlin-reflect.jar"))
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))
+2 -4
View File
@@ -14,10 +14,8 @@ dependencies {
testCompile(projectTests(":generators:test-generator")) testCompile(projectTests(":generators:test-generator"))
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") } testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
Platform[192].orHigher { testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency") }
testRuntimeOnly(intellijDep()) { includeJars("platform-concurrency") } testRuntimeOnly(jpsStandalone()) { includeJars("jps-model") }
testRuntimeOnly(jpsStandalone()) { includeJars("jps-model") }
}
} }
sourceSets { sourceSets {
+7 -10
View File
@@ -95,17 +95,14 @@ dependencies {
compileOnly(project(":kotlin-daemon-client")) compileOnly(project(":kotlin-daemon-client"))
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
Platform[193].orHigher { compileOnly(intellijPluginDep("java"))
implementation(commonDep("org.jetbrains.intellij.deps.completion", "completion-ranking-kotlin")) testCompileOnly(intellijPluginDep("java"))
Ide.IJ { testRuntime(intellijPluginDep("java"))
implementation(intellijPluginDep("stats-collector"))
} implementation(commonDep("org.jetbrains.intellij.deps.completion", "completion-ranking-kotlin"))
Ide.IJ {
implementation(intellijPluginDep("stats-collector"))
} }
compileOnly(commonDep("org.jetbrains", "markdown")) compileOnly(commonDep("org.jetbrains", "markdown"))
+1 -3
View File
@@ -8,9 +8,7 @@ dependencies {
compile(project(":compiler:util")) compile(project(":compiler:util"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
@@ -49,13 +49,13 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Classes //region Classes
override fun processAllClassNames(processor: StringProcessor): Boolean { override fun processAllClassNames(processor: Processor<in String>): Boolean {
if (disableSearch.get()) return true if (disableSearch.get()) return true
return KotlinClassShortNameIndex.getInstance().processAllKeys(project, processor) && return KotlinClassShortNameIndex.getInstance().processAllKeys(project, processor) &&
KotlinFileFacadeShortNameIndex.INSTANCE.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 if (disableSearch.get()) return true
return processAllClassNames(processor) return processAllClassNames(processor)
} }
@@ -150,7 +150,11 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Methods //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 if (disableSearch.get()) return true
return processAllMethodNames(processor) 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 (disableSearch.get()) return true
if (!KotlinFunctionShortNameIndex.getInstance().processAllKeys(project, processor)) { if (!KotlinFunctionShortNameIndex.getInstance().processAllKeys(project, processor)) {
return false 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 if (disableSearch.get()) return true
return ContainerUtil.process(getMethodsByName(name, scope), processor) return ContainerUtil.process(getMethodsByName(name, scope), processor)
} }
@@ -253,7 +261,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
//region Fields //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 if (disableSearch.get()) return true
return processAllFieldNames(processor) 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 if (disableSearch.get()) return true
return KotlinPropertyShortNameIndex.getInstance().processAllKeys(project, processor) return KotlinPropertyShortNameIndex.getInstance().processAllKeys(project, processor)
} }
@@ -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>
@@ -6,10 +6,7 @@
package org.jetbrains.kotlin.idea.completion.test.handlers package org.jetbrains.kotlin.idea.completion.test.handlers
import com.intellij.codeInsight.completion.CompletionType import com.intellij.codeInsight.completion.CompletionType
import com.intellij.codeInsight.lookup.LookupElement import com.intellij.codeInsight.lookup.*
import com.intellij.codeInsight.lookup.LookupElementPresentation
import com.intellij.codeInsight.lookup.LookupEvent
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.impl.LookupImpl import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture 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 if (lookup.currentItem != item) { // do not touch selection if not changed - important for char filter tests
lookup.currentItem = item lookup.currentItem = item
} }
lookup.setFocusedFocusDegree() lookup.lookupFocusDegree = LookupFocusDegree.FOCUSED
if (LookupEvent.isSpecialCompletionChar(completionChar)) { if (LookupEvent.isSpecialCompletionChar(completionChar)) {
lookup.finishLookup(completionChar) lookup.finishLookup(completionChar)
} else { } else {
@@ -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
}
+1 -3
View File
@@ -31,9 +31,7 @@ dependencies {
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("gradle")) compileOnly(intellijPluginDep("gradle"))
} }
@@ -24,7 +24,7 @@ import com.intellij.psi.impl.java.stubs.index.JavaShortClassNameIndex
import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.GlobalSearchScope
import com.intellij.psi.search.PsiShortNamesCache import com.intellij.psi.search.PsiShortNamesCache
import com.intellij.psi.stubs.StubIndex 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 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 // 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 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>() override fun getAllFieldNames() = emptyArray<String>()
@@ -29,9 +29,7 @@ dependencies {
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
testRuntime(intellijDep()) testRuntime(intellijDep())
Platform[192].orHigher { compile(intellijPluginDep("java"))
compile(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
+1 -3
View File
@@ -25,9 +25,7 @@ dependencies {
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
testRuntime(intellijDep()) testRuntime(intellijDep())
Platform[192].orHigher { compile(intellijPluginDep("java"))
compile(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
+1 -8
View File
@@ -13,14 +13,7 @@ dependencies {
compileOnly(project(":compiler:psi")) compileOnly(project(":compiler:psi"))
compileOnly(intellijCoreDep()) compileOnly(intellijCoreDep())
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
Platform[191].orLower {
compileOnly(intellijDep()) { includeJars("java-api", "java-impl") }
}
Platform[192].orHigher {
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
} }
sourceSets { sourceSets {
+1 -3
View File
@@ -33,9 +33,7 @@ dependencies {
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
Platform[192].orHigher { compile(intellijPluginDep("java"))
compile(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
@@ -36,9 +36,7 @@ dependencies {
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
Platform[192].orHigher { compile(intellijPluginDep("java"))
compile(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
@@ -19,14 +19,7 @@ dependencies {
compileOnly(intellijCoreDep()) compileOnly(intellijCoreDep())
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(project(":compiler:light-classes")) compileOnly(project(":compiler:light-classes"))
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
Platform[191].orLower {
compileOnly(intellijDep()) { includeJars("java-api", "java-impl") }
}
Platform[192].orHigher {
compileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl") }
}
} }
sourceSets { sourceSets {
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.idea.util.application.getServiceSafe
/** /**
* Tested in OutOfBlockModificationTestGenerated * Tested in OutOfBlockModificationTestGenerated
*/ */
// FIX ME WHEN BUNCH 193 REMOVED
class KotlinCodeBlockModificationListener(project: Project) : KotlinCodeBlockModificationListenerCompat(project) { class KotlinCodeBlockModificationListener(project: Project) : KotlinCodeBlockModificationListenerCompat(project) {
init { init {
@@ -41,7 +41,6 @@ val KOTLIN_CONSOLE_KEY = Key.create<Boolean>("kotlin.console")
/** /**
* Tested in OutOfBlockModificationTestGenerated * Tested in OutOfBlockModificationTestGenerated
*/ */
// FIX ME WHEN BUNCH 193 REMOVED
abstract class KotlinCodeBlockModificationListenerCompat(protected val project: Project) : PsiTreeChangePreprocessor, Disposable { abstract class KotlinCodeBlockModificationListenerCompat(protected val project: Project) : PsiTreeChangePreprocessor, Disposable {
protected val modificationTrackerImpl: PsiModificationTrackerImpl = protected val modificationTrackerImpl: PsiModificationTrackerImpl =
PsiModificationTracker.SERVICE.getInstance(project) as PsiModificationTrackerImpl PsiModificationTracker.SERVICE.getInstance(project) as PsiModificationTrackerImpl
@@ -24,6 +24,8 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.psi.PsiElement import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiParameter 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.KotlinCallableFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory import org.jetbrains.kotlin.idea.findUsages.KotlinFindUsagesHandlerFactory
import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.idea.util.application.runReadAction
@@ -73,7 +75,11 @@ class DelegatingFindMemberUsagesHandler(
return kotlinHandler.getFindUsagesOptions(dataContext) 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 val (handler, handlerOptions) = runReadAction { getHandlerAndOptions(element, options) } ?: return true
return handler.processElementUsages(element, processor, handlerOptions!!) return handler.processElementUsages(element, processor, handlerOptions!!)
} }
@@ -26,6 +26,7 @@ import com.intellij.psi.search.PsiElementProcessor
import com.intellij.psi.search.PsiElementProcessorAdapter import com.intellij.psi.search.PsiElementProcessorAdapter
import com.intellij.psi.search.searches.MethodReferencesSearch import com.intellij.psi.search.searches.MethodReferencesSearch
import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.usageView.UsageInfo
import com.intellij.util.FilteredQuery import com.intellij.util.FilteredQuery
import com.intellij.util.Processor import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.asJava.LightClassProvider.Companion.providedToLightClass 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) return MySearcher(element, processor, options)
} }
private class MySearcher( private class MySearcher(
element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions element: PsiElement, processor: Processor<in UsageInfo>, options: FindUsagesOptions
) : Searcher(element, processor, options) { ) : Searcher(element, processor, options) {
private val kotlinOptions = options as KotlinClassFindUsagesOptions private val kotlinOptions = options as KotlinClassFindUsagesOptions
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiReference
import com.intellij.psi.search.SearchScope import com.intellij.psi.search.SearchScope
import com.intellij.psi.search.searches.MethodReferencesSearch import com.intellij.psi.search.searches.MethodReferencesSearch
import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.usageView.UsageInfo
import com.intellij.util.* import com.intellij.util.*
import org.jetbrains.annotations.TestOnly import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.asJava.LightClassProvider.Companion.providedToLightMethods import org.jetbrains.kotlin.idea.asJava.LightClassProvider.Companion.providedToLightMethods
@@ -101,7 +102,11 @@ abstract class KotlinFindMemberUsagesHandler<T : KtNamedDeclaration> protected c
factory: KotlinFindUsagesHandlerFactory factory: KotlinFindUsagesHandlerFactory
) : KotlinFindMemberUsagesHandler<KtNamedDeclaration>(propertyDeclaration, elementsToSearch, factory) { ) : 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 || if (ApplicationManager.getApplication().isUnitTestMode ||
!isPropertyOfDataClass || !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) return MySearcher(element, processor, options)
} }
private inner class MySearcher( private inner class MySearcher(
element: PsiElement, processor: UsageInfoProcessor, options: FindUsagesOptions element: PsiElement, processor: Processor<in UsageInfo>, options: FindUsagesOptions
) : Searcher(element, processor, options) { ) : Searcher(element, processor, options) {
private val kotlinOptions = options as KotlinCallableFindUsagesOptions private val kotlinOptions = options as KotlinCallableFindUsagesOptions
@@ -55,7 +55,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
elementsToSearch.toTypedArray() 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 if (!options.isSearchForTextOccurrences) return true
val scope = options.searchScope val scope = options.searchScope
@@ -71,13 +75,17 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return true 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) return searchReferences(element, processor, options, forHighlight = false) && searchTextOccurrences(element, processor, options)
} }
private fun searchReferences( private fun searchReferences(
element: PsiElement, element: PsiElement,
processor: UsageInfoProcessor, processor: Processor<in UsageInfo>,
options: FindUsagesOptions, options: FindUsagesOptions,
forHighlight: Boolean forHighlight: Boolean
): Boolean { ): Boolean {
@@ -86,7 +94,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return searcher.executeTasks() 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> { override fun findReferencesToHighlight(target: PsiElement, searchScope: SearchScope): Collection<PsiReference> {
val results = Collections.synchronizedList(arrayListOf<PsiReference>()) val results = Collections.synchronizedList(arrayListOf<PsiReference>())
@@ -102,7 +114,11 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
return results 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>() private val tasks = ArrayList<() -> Boolean>()
/** /**
@@ -128,7 +144,7 @@ abstract class KotlinFindUsagesHandler<T : PsiElement>(
companion object { companion object {
val LOG = Logger.getInstance(KotlinFindUsagesHandler::class.java) 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 { processor.processIfNotNull {
when { when {
ref is LightMemberReference -> KotlinReferencePreservingUsageInfo(ref) 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 } 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() ProgressManager.checkCanceled()
val usageInfo = runReadAction(callback) val usageInfo = runReadAction(callback)
return if (usageInfo != null) process(usageInfo) else true 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) val uniqueProcessor = CommonProcessors.UniqueProcessor(usageInfoProcessor)
return Processor { processUsage(uniqueProcessor, it) } return Processor { processUsage(uniqueProcessor, it) }
@@ -21,6 +21,8 @@ import com.intellij.find.findUsages.FindUsagesOptions
import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.actionSystem.DataContext
import com.intellij.psi.PsiElement import com.intellij.psi.PsiElement
import com.intellij.psi.search.searches.ReferencesSearch 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.KotlinFindUsagesHandlerFactory
import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinTypeParameterFindUsagesDialog import org.jetbrains.kotlin.idea.findUsages.dialogs.KotlinTypeParameterFindUsagesDialog
import org.jetbrains.kotlin.psi.KtNamedDeclaration 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) { return object : Searcher(element, processor, options) {
override fun buildTaskList(forHighlight: Boolean): Boolean { override fun buildTaskList(forHighlight: Boolean): Boolean {
addTask { addTask {
@@ -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>
+3 -9
View File
@@ -23,9 +23,7 @@ dependencies {
testCompile(projectTests(":idea:idea-gradle")) testCompile(projectTests(":idea:idea-gradle"))
compileOnly(intellijPluginDep("gradle")) compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher { compileOnly(intellijPluginDep("gradle-java"))
compileOnly(intellijPluginDep("gradle-java"))
}
compileOnly(intellijPluginDep("Groovy")) compileOnly(intellijPluginDep("Groovy"))
compileOnly(intellijDep()) compileOnly(intellijDep())
@@ -36,9 +34,7 @@ dependencies {
testCompileOnly(intellijPluginDep("Groovy")) testCompileOnly(intellijPluginDep("Groovy"))
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar()) testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))
@@ -61,9 +57,7 @@ dependencies {
testRuntime(intellijPluginDep("testng")) testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("properties")) testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle")) testRuntime(intellijPluginDep("gradle"))
Platform[193].orHigher { testRuntime(intellijPluginDep("gradle-java"))
testRuntime(intellijPluginDep("gradle-java"))
}
testRuntime(intellijPluginDep("Groovy")) testRuntime(intellijPluginDep("Groovy"))
testRuntime(intellijPluginDep("coverage")) testRuntime(intellijPluginDep("coverage"))
if (Ide.IJ()) { if (Ide.IJ()) {
@@ -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")
}
+6 -14
View File
@@ -20,9 +20,7 @@ dependencies {
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(intellijPluginDep("gradle")) compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher { compileOnly(intellijPluginDep("gradle-java"))
compileOnly(intellijPluginDep("gradle-java"))
}
compileOnly(intellijPluginDep("Groovy")) compileOnly(intellijPluginDep("Groovy"))
compileOnly(intellijPluginDep("junit")) compileOnly(intellijPluginDep("junit"))
compileOnly(intellijPluginDep("testng")) compileOnly(intellijPluginDep("testng"))
@@ -30,19 +28,15 @@ dependencies {
compileOnly(project(":kotlin-gradle-statistics")) compileOnly(project(":kotlin-gradle-statistics"))
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java")) testCompileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java")) testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
testCompile(projectTests(":idea")) testCompile(projectTests(":idea"))
testCompile(projectTests(":idea:idea-test-framework")) testCompile(projectTests(":idea:idea-test-framework"))
testCompile(intellijPluginDep("gradle")) testCompile(intellijPluginDep("gradle"))
Platform[193].orHigher { testCompile(intellijPluginDep("gradle-java"))
testCompile(intellijPluginDep("gradle-java"))
}
testCompileOnly(intellijPluginDep("Groovy")) testCompileOnly(intellijPluginDep("Groovy"))
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
@@ -71,9 +65,7 @@ dependencies {
testRuntime(intellijPluginDep("testng")) testRuntime(intellijPluginDep("testng"))
testRuntime(intellijPluginDep("properties")) testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle")) testRuntime(intellijPluginDep("gradle"))
Platform[193].orHigher { testRuntime(intellijPluginDep("gradle-java"))
testRuntime(intellijPluginDep("gradle-java"))
}
testRuntime(intellijPluginDep("Groovy")) testRuntime(intellijPluginDep("Groovy"))
testRuntime(intellijPluginDep("coverage")) testRuntime(intellijPluginDep("coverage"))
if (Ide.IJ()) { if (Ide.IJ()) {
@@ -11,7 +11,6 @@ import com.intellij.openapi.externalSystem.model.project.ProjectData
import org.gradle.tooling.model.idea.IdeaModule import org.gradle.tooling.model.idea.IdeaModule
import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension
// FIX ME WHEN BUNCH 193 REMOVED
abstract class AbstractProjectResolverExtensionCompat : AbstractProjectResolverExtension() { abstract class AbstractProjectResolverExtensionCompat : AbstractProjectResolverExtension() {
override fun createModule(gradleModule: IdeaModule, projectDataNode: DataNode<ProjectData>): DataNode<ModuleData>? { override fun createModule(gradleModule: IdeaModule, projectDataNode: DataNode<ProjectData>): DataNode<ModuleData>? {
return super.createModule(gradleModule, projectDataNode)?.also { return super.createModule(gradleModule, projectDataNode)?.also {
+1 -4
View File
@@ -8,10 +8,7 @@ dependencies {
compile(project(":idea:idea-core")) compile(project(":idea:idea-core"))
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(intellijPluginDep("java"))
Platform[192].orHigher {
compileOnly(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
+1 -3
View File
@@ -14,9 +14,7 @@ dependencies {
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(commonDep("com.google.code.findbugs", "jsr305")) compileOnly(commonDep("com.google.code.findbugs", "jsr305"))
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("junit")) compileOnly(intellijPluginDep("junit"))
compileOnly(intellijPluginDep("testng")) compileOnly(intellijPluginDep("testng"))
@@ -18,7 +18,6 @@ package org.jetbrains.kotlin.idea.liveTemplates;
import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider; import com.intellij.codeInsight.template.impl.DefaultLiveTemplatesProvider;
// FIX ME WHEN BUNCH 193 REMOVED
public class KotlinLiveTemplatesProvider implements DefaultLiveTemplatesProvider { public class KotlinLiveTemplatesProvider implements DefaultLiveTemplatesProvider {
@Override @Override
public String[] getDefaultLiveTemplateFiles() { public String[] getDefaultLiveTemplateFiles() {
@@ -28,7 +28,7 @@ class LiveTemplatesTest : KotlinLightCodeInsightFixtureTestCase() {
override fun setUp() { override fun setUp() {
super.setUp() super.setUp()
myFixture.testDataPath = File(TEST_DATA_BASE_PATH).path + File.separator myFixture.testDataPath = File(TEST_DATA_BASE_PATH).path + File.separator
setTemplateTestingCompat(module.project, testRootDisposable) TemplateManagerImpl.setTemplateTesting(testRootDisposable)
} }
fun testSout() { fun testSout() {
@@ -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)
}
+4 -6
View File
@@ -18,12 +18,10 @@ dependencies {
compile(project(":idea:idea-jps-common")) compile(project(":idea:idea-jps-common"))
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java")) testCompileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java")) testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java")) testRuntimeOnly(intellijPluginDep("java-ide-customization"))
testRuntimeOnly(intellijPluginDep("java-ide-customization"))
}
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) } excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) }
+1 -3
View File
@@ -12,9 +12,7 @@ dependencies {
compile(project(":native:frontend.native")) compile(project(":native:frontend.native"))
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
testRuntimeOnly(intellijDep()) testRuntimeOnly(intellijDep())
@@ -13,9 +13,7 @@ dependencies {
compileOnly(intellijCoreDep()) compileOnly(intellijCoreDep())
compileOnly(intellijDep()) compileOnly(intellijDep())
compileOnly(intellijPluginDep("gradle")) compileOnly(intellijPluginDep("gradle"))
Platform[193].orHigher { compileOnly(intellijPluginDep("gradle-java"))
compileOnly(intellijPluginDep("gradle-java"))
}
testImplementation(projectTests(":idea")) testImplementation(projectTests(":idea"))
testImplementation(project(":libraries:tools:new-project-wizard:new-project-wizard-cli")) testImplementation(project(":libraries:tools:new-project-wizard:new-project-wizard-cli"))
+1 -3
View File
@@ -15,9 +15,7 @@ dependencies {
testCompileOnly(project(":kotlin-reflect-api")) testCompileOnly(project(":kotlin-reflect-api"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
Platform[192].orHigher { testCompileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java"))
}
} }
sourceSets { sourceSets {
@@ -9,7 +9,7 @@ import com.intellij.ide.startup.impl.StartupManagerImpl
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupManager import com.intellij.openapi.startup.StartupManager
// FIX ME WHEN BUNCH 193 REMOVED // FIX ME WHEN BUNCH 201 REMOVED
fun runPostStartupActivitiesOnce(project: Project) { fun runPostStartupActivitiesOnce(project: Project) {
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically() (StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically()
} }
@@ -7,6 +7,5 @@ package org.jetbrains.kotlin.idea.test
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
// FIX ME WHEN BUNCH 193 REMOVED
fun runPostStartupActivitiesOnce(project: Project) { fun runPostStartupActivitiesOnce(project: Project) {
} }
@@ -14,9 +14,7 @@ dependencies {
compileOnly(toolsJarApi()) compileOnly(toolsJarApi())
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("stream-debugger")) compileOnly(intellijPluginDep("stream-debugger"))
@@ -10,9 +10,7 @@ dependencies {
compileOnly(toolsJarApi()) compileOnly(toolsJarApi())
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
@@ -11,9 +11,7 @@ dependencies {
compile(project(":idea:jvm-debugger:jvm-debugger-util")) compile(project(":idea:jvm-debugger:jvm-debugger-util"))
compileOnly(toolsJarApi()) compileOnly(toolsJarApi())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijDep()) compileOnly(intellijDep())
@@ -9,9 +9,7 @@ dependencies {
compileOnly(toolsJarApi()) compileOnly(toolsJarApi())
compileOnly(intellijDep()) compileOnly(intellijDep())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijPluginDep("stream-debugger")) compileOnly(intellijPluginDep("stream-debugger"))
@@ -20,10 +20,8 @@ dependencies {
testCompile(intellijPluginDep("stream-debugger")) testCompile(intellijPluginDep("stream-debugger"))
Platform[192].orHigher { testCompileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl", "aether-dependency-resolver") }
testCompileOnly(intellijPluginDep("java")) { includeJars("java-api", "java-impl", "aether-dependency-resolver") } testRuntime(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
testRuntime(project(":nj2k:nj2k-services")) { isTransitive = false } testRuntime(project(":nj2k:nj2k-services")) { isTransitive = false }
testRuntime(project(":idea:idea-jvm")) testRuntime(project(":idea:idea-jvm"))
@@ -13,9 +13,7 @@ dependencies {
compileOnly(toolsJarApi()) compileOnly(toolsJarApi())
Platform[192].orHigher { compileOnly(intellijPluginDep("java"))
compileOnly(intellijPluginDep("java"))
}
compileOnly(intellijDep()) compileOnly(intellijDep())
@@ -12,9 +12,6 @@ dependencies {
compileOnly(intellijPluginDep("gradle")) compileOnly(intellijPluginDep("gradle"))
compileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") } compileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") }
Platform[193].orLower {
compile(project(":idea:idea-gradle-tooling-api"))
}
} }
sourceSets { sourceSets {
+4 -15
View File
@@ -22,9 +22,6 @@ dependencies {
testRuntimeOnly(project(":nj2k:nj2k-services")) testRuntimeOnly(project(":nj2k:nj2k-services"))
testRuntimeOnly(project(":kotlin-reflect")) testRuntimeOnly(project(":kotlin-reflect"))
testRuntimeOnly(project(":idea:kotlin-gradle-tooling")) testRuntimeOnly(project(":idea:kotlin-gradle-tooling"))
Platform[193].orLower {
testRuntimeOnly(project(":idea:idea-gradle-tooling-api"))
}
testRuntimeOnly(project(":kotlin-gradle-statistics")) testRuntimeOnly(project(":kotlin-gradle-statistics"))
testImplementation(intellijPluginDep("gradle")) testImplementation(intellijPluginDep("gradle"))
@@ -40,22 +37,14 @@ dependencies {
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.+") testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.+")
testImplementation("khttp:khttp:1.0.0") testImplementation("khttp:khttp:1.0.0")
testCompileOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
Platform[192].orHigher { testImplementation(intellijPluginDep("gradle-java"))
testCompileOnly(intellijPluginDep("java")) testRuntimeOnly(intellijPluginDep("gradle-java"))
testRuntimeOnly(intellijPluginDep("java"))
}
Platform[193].orHigher {
testImplementation(intellijPluginDep("gradle-java"))
testRuntimeOnly(intellijPluginDep("gradle-java"))
}
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
testCompileOnly(project(":nj2k")) testCompileOnly(project(":nj2k"))
Platform[193].orLower {
testCompileOnly(project(":idea:idea-gradle-tooling-api"))
}
testCompileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") } testCompileOnly(intellijDep()) { includeJars("slf4j-api-1.7.25") }
} }
@@ -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.perf.util.logMessage
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
import org.jetbrains.kotlin.idea.testFramework.* 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.cleanupCaches
import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.close import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.close
import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.isAKotlinScriptFile import org.jetbrains.kotlin.idea.testFramework.Fixture.Companion.isAKotlinScriptFile
@@ -26,10 +26,10 @@ import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.impl.search.IndexPatternBuilder import com.intellij.psi.impl.search.IndexPatternBuilder
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry
import com.intellij.psi.xml.XmlFileNSInfoProvider import com.intellij.psi.xml.XmlFileNSInfoProvider
import com.intellij.testFramework.TestApplicationManager
import com.intellij.xml.XmlSchemaProvider import com.intellij.xml.XmlSchemaProvider
import org.jetbrains.kotlin.idea.framework.KotlinSdkType import org.jetbrains.kotlin.idea.framework.KotlinSdkType
import org.jetbrains.kotlin.idea.perf.util.TeamCity import org.jetbrains.kotlin.idea.perf.util.TeamCity
import org.jetbrains.kotlin.idea.testFramework.TestApplicationManager
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
import java.io.File import java.io.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.GradleProcessOutputInterceptor
import org.jetbrains.kotlin.idea.test.invalidateLibraryCache import org.jetbrains.kotlin.idea.test.invalidateLibraryCache
import org.jetbrains.kotlin.idea.testFramework.* import org.jetbrains.kotlin.idea.testFramework.*
import org.jetbrains.kotlin.idea.testFramework.TestApplicationManager
import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe import org.jetbrains.kotlin.idea.util.getProjectJdkTableSafe
import java.io.File import java.io.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
@@ -23,6 +23,7 @@ import com.intellij.openapi.startup.StartupManager
import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.ExtensionTestUtil import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.TestApplicationManager
import com.intellij.testFramework.runInEdtAndWait import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.ui.UIUtil import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.perf.util.logMessage 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" } logMessage { "project '$name' is about to be closed" }
dispatchAllInvocationEvents() dispatchAllInvocationEvents()
val projectManagerEx = ProjectManagerEx.getInstanceEx() val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProjectEx(project, true) projectManagerEx.forceCloseProject(project)
logMessage { "project '$name' successfully closed" } logMessage { "project '$name' successfully closed" }
} }
@@ -25,6 +25,7 @@ import com.intellij.platform.PlatformProjectOpenProcessor
import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.impl.PsiDocumentManagerBase import com.intellij.psi.impl.PsiDocumentManagerBase
import com.intellij.testFramework.ExtensionTestUtil import com.intellij.testFramework.ExtensionTestUtil
import com.intellij.testFramework.TestApplicationManager
import com.intellij.testFramework.runInEdtAndWait import com.intellij.testFramework.runInEdtAndWait
import com.intellij.util.ui.UIUtil import com.intellij.util.ui.UIUtil
import org.jetbrains.kotlin.idea.perf.util.logMessage 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" } logMessage { "project '$name' is about to be closed" }
dispatchAllInvocationEvents() dispatchAllInvocationEvents()
val projectManagerEx = ProjectManagerEx.getInstanceEx() val projectManagerEx = ProjectManagerEx.getInstanceEx()
projectManagerEx.forceCloseProjectEx(project, true) projectManagerEx.forceCloseProject(project)
logMessage { "project '$name' successfully closed" } logMessage { "project '$name' successfully closed" }
} }
+2 -4
View File
@@ -31,10 +31,8 @@ dependencies {
testRuntime(project(":idea:idea-android")) { isTransitive = false } testRuntime(project(":idea:idea-android")) { isTransitive = false }
Platform[192].orHigher { testCompileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java")) testRuntime(intellijPluginDep("java"))
testRuntime(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar()) testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))
@@ -8,8 +8,10 @@ package org.jetbrains.kotlin.idea.hierarchy.calls
import com.intellij.ide.hierarchy.HierarchyNodeDescriptor import com.intellij.ide.hierarchy.HierarchyNodeDescriptor
import com.intellij.ide.hierarchy.HierarchyTreeStructure import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor
import com.intellij.ide.hierarchy.call.CalleeMethodsTreeStructure
import com.intellij.ide.util.treeView.NodeDescriptor import com.intellij.ide.util.treeView.NodeDescriptor
import com.intellij.psi.PsiElement import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMember
import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethod
import com.intellij.util.ArrayUtil import com.intellij.util.ArrayUtil
import org.jetbrains.kotlin.asJava.unwrapped import org.jetbrains.kotlin.asJava.unwrapped
@@ -40,7 +42,7 @@ class KotlinCalleeTreeStructure(
override fun buildChildren(nodeDescriptor: HierarchyNodeDescriptor): Array<Any> { override fun buildChildren(nodeDescriptor: HierarchyNodeDescriptor): Array<Any> {
if (nodeDescriptor is CallHierarchyNodeDescriptor) { if (nodeDescriptor is CallHierarchyNodeDescriptor) {
val psiMethod = nodeDescriptor.enclosingElement as? PsiMethod ?: return ArrayUtil.EMPTY_OBJECT_ARRAY 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 val element = nodeDescriptor.psiElement as? KtElement ?: return ArrayUtil.EMPTY_OBJECT_ARRAY
@@ -9,6 +9,7 @@ import com.intellij.find.findUsages.JavaFindUsagesOptions
import com.intellij.ide.hierarchy.HierarchyNodeDescriptor import com.intellij.ide.hierarchy.HierarchyNodeDescriptor
import com.intellij.ide.hierarchy.HierarchyTreeStructure import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor import com.intellij.ide.hierarchy.call.CallHierarchyNodeDescriptor
import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure
import com.intellij.ide.util.treeView.NodeDescriptor import com.intellij.ide.util.treeView.NodeDescriptor
import com.intellij.psi.PsiElement import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMember import com.intellij.psi.PsiMember
@@ -67,7 +68,7 @@ class KotlinCallerTreeStructure(
): Collection<Any> { ): Collection<Any> {
if (nodeDescriptor is CallHierarchyNodeDescriptor) { if (nodeDescriptor is CallHierarchyNodeDescriptor) {
val psiMethod = nodeDescriptor.enclosingElement as? PsiMethod ?: return emptyList() 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() if (element !is KtDeclaration) return emptyList()
@@ -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)
}
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.idea.KotlinIconProviderBase
import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFile
// FIX ME WHEN BUNCH 193 REMOVED
abstract class AbstractNavBarModelExtensionCompatBase : StructureAwareNavBarModelExtension() { abstract class AbstractNavBarModelExtensionCompatBase : StructureAwareNavBarModelExtension() {
protected abstract fun adjustElementImpl(psiElement: PsiElement?): PsiElement? protected abstract fun adjustElementImpl(psiElement: PsiElement?): PsiElement?
@@ -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<*>
@@ -28,8 +28,8 @@ class KotlinExpandNodeProjectViewProvider : TreeStructureProvider, DumbAware {
// should be called after ClassesTreeStructureProvider // should be called after ClassesTreeStructureProvider
override fun modify( override fun modify(
parent: AbstractTreeNodeAny, parent: AbstractTreeNode<*>,
children: Collection<AbstractTreeNodeAny>, children: Collection<AbstractTreeNode<*>>,
settings: ViewSettings settings: ViewSettings
): Collection<AbstractTreeNode<out Any>> { ): Collection<AbstractTreeNode<out Any>> {
val result = ArrayList<AbstractTreeNode<out Any>>() val result = ArrayList<AbstractTreeNode<out Any>>()
@@ -60,16 +60,16 @@ class KotlinExpandNodeProjectViewProvider : TreeStructureProvider, DumbAware {
else -> null 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 { 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( override fun modify(
parent: AbstractTreeNodeAny, parent: AbstractTreeNode<*>,
children: Collection<AbstractTreeNodeAny>, children: Collection<AbstractTreeNode<*>>,
settings: ViewSettings settings: ViewSettings
): Collection<AbstractTreeNode<out Any>> { ): Collection<AbstractTreeNode<out Any>> {
return ArrayList(children) return ArrayList(children)
@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui
import com.intellij.openapi.project.Project import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.ComboBox
import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiDocumentManager
import com.intellij.refactoring.BaseRefactoringProcessor import com.intellij.refactoring.BaseRefactoringProcessor
import com.intellij.refactoring.ui.RefactoringDialog import com.intellij.refactoring.ui.RefactoringDialog
@@ -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>
@@ -332,12 +332,15 @@ class KotlinChangeSignatureDialog(
if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite && if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite &&
myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false, reanalyse = true).type == null myReturnTypeCodeFragment.getTypeInfo(isCovariant = true, forPreview = false, reanalyse = true).type == null
) { ) {
if (showOkCancelDialog( if (Messages.showOkCancelDialog(
myProject, myProject,
KotlinBundle.message("message.text.return.type.cannot.be.resolved", KotlinBundle.message(
myReturnTypeCodeFragment?.text.toString() "message.text.return.type.cannot.be.resolved",
), myReturnTypeCodeFragment?.text.toString()
),
RefactoringBundle.message("changeSignature.refactoring.name"), RefactoringBundle.message("changeSignature.refactoring.name"),
Messages.getOkButton(),
Messages.getCancelButton(),
Messages.getWarningIcon() Messages.getWarningIcon()
) != Messages.OK ) != Messages.OK
) { ) {
@@ -351,13 +354,16 @@ class KotlinChangeSignatureDialog(
KotlinBundle.message("text.parameter.0", item.parameter.name) KotlinBundle.message("text.parameter.0", item.parameter.name)
else else
KotlinBundle.message("text.receiver") KotlinBundle.message("text.receiver")
if (showOkCancelDialog( if (Messages.showOkCancelDialog(
myProject, myProject,
KotlinBundle.message("message.type.for.cannot.be.resolved", KotlinBundle.message(
item.typeCodeFragment.text, "message.type.for.cannot.be.resolved",
paramText item.typeCodeFragment.text,
), paramText
),
RefactoringBundle.message("changeSignature.refactoring.name"), RefactoringBundle.message("changeSignature.refactoring.name"),
Messages.getOkButton(),
Messages.getCancelButton(),
Messages.getWarningIcon() Messages.getWarningIcon()
) != Messages.OK ) != Messages.OK
) { ) {
@@ -9,6 +9,7 @@ import com.intellij.psi.PsiCall
import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.search.SearchScope import com.intellij.psi.search.SearchScope
import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor import com.intellij.util.Processor
import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor 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.descriptors.impl.SyntheticFieldDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.* import org.jetbrains.kotlin.idea.caches.resolve.*
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions 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.findUsages.processAllUsages
import org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinValVar import org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinValVar
import org.jetbrains.kotlin.idea.refactoring.changeSignature.toValVar import org.jetbrains.kotlin.idea.refactoring.changeSignature.toValVar
@@ -45,7 +45,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions
class InflowSlicer( class InflowSlicer(
element: KtElement, element: KtElement,
processor: SliceUsageProcessor, processor: Processor<in SliceUsage>,
parentUsage: KotlinSliceUsage parentUsage: KotlinSliceUsage
) : Slicer(element, processor, parentUsage) { ) : Slicer(element, processor, parentUsage) {
@@ -5,7 +5,8 @@
package org.jetbrains.kotlin.idea.slicer 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.KtElement
import org.jetbrains.kotlin.psi.KtNamedFunction import org.jetbrains.kotlin.psi.KtNamedFunction
import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
@@ -34,7 +35,11 @@ data class KotlinSliceAnalysisMode(val behaviourStack: List<Behaviour>, val inli
get() = behaviourStack.lastOrNull() get() = behaviourStack.lastOrNull()
interface Behaviour { interface Behaviour {
fun processUsages(element: KtElement, parent: KotlinSliceUsage, uniqueProcessor: SliceUsageProcessor) fun processUsages(
element: KtElement,
parent: KotlinSliceUsage,
uniqueProcessor: Processor<in SliceUsage>
)
val slicePresentationPrefix: String val slicePresentationPrefix: String
val testPresentationPrefix: String val testPresentationPrefix: String
@@ -27,7 +27,7 @@ import com.intellij.psi.PsiElement
import com.intellij.slicer.SliceAnalysisParams import com.intellij.slicer.SliceAnalysisParams
import com.intellij.slicer.SliceUsage import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo 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.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.endOffset import org.jetbrains.kotlin.psi.psiUtil.endOffset
@@ -98,7 +98,10 @@ open class KotlinSliceUsage : SliceUsage {
override fun canBeLeaf() = element != null && mode == KotlinSliceAnalysisMode.Default 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 ktElement = element as? KtElement ?: return
val behaviour = mode.currentBehaviour val behaviour = mode.currentBehaviour
if (behaviour != null) { 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 ktElement = element as? KtElement ?: return
val behaviour = mode.currentBehaviour val behaviour = mode.currentBehaviour
if (behaviour != null) { if (behaviour != null) {
@@ -9,11 +9,14 @@ import com.intellij.slicer.SliceUsage
import com.intellij.util.Processor import com.intellij.util.Processor
import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtElement
data class LambdaCallsBehaviour(private val sliceProducer: SliceProducer) : KotlinSliceAnalysisMode.Behaviour { 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> { val processor = object : Processor<SliceUsage> {
override fun process(sliceUsage: SliceUsage): Boolean { override fun process(sliceUsage: SliceUsage): Boolean {
if (sliceUsage is KotlinSliceUsage && sliceUsage.mode.currentBehaviour === this@LambdaCallsBehaviour) { if (sliceUsage is KotlinSliceUsage && sliceUsage.mode.currentBehaviour === this@LambdaCallsBehaviour) {
@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer 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.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtElement
data class LambdaParameterInflowBehaviour(val parameterIndex: Int) : KotlinSliceAnalysisMode.Behaviour { 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) InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
} }
@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer 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.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtElement
object LambdaReceiverInflowBehaviour : KotlinSliceAnalysisMode.Behaviour { 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) InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
} }
@@ -5,12 +5,17 @@
package org.jetbrains.kotlin.idea.slicer 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.KotlinBundle
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor
import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtElement
object LambdaResultInflowBehaviour : KotlinSliceAnalysisMode.Behaviour { 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) InflowSlicer(element, uniqueProcessor, parent).processChildren(parent.forcedExpressionMode)
} }
@@ -11,7 +11,9 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod import com.intellij.psi.PsiMethod
import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.LocalSearchScope
import com.intellij.psi.util.parentOfType import com.intellij.psi.util.parentOfType
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.builtins.isExtensionFunctionType import org.jetbrains.kotlin.builtins.isExtensionFunctionType
import org.jetbrains.kotlin.builtins.isFunctionType import org.jetbrains.kotlin.builtins.isFunctionType
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue 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.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.analyze
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny 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.declarationsSearch.forEachOverridingElement
import org.jetbrains.kotlin.idea.search.ideaExtensions.KotlinReadWriteAccessDetector import org.jetbrains.kotlin.idea.search.ideaExtensions.KotlinReadWriteAccessDetector
import org.jetbrains.kotlin.idea.util.actualsForExpected import org.jetbrains.kotlin.idea.util.actualsForExpected
@@ -36,7 +37,7 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
class OutflowSlicer( class OutflowSlicer(
element: KtElement, element: KtElement,
processor: SliceUsageProcessor, processor: Processor<in SliceUsage>,
parentUsage: KotlinSliceUsage parentUsage: KotlinSliceUsage
) : Slicer(element, processor, parentUsage) { ) : Slicer(element, processor, parentUsage) {
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.slicer
import com.intellij.slicer.SliceUsage import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo import com.intellij.usageView.UsageInfo
import org.jetbrains.kotlin.idea.findUsages.handlers.SliceUsageProcessor import com.intellij.util.Processor
interface SliceProducer { interface SliceProducer {
fun produce(usage: UsageInfo, mode: KotlinSliceAnalysisMode, parent: SliceUsage): Collection<SliceUsage>? fun produce(usage: UsageInfo, mode: KotlinSliceAnalysisMode, parent: SliceUsage): Collection<SliceUsage>?
@@ -34,7 +34,7 @@ fun SliceProducer.produceAndProcess(
sliceUsage: SliceUsage, sliceUsage: SliceUsage,
mode: KotlinSliceAnalysisMode, mode: KotlinSliceAnalysisMode,
parentUsage: SliceUsage, parentUsage: SliceUsage,
processor: SliceUsageProcessor processor: Processor<in SliceUsage>
): Boolean { ): Boolean {
val result = produce(sliceUsage.usageInfo, mode, parentUsage) ?: listOf(sliceUsage) val result = produce(sliceUsage.usageInfo, mode, parentUsage) ?: listOf(sliceUsage)
for (usage in result) { for (usage in result) {
@@ -12,7 +12,9 @@ import com.intellij.psi.PsiMethod
import com.intellij.psi.search.SearchScope import com.intellij.psi.search.SearchScope
import com.intellij.psi.util.parentOfType import com.intellij.psi.util.parentOfType
import com.intellij.slicer.JavaSliceUsage import com.intellij.slicer.JavaSliceUsage
import com.intellij.slicer.SliceUsage
import com.intellij.usageView.UsageInfo import com.intellij.usageView.UsageInfo
import com.intellij.util.Processor
import org.jetbrains.kotlin.asJava.namedUnwrappedElement import org.jetbrains.kotlin.asJava.namedUnwrappedElement
import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode 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.core.getDeepestSuperDeclarations
import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions import org.jetbrains.kotlin.idea.findUsages.KotlinFunctionFindUsagesOptions
import org.jetbrains.kotlin.idea.findUsages.KotlinPropertyFindUsagesOptions 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.processAllExactUsages
import org.jetbrains.kotlin.idea.findUsages.processAllUsages import org.jetbrains.kotlin.idea.findUsages.processAllUsages
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
@@ -54,7 +55,7 @@ import java.util.*
abstract class Slicer( abstract class Slicer(
protected val element: KtElement, protected val element: KtElement,
protected val processor: SliceUsageProcessor, protected val processor: Processor<in SliceUsage>,
protected val parentUsage: KotlinSliceUsage protected val parentUsage: KotlinSliceUsage
) { ) {
abstract fun processChildren(forcedExpressionMode: Boolean) abstract fun processChildren(forcedExpressionMode: Boolean)
@@ -25,7 +25,7 @@ abstract class KotlinHierarchyViewTestBase : KotlinLightCodeInsightFixtureTestCa
) { ) {
myFixture.configureByFiles(*fileNames) myFixture.configureByFiles(*fileNames)
val expectedStructure = loadExpectedStructure() val expectedStructure = loadExpectedStructure()
doHierarchyTestCompat(hierarchyFixture, treeStructureComputable, expectedStructure) HierarchyViewTestFixture.doHierarchyTest(treeStructureComputable.compute(), expectedStructure)
} }
@Throws(IOException::class) @Throws(IOException::class)
@@ -5,7 +5,7 @@
package org.jetbrains.kotlin.idea.codeInsight.postfix 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.KotlinLightCodeInsightFixtureTestCase
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.InTextDirectivesUtils
@@ -30,7 +30,7 @@ abstract class AbstractPostfixTemplateProviderTest : KotlinLightCodeInsightFixtu
myFixture.configureByFile(fileName) myFixture.configureByFile(fileName)
val template = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TEMPLATE:") val template = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// TEMPLATE:")
if (template != null) { if (template != null) {
setTemplateTestingCompat(project, testRootDisposable) TemplateManagerImpl.setTemplateTesting(testRootDisposable)
myFixture.type(template.replace("\\t", "\t")) myFixture.type(template.replace("\\t", "\t"))
} else { } else {
myFixture.type('\t') myFixture.type('\t')
@@ -5,22 +5,9 @@
package org.jetbrains.kotlin.idea package org.jetbrains.kotlin.idea
import com.intellij.ide.hierarchy.HierarchyTreeStructure
import com.intellij.openapi.Disposable import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.util.Computable
import com.intellij.testFramework.ExtensionTestUtil 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( fun <T> maskExtensions(
pointName: ExtensionPointName<T>, pointName: ExtensionPointName<T>,
@@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.hierarchy
import com.intellij.ide.hierarchy.* import com.intellij.ide.hierarchy.*
import com.intellij.ide.hierarchy.actions.BrowseHierarchyActionBase 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.SubtypesHierarchyTreeStructure
import com.intellij.ide.hierarchy.type.SupertypesHierarchyTreeStructure import com.intellij.ide.hierarchy.type.SupertypesHierarchyTreeStructure
import com.intellij.ide.hierarchy.type.TypeHierarchyTreeStructure 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.fileEditor.impl.text.TextEditorPsiDataProvider
import com.intellij.openapi.util.Computable import com.intellij.openapi.util.Computable
import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.io.FileUtil
import com.intellij.psi.PsiClass import com.intellij.psi.*
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.refactoring.util.CommonRefactoringUtil.RefactoringErrorHintException import com.intellij.refactoring.util.CommonRefactoringUtil.RefactoringErrorHintException
import com.intellij.rt.execution.junit.ComparisonDetailsExtractor import com.intellij.rt.execution.junit.ComparisonDetailsExtractor
import com.intellij.testFramework.LightProjectDescriptor import com.intellij.testFramework.LightProjectDescriptor
@@ -29,7 +27,6 @@ import junit.framework.TestCase
import org.jetbrains.kotlin.idea.KotlinHierarchyViewTestBase import org.jetbrains.kotlin.idea.KotlinHierarchyViewTestBase
import org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCalleeTreeStructure import org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCalleeTreeStructure
import org.jetbrains.kotlin.idea.hierarchy.calls.KotlinCallerTreeStructure 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.hierarchy.overrides.KotlinOverrideTreeStructure
import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor
import org.jetbrains.kotlin.psi.KtCallableDeclaration import org.jetbrains.kotlin.psi.KtCallableDeclaration
@@ -124,10 +121,9 @@ abstract class AbstractHierarchyTest : KotlinHierarchyViewTestBase() {
private val callerJavaHierarchyStructure: Computable<HierarchyTreeStructure> private val callerJavaHierarchyStructure: Computable<HierarchyTreeStructure>
get() = Computable { get() = Computable {
createCallerMethodsTreeStructure( CallerMethodsTreeStructure(
project, project,
(getElementAtCaret(LanguageCallHierarchy.INSTANCE) as PsiMethod), (getElementAtCaret(LanguageCallHierarchy.INSTANCE) as PsiMethod) as PsiMember, HierarchyBrowserBaseEx.SCOPE_PROJECT
HierarchyBrowserBaseEx.SCOPE_PROJECT
) )
} }
@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile import com.intellij.psi.PsiFile
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl
import com.intellij.util.ArrayUtil import com.intellij.util.ArrayUtil
import com.intellij.util.PathUtil import com.intellij.util.PathUtil
import junit.framework.ComparisonFailure import junit.framework.ComparisonFailure
@@ -335,7 +336,7 @@ abstract class AbstractQuickFixMultiFileTest : KotlinLightCodeInsightFixtureTest
TestCase.fail("Action '$text' is available (but must not) in test $testFilePath") TestCase.fail("Action '$text' is available (but must not) in test $testFilePath")
} }
invokeIntentionCompat(action, file, editor) CodeInsightTestFixtureImpl.invokeIntention(action, file, editor)
if (!shouldBeAvailableAfterExecution) { if (!shouldBeAvailableAfterExecution) {
val afterAction = findActionByPattern(pattern, getAvailableActions()) val afterAction = findActionByPattern(pattern, getAvailableActions())
@@ -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)
}
@@ -15,7 +15,6 @@ import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler
import com.intellij.testFramework.LightPlatformCodeInsightTestCase import com.intellij.testFramework.LightPlatformCodeInsightTestCase
import com.intellij.testFramework.fixtures.CodeInsightTestUtil import com.intellij.testFramework.fixtures.CodeInsightTestUtil
import junit.framework.TestCase 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.KotlinMemberInplaceRenameHandler
import org.jetbrains.kotlin.idea.refactoring.rename.KotlinVariableInplaceRenameHandler import org.jetbrains.kotlin.idea.refactoring.rename.KotlinVariableInplaceRenameHandler
import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinImplicitLambdaParameter import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinImplicitLambdaParameter
@@ -202,7 +201,7 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
val project = editor.project!! val project = editor.project!!
setTemplateTestingCompat(project, testRootDisposable) TemplateManagerImpl.setTemplateTesting(testRootDisposable)
object : WriteCommandAction.Simple<Any>(project) { object : WriteCommandAction.Simple<Any>(project) {
override fun run() { override fun run() {
+2 -4
View File
@@ -24,10 +24,8 @@ dependencies {
testCompileOnly(intellijDep()) testCompileOnly(intellijDep())
Platform[192].orHigher { testCompileOnly(intellijPluginDep("java"))
testCompileOnly(intellijPluginDep("java")) testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
testCompile(project(":idea:idea-native")) { isTransitive = false } testCompile(project(":idea:idea-native")) { isTransitive = false }
testCompile(project(":idea:idea-gradle-native")) { isTransitive = false } testCompile(project(":idea:idea-gradle-native")) { isTransitive = false }
+1 -3
View File
@@ -44,9 +44,7 @@ dependencies {
testRuntime(project(it)) testRuntime(project(it))
} }
Platform[192].orHigher { testRuntimeOnly(intellijPluginDep("java"))
testRuntimeOnly(intellijPluginDep("java"))
}
testRuntimeOnly(toolsJar()) testRuntimeOnly(toolsJar())
testRuntime(project(":kotlin-reflect")) testRuntime(project(":kotlin-reflect"))

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