Fix binary compatibility issue after moving ModuleTestSourceInfo

Compatibility check revealed problem in 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
This commit is contained in:
Nikolay Krasko
2018-04-30 17:07:03 +03:00
parent d71ff1818d
commit c9f31099f2
5 changed files with 46 additions and 4 deletions
@@ -48,7 +48,8 @@ import java.util.*
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
@@ -179,9 +180,9 @@ data class ModuleProductionSourceInfo internal constructor(
}
//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}>")
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.context.GlobalContext
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
@@ -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()
@@ -31,6 +31,8 @@ import org.jetbrains.kotlin.context.GlobalContextImpl
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
@@ -33,6 +33,8 @@ import com.intellij.testFramework.PsiTestUtil
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.idea.test.PluginTestCaseBase.*