From 2c4180222acbb55f385e9ed88247d51cdb1a11e3 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 28 Dec 2017 13:02:53 +0100 Subject: [PATCH] Check if containing file is KtFile EA-109460 - CCE: KtElementImplStub.getContainingKtFile --- .../navigation/SourceNavigationHelper.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/SourceNavigationHelper.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/SourceNavigationHelper.kt index 07bcca75a49..ef2f76c4478 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/SourceNavigationHelper.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/SourceNavigationHelper.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2017 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. */ package org.jetbrains.kotlin.idea.decompiler.navigation @@ -31,7 +20,9 @@ import gnu.trove.THashSet import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.asJava.toLightClass import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.* +import org.jetbrains.kotlin.idea.caches.resolve.getBinaryLibrariesModuleInfos +import org.jetbrains.kotlin.idea.caches.resolve.getLibrarySourcesModuleInfos +import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.decompiler.navigation.MemberMatching.* import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex @@ -275,7 +266,8 @@ object SourceNavigationHelper { when (navigationKind) { SourceNavigationHelper.NavigationKind.CLASS_FILES_TO_SOURCES -> if (!from.containingKtFile.isCompiled) return from SourceNavigationHelper.NavigationKind.SOURCES_TO_CLASS_FILES -> { - if (from.containingKtFile.isCompiled) return from + val file = from.containingFile + if (file is KtFile && file.isCompiled) return from if (!ProjectRootsUtil.isInContent(from, false, true, false, true)) return from if (KtPsiUtil.isLocal(from)) return from }