From 6c1ba5ffc3576ba17eda19af764e4b27468d306d Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Fri, 6 Dec 2024 16:14:36 +0100 Subject: [PATCH] [PSI] KtCommonFile: deprecate `packageFqNameByTree` ^KT-73687 --- .../org/jetbrains/kotlin/psi/KtCommonFile.kt | 5 +++-- .../psi/stubs/elements/StubIndexService.kt | 18 +++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt index 246a73a381946..0c42d1395bc4a 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt @@ -79,7 +79,7 @@ open class KtCommonFile(viewProvider: FileViewProvider, val isCompiled: Boolean) get() = findChildBeforeFirstDeclarationInclusiveByType(KtStubElementTypes.PACKAGE_DIRECTIVE) var packageFqName: FqName - get() = greenStub?.getPackageFqName() ?: packageFqNameByTree + get() = greenStub?.getPackageFqName() ?: packageDirective?.fqName ?: FqName.ROOT set(value) { val packageDirective = packageDirective if (packageDirective != null) { @@ -90,8 +90,9 @@ open class KtCommonFile(viewProvider: FileViewProvider, val isCompiled: Boolean) } } + @Deprecated("Use 'packageFqName' property instead", ReplaceWith("packageFqName")) val packageFqNameByTree: FqName - get() = packageDirective?.fqName ?: FqName.ROOT + get() = packageFqName val script: KtScript? get() { diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/StubIndexService.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/StubIndexService.kt index db70761f81dd7..f4a7f9a685d17 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/StubIndexService.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/stubs/elements/StubIndexService.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 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 2010-2024 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.psi.stubs.elements @@ -20,7 +9,6 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.psi.stubs.IndexSink import com.intellij.psi.stubs.StubInputStream import com.intellij.psi.stubs.StubOutputStream -import org.jetbrains.kotlin.psi.KtConstructor import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.stubs.* import org.jetbrains.kotlin.psi.stubs.impl.KotlinFileStubImpl @@ -55,7 +43,7 @@ open class StubIndexService protected constructor() { } open fun createFileStub(file: KtFile): KotlinFileStub { - return KotlinFileStubImpl(file, file.packageFqNameByTree.asString(), file.isScriptByTree) + return KotlinFileStubImpl(file, file.packageFqName.asString(), file.isScriptByTree) } @Throws(IOException::class)