diff --git a/idea/idea-frontend-api/build.gradle.kts b/idea/idea-frontend-api/build.gradle.kts index 5e9c02fd29c..dd58ac61c73 100644 --- a/idea/idea-frontend-api/build.gradle.kts +++ b/idea/idea-frontend-api/build.gradle.kts @@ -15,6 +15,10 @@ dependencies { compile(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } } +kotlin { + explicitApi() +} + sourceSets { "main" { projectDefault() } "test" { projectDefault() } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ForbidKtResolve.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ForbidKtResolve.kt index 82583a946c4..4f0df8af355 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ForbidKtResolve.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ForbidKtResolve.kt @@ -5,14 +5,12 @@ package org.jetbrains.kotlin.idea.frontend.api -import kotlin.reflect.KProperty1 - @RequiresOptIn -annotation class ForbidKtResolveInternals +public annotation class ForbidKtResolveInternals -object ForbidKtResolve { +public object ForbidKtResolve { @OptIn(ForbidKtResolveInternals::class) - inline fun forbidResolveIn(actionName: String, action: () -> R): R { + public inline fun forbidResolveIn(actionName: String, action: () -> R): R { if (resovleIsForbidenInActionWithName.get() != null) return action() resovleIsForbidenInActionWithName.set(actionName) return try { @@ -23,5 +21,5 @@ object ForbidKtResolve { } @ForbidKtResolveInternals - val resovleIsForbidenInActionWithName: ThreadLocal = ThreadLocal.withInitial { null } + public val resovleIsForbidenInActionWithName: ThreadLocal = ThreadLocal.withInitial { null } } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ImplicitReceiverSmartCast.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ImplicitReceiverSmartCast.kt index 09de7bbdb92..f05a7937626 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ImplicitReceiverSmartCast.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ImplicitReceiverSmartCast.kt @@ -7,8 +7,8 @@ package org.jetbrains.kotlin.idea.frontend.api import org.jetbrains.kotlin.idea.frontend.api.types.KtType -data class ImplicitReceiverSmartCast(val type: KtType, val kind: ImplicitReceiverSmartcastKind) +public data class ImplicitReceiverSmartCast(val type: KtType, val kind: ImplicitReceiverSmartcastKind) -enum class ImplicitReceiverSmartcastKind { +public enum class ImplicitReceiverSmartcastKind { DISPATCH, EXTENSION } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index 71712ff0358..61c53c010af 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.psi.* * * To create analysis session consider using [analyse] */ -abstract class KtAnalysisSession(final override val token: ValidityToken) : ValidityTokenOwner, +public abstract class KtAnalysisSession(final override val token: ValidityToken) : ValidityTokenOwner, KtSmartCastProviderMixIn, KtCallResolverMixIn, KtDiagnosticProviderMixIn, @@ -50,7 +50,7 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali override val analysisSession: KtAnalysisSession get() = this - abstract fun createContextDependentCopy(originalKtFile: KtFile, elementToReanalyze: KtElement): KtAnalysisSession + public abstract fun createContextDependentCopy(originalKtFile: KtFile, elementToReanalyze: KtElement): KtAnalysisSession internal val smartCastProvider: KtSmartCastProvider get() = smartCastProviderImpl protected abstract val smartCastProviderImpl: KtSmartCastProvider @@ -112,6 +112,8 @@ abstract class KtAnalysisSession(final override val token: ValidityToken) : Vali internal val inheritorsProvider: KtInheritorsProvider get() = inheritorsProviderImpl protected abstract val inheritorsProviderImpl: KtInheritorsProvider - @PublishedApi internal val typesCreator: KtTypeCreator get() = typesCreatorImpl + @PublishedApi + internal val typesCreator: KtTypeCreator + get() = typesCreatorImpl protected abstract val typesCreatorImpl: KtTypeCreator } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt index e45eeb81c52..52da4eee02c 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt @@ -20,26 +20,26 @@ import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile @RequiresOptIn("To use analysis session, consider using analyze/analyzeWithReadAction/analyseInModalWindow methods") -annotation class InvalidWayOfUsingAnalysisSession +public annotation class InvalidWayOfUsingAnalysisSession @RequiresOptIn -annotation class KtAnalysisSessionProviderInternals +public annotation class KtAnalysisSessionProviderInternals /** * Provides [KtAnalysisSession] by [contextElement] * Should not be used directly, consider using [analyse]/[analyseWithReadAction]/[analyseInModalWindow] instead */ @InvalidWayOfUsingAnalysisSession -abstract class KtAnalysisSessionProvider : Disposable { +public abstract class KtAnalysisSessionProvider : Disposable { @Suppress("LeakingThis") @OptIn(KtInternalApiMarker::class) - val noWriteActionInAnalyseCallChecker = NoWriteActionInAnalyseCallChecker(this) + public val noWriteActionInAnalyseCallChecker: NoWriteActionInAnalyseCallChecker = NoWriteActionInAnalyseCallChecker(this) @InvalidWayOfUsingAnalysisSession - abstract fun getAnalysisSession(contextElement: KtElement, factory: ValidityTokenFactory): KtAnalysisSession + public abstract fun getAnalysisSession(contextElement: KtElement, factory: ValidityTokenFactory): KtAnalysisSession @InvalidWayOfUsingAnalysisSession - inline fun analyseInDependedAnalysisSession( + public inline fun analyseInDependedAnalysisSession( originalFile: KtFile, elementToReanalyze: KtElement, action: KtAnalysisSession.() -> R @@ -50,12 +50,12 @@ abstract class KtAnalysisSessionProvider : Disposable { } @InvalidWayOfUsingAnalysisSession - inline fun analyse(contextElement: KtElement, tokenFactory: ValidityTokenFactory, action: KtAnalysisSession.() -> R): R = + public inline fun analyse(contextElement: KtElement, tokenFactory: ValidityTokenFactory, action: KtAnalysisSession.() -> R): R = analyse(getAnalysisSession(contextElement, tokenFactory), tokenFactory, action) @OptIn(KtAnalysisSessionProviderInternals::class, KtInternalApiMarker::class) @InvalidWayOfUsingAnalysisSession - inline fun analyse(analysisSession: KtAnalysisSession, factory: ValidityTokenFactory, action: KtAnalysisSession.() -> R): R { + public inline fun analyse(analysisSession: KtAnalysisSession, factory: ValidityTokenFactory, action: KtAnalysisSession.() -> R): R { noWriteActionInAnalyseCallChecker.beforeEnteringAnalysisContext() factory.beforeEnteringAnalysisContext() return try { @@ -67,12 +67,12 @@ abstract class KtAnalysisSessionProvider : Disposable { } @TestOnly - abstract fun clearCaches() + public abstract fun clearCaches() override fun dispose() {} - companion object { - fun getInstance(project: Project): KtAnalysisSessionProvider = + public companion object { + public fun getInstance(project: Project): KtAnalysisSessionProvider = ServiceManager.getService(project, KtAnalysisSessionProvider::class.java) } } @@ -90,12 +90,12 @@ abstract class KtAnalysisSessionProvider : Disposable { * @see analyseWithReadAction */ @OptIn(InvalidWayOfUsingAnalysisSession::class) -inline fun analyse(contextElement: KtElement, action: KtAnalysisSession.() -> R): R = +public inline fun analyse(contextElement: KtElement, action: KtAnalysisSession.() -> R): R = KtAnalysisSessionProvider.getInstance(contextElement.project) .analyse(contextElement, ReadActionConfinementValidityTokenFactory, action) @OptIn(InvalidWayOfUsingAnalysisSession::class) -inline fun analyseWithCustomToken( +public inline fun analyseWithCustomToken( contextElement: KtElement, tokenFactory: ValidityTokenFactory, action: KtAnalysisSession.() -> R @@ -107,14 +107,14 @@ inline fun analyseWithCustomToken( * UAST-specific version of [analyse] that executes the given [action] in [KtAnalysisSession] context */ @OptIn(InvalidWayOfUsingAnalysisSession::class) -inline fun analyseForUast( +public inline fun analyseForUast( contextElement: KtElement, action: KtAnalysisSession.() -> R ): R = analyseWithCustomToken(contextElement, AlwaysAccessibleValidityTokenFactory, action) @OptIn(InvalidWayOfUsingAnalysisSession::class) -inline fun analyseInDependedAnalysisSession( +public inline fun analyseInDependedAnalysisSession( originalFile: KtFile, elementToReanalyze: KtElement, action: KtAnalysisSession.() -> R @@ -134,7 +134,7 @@ inline fun analyseInDependedAnalysisSession( * @see KtAnalysisSession * @see analyse */ -inline fun analyseWithReadAction( +public inline fun analyseWithReadAction( contextElement: KtElement, crossinline action: KtAnalysisSession.() -> R ): R = ApplicationManager.getApplication().runReadAction(Computable { @@ -148,7 +148,7 @@ inline fun analyseWithReadAction( * Should be executed from EDT only * If you want to analyse something from non-EDT thread, consider using [analyse]/[analyseWithReadAction] */ -inline fun analyseInModalWindow( +public inline fun analyseInModalWindow( contextElement: KtElement, windowTitle: String, crossinline action: KtAnalysisSession.() -> R diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtSymbolBasedReference.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtSymbolBasedReference.kt index f6eb8ddd915..d86d3898523 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtSymbolBasedReference.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtSymbolBasedReference.kt @@ -8,6 +8,6 @@ package org.jetbrains.kotlin.idea.frontend.api import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.idea.references.KtReference -interface KtSymbolBasedReference : KtReference { - fun KtAnalysisSession.resolveToSymbols(): Collection +public interface KtSymbolBasedReference : KtReference { + public fun KtAnalysisSession.resolveToSymbols(): Collection } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtTypeArgument.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtTypeArgument.kt index fed8f46540e..79022ff8e2f 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtTypeArgument.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtTypeArgument.kt @@ -9,13 +9,13 @@ import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.types.Variance -sealed class KtTypeArgument : ValidityTokenOwner +public sealed class KtTypeArgument : ValidityTokenOwner -class KtStarProjectionTypeArgument(override val token: ValidityToken) : KtTypeArgument() +public class KtStarProjectionTypeArgument(override val token: ValidityToken) : KtTypeArgument() -class KtTypeArgumentWithVariance( - val type: KtType, - val variance: Variance, +public class KtTypeArgumentWithVariance( + public val type: KtType, + public val variance: Variance, override val token: ValidityToken, ) : KtTypeArgument() diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/NoWriteActionInAnalyseCallChecker.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/NoWriteActionInAnalyseCallChecker.kt index f971d28bd38..ec38b878bc8 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/NoWriteActionInAnalyseCallChecker.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/NoWriteActionInAnalyseCallChecker.kt @@ -10,7 +10,7 @@ import com.intellij.openapi.application.ApplicationListener import com.intellij.openapi.application.ApplicationManager @KtInternalApiMarker -class NoWriteActionInAnalyseCallChecker(parentDisposable: Disposable) { +public class NoWriteActionInAnalyseCallChecker(parentDisposable: Disposable) { init { val listener = object : ApplicationListener { override fun writeActionFinished(action: Any) { @@ -22,17 +22,17 @@ class NoWriteActionInAnalyseCallChecker(parentDisposable: Disposable) { ApplicationManager.getApplication().addApplicationListener(listener, parentDisposable) } - fun beforeEnteringAnalysisContext() { + public fun beforeEnteringAnalysisContext() { currentAnalysisContextEnteringCount.set(currentAnalysisContextEnteringCount.get() + 1) } - fun afterLeavingAnalysisContext() { + public fun afterLeavingAnalysisContext() { currentAnalysisContextEnteringCount.set(currentAnalysisContextEnteringCount.get() - 1) } private val currentAnalysisContextEnteringCount = ThreadLocal.withInitial { 0 } } -class WriteActionStartInsideAnalysisContextException : IllegalStateException( +public class WriteActionStartInsideAnalysisContextException : IllegalStateException( "write action should be never executed inside analysis context (e,g. analyse call)" ) \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ValidityTokenOwner.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ValidityTokenOwner.kt index 96a7b997514..3de2d03faaa 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ValidityTokenOwner.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/ValidityTokenOwner.kt @@ -8,18 +8,18 @@ package org.jetbrains.kotlin.idea.frontend.api import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.tokens.assertIsValidAndAccessible -interface ValidityTokenOwner { - val token: ValidityToken +public interface ValidityTokenOwner { + public val token: ValidityToken } -fun ValidityTokenOwner.isValid(): Boolean = token.isValid() +public fun ValidityTokenOwner.isValid(): Boolean = token.isValid() @Suppress("NOTHING_TO_INLINE") -inline fun ValidityTokenOwner.assertIsValidAndAccessible() { +public inline fun ValidityTokenOwner.assertIsValidAndAccessible() { token.assertIsValidAndAccessible() } -inline fun ValidityTokenOwner.withValidityAssertion(action: () -> R): R { +public inline fun ValidityTokenOwner.withValidityAssertion(action: () -> R): R { assertIsValidAndAccessible() return action() } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/annotations.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/annotations.kt index a5f707ca765..430f5a4a677 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/annotations.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/annotations.kt @@ -6,4 +6,4 @@ package org.jetbrains.kotlin.idea.frontend.api @RequiresOptIn -annotation class KtInternalApiMarker \ No newline at end of file +public annotation class KtInternalApiMarker \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt index 19c8f634971..dbef098fe86 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/KtCall.kt @@ -12,9 +12,9 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtVariableLikeSymbol /** * Represents direct or indirect (via invoke) function call from Kotlin code */ -sealed class KtCall { - abstract val isErrorCall: Boolean - abstract val targetFunction: KtCallTarget +public sealed class KtCall { + public abstract val isErrorCall: Boolean + public abstract val targetFunction: KtCallTarget } /** @@ -24,8 +24,8 @@ sealed class KtCall { * f() // functional type call * } */ -class KtFunctionalTypeVariableCall( - val target: KtVariableLikeSymbol, +public class KtFunctionalTypeVariableCall( + public val target: KtVariableLikeSymbol, override val targetFunction: KtCallTarget ) : KtCall() { override val isErrorCall: Boolean get() = false @@ -34,7 +34,7 @@ class KtFunctionalTypeVariableCall( /** * Direct or indirect call of function declared by user */ -sealed class KtDeclaredFunctionCall : KtCall() { +public sealed class KtDeclaredFunctionCall : KtCall() { override val isErrorCall: Boolean get() = targetFunction is KtErrorCallTarget } @@ -48,8 +48,8 @@ sealed class KtDeclaredFunctionCall : KtCall() { * * fun Int.invoke() {} */ -class KtVariableWithInvokeFunctionCall( - val target: KtVariableLikeSymbol, +public class KtVariableWithInvokeFunctionCall( + public val target: KtVariableLikeSymbol, override val targetFunction: KtCallTarget ) : KtDeclaredFunctionCall() @@ -58,21 +58,21 @@ class KtVariableWithInvokeFunctionCall( * * x.toString() // function call */ -data class KtFunctionCall(override val targetFunction: KtCallTarget) : KtDeclaredFunctionCall() +public data class KtFunctionCall(override val targetFunction: KtCallTarget) : KtDeclaredFunctionCall() /** * Represents function(s) in which call was resolved, * Can be success [KtSuccessCallTarget] in this case there only one such function * Or erroneous [KtErrorCallTarget] in this case there can be any count of candidates */ -sealed class KtCallTarget { - abstract val candidates: Collection +public sealed class KtCallTarget { + public abstract val candidates: Collection } /** * Success call of [symbol] */ -class KtSuccessCallTarget(val symbol: KtFunctionLikeSymbol) : KtCallTarget() { +public class KtSuccessCallTarget(public val symbol: KtFunctionLikeSymbol) : KtCallTarget() { override val candidates: Collection get() = listOf(symbol) } @@ -80,4 +80,7 @@ class KtSuccessCallTarget(val symbol: KtFunctionLikeSymbol) : KtCallTarget() { /** * Function all with errors, possible candidates are [candidates] */ -class KtErrorCallTarget(override val candidates: Collection, val diagnostic: KtDiagnostic) : KtCallTarget() \ No newline at end of file +public class KtErrorCallTarget( + override val candidates: Collection, + public val diagnostic: KtDiagnostic +) : KtCallTarget() \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt index 29d37d79d61..aed6c30a3ab 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/calls/ktCallUtils.kt @@ -7,12 +7,12 @@ package org.jetbrains.kotlin.idea.frontend.api.calls import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol -fun KtCallTarget.getSuccessCallSymbolOrNull(): KtFunctionLikeSymbol? = when (this) { +public fun KtCallTarget.getSuccessCallSymbolOrNull(): KtFunctionLikeSymbol? = when (this) { is KtSuccessCallTarget -> symbol is KtErrorCallTarget -> null } -inline fun KtCall.isSuccessCallOf(predicate: (S) -> Boolean): Boolean { +public inline fun KtCall.isSuccessCallOf(predicate: (S) -> Boolean): Boolean { if (this !is KtFunctionCall) return false val symbol = targetFunction.getSuccessCallSymbolOrNull() ?: return false if (symbol !is S) return false diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionComponent.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionComponent.kt index 2f644f48a2d..2baef77bc1d 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionComponent.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionComponent.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner -abstract class KtAnalysisSessionComponent : ValidityTokenOwner { +public abstract class KtAnalysisSessionComponent : ValidityTokenOwner { protected abstract val analysisSession: KtAnalysisSession } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionMixIn.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionMixIn.kt index 7ee3f0fbfff..ea12b99ae3e 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionMixIn.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtAnalysisSessionMixIn.kt @@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -interface KtAnalysisSessionMixIn { - val analysisSession: KtAnalysisSession +public interface KtAnalysisSessionMixIn { + public val analysisSession: KtAnalysisSession } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt index 9a40fe43916..096b589b543 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCallResolver.kt @@ -10,19 +10,19 @@ import org.jetbrains.kotlin.psi.KtBinaryExpression import org.jetbrains.kotlin.psi.KtCallExpression import org.jetbrains.kotlin.psi.KtUnaryExpression -abstract class KtCallResolver : KtAnalysisSessionComponent() { - abstract fun resolveCall(call: KtCallExpression): KtCall? - abstract fun resolveCall(call: KtBinaryExpression): KtCall? - abstract fun resolveCall(call: KtUnaryExpression): KtCall? +public abstract class KtCallResolver : KtAnalysisSessionComponent() { + public abstract fun resolveCall(call: KtCallExpression): KtCall? + public abstract fun resolveCall(call: KtBinaryExpression): KtCall? + public abstract fun resolveCall(call: KtUnaryExpression): KtCall? } -interface KtCallResolverMixIn : KtAnalysisSessionMixIn { - fun KtCallExpression.resolveCall(): KtCall? = +public interface KtCallResolverMixIn : KtAnalysisSessionMixIn { + public fun KtCallExpression.resolveCall(): KtCall? = analysisSession.callResolver.resolveCall(this) - fun KtBinaryExpression.resolveCall(): KtCall? = + public fun KtBinaryExpression.resolveCall(): KtCall? = analysisSession.callResolver.resolveCall(this) - fun KtUnaryExpression.resolveCall(): KtCall? = + public fun KtUnaryExpression.resolveCall(): KtCall? = analysisSession.callResolver.resolveCall(this) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt index 773b649c6f0..cb7736c12b7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompileTimeConstantProvider.kt @@ -8,11 +8,11 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSimpleConstantValue import org.jetbrains.kotlin.psi.KtExpression -abstract class KtCompileTimeConstantProvider : KtAnalysisSessionComponent() { - abstract fun evaluate(expression: KtExpression): KtSimpleConstantValue<*>? +public abstract class KtCompileTimeConstantProvider : KtAnalysisSessionComponent() { + public abstract fun evaluate(expression: KtExpression): KtSimpleConstantValue<*>? } -interface KtCompileTimeConstantProviderMixIn : KtAnalysisSessionMixIn { - fun KtExpression.evaluate(): KtSimpleConstantValue<*>? = +public interface KtCompileTimeConstantProviderMixIn : KtAnalysisSessionMixIn { + public fun KtExpression.evaluate(): KtSimpleConstantValue<*>? = analysisSession.compileTimeConstantProvider.evaluate(this) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompletionCandidateChecker.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompletionCandidateChecker.kt index bebc350d485..73f0df7a834 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompletionCandidateChecker.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtCompletionCandidateChecker.kt @@ -10,8 +10,8 @@ import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtSimpleNameExpression -abstract class KtCompletionCandidateChecker : KtAnalysisSessionComponent() { - abstract fun checkExtensionFitsCandidate( +public abstract class KtCompletionCandidateChecker : KtAnalysisSessionComponent() { + public abstract fun checkExtensionFitsCandidate( firSymbolForCandidate: KtCallableSymbol, originalFile: KtFile, nameExpression: KtSimpleNameExpression, @@ -19,14 +19,14 @@ abstract class KtCompletionCandidateChecker : KtAnalysisSessionComponent() { ): KtExtensionApplicabilityResult } -enum class KtExtensionApplicabilityResult(val isApplicable: Boolean) { +public enum class KtExtensionApplicabilityResult(public val isApplicable: Boolean) { ApplicableAsExtensionCallable(isApplicable = true), ApplicableAsFunctionalVariableCall(isApplicable = true), NonApplicable(isApplicable = false), } -interface KtCompletionCandidateCheckerMixIn : KtAnalysisSessionMixIn { - fun KtCallableSymbol.checkExtensionIsSuitable( +public interface KtCompletionCandidateCheckerMixIn : KtAnalysisSessionMixIn { + public fun KtCallableSymbol.checkExtensionIsSuitable( originalPsiFile: KtFile, psiFakeCompletionExpression: KtSimpleNameExpression, psiReceiverExpression: KtExpression?, diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtDiagnosticProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtDiagnosticProvider.kt index 4b7f58a581b..db2768cfa21 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtDiagnosticProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtDiagnosticProvider.kt @@ -10,20 +10,20 @@ import org.jetbrains.kotlin.idea.frontend.api.diagnostics.KtDiagnosticWithPsi import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile -abstract class KtDiagnosticProvider : KtAnalysisSessionComponent() { - abstract fun getDiagnosticsForElement(element: KtElement, filter: KtDiagnosticCheckerFilter): Collection> - abstract fun collectDiagnosticsForFile(ktFile: KtFile, filter: KtDiagnosticCheckerFilter): Collection> +public abstract class KtDiagnosticProvider : KtAnalysisSessionComponent() { + public abstract fun getDiagnosticsForElement(element: KtElement, filter: KtDiagnosticCheckerFilter): Collection> + public abstract fun collectDiagnosticsForFile(ktFile: KtFile, filter: KtDiagnosticCheckerFilter): Collection> } -interface KtDiagnosticProviderMixIn : KtAnalysisSessionMixIn { - fun KtElement.getDiagnostics(filter: KtDiagnosticCheckerFilter): Collection = +public interface KtDiagnosticProviderMixIn : KtAnalysisSessionMixIn { + public fun KtElement.getDiagnostics(filter: KtDiagnosticCheckerFilter): Collection = analysisSession.diagnosticProvider.getDiagnosticsForElement(this, filter) - fun KtFile.collectDiagnosticsForFile(filter: KtDiagnosticCheckerFilter): Collection> = + public fun KtFile.collectDiagnosticsForFile(filter: KtDiagnosticCheckerFilter): Collection> = analysisSession.diagnosticProvider.collectDiagnosticsForFile(this, filter) } -enum class KtDiagnosticCheckerFilter { +public enum class KtDiagnosticCheckerFilter { ONLY_COMMON_CHECKERS, ONLY_EXTENDED_CHECKERS, EXTENDED_AND_COMMON_CHECKERS, diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionInfoProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionInfoProvider.kt index c037610cb00..0c761919da9 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionInfoProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionInfoProvider.kt @@ -10,14 +10,14 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.psi.KtReturnExpression import org.jetbrains.kotlin.psi.KtWhenExpression -abstract class KtExpressionInfoProvider : KtAnalysisSessionComponent() { - abstract fun getReturnExpressionTargetSymbol(returnExpression: KtReturnExpression): KtCallableSymbol? - abstract fun getWhenMissingCases(whenExpression: KtWhenExpression): List +public abstract class KtExpressionInfoProvider : KtAnalysisSessionComponent() { + public abstract fun getReturnExpressionTargetSymbol(returnExpression: KtReturnExpression): KtCallableSymbol? + public abstract fun getWhenMissingCases(whenExpression: KtWhenExpression): List } -interface KtExpressionInfoProviderMixIn : KtAnalysisSessionMixIn { - fun KtReturnExpression.getReturnTargetSymbol(): KtCallableSymbol? = +public interface KtExpressionInfoProviderMixIn : KtAnalysisSessionMixIn { + public fun KtReturnExpression.getReturnTargetSymbol(): KtCallableSymbol? = analysisSession.expressionInfoProvider.getReturnExpressionTargetSymbol(this) - fun KtWhenExpression.getMissingCases(): List = analysisSession.expressionInfoProvider.getWhenMissingCases(this) + public fun KtWhenExpression.getMissingCases(): List = analysisSession.expressionInfoProvider.getWhenMissingCases(this) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionTypeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionTypeProvider.kt index fcb2d9e89af..f1d741485c0 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionTypeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtExpressionTypeProvider.kt @@ -10,33 +10,33 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtExpression -abstract class KtExpressionTypeProvider : KtAnalysisSessionComponent() { - abstract fun getReturnTypeForKtDeclaration(declaration: KtDeclaration): KtType - abstract fun getKtExpressionType(expression: KtExpression): KtType - abstract fun getExpectedType(expression: PsiElement): KtType? - abstract fun isDefinitelyNull(expression: KtExpression): Boolean - abstract fun isDefinitelyNotNull(expression: KtExpression): Boolean +public abstract class KtExpressionTypeProvider : KtAnalysisSessionComponent() { + public abstract fun getReturnTypeForKtDeclaration(declaration: KtDeclaration): KtType + public abstract fun getKtExpressionType(expression: KtExpression): KtType + public abstract fun getExpectedType(expression: PsiElement): KtType? + public abstract fun isDefinitelyNull(expression: KtExpression): Boolean + public abstract fun isDefinitelyNotNull(expression: KtExpression): Boolean } -interface KtExpressionTypeProviderMixIn : KtAnalysisSessionMixIn { - fun KtExpression.getKtType(): KtType = +public interface KtExpressionTypeProviderMixIn : KtAnalysisSessionMixIn { + public fun KtExpression.getKtType(): KtType = analysisSession.expressionTypeProvider.getKtExpressionType(this) - fun KtDeclaration.getReturnKtType(): KtType = + public fun KtDeclaration.getReturnKtType(): KtType = analysisSession.expressionTypeProvider.getReturnTypeForKtDeclaration(this) /** * Returns the expected [KtType] of this [PsiElement] if it is an expression. The returned value should not be a * [org.jetbrains.kotlin.idea.frontend.api.types.KtClassErrorType]. */ - fun PsiElement.getExpectedType(): KtType? = + public fun PsiElement.getExpectedType(): KtType? = analysisSession.expressionTypeProvider.getExpectedType(this) /** * Returns `true` if this expression is definitely null, based on declared nullability and smart cast types derived from * data-flow analysis facts. Examples: * ``` - * fun foo(t: T, nt: T?, s: String, ns: String?) { + * public fun foo(t: T, nt: T?, s: String, ns: String?) { * t // t.isDefinitelyNull() == false && t.isDefinitelyNotNull() == true * nt // nt.isDefinitelyNull() == false && nt.isDefinitelyNotNull() == false * s // s.isDefinitelyNull() == false && s.isDefinitelyNotNull() == true @@ -54,12 +54,12 @@ interface KtExpressionTypeProviderMixIn : KtAnalysisSessionMixIn { * Note that only nullability from "stable" smart cast types is considered. The * [spec](https://kotlinlang.org/spec/type-inference.html#smart-cast-sink-stability) provides an explanation on smart cast stability. */ - fun KtExpression.isDefinitelyNull(): Boolean = + public fun KtExpression.isDefinitelyNull(): Boolean = analysisSession.expressionTypeProvider.isDefinitelyNull(this) /** * Returns `true` if this expression is definitely not null. See [isDefinitelyNull] for examples. */ - fun KtExpression.isDefinitelyNotNull(): Boolean = + public fun KtExpression.isDefinitelyNotNull(): Boolean = analysisSession.expressionTypeProvider.isDefinitelyNotNull(this) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtInheritorsProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtInheritorsProvider.kt index fa45d24cfb2..2f1d7759f7f 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtInheritorsProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtInheritorsProvider.kt @@ -8,15 +8,15 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtNamedClassOrObjectSymbol -abstract class KtInheritorsProvider : KtAnalysisSessionComponent() { - abstract fun getInheritorsOfSealedClass(classSymbol: KtNamedClassOrObjectSymbol): List - abstract fun getEnumEntries(classSymbol: KtNamedClassOrObjectSymbol): List +public abstract class KtInheritorsProvider : KtAnalysisSessionComponent() { + public abstract fun getInheritorsOfSealedClass(classSymbol: KtNamedClassOrObjectSymbol): List + public abstract fun getEnumEntries(classSymbol: KtNamedClassOrObjectSymbol): List } -interface KtInheritorsProviderMixIn : KtAnalysisSessionMixIn { - fun KtNamedClassOrObjectSymbol.getSealedClassInheritors(): List = - analysisSession.inheritorsProvider.getInheritorsOfSealedClass(this) +public interface KtInheritorsProviderMixIn : KtAnalysisSessionMixIn { + public fun KtNamedClassOrObjectSymbol.getSealedClassInheritors(): List = + analysisSession.inheritorsProvider.getInheritorsOfSealedClass(this) - fun KtNamedClassOrObjectSymbol.getEnumEntries(): List = - analysisSession.inheritorsProvider.getEnumEntries(this) + public fun KtNamedClassOrObjectSymbol.getEnumEntries(): List = + analysisSession.inheritorsProvider.getEnumEntries(this) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtOverrideInfoProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtOverrideInfoProvider.kt index a8938c443b7..ac22cac642d 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtOverrideInfoProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtOverrideInfoProvider.kt @@ -9,24 +9,28 @@ import org.jetbrains.kotlin.util.ImplementationStatus import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol -abstract class KtOverrideInfoProvider : KtAnalysisSessionComponent() { - abstract fun isVisible(memberSymbol: KtCallableSymbol, classSymbol: KtClassOrObjectSymbol): Boolean - abstract fun getImplementationStatus(memberSymbol: KtCallableSymbol, parentClassSymbol: KtClassOrObjectSymbol): ImplementationStatus? - abstract fun getOriginalOverriddenSymbol(symbol: KtCallableSymbol): KtCallableSymbol? - abstract fun getOriginalContainingClassForOverride(symbol: KtCallableSymbol): KtClassOrObjectSymbol? +public abstract class KtOverrideInfoProvider : KtAnalysisSessionComponent() { + public abstract fun isVisible(memberSymbol: KtCallableSymbol, classSymbol: KtClassOrObjectSymbol): Boolean + public abstract fun getImplementationStatus( + memberSymbol: KtCallableSymbol, + parentClassSymbol: KtClassOrObjectSymbol + ): ImplementationStatus? + + public abstract fun getOriginalOverriddenSymbol(symbol: KtCallableSymbol): KtCallableSymbol? + public abstract fun getOriginalContainingClassForOverride(symbol: KtCallableSymbol): KtClassOrObjectSymbol? } -interface KtMemberSymbolProviderMixin : KtAnalysisSessionMixIn { +public interface KtMemberSymbolProviderMixin : KtAnalysisSessionMixIn { /** Checks if the given symbol (possibly a symbol inherited from a super class) is visible in the given class. */ - fun KtCallableSymbol.isVisibleInClass(classSymbol: KtClassOrObjectSymbol): Boolean = + public fun KtCallableSymbol.isVisibleInClass(classSymbol: KtClassOrObjectSymbol): Boolean = analysisSession.overrideInfoProvider.isVisible(this, classSymbol) /** * Gets the [ImplementationStatus] of the [this] member symbol in the given [parentClassSymbol]. Or null if this symbol is not a * member. */ - fun KtCallableSymbol.getImplementationStatus(parentClassSymbol: KtClassOrObjectSymbol): ImplementationStatus? = + public fun KtCallableSymbol.getImplementationStatus(parentClassSymbol: KtClassOrObjectSymbol): ImplementationStatus? = analysisSession.overrideInfoProvider.getImplementationStatus(this, parentClassSymbol) /** @@ -34,11 +38,11 @@ interface KtMemberSymbolProviderMixin : KtAnalysisSessionMixIn { * classes. For example, consider * * ``` - * interface A { - * fun foo(t:T) + * public interface A { + * public fun foo(t:T) * } * - * interface B: A { + * public interface B: A { * } * ``` * @@ -49,12 +53,12 @@ interface KtMemberSymbolProviderMixin : KtAnalysisSessionMixIn { * Such situation can also happens for intersection symbols (in case of multiple super types containing symbols with identical signature * after specialization) and delegation. */ - val KtCallableSymbol.originalOverriddenSymbol: KtCallableSymbol? + public val KtCallableSymbol.originalOverriddenSymbol: KtCallableSymbol? get() = analysisSession.overrideInfoProvider.getOriginalOverriddenSymbol(this) /** * Gets the class symbol where the given callable symbol is declared. See [originalOverriddenSymbol] for more details. */ - val KtCallableSymbol.originalContainingClassForOverride: KtClassOrObjectSymbol? + public val KtCallableSymbol.originalContainingClassForOverride: KtClassOrObjectSymbol? get() = analysisSession.overrideInfoProvider.getOriginalContainingClassForOverride(this) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtPsiTypeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtPsiTypeProvider.kt index 96a17ffbd66..7c208a9656e 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtPsiTypeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtPsiTypeProvider.kt @@ -11,22 +11,22 @@ import org.jetbrains.kotlin.psi.KtDoubleColonExpression import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtTypeReference -abstract class KtPsiTypeProvider : KtAnalysisSessionComponent() { - abstract fun getPsiTypeForKtExpression(expression: KtExpression, mode: TypeMappingMode): PsiType - abstract fun getPsiTypeForKtTypeReference(ktTypeReference: KtTypeReference, mode: TypeMappingMode): PsiType - abstract fun getPsiTypeForReceiverOfDoubleColonExpression( +public abstract class KtPsiTypeProvider : KtAnalysisSessionComponent() { + public abstract fun getPsiTypeForKtExpression(expression: KtExpression, mode: TypeMappingMode): PsiType + public abstract fun getPsiTypeForKtTypeReference(ktTypeReference: KtTypeReference, mode: TypeMappingMode): PsiType + public abstract fun getPsiTypeForReceiverOfDoubleColonExpression( ktDoubleColonExpression: KtDoubleColonExpression, mode: TypeMappingMode ): PsiType? } -interface KtPsiTypeProviderMixIn : KtAnalysisSessionMixIn { - fun KtExpression.getPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType = +public interface KtPsiTypeProviderMixIn : KtAnalysisSessionMixIn { + public fun KtExpression.getPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType = analysisSession.psiTypeProvider.getPsiTypeForKtExpression(this, mode) - fun KtTypeReference.getPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType = + public fun KtTypeReference.getPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType = analysisSession.psiTypeProvider.getPsiTypeForKtTypeReference(this, mode) - fun KtDoubleColonExpression.getReceiverPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType? = + public fun KtDoubleColonExpression.getReceiverPsiType(mode: TypeMappingMode = TypeMappingMode.DEFAULT): PsiType? = analysisSession.psiTypeProvider.getPsiTypeForReceiverOfDoubleColonExpression(this, mode) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceResolveMixIn.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceResolveMixIn.kt index 0c96bb2d014..bd3068c2569 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceResolveMixIn.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceResolveMixIn.kt @@ -9,13 +9,13 @@ import org.jetbrains.kotlin.idea.frontend.api.KtSymbolBasedReference import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.idea.references.KtReference -interface KtReferenceResolveMixIn : KtAnalysisSessionMixIn { - fun KtReference.resolveToSymbols(): Collection { +public interface KtReferenceResolveMixIn : KtAnalysisSessionMixIn { + public fun KtReference.resolveToSymbols(): Collection { check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference" } return analysisSession.resolveToSymbols() } - fun KtReference.resolveToSymbol(): KtSymbol? { + public fun KtReference.resolveToSymbol(): KtSymbol? { check(this is KtSymbolBasedReference) { "To get reference symbol the one should be KtSymbolBasedReference but was ${this::class}" } return resolveToSymbols().singleOrNull() } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceShortener.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceShortener.kt index 6ac15e2dd48..1bb3aefa518 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceShortener.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtReferenceShortener.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtEnumEntrySymbol import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile -enum class ShortenOption { +public enum class ShortenOption { /** Skip shortening references to this symbol. */ DO_NOT_SHORTEN, @@ -26,8 +26,8 @@ enum class ShortenOption { SHORTEN_AND_STAR_IMPORT } -abstract class KtReferenceShortener : KtAnalysisSessionComponent() { - abstract fun collectShortenings( +public abstract class KtReferenceShortener : KtAnalysisSessionComponent() { + public abstract fun collectShortenings( file: KtFile, selection: TextRange, classShortenOption: (KtClassLikeSymbol) -> ShortenOption, @@ -35,8 +35,8 @@ abstract class KtReferenceShortener : KtAnalysisSessionComponent() { ): ShortenCommand } -interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { - companion object { +public interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { + public companion object { private val defaultClassShortenOption: (KtClassLikeSymbol) -> ShortenOption = { if (it.classIdIfNonLocal?.isNestedClass == true) { ShortenOption.SHORTEN_IF_ALREADY_IMPORTED @@ -55,7 +55,7 @@ interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { * Collects possible references to shorten. By default, it shortens a fully-qualified members to the outermost class and does not * shorten enum entries. */ - fun collectPossibleReferenceShortenings( + public fun collectPossibleReferenceShortenings( file: KtFile, selection: TextRange = file.textRange, classShortenOption: (KtClassLikeSymbol) -> ShortenOption = defaultClassShortenOption, @@ -63,7 +63,7 @@ interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { ): ShortenCommand = analysisSession.referenceShortener.collectShortenings(file, selection, classShortenOption, callableShortenOption) - fun collectPossibleReferenceShorteningsInElement( + public fun collectPossibleReferenceShorteningsInElement( element: KtElement, classShortenOption: (KtClassLikeSymbol) -> ShortenOption = defaultClassShortenOption, callableShortenOption: (KtCallableSymbol) -> ShortenOption = defaultCallableShortenOption @@ -76,7 +76,7 @@ interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { ) } -interface ShortenCommand { - fun invokeShortening() - val isEmpty: Boolean +public interface ShortenCommand { + public fun invokeShortening() + public val isEmpty: Boolean } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt index d636d6e0b2c..f434e3bc063 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtScopeProvider.kt @@ -17,56 +17,56 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile -abstract class KtScopeProvider : KtAnalysisSessionComponent() { - abstract fun getMemberScope(classSymbol: KtSymbolWithMembers): KtMemberScope - abstract fun getStaticMemberScope(symbol: KtSymbolWithMembers): KtScope +public abstract class KtScopeProvider : KtAnalysisSessionComponent() { + public abstract fun getMemberScope(classSymbol: KtSymbolWithMembers): KtMemberScope + public abstract fun getStaticMemberScope(symbol: KtSymbolWithMembers): KtScope - abstract fun getDeclaredMemberScope(classSymbol: KtSymbolWithMembers): KtDeclaredMemberScope - abstract fun getFileScope(fileSymbol: KtFileSymbol): KtDeclarationScope - abstract fun getPackageScope(packageSymbol: KtPackageSymbol): KtPackageScope - abstract fun getCompositeScope(subScopes: List): KtCompositeScope + public abstract fun getDeclaredMemberScope(classSymbol: KtSymbolWithMembers): KtDeclaredMemberScope + public abstract fun getFileScope(fileSymbol: KtFileSymbol): KtDeclarationScope + public abstract fun getPackageScope(packageSymbol: KtPackageSymbol): KtPackageScope + public abstract fun getCompositeScope(subScopes: List): KtCompositeScope - abstract fun getTypeScope(type: KtType): KtScope? + public abstract fun getTypeScope(type: KtType): KtScope? - abstract fun getScopeContextForPosition( + public abstract fun getScopeContextForPosition( originalFile: KtFile, positionInFakeFile: KtElement ): KtScopeContext } -interface KtScopeProviderMixIn : KtAnalysisSessionMixIn { - fun KtSymbolWithMembers.getMemberScope(): KtMemberScope = +public interface KtScopeProviderMixIn : KtAnalysisSessionMixIn { + public fun KtSymbolWithMembers.getMemberScope(): KtMemberScope = analysisSession.scopeProvider.getMemberScope(this) - fun KtSymbolWithMembers.getDeclaredMemberScope(): KtDeclaredMemberScope = + public fun KtSymbolWithMembers.getDeclaredMemberScope(): KtDeclaredMemberScope = analysisSession.scopeProvider.getDeclaredMemberScope(this) - fun KtSymbolWithMembers.getStaticMemberScope(): KtScope = + public fun KtSymbolWithMembers.getStaticMemberScope(): KtScope = analysisSession.scopeProvider.getStaticMemberScope(this) - fun KtFileSymbol.getFileScope(): KtDeclarationScope = + public fun KtFileSymbol.getFileScope(): KtDeclarationScope = analysisSession.scopeProvider.getFileScope(this) - fun KtPackageSymbol.getPackageScope(): KtPackageScope = + public fun KtPackageSymbol.getPackageScope(): KtPackageScope = analysisSession.scopeProvider.getPackageScope(this) - fun List.asCompositeScope(): KtCompositeScope = + public fun List.asCompositeScope(): KtCompositeScope = analysisSession.scopeProvider.getCompositeScope(this) - fun KtType.getTypeScope(): KtScope? = + public fun KtType.getTypeScope(): KtScope? = analysisSession.scopeProvider.getTypeScope(this) - fun KtFile.getScopeContextForPosition(positionInFakeFile: KtElement): KtScopeContext = + public fun KtFile.getScopeContextForPosition(positionInFakeFile: KtElement): KtScopeContext = analysisSession.scopeProvider.getScopeContextForPosition(this, positionInFakeFile) - fun KtFile.getScopeContextForFile(): KtScopeContext = + public fun KtFile.getScopeContextForFile(): KtScopeContext = analysisSession.scopeProvider.getScopeContextForPosition(this, this) } -data class KtScopeContext(val scopes: KtCompositeScope, val implicitReceivers: List) +public data class KtScopeContext(val scopes: KtCompositeScope, val implicitReceivers: List) -class KtImplicitReceiver( +public class KtImplicitReceiver( override val token: ValidityToken, - val type: KtType, - val ownerSymbol: KtSymbol -): ValidityTokenOwner + public val type: KtType, + public val ownerSymbol: KtSymbol +) : ValidityTokenOwner diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSmartCastProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSmartCastProvider.kt index f1a1b604c41..ca6d9ccdf46 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSmartCastProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSmartCastProvider.kt @@ -9,15 +9,15 @@ import org.jetbrains.kotlin.idea.frontend.api.ImplicitReceiverSmartCast import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.psi.KtExpression -abstract class KtSmartCastProvider : KtAnalysisSessionComponent() { - abstract fun getSmartCastedToType(expression: KtExpression): KtType? - abstract fun getImplicitReceiverSmartCast(expression: KtExpression): Collection +public abstract class KtSmartCastProvider : KtAnalysisSessionComponent() { + public abstract fun getSmartCastedToType(expression: KtExpression): KtType? + public abstract fun getImplicitReceiverSmartCast(expression: KtExpression): Collection } -interface KtSmartCastProviderMixIn : KtAnalysisSessionMixIn { - fun KtExpression.getSmartCast(): KtType? = +public interface KtSmartCastProviderMixIn : KtAnalysisSessionMixIn { + public fun KtExpression.getSmartCast(): KtType? = analysisSession.smartCastProvider.getSmartCastedToType(this) - fun KtExpression.getImplicitReceiverSmartCast(): Collection = + public fun KtExpression.getImplicitReceiverSmartCast(): Collection = analysisSession.smartCastProvider.getImplicitReceiverSmartCast(this) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSubtypingComponent.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSubtypingComponent.kt index 3f412cdde6e..721217e9288 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSubtypingComponent.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSubtypingComponent.kt @@ -7,18 +7,18 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.types.KtType -abstract class KtSubtypingComponent : KtAnalysisSessionComponent() { - abstract fun isEqualTo(first: KtType, second: KtType): Boolean - abstract fun isSubTypeOf(subType: KtType, superType: KtType): Boolean +public abstract class KtSubtypingComponent : KtAnalysisSessionComponent() { + public abstract fun isEqualTo(first: KtType, second: KtType): Boolean + public abstract fun isSubTypeOf(subType: KtType, superType: KtType): Boolean } -interface KtSubtypingComponentMixIn : KtAnalysisSessionMixIn { - infix fun KtType.isEqualTo(other: KtType): Boolean = +public interface KtSubtypingComponentMixIn : KtAnalysisSessionMixIn { + infix public fun KtType.isEqualTo(other: KtType): Boolean = analysisSession.subtypingComponent.isEqualTo(this, other) - infix fun KtType.isSubTypeOf(superType: KtType): Boolean = + infix public fun KtType.isSubTypeOf(superType: KtType): Boolean = analysisSession.subtypingComponent.isSubTypeOf(this, superType) - infix fun KtType.isNotSubTypeOf(superType: KtType): Boolean = + infix public fun KtType.isNotSubTypeOf(superType: KtType): Boolean = !analysisSession.subtypingComponent.isSubTypeOf(this, superType) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolContainingDeclarationProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolContainingDeclarationProvider.kt index 0ce5ac09520..5916cc33d8d 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolContainingDeclarationProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolContainingDeclarationProvider.kt @@ -7,17 +7,17 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithKind -abstract class KtSymbolContainingDeclarationProvider : KtAnalysisSessionComponent() { - abstract fun getContainingDeclaration(symbol: KtSymbolWithKind): KtSymbolWithKind? +public abstract class KtSymbolContainingDeclarationProvider : KtAnalysisSessionComponent() { + public abstract fun getContainingDeclaration(symbol: KtSymbolWithKind): KtSymbolWithKind? } -interface KtSymbolContainingDeclarationProviderMixIn : KtAnalysisSessionMixIn { +public interface KtSymbolContainingDeclarationProviderMixIn : KtAnalysisSessionMixIn { /** * Returns containing declaration for symbol: * for top-level declarations returns null * for class members returns containing class * for local declaration returns declaration it was declared it */ - fun KtSymbolWithKind.getContainingSymbol(): KtSymbolWithKind? = + public fun KtSymbolWithKind.getContainingSymbol(): KtSymbolWithKind? = analysisSession.containingDeclarationProvider.getContainingDeclaration(this) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationOverridesProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationOverridesProvider.kt index 53b5e0e6e21..9effaa02510 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationOverridesProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationOverridesProvider.kt @@ -9,14 +9,14 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol -abstract class KtSymbolDeclarationOverridesProvider : KtAnalysisSessionComponent() { - abstract fun getAllOverriddenSymbols(callableSymbol: T): List - abstract fun getDirectlyOverriddenSymbols(callableSymbol: T): List +public abstract class KtSymbolDeclarationOverridesProvider : KtAnalysisSessionComponent() { + public abstract fun getAllOverriddenSymbols(callableSymbol: T): List + public abstract fun getDirectlyOverriddenSymbols(callableSymbol: T): List - abstract fun getIntersectionOverriddenSymbols(symbol: KtCallableSymbol): Collection + public abstract fun getIntersectionOverriddenSymbols(symbol: KtCallableSymbol): Collection } -interface KtSymbolDeclarationOverridesProviderMixIn : KtAnalysisSessionMixIn { +public interface KtSymbolDeclarationOverridesProviderMixIn : KtAnalysisSessionMixIn { /** * Return a list of **all** symbols which are overridden by symbol * @@ -26,7 +26,7 @@ interface KtSymbolDeclarationOverridesProviderMixIn : KtAnalysisSessionMixIn { * * @see getDirectlyOverriddenSymbols */ - fun KtCallableSymbol.getAllOverriddenSymbols(): List = + public fun KtCallableSymbol.getAllOverriddenSymbols(): List = analysisSession.symbolDeclarationOverridesProvider.getAllOverriddenSymbols(this) /** @@ -38,9 +38,9 @@ interface KtSymbolDeclarationOverridesProviderMixIn : KtAnalysisSessionMixIn { * * @see getAllOverriddenSymbols */ - fun KtCallableSymbol.getDirectlyOverriddenSymbols(): List = + public fun KtCallableSymbol.getDirectlyOverriddenSymbols(): List = analysisSession.symbolDeclarationOverridesProvider.getDirectlyOverriddenSymbols(this) - fun KtCallableSymbol.getIntersectionOverriddenSymbols(): Collection = + public fun KtCallableSymbol.getIntersectionOverriddenSymbols(): Collection = analysisSession.symbolDeclarationOverridesProvider.getIntersectionOverriddenSymbols(this) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationRendererProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationRendererProvider.kt index 3ee5e557c70..ab7e3a74cf7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationRendererProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolDeclarationRendererProvider.kt @@ -13,28 +13,28 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtType * @see KtType * @see KtSymbolDeclarationRendererProvider.render */ -data class KtTypeRendererOptions( +public data class KtTypeRendererOptions( /** * Render type name without package name for not local types */ - val shortQualifiedNames: Boolean = false, + public val shortQualifiedNames: Boolean = false, /** - * Render function types FunctionN using Kotlin function type syntax - * @see Function - * @sample Function0 returns () -> Int + * Render public function types public functionN using Kotlin public function type syntax + * @see public function + * @sample public function0 returns () -> Int */ - val renderFunctionType: Boolean = true, + public val renderFunctionType: Boolean = true, /** * When met type with unresolved qualifier, render it as it is resolved * When `true` will render as `UnresolvedQualifier` * When `false` will render as "ERROR_TYPE " */ - val renderUnresolvedTypeAsResolved: Boolean = true + public val renderUnresolvedTypeAsResolved: Boolean = true ) { - companion object { - val DEFAULT = KtTypeRendererOptions() - val SHORT_NAMES = DEFAULT.copy(shortQualifiedNames = true) + public companion object { + public val DEFAULT: KtTypeRendererOptions = KtTypeRendererOptions() + public val SHORT_NAMES: KtTypeRendererOptions = DEFAULT.copy(shortQualifiedNames = true) } } @@ -43,7 +43,7 @@ data class KtTypeRendererOptions( * @see KtSymbol * @see KtSymbolDeclarationRendererProvider.render */ -data class KtDeclarationRendererOptions( +public data class KtDeclarationRendererOptions( /** * Set of modifiers that needed to be rendered * @see RendererModifier @@ -55,7 +55,7 @@ data class KtDeclarationRendererOptions( */ val typeRendererOptions: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT, /** - * Render Unit return type for functions + * Render Unit return type for public functions */ val renderUnitReturnType: Boolean = false, /** @@ -72,24 +72,24 @@ data class KtDeclarationRendererOptions( val approximateTypes: Boolean = false, /** - * Declaration header is something like `abstract class`, `fun`, or `private interface` in a declaration. + * Declaration header is something like `public abstract class`, `public fun`, or `private public interface ` in a declaration. */ val renderDeclarationHeader: Boolean = true, /** - * Whether to forcefully add `override` modifier when rendering functions or properties. Note that the [modifiers] option still + * Whether to forcefully add `override` modifier when rendering public functions or properties. Note that the [modifiers] option still * controls whether `override` is rendered. That is, if [modifiers] don't contain `override`, then this flag does not have any effect. */ val forceRenderingOverrideModifier: Boolean = false, val renderDefaultParameterValue: Boolean = true, ) { - companion object { - val DEFAULT = KtDeclarationRendererOptions() + public companion object { + public val DEFAULT: KtDeclarationRendererOptions = KtDeclarationRendererOptions() } } -enum class RendererModifier(val includeByDefault: Boolean) { +public enum class RendererModifier(public val includeByDefault: Boolean) { VISIBILITY(true), MODALITY(true), OVERRIDE(true), @@ -106,29 +106,29 @@ enum class RendererModifier(val includeByDefault: Boolean) { OPERATOR(true) ; - companion object { - val ALL = values().toSet() + public companion object { + public val ALL: Set = values().toSet() } } -abstract class KtSymbolDeclarationRendererProvider : KtAnalysisSessionComponent() { - abstract fun render(symbol: KtSymbol, options: KtDeclarationRendererOptions): String - abstract fun render(type: KtType, options: KtTypeRendererOptions): String +public abstract class KtSymbolDeclarationRendererProvider : KtAnalysisSessionComponent() { + public abstract fun render(symbol: KtSymbol, options: KtDeclarationRendererOptions): String + public abstract fun render(type: KtType, options: KtTypeRendererOptions): String } /** * Provides services for rendering Symbols and Types into the Kotlin strings */ -interface KtSymbolDeclarationRendererMixIn : KtAnalysisSessionMixIn { +public interface KtSymbolDeclarationRendererMixIn : KtAnalysisSessionMixIn { /** * Render symbol into the representable Kotlin string */ - fun KtSymbol.render(options: KtDeclarationRendererOptions = KtDeclarationRendererOptions.DEFAULT): String = + public fun KtSymbol.render(options: KtDeclarationRendererOptions = KtDeclarationRendererOptions.DEFAULT): String = analysisSession.symbolDeclarationRendererProvider.render(this, options) /** * Render kotlin type into the representable Kotlin type string */ - fun KtType.render(options: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT): String = + public fun KtType.render(options: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT): String = analysisSession.symbolDeclarationRendererProvider.render(this, options) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolsMixIn.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolsMixIn.kt index ec38c2908ce..2c9a125b794 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolsMixIn.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolsMixIn.kt @@ -8,7 +8,7 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer -interface KtSymbolsMixIn : KtAnalysisSessionMixIn { +public interface KtSymbolsMixIn : KtAnalysisSessionMixIn { @Suppress("DEPRECATION") - fun KtSymbolPointer.restoreSymbol(): S? = restoreSymbol(analysisSession) + public fun KtSymbolPointer.restoreSymbol(): S? = restoreSymbol(analysisSession) } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeCreator.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeCreator.kt index d124ffd86c7..eaa88bc9eaf 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeCreator.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeCreator.kt @@ -14,44 +14,44 @@ import org.jetbrains.kotlin.idea.frontend.api.types.KtTypeNullability import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.types.Variance -abstract class KtTypeCreator : KtAnalysisSessionComponent() { - abstract fun buildClassType(builder: KtClassTypeBuilder): KtClassType +public abstract class KtTypeCreator : KtAnalysisSessionComponent() { + public abstract fun buildClassType(builder: KtClassTypeBuilder): KtClassType } -interface KtTypeCreatorMixIn : KtAnalysisSessionMixIn +public interface KtTypeCreatorMixIn : KtAnalysisSessionMixIn -inline fun KtTypeCreatorMixIn.buildClassType( +public inline fun KtTypeCreatorMixIn.buildClassType( classId: ClassId, build: KtClassTypeBuilder.() -> Unit = {} ): KtClassType = analysisSession.typesCreator.buildClassType(KtClassTypeBuilder.ByClassId(classId).apply(build)) -inline fun KtTypeCreatorMixIn.buildClassType( +public inline fun KtTypeCreatorMixIn.buildClassType( symbol: KtClassOrObjectSymbol, build: KtClassTypeBuilder.() -> Unit = {} ): KtClassType = analysisSession.typesCreator.buildClassType(KtClassTypeBuilder.BySymbol(symbol).apply(build)) -sealed class KtTypeBuilder +public sealed class KtTypeBuilder -sealed class KtClassTypeBuilder : KtTypeBuilder() { +public sealed class KtClassTypeBuilder : KtTypeBuilder() { private val _arguments = mutableListOf() - var nullability: KtTypeNullability = KtTypeNullability.NON_NULLABLE + public var nullability: KtTypeNullability = KtTypeNullability.NON_NULLABLE - val arguments: List get() = _arguments + public val arguments: List get() = _arguments - fun argument(argument: KtTypeArgument) { + public fun argument(argument: KtTypeArgument) { _arguments += argument } - fun argument(type: KtType, variance: Variance = Variance.INVARIANT) { + public fun argument(type: KtType, variance: Variance = Variance.INVARIANT) { _arguments += KtTypeArgumentWithVariance(type, variance, type.token) } - class ByClassId(val classId: ClassId) : KtClassTypeBuilder() - class BySymbol(val symbol: KtClassOrObjectSymbol) : KtClassTypeBuilder() + public class ByClassId(public val classId: ClassId) : KtClassTypeBuilder() + public class BySymbol(public val symbol: KtClassOrObjectSymbol) : KtClassTypeBuilder() } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeInfoProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeInfoProvider.kt index 5b8f4ccc6a1..821a9b85e06 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeInfoProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeInfoProvider.kt @@ -11,43 +11,43 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeAliasSymbol import org.jetbrains.kotlin.idea.frontend.api.types.* import org.jetbrains.kotlin.name.ClassId -abstract class KtTypeInfoProvider : KtAnalysisSessionComponent() { - abstract fun canBeNull(type: KtType): Boolean +public abstract class KtTypeInfoProvider : KtAnalysisSessionComponent() { + public abstract fun canBeNull(type: KtType): Boolean } -interface KtTypeInfoProviderMixIn : KtAnalysisSessionMixIn { +public interface KtTypeInfoProviderMixIn : KtAnalysisSessionMixIn { /** - * Returns true if a value of this type can potentially be null. This means this type is not a subtype of [Any]. However, it does not - * mean one can assign `null` to a variable of this type because it may be unknown if this type can accept `null`. For example, a value + * Returns true if a public value of this type can potentially be null. This means this type is not a subtype of [Any]. However, it does not + * mean one can assign `null` to a variable of this type because it may be unknown if this type can accept `null`. For example, a public value * of type `T:Any?` can potentially be null. But one can not assign `null` to such a variable because the instantiated type may not be * nullable. */ - val KtType.canBeNull: Boolean get() = analysisSession.typeInfoProvider.canBeNull(this) + public val KtType.canBeNull: Boolean get() = analysisSession.typeInfoProvider.canBeNull(this) /** Returns true if the type is explicitly marked as nullable. This means it's safe to assign `null` to a variable with this type. */ - val KtType.isMarkedNullable: Boolean get() = (this as? KtTypeWithNullability)?.nullability == KtTypeNullability.NULLABLE + public val KtType.isMarkedNullable: Boolean get() = (this as? KtTypeWithNullability)?.nullability == KtTypeNullability.NULLABLE - val KtType.isUnit: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.UNIT) - val KtType.isInt: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.INT) - val KtType.isLong: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.LONG) - val KtType.isShort: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.SHORT) - val KtType.isByte: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.BYTE) - val KtType.isFloat: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.FLOAT) - val KtType.isDouble: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.DOUBLE) - val KtType.isChar: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.CHAR) - val KtType.isBoolean: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.BOOLEAN) - val KtType.isString: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.STRING) - val KtType.isCharSequence: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.CHAR_SEQUENCE) - val KtType.isAny: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.ANY) - val KtType.isNothing: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.NOTHING) + public val KtType.isUnit: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.UNIT) + public val KtType.isInt: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.INT) + public val KtType.isLong: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.LONG) + public val KtType.isShort: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.SHORT) + public val KtType.isByte: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.BYTE) + public val KtType.isFloat: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.FLOAT) + public val KtType.isDouble: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.DOUBLE) + public val KtType.isChar: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.CHAR) + public val KtType.isBoolean: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.BOOLEAN) + public val KtType.isString: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.STRING) + public val KtType.isCharSequence: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.CHAR_SEQUENCE) + public val KtType.isAny: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.ANY) + public val KtType.isNothing: Boolean get() = isClassTypeWithClassId(DefaultTypeClassIds.NOTHING) - val KtType.isUInt: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uInt) - val KtType.isULong: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uLong) - val KtType.isUShort: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uShort) - val KtType.isUByte: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uByte) + public val KtType.isUInt: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uInt) + public val KtType.isULong: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uLong) + public val KtType.isUShort: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uShort) + public val KtType.isUByte: Boolean get() = isClassTypeWithClassId(StandardNames.FqNames.uByte) /** Gets the class symbol backing the given type, if available. */ - val KtType.expandedClassSymbol: KtClassOrObjectSymbol? + public val KtType.expandedClassSymbol: KtClassOrObjectSymbol? get() { return when (this) { is KtNonErrorClassType -> when (val classSymbol = classSymbol) { @@ -58,18 +58,18 @@ interface KtTypeInfoProviderMixIn : KtAnalysisSessionMixIn { } } - fun KtType.isClassTypeWithClassId(classId: ClassId): Boolean { + public fun KtType.isClassTypeWithClassId(classId: ClassId): Boolean { if (this !is KtNonErrorClassType) return false return this.classId == classId } - val KtType.isPrimitive: Boolean + public val KtType.isPrimitive: Boolean get() { if (this !is KtNonErrorClassType) return false return this.classId in DefaultTypeClassIds.PRIMITIVES } - val KtType.defaultInitializer: String? + public val KtType.defaultInitializer: String? get() = when { isMarkedNullable -> "null" isInt || isLong || isShort || isByte -> "0" @@ -87,19 +87,19 @@ interface KtTypeInfoProviderMixIn : KtAnalysisSessionMixIn { } } -object DefaultTypeClassIds { - val UNIT = ClassId.topLevel(StandardNames.FqNames.unit.toSafe()) - val INT = ClassId.topLevel(StandardNames.FqNames._int.toSafe()) - val LONG = ClassId.topLevel(StandardNames.FqNames._long.toSafe()) - val SHORT = ClassId.topLevel(StandardNames.FqNames._short.toSafe()) - val BYTE = ClassId.topLevel(StandardNames.FqNames._byte.toSafe()) - val FLOAT = ClassId.topLevel(StandardNames.FqNames._float.toSafe()) - val DOUBLE = ClassId.topLevel(StandardNames.FqNames._double.toSafe()) - val CHAR = ClassId.topLevel(StandardNames.FqNames._char.toSafe()) - val BOOLEAN = ClassId.topLevel(StandardNames.FqNames._boolean.toSafe()) - val STRING = ClassId.topLevel(StandardNames.FqNames.string.toSafe()) - val CHAR_SEQUENCE = ClassId.topLevel(StandardNames.FqNames.charSequence.toSafe()) - val ANY = ClassId.topLevel(StandardNames.FqNames.any.toSafe()) - val NOTHING = ClassId.topLevel(StandardNames.FqNames.nothing.toSafe()) - val PRIMITIVES = setOf(INT, LONG, SHORT, BYTE, FLOAT, DOUBLE, CHAR, BOOLEAN) +public object DefaultTypeClassIds { + public val UNIT: ClassId = ClassId.topLevel(StandardNames.FqNames.unit.toSafe()) + public val INT: ClassId = ClassId.topLevel(StandardNames.FqNames._int.toSafe()) + public val LONG: ClassId = ClassId.topLevel(StandardNames.FqNames._long.toSafe()) + public val SHORT: ClassId = ClassId.topLevel(StandardNames.FqNames._short.toSafe()) + public val BYTE: ClassId = ClassId.topLevel(StandardNames.FqNames._byte.toSafe()) + public val FLOAT: ClassId = ClassId.topLevel(StandardNames.FqNames._float.toSafe()) + public val DOUBLE: ClassId = ClassId.topLevel(StandardNames.FqNames._double.toSafe()) + public val CHAR: ClassId = ClassId.topLevel(StandardNames.FqNames._char.toSafe()) + public val BOOLEAN: ClassId = ClassId.topLevel(StandardNames.FqNames._boolean.toSafe()) + public val STRING: ClassId = ClassId.topLevel(StandardNames.FqNames.string.toSafe()) + public val CHAR_SEQUENCE: ClassId = ClassId.topLevel(StandardNames.FqNames.charSequence.toSafe()) + public val ANY: ClassId = ClassId.topLevel(StandardNames.FqNames.any.toSafe()) + public val NOTHING: ClassId = ClassId.topLevel(StandardNames.FqNames.nothing.toSafe()) + public val PRIMITIVES: Set = setOf(INT, LONG, SHORT, BYTE, FLOAT, DOUBLE, CHAR, BOOLEAN) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt index 55d2c02ed96..b98a2dc64e4 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtTypeProvider.kt @@ -10,18 +10,18 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtNamedClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.idea.frontend.api.types.KtTypeNullability -abstract class KtTypeProvider : KtAnalysisSessionComponent() { - abstract val builtinTypes: KtBuiltinTypes +public abstract class KtTypeProvider : KtAnalysisSessionComponent() { + public abstract val builtinTypes: KtBuiltinTypes - abstract fun approximateToSuperPublicDenotableType(type: KtType): KtType? + public abstract fun approximateToSuperPublicDenotableType(type: KtType): KtType? - abstract fun buildSelfClassType(symbol: KtNamedClassOrObjectSymbol): KtType + public abstract fun buildSelfClassType(symbol: KtNamedClassOrObjectSymbol): KtType - abstract fun withNullability(type: KtType, newNullability: KtTypeNullability): KtType + public abstract fun withNullability(type: KtType, newNullability: KtTypeNullability): KtType } -interface KtTypeProviderMixIn : KtAnalysisSessionMixIn { - val builtinTypes: KtBuiltinTypes +public interface KtTypeProviderMixIn : KtAnalysisSessionMixIn { + public val builtinTypes: KtBuiltinTypes get() = analysisSession.typeProvider.builtinTypes /** @@ -30,36 +30,36 @@ interface KtTypeProviderMixIn : KtAnalysisSessionMixIn { * Return `null` if the type do not need approximation and can be rendered as is * Otherwise, for type `T` return type `S` such `T <: S` and `T` and every it type argument is [org.jetbrains.kotlin.idea.frontend.api.types.KtDenotableType]` */ - fun KtType.approximateToSuperPublicDenotable(): KtType? = + public fun KtType.approximateToSuperPublicDenotable(): KtType? = analysisSession.typeProvider.approximateToSuperPublicDenotableType(this) - fun KtType.approximateToSuperPublicDenotableOrSelf(): KtType = approximateToSuperPublicDenotable() ?: this + public fun KtType.approximateToSuperPublicDenotableOrSelf(): KtType = approximateToSuperPublicDenotable() ?: this - fun KtNamedClassOrObjectSymbol.buildSelfClassType(): KtType = + public fun KtNamedClassOrObjectSymbol.buildSelfClassType(): KtType = analysisSession.typeProvider.buildSelfClassType(this) - fun KtType.withNullability(newNullability: KtTypeNullability): KtType = + public fun KtType.withNullability(newNullability: KtTypeNullability): KtType = analysisSession.typeProvider.withNullability(this, newNullability) } @Suppress("PropertyName") -abstract class KtBuiltinTypes : ValidityTokenOwner { - abstract val INT: KtType - abstract val LONG: KtType - abstract val SHORT: KtType - abstract val BYTE: KtType +public abstract class KtBuiltinTypes : ValidityTokenOwner { + public abstract val INT: KtType + public abstract val LONG: KtType + public abstract val SHORT: KtType + public abstract val BYTE: KtType - abstract val FLOAT: KtType - abstract val DOUBLE: KtType + public abstract val FLOAT: KtType + public abstract val DOUBLE: KtType - abstract val BOOLEAN: KtType - abstract val CHAR: KtType - abstract val STRING: KtType + public abstract val BOOLEAN: KtType + public abstract val CHAR: KtType + public abstract val STRING: KtType - abstract val UNIT: KtType - abstract val NOTHING: KtType - abstract val ANY: KtType + public abstract val UNIT: KtType + public abstract val NOTHING: KtType + public abstract val ANY: KtType - abstract val NULLABLE_ANY: KtType - abstract val NULLABLE_NOTHING: KtType + public abstract val NULLABLE_ANY: KtType + public abstract val NULLABLE_NOTHING: KtType } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtVisibilityCheckerMixIn.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtVisibilityCheckerMixIn.kt index 860e41b7b8b..542bd0bc2d5 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtVisibilityCheckerMixIn.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtVisibilityCheckerMixIn.kt @@ -10,8 +10,8 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFileSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility import org.jetbrains.kotlin.psi.KtExpression -abstract class KtVisibilityChecker : KtAnalysisSessionComponent() { - abstract fun isVisible( +public abstract class KtVisibilityChecker : KtAnalysisSessionComponent() { + public abstract fun isVisible( candidateSymbol: KtSymbolWithVisibility, useSiteFile: KtFileSymbol, position: PsiElement, @@ -19,8 +19,8 @@ abstract class KtVisibilityChecker : KtAnalysisSessionComponent() { ): Boolean } -interface KtVisibilityCheckerMixIn : KtAnalysisSessionMixIn { - fun isVisible( +public interface KtVisibilityCheckerMixIn : KtAnalysisSessionMixIn { + public fun isVisible( candidateSymbol: KtSymbolWithVisibility, useSiteFile: KtFileSymbol, receiverExpression: KtExpression? = null, diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt index fec1f712baa..e5f6a5294c4 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/diagnostics/KtDiagnostic.kt @@ -12,19 +12,19 @@ import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityToken import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import kotlin.reflect.KClass -interface KtDiagnostic : ValidityTokenOwner { - val severity: Severity - val factoryName: String? - val defaultMessage: String +public interface KtDiagnostic : ValidityTokenOwner { + public val severity: Severity + public val factoryName: String? + public val defaultMessage: String } -interface KtDiagnosticWithPsi : KtDiagnostic { - val psi: PSI - val textRanges: Collection - val diagnosticClass: KClass> +public interface KtDiagnosticWithPsi : KtDiagnostic { + public val psi: PSI + public val textRanges: Collection + public val diagnosticClass: KClass> } -class KtNonBoundToPsiErrorDiagnostic( +public class KtNonBoundToPsiErrorDiagnostic( override val factoryName: String?, override val defaultMessage: String, override val token: ValidityToken, @@ -32,6 +32,6 @@ class KtNonBoundToPsiErrorDiagnostic( override val severity: Severity get() = Severity.ERROR } -fun KtDiagnostic.getDefaultMessageWithFactoryName(): String = +public fun KtDiagnostic.getDefaultMessageWithFactoryName(): String = if (factoryName == null) defaultMessage else "[$factoryName] $defaultMessage" \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtImportingScope.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtImportingScope.kt index bffde8da369..0279ebca6e6 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtImportingScope.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtImportingScope.kt @@ -9,33 +9,33 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -interface KtImportingScope : KtScope { - val imports: List - val isDefaultImportingScope: Boolean +public interface KtImportingScope : KtScope { + public val imports: List + public val isDefaultImportingScope: Boolean } -interface KtStarImportingScope : KtImportingScope { +public interface KtStarImportingScope : KtImportingScope { override val imports: List } -interface KtNonStarImportingScope : KtImportingScope { +public interface KtNonStarImportingScope : KtImportingScope { override val imports: List } -sealed class Import { - abstract val packageFqName: FqName - abstract val relativeClassName: FqName? - abstract val resolvedClassId: ClassId? +public sealed class Import { + public abstract val packageFqName: FqName + public abstract val relativeClassName: FqName? + public abstract val resolvedClassId: ClassId? } -class NonStarImport( - override val packageFqName: FqName, +public class NonStarImport( + public override val packageFqName: FqName, override val relativeClassName: FqName?, override val resolvedClassId: ClassId?, - val callableName: Name?, + public val callableName: Name?, ) : Import() -class StarImport( +public class StarImport( override val packageFqName: FqName, override val relativeClassName: FqName?, override val resolvedClassId: ClassId?, diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt index 265b6a0f751..a8b3bb6e8b6 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/scopes/KtScope.kt @@ -14,12 +14,12 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -interface KtScope : ValidityTokenOwner { +public interface KtScope : ValidityTokenOwner { /** * Returns a **subset** of names which current scope may contain. * In other words `ALL_NAMES(scope)` is a subset of `scope.getAllNames()` */ - fun getAllPossibleNames(): Set = withValidityAssertion { + public fun getAllPossibleNames(): Set = withValidityAssertion { getPossibleCallableNames() + getPossibleClassifierNames() } @@ -27,19 +27,19 @@ interface KtScope : ValidityTokenOwner { * Returns a **subset** of callable names which current scope may contain. * In other words `ALL_CALLABLE_NAMES(scope)` is a subset of `scope.getCallableNames()` */ - fun getPossibleCallableNames(): Set + public fun getPossibleCallableNames(): Set /** * Returns a **subset** of classifier names which current scope may contain. * In other words `ALL_CLASSIFIER_NAMES(scope)` is a subset of `scope.getClassifierNames()` */ - fun getPossibleClassifierNames(): Set + public fun getPossibleClassifierNames(): Set /** * Return a sequence of all [KtSymbol] which current scope contain */ - fun getAllSymbols(): Sequence = withValidityAssertion { + public fun getAllSymbols(): Sequence = withValidityAssertion { sequence { yieldAll(getCallableSymbols()) yieldAll(getClassifierSymbols()) @@ -50,50 +50,50 @@ interface KtScope : ValidityTokenOwner { /** * Return a sequence of [KtCallableSymbol] which current scope contain if declaration name matches [nameFilter] */ - fun getCallableSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence + public fun getCallableSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence /** * Return a sequence of [KtClassifierSymbol] which current scope contain if declaration name matches [nameFilter] */ - fun getClassifierSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence + public fun getClassifierSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence /** * Return a sequence of [KtConstructorSymbol] which current scope contain */ - fun getConstructors(): Sequence + public fun getConstructors(): Sequence /** * return true if the scope may contain name, false otherwise. * * In other words `(mayContainName(name) == false) => (name !in scope)`; vice versa is not always true */ - fun mayContainName(name: Name): Boolean = withValidityAssertion { + public fun mayContainName(name: Name): Boolean = withValidityAssertion { name in getPossibleCallableNames() || name in getPossibleClassifierNames() } } -typealias KtScopeNameFilter = (Name) -> Boolean +public typealias KtScopeNameFilter = (Name) -> Boolean -interface KtCompositeScope : KtScope { - val subScopes: List +public interface KtCompositeScope : KtScope { + public val subScopes: List } -interface KtMemberScope : KtDeclarationScope { +public interface KtMemberScope : KtDeclarationScope { override val owner: KtSymbolWithMembers } -interface KtDeclaredMemberScope : KtDeclarationScope { +public interface KtDeclaredMemberScope : KtDeclarationScope { override val owner: KtSymbolWithMembers } -interface KtDeclarationScope : KtScope { - val owner: T +public interface KtDeclarationScope : KtScope { + public val owner: T } -interface KtPackageScope : KtScope { - val fqName: FqName +public interface KtPackageScope : KtScope { + public val fqName: FqName - fun getPackageSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence + public fun getPackageSymbols(nameFilter: KtScopeNameFilter = { true }): Sequence override fun getAllSymbols(): Sequence = withValidityAssertion { super.getAllSymbols() + getPackageSymbols() diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt index aa8864da373..15ce2c02392 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt @@ -15,8 +15,8 @@ import java.lang.reflect.InvocationTargetException import kotlin.reflect.KProperty import kotlin.reflect.jvm.javaGetter -object DebugSymbolRenderer { - fun render(symbol: KtSymbol): String = buildString { +public object DebugSymbolRenderer { + public fun render(symbol: KtSymbol): String = buildString { val klass = symbol::class appendLine("${klass.simpleName}:") klass.members.filterIsInstance>().sortedBy { it.name }.forEach { property -> diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtCallableSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtCallableSymbol.kt index db9a43401bb..e7f9a2d352e 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtCallableSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtCallableSymbol.kt @@ -10,12 +10,12 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtTypeAndAnnotatio import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.name.CallableId -abstract class KtCallableSymbol : KtSymbol, KtSymbolWithKind { - abstract val callableIdIfNonLocal: CallableId? - abstract val annotatedType: KtTypeAndAnnotations +public abstract class KtCallableSymbol : KtSymbol, KtSymbolWithKind { + public abstract val callableIdIfNonLocal: CallableId? + public abstract val annotatedType: KtTypeAndAnnotations - abstract val receiverType: KtTypeAndAnnotations? - abstract val isExtension: Boolean + public abstract val receiverType: KtTypeAndAnnotations? + public abstract val isExtension: Boolean abstract override fun createPointer(): KtSymbolPointer } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt index 2903f4192ba..f08c7ef820d 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtClassLikeSymbol.kt @@ -13,48 +13,48 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.types.Variance -sealed class KtClassifierSymbol : KtSymbol, KtPossiblyNamedSymbol +public sealed class KtClassifierSymbol : KtSymbol, KtPossiblyNamedSymbol -val KtClassifierSymbol.nameOrAnonymous: Name +public val KtClassifierSymbol.nameOrAnonymous: Name get() = name ?: SpecialNames.ANONYMOUS_FUNCTION -abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol { +public abstract class KtTypeParameterSymbol : KtClassifierSymbol(), KtNamedSymbol { abstract override fun createPointer(): KtSymbolPointer - abstract val upperBounds: List - abstract val variance: Variance - abstract val isReified: Boolean + public abstract val upperBounds: List + public abstract val variance: Variance + public abstract val isReified: Boolean } -sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtSymbolWithKind { - abstract val classIdIfNonLocal: ClassId? +public sealed class KtClassLikeSymbol : KtClassifierSymbol(), KtSymbolWithKind { + public abstract val classIdIfNonLocal: ClassId? abstract override fun createPointer(): KtSymbolPointer } -abstract class KtTypeAliasSymbol : KtClassLikeSymbol(), KtNamedSymbol { +public abstract class KtTypeAliasSymbol : KtClassLikeSymbol(), KtNamedSymbol { final override val symbolKind: KtSymbolKind get() = KtSymbolKind.TOP_LEVEL /** * Returns type from right-hand site of type alias * If type alias has type parameters, then those type parameters will be present in result type */ - abstract val expandedType: KtType + public abstract val expandedType: KtType abstract override fun createPointer(): KtSymbolPointer } -sealed class KtClassOrObjectSymbol : KtClassLikeSymbol(), +public sealed class KtClassOrObjectSymbol : KtClassLikeSymbol(), KtAnnotatedSymbol, KtSymbolWithMembers { - abstract val classKind: KtClassKind - abstract val superTypes: List + public abstract val classKind: KtClassKind + public abstract val superTypes: List abstract override fun createPointer(): KtSymbolPointer } -abstract class KtAnonymousObjectSymbol : KtClassOrObjectSymbol() { +public abstract class KtAnonymousObjectSymbol : KtClassOrObjectSymbol() { final override val classKind: KtClassKind get() = KtClassKind.ANONYMOUS_OBJECT final override val classIdIfNonLocal: ClassId? get() = null final override val symbolKind: KtSymbolKind get() = KtSymbolKind.LOCAL @@ -63,25 +63,25 @@ abstract class KtAnonymousObjectSymbol : KtClassOrObjectSymbol() { abstract override fun createPointer(): KtSymbolPointer } -abstract class KtNamedClassOrObjectSymbol : KtClassOrObjectSymbol(), +public abstract class KtNamedClassOrObjectSymbol : KtClassOrObjectSymbol(), KtSymbolWithTypeParameters, KtSymbolWithModality, KtSymbolWithVisibility, KtNamedSymbol { - abstract val isInner: Boolean - abstract val isData: Boolean - abstract val isInline: Boolean - abstract val isFun: Boolean + public abstract val isInner: Boolean + public abstract val isData: Boolean + public abstract val isInline: Boolean + public abstract val isFun: Boolean - abstract val isExternal: Boolean + public abstract val isExternal: Boolean - abstract val companionObject: KtNamedClassOrObjectSymbol? + public abstract val companionObject: KtNamedClassOrObjectSymbol? abstract override fun createPointer(): KtSymbolPointer } -enum class KtClassKind { +public enum class KtClassKind { CLASS, ENUM_CLASS, ENUM_ENTRY, @@ -91,5 +91,5 @@ enum class KtClassKind { INTERFACE, ANONYMOUS_OBJECT; - val isObject: Boolean get() = this == OBJECT || this == COMPANION_OBJECT || this == ANONYMOUS_OBJECT + public val isObject: Boolean get() = this == OBJECT || this == COMPANION_OBJECT || this == ANONYMOUS_OBJECT } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFileSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFileSymbol.kt index ecc70c37c8b..749441fb276 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFileSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFileSymbol.kt @@ -8,6 +8,6 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtAnnotatedSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer -abstract class KtFileSymbol : KtAnnotatedSymbol { +public abstract class KtFileSymbol : KtAnnotatedSymbol { abstract override fun createPointer(): KtSymbolPointer } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFunctionLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFunctionLikeSymbol.kt index d8466c21404..2adda3ace1f 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFunctionLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtFunctionLikeSymbol.kt @@ -11,20 +11,20 @@ import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName -abstract class KtFunctionLikeSymbol : KtCallableSymbol(), KtSymbolWithKind { - abstract val valueParameters: List +public abstract class KtFunctionLikeSymbol : KtCallableSymbol(), KtSymbolWithKind { + public abstract val valueParameters: List abstract override fun createPointer(): KtSymbolPointer } -abstract class KtAnonymousFunctionSymbol : KtFunctionLikeSymbol() { +public abstract class KtAnonymousFunctionSymbol : KtFunctionLikeSymbol() { final override val symbolKind: KtSymbolKind get() = KtSymbolKind.LOCAL final override val callableIdIfNonLocal: CallableId? get() = null abstract override fun createPointer(): KtSymbolPointer } -abstract class KtFunctionSymbol : KtFunctionLikeSymbol(), +public abstract class KtFunctionSymbol : KtFunctionLikeSymbol(), KtNamedSymbol, KtPossibleMemberSymbol, KtSymbolWithTypeParameters, @@ -32,24 +32,24 @@ abstract class KtFunctionSymbol : KtFunctionLikeSymbol(), KtSymbolWithVisibility, KtAnnotatedSymbol { - abstract val isSuspend: Boolean - abstract val isOperator: Boolean - abstract val isExternal: Boolean - abstract val isInline: Boolean - abstract val isOverride: Boolean - abstract val isInfix: Boolean - abstract val isStatic: Boolean + public abstract val isSuspend: Boolean + public abstract val isOperator: Boolean + public abstract val isExternal: Boolean + public abstract val isInline: Boolean + public abstract val isOverride: Boolean + public abstract val isInfix: Boolean + public abstract val isStatic: Boolean abstract override fun createPointer(): KtSymbolPointer } -abstract class KtConstructorSymbol : KtFunctionLikeSymbol(), +public abstract class KtConstructorSymbol : KtFunctionLikeSymbol(), KtPossibleMemberSymbol, KtAnnotatedSymbol, KtSymbolWithVisibility, KtSymbolWithTypeParameters { - abstract val isPrimary: Boolean - abstract val containingClassIdIfNonLocal: ClassId? + public abstract val isPrimary: Boolean + public abstract val containingClassIdIfNonLocal: ClassId? final override val callableIdIfNonLocal: CallableId? get() = null final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtIconProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtIconProvider.kt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPackageSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPackageSymbol.kt index eb65ae2de76..823b5e49f53 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPackageSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPackageSymbol.kt @@ -8,8 +8,8 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.name.FqName -abstract class KtPackageSymbol : KtSymbol { - abstract val fqName: FqName +public abstract class KtPackageSymbol : KtSymbol { + public abstract val fqName: FqName abstract override fun createPointer(): KtSymbolPointer } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt index 05d466c4592..7ce31e97383 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtPropertyAccessorSymbol.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.name.CallableId -sealed class KtPropertyAccessorSymbol : KtCallableSymbol(), +public sealed class KtPropertyAccessorSymbol : KtCallableSymbol(), KtPossibleMemberSymbol, KtSymbolWithModality, KtSymbolWithVisibility, @@ -20,22 +20,22 @@ sealed class KtPropertyAccessorSymbol : KtCallableSymbol(), final override val isExtension: Boolean get() = false final override val receiverType: KtTypeAndAnnotations? get() = null - abstract val isDefault: Boolean - abstract val isInline: Boolean - abstract val isOverride: Boolean - abstract val hasBody: Boolean + public abstract val isDefault: Boolean + public abstract val isInline: Boolean + public abstract val isOverride: Boolean + public abstract val hasBody: Boolean final override val symbolKind: KtSymbolKind get() = KtSymbolKind.ACCESSOR abstract override fun createPointer(): KtSymbolPointer } -abstract class KtPropertyGetterSymbol : KtPropertyAccessorSymbol() { +public abstract class KtPropertyGetterSymbol : KtPropertyAccessorSymbol() { abstract override fun createPointer(): KtSymbolPointer } -abstract class KtPropertySetterSymbol : KtPropertyAccessorSymbol() { - abstract val parameter: KtValueParameterSymbol +public abstract class KtPropertySetterSymbol : KtPropertyAccessorSymbol() { + public abstract val parameter: KtValueParameterSymbol abstract override fun createPointer(): KtSymbolPointer } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbol.kt index b77a0d5ac19..4a35de9445f 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbol.kt @@ -9,8 +9,8 @@ import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer -interface KtSymbol : ValidityTokenOwner { - val origin: KtSymbolOrigin +public interface KtSymbol : ValidityTokenOwner { + public val origin: KtSymbolOrigin /** * [PsiElement] which corresponds to given [KtSymbol] @@ -19,9 +19,9 @@ interface KtSymbol : ValidityTokenOwner { * * For [KtSymbolOrigin.LIBRARY] the generated by Kotlin class file source element is returned */ - val psi: PsiElement? + public val psi: PsiElement? - fun createPointer(): KtSymbolPointer + public fun createPointer(): KtSymbolPointer } /** @@ -29,7 +29,7 @@ interface KtSymbol : ValidityTokenOwner { * * @see KtSymbol.psi */ -inline fun KtSymbol.psi(): PSI = +public inline fun KtSymbol.psi(): PSI = psi as PSI /** @@ -37,13 +37,13 @@ inline fun KtSymbol.psi(): PSI = * * @see KtSymbol.psi */ -inline fun KtSymbol.psiSafe(): PSI? = +public inline fun KtSymbol.psiSafe(): PSI? = psi as? PSI /** * A place where [KtSymbol] came from */ -enum class KtSymbolOrigin { +public enum class KtSymbolOrigin { /** * Declaration from Kotlin sources */ diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt index 6ebd9fada31..4402477562b 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtSymbolProvider.kt @@ -12,8 +12,8 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* -abstract class KtSymbolProvider : KtAnalysisSessionComponent() { - open fun getSymbol(psi: KtDeclaration): KtSymbol = when (psi) { +public abstract class KtSymbolProvider : KtAnalysisSessionComponent() { + public open fun getSymbol(psi: KtDeclaration): KtSymbol = when (psi) { is KtParameter -> getParameterSymbol(psi) is KtNamedFunction -> getFunctionLikeSymbol(psi) is KtConstructor<*> -> getConstructorSymbol(psi) @@ -30,34 +30,34 @@ abstract class KtSymbolProvider : KtAnalysisSessionComponent() { else -> error("Cannot build symbol for ${psi::class}") } - abstract fun getParameterSymbol(psi: KtParameter): KtValueParameterSymbol - abstract fun getFileSymbol(psi: KtFile): KtFileSymbol - abstract fun getFunctionLikeSymbol(psi: KtNamedFunction): KtFunctionLikeSymbol - abstract fun getConstructorSymbol(psi: KtConstructor<*>): KtConstructorSymbol - abstract fun getTypeParameterSymbol(psi: KtTypeParameter): KtTypeParameterSymbol - abstract fun getTypeAliasSymbol(psi: KtTypeAlias): KtTypeAliasSymbol - abstract fun getEnumEntrySymbol(psi: KtEnumEntry): KtEnumEntrySymbol - abstract fun getAnonymousFunctionSymbol(psi: KtNamedFunction): KtAnonymousFunctionSymbol - abstract fun getAnonymousFunctionSymbol(psi: KtFunctionLiteral): KtAnonymousFunctionSymbol - abstract fun getVariableSymbol(psi: KtProperty): KtVariableSymbol - abstract fun getAnonymousObjectSymbol(psi: KtObjectLiteralExpression): KtAnonymousObjectSymbol - abstract fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol - abstract fun getNamedClassOrObjectSymbol(psi: KtClassOrObject): KtNamedClassOrObjectSymbol - abstract fun getPropertyAccessorSymbol(psi: KtPropertyAccessor): KtPropertyAccessorSymbol + public abstract fun getParameterSymbol(psi: KtParameter): KtValueParameterSymbol + public abstract fun getFileSymbol(psi: KtFile): KtFileSymbol + public abstract fun getFunctionLikeSymbol(psi: KtNamedFunction): KtFunctionLikeSymbol + public abstract fun getConstructorSymbol(psi: KtConstructor<*>): KtConstructorSymbol + public abstract fun getTypeParameterSymbol(psi: KtTypeParameter): KtTypeParameterSymbol + public abstract fun getTypeAliasSymbol(psi: KtTypeAlias): KtTypeAliasSymbol + public abstract fun getEnumEntrySymbol(psi: KtEnumEntry): KtEnumEntrySymbol + public abstract fun getAnonymousFunctionSymbol(psi: KtNamedFunction): KtAnonymousFunctionSymbol + public abstract fun getAnonymousFunctionSymbol(psi: KtFunctionLiteral): KtAnonymousFunctionSymbol + public abstract fun getVariableSymbol(psi: KtProperty): KtVariableSymbol + public abstract fun getAnonymousObjectSymbol(psi: KtObjectLiteralExpression): KtAnonymousObjectSymbol + public abstract fun getClassOrObjectSymbol(psi: KtClassOrObject): KtClassOrObjectSymbol + public abstract fun getNamedClassOrObjectSymbol(psi: KtClassOrObject): KtNamedClassOrObjectSymbol + public abstract fun getPropertyAccessorSymbol(psi: KtPropertyAccessor): KtPropertyAccessorSymbol - abstract fun getClassOrObjectSymbolByClassId(classId: ClassId): KtClassOrObjectSymbol? + public abstract fun getClassOrObjectSymbolByClassId(classId: ClassId): KtClassOrObjectSymbol? - abstract fun getTopLevelCallableSymbols(packageFqName: FqName, name: Name): Sequence + public abstract fun getTopLevelCallableSymbols(packageFqName: FqName, name: Name): Sequence @Suppress("PropertyName") - abstract val ROOT_PACKAGE_SYMBOL: KtPackageSymbol + public abstract val ROOT_PACKAGE_SYMBOL: KtPackageSymbol } -interface KtSymbolProviderMixIn : KtAnalysisSessionMixIn { - fun KtDeclaration.getSymbol(): KtSymbol = +public interface KtSymbolProviderMixIn : KtAnalysisSessionMixIn { + public fun KtDeclaration.getSymbol(): KtSymbol = analysisSession.symbolProvider.getSymbol(this) - fun KtParameter.getParameterSymbol(): KtValueParameterSymbol = + public fun KtParameter.getParameterSymbol(): KtValueParameterSymbol = analysisSession.symbolProvider.getParameterSymbol(this) /** @@ -66,55 +66,55 @@ interface KtSymbolProviderMixIn : KtAnalysisSessionMixIn { * If [KtNamedFunction.getName] is `null` then returns [KtAnonymousFunctionSymbol] * Otherwise, returns [KtFunctionSymbol] */ - fun KtNamedFunction.getFunctionLikeSymbol(): KtFunctionLikeSymbol = + public fun KtNamedFunction.getFunctionLikeSymbol(): KtFunctionLikeSymbol = analysisSession.symbolProvider.getFunctionLikeSymbol(this) - fun KtConstructor<*>.getConstructorSymbol(): KtConstructorSymbol = + public fun KtConstructor<*>.getConstructorSymbol(): KtConstructorSymbol = analysisSession.symbolProvider.getConstructorSymbol(this) - fun KtTypeParameter.getTypeParameterSymbol(): KtTypeParameterSymbol = + public fun KtTypeParameter.getTypeParameterSymbol(): KtTypeParameterSymbol = analysisSession.symbolProvider.getTypeParameterSymbol(this) - fun KtTypeAlias.getTypeAliasSymbol(): KtTypeAliasSymbol = + public fun KtTypeAlias.getTypeAliasSymbol(): KtTypeAliasSymbol = analysisSession.symbolProvider.getTypeAliasSymbol(this) - fun KtEnumEntry.getEnumEntrySymbol(): KtEnumEntrySymbol = + public fun KtEnumEntry.getEnumEntrySymbol(): KtEnumEntrySymbol = analysisSession.symbolProvider.getEnumEntrySymbol(this) - fun KtNamedFunction.getAnonymousFunctionSymbol(): KtAnonymousFunctionSymbol = + public fun KtNamedFunction.getAnonymousFunctionSymbol(): KtAnonymousFunctionSymbol = analysisSession.symbolProvider.getAnonymousFunctionSymbol(this) - fun KtFunctionLiteral.getAnonymousFunctionSymbol(): KtAnonymousFunctionSymbol = + public fun KtFunctionLiteral.getAnonymousFunctionSymbol(): KtAnonymousFunctionSymbol = analysisSession.symbolProvider.getAnonymousFunctionSymbol(this) - fun KtProperty.getVariableSymbol(): KtVariableSymbol = + public fun KtProperty.getVariableSymbol(): KtVariableSymbol = analysisSession.symbolProvider.getVariableSymbol(this) - fun KtObjectLiteralExpression.getAnonymousObjectSymbol(): KtAnonymousObjectSymbol = + public fun KtObjectLiteralExpression.getAnonymousObjectSymbol(): KtAnonymousObjectSymbol = analysisSession.symbolProvider.getAnonymousObjectSymbol(this) - fun KtClassOrObject.getClassOrObjectSymbol(): KtClassOrObjectSymbol = + public fun KtClassOrObject.getClassOrObjectSymbol(): KtClassOrObjectSymbol = analysisSession.symbolProvider.getClassOrObjectSymbol(this) - fun KtClassOrObject.getNamedClassOrObjectSymbol(): KtNamedClassOrObjectSymbol = + public fun KtClassOrObject.getNamedClassOrObjectSymbol(): KtNamedClassOrObjectSymbol = analysisSession.symbolProvider.getNamedClassOrObjectSymbol(this) - fun KtPropertyAccessor.getPropertyAccessorSymbol(): KtPropertyAccessorSymbol = + public fun KtPropertyAccessor.getPropertyAccessorSymbol(): KtPropertyAccessorSymbol = analysisSession.symbolProvider.getPropertyAccessorSymbol(this) - fun KtFile.getFileSymbol(): KtFileSymbol = + public fun KtFile.getFileSymbol(): KtFileSymbol = analysisSession.symbolProvider.getFileSymbol(this) /** * @return symbol with specified [this@getClassOrObjectSymbolByClassId] or `null` in case such symbol is not found */ - fun ClassId.getCorrespondingToplevelClassOrObjectSymbol(): KtClassOrObjectSymbol? = + public fun ClassId.getCorrespondingToplevelClassOrObjectSymbol(): KtClassOrObjectSymbol? = analysisSession.symbolProvider.getClassOrObjectSymbolByClassId(this) - fun FqName.getContainingCallableSymbolsWithName(name: Name): Sequence = + public fun FqName.getContainingCallableSymbolsWithName(name: Name): Sequence = analysisSession.symbolProvider.getTopLevelCallableSymbols(this, name) @Suppress("PropertyName") - val ROOT_PACKAGE_SYMBOL: KtPackageSymbol + public val ROOT_PACKAGE_SYMBOL: KtPackageSymbol get() = analysisSession.symbolProvider.ROOT_PACKAGE_SYMBOL } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt index ba17fa897c9..03eb7d79919 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/KtVariableLikeSymbol.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtNamedSymbol, KtSymbolWithKind { +public sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtNamedSymbol, KtSymbolWithKind { abstract override fun createPointer(): KtSymbolPointer } @@ -28,8 +28,8 @@ sealed class KtVariableLikeSymbol : KtCallableSymbol(), KtNamedSymbol, KtSymbolW * * Symbol at caret will be resolved to a [KtBackingFieldSymbol] */ -abstract class KtBackingFieldSymbol : KtVariableLikeSymbol() { - abstract val owningProperty: KtKotlinPropertySymbol +public abstract class KtBackingFieldSymbol : KtVariableLikeSymbol() { + public abstract val owningProperty: KtKotlinPropertySymbol final override val name: Name get() = fieldName final override val psi: PsiElement? get() = null @@ -41,29 +41,29 @@ abstract class KtBackingFieldSymbol : KtVariableLikeSymbol() { abstract override fun createPointer(): KtSymbolPointer - companion object { + public companion object { private val fieldName = Name.identifier("field") } } -abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithMembers, KtSymbolWithKind { +public abstract class KtEnumEntrySymbol : KtVariableLikeSymbol(), KtSymbolWithMembers, KtSymbolWithKind { final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER final override val isExtension: Boolean get() = false final override val receiverType: KtTypeAndAnnotations? get() = null - abstract val containingEnumClassIdIfNonLocal: ClassId? + public abstract val containingEnumClassIdIfNonLocal: ClassId? abstract override fun createPointer(): KtSymbolPointer } -sealed class KtVariableSymbol : KtVariableLikeSymbol() { - abstract val isVal: Boolean +public sealed class KtVariableSymbol : KtVariableLikeSymbol() { + public abstract val isVal: Boolean abstract override fun createPointer(): KtSymbolPointer } -abstract class KtJavaFieldSymbol : +public abstract class KtJavaFieldSymbol : KtVariableSymbol(), KtSymbolWithModality, KtSymbolWithVisibility, @@ -71,56 +71,56 @@ abstract class KtJavaFieldSymbol : final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER final override val isExtension: Boolean get() = false final override val receiverType: KtTypeAndAnnotations? get() = null - abstract val isStatic: Boolean + public abstract val isStatic: Boolean abstract override fun createPointer(): KtSymbolPointer } -sealed class KtPropertySymbol : KtVariableSymbol(), +public sealed class KtPropertySymbol : KtVariableSymbol(), KtPossibleMemberSymbol, KtSymbolWithModality, KtSymbolWithVisibility, KtAnnotatedSymbol, KtSymbolWithKind { - abstract val hasGetter: Boolean - abstract val hasSetter: Boolean + public abstract val hasGetter: Boolean + public abstract val hasSetter: Boolean - abstract val getter: KtPropertyGetterSymbol? - abstract val setter: KtPropertySetterSymbol? + public abstract val getter: KtPropertyGetterSymbol? + public abstract val setter: KtPropertySetterSymbol? - abstract val hasBackingField: Boolean + public abstract val hasBackingField: Boolean - abstract val isOverride: Boolean - abstract val isStatic: Boolean + public abstract val isOverride: Boolean + public abstract val isStatic: Boolean - abstract val initializer: KtConstantValue? + public abstract val initializer: KtConstantValue? abstract override fun createPointer(): KtSymbolPointer } -abstract class KtKotlinPropertySymbol : KtPropertySymbol() { - abstract val isLateInit: Boolean +public abstract class KtKotlinPropertySymbol : KtPropertySymbol() { + public abstract val isLateInit: Boolean - abstract val isConst: Boolean + public abstract val isConst: Boolean abstract override fun createPointer(): KtSymbolPointer } -abstract class KtSyntheticJavaPropertySymbol : KtPropertySymbol() { +public abstract class KtSyntheticJavaPropertySymbol : KtPropertySymbol() { final override val hasBackingField: Boolean get() = true final override val hasGetter: Boolean get() = true final override val symbolKind: KtSymbolKind get() = KtSymbolKind.MEMBER abstract override val getter: KtPropertyGetterSymbol - abstract val javaGetterName: Name - abstract val javaSetterName: Name? + public abstract val javaGetterName: Name + public abstract val javaSetterName: Name? abstract override fun createPointer(): KtSymbolPointer } -abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKind { +public abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKind { final override val callableIdIfNonLocal: CallableId? get() = null final override val isExtension: Boolean get() = false final override val receiverType: KtTypeAndAnnotations? get() = null @@ -128,14 +128,14 @@ abstract class KtLocalVariableSymbol : KtVariableSymbol(), KtSymbolWithKind { abstract override fun createPointer(): KtSymbolPointer } -abstract class KtValueParameterSymbol : KtVariableLikeSymbol(), KtSymbolWithKind, KtAnnotatedSymbol { +public abstract class KtValueParameterSymbol : KtVariableLikeSymbol(), KtSymbolWithKind, KtAnnotatedSymbol { final override val symbolKind: KtSymbolKind get() = KtSymbolKind.LOCAL final override val callableIdIfNonLocal: CallableId? get() = null final override val isExtension: Boolean get() = false final override val receiverType: KtTypeAndAnnotations? get() = null - abstract val hasDefaultValue: Boolean - abstract val isVararg: Boolean + public abstract val hasDefaultValue: Boolean + public abstract val isVararg: Boolean abstract override fun createPointer(): KtSymbolPointer } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt index 5427905d3ad..dd292581201 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtAnnotatedSymbol.kt @@ -11,18 +11,18 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.psi.KtCallElement -abstract class KtAnnotationCall : ValidityTokenOwner { - abstract val classId: ClassId? - abstract val useSiteTarget: AnnotationUseSiteTarget? - abstract val psi: KtCallElement? - abstract val arguments: List +public abstract class KtAnnotationCall : ValidityTokenOwner { + public abstract val classId: ClassId? + public abstract val useSiteTarget: AnnotationUseSiteTarget? + public abstract val psi: KtCallElement? + public abstract val arguments: List } -data class KtNamedConstantValue(val name: String, val expression: KtConstantValue) +public data class KtNamedConstantValue(val name: String, val expression: KtConstantValue) -interface KtAnnotatedSymbol : KtSymbol { - val annotations: List +public interface KtAnnotatedSymbol : KtSymbol { + public val annotations: List - fun containsAnnotation(classId: ClassId): Boolean - val annotationClassIds: Collection + public fun containsAnnotation(classId: ClassId): Boolean + public val annotationClassIds: Collection } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt index c034ad68ac5..68c47c84646 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtConstantValue.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.markers import org.jetbrains.kotlin.types.ConstantValueKind -sealed class KtConstantValue -object KtUnsupportedConstantValue : KtConstantValue() +public sealed class KtConstantValue +public object KtUnsupportedConstantValue : KtConstantValue() -data class KtSimpleConstantValue(val constantValueKind: ConstantValueKind, val value: T) : KtConstantValue() \ No newline at end of file +public data class KtSimpleConstantValue(val constantValueKind: ConstantValueKind, val value: T) : KtConstantValue() \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtPossibleMemberSymbol.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtPossibleMemberSymbol.kt index 75831e5e188..04263d64d2f 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtPossibleMemberSymbol.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtPossibleMemberSymbol.kt @@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.markers import org.jetbrains.kotlin.idea.frontend.api.types.KtType -interface KtPossibleMemberSymbol { - val dispatchType: KtType? +public interface KtPossibleMemberSymbol { + public val dispatchType: KtType? } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithKind.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithKind.kt index 3f234e5f034..63a2bc82102 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithKind.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithKind.kt @@ -10,11 +10,11 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName -interface KtSymbolWithKind : KtSymbol { - val symbolKind: KtSymbolKind +public interface KtSymbolWithKind : KtSymbol { + public val symbolKind: KtSymbolKind } -enum class KtSymbolKind { +public enum class KtSymbolKind { TOP_LEVEL, MEMBER, LOCAL, ACCESSOR } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithMembers.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithMembers.kt index 38bb73b26ae..c58374bb367 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithMembers.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithMembers.kt @@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.markers import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol -interface KtSymbolWithMembers : KtSymbolWithDeclarations +public interface KtSymbolWithMembers : KtSymbolWithDeclarations -interface KtSymbolWithDeclarations : KtSymbol \ No newline at end of file +public interface KtSymbolWithDeclarations : KtSymbol \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt index 45f59c4cc2f..9386da0d82b 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithModality.kt @@ -7,6 +7,6 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.markers import org.jetbrains.kotlin.descriptors.Modality -interface KtSymbolWithModality { - val modality: Modality +public interface KtSymbolWithModality { + public val modality: Modality } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt index a9ee1480c39..64e292c5704 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtSymbolWithVisibility.kt @@ -8,10 +8,10 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.markers import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibility -interface KtSymbolWithVisibility { - val visibility: Visibility +public interface KtSymbolWithVisibility { + public val visibility: Visibility } -fun Visibility.isPrivateOrPrivateToThis(): Boolean = +public fun Visibility.isPrivateOrPrivateToThis(): Boolean = this == Visibilities.Private || this == Visibilities.PrivateToThis \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtTypeAndAnnotations.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtTypeAndAnnotations.kt index f2cd32de397..693e69f51ce 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtTypeAndAnnotations.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/KtTypeAndAnnotations.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtType -abstract class KtTypeAndAnnotations : ValidityTokenOwner { - abstract val type: KtType - abstract val annotations: List +public abstract class KtTypeAndAnnotations : ValidityTokenOwner { + public abstract val type: KtType + public abstract val annotations: List } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/markers.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/markers.kt index 2e8d0dbd1d3..aeb06caf966 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/markers.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/markers/markers.kt @@ -10,14 +10,14 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtType import org.jetbrains.kotlin.name.Name -interface KtPossiblyNamedSymbol : KtSymbol { - val name: Name? +public interface KtPossiblyNamedSymbol : KtSymbol { + public val name: Name? } -interface KtNamedSymbol : KtPossiblyNamedSymbol { - abstract override val name: Name +public interface KtNamedSymbol : KtPossiblyNamedSymbol { + override val name: Name } -interface KtSymbolWithTypeParameters { - val typeParameters: List +public interface KtSymbolWithTypeParameters { + public val typeParameters: List } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/CouldNotCreateSymbolPointerException.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/CouldNotCreateSymbolPointerException.kt index d9d4e504e0b..2ef65de5db6 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/CouldNotCreateSymbolPointerException.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/CouldNotCreateSymbolPointerException.kt @@ -5,5 +5,5 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols.pointers -class CanNotCreateSymbolPointerForLocalLibraryDeclarationException(description: String) : +public class CanNotCreateSymbolPointerForLocalLibraryDeclarationException(description: String) : IllegalStateException("Could not create a symbol pointer for local symbol $description") \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtPsiBasedSymbolPointer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtPsiBasedSymbolPointer.kt index 89196c6f6f2..58c648217bf 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtPsiBasedSymbolPointer.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtPsiBasedSymbolPointer.kt @@ -13,7 +13,8 @@ import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtObjectLiteralExpression import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer -class KtPsiBasedSymbolPointer(private val psiPointer: SmartPsiElementPointer) : KtSymbolPointer() { +public class KtPsiBasedSymbolPointer(private val psiPointer: SmartPsiElementPointer) : + KtSymbolPointer() { override fun restoreSymbol(analysisSession: KtAnalysisSession): S? { val psi = psiPointer.element ?: return null @@ -21,10 +22,10 @@ class KtPsiBasedSymbolPointer(private val psiPointer: SmartPsiElem return with(analysisSession) { psi.getSymbol() } as S? } - companion object { - fun createForSymbolFromSource(symbol: S): KtPsiBasedSymbolPointer? { + public companion object { + public fun createForSymbolFromSource(symbol: S): KtPsiBasedSymbolPointer? { if (symbol.origin == KtSymbolOrigin.LIBRARY) return null - val psi = when(val psi = symbol.psi) { + val psi = when (val psi = symbol.psi) { is KtDeclaration -> psi is KtObjectLiteralExpression -> psi.objectDeclaration else -> null diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtSymbolPointer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtSymbolPointer.kt index c7bf5c01885..88805da9a6c 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtSymbolPointer.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/pointers/KtSymbolPointer.kt @@ -23,16 +23,17 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol * * @see org.jetbrains.kotlin.idea.frontend.api.ReadActionConfinementValidityToken */ -abstract class KtSymbolPointer { +public abstract class KtSymbolPointer { /** * @return restored symbol (possibly the new symbol instance) if one is still valid, `null` otherwise * * Consider using [org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol] */ @Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol") - abstract fun restoreSymbol(analysisSession: KtAnalysisSession): S? + public abstract fun restoreSymbol(analysisSession: KtAnalysisSession): S? } -inline fun symbolPointer(crossinline getSymbol: (KtAnalysisSession) -> S?) = object : KtSymbolPointer() { - override fun restoreSymbol(analysisSession: KtAnalysisSession): S? = getSymbol(analysisSession) -} \ No newline at end of file +public inline fun symbolPointer(crossinline getSymbol: (KtAnalysisSession) -> S?): KtSymbolPointer = + object : KtSymbolPointer() { + override fun restoreSymbol(analysisSession: KtAnalysisSession): S? = getSymbol(analysisSession) + } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/AlwaysAccessibleValidityToken.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/AlwaysAccessibleValidityToken.kt index 19711df7bd2..d1a6fb6e3a7 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/AlwaysAccessibleValidityToken.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/AlwaysAccessibleValidityToken.kt @@ -9,7 +9,7 @@ import com.intellij.openapi.project.Project import org.jetbrains.kotlin.idea.fir.low.level.api.api.createProjectWideOutOfBlockModificationTracker import kotlin.reflect.KClass -class AlwaysAccessibleValidityToken(project: Project) : ValidityToken() { +public class AlwaysAccessibleValidityToken(project: Project) : ValidityToken() { private val modificationTracker = project.createProjectWideOutOfBlockModificationTracker() private val onCreatedTimeStamp = modificationTracker.modificationCount @@ -31,7 +31,7 @@ class AlwaysAccessibleValidityToken(project: Project) : ValidityToken() { } } -object AlwaysAccessibleValidityTokenFactory : ValidityTokenFactory() { +public object AlwaysAccessibleValidityTokenFactory : ValidityTokenFactory() { override val identifier: KClass = AlwaysAccessibleValidityToken::class override fun create(project: Project): ValidityToken = diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ReadActionConfinementValidityToken.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ReadActionConfinementValidityToken.kt index ae5fd29e5d5..1a927f814a5 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ReadActionConfinementValidityToken.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ReadActionConfinementValidityToken.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.api.createProjectWideOutOfBlo import org.jetbrains.kotlin.idea.frontend.api.* import kotlin.reflect.KClass -class ReadActionConfinementValidityToken(project: Project) : ValidityToken() { +public class ReadActionConfinementValidityToken(project: Project) : ValidityToken() { private val modificationTracker = project.createProjectWideOutOfBlockModificationTracker() private val onCreatedTimeStamp = modificationTracker.modificationCount @@ -48,13 +48,13 @@ class ReadActionConfinementValidityToken(project: Project) : ValidityToken() { } - companion object { + public companion object { @HackToForceAllowRunningAnalyzeOnEDT - val allowOnEdt: ThreadLocal = ThreadLocal.withInitial { false } + public val allowOnEdt: ThreadLocal = ThreadLocal.withInitial { false } } } -object ReadActionConfinementValidityTokenFactory : ValidityTokenFactory() { +public object ReadActionConfinementValidityTokenFactory : ValidityTokenFactory() { override val identifier: KClass = ReadActionConfinementValidityToken::class override fun create(project: Project): ValidityToken = ReadActionConfinementValidityToken(project) @@ -73,7 +73,7 @@ object ReadActionConfinementValidityTokenFactory : ValidityTokenFactory() { } @RequiresOptIn("All frontend related work should not be allowed to be ran from EDT thread. Only use it as a temporary solution") -annotation class HackToForceAllowRunningAnalyzeOnEDT +public annotation class HackToForceAllowRunningAnalyzeOnEDT /** * All frontend related work should not be allowed to be ran from EDT thread. Only use it as a temporary solution. @@ -82,7 +82,7 @@ annotation class HackToForceAllowRunningAnalyzeOnEDT * @see ReadActionConfinementValidityToken */ @HackToForceAllowRunningAnalyzeOnEDT -inline fun hackyAllowRunningOnEdt(action: () -> T): T { +public inline fun hackyAllowRunningOnEdt(action: () -> T): T { if (ReadActionConfinementValidityToken.allowOnEdt.get()) return action() ReadActionConfinementValidityToken.allowOnEdt.set(true) try { diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ValidityToken.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ValidityToken.kt index 282b58c0301..6f9e3b4fb51 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ValidityToken.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/tokens/ValidityToken.kt @@ -8,25 +8,25 @@ package org.jetbrains.kotlin.idea.frontend.api.tokens import com.intellij.openapi.project.Project import kotlin.reflect.KClass -abstract class ValidityToken { - abstract fun isValid(): Boolean - abstract fun getInvalidationReason(): String +public abstract class ValidityToken { + public abstract fun isValid(): Boolean + public abstract fun getInvalidationReason(): String - abstract fun isAccessible(): Boolean - abstract fun getInaccessibilityReason(): String + public abstract fun isAccessible(): Boolean + public abstract fun getInaccessibilityReason(): String } -abstract class ValidityTokenFactory { - abstract val identifier: KClass - abstract fun create(project: Project): ValidityToken +public abstract class ValidityTokenFactory { + public abstract val identifier: KClass + public abstract fun create(project: Project): ValidityToken - open fun beforeEnteringAnalysisContext() {} - open fun afterLeavingAnalysisContext() {} + public open fun beforeEnteringAnalysisContext() {} + public open fun afterLeavingAnalysisContext() {} } @Suppress("NOTHING_TO_INLINE") -inline fun ValidityToken.assertIsValidAndAccessible() { +public inline fun ValidityToken.assertIsValidAndAccessible() { if (!isValid()) { throw InvalidEntityAccessException("Access to invalid $this: ${getInvalidationReason()}") } @@ -35,8 +35,8 @@ inline fun ValidityToken.assertIsValidAndAccessible() { } } -abstract class BadEntityAccessException() : IllegalStateException() +public abstract class BadEntityAccessException() : IllegalStateException() -class InvalidEntityAccessException(override val message: String) : BadEntityAccessException() -class InaccessibleEntityAccessException(override val message: String) : BadEntityAccessException() +public class InvalidEntityAccessException(override val message: String) : BadEntityAccessException() +public class InaccessibleEntityAccessException(override val message: String) : BadEntityAccessException() diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt index 4c95c56b35a..c8c3fa8501b 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtType.kt @@ -12,73 +12,73 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtTypeParameterSymbol import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.Name -sealed interface KtType : ValidityTokenOwner { - fun asStringForDebugging(): String +public sealed interface KtType : ValidityTokenOwner { + public fun asStringForDebugging(): String } -interface KtTypeWithNullability : KtType { - val nullability: KtTypeNullability +public interface KtTypeWithNullability : KtType { + public val nullability: KtTypeNullability } -enum class KtTypeNullability(val isNullable: Boolean) { +public enum class KtTypeNullability(public val isNullable: Boolean) { NULLABLE(true), NON_NULLABLE(false); - companion object { - fun create(isNullable: Boolean) = if (isNullable) NULLABLE else NON_NULLABLE + public companion object { + public fun create(isNullable: Boolean): KtTypeNullability = if (isNullable) NULLABLE else NON_NULLABLE } } -sealed class KtClassType : KtType { +public sealed class KtClassType : KtType { override fun toString(): String = asStringForDebugging() } -sealed class KtNonErrorClassType : KtClassType(), KtTypeWithNullability { - abstract val classId: ClassId - abstract val classSymbol: KtClassLikeSymbol - abstract val typeArguments: List +public sealed class KtNonErrorClassType : KtClassType(), KtTypeWithNullability { + public abstract val classId: ClassId + public abstract val classSymbol: KtClassLikeSymbol + public abstract val typeArguments: List } -abstract class KtFunctionalType : KtNonErrorClassType() { - abstract val isSuspend: Boolean - abstract val arity: Int - abstract val receiverType: KtType? - abstract val hasReceiver: Boolean - abstract val parameterTypes: List - abstract val returnType: KtType +public abstract class KtFunctionalType : KtNonErrorClassType() { + public abstract val isSuspend: Boolean + public abstract val arity: Int + public abstract val receiverType: KtType? + public abstract val hasReceiver: Boolean + public abstract val parameterTypes: List + public abstract val returnType: KtType } -abstract class KtUsualClassType : KtNonErrorClassType() +public abstract class KtUsualClassType : KtNonErrorClassType() -abstract class KtClassErrorType : KtClassType() { - abstract val error: String +public abstract class KtClassErrorType : KtClassType() { + public abstract val error: String } -abstract class KtTypeParameterType : KtTypeWithNullability { - abstract val name: Name - abstract val symbol: KtTypeParameterSymbol +public abstract class KtTypeParameterType : KtTypeWithNullability { + public abstract val name: Name + public abstract val symbol: KtTypeParameterSymbol } -abstract class KtCapturedType : KtType { +public abstract class KtCapturedType : KtType { override fun toString(): String = asStringForDebugging() } -abstract class KtDefinitelyNotNullType : KtType, KtTypeWithNullability { - abstract val original: KtType +public abstract class KtDefinitelyNotNullType : KtType, KtTypeWithNullability { + public abstract val original: KtType final override val nullability: KtTypeNullability get() = KtTypeNullability.NON_NULLABLE override fun toString(): String = asStringForDebugging() } -abstract class KtFlexibleType : KtType { - abstract val lowerBound: KtType - abstract val upperBound: KtType +public abstract class KtFlexibleType : KtType { + public abstract val lowerBound: KtType + public abstract val upperBound: KtType override fun toString(): String = asStringForDebugging() } -abstract class KtIntersectionType : KtType { - abstract val conjuncts: List +public abstract class KtIntersectionType : KtType { + public abstract val conjuncts: List override fun toString(): String = asStringForDebugging() } \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt deleted file mode 100644 index de1a270e6c7..00000000000 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRenderer.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.frontend.api.types - -import org.jetbrains.kotlin.idea.frontend.api.* -import org.jetbrains.kotlin.name.ClassId