Fix compatibility after moving declaration from *.idea.caches.resolve
Compatibility check revealed problem in some plugins.
1. https://plugins.jetbrains.com/plugin/8249-truth-postfix-plugin
https://github.com/droibit/truth-postfix-plugin/blob/b06adbf4e6563672da75b112b1bc7f1fc511a848/plugin/src/main/kotlin/com/github/droibit/plugin/truth/postfix/utils/TemplateUtils.kt
2. https://plugins.jetbrains.com/plugin/10137-clean-architecture-templates
https://github.com/HelmMobile/Kotlin-Clean-Architecture-plugin-for-Android-Studio/blob/62c6e0fe37cb5198530c332fd8972a8bf493dce2/src/main/kotlin/cat/helm/idea/extensions/FileUtils.kt
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/IdeaModuleInfos.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/IdeaModuleInfos.kt
index 3781e47..272fd88 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/IdeaModuleInfos.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/IdeaModuleInfos.kt
@@ -47,7 +47,8 @@
internal val LOG = Logger.getInstance(IdeaModuleInfo::class.java)
-interface IdeaModuleInfo : ModuleInfo {
+@Suppress("DEPRECATION_ERROR")
+interface IdeaModuleInfo : org.jetbrains.kotlin.idea.caches.resolve.IdeaModuleInfo {
fun contentScope(): GlobalSearchScope
val moduleOrigin: ModuleOrigin
@@ -178,9 +179,9 @@
}
//TODO: (module refactoring) do not create ModuleTestSourceInfo when there are no test roots for module
-data class ModuleTestSourceInfo internal constructor(
- override val module: Module
-) : ModuleSourceInfoWithExpectedBy(forProduction = false) {
+@Suppress("DEPRECATION_ERROR")
+data class ModuleTestSourceInfo internal constructor(override val module: Module) :
+ ModuleSourceInfoWithExpectedBy(forProduction = false), org.jetbrains.kotlin.idea.caches.resolve.ModuleTestSourceInfo {
override val name = Name.special("<test sources for module ${module.name}>")
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt
index 56ba1e90..0ea2811 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt
@@ -36,6 +36,7 @@
import org.jetbrains.kotlin.context.GlobalContextImpl
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.idea.caches.project.*
+import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo
import org.jetbrains.kotlin.idea.caches.resolve.util.contextWithNewLockAndCompositeExceptionTracker
import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesModificationTracker
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ModuleTestSourceInfo.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ModuleTestSourceInfo.kt
new file mode 100644
index 0000000..8c797c4
--- /dev/null
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ModuleTestSourceInfo.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
+ * that can be found in the license/LICENSE.txt file.
+ */
+@file:JvmName("GetModuleInfoKt")
+@file:Suppress("DEPRECATION_ERROR")
+
+package org.jetbrains.kotlin.idea.caches.resolve
+
+import com.intellij.psi.PsiElement
+import org.jetbrains.kotlin.analyzer.ModuleInfo
+import org.jetbrains.kotlin.idea.caches.project.getNullableModuleInfo as getNullableModuleInfoNew
+
+@Deprecated(
+ "Temporary interface to support binary compatibility in other plugins. " +
+ "Works only for instanceof check. Will be removed in Kotlin plugin bundled to 2018.2.",
+ ReplaceWith("org.jetbrains.kotlin.idea.caches.project.ModuleTestSourceInfo"),
+ level = DeprecationLevel.ERROR
+)
+interface IdeaModuleInfo : ModuleInfo
+
+@Deprecated(
+ "Temporary interface to support binary compatibility in other plugins. " +
+ "Works only for instanceof check. Will be removed in Kotlin plugin bundled to 2018.2.",
+ ReplaceWith("org.jetbrains.kotlin.idea.caches.project.ModuleTestSourceInfo"),
+ level = DeprecationLevel.ERROR
+)
+interface ModuleTestSourceInfo : IdeaModuleInfo
+
+@Deprecated(
+ "Temporary function to support binary compatibility after for other plugins after move." +
+ "Will be removed in Kotlin plugin bundled to 2018.2.",
+ ReplaceWith("org.jetbrains.kotlin.idea.caches.project.getNullableModuleInfo"),
+ level = DeprecationLevel.ERROR
+)
+fun PsiElement.getNullableModuleInfo(): IdeaModuleInfo? = getNullableModuleInfoNew()
diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt
index b72754b..587cd15 100644
--- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt
+++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt
@@ -31,6 +31,8 @@
import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.idea.caches.project.*
+import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo
+import org.jetbrains.kotlin.idea.caches.project.getNullableModuleInfo
import org.jetbrains.kotlin.idea.compiler.IDELanguageSettingsProvider
import org.jetbrains.kotlin.idea.project.IdeaEnvironment
import org.jetbrains.kotlin.load.java.structure.JavaClass
diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfoTest.kt b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfoTest.kt
index 5877302..3019bd7 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfoTest.kt
+++ b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/IdeaModuleInfoTest.kt
@@ -27,6 +27,8 @@
import com.intellij.testFramework.UsefulTestCase
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.idea.caches.project.*
+import org.jetbrains.kotlin.idea.caches.project.IdeaModuleInfo
+import org.jetbrains.kotlin.idea.caches.project.ModuleTestSourceInfo
import org.jetbrains.kotlin.idea.framework.CommonLibraryKind
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
import org.jetbrains.kotlin.test.util.addDependency