[FIR IDE] Hack checkIsInheritor until KT-51240 is fixed

We do not know for sure if there is any dependency between the
two classes passed to `checkIsInheritor`. To avoid the problem described
in KT-51240, we try to analyse them both and hope that the dependency
in some direction exists.

`NoCacheForModuleException` is introduced to signal about this
particular problem and avoid catching just any `NoSuchElementException`.

This hack is mainly done to fix very annoying KT-51240 for the time
being.

^KTIJ-20852 Fixed
This commit is contained in:
Roman Golyshev
2022-02-10 11:53:38 +03:00
committed by teamcity
parent 729afb6149
commit ca72790962
3 changed files with 52 additions and 7 deletions
@@ -0,0 +1,21 @@
/*
* Copyright 2010-2022 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.analysis.project.structure
/**
* Exception to signal that no [org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.ModuleFileCache] was
* found for [missingModule] by [org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionProvider].
*
* TODO: This can be caused by the problem described in KT-51240. When the problem is fixed, this exception will probably become redundant.
*/
public class NoCacheForModuleException(
private val missingModule: KtModule,
private val existingModules: Set<KtModule>
) : NoSuchElementException() {
override val message: String
get() = "No cache was found for module '${missingModule.moduleDescription}'! " +
"Caches exist for the following modules: ${existingModules.map { it.moduleDescription }}"
}