Skip to content

Commit

Permalink
[PSI] KtCommonFile: deprecate packageFqNameByTree
Browse files Browse the repository at this point in the history
^KT-73687
  • Loading branch information
dimonchik0036 authored and qodana-bot committed Dec 9, 2024
1 parent ec425d4 commit 6c1ba5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
5 changes: 3 additions & 2 deletions compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6c1ba5f

Please sign in to comment.