diff --git a/.idea/libraries/kotlinc_allopen_compiler_plugin.xml b/.idea/libraries/kotlinc_allopen_compiler_plugin.xml index 905ef1ab0038..555359f5ceb5 100644 --- a/.idea/libraries/kotlinc_allopen_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_allopen_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + fac3acf18b7eca2a1110dd2a85af8eb9c7049ba32dfc5102d4e0e0446d44c61d - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_analysis_api_providers.xml b/.idea/libraries/kotlinc_analysis_api_providers.xml index 659e0f09b322..af5f1c79a979 100644 --- a/.idea/libraries/kotlinc_analysis_api_providers.xml +++ b/.idea/libraries/kotlinc_analysis_api_providers.xml @@ -1,18 +1,18 @@ - + - + 08773ddb1cec02c3b797f7beccf7c0a46e83cb899e70659480dc10b9cc7a0e29 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_analysis_project_structure.xml b/.idea/libraries/kotlinc_analysis_project_structure.xml index 53b2ab6fa574..bb7cf956d22e 100644 --- a/.idea/libraries/kotlinc_analysis_project_structure.xml +++ b/.idea/libraries/kotlinc_analysis_project_structure.xml @@ -1,18 +1,18 @@ - + - + 971aceb3c727fa15a3ea890055a7702cd6929e60d20f885be4b87b6de5ac1e5a - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_android_extensions_compiler_plugin.xml b/.idea/libraries/kotlinc_android_extensions_compiler_plugin.xml index 6bf4834104eb..c38d20ff4236 100644 --- a/.idea/libraries/kotlinc_android_extensions_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_android_extensions_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + 3878c449ad28e8718074794418dc2db2597f52f59f2ab8f66aa133dda1cd6102 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_assignment_compiler_plugin.xml b/.idea/libraries/kotlinc_assignment_compiler_plugin.xml index 085ebaf76773..35336a5fcf54 100644 --- a/.idea/libraries/kotlinc_assignment_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_assignment_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + c0a707d2046d126ffd9f2a91b2120f375f85bdb3134d461bd98d8fc6b6afc68c - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api.xml b/.idea/libraries/kotlinc_high_level_api.xml index b407d17bcf72..a3361bd7a961 100644 --- a/.idea/libraries/kotlinc_high_level_api.xml +++ b/.idea/libraries/kotlinc_high_level_api.xml @@ -1,18 +1,18 @@ - + - - e7327c607c110657945238fa7a10da134645f54d1fffd49db5e20293d1d85e11 + + eee1f268be21a62981cce38af4657ef4428e6e191111c5725e2d29923c9315a9 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api_fe10.xml b/.idea/libraries/kotlinc_high_level_api_fe10.xml index d67fdd1c21cc..00d6cd47e46d 100644 --- a/.idea/libraries/kotlinc_high_level_api_fe10.xml +++ b/.idea/libraries/kotlinc_high_level_api_fe10.xml @@ -1,18 +1,18 @@ - + - + 23ef3fdc182462721ba2dcea2b118ccc12444db4936d84bc5928de01268c53e1 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api_fir.xml b/.idea/libraries/kotlinc_high_level_api_fir.xml index 11ff50e50175..8c08d5227420 100644 --- a/.idea/libraries/kotlinc_high_level_api_fir.xml +++ b/.idea/libraries/kotlinc_high_level_api_fir.xml @@ -1,18 +1,18 @@ - + - - 9dbd6a6e60948ea6dde7f2bc4de34859021f81ef898afdef5657d6c28638c1ad + + b8727a1460e8c57422cf46d8ca33e8ca975007d680819fcf2edd18bafa34247e - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api_fir_tests.xml b/.idea/libraries/kotlinc_high_level_api_fir_tests.xml index c429f57255e3..fcb551f34610 100644 --- a/.idea/libraries/kotlinc_high_level_api_fir_tests.xml +++ b/.idea/libraries/kotlinc_high_level_api_fir_tests.xml @@ -1,18 +1,18 @@ - + - - 49832ae59ada735ce96b1b4f6e9aa0473a26a9ac43b52b276a3cf0a2cdd26e66 + + afc3a06ebf3dd75894482b88cdbb0e3a6388e012ecd1d8d63295ba7b6ca35edb - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api_impl_base.xml b/.idea/libraries/kotlinc_high_level_api_impl_base.xml index 56b842c24c7d..b3415ce24e43 100644 --- a/.idea/libraries/kotlinc_high_level_api_impl_base.xml +++ b/.idea/libraries/kotlinc_high_level_api_impl_base.xml @@ -1,18 +1,18 @@ - + - + 3aaf51d5edac59ac7c938dfc0294c2b6955ce50cc59df9cc0dff5220c0c03f39 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_high_level_api_impl_base_tests.xml b/.idea/libraries/kotlinc_high_level_api_impl_base_tests.xml index 45584dded3b5..a47353d95810 100644 --- a/.idea/libraries/kotlinc_high_level_api_impl_base_tests.xml +++ b/.idea/libraries/kotlinc_high_level_api_impl_base_tests.xml @@ -1,18 +1,18 @@ - + - - 45a3bf7aa535f0a444efcc13e7c7ae38a7e4a3578a55aefb0cd233b50756808c + + 07f901a7e7ae4346015386b679dc020e0d4f676ca76a54eeee4b283257dd406f - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_incremental_compilation_impl_tests.xml b/.idea/libraries/kotlinc_incremental_compilation_impl_tests.xml index 3c7ea6026402..7f61a6b26f9d 100644 --- a/.idea/libraries/kotlinc_incremental_compilation_impl_tests.xml +++ b/.idea/libraries/kotlinc_incremental_compilation_impl_tests.xml @@ -1,18 +1,18 @@ - + - + 0837d457bb9e93cda7076c3475c59dfd02efc2df8e22ffbfbbe3483022b46223 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_build_common_tests.xml b/.idea/libraries/kotlinc_kotlin_build_common_tests.xml index 27f280e220c5..a27b576d7c4d 100644 --- a/.idea/libraries/kotlinc_kotlin_build_common_tests.xml +++ b/.idea/libraries/kotlinc_kotlin_build_common_tests.xml @@ -1,18 +1,18 @@ - + - + d48e1e35a457e3fa6666244524a2f102073f185ccee7f995b566c5c00f9a0d40 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_cli.xml b/.idea/libraries/kotlinc_kotlin_compiler_cli.xml index c3595e7ffc39..40006bfe6dbf 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_cli.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_cli.xml @@ -1,18 +1,18 @@ - + - - 941a776ef54d93fd564a51b15bbe70262cb0aeabfb383564463100a040f81c32 + + 3af2c4ea1885d013058225091cddb829044a0ba655f2177ba516a0773295b775 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_common.xml b/.idea/libraries/kotlinc_kotlin_compiler_common.xml index a87faea06722..c5d32bd4cb7e 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_common.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_common.xml @@ -1,18 +1,18 @@ - + - - 52498604e20007e36209eabd281b197a969b0f97a157aba6238ad56664ee05e2 + + 26655aa24e8ccdcf2969f9430479b8cb595f5a8437930bff86dfa5f37f73846e - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_fe10.xml b/.idea/libraries/kotlinc_kotlin_compiler_fe10.xml index ab75de768c91..da2e452334ab 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_fe10.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_fe10.xml @@ -1,18 +1,18 @@ - + - - 505a852370a976de0794937b0ccc0be727af957a770a7af45da2fb016f038054 + + 33730531ad16f74b613309d357ba93e9e2dd00739114a805ecf7a0fa0038465d - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_fir.xml b/.idea/libraries/kotlinc_kotlin_compiler_fir.xml index a5176d56b7d3..e85f7d8ae865 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_fir.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_fir.xml @@ -1,18 +1,18 @@ - + - - b4aaf7e4c35751d1071fbba4288d6408e3a292ab2f3103992f15c692abce5c95 + + 94a11c4ae9f6ec68dce3af13681de03c0c4f6a560d62362c04fea682df9c49dc - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_ir.xml b/.idea/libraries/kotlinc_kotlin_compiler_ir.xml index e2a6705afc08..2e0972cf0fa4 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_ir.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_ir.xml @@ -1,18 +1,18 @@ - + - - 5b106e669cc897e7b6a9471d83bfdc9525de983ddcd86b7d09516a3e915244d8 + + 3e8a89b47f2d9fe6c142da6f316658cfe2d470d449495df5c1a25aa0e4e48e52 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_compiler_tests.xml b/.idea/libraries/kotlinc_kotlin_compiler_tests.xml index b548b9e64a71..704894ab7e6e 100644 --- a/.idea/libraries/kotlinc_kotlin_compiler_tests.xml +++ b/.idea/libraries/kotlinc_kotlin_compiler_tests.xml @@ -1,18 +1,18 @@ - + - - 114a564cdc067202f81445150c5ebbf48183d81b6bfe5f7414fc0ad65eb2ea50 + + f0fe17636b4cb68ca5c0aa68bd8e22ff07e57d84b3f778bacd1c41aa7aeda95b - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_gradle_statistics.xml b/.idea/libraries/kotlinc_kotlin_gradle_statistics.xml index 46677e6097bf..5b98ed5c9213 100644 --- a/.idea/libraries/kotlinc_kotlin_gradle_statistics.xml +++ b/.idea/libraries/kotlinc_kotlin_gradle_statistics.xml @@ -1,18 +1,18 @@ - + - + 8549bd4b9b065bf4f51511ec9beeb4a0db09a65b459dd66b6e4c5f940a4781a3 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_jps_common.xml b/.idea/libraries/kotlinc_kotlin_jps_common.xml index 41653f54e625..e4e95de295e3 100644 --- a/.idea/libraries/kotlinc_kotlin_jps_common.xml +++ b/.idea/libraries/kotlinc_kotlin_jps_common.xml @@ -1,18 +1,18 @@ - + - + 4d2c850a2cd76ca2ee20203a8ed00fcd6e9402184d2e47d2cb83928955f6dc1e - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_jps_plugin_classpath_bootstrap_for_tests.xml b/.idea/libraries/kotlinc_kotlin_jps_plugin_classpath_bootstrap_for_tests.xml index 7cc9840961cd..acee0f39c113 100644 --- a/.idea/libraries/kotlinc_kotlin_jps_plugin_classpath_bootstrap_for_tests.xml +++ b/.idea/libraries/kotlinc_kotlin_jps_plugin_classpath_bootstrap_for_tests.xml @@ -1,18 +1,18 @@ - + - - d188369c9ff9eb2282ad14daddd6bde989700d2e66011666b4effed7fa3d7750 + + 5f6944da02a389abf55025433dc36dedfdb9d4ea005e85ef044fca2721826ddb - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_script_runtime.xml b/.idea/libraries/kotlinc_kotlin_script_runtime.xml index 7a6ad7bdbe84..4934e39e9387 100644 --- a/.idea/libraries/kotlinc_kotlin_script_runtime.xml +++ b/.idea/libraries/kotlinc_kotlin_script_runtime.xml @@ -1,18 +1,18 @@ - + - - b59f845c2079fae20a3920d8b4f675d5cca020b68bbc36a5450ea5dd658ec252 + + 695b9fddc09d9d43fc6d791e3e0e96daac6f9f247b4357a9eb45c468c86bddad - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_scripting_common.xml b/.idea/libraries/kotlinc_kotlin_scripting_common.xml index bc0925a1ec49..14f428befb55 100644 --- a/.idea/libraries/kotlinc_kotlin_scripting_common.xml +++ b/.idea/libraries/kotlinc_kotlin_scripting_common.xml @@ -1,18 +1,18 @@ - + - - 561fc5fa78c83a902591488615b6ebcc02da90caa156ab10dab983ca36679284 + + 3685fc862521e90108c1acea3239b273debb3f61c3d1f1858ca23df37c5631d5 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_scripting_compiler_impl.xml b/.idea/libraries/kotlinc_kotlin_scripting_compiler_impl.xml index c9a70b4891f7..4824e87c4c09 100644 --- a/.idea/libraries/kotlinc_kotlin_scripting_compiler_impl.xml +++ b/.idea/libraries/kotlinc_kotlin_scripting_compiler_impl.xml @@ -1,18 +1,18 @@ - + - - 1ec3f62c9056816bfee66050bd76c496ff32fbeb7a77a104117b283c99c5c5e7 + + 6b2c3c9e938429313f44553a7b289d182f165bbae0b2e565812eb7a4eb93bcb8 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlin_scripting_jvm.xml b/.idea/libraries/kotlinc_kotlin_scripting_jvm.xml index c5a25ba8d859..56b223094a64 100644 --- a/.idea/libraries/kotlinc_kotlin_scripting_jvm.xml +++ b/.idea/libraries/kotlinc_kotlin_scripting_jvm.xml @@ -1,18 +1,18 @@ - + - - 4842f8f42269c433fd73fa051e5b8ad62520c817a3d0ac158d91053135bcd141 + + 416cfdae213f854d262570f0be98e730e082ef1851263bd21cb0dc3c24a399ce - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_kotlinx_serialization_compiler_plugin.xml b/.idea/libraries/kotlinc_kotlinx_serialization_compiler_plugin.xml index a4d03ee5bd9c..c83e8d498dbf 100644 --- a/.idea/libraries/kotlinc_kotlinx_serialization_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_kotlinx_serialization_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - - e265054bd72e65815a7e917861b390f1fa5a0a849c844d53657ca2e480c95a35 + + 97a71a39fd9d7488099c1bd9651d3511343906a7770921b361875c5e3e756e2d - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_lombok_compiler_plugin.xml b/.idea/libraries/kotlinc_lombok_compiler_plugin.xml index 6a6235237578..9377ce3c8a8d 100644 --- a/.idea/libraries/kotlinc_lombok_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_lombok_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + 6545928eeb3d48562e718cd3f0365ff2788d1a9bd87dbc37eac30849e8b0a7c4 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_low_level_api_fir.xml b/.idea/libraries/kotlinc_low_level_api_fir.xml index fa16583497fc..da87299d0289 100644 --- a/.idea/libraries/kotlinc_low_level_api_fir.xml +++ b/.idea/libraries/kotlinc_low_level_api_fir.xml @@ -1,18 +1,18 @@ - + - - 647685582767ea1687c21d700ace7e217572d4ab2253778c7fff59d20d194877 + + 4f195a2dd39349cbab367964f7904b1eaa90424bb848e5df064f5f8345ca9027 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_noarg_compiler_plugin.xml b/.idea/libraries/kotlinc_noarg_compiler_plugin.xml index 6c65985dedca..affa33e67d11 100644 --- a/.idea/libraries/kotlinc_noarg_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_noarg_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + 73dbffd86d5855b9cedf8b47c31868f602644fad0739abe8220ad2e0e59c5418 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_parcelize_compiler_plugin.xml b/.idea/libraries/kotlinc_parcelize_compiler_plugin.xml index 8e75757b0d57..a4b633b57d57 100644 --- a/.idea/libraries/kotlinc_parcelize_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_parcelize_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + 094493321b2bf7dd181edabcd726d2d75c1987c4781972399adb299f580e5dc1 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_sam_with_receiver_compiler_plugin.xml b/.idea/libraries/kotlinc_sam_with_receiver_compiler_plugin.xml index dcc39e9fc9fa..df95246fdfcb 100644 --- a/.idea/libraries/kotlinc_sam_with_receiver_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_sam_with_receiver_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - + 1fd53f076800633e7f900cfba9381019aa18d8c72057b29ce5795318a6f458af - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_scripting_compiler_plugin.xml b/.idea/libraries/kotlinc_scripting_compiler_plugin.xml index b3dd1bea19db..237ef5879663 100644 --- a/.idea/libraries/kotlinc_scripting_compiler_plugin.xml +++ b/.idea/libraries/kotlinc_scripting_compiler_plugin.xml @@ -1,18 +1,18 @@ - + - - 9e0db2ce32b3064bf0e25e045d41d0e40385192305700b1d21c109fcd3cf629d + + 75d18f2b535579c766fba657d541a40bbe81edeeb6b41d2f6107db8d7e250e12 - + - + \ No newline at end of file diff --git a/.idea/libraries/kotlinc_symbol_light_classes.xml b/.idea/libraries/kotlinc_symbol_light_classes.xml index 77c1e468812f..d0729d3d9c0b 100644 --- a/.idea/libraries/kotlinc_symbol_light_classes.xml +++ b/.idea/libraries/kotlinc_symbol_light_classes.xml @@ -1,18 +1,18 @@ - + - + 636712fd4483f6e98584aea7bd1a6c9c8a2625e11783c837cd7b053a16fe383c - + - + \ No newline at end of file diff --git a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/AbstractHighLevelQuickFixMultiModuleTest.kt b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/AbstractHighLevelQuickFixMultiModuleTest.kt index 46800a7b4144..69857c8fd351 100644 --- a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/AbstractHighLevelQuickFixMultiModuleTest.kt +++ b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/AbstractHighLevelQuickFixMultiModuleTest.kt @@ -1,8 +1,15 @@ // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.kotlin.idea.k2.codeinsight.fixes +import com.intellij.psi.PsiFile import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest +import org.jetbrains.kotlin.psi.KtFile abstract class AbstractHighLevelQuickFixMultiModuleTest : AbstractQuickFixMultiModuleTest() { override fun isFirPlugin(): Boolean = true + override fun findAfterFile(editedFile: KtFile): PsiFile? { + val firAfter = editedFile.containingDirectory?.findFile(editedFile.name + ".fir.after") + if (firAfter != null) return firAfter + return editedFile.containingDirectory?.findFile(editedFile.name + ".after") + } } \ No newline at end of file diff --git a/plugins/kotlin/code-insight/override-implement-k2/src/org/jetbrains/kotlin/idea/core/overrideImplement/KtClassMember.kt b/plugins/kotlin/code-insight/override-implement-k2/src/org/jetbrains/kotlin/idea/core/overrideImplement/KtClassMember.kt index 9618d2fb7126..6072c4e6b827 100644 --- a/plugins/kotlin/code-insight/override-implement-k2/src/org/jetbrains/kotlin/idea/core/overrideImplement/KtClassMember.kt +++ b/plugins/kotlin/code-insight/override-implement-k2/src/org/jetbrains/kotlin/idea/core/overrideImplement/KtClassMember.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.analysis.api.renderer.declarations.modifiers.rendere import org.jetbrains.kotlin.analysis.api.renderer.declarations.modifiers.renderers.KtRendererOtherModifiersProvider import org.jetbrains.kotlin.analysis.api.symbols.* import org.jetbrains.kotlin.analysis.api.symbols.markers.KtNamedSymbol +import org.jetbrains.kotlin.analysis.api.symbols.markers.KtPossibleMultiplatformSymbol import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.idea.base.util.names.FqNames import org.jetbrains.kotlin.idea.core.TemplateKind @@ -132,11 +133,63 @@ fun generateMember( modalityProvider = modalityProvider.onlyIf { s -> s != symbol } - otherModifiersProvider = otherModifiersProvider and object : KtRendererOtherModifiersProvider { + val containingSymbol = targetClass?.getSymbol() as? KtClassOrObjectSymbol + otherModifiersProvider = object : KtRendererOtherModifiersProvider { + //copy from KtRendererOtherModifiersProvider.ALL with `actual` and `override` specifics context(KtAnalysisSession) - override fun getOtherModifiers(symbol: KtDeclarationSymbol): List = - listOf(KtTokens.OVERRIDE_KEYWORD) - }.onlyIf { s -> mode == MemberGenerateMode.OVERRIDE && s == symbol } + override fun getOtherModifiers(s: KtDeclarationSymbol): List = buildList { + if (mode == MemberGenerateMode.OVERRIDE && s is KtPossibleMultiplatformSymbol && containingSymbol?.isActual == true) { + //include actual modifier explicitly when containing class has modifier + if (s.isActual) add(KtTokens.ACTUAL_KEYWORD) + } + + if (s is KtFunctionSymbol) { + if (s.isExternal) add(KtTokens.EXTERNAL_KEYWORD) + if (s.isOverride) add(KtTokens.OVERRIDE_KEYWORD) + if (s.isInline) add(KtTokens.INLINE_KEYWORD) + if (s.isInfix) add(KtTokens.INFIX_KEYWORD) + if (s.isOperator) add(KtTokens.OPERATOR_KEYWORD) + if (s.isSuspend) add(KtTokens.SUSPEND_KEYWORD) + } + + if (s is KtPropertySymbol) { + if (s.isOverride) add(KtTokens.OVERRIDE_KEYWORD) + } + + if (s is KtValueParameterSymbol) { + if (s.isVararg) add(KtTokens.VARARG_KEYWORD) + if (s.isCrossinline) add(KtTokens.CROSSINLINE_KEYWORD) + if (s.isNoinline) add(KtTokens.NOINLINE_KEYWORD) + } + + if (s is KtKotlinPropertySymbol) { + if (s.isConst) add(KtTokens.CONST_KEYWORD) + if (s.isLateInit) add(KtTokens.LATEINIT_KEYWORD) + } + + if (s is KtNamedClassOrObjectSymbol) { + if (s.isExternal) add(KtTokens.EXTERNAL_KEYWORD) + if (s.isInline) add(KtTokens.INLINE_KEYWORD) + if (s.isData) add(KtTokens.DATA_KEYWORD) + if (s.isFun) add(KtTokens.FUN_KEYWORD) + if (s.isInner) add(KtTokens.INNER_KEYWORD) + } + + if (s is KtTypeParameterSymbol) { + if (s.isReified) add(KtTokens.REIFIED_KEYWORD) + when (s.variance) { + Variance.INVARIANT -> {} + Variance.IN_VARIANCE -> add(KtTokens.IN_KEYWORD) + Variance.OUT_VARIANCE -> add(KtTokens.OUT_KEYWORD) + } + } + + if (s == symbol && mode == MemberGenerateMode.OVERRIDE) { + //include additional override modifier + add(KtTokens.OVERRIDE_KEYWORD) + } + } + } } } @@ -158,15 +211,13 @@ fun generateMember( } MemberGenerateMode.OVERRIDE -> { - // TODO: add `actual` keyword to the generated member if the target class has `actual` and the generated member corresponds to // an `expect` member. } } if (copyDoc) { val kDoc = when (val originalOverriddenPsi = symbol.unwrapFakeOverrides.psi) { - is KtDeclaration -> - findDocComment(originalOverriddenPsi) + is KtDeclaration -> findDocComment(originalOverriddenPsi) is PsiDocCommentOwner -> { val kDocText = originalOverriddenPsi.docComment?.let { IdeaDocCommentConverter.convertDocComment(it) } @@ -243,25 +294,21 @@ private fun generateProperty( val returnType = symbol.returnType val returnsNotUnit = !returnType.isUnit - val body = - if (bodyType != BodyType.NoBody) { - buildString { - append("\nget()") - append(" = ") - append(generateUnsupportedOrSuperCall(project, symbol, bodyType, !returnsNotUnit)) - if (!symbol.isVal) { - append("\nset(value) {}") - } + val body = if (bodyType != BodyType.NoBody) { + buildString { + append("\nget()") + append(" = ") + append(generateUnsupportedOrSuperCall(project, symbol, bodyType, !returnsNotUnit)) + if (!symbol.isVal) { + append("\nset(value) {}") } - } else "" + } + } else "" return KtPsiFactory(project).createProperty(symbol.render(renderer) + body) } private fun KtAnalysisSession.generateUnsupportedOrSuperCall( - project: Project, - symbol: T, - bodyType: BodyType, - canBeEmpty: Boolean = true + project: Project, symbol: T, bodyType: BodyType, canBeEmpty: Boolean = true ): String where T : KtNamedSymbol, T : KtCallableSymbol { when (bodyType.effectiveBodyType(canBeEmpty)) { BodyType.EmptyOrTemplate -> return "" @@ -272,11 +319,7 @@ private fun KtAnalysisSession.generateUnsupportedOrSuperCall( else -> throw IllegalArgumentException("$symbol must be either a function or a property") } return getFunctionBodyTextFromTemplate( - project, - templateKind, - symbol.name.asString(), - symbol.returnType.render(position = Variance.OUT_VARIANCE), - null + project, templateKind, symbol.name.asString(), symbol.returnType.render(position = Variance.OUT_VARIANCE), null ) } diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiModuleTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiModuleTest.kt index 34c7f3461c16..a2d3393346db 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiModuleTest.kt +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixMultiModuleTest.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.ui.Messages import com.intellij.openapi.ui.TestDialog import com.intellij.openapi.ui.TestDialogManager import com.intellij.openapi.vfs.VirtualFile +import com.intellij.psi.PsiFile import com.intellij.rt.execution.junit.FileComparisonData import com.intellij.testFramework.IdeaTestUtil import com.intellij.testFramework.UsefulTestCase @@ -154,7 +155,7 @@ abstract class AbstractQuickFixMultiModuleTest : AbstractMultiModuleTest(), Quic val afterFiles = projectDirectory.walkTopDown().filter { it.path.endsWith(".after") }.toList() for (editedFile in project.allKotlinFiles()) { - val afterFileInTmpProject = editedFile.containingDirectory?.findFile(editedFile.name + ".after") ?: continue + val afterFileInTmpProject = findAfterFile(editedFile) ?: continue val afterFileInTestData = afterFiles.filter { it.name == afterFileInTmpProject.name }.single { it.readText() == File(afterFileInTmpProject.virtualFile.path).readText() } @@ -169,6 +170,8 @@ abstract class AbstractQuickFixMultiModuleTest : AbstractMultiModuleTest(), Quic } } + protected open fun findAfterFile(editedFile: KtFile): PsiFile? = editedFile.containingDirectory?.findFile(editedFile.name + ".after") + private val availableActions: List get() { doHighlighting() diff --git a/plugins/kotlin/idea/tests/testData/editor/quickDoc/OnActualDeclaration.kt b/plugins/kotlin/idea/tests/testData/editor/quickDoc/OnActualDeclaration.kt index 52a0d7d9053b..6d0807dc9892 100644 --- a/plugins/kotlin/idea/tests/testData/editor/quickDoc/OnActualDeclaration.kt +++ b/plugins/kotlin/idea/tests/testData/editor/quickDoc/OnActualDeclaration.kt @@ -8,5 +8,5 @@ expect class Foo */ actual class Foo -//K2_INFO: public final class FooDoc for actual class Foo OnActualDeclaration.kt +//K2_INFO: public actual final class FooDoc for actual class Foo OnActualDeclaration.kt //INFO: public final actual class FooDoc for actual class Foo OnActualDeclaration.kt diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkJsPlatform/gradle.properties b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkJsPlatform/gradle.properties deleted file mode 100644 index 9dcc3a7655fe..000000000000 --- a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkJsPlatform/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -kotlin.code.style=official -kotlin.js.compiler=ir diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/build.gradle.kts b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/build.gradle.kts similarity index 98% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/build.gradle.kts rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/build.gradle.kts index 51f2cd84f70f..6262dca63404 100644 --- a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/build.gradle.kts +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/build.gradle.kts @@ -10,7 +10,7 @@ repositories { } kotlin { - wasm { + wasmJs { binaries.executable() browser {} } diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/settings.gradle.kts b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/settings.gradle.kts similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/settings.gradle.kts rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/settings.gradle.kts diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonMain/kotlin/Simple.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonMain/kotlin/Simple.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonMain/kotlin/Simple.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonMain/kotlin/Simple.kt diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonMain/resources/index.html b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonMain/resources/index.html similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonMain/resources/index.html rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonMain/resources/index.html diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonTest/kotlin/SimpleTest.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonTest/kotlin/SimpleTest.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/commonTest/kotlin/SimpleTest.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/commonTest/kotlin/SimpleTest.kt diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/wasmJsMain/kotlin/w.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/wasmJsMain/kotlin/w.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/wasmJsMain/kotlin/w.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/wasmJsMain/kotlin/w.kt diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/wasmJsTest/kotlin/wTest.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/wasmJsTest/kotlin/wTest.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/wasmJsTest/kotlin/wTest.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmJsPlatform/src/wasmJsTest/kotlin/wTest.kt diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/gradle.properties b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/gradle.properties deleted file mode 100644 index 38124e1e32b1..000000000000 --- a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -kotlin.code.style=official -kotlin.js.compiler=ir - diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/build.gradle.kts b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/build.gradle.kts new file mode 100644 index 000000000000..ecd090cf8e00 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/build.gradle.kts @@ -0,0 +1,32 @@ +plugins { + kotlin("multiplatform") version "{{kotlin_plugin_version}}" +} + +group = "me.user" +version = "1.0-SNAPSHOT" + +repositories { + { { kts_kotlin_plugin_repositories } } +} + +kotlin { + wasmWasi { + binaries.executable() + nodejs {} + } + + sourceSets { + val commonTest by getting { + dependencies { + implementation(kotlin("test-common")) + implementation(kotlin("test-annotations-common")) + } + } + + val wasmWasiTest by getting { + dependencies { + implementation(kotlin("test-wasm-wasi")) + } + } + } +} diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/settings.gradle.kts b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/settings.gradle.kts new file mode 100644 index 000000000000..94e8a82bfe8b --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/settings.gradle.kts @@ -0,0 +1,12 @@ +rootProject.name = "wasm20221114" + +pluginManagement { + repositories { + { { kts_kotlin_plugin_repositories } } + } +} +dependencyResolutionManagement { + repositories { + { { kts_kotlin_plugin_repositories } } + } +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonMain/kotlin/Simple.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonMain/kotlin/Simple.kt new file mode 100644 index 000000000000..ca42cd7fdb4d --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonMain/kotlin/Simple.kt @@ -0,0 +1,5 @@ +fun main() { + println() +} + +fun greet() = "world" diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonTest/kotlin/SimpleTest.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonTest/kotlin/SimpleTest.kt new file mode 100644 index 000000000000..63f94bd345c9 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/commonTest/kotlin/SimpleTest.kt @@ -0,0 +1,9 @@ +import kotlin.test.Test +import kotlin.test.assertEquals + +class TestClient { + @Test + fun testGreet() { + assertEquals("world", greet()) + } +} \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsMain/kotlin/main.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiMain/kotlin/w.kt similarity index 57% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsMain/kotlin/main.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiMain/kotlin/w.kt index 4529c7c121c5..0a18a04310ae 100644 --- a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsMain/kotlin/main.kt +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiMain/kotlin/w.kt @@ -1,9 +1,6 @@ package foo @kotlin.js.JsExport -fun jsMain() { - Foo() +fun wasmMain() { println() } - -class Foo diff --git a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsTest/kotlin/Test.kt b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiTest/kotlin/wTest.kt similarity index 85% rename from plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsTest/kotlin/Test.kt rename to plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiTest/kotlin/wTest.kt index 487b44ae7a1c..ce3d516f89b9 100644 --- a/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmPlatform/src/jsTest/kotlin/Test.kt +++ b/plugins/kotlin/idea/tests/testData/gradle/detectPlatforms/checkWasmWasiPlatform/src/wasmWasiTest/kotlin/wTest.kt @@ -1,7 +1,7 @@ import kotlin.test.Test import kotlin.test.assertEquals -class JsTestClient { +class WasmTestClient { @Test fun testGreet() { assertEquals("world", greet()) diff --git a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/other/implementMembersInActualClassNoExpectMember/jvm/jvm.kt.fir.after b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/other/implementMembersInActualClassNoExpectMember/jvm/jvm.kt.fir.after new file mode 100644 index 000000000000..e70911c8cb38 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/other/implementMembersInActualClassNoExpectMember/jvm/jvm.kt.fir.after @@ -0,0 +1,12 @@ +// "Implement members" "true" +// DISABLE-ERRORS + +actual interface ExpInterface { + actual fun first() +} + +actual class ExpImpl : ExpInterface { + actual override fun first() { + TODO("Not yet implemented") + } +} \ No newline at end of file diff --git a/plugins/kotlin/plugin/k2/resources/META-INF/lowLevelApiFir.xml b/plugins/kotlin/plugin/k2/resources/META-INF/lowLevelApiFir.xml index 7b69d6ccaa72..4aba53b0b27f 100644 --- a/plugins/kotlin/plugin/k2/resources/META-INF/lowLevelApiFir.xml +++ b/plugins/kotlin/plugin/k2/resources/META-INF/lowLevelApiFir.xml @@ -22,6 +22,8 @@ + diff --git a/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt b/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt index 81df8d4069d2..bb23c2e63f59 100644 --- a/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt +++ b/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt @@ -388,7 +388,15 @@ fun getPlatform(module: Module): String { if (module.name.contains("android")) "jvm.android" else "jvm" } - module.platform.isWasm() && hasKotlinWasmRuntimeInScope(module) -> "wasm" + + module.platform.isWasm() -> { + when { + hasKotlinWasmJsRuntimeInScope(module) -> "wasm.js" + hasKotlinWasmWasiRuntimeInScope(module) -> "wasm.wasi" + else -> "wasm.unknown" + } + } + module.platform.isJs() && hasKotlinJsRuntimeInScope(module) -> "js" module.platform.isCommon() -> "common" module.platform.isNative() -> "native." + (module.platform?.componentPlatforms?.first()?.targetName ?: "unknown") @@ -436,6 +444,14 @@ fun hasKotlinWasmRuntimeInScope(module: Module): Boolean { return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_FQ_NAME, KotlinWasmLibraryKind) } +fun hasKotlinWasmJsRuntimeInScope(module: Module): Boolean { + return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_JS_FQ_NAME, KotlinWasmLibraryKind) +} + +fun hasKotlinWasmWasiRuntimeInScope(module: Module): Boolean { + return hasKotlinPlatformRuntimeInScope(module, KOTLIN_WASM_WASI_FQ_NAME, KotlinWasmLibraryKind) +} + fun hasKotlinNativeRuntimeInScope(module: Module): Boolean { return hasKotlinPlatformRuntimeInScope(module, KOTLIN_NATIVE_FQ_NAME, KotlinNativeLibraryKind) } @@ -570,6 +586,8 @@ private fun getJvmTargetFromSdkOrDefault( private val KOTLIN_JS_FQ_NAME = FqName("kotlin.js") private val KOTLIN_WASM_FQ_NAME = FqName("kotlin.wasm") +private val KOTLIN_WASM_JS_FQ_NAME = FqName("kotlin.wasm.js") +private val KOTLIN_WASM_WASI_FQ_NAME = FqName("kotlin.wasm.wasi") private val KOTLIN_NATIVE_FQ_NAME = FqName("kotlin.native") diff --git a/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt b/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt index 73506efd7e17..98953d9cf08f 100644 --- a/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt +++ b/plugins/kotlin/project-configuration/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt @@ -57,7 +57,7 @@ internal class ProjectConfigurationCollector : ProjectUsagesCollector() { } } - private val GROUP = EventLogGroup("kotlin.project.configuration", 10) + private val GROUP = EventLogGroup("kotlin.project.configuration", 11) private val systemField = EventFields.String("system", listOf("JPS", "Maven", "Gradle", "unknown")) private val platformField = EventFields.String("platform", composePlatformFields()) @@ -69,7 +69,18 @@ internal class ProjectConfigurationCollector : ProjectUsagesCollector() { private fun composePlatformFields(): List { return listOf( - listOf("jvm", "jvm.android", "js", "wasm", "common", "native.unknown", "unknown"), + listOf( + "jvm", + "jvm.android", + "js", + "wasm", + "wasm.js", + "wasm.wasi", + "wasm.unknown", + "common", + "native.unknown", + "unknown" + ), KonanTarget.predefinedTargets.keys.map { "native.$it" } ).flatten() } diff --git a/plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/LightClassBehaviorTestBase.kt b/plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/LightClassBehaviorTestBase.kt index 4b2ea0bd8b5b..adc410d41910 100644 --- a/plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/LightClassBehaviorTestBase.kt +++ b/plugins/kotlin/uast/uast-kotlin-base/tests/test/org/jetbrains/uast/test/common/kotlin/LightClassBehaviorTestBase.kt @@ -594,7 +594,7 @@ interface LightClassBehaviorTestBase : UastPluginSelection { ) } - fun checkDefaultValueOfAnnotation(myFixture: JavaCodeInsightTestFixture) { + fun checkDefaultValueOfAnnotation_Kotlin(myFixture: JavaCodeInsightTestFixture) { myFixture.configureByText( "main.kt", """ annotation class IntDef( @@ -629,6 +629,51 @@ interface LightClassBehaviorTestBase : UastPluginSelection { TestCase.assertEquals("false", flagValue?.toString()) } + fun checkDefaultValueOfAnnotation_Java(myFixture: JavaCodeInsightTestFixture) { + myFixture.addClass( + """ + import java.lang.annotation.Annotation; + import java.lang.annotation.ElementType; + import java.lang.annotation.Target; + + @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) + public @interface MyRestrictedApi { + String explanation(); + Class extends Annotation>[] allowlistAnnotations() default {}; + boolean allowedInTestonlyTargets() default false; + } + """.trimIndent() + ) + myFixture.configureByText( + "main.kt", """ + @Target(AnnotationTarget.FUNCTION) annotation class KAllowlist + + class Test { + @MyRestrictedApi( + explanation = "umbrella", + allowlistAnnotations = [KAllowlist::class], + ) + fun foo() {} + } + """.trimIndent() + ) + + val uFile = myFixture.file.toUElement()!! + val foo = uFile.findElementByTextFromPsi("fun foo", strict = false) + .orFail("can't convert to UMethod") + val lc = foo.uAnnotations.single().javaPsi!! + val annos = (lc.findAttributeValue("allowlistAnnotations") as? PsiArrayInitializerMemberValue)?.initializers + TestCase.assertEquals( + "[KAllowlist]", + annos?.joinToString(separator = ", ", prefix = "[", postfix = "]") { annoValue -> + (annoValue as? PsiClassObjectAccessExpression)?.type?.canonicalText ?: annoValue.text + } + ) + + val flagValue = (lc.findAttributeValue("allowedInTestonlyTargets") as? PsiLiteralExpression)?.value + TestCase.assertEquals("false", flagValue?.toString()) + } + fun checkAnnotationParameterReference(myFixture: JavaCodeInsightTestFixture) { PsiReferenceContributor.EP_NAME.point.registerExtension( PsiReferenceContributorEP().apply { diff --git a/plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirLightClassBehaviorTest.kt b/plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirLightClassBehaviorTest.kt index dfbc9220cc6b..6924094576a9 100644 --- a/plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirLightClassBehaviorTest.kt +++ b/plugins/kotlin/uast/uast-kotlin-fir/tests/test/org/jetbrains/fir/uast/test/FirLightClassBehaviorTest.kt @@ -77,8 +77,12 @@ class FirLightClassBehaviorTest : KotlinLightCodeInsightFixtureTestCase(), Light checkUpperBoundForRecursiveTypeParameter(myFixture) } - fun testDefaultValueOfAnnotation() { - checkDefaultValueOfAnnotation(myFixture) + fun testDefaultValueOfAnnotation_Kotlin() { + checkDefaultValueOfAnnotation_Kotlin(myFixture) + } + + fun testDefaultValueOfAnnotation_Java() { + checkDefaultValueOfAnnotation_Java(myFixture) } fun testAnnotationParameterReference() { diff --git a/plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1LightClassBehaviorTest.kt b/plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1LightClassBehaviorTest.kt index 1d9ad3d99bd9..6bbd366d61ad 100644 --- a/plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1LightClassBehaviorTest.kt +++ b/plugins/kotlin/uast/uast-kotlin/tests/test/org/jetbrains/uast/test/kotlin/comparison/FE1LightClassBehaviorTest.kt @@ -81,8 +81,12 @@ class FE1LightClassBehaviorTest : KotlinLightCodeInsightFixtureTestCase(), Light checkUpperBoundForRecursiveTypeParameter(myFixture) } - fun testDefaultValueOfAnnotation() { - checkDefaultValueOfAnnotation(myFixture) + fun testDefaultValueOfAnnotation_Kotlin() { + checkDefaultValueOfAnnotation_Kotlin(myFixture) + } + + fun testDefaultValueOfAnnotation_Java() { + checkDefaultValueOfAnnotation_Java(myFixture) } fun testAnnotationParameterReference() { diff --git a/plugins/kotlin/util/project-model-updater/resources/model.properties b/plugins/kotlin/util/project-model-updater/resources/model.properties index a448e53ef359..bb4a0189a022 100644 --- a/plugins/kotlin/util/project-model-updater/resources/model.properties +++ b/plugins/kotlin/util/project-model-updater/resources/model.properties @@ -1,5 +1,5 @@ # Please do not touch this file. It is the responsibility of Kotlin/IntelliJ Kotlin team to advance kotlin compiler version -kotlincVersion=2.0.0-dev-19480 +kotlincVersion=2.0.20-dev-7 kotlincArtifactsMode=MAVEN jpsPluginVersion=1.9.23-release-779
public final class Foo
Doc for actual class Foo
public actual final class Foo
public final actual class Foo