From f2a892a9724a7bb6f9818aa7c1f22f3ddc9f2bd8 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Sun, 28 Mar 2021 16:26:32 +0300 Subject: [PATCH] Cleanup 201 and as41 bunch files --- .bunch | 2 - .../android/tests/AndroidRunner.java.as41 | 0 .../codegen/VersionIndependentOpcodes.kt.201 | 13 - .../codegen/AbstractClassBuilder.java.201 | 158 -- .../kotlin/codegen/ClassBuilder.java.201 | 79 - .../kotlin/codegen/ClassBuilderRecord.kt.201 | 11 - .../codegen/DelegatingClassBuilder.java.201 | 118 -- .../common/TypeAnnotatedFrames.kt.201 | 11 - .../state/JvmMethodExceptionTypes.kt.201 | 8 - .../cli/jvm/compiler/JavaLanguageLevel.kt.201 | 14 - .../kotlin/cli/jvm/compiler/compat.kt.201 | 15 - .../classes/lightClassPlatformUtils.kt.201 | 13 - .../java/structure/impl/JavaClassImpl.kt.201 | 154 -- .../structure/impl/JavaElementUtil.java.201 | 113 -- .../impl/classFiles/BinaryJavaClass.kt.201 | 247 ---- .../testFramework/KtParsingTestCase.java.201 | 346 ----- .../testFramework/KtUsefulTestCase.java.201 | 1187 --------------- .../testFramework/KtUsefulTestCase.java.as41 | 1186 --------------- .../kotlin/utils/platformUtils.kt.201 | 17 - .../generators/tests/GenerateTests.kt.as41 | 1312 ----------------- gradle/versions.properties.201 | 19 - gradle/versions.properties.as41 | 23 - .../PropertyKeysEmptyString.kt.201 | 13 - .../PropertyKeysNoPrefix.kt.201 | 13 - .../PropertyKeysWithPrefix.kt.201 | 12 - .../DaemonCodeAnalyzerStatusService.kt.201 | 43 - .../idea/statistics/KotlinFUSLogger.kt.as41 | 18 - .../ProjectConfigurationCollector.kt.as41 | 3 - .../actions/ShowKotlinGradleDslLogs.kt.201 | 88 -- ...lMultiplatformProjectImportingTest.kt.as41 | 0 .../MultiplatformProjectImportingTest.kt.as41 | 0 ...ltiplatformTestCompatibilityMatrix.kt.as41 | 8 - ...wMultiplatformProjectImportingTest.kt.as41 | 0 .../gradle/PackagePrefixImportingTest.kt.as41 | 0 ...leConfiguratorPlatformSpecificTest.kt.as41 | 0 .../gradle/GradleFacetImportTest.kt.as41 | 0 ...eInspectionTestCompatibilityMatrix.kt.as41 | 8 - .../wizard/service/IdeaGradleWizardService.kt | 1 - .../service/MavenProjectImporter.kt.as41 | 15 - .../KotlinLightCodeInsightFixtureTestCase.kt | 1 - ...ghtCodeInsightFixtureTestCaseBase.java.201 | 98 -- ...LightPlatformCodeInsightFixtureTestCase.kt | 1 - .../idea/test/PluginTestCaseBase.java.201 | 137 -- .../org/jetbrains/kotlin/idea/test/compat.kt | 11 - .../jetbrains/kotlin/idea/test/compat.kt.201 | 15 - ...nClassWithDelegatedPropertyRenderer.kt.201 | 120 -- ...bstractKotlinEvaluateExpressionTest.kt.201 | 299 ---- .../idea/debugger/test/util/FramePrinter.kt | 6 +- .../idea/testFramework/gradleRoutines.kt.201 | 82 -- .../idea/testFramework/projectRoutines.kt.201 | 120 -- .../META-INF/plugin.xml.201 | 221 --- .../META-INF/plugin.xml.as41 | 203 --- idea/resources/META-INF/android-lint.xml.as41 | 5 - .../AbstractScratchRunActionTest.kt.201 | 380 ----- .../scratch/ScratchLineMarkersTest.kt.201 | 75 - .../idea/IDESettingsFUSCollector.kt.as41 | 3 - .../idea/KotlinDocumentationProviderCompat.kt | 2 +- .../KotlinDocumentationProviderCompat.kt.203 | 1 - .../kotlin/idea/PluginStartupActivity.java | 6 +- .../idea/actions/NewKotlinFileAction.kt.201 | 274 ---- .../BreadcrumbsProviderCompatBase.kt | 15 - .../KotlinBreadcrumbsInfoProvider.kt | 8 +- .../MLCompletionForKotlin.kt.as41 | 16 - ...inHighlightExitPointsHandlerFactory.kt.201 | 174 --- ...inHighlightImplicitItHandlerFactory.kt.201 | 58 - ...tlinRecursiveCallLineMarkerProvider.kt.201 | 189 --- ...KotlinSuspendCallLineMarkerProvider.kt.201 | 126 -- .../markers/LineMarkerInfos.kt.201 | 10 - .../idea/highlighter/markers/dslStyleIcon.kt | 2 +- .../highlighter/markers/dslStyleIcon.kt.as41 | 14 - .../TrailingCommaInspection.kt.201 | 192 --- .../changeSignature/BunchedDeprecation.java | 27 - .../KotlinChangeSignatureUsageProcessor.kt | 7 +- .../KotlinMutableMethodDescriptor.kt.201 | 48 - .../moveDeclarations/BunchedDeprecation.java | 27 - .../MoveKotlinDeclarationsProcessor.kt | 7 +- .../idea/reporter/ITNReporterCompat.kt.as41 | 33 - .../KotlinTargetElementEvaluator.kt.201 | 111 -- .../idea/slicer/KotlinSliceProvider.kt.201 | 127 -- .../idea/{startupCompat.kt => startup.kt} | 1 - .../kotlin/idea/testResourceBundle.kt | 11 - .../kotlin/idea/testResourceBundle.kt.as41 | 31 - .../kotlin/idea/testResourceBundle.kt.as42 | 12 - .../update/GooglePluginUpdateVerifier.kt.as41 | 157 -- .../kotlin/idea/update/verify.kt.as41 | 35 - .../src/test/kotlin/MyKotlinTest.kt.as41 | 7 - .../src/test/kotlin/MyKotlinTest.kt.as41 | 11 - ...PrimaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...PrimaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...condaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...PrimaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...condaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...jkKeepValOnAddingParameter1.after.java.201 | 7 - ...ValOnAddingParameter1.before.Main.java.201 | 7 - ...jkKeepValOnAddingParameter2.after.java.201 | 7 - ...ValOnAddingParameter2.before.Main.java.201 | 7 - ...PrimaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - ...condaryConstructorParameter.after.java.201 | 7 - ...yConstructorParameter.before.Main.java.201 | 7 - .../findUsages/CustomUsageSearcherTest.kt | 7 +- .../kotlin/findUsages/customUsageSearcher.kt | 11 - .../AbstractLineMarkersTest.kt.201 | 184 --- ...ractLineMarkersTestInLibrarySources.kt.201 | 93 -- .../codeInsight/AbstractRenderingKDocTest.kt | 2 +- ...bstractConfigureKotlinInTempDirTest.kt.201 | 38 - .../AbstractConfigureKotlinTest.kt.201 | 256 ---- .../quickDoc/QuickDocInHierarchyTest.kt.201 | 50 - .../AbstractUsageHighlightingTest.kt.201 | 64 - .../InspectionDescriptionTest.kt.201 | 149 -- .../IntentionDescriptionTest.kt.201 | 64 - .../kotlin/idea/kdoc/KdocRenameTest.java | 2 - .../kotlin/idea/navigation/GotoCheck.kt.201 | 81 - .../CommonIntentionActionsTest.kt.201 | 729 --------- ...tionalResolveDescriptorRendererTest.kt.201 | 56 - .../kotlin/idea/slicer/SlicerTestUtil.kt.201 | 135 -- .../AbstractMultiHighlightingTest.kt.201 | 50 - ...JavaToKotlinConverterForWebDemoTest.kt.201 | 134 -- .../AllOpenMavenProjectImportHandler.kt.as41 | 0 ...nitClassBuilderInterceptorExtension.kt.201 | 156 -- ...royClassBuilderInterceptorExtension.kt.201 | 136 -- .../src/AbstractMavenImportHandler.kt.as41 | 0 ...linSerializationMavenImportHandler.kt.as41 | 0 .../NoArgMavenProjectImportHandler.kt.as41 | 0 ...nitClassBuilderInterceptorExtension.kt.201 | 150 -- ...hReceiverMavenProjectImportHandler.kt.as41 | 0 .../KotlinUastCodeGenerationPlugin.kt.201 | 429 ------ .../AbstractKotlinIdentifiersTest.kt.201 | 37 - tests/mute-platform.csv.201 | 115 -- tests/mute-platform.csv.as41 | 117 -- 135 files changed, 28 insertions(+), 12127 deletions(-) delete mode 100644 compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as41 delete mode 100644 compiler/backend.common.jvm/src/org/jetbrains/kotlin/codegen/VersionIndependentOpcodes.kt.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderRecord.kt.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/JavaLanguageLevel.kt.201 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 delete mode 100644 compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/lightClassPlatformUtils.kt.201 delete mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 delete mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 delete mode 100644 compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.as41 delete mode 100644 compiler/util/src/org/jetbrains/kotlin/utils/platformUtils.kt.201 delete mode 100644 generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 delete mode 100644 gradle/versions.properties.201 delete mode 100644 gradle/versions.properties.as41 delete mode 100644 idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 delete mode 100644 idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 delete mode 100644 idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as41 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as41 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as41 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as41 delete mode 100644 idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as41 delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 delete mode 100644 idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 delete mode 100644 idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 delete mode 100644 idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 delete mode 100644 idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 delete mode 100644 idea/resources-descriptors/META-INF/plugin.xml.201 delete mode 100644 idea/resources-descriptors/META-INF/plugin.xml.as41 delete mode 100644 idea/resources/META-INF/android-lint.xml.as41 delete mode 100644 idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 delete mode 100644 idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java delete mode 100644 idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 rename idea/src/org/jetbrains/kotlin/idea/{startupCompat.kt => startup.kt} (97%) delete mode 100644 idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as42 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as41 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as41 delete mode 100644 idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as41 delete mode 100644 idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as41 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 delete mode 100644 idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 delete mode 100644 j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 delete mode 100644 plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as41 delete mode 100644 plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 delete mode 100644 plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 delete mode 100644 plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as41 delete mode 100644 plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as41 delete mode 100644 plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as41 delete mode 100644 plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 delete mode 100644 plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as41 delete mode 100644 plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 delete mode 100644 plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 delete mode 100644 tests/mute-platform.csv.201 delete mode 100644 tests/mute-platform.csv.as41 diff --git a/.bunch b/.bunch index 67304541a87..822378012cd 100644 --- a/.bunch +++ b/.bunch @@ -1,4 +1,2 @@ 202 -201 -as41_201 as42 \ No newline at end of file diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as41 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/backend.common.jvm/src/org/jetbrains/kotlin/codegen/VersionIndependentOpcodes.kt.201 b/compiler/backend.common.jvm/src/org/jetbrains/kotlin/codegen/VersionIndependentOpcodes.kt.201 deleted file mode 100644 index 2b2b7422592..00000000000 --- a/compiler/backend.common.jvm/src/org/jetbrains/kotlin/codegen/VersionIndependentOpcodes.kt.201 +++ /dev/null @@ -1,13 +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.codegen - -import org.jetbrains.org.objectweb.asm.Opcodes - -// This object should help compiling against different ASM versions from different bunch versions -object VersionIndependentOpcodes { - const val ACC_RECORD = 0 -} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 deleted file mode 100644 index 9339caf91e8..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AbstractClassBuilder.java.201 +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.codegen; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.codegen.inline.FileMapping; -import org.jetbrains.kotlin.codegen.inline.SMAPBuilder; -import org.jetbrains.kotlin.codegen.inline.SourceMapper; -import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; -import org.jetbrains.org.objectweb.asm.*; - -import java.util.List; - -import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP; - -public abstract class AbstractClassBuilder implements ClassBuilder { - protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {}; - protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {}; - - private String thisName; - - private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings(); - - private String sourceName; - - private String debugInfo; - - public static class Concrete extends AbstractClassBuilder { - private final ClassVisitor v; - - public Concrete(@NotNull ClassVisitor v) { - this.v = v; - } - - @Override - @NotNull - public ClassVisitor getVisitor() { - return v; - } - } - - @Override - @NotNull - public FieldVisitor newField( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable Object value - ) { - FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value); - if (visitor == null) { - return EMPTY_FIELD_VISITOR; - } - return visitor; - } - - @Override - @NotNull - public MethodVisitor newMethod( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable String[] exceptions - ) { - MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions); - if (visitor == null) { - return EMPTY_METHOD_VISITOR; - } - return visitor; - } - - @Override - @NotNull - public JvmSerializationBindings getSerializationBindings() { - return serializationBindings; - } - - @Override - @NotNull - public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) { - return getVisitor().visitAnnotation(desc, visible); - } - - @Override - public void done() { - getVisitor().visitSource(sourceName, debugInfo); - getVisitor().visitEnd(); - } - - @Override - public void defineClass( - @Nullable PsiElement origin, - int version, - int access, - @NotNull String name, - @Nullable String signature, - @NotNull String superName, - @NotNull String[] interfaces - ) { - thisName = name; - getVisitor().visit(version, access, name, signature, superName, interfaces); - } - - @Override - public void visitSource(@NotNull String name, @Nullable String debug) { - assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name; - sourceName = name; - debugInfo = debug; - } - - @Override - public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) { - if (!GENERATE_SMAP) return; - - List fileMappings = smap.getResultMappings(); - if (fileMappings.isEmpty()) return; - - visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax)); - } - - @Override - public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) { - getVisitor().visitOuterClass(owner, name, desc); - } - - @Override - public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) { - getVisitor().visitInnerClass(name, outerName, innerName, access); - } - - @Override - @NotNull - public String getThisName() { - assert thisName != null : "This name isn't set"; - return thisName; - } -} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 deleted file mode 100644 index 6e5bf2b6259..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilder.java.201 +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.codegen; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.codegen.inline.SourceMapper; -import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; -import org.jetbrains.org.objectweb.asm.*; - -public interface ClassBuilder { - @NotNull - FieldVisitor newField( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable Object value - ); - - @NotNull - MethodVisitor newMethod( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable String[] exceptions - ); - - @NotNull - JvmSerializationBindings getSerializationBindings(); - - @NotNull - AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible); - - void done(); - - @NotNull - ClassVisitor getVisitor(); - - void defineClass( - @Nullable PsiElement origin, - int version, - int access, - @NotNull String name, - @Nullable String signature, - @NotNull String superName, - @NotNull String[] interfaces - ); - - void visitSource(@NotNull String name, @Nullable String debug); - - void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax); - - void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc); - - void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access); - - @NotNull - String getThisName(); -} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderRecord.kt.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderRecord.kt.201 deleted file mode 100644 index 9bbdd111b61..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderRecord.kt.201 +++ /dev/null @@ -1,11 +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.codegen - -@Suppress("UNUSED_PARAMETER", "unused") -fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) { - // newRecordComponent(name, desc, signature) -} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 deleted file mode 100644 index 998b33ff552..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilder.java.201 +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.codegen; - -import com.intellij.psi.PsiElement; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.codegen.inline.SourceMapper; -import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings; -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin; -import org.jetbrains.org.objectweb.asm.*; - -public abstract class DelegatingClassBuilder implements ClassBuilder { - @NotNull - protected abstract ClassBuilder getDelegate(); - - @NotNull - @Override - public FieldVisitor newField( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable Object value - ) { - return getDelegate().newField(origin, access, name, desc, signature, value); - } - - @NotNull - @Override - public MethodVisitor newMethod( - @NotNull JvmDeclarationOrigin origin, - int access, - @NotNull String name, - @NotNull String desc, - @Nullable String signature, - @Nullable String[] exceptions - ) { - return getDelegate().newMethod(origin, access, name, desc, signature, exceptions); - } - - @NotNull - @Override - public JvmSerializationBindings getSerializationBindings() { - return getDelegate().getSerializationBindings(); - } - - @NotNull - @Override - public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) { - return getDelegate().newAnnotation(desc, visible); - } - - @Override - public void done() { - getDelegate().done(); - } - - @NotNull - @Override - public ClassVisitor getVisitor() { - return getDelegate().getVisitor(); - } - - @Override - public void defineClass( - @Nullable PsiElement origin, - int version, - int access, - @NotNull String name, - @Nullable String signature, - @NotNull String superName, - @NotNull String[] interfaces - ) { - getDelegate().defineClass(origin, version, access, name, signature, superName, interfaces); - } - - @Override - public void visitSource(@NotNull String name, @Nullable String debug) { - getDelegate().visitSource(name, debug); - } - - @Override - public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) { - getDelegate().visitSMAP(smap, backwardsCompatibleSyntax); - } - - @Override - public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) { - getDelegate().visitOuterClass(owner, name, desc); - } - - @Override - public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) { - getDelegate().visitInnerClass(name, outerName, innerName, access); - } - - @NotNull - @Override - public String getThisName() { - return getDelegate().getThisName(); - } -} diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 deleted file mode 100644 index 774af1054df..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/TypeAnnotatedFrames.kt.201 +++ /dev/null @@ -1,11 +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.codegen.optimization.common - -import org.jetbrains.org.objectweb.asm.tree.analysis.BasicValue -import org.jetbrains.org.objectweb.asm.tree.analysis.Frame - -typealias TypeAnnotatedFrames = Array?> \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 deleted file mode 100644 index ebab87ad525..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JvmMethodExceptionTypes.kt.201 +++ /dev/null @@ -1,8 +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.codegen.state - -typealias JvmMethodExceptionTypes = Array? \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/JavaLanguageLevel.kt.201 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/JavaLanguageLevel.kt.201 deleted file mode 100644 index 423b6b10229..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/JavaLanguageLevel.kt.201 +++ /dev/null @@ -1,14 +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.cli.jvm.compiler - -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.LanguageLevelProjectExtension -import com.intellij.pom.java.LanguageLevel - -fun Project.setupHighestLanguageLevel() { - // LanguageLevelProjectExtension.getInstance(this).languageLevel = LanguageLevel.JDK_15_PREVIEW -} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 deleted file mode 100644 index 1a12369aa17..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.201 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2018 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.cli.jvm.compiler - -fun setupIdeaStandaloneExecution() { - System.getProperties().setProperty("idea.plugins.compatible.build", "201.6668.13") - System.getProperties().setProperty("project.structure.add.tools.jar.to.new.jdk", "false") - System.getProperties().setProperty("psi.track.invalidation", "true") - System.getProperties().setProperty("psi.incremental.reparse.depth.limit", "1000") - System.getProperties().setProperty("ide.hide.excluded.files", "false") - System.getProperties().setProperty("ast.loading.filter", "false") -} \ No newline at end of file diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/lightClassPlatformUtils.kt.201 b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/lightClassPlatformUtils.kt.201 deleted file mode 100644 index 8ba9866df58..00000000000 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/lightClassPlatformUtils.kt.201 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2021 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.asJava.classes - -import com.intellij.psi.PsiElement -import com.intellij.psi.augment.PsiAugmentProvider - -internal fun collectAugments(element: PsiElement, type: Class): List { - return PsiAugmentProvider.collectAugments(element, type) -} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 deleted file mode 100644 index cb79b6d81b2..00000000000 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.kt.201 +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.load.java.structure.impl - -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiTypeParameter -import com.intellij.psi.search.SearchScope -import org.jetbrains.kotlin.asJava.KtLightClassMarker -import org.jetbrains.kotlin.asJava.isSyntheticValuesOrValueOfMethod -import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.load.java.structure.* -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.KtPsiUtil - -class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl(psiClass), VirtualFileBoundJavaClass, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl { - init { - assert(psiClass !is PsiTypeParameter) { "PsiTypeParameter should be wrapped in JavaTypeParameter, not JavaClass: use JavaClassifier.create()" } - } - - override val innerClassNames: Collection - get() = psi.innerClasses.mapNotNull { it.name?.takeIf(Name::isValidIdentifier)?.let(Name::identifier) } - - override fun findInnerClass(name: Name): JavaClass? { - return psi.findInnerClassByName(name.asString(), false)?.let(::JavaClassImpl) - } - - override val fqName: FqName? - get() { - val qualifiedName = psi.qualifiedName - return if (qualifiedName == null) null else FqName(qualifiedName) - } - - override val name: Name - get() = KtPsiUtil.safeName(psi.name) - - override val isInterface: Boolean - get() = psi.isInterface - - override val isAnnotationType: Boolean - get() = psi.isAnnotationType - - override val isEnum: Boolean - get() = psi.isEnum - - override val isRecord: Boolean - get() = false - - override val isSealed: Boolean - get() = JavaElementUtil.isSealed(this) - - override val permittedTypes: Collection - get() = emptyList() - - override val outerClass: JavaClassImpl? - get() { - val outer = psi.containingClass - return if (outer == null) null else JavaClassImpl(outer) - } - - override val typeParameters: List - get() = typeParameters(psi.typeParameters) - - override val supertypes: Collection - get() = classifierTypes(psi.superTypes) - - override val methods: Collection - get() { - assertNotLightClass() - // We apply distinct here because PsiClass#getMethods() can return duplicate PSI methods, for example in Lombok (see KT-11778) - // Return type seems to be null for example for the 'clone' Groovy method generated by @AutoClone (see EA-73795) - return methods( - psi.methods.filter { method -> - !method.isConstructor && method.returnType != null && !(isEnum && isSyntheticValuesOrValueOfMethod(method)) - } - ).distinct() - } - - override val fields: Collection - get() { - assertNotLightClass() - return fields(psi.fields.filter { - // ex. Android plugin generates LightFields for resources started from '.' (.DS_Store file etc) - Name.isValidIdentifier(it.name) - }) - } - - override val constructors: Collection - get() { - assertNotLightClass() - // See for example org.jetbrains.plugins.scala.lang.psi.light.ScFunctionWrapper, - // which is present in getConstructors(), but its isConstructor() returns false - return constructors(psi.constructors.filter { method -> method.isConstructor }) - } - - override val recordComponents: Collection - get() { - assertNotLightClass() - - return emptyList() - } - - override fun hasDefaultConstructor() = !isInterface && constructors.isEmpty() - - override val isAbstract: Boolean - get() = JavaElementUtil.isAbstract(this) - - override val isStatic: Boolean - get() = JavaElementUtil.isStatic(this) - - override val isFinal: Boolean - get() = JavaElementUtil.isFinal(this) - - override val visibility: Visibility - get() = JavaElementUtil.getVisibility(this) - - override val lightClassOriginKind: LightClassOriginKind? - get() = (psi as? KtLightClassMarker)?.originKind - - override val virtualFile: VirtualFile? - get() = psi.containingFile?.virtualFile - - override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = psi.containingFile.virtualFile in scope - - override fun getAnnotationOwnerPsi() = psi.modifierList - - private fun assertNotLightClass() { - val psiClass = psi - if (psiClass !is KtLightClassMarker) return - - val message = "Querying members of JavaClass created for $psiClass of type ${psiClass::class.java} defined in file ${psiClass.containingFile?.virtualFile?.canonicalPath}" - LOGGER.error(message) - } - - companion object { - private val LOGGER = Logger.getInstance(JavaClassImpl::class.java) - } -} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 deleted file mode 100644 index 9696b156fd9..00000000000 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java.201 +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.load.java.structure.impl; - -import com.intellij.codeInsight.ExternalAnnotationsManager; -import com.intellij.psi.PsiAnnotation; -import com.intellij.psi.PsiAnnotationOwner; -import com.intellij.psi.PsiModifier; -import com.intellij.psi.PsiModifierListOwner; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.descriptors.Visibilities; -import org.jetbrains.kotlin.descriptors.Visibility; -import org.jetbrains.kotlin.descriptors.java.JavaVisibilities; -import org.jetbrains.kotlin.load.java.structure.JavaAnnotation; -import org.jetbrains.kotlin.name.FqName; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; - -import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectionFromPsiArrayUtil.annotations; -import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectionFromPsiArrayUtil.nullabilityAnnotations; - -/* package */ class JavaElementUtil { - private JavaElementUtil() { - } - - public static boolean isAbstract(@NotNull JavaModifierListOwnerImpl owner) { - return owner.getPsi().hasModifierProperty(PsiModifier.ABSTRACT); - } - - public static boolean isStatic(@NotNull JavaModifierListOwnerImpl owner) { - return owner.getPsi().hasModifierProperty(PsiModifier.STATIC); - } - - public static boolean isFinal(@NotNull JavaModifierListOwnerImpl owner) { - return owner.getPsi().hasModifierProperty(PsiModifier.FINAL); - } - - public static boolean isSealed(@NotNull JavaModifierListOwnerImpl owner) { - return false; - } - - @NotNull - public static Visibility getVisibility(@NotNull JavaModifierListOwnerImpl owner) { - PsiModifierListOwner psiOwner = owner.getPsi(); - if (psiOwner.hasModifierProperty(PsiModifier.PUBLIC)) { - return Visibilities.Public.INSTANCE; - } - if (psiOwner.hasModifierProperty(PsiModifier.PRIVATE)) { - return Visibilities.Private.INSTANCE; - } - if (psiOwner.hasModifierProperty(PsiModifier.PROTECTED)) { - return owner.isStatic() ? JavaVisibilities.ProtectedStaticVisibility.INSTANCE : JavaVisibilities.ProtectedAndPackage.INSTANCE; - } - return JavaVisibilities.PackageVisibility.INSTANCE; - } - - @NotNull - public static Collection getAnnotations(@NotNull JavaAnnotationOwnerImpl owner) { - PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi(); - if (annotationOwnerPsi != null) { - return annotations(annotationOwnerPsi.getAnnotations()); - } - return Collections.emptyList(); - } - - @Nullable - private static PsiAnnotation[] getExternalAnnotations(@NotNull JavaModifierListOwnerImpl modifierListOwner) { - PsiModifierListOwner psiModifierListOwner = modifierListOwner.getPsi(); - ExternalAnnotationsManager externalAnnotationManager = ExternalAnnotationsManager - .getInstance(psiModifierListOwner.getProject()); - return externalAnnotationManager.findExternalAnnotations(psiModifierListOwner); - } - - @NotNull - static - Collection getRegularAndExternalAnnotations(@NotNull T owner) { - PsiAnnotation[] externalAnnotations = getExternalAnnotations(owner); - if (externalAnnotations == null) { - return getAnnotations(owner); - } - Collection annotations = new ArrayList<>(getAnnotations(owner)); - annotations.addAll(nullabilityAnnotations(externalAnnotations)); - return annotations; - } - - - @Nullable - public static JavaAnnotation findAnnotation(@NotNull JavaAnnotationOwnerImpl owner, @NotNull FqName fqName) { - PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi(); - if (annotationOwnerPsi != null) { - PsiAnnotation psiAnnotation = annotationOwnerPsi.findAnnotation(fqName.asString()); - return psiAnnotation == null ? null : new JavaAnnotationImpl(psiAnnotation); - } - return null; - } -} diff --git a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 b/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 deleted file mode 100644 index 8de96673afb..00000000000 --- a/compiler/resolution.common.jvm/src/org/jetbrains/kotlin/load/java/structure/impl/classFiles/BinaryJavaClass.kt.201 +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.load.java.structure.impl.classFiles - -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.search.SearchScope -import gnu.trove.THashMap -import org.jetbrains.kotlin.builtins.PrimitiveType -import org.jetbrains.kotlin.load.java.structure.* -import org.jetbrains.kotlin.load.java.structure.impl.VirtualFileBoundJavaClass -import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaAnnotation.Companion.computeTypeParameterBound -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.utils.SmartList -import org.jetbrains.kotlin.utils.addIfNotNull -import org.jetbrains.org.objectweb.asm.* -import java.text.CharacterIterator -import java.text.StringCharacterIterator - -class BinaryJavaClass( - override val virtualFile: VirtualFile, - override val fqName: FqName, - internal val context: ClassifierResolutionContext, - private val signatureParser: BinaryClassSignatureParser, - override var access: Int = 0, - override val outerClass: JavaClass?, - classContent: ByteArray? = null -) : ClassVisitor(ASM_API_VERSION_FOR_CLASS_READING), VirtualFileBoundJavaClass, BinaryJavaModifierListOwner, MutableJavaAnnotationOwner { - override val annotations: MutableCollection = SmartList() - - override lateinit var typeParameters: List - override lateinit var supertypes: List - - override val methods = arrayListOf() - override val fields = arrayListOf() - override val constructors = arrayListOf() - override val recordComponents = arrayListOf() - - override fun hasDefaultConstructor() = false // never: all constructors explicit in bytecode - - private lateinit var myInternalName: String - - // In accordance with JVMS, super class always comes before the interface list - private val superclass: JavaClassifierType? get() = supertypes.firstOrNull() - private val implementedInterfaces: List get() = supertypes.drop(1) - - override val annotationsByFqName by buildLazyValueForMap() - - // Short name of a nested class of this class -> access flags as seen in the InnerClasses attribute value. - // Note that it doesn't include classes mentioned in other InnerClasses attribute values (those which are not nested in this class). - private val ownInnerClassNameToAccess: MutableMap = THashMap() - - override val innerClassNames get() = ownInnerClassNameToAccess.keys - - override val name: Name - get() = fqName.shortName() - - override val isInterface get() = isSet(Opcodes.ACC_INTERFACE) - override val isAnnotationType get() = isSet(Opcodes.ACC_ANNOTATION) - override val isEnum get() = isSet(Opcodes.ACC_ENUM) - - override val isRecord get() = false - - override val lightClassOriginKind: LightClassOriginKind? get() = null - - override val isSealed: Boolean get() = permittedTypes.isNotEmpty() - override val permittedTypes = arrayListOf() - - override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false - - override fun visitTypeAnnotation(typeRef: Int, typePath: TypePath?, descriptor: String?, visible: Boolean): AnnotationVisitor? { - if (descriptor == null) - return null - - fun getTargetType(baseType: JavaType) = - if (typePath != null) BinaryJavaAnnotation.computeTargetType(baseType, typePath) else baseType - - val typeReference = TypeReference(typeRef) - - val annotationOwner = when (typeReference.sort) { - TypeReference.CLASS_EXTENDS -> - getTargetType(if (typeReference.superTypeIndex == -1) superclass!! else implementedInterfaces[typeReference.superTypeIndex]) - TypeReference.CLASS_TYPE_PARAMETER -> typeParameters[typeReference.typeParameterIndex] - TypeReference.CLASS_TYPE_PARAMETER_BOUND -> getTargetType(computeTypeParameterBound(typeParameters, typeReference)) - else -> return null - } - - if (annotationOwner !is MutableJavaAnnotationOwner) return null - - return BinaryJavaAnnotation.addAnnotation(annotationOwner, descriptor, context, signatureParser, isFreshlySupportedAnnotation = true) - } - - override fun visitEnd() { - methods.trimToSize() - fields.trimToSize() - constructors.trimToSize() - } - - init { - try { - ClassReader(classContent ?: virtualFile.contentsToByteArray()).accept( - this, - ClassReader.SKIP_CODE or ClassReader.SKIP_FRAMES - ) - } catch (e: Throwable) { - throw IllegalStateException("Could not read class: $virtualFile", e) - } - } - - override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array?): MethodVisitor? { - if (access.isSet(Opcodes.ACC_SYNTHETIC) || access.isSet(Opcodes.ACC_BRIDGE) || name == "") return null - - // skip semi-synthetic enum methods - if (isEnum) { - if (name == "values" && desc.startsWith("()")) return null - if (name == "valueOf" && desc.startsWith("(Ljava/lang/String;)")) return null - } - - val (member, visitor) = BinaryJavaMethodBase.create(name, access, desc, signature, this, context.copyForMember(), signatureParser) - - when (member) { - is JavaMethod -> methods.add(member) - is JavaConstructor -> constructors.add(member) - else -> error("Unexpected member: ${member.javaClass}") - } - - return visitor - } - - override fun visitInnerClass(name: String, outerName: String?, innerName: String?, access: Int) { - if (access.isSet(Opcodes.ACC_SYNTHETIC)) return - if (innerName == null || outerName == null) return - - // Do not read InnerClasses attribute values where full name != outer + $ + inner; treat those classes as top level instead. - // This is possible for example for Groovy-generated $Trait$FieldHelper classes. - if (name == "$outerName$$innerName") { - context.addInnerClass(name, outerName, innerName) - - if (myInternalName == outerName) { - ownInnerClassNameToAccess[context.mapInternalNameToClassId(name).shortClassName] = access - } - } - } - - override fun visit( - version: Int, - access: Int, - name: String, - signature: String?, - superName: String?, - interfaces: Array? - ) { - this.access = this.access or access - this.myInternalName = name - - if (signature != null) { - parseClassSignature(signature) - } else { - this.typeParameters = emptyList() - this.supertypes = mutableListOf().apply { - addIfNotNull(superName?.convertInternalNameToClassifierType()) - interfaces?.forEach { - addIfNotNull(it.convertInternalNameToClassifierType()) - } - } - } - } - - private fun parseClassSignature(signature: String) { - val iterator = StringCharacterIterator(signature) - this.typeParameters = - signatureParser - .parseTypeParametersDeclaration(iterator, context) - .also(context::addTypeParameters) - - val supertypes = SmartList() - supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context)) - while (iterator.current() != CharacterIterator.DONE) { - supertypes.addIfNotNull(signatureParser.parseClassifierRefSignature(iterator, context)) - } - this.supertypes = supertypes - } - - private fun String.convertInternalNameToClassifierType(): JavaClassifierType = - PlainJavaClassifierType({ context.resolveByInternalName(this) }, emptyList()) - - override fun visitField(access: Int, name: String, desc: String, signature: String?, value: Any?): FieldVisitor? { - if (access.isSet(Opcodes.ACC_SYNTHETIC)) return null - - val type = signatureParser.parseTypeString(StringCharacterIterator(signature ?: desc), context) - val processedValue = processValue(value, type) - val filed = BinaryJavaField(Name.identifier(name), access, this, access.isSet(Opcodes.ACC_ENUM), type, processedValue) - - fields.add(filed) - - return AnnotationsCollectorFieldVisitor(filed, context, signatureParser) - } - - /** - * All the int-like values (including Char/Boolean) come in visitor as Integer instances - */ - private fun processValue(value: Any?, fieldType: JavaType): Any? { - if (fieldType !is JavaPrimitiveType || fieldType.type == null || value !is Int) return value - - return when (fieldType.type) { - PrimitiveType.BOOLEAN -> { - when (value) { - 0 -> false - 1 -> true - else -> value - } - } - PrimitiveType.CHAR -> value.toChar() - else -> value - } - } - - override fun visitAnnotation(desc: String, visible: Boolean) = - BinaryJavaAnnotation.addAnnotation(this, desc, context, signatureParser) - - override fun findInnerClass(name: Name): JavaClass? = findInnerClass(name, classFileContent = null) - - fun findInnerClass(name: Name, classFileContent: ByteArray?): JavaClass? { - val access = ownInnerClassNameToAccess[name] ?: return null - - return virtualFile.parent.findChild("${virtualFile.nameWithoutExtension}$$name.class")?.let { - BinaryJavaClass( - it, fqName.child(name), context.copyForMember(), signatureParser, access, this, - classFileContent - ) - } - } -} diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 deleted file mode 100644 index 2e42e3a75b2..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtParsingTestCase.java.201 +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.test.testFramework; - -import com.intellij.core.CoreASTFactory; -import com.intellij.ide.util.AppPropertiesComponentImpl; -import com.intellij.ide.util.PropertiesComponent; -import com.intellij.lang.*; -import com.intellij.lang.impl.PsiBuilderFactoryImpl; -import com.intellij.mock.*; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.editor.EditorFactory; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.fileEditor.impl.LoadTextUtil; -import com.intellij.openapi.fileTypes.FileTypeFactory; -import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.fileTypes.FileTypeRegistry; -import com.intellij.openapi.options.SchemeManagerFactory; -import com.intellij.openapi.progress.EmptyProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.impl.CoreProgressManager; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.Key; -import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.CharsetToolkit; -import com.intellij.pom.PomModel; -import com.intellij.pom.core.impl.PomModelImpl; -import com.intellij.pom.tree.TreeAspect; -import com.intellij.psi.*; -import com.intellij.psi.impl.*; -import com.intellij.psi.util.CachedValuesManager; -import com.intellij.testFramework.LightVirtualFile; -import com.intellij.testFramework.MockSchemeManagerFactory; -import com.intellij.testFramework.TestDataFile; -import com.intellij.util.CachedValuesManagerImpl; -import com.intellij.util.Function; -import junit.framework.TestCase; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.idea.KotlinFileType; -import org.picocontainer.ComponentAdapter; -import org.picocontainer.MutablePicoContainer; - -import java.io.File; -import java.io.IOException; -import java.util.Set; - -@SuppressWarnings("ALL") -public abstract class KtParsingTestCase extends KtPlatformLiteFixture { - public static final Key HARD_REF_TO_DOCUMENT_KEY = Key.create("HARD_REF_TO_DOCUMENT_KEY"); - protected String myFilePrefix = ""; - protected String myFileExt; - protected final String myFullDataPath; - protected PsiFile myFile; - private MockPsiManager myPsiManager; - private PsiFileFactoryImpl myFileFactory; - protected Language myLanguage; - private final ParserDefinition[] myDefinitions; - private final boolean myLowercaseFirstLetter; - - protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, @NotNull ParserDefinition... definitions) { - this(dataPath, fileExt, false, definitions); - } - - protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, boolean lowercaseFirstLetter, @NotNull ParserDefinition... definitions) { - myDefinitions = definitions; - myFullDataPath = getTestDataPath() + "/" + dataPath; - myFileExt = fileExt; - myLowercaseFirstLetter = lowercaseFirstLetter; - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - initApplication(); - ComponentAdapter component = getApplication().getPicoContainer().getComponentAdapter(ProgressManager.class.getName()); - - Extensions.registerAreaClass("IDEA_PROJECT", null); - myProject = new MockProjectEx(getTestRootDisposable()); - myPsiManager = new MockPsiManager(myProject); - myFileFactory = new PsiFileFactoryImpl(myPsiManager); - MutablePicoContainer appContainer = getApplication().getPicoContainer(); - final MockEditorFactory editorFactory = new MockEditorFactory(); - MockFileTypeManager mockFileTypeManager = new MockFileTypeManager(KotlinFileType.INSTANCE); - MockFileDocumentManagerImpl mockFileDocumentManager = new MockFileDocumentManagerImpl(new Function() { - @Override - public Document fun(CharSequence charSequence) { - return editorFactory.createDocument(charSequence); - } - }, HARD_REF_TO_DOCUMENT_KEY); - - registerApplicationService(PropertiesComponent.class, new AppPropertiesComponentImpl()); - registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl()); - registerApplicationService(DefaultASTFactory.class, new CoreASTFactory()); - registerApplicationService(SchemeManagerFactory.class, new MockSchemeManagerFactory()); - registerApplicationService(FileTypeManager.class, mockFileTypeManager); - registerApplicationService(FileDocumentManager.class, mockFileDocumentManager); - - registerApplicationService(ProgressManager.class, new CoreProgressManager()); - - registerComponentInstance(appContainer, FileTypeRegistry.class, mockFileTypeManager); - registerComponentInstance(appContainer, FileTypeManager.class, mockFileTypeManager); - registerComponentInstance(appContainer, EditorFactory.class, editorFactory); - registerComponentInstance(appContainer, FileDocumentManager.class, mockFileDocumentManager); - registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager()); - - - myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager))); - myProject.registerService(PsiManager.class, myPsiManager); - - this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class); - registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class); - - for (ParserDefinition definition : myDefinitions) { - addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition); - } - if (myDefinitions.length > 0) { - configureFromParserDefinition(myDefinitions[0], myFileExt); - } - - // That's for reparse routines - final PomModelImpl pomModel = new PomModelImpl(myProject); - myProject.registerService(PomModel.class, pomModel); - new TreeAspect(pomModel); - } - - public void configureFromParserDefinition(ParserDefinition definition, String extension) { - myLanguage = definition.getFileNodeType().getLanguage(); - myFileExt = extension; - addExplicitExtension(LanguageParserDefinitions.INSTANCE, this.myLanguage, definition); - registerComponentInstance( - getApplication().getPicoContainer(), FileTypeManager.class, - new MockFileTypeManager(new MockLanguageFileType(myLanguage, myFileExt))); - } - - protected void addExplicitExtension(final LanguageExtension instance, final Language language, final T object) { - instance.addExplicitExtension(language, object); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - instance.removeExplicitExtension(language, object); - } - }); - } - - @Override - protected void registerExtensionPoint(final ExtensionPointName extensionPointName, Class aClass) { - super.registerExtensionPoint(extensionPointName, aClass); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - Extensions.getRootArea().unregisterExtensionPoint(extensionPointName.getName()); - } - }); - } - - protected void registerApplicationService(final Class aClass, T object) { - getApplication().registerService(aClass, object); - Disposer.register(myProject, new Disposable() { - @Override - public void dispose() { - getApplication().getPicoContainer().unregisterComponent(aClass.getName()); - } - }); - } - - public MockProjectEx getProject() { - return myProject; - } - - public MockPsiManager getPsiManager() { - return myPsiManager; - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - myFile = null; - myProject = null; - myPsiManager = null; - } - - protected String getTestDataPath() { - return PathManager.getHomePath(); - } - - @NotNull - public final String getTestName() { - return getTestName(myLowercaseFirstLetter); - } - - protected boolean includeRanges() { - return false; - } - - protected boolean skipSpaces() { - return false; - } - - protected boolean checkAllPsiRoots() { - return true; - } - - protected void doTest(boolean checkResult) { - String name = getTestName(); - try { - String text = loadFile(name + "." + myFileExt); - myFile = createPsiFile(name, text); - ensureParsed(myFile); - assertEquals("light virtual file text mismatch", text, ((LightVirtualFile)myFile.getVirtualFile()).getContent().toString()); - assertEquals("virtual file text mismatch", text, LoadTextUtil.loadText(myFile.getVirtualFile())); - assertEquals("doc text mismatch", text, myFile.getViewProvider().getDocument().getText()); - assertEquals("psi text mismatch", text, myFile.getText()); - ensureCorrectReparse(myFile); - if (checkResult){ - checkResult(name, myFile); - } - else{ - toParseTreeText(myFile, skipSpaces(), includeRanges()); - } - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - protected void doTest(String suffix) throws IOException { - String name = getTestName(); - String text = loadFile(name + "." + myFileExt); - myFile = createPsiFile(name, text); - ensureParsed(myFile); - assertEquals(text, myFile.getText()); - checkResult(name + suffix, myFile); - } - - protected void doCodeTest(String code) throws IOException { - String name = getTestName(); - myFile = createPsiFile("a", code); - ensureParsed(myFile); - assertEquals(code, myFile.getText()); - checkResult(myFilePrefix + name, myFile); - } - - protected PsiFile createPsiFile(String name, String text) { - return createFile(name + "." + myFileExt, text); - } - - protected PsiFile createFile(@NonNls String name, String text) { - LightVirtualFile virtualFile = new LightVirtualFile(name, myLanguage, text); - virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET); - return createFile(virtualFile); - } - - protected PsiFile createFile(LightVirtualFile virtualFile) { - return myFileFactory.trySetupPsiForFile(virtualFile, myLanguage, true, false); - } - - protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws IOException { - doCheckResult(myFullDataPath, file, checkAllPsiRoots(), targetDataName, skipSpaces(), includeRanges()); - } - - public static void doCheckResult(String testDataDir, - PsiFile file, - boolean checkAllPsiRoots, - String targetDataName, - boolean skipSpaces, - boolean printRanges) throws IOException { - FileViewProvider provider = file.getViewProvider(); - Set languages = provider.getLanguages(); - - if (!checkAllPsiRoots || languages.size() == 1) { - doCheckResult(testDataDir, targetDataName + ".txt", toParseTreeText(file, skipSpaces, printRanges).trim()); - return; - } - - for (Language language : languages) { - PsiFile root = provider.getPsi(language); - String expectedName = targetDataName + "." + language.getID() + ".txt"; - doCheckResult(testDataDir, expectedName, toParseTreeText(root, skipSpaces, printRanges).trim()); - } - } - - protected void checkResult(String actual) throws IOException { - String name = getTestName(); - doCheckResult(myFullDataPath, myFilePrefix + name + ".txt", actual); - } - - protected void checkResult(@TestDataFile @NonNls String targetDataName, String actual) throws IOException { - doCheckResult(myFullDataPath, targetDataName, actual); - } - - public static void doCheckResult(String fullPath, String targetDataName, String actual) throws IOException { - String expectedFileName = fullPath + File.separatorChar + targetDataName; - KtUsefulTestCase.assertSameLinesWithFile(expectedFileName, actual); - } - - protected static String toParseTreeText(PsiElement file, boolean skipSpaces, boolean printRanges) { - return DebugUtil.psiToString(file, skipSpaces, printRanges); - } - - protected String loadFile(@NonNls @TestDataFile String name) throws IOException { - return loadFileDefault(myFullDataPath, name); - } - - public static String loadFileDefault(String dir, String name) throws IOException { - return FileUtil.loadFile(new File(dir, name), CharsetToolkit.UTF8, true).trim(); - } - - public static void ensureParsed(PsiFile file) { - file.accept(new PsiElementVisitor() { - @Override - public void visitElement(PsiElement element) { - element.acceptChildren(this); - } - }); - } - - public static void ensureCorrectReparse(@NotNull PsiFile file) { - String psiToStringDefault = DebugUtil.psiToString(file, false, false); - String fileText = file.getText(); - DiffLog diffLog = (new BlockSupportImpl()).reparseRange( - file, file.getNode(), TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText); - diffLog.performActualPsiChange(file); - - TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false)); - } -} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 deleted file mode 100644 index e651e41048b..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.201 +++ /dev/null @@ -1,1187 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.test.testFramework; - -import com.intellij.codeInsight.CodeInsightSettings; -import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; -import com.intellij.diagnostic.PerformanceWatcher; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.Application; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileTypes.StdFileTypes; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.IconLoader; -import com.intellij.openapi.util.JDOMUtil; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileVisitor; -import com.intellij.psi.PsiDocumentManager; -import com.intellij.psi.codeStyle.CodeStyleSettings; -import com.intellij.psi.impl.DocumentCommitProcessor; -import com.intellij.psi.impl.DocumentCommitThread; -import com.intellij.psi.impl.source.PostprocessReformattingAspect; -import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.testFramework.*; -import com.intellij.testFramework.exceptionCases.AbstractExceptionCase; -import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy; -import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.PeekableIterator; -import com.intellij.util.containers.PeekableIteratorWrapper; -import com.intellij.util.indexing.FileBasedIndex; -import com.intellij.util.indexing.FileBasedIndexImpl; -import com.intellij.util.lang.CompoundRuntimeException; -import com.intellij.util.ui.UIUtil; -import gnu.trove.Equality; -import gnu.trove.THashSet; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; -import org.jdom.Element; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.testFramework.MockComponentManagerCreationTracer; -import org.jetbrains.kotlin.types.AbstractTypeChecker; -import org.jetbrains.kotlin.types.FlexibleTypeImpl; -import org.junit.Assert; -import org.junit.ComparisonFailure; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -@SuppressWarnings("ALL") -public abstract class KtUsefulTestCase extends TestCase { - public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; - public static final String TEMP_DIR_MARKER = "unitTest_"; - public static final boolean OVERWRITE_TESTDATA = Boolean.getBoolean("idea.tests.overwrite.data"); - - private static final String ORIGINAL_TEMP_DIR = FileUtil.getTempDirectory(); - - private static final Map TOTAL_SETUP_COST_MILLIS = new HashMap<>(); - private static final Map TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>(); - - private Application application; - - static { - IdeaForkJoinWorkerThreadFactory.setupPoisonFactory(); - Logger.setFactory(TestLoggerFactory.class); - } - protected static final Logger LOG = Logger.getInstance(KtUsefulTestCase.class); - - @NotNull - private final Disposable myTestRootDisposable = new TestDisposable(); - - static Path ourPathToKeep; - private final List myPathsToKeep = new ArrayList<>(); - - private String myTempDir; - - private static final String DEFAULT_SETTINGS_EXTERNALIZED; - private static final CodeInsightSettings defaultSettings = new CodeInsightSettings(); - static { - // Radar #5755208: Command line Java applications need a way to launch without a Dock icon. - System.setProperty("apple.awt.UIElement", "true"); - - try { - Element oldS = new Element("temp"); - defaultSettings.writeExternal(oldS); - DEFAULT_SETTINGS_EXTERNALIZED = JDOMUtil.writeElement(oldS); - } - catch (Exception e) { - throw new RuntimeException(e); - } - - // -- KOTLIN ADDITIONAL START -- - - FlexibleTypeImpl.RUN_SLOW_ASSERTIONS = true; - AbstractTypeChecker.RUN_SLOW_ASSERTIONS = true; - - // -- KOTLIN ADDITIONAL END -- - } - - /** - * Pass here the exception you want to be thrown first - * E.g.
-     * {@code
-     *   void tearDown() {
-     *     try {
-     *       doTearDowns();
-     *     }
-     *     catch(Exception e) {
-     *       addSuppressedException(e);
-     *     }
-     *     finally {
-     *       super.tearDown();
-     *     }
-     *   }
-     * }
-     * 
- * - */ - protected void addSuppressedException(@NotNull Throwable e) { - List list = mySuppressedExceptions; - if (list == null) { - mySuppressedExceptions = list = new SmartList<>(); - } - list.add(e); - } - private List mySuppressedExceptions; - - - public KtUsefulTestCase() { - } - - public KtUsefulTestCase(@NotNull String name) { - super(name); - } - - protected boolean shouldContainTempFiles() { - return true; - } - - @Override - protected void setUp() throws Exception { - // -- KOTLIN ADDITIONAL START -- - application = ApplicationManager.getApplication(); - - if (application != null && application.isDisposed()) { - MockComponentManagerCreationTracer.diagnoseDisposedButNotClearedApplication(application); - } - // -- KOTLIN ADDITIONAL END -- - - super.setUp(); - - if (shouldContainTempFiles()) { - IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - String testName = null; - if (policy != null) { - testName = policy.getPerTestTempDirName(); - } - if (testName == null) { - testName = FileUtil.sanitizeFileName(getTestName(true)); - } - testName = new File(testName).getName(); // in case the test name contains file separators - myTempDir = FileUtil.createTempDirectory(TEMP_DIR_MARKER + testName, "", false).getPath(); - FileUtil.resetCanonicalTempPathCache(myTempDir); - } - - boolean isStressTest = isStressTest(); - ApplicationInfoImpl.setInStressTest(isStressTest); - if (isPerformanceTest()) { - Timings.getStatistics(); - } - - // turn off Disposer debugging for performance tests - Disposer.setDebugMode(!isStressTest); - - if (isIconRequired()) { - // ensure that IconLoader will use dummy empty icon - IconLoader.deactivate(); - //IconManager.activate(); - } - } - - protected boolean isIconRequired() { - return false; - } - - @Override - protected void tearDown() throws Exception { - try { - // don't use method references here to make stack trace reading easier - //noinspection Convert2MethodRef - new RunAll( - () -> { - if (isIconRequired()) { - //IconManager.deactivate(); - } - }, - () -> disposeRootDisposable(), - () -> cleanupSwingDataStructures(), - () -> cleanupDeleteOnExitHookList(), - () -> Disposer.setDebugMode(true), - () -> { - if (shouldContainTempFiles()) { - FileUtil.resetCanonicalTempPathCache(ORIGINAL_TEMP_DIR); - if (hasTmpFilesToKeep()) { - File[] files = new File(myTempDir).listFiles(); - if (files != null) { - for (File file : files) { - if (!shouldKeepTmpFile(file)) { - FileUtil.delete(file); - } - } - } - } - else { - FileUtil.delete(new File(myTempDir)); - } - } - }, - () -> waitForAppLeakingThreads(10, TimeUnit.SECONDS) - ).run(ObjectUtils.notNull(mySuppressedExceptions, Collections.emptyList())); - } - finally { - // -- KOTLIN ADDITIONAL START -- - TestApplicationUtilKt.resetApplicationToNull(application); - application = null; - // -- KOTLIN ADDITIONAL END -- - } - } - - protected final void disposeRootDisposable() { - Disposer.dispose(getTestRootDisposable()); - } - - protected void addTmpFileToKeep(@NotNull File file) { - myPathsToKeep.add(file.getPath()); - } - - private boolean hasTmpFilesToKeep() { - return ourPathToKeep != null && FileUtil.isAncestor(myTempDir, ourPathToKeep.toString(), false) || !myPathsToKeep.isEmpty(); - } - - private boolean shouldKeepTmpFile(@NotNull File file) { - String path = file.getPath(); - if (FileUtil.pathsEqual(path, ourPathToKeep.toString())) return true; - for (String pathToKeep : myPathsToKeep) { - if (FileUtil.pathsEqual(path, pathToKeep)) return true; - } - return false; - } - - private static final Set DELETE_ON_EXIT_HOOK_DOT_FILES; - private static final Class DELETE_ON_EXIT_HOOK_CLASS; - static { - Class aClass; - try { - aClass = Class.forName("java.io.DeleteOnExitHook"); - } - catch (Exception e) { - throw new RuntimeException(e); - } - @SuppressWarnings("unchecked") Set files = ReflectionUtil.getStaticFieldValue(aClass, Set.class, "files"); - DELETE_ON_EXIT_HOOK_CLASS = aClass; - DELETE_ON_EXIT_HOOK_DOT_FILES = files; - } - - @SuppressWarnings("SynchronizeOnThis") - private static void cleanupDeleteOnExitHookList() { - // try to reduce file set retained by java.io.DeleteOnExitHook - List list; - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - if (DELETE_ON_EXIT_HOOK_DOT_FILES.isEmpty()) return; - list = new ArrayList<>(DELETE_ON_EXIT_HOOK_DOT_FILES); - } - for (int i = list.size() - 1; i >= 0; i--) { - String path = list.get(i); - File file = new File(path); - if (file.delete() || !file.exists()) { - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - DELETE_ON_EXIT_HOOK_DOT_FILES.remove(path); - } - } - } - } - - @SuppressWarnings("ConstantConditions") - private static void cleanupSwingDataStructures() throws Exception { - Object manager = ReflectionUtil.getDeclaredMethod(Class.forName("javax.swing.KeyboardManager"), "getCurrentManager").invoke(null); - Map componentKeyStrokeMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "componentKeyStrokeMap"); - componentKeyStrokeMap.clear(); - Map containerMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "containerMap"); - containerMap.clear(); - } - - static void doCheckForSettingsDamage(@NotNull CodeStyleSettings oldCodeStyleSettings, @NotNull CodeStyleSettings currentCodeStyleSettings) { - final CodeInsightSettings settings = CodeInsightSettings.getInstance(); - // don't use method references here to make stack trace reading easier - //noinspection Convert2MethodRef - new RunAll() - .append(() -> { - try { - checkCodeInsightSettingsEqual(defaultSettings, settings); - } - catch (AssertionError error) { - CodeInsightSettings clean = new CodeInsightSettings(); - for (Field field : clean.getClass().getFields()) { - try { - ReflectionUtil.copyFieldValue(clean, settings, field); - } - catch (Exception ignored) { - } - } - throw error; - } - }) - .append(() -> { - currentCodeStyleSettings.getIndentOptions(StdFileTypes.JAVA); - try { - checkCodeStyleSettingsEqual(oldCodeStyleSettings, currentCodeStyleSettings); - } - finally { - currentCodeStyleSettings.clearCodeStyleSettings(); - } - }) - .run(); - } - - @NotNull - public Disposable getTestRootDisposable() { - return myTestRootDisposable; - } - - @Override - protected void runTest() throws Throwable { - final Throwable[] throwables = new Throwable[1]; - - Runnable runnable = () -> { - try { - TestLoggerFactory.onTestStarted(); - super.runTest(); - TestLoggerFactory.onTestFinished(true); - } - catch (InvocationTargetException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e.getTargetException(); - } - catch (IllegalAccessException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e; - } - catch (Throwable e) { - TestLoggerFactory.onTestFinished(false); - throwables[0] = e; - } - }; - - invokeTestRunnable(runnable); - - if (throwables[0] != null) { - throw throwables[0]; - } - } - - protected boolean shouldRunTest() { - return TestFrameworkUtil.canRunTest(getClass()); - } - - protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception { - if (runInDispatchThread()) { - EdtTestUtilKt.runInEdtAndWait(() -> { - runnable.run(); - return null; - }); - } - else { - runnable.run(); - } - } - - protected void defaultRunBare() throws Throwable { - Throwable exception = null; - try { - long setupStart = System.nanoTime(); - setUp(); - long setupCost = (System.nanoTime() - setupStart) / 1000000; - logPerClassCost(setupCost, TOTAL_SETUP_COST_MILLIS); - - runTest(); - } - catch (Throwable running) { - exception = running; - } - finally { - try { - long teardownStart = System.nanoTime(); - tearDown(); - long teardownCost = (System.nanoTime() - teardownStart) / 1000000; - logPerClassCost(teardownCost, TOTAL_TEARDOWN_COST_MILLIS); - } - catch (Throwable tearingDown) { - if (exception == null) { - exception = tearingDown; - } - else { - exception = new CompoundRuntimeException(Arrays.asList(exception, tearingDown)); - } - } - } - if (exception != null) { - throw exception; - } - } - - /** - * Logs the setup cost grouped by test fixture class (superclass of the current test class). - * - * @param cost setup cost in milliseconds - */ - private void logPerClassCost(long cost, @NotNull Map costMap) { - Class superclass = getClass().getSuperclass(); - Long oldCost = costMap.get(superclass.getName()); - long newCost = oldCost == null ? cost : oldCost + cost; - costMap.put(superclass.getName(), newCost); - } - - @SuppressWarnings("UseOfSystemOutOrSystemErr") - static void logSetupTeardownCosts() { - System.out.println("Setup costs"); - long totalSetup = 0; - for (Map.Entry entry : TOTAL_SETUP_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalSetup += entry.getValue(); - } - System.out.println("Teardown costs"); - long totalTeardown = 0; - for (Map.Entry entry : TOTAL_TEARDOWN_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalTeardown += entry.getValue(); - } - System.out.println(String.format("Total overhead: setup %d ms, teardown %d ms", totalSetup, totalTeardown)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalSetupMs' value='%d']", totalSetup)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalTeardownMs' value='%d']", totalTeardown)); - } - - @Override - public void runBare() throws Throwable { - if (!shouldRunTest()) return; - - if (runInDispatchThread()) { - TestRunnerUtil.replaceIdeEventQueueSafely(); - EdtTestUtil.runInEdtAndWait(this::defaultRunBare); - } - else { - defaultRunBare(); - } - } - - protected boolean runInDispatchThread() { - IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - if (policy != null) { - return policy.runInDispatchThread(); - } - return true; - } - - /** - * If you want a more shorter name than runInEdtAndWait. - */ - protected void edt(@NotNull ThrowableRunnable runnable) { - EdtTestUtil.runInEdtAndWait(runnable); - } - - @NotNull - public static String toString(@NotNull Iterable collection) { - if (!collection.iterator().hasNext()) { - return ""; - } - - final StringBuilder builder = new StringBuilder(); - for (final Object o : collection) { - if (o instanceof THashSet) { - builder.append(new TreeSet<>((THashSet)o)); - } - else { - builder.append(o); - } - builder.append('\n'); - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull T[] actual, @NotNull T... expected) { - assertOrderedEquals(Arrays.asList(actual), expected); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals("", actual, expected); - } - - public static void assertOrderedEquals(@NotNull byte[] actual, @NotNull byte[] expected) { - assertEquals(expected.length, actual.length); - for (int i = 0; i < actual.length; i++) { - byte a = actual[i]; - byte e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - public static void assertOrderedEquals(@NotNull int[] actual, @NotNull int[] expected) { - if (actual.length != expected.length) { - fail("Expected size: "+expected.length+"; actual: "+actual.length+"\nexpected: "+Arrays.toString(expected)+"\nactual : "+Arrays.toString(actual)); - } - for (int i = 0; i < actual.length; i++) { - int a = actual[i]; - int e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals(errorMsg, actual, Arrays.asList(expected)); - } - - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull Iterable expected) { - assertOrderedEquals("", actual, expected); - } - - @SuppressWarnings("unchecked") - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected) { - assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); - } - - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected, - @NotNull Equality comparator) { - if (!equals(actual, expected, comparator)) { - String expectedString = toString(expected); - String actualString = toString(actual); - Assert.assertEquals(errorMsg, expectedString, actualString); - Assert.fail("Warning! 'toString' does not reflect the difference.\nExpected: " + expectedString + "\nActual: " + actualString); - } - } - - private static boolean equals(@NotNull Iterable a1, - @NotNull Iterable a2, - @NotNull Equality comparator) { - Iterator it1 = a1.iterator(); - Iterator it2 = a2.iterator(); - while (it1.hasNext() || it2.hasNext()) { - if (!it1.hasNext() || !it2.hasNext()) return false; - if (!comparator.equals(it1.next(), it2.next())) return false; - } - return true; - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertOrderedCollection(Arrays.asList(collection), checkers); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull T[] actual, @NotNull T... expected) { - assertSameElements(Arrays.asList(actual), expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull Collection actual, @NotNull T... expected) { - assertSameElements(actual, Arrays.asList(expected)); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull Collection actual, @NotNull Collection expected) { - assertSameElements("", actual, expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull String message, @NotNull Collection actual, @NotNull Collection expected) { - if (actual.size() != expected.size() || !new HashSet<>(expected).equals(new HashSet(actual))) { - Assert.assertEquals(message, new HashSet<>(expected), new HashSet(actual)); - } - } - - @SafeVarargs - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull T... expected) { - assertContainsOrdered(collection, Arrays.asList(expected)); - } - - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull Collection expected) { - PeekableIterator expectedIt = new PeekableIteratorWrapper<>(expected.iterator()); - PeekableIterator actualIt = new PeekableIteratorWrapper<>(collection.iterator()); - - while (actualIt.hasNext() && expectedIt.hasNext()) { - T expectedElem = expectedIt.peek(); - T actualElem = actualIt.peek(); - if (expectedElem.equals(actualElem)) { - expectedIt.next(); - } - actualIt.next(); - } - if (expectedIt.hasNext()) { - throw new ComparisonFailure("", toString(expected), toString(collection)); - } - } - - @SafeVarargs - public static void assertContainsElements(@NotNull Collection collection, @NotNull T... expected) { - assertContainsElements(collection, Arrays.asList(expected)); - } - - public static void assertContainsElements(@NotNull Collection collection, @NotNull Collection expected) { - ArrayList copy = new ArrayList<>(collection); - copy.retainAll(expected); - assertSameElements(toString(collection), copy, expected); - } - - @NotNull - public static String toString(@NotNull Object[] collection, @NotNull String separator) { - return toString(Arrays.asList(collection), separator); - } - - @SafeVarargs - public static void assertDoesntContain(@NotNull Collection collection, @NotNull T... notExpected) { - assertDoesntContain(collection, Arrays.asList(notExpected)); - } - - public static void assertDoesntContain(@NotNull Collection collection, @NotNull Collection notExpected) { - ArrayList expected = new ArrayList<>(collection); - expected.removeAll(notExpected); - assertSameElements(collection, expected); - } - - @NotNull - public static String toString(@NotNull Collection collection, @NotNull String separator) { - List list = ContainerUtil.map2List(collection, String::valueOf); - Collections.sort(list); - StringBuilder builder = new StringBuilder(); - boolean flag = false; - for (final String o : list) { - if (flag) { - builder.append(separator); - } - builder.append(o); - flag = true; - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - int i = 0; - for (final T actual : collection) { - try { - checkers[i].consume(actual); - } - catch (AssertionFailedError e) { - //noinspection UseOfSystemOutOrSystemErr - System.out.println(i + ": " + actual); - throw e; - } - i++; - } - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertUnorderedCollection(Arrays.asList(collection), checkers); - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - Set> checkerSet = ContainerUtil.set(checkers); - int i = 0; - Throwable lastError = null; - for (final T actual : collection) { - boolean flag = true; - for (final Consumer condition : checkerSet) { - Throwable error = accepts(condition, actual); - if (error == null) { - checkerSet.remove(condition); - flag = false; - break; - } - else { - lastError = error; - } - } - if (flag) { - //noinspection ConstantConditions,CallToPrintStackTrace - lastError.printStackTrace(); - Assert.fail("Incorrect element(" + i + "): " + actual); - } - i++; - } - } - - private static Throwable accepts(@NotNull Consumer condition, final T actual) { - try { - condition.consume(actual); - return null; - } - catch (Throwable e) { - return e; - } - } - - @Contract("null, _ -> fail") - @NotNull - public static T assertInstanceOf(Object o, @NotNull Class aClass) { - Assert.assertNotNull("Expected instance of: " + aClass.getName() + " actual: " + null, o); - Assert.assertTrue("Expected instance of: " + aClass.getName() + " actual: " + o.getClass().getName(), aClass.isInstance(o)); - @SuppressWarnings("unchecked") T t = (T)o; - return t; - } - - public static T assertOneElement(@NotNull Collection collection) { - Iterator iterator = collection.iterator(); - String toString = toString(collection); - Assert.assertTrue(toString, iterator.hasNext()); - T t = iterator.next(); - Assert.assertFalse(toString, iterator.hasNext()); - return t; - } - - public static T assertOneElement(@NotNull T[] ts) { - Assert.assertEquals(Arrays.asList(ts).toString(), 1, ts.length); - return ts[0]; - } - - @SafeVarargs - public static void assertOneOf(T value, @NotNull T... values) { - for (T v : values) { - if (Objects.equals(value, v)) { - return; - } - } - Assert.fail(value + " should be equal to one of " + Arrays.toString(values)); - } - - public static void printThreadDump() { - PerformanceWatcher.dumpThreadsToConsole("Thread dump:"); - } - - public static void assertEmpty(@NotNull Object[] array) { - assertOrderedEquals(array); - } - - public static void assertNotEmpty(final Collection collection) { - assertNotNull(collection); - assertFalse(collection.isEmpty()); - } - - public static void assertEmpty(@NotNull Collection collection) { - assertEmpty(collection.toString(), collection); - } - - public static void assertNullOrEmpty(@Nullable Collection collection) { - if (collection == null) return; - assertEmpty("", collection); - } - - public static void assertEmpty(final String s) { - assertTrue(s, StringUtil.isEmpty(s)); - } - - public static void assertEmpty(@NotNull String errorMsg, @NotNull Collection collection) { - assertOrderedEquals(errorMsg, collection, Collections.emptyList()); - } - - public static void assertSize(int expectedSize, @NotNull Object[] array) { - if (array.length != expectedSize) { - assertEquals(toString(Arrays.asList(array)), expectedSize, array.length); - } - } - - public static void assertSize(int expectedSize, @NotNull Collection c) { - if (c.size() != expectedSize) { - assertEquals(toString(c), expectedSize, c.size()); - } - } - - @NotNull - protected T disposeOnTearDown(@NotNull T disposable) { - Disposer.register(getTestRootDisposable(), disposable); - return disposable; - } - - public static void assertSameLines(@NotNull String expected, @NotNull String actual) { - assertSameLines(null, expected, actual); - } - - public static void assertSameLines(@Nullable String message, @NotNull String expected, @NotNull String actual) { - String expectedText = StringUtil.convertLineSeparators(expected.trim()); - String actualText = StringUtil.convertLineSeparators(actual.trim()); - Assert.assertEquals(message, expectedText, actualText); - } - - public static void assertExists(@NotNull File file){ - assertTrue("File should exist " + file, file.exists()); - } - - public static void assertDoesntExist(@NotNull File file){ - assertFalse("File should not exist " + file, file.exists()); - } - - @NotNull - protected String getTestName(boolean lowercaseFirstLetter) { - return getTestName(getName(), lowercaseFirstLetter); - } - - @NotNull - public static String getTestName(@Nullable String name, boolean lowercaseFirstLetter) { - return name == null ? "" : PlatformTestUtil.getTestName(name, lowercaseFirstLetter); - } - - @NotNull - protected String getTestDirectoryName() { - final String testName = getTestName(true); - return testName.replaceAll("_.*", ""); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText) { - assertSameLinesWithFile(filePath, actualText, true); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - @NotNull Supplier messageProducer) { - assertSameLinesWithFile(filePath, actualText, true, messageProducer); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText, boolean trimBeforeComparing) { - assertSameLinesWithFile(filePath, actualText, trimBeforeComparing, null); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - boolean trimBeforeComparing, - @Nullable Supplier messageProducer) { - String fileText; - try { - if (OVERWRITE_TESTDATA) { - VfsTestUtil.overwriteTestData(filePath, actualText); - //noinspection UseOfSystemOutOrSystemErr - System.out.println("File " + filePath + " created."); - } - fileText = FileUtil.loadFile(new File(filePath), StandardCharsets.UTF_8); - } - catch (FileNotFoundException e) { - VfsTestUtil.overwriteTestData(filePath, actualText); - throw new AssertionFailedError("No output text found. File " + filePath + " created."); - } - catch (IOException e) { - throw new RuntimeException(e); - } - String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); - String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); - if (!Comparing.equal(expected, actual)) { - throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); - } - } - - protected static void clearFields(@NotNull Object test) throws IllegalAccessException { - Class aClass = test.getClass(); - while (aClass != null) { - clearDeclaredFields(test, aClass); - aClass = aClass.getSuperclass(); - } - } - - public static void clearDeclaredFields(@NotNull Object test, @NotNull Class aClass) throws IllegalAccessException { - for (final Field field : aClass.getDeclaredFields()) { - final String name = field.getDeclaringClass().getName(); - if (!name.startsWith("junit.framework.") && !name.startsWith("com.intellij.testFramework.")) { - final int modifiers = field.getModifiers(); - if ((modifiers & Modifier.FINAL) == 0 && (modifiers & Modifier.STATIC) == 0 && !field.getType().isPrimitive()) { - field.setAccessible(true); - field.set(test, null); - } - } - } - } - - private static void checkCodeStyleSettingsEqual(@NotNull CodeStyleSettings expected, @NotNull CodeStyleSettings settings) { - if (!expected.equals(settings)) { - Element oldS = new Element("temp"); - expected.writeExternal(oldS); - Element newS = new Element("temp"); - settings.writeExternal(newS); - - String newString = JDOMUtil.writeElement(newS); - String oldString = JDOMUtil.writeElement(oldS); - Assert.assertEquals("Code style settings damaged", oldString, newString); - } - } - - private static void checkCodeInsightSettingsEqual(@NotNull CodeInsightSettings oldSettings, @NotNull CodeInsightSettings settings) { - if (!oldSettings.equals(settings)) { - Element newS = new Element("temp"); - settings.writeExternal(newS); - Assert.assertEquals("Code insight settings damaged", DEFAULT_SETTINGS_EXTERNALIZED, JDOMUtil.writeElement(newS)); - } - } - - public boolean isPerformanceTest() { - String testName = getName(); - String className = getClass().getSimpleName(); - return TestFrameworkUtil.isPerformanceTest(testName, className); - } - - /** - * @return true for a test which performs A LOT of computations. - * Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations. - * If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow". - * For example: {@code public void testStressPSIFromDifferentThreads()} - */ - public boolean isStressTest() { - return isStressTest(getName(), getClass().getName()); - } - - private static boolean isStressTest(String testName, String className) { - return TestFrameworkUtil.isPerformanceTest(testName, className) || - containsStressWords(testName) || - containsStressWords(className); - } - - private static boolean containsStressWords(@Nullable String name) { - return name != null && (name.contains("Stress") || name.contains("Slow")); - } - - public static void doPostponedFormatting(@NotNull Project project) { - DocumentUtil.writeInRunUndoTransparentAction(() -> { - PsiDocumentManager.getInstance(project).commitAllDocuments(); - PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(); - }); - } - - /** - * Checks that code block throw corresponding exception. - * - * @param exceptionCase Block annotated with some exception type - */ - protected void assertException(@NotNull AbstractExceptionCase exceptionCase) { - assertException(exceptionCase, null); - } - - /** - * Checks that code block throw corresponding exception with expected error msg. - * If expected error message is null it will not be checked. - * - * @param exceptionCase Block annotated with some exception type - * @param expectedErrorMsg expected error message - */ - @SuppressWarnings("unchecked") - protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); - } - - /** - * Checks that the code block throws an exception of the specified class. - * - * @param exceptionClass Expected exception type - * @param runnable Block annotated with some exception type - */ - public static void assertThrows(@NotNull Class exceptionClass, - @NotNull ThrowableRunnable runnable) { - assertThrows(exceptionClass, null, runnable); - } - - /** - * Checks that the code block throws an exception of the specified class with expected error msg. - * If expected error message is null it will not be checked. - * - * @param exceptionClass Expected exception type - * @param expectedErrorMsgPart expected error message, of any - * @param runnable Block annotated with some exception type - */ - @SuppressWarnings({"unchecked", "SameParameterValue"}) - public static void assertThrows(@NotNull Class exceptionClass, - @Nullable String expectedErrorMsgPart, - @NotNull ThrowableRunnable runnable) { - assertExceptionOccurred(true, new AbstractExceptionCase() { - @Override - public Class getExpectedExceptionClass() { - return (Class)exceptionClass; - } - - @Override - public void tryClosure() throws Throwable { - runnable.run(); - } - }, expectedErrorMsgPart); - } - - /** - * Checks that code block doesn't throw corresponding exception. - * - * @param exceptionCase Block annotated with some exception type - */ - protected void assertNoException(@NotNull AbstractExceptionCase exceptionCase) throws T { - assertExceptionOccurred(false, exceptionCase, null); - } - - protected void assertNoThrowable(@NotNull Runnable closure) { - String throwableName = null; - try { - closure.run(); - } - catch (Throwable thr) { - throwableName = thr.getClass().getName(); - } - assertNull(throwableName); - } - - private static void assertExceptionOccurred(boolean shouldOccur, - @NotNull AbstractExceptionCase exceptionCase, - String expectedErrorMsgPart) throws T { - boolean wasThrown = false; - try { - exceptionCase.tryClosure(); - } - catch (Throwable e) { - Throwable cause = e; - - if (shouldOccur) { - wasThrown = true; - final String errorMessage = exceptionCase.getAssertionErrorMessage(); - assertEquals(errorMessage, exceptionCase.getExpectedExceptionClass(), cause.getClass()); - if (expectedErrorMsgPart != null) { - assertTrue(cause.getMessage(), cause.getMessage().contains(expectedErrorMsgPart)); - } - } - else if (exceptionCase.getExpectedExceptionClass().equals(cause.getClass())) { - wasThrown = true; - - //noinspection UseOfSystemOutOrSystemErr - System.out.println(); - //noinspection UseOfSystemOutOrSystemErr - e.printStackTrace(System.out); - - fail("Exception isn't expected here. Exception message: " + cause.getMessage()); - } - else { - throw e; - } - } - finally { - if (shouldOccur && !wasThrown) { - fail(exceptionCase.getAssertionErrorMessage()); - } - } - } - - protected boolean annotatedWith(@NotNull Class annotationClass) { - Class aClass = getClass(); - String methodName = "test" + getTestName(false); - boolean methodChecked = false; - while (aClass != null && aClass != Object.class) { - if (aClass.getAnnotation(annotationClass) != null) return true; - if (!methodChecked) { - Method method = ReflectionUtil.getDeclaredMethod(aClass, methodName); - if (method != null) { - if (method.getAnnotation(annotationClass) != null) return true; - methodChecked = true; - } - } - aClass = aClass.getSuperclass(); - } - return false; - } - - @NotNull - protected String getHomePath() { - return PathManager.getHomePath().replace(File.separatorChar, '/'); - } - - public static void refreshRecursively(@NotNull VirtualFile file) { - VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() { - @Override - public boolean visitFile(@NotNull VirtualFile file) { - file.getChildren(); - return true; - } - }); - file.refresh(false, true); - } - - public static VirtualFile refreshAndFindFile(@NotNull final File file) { - return UIUtil.invokeAndWaitIfNeeded(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); - } - - public static void waitForAppLeakingThreads(long timeout, @NotNull TimeUnit timeUnit) { - EdtTestUtil.runInEdtAndWait(() -> { - Application app = ApplicationManager.getApplication(); - if (app != null && !app.isDisposed()) { - FileBasedIndexImpl index = (FileBasedIndexImpl)app.getServiceIfCreated(FileBasedIndex.class); - if (index != null) { - index.getChangedFilesCollector().waitForVfsEventsExecuted(timeout, timeUnit); - } - - DocumentCommitThread commitThread = (DocumentCommitThread)app.getServiceIfCreated(DocumentCommitProcessor.class); - if (commitThread != null) { - commitThread.waitForAllCommits(timeout, timeUnit); - } - } - }); - } - - protected class TestDisposable implements Disposable { - private volatile boolean myDisposed; - - public TestDisposable() { - } - - @Override - public void dispose() { - myDisposed = true; - } - - public boolean isDisposed() { - return myDisposed; - } - - @Override - public String toString() { - String testName = getTestName(false); - return KtUsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); - } - } -} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.as41 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.as41 deleted file mode 100644 index 6bd15dbaab0..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.as41 +++ /dev/null @@ -1,1186 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.test.testFramework; - -import com.intellij.codeInsight.CodeInsightSettings; -import com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory; -import com.intellij.diagnostic.PerformanceWatcher; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.Application; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.fileTypes.StdFileTypes; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.IconLoader; -import com.intellij.openapi.util.JDOMUtil; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileVisitor; -import com.intellij.psi.PsiDocumentManager; -import com.intellij.psi.codeStyle.CodeStyleSettings; -import com.intellij.psi.impl.DocumentCommitProcessor; -import com.intellij.psi.impl.DocumentCommitThread; -import com.intellij.psi.impl.source.PostprocessReformattingAspect; -import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.testFramework.*; -import com.intellij.testFramework.exceptionCases.AbstractExceptionCase; -import com.intellij.testFramework.fixtures.IdeaTestExecutionPolicy; -import com.intellij.util.*; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.PeekableIterator; -import com.intellij.util.containers.PeekableIteratorWrapper; -import com.intellij.util.indexing.FileBasedIndex; -import com.intellij.util.indexing.FileBasedIndexImpl; -import com.intellij.util.lang.CompoundRuntimeException; -import com.intellij.util.ui.UIUtil; -import gnu.trove.Equality; -import gnu.trove.THashSet; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; -import org.jdom.Element; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.testFramework.MockComponentManagerCreationTracer; -import org.jetbrains.kotlin.types.AbstractTypeChecker; -import org.jetbrains.kotlin.types.FlexibleTypeImpl; -import org.junit.Assert; -import org.junit.ComparisonFailure; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -@SuppressWarnings("ALL") -public abstract class KtUsefulTestCase extends TestCase { - public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; - public static final String TEMP_DIR_MARKER = "unitTest_"; - public static final boolean OVERWRITE_TESTDATA = Boolean.getBoolean("idea.tests.overwrite.data"); - - private static final String ORIGINAL_TEMP_DIR = FileUtil.getTempDirectory(); - - private static final Map TOTAL_SETUP_COST_MILLIS = new HashMap<>(); - private static final Map TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>(); - - private Application application; - - static { - IdeaForkJoinWorkerThreadFactory.setupPoisonFactory(); - Logger.setFactory(TestLoggerFactory.class); - } - protected static final Logger LOG = Logger.getInstance(KtUsefulTestCase.class); - - @NotNull - private final Disposable myTestRootDisposable = new TestDisposable(); - - static Path ourPathToKeep; - private final List myPathsToKeep = new ArrayList<>(); - - private String myTempDir; - - private static final String DEFAULT_SETTINGS_EXTERNALIZED; - private static final CodeInsightSettings defaultSettings = new CodeInsightSettings(); - static { - // Radar #5755208: Command line Java applications need a way to launch without a Dock icon. - System.setProperty("apple.awt.UIElement", "true"); - - try { - Element oldS = new Element("temp"); - defaultSettings.writeExternal(oldS); - DEFAULT_SETTINGS_EXTERNALIZED = JDOMUtil.writeElement(oldS); - } - catch (Exception e) { - throw new RuntimeException(e); - } - - // -- KOTLIN ADDITIONAL START -- - - FlexibleTypeImpl.RUN_SLOW_ASSERTIONS = true; - AbstractTypeChecker.RUN_SLOW_ASSERTIONS = true; - - // -- KOTLIN ADDITIONAL END -- - } - - /** - * Pass here the exception you want to be thrown first - * E.g.
-     * {@code
-     *   void tearDown() {
-     *     try {
-     *       doTearDowns();
-     *     }
-     *     catch(Exception e) {
-     *       addSuppressedException(e);
-     *     }
-     *     finally {
-     *       super.tearDown();
-     *     }
-     *   }
-     * }
-     * 
- * - */ - protected void addSuppressedException(@NotNull Throwable e) { - List list = mySuppressedExceptions; - if (list == null) { - mySuppressedExceptions = list = new SmartList<>(); - } - list.add(e); - } - private List mySuppressedExceptions; - - - public KtUsefulTestCase() { - } - - public KtUsefulTestCase(@NotNull String name) { - super(name); - } - - protected boolean shouldContainTempFiles() { - return true; - } - - @Override - protected void setUp() throws Exception { - // -- KOTLIN ADDITIONAL START -- - application = ApplicationManager.getApplication(); - - if (application != null && application.isDisposed()) { - MockComponentManagerCreationTracer.diagnoseDisposedButNotClearedApplication(application); - } - // -- KOTLIN ADDITIONAL END -- - - super.setUp(); - - if (shouldContainTempFiles()) { - IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - String testName = null; - if (policy != null) { - testName = policy.getPerTestTempDirName(); - } - if (testName == null) { - testName = FileUtil.sanitizeFileName(getTestName(true)); - } - testName = new File(testName).getName(); // in case the test name contains file separators - myTempDir = FileUtil.createTempDirectory(TEMP_DIR_MARKER + testName, "", false).getPath(); - FileUtil.resetCanonicalTempPathCache(myTempDir); - } - - boolean isStressTest = isStressTest(); - ApplicationInfoImpl.setInStressTest(isStressTest); - if (isPerformanceTest()) { - Timings.getStatistics(); - } - - // turn off Disposer debugging for performance tests - Disposer.setDebugMode(!isStressTest); - - if (isIconRequired()) { - // ensure that IconLoader will use dummy empty icon - IconLoader.deactivate(); - //IconManager.activate(); - } - } - - protected boolean isIconRequired() { - return false; - } - - @Override - protected void tearDown() throws Exception { - try { - // don't use method references here to make stack trace reading easier - //noinspection Convert2MethodRef - new RunAll( - () -> { - if (isIconRequired()) { - //IconManager.deactivate(); - } - }, - () -> disposeRootDisposable(), - () -> cleanupSwingDataStructures(), - () -> cleanupDeleteOnExitHookList(), - () -> Disposer.setDebugMode(true), - () -> { - if (shouldContainTempFiles()) { - FileUtil.resetCanonicalTempPathCache(ORIGINAL_TEMP_DIR); - if (hasTmpFilesToKeep()) { - File[] files = new File(myTempDir).listFiles(); - if (files != null) { - for (File file : files) { - if (!shouldKeepTmpFile(file)) { - FileUtil.delete(file); - } - } - } - } - else { - FileUtil.delete(new File(myTempDir)); - } - } - }, - () -> waitForAppLeakingThreads(10, TimeUnit.SECONDS) - ).run(ObjectUtils.notNull(mySuppressedExceptions, Collections.emptyList())); - } - finally { - // -- KOTLIN ADDITIONAL START -- - TestApplicationUtilKt.resetApplicationToNull(application); - application = null; - // -- KOTLIN ADDITIONAL END -- - } - } - - protected final void disposeRootDisposable() { - Disposer.dispose(getTestRootDisposable()); - } - - protected void addTmpFileToKeep(@NotNull File file) { - myPathsToKeep.add(file.getPath()); - } - - private boolean hasTmpFilesToKeep() { - return ourPathToKeep != null && FileUtil.isAncestor(myTempDir, ourPathToKeep.toString(), false) || !myPathsToKeep.isEmpty(); - } - - private boolean shouldKeepTmpFile(@NotNull File file) { - String path = file.getPath(); - if (FileUtil.pathsEqual(path, ourPathToKeep.toString())) return true; - for (String pathToKeep : myPathsToKeep) { - if (FileUtil.pathsEqual(path, pathToKeep)) return true; - } - return false; - } - - private static final Set DELETE_ON_EXIT_HOOK_DOT_FILES; - private static final Class DELETE_ON_EXIT_HOOK_CLASS; - static { - Class aClass; - try { - aClass = Class.forName("java.io.DeleteOnExitHook"); - } - catch (Exception e) { - throw new RuntimeException(e); - } - @SuppressWarnings("unchecked") Set files = ReflectionUtil.getStaticFieldValue(aClass, Set.class, "files"); - DELETE_ON_EXIT_HOOK_CLASS = aClass; - DELETE_ON_EXIT_HOOK_DOT_FILES = files; - } - - @SuppressWarnings("SynchronizeOnThis") - private static void cleanupDeleteOnExitHookList() { - // try to reduce file set retained by java.io.DeleteOnExitHook - List list; - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - if (DELETE_ON_EXIT_HOOK_DOT_FILES.isEmpty()) return; - list = new ArrayList<>(DELETE_ON_EXIT_HOOK_DOT_FILES); - } - for (int i = list.size() - 1; i >= 0; i--) { - String path = list.get(i); - File file = new File(path); - if (file.delete() || !file.exists()) { - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - DELETE_ON_EXIT_HOOK_DOT_FILES.remove(path); - } - } - } - } - - @SuppressWarnings("ConstantConditions") - private static void cleanupSwingDataStructures() throws Exception { - Object manager = ReflectionUtil.getDeclaredMethod(Class.forName("javax.swing.KeyboardManager"), "getCurrentManager").invoke(null); - Map componentKeyStrokeMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "componentKeyStrokeMap"); - componentKeyStrokeMap.clear(); - Map containerMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "containerMap"); - containerMap.clear(); - } - - static void doCheckForSettingsDamage(@NotNull CodeStyleSettings oldCodeStyleSettings, @NotNull CodeStyleSettings currentCodeStyleSettings) { - final CodeInsightSettings settings = CodeInsightSettings.getInstance(); - // don't use method references here to make stack trace reading easier - //noinspection Convert2MethodRef - new RunAll() - .append(() -> { - try { - checkCodeInsightSettingsEqual(defaultSettings, settings); - } - catch (AssertionError error) { - CodeInsightSettings clean = new CodeInsightSettings(); - for (Field field : clean.getClass().getFields()) { - try { - ReflectionUtil.copyFieldValue(clean, settings, field); - } - catch (Exception ignored) { - } - } - throw error; - } - }) - .append(() -> { - currentCodeStyleSettings.getIndentOptions(StdFileTypes.JAVA); - try { - checkCodeStyleSettingsEqual(oldCodeStyleSettings, currentCodeStyleSettings); - } - finally { - currentCodeStyleSettings.clearCodeStyleSettings(); - } - }) - .run(); - } - - @NotNull - public Disposable getTestRootDisposable() { - return myTestRootDisposable; - } - - @Override - protected void runTest() throws Throwable { - final Throwable[] throwables = new Throwable[1]; - - Runnable runnable = () -> { - try { - TestLoggerFactory.onTestStarted(); - super.runTest(); - TestLoggerFactory.onTestFinished(true); - } - catch (InvocationTargetException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e.getTargetException(); - } - catch (IllegalAccessException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e; - } - catch (Throwable e) { - TestLoggerFactory.onTestFinished(false); - throwables[0] = e; - } - }; - - invokeTestRunnable(runnable); - - if (throwables[0] != null) { - throw throwables[0]; - } - } - - protected boolean shouldRunTest() { - return TestFrameworkUtil.canRunTest(getClass()); - } - - protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception { - if (runInDispatchThread()) { - EdtTestUtilKt.runInEdtAndWait(() -> { - runnable.run(); - return null; - }); - } - else { - runnable.run(); - } - } - - protected void defaultRunBare() throws Throwable { - Throwable exception = null; - try { - long setupStart = System.nanoTime(); - setUp(); - long setupCost = (System.nanoTime() - setupStart) / 1000000; - logPerClassCost(setupCost, TOTAL_SETUP_COST_MILLIS); - - runTest(); - } - catch (Throwable running) { - exception = running; - } - finally { - try { - long teardownStart = System.nanoTime(); - tearDown(); - long teardownCost = (System.nanoTime() - teardownStart) / 1000000; - logPerClassCost(teardownCost, TOTAL_TEARDOWN_COST_MILLIS); - } - catch (Throwable tearingDown) { - if (exception == null) { - exception = tearingDown; - } - else { - exception = new CompoundRuntimeException(Arrays.asList(exception, tearingDown)); - } - } - } - if (exception != null) { - throw exception; - } - } - - /** - * Logs the setup cost grouped by test fixture class (superclass of the current test class). - * - * @param cost setup cost in milliseconds - */ - private void logPerClassCost(long cost, @NotNull Map costMap) { - Class superclass = getClass().getSuperclass(); - Long oldCost = costMap.get(superclass.getName()); - long newCost = oldCost == null ? cost : oldCost + cost; - costMap.put(superclass.getName(), newCost); - } - - @SuppressWarnings("UseOfSystemOutOrSystemErr") - static void logSetupTeardownCosts() { - System.out.println("Setup costs"); - long totalSetup = 0; - for (Map.Entry entry : TOTAL_SETUP_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalSetup += entry.getValue(); - } - System.out.println("Teardown costs"); - long totalTeardown = 0; - for (Map.Entry entry : TOTAL_TEARDOWN_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalTeardown += entry.getValue(); - } - System.out.println(String.format("Total overhead: setup %d ms, teardown %d ms", totalSetup, totalTeardown)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalSetupMs' value='%d']", totalSetup)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalTeardownMs' value='%d']", totalTeardown)); - } - - @Override - public void runBare() throws Throwable { - if (!shouldRunTest()) return; - - if (runInDispatchThread()) { - TestRunnerUtil.replaceIdeEventQueueSafely(); - EdtTestUtil.runInEdtAndWait(this::defaultRunBare); - } - else { - defaultRunBare(); - } - } - - protected boolean runInDispatchThread() { - IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - if (policy != null) { - return policy.runInDispatchThread(); - } - return true; - } - - /** - * If you want a more shorter name than runInEdtAndWait. - */ - protected void edt(@NotNull ThrowableRunnable runnable) { - EdtTestUtil.runInEdtAndWait(runnable); - } - - @NotNull - public static String toString(@NotNull Iterable collection) { - if (!collection.iterator().hasNext()) { - return ""; - } - - final StringBuilder builder = new StringBuilder(); - for (final Object o : collection) { - if (o instanceof THashSet) { - builder.append(new TreeSet<>((THashSet)o)); - } - else { - builder.append(o); - } - builder.append('\n'); - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull T[] actual, @NotNull T... expected) { - assertOrderedEquals(Arrays.asList(actual), expected); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals("", actual, expected); - } - - public static void assertOrderedEquals(@NotNull byte[] actual, @NotNull byte[] expected) { - assertEquals(expected.length, actual.length); - for (int i = 0; i < actual.length; i++) { - byte a = actual[i]; - byte e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - public static void assertOrderedEquals(@NotNull int[] actual, @NotNull int[] expected) { - if (actual.length != expected.length) { - fail("Expected size: "+expected.length+"; actual: "+actual.length+"\nexpected: "+Arrays.toString(expected)+"\nactual : "+Arrays.toString(actual)); - } - for (int i = 0; i < actual.length; i++) { - int a = actual[i]; - int e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals(errorMsg, actual, Arrays.asList(expected)); - } - - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull Iterable expected) { - assertOrderedEquals("", actual, expected); - } - - @SuppressWarnings("unchecked") - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected) { - assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); - } - - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected, - @NotNull Equality comparator) { - if (!equals(actual, expected, comparator)) { - String expectedString = toString(expected); - String actualString = toString(actual); - Assert.assertEquals(errorMsg, expectedString, actualString); - Assert.fail("Warning! 'toString' does not reflect the difference.\nExpected: " + expectedString + "\nActual: " + actualString); - } - } - - private static boolean equals(@NotNull Iterable a1, - @NotNull Iterable a2, - @NotNull Equality comparator) { - Iterator it1 = a1.iterator(); - Iterator it2 = a2.iterator(); - while (it1.hasNext() || it2.hasNext()) { - if (!it1.hasNext() || !it2.hasNext()) return false; - if (!comparator.equals(it1.next(), it2.next())) return false; - } - return true; - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertOrderedCollection(Arrays.asList(collection), checkers); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull T[] actual, @NotNull T... expected) { - assertSameElements(Arrays.asList(actual), expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull Collection actual, @NotNull T... expected) { - assertSameElements(actual, Arrays.asList(expected)); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull Collection actual, @NotNull Collection expected) { - assertSameElements("", actual, expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull String message, @NotNull Collection actual, @NotNull Collection expected) { - if (actual.size() != expected.size() || !new HashSet<>(expected).equals(new HashSet(actual))) { - Assert.assertEquals(message, new HashSet<>(expected), new HashSet(actual)); - } - } - - @SafeVarargs - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull T... expected) { - assertContainsOrdered(collection, Arrays.asList(expected)); - } - - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull Collection expected) { - PeekableIterator expectedIt = new PeekableIteratorWrapper<>(expected.iterator()); - PeekableIterator actualIt = new PeekableIteratorWrapper<>(collection.iterator()); - - while (actualIt.hasNext() && expectedIt.hasNext()) { - T expectedElem = expectedIt.peek(); - T actualElem = actualIt.peek(); - if (expectedElem.equals(actualElem)) { - expectedIt.next(); - } - actualIt.next(); - } - if (expectedIt.hasNext()) { - throw new ComparisonFailure("", toString(expected), toString(collection)); - } - } - - @SafeVarargs - public static void assertContainsElements(@NotNull Collection collection, @NotNull T... expected) { - assertContainsElements(collection, Arrays.asList(expected)); - } - - public static void assertContainsElements(@NotNull Collection collection, @NotNull Collection expected) { - ArrayList copy = new ArrayList<>(collection); - copy.retainAll(expected); - assertSameElements(toString(collection), copy, expected); - } - - @NotNull - public static String toString(@NotNull Object[] collection, @NotNull String separator) { - return toString(Arrays.asList(collection), separator); - } - - @SafeVarargs - public static void assertDoesntContain(@NotNull Collection collection, @NotNull T... notExpected) { - assertDoesntContain(collection, Arrays.asList(notExpected)); - } - - public static void assertDoesntContain(@NotNull Collection collection, @NotNull Collection notExpected) { - ArrayList expected = new ArrayList<>(collection); - expected.removeAll(notExpected); - assertSameElements(collection, expected); - } - - @NotNull - public static String toString(@NotNull Collection collection, @NotNull String separator) { - List list = ContainerUtil.map2List(collection, String::valueOf); - Collections.sort(list); - StringBuilder builder = new StringBuilder(); - boolean flag = false; - for (final String o : list) { - if (flag) { - builder.append(separator); - } - builder.append(o); - flag = true; - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - int i = 0; - for (final T actual : collection) { - try { - checkers[i].consume(actual); - } - catch (AssertionFailedError e) { - //noinspection UseOfSystemOutOrSystemErr - System.out.println(i + ": " + actual); - throw e; - } - i++; - } - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertUnorderedCollection(Arrays.asList(collection), checkers); - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - Set> checkerSet = ContainerUtil.set(checkers); - int i = 0; - Throwable lastError = null; - for (final T actual : collection) { - boolean flag = true; - for (final Consumer condition : checkerSet) { - Throwable error = accepts(condition, actual); - if (error == null) { - checkerSet.remove(condition); - flag = false; - break; - } - else { - lastError = error; - } - } - if (flag) { - //noinspection ConstantConditions,CallToPrintStackTrace - lastError.printStackTrace(); - Assert.fail("Incorrect element(" + i + "): " + actual); - } - i++; - } - } - - private static Throwable accepts(@NotNull Consumer condition, final T actual) { - try { - condition.consume(actual); - return null; - } - catch (Throwable e) { - return e; - } - } - - @Contract("null, _ -> fail") - @NotNull - public static T assertInstanceOf(Object o, @NotNull Class aClass) { - Assert.assertNotNull("Expected instance of: " + aClass.getName() + " actual: " + null, o); - Assert.assertTrue("Expected instance of: " + aClass.getName() + " actual: " + o.getClass().getName(), aClass.isInstance(o)); - @SuppressWarnings("unchecked") T t = (T)o; - return t; - } - - public static T assertOneElement(@NotNull Collection collection) { - Iterator iterator = collection.iterator(); - String toString = toString(collection); - Assert.assertTrue(toString, iterator.hasNext()); - T t = iterator.next(); - Assert.assertFalse(toString, iterator.hasNext()); - return t; - } - - public static T assertOneElement(@NotNull T[] ts) { - Assert.assertEquals(Arrays.asList(ts).toString(), 1, ts.length); - return ts[0]; - } - - @SafeVarargs - public static void assertOneOf(T value, @NotNull T... values) { - for (T v : values) { - if (Objects.equals(value, v)) { - return; - } - } - Assert.fail(value + " should be equal to one of " + Arrays.toString(values)); - } - - public static void printThreadDump() { - PerformanceWatcher.dumpThreadsToConsole("Thread dump:"); - } - - public static void assertEmpty(@NotNull Object[] array) { - assertOrderedEquals(array); - } - - public static void assertNotEmpty(final Collection collection) { - assertNotNull(collection); - assertFalse(collection.isEmpty()); - } - - public static void assertEmpty(@NotNull Collection collection) { - assertEmpty(collection.toString(), collection); - } - - public static void assertNullOrEmpty(@Nullable Collection collection) { - if (collection == null) return; - assertEmpty("", collection); - } - - public static void assertEmpty(final String s) { - assertTrue(s, StringUtil.isEmpty(s)); - } - - public static void assertEmpty(@NotNull String errorMsg, @NotNull Collection collection) { - assertOrderedEquals(errorMsg, collection, Collections.emptyList()); - } - - public static void assertSize(int expectedSize, @NotNull Object[] array) { - if (array.length != expectedSize) { - assertEquals(toString(Arrays.asList(array)), expectedSize, array.length); - } - } - - public static void assertSize(int expectedSize, @NotNull Collection c) { - if (c.size() != expectedSize) { - assertEquals(toString(c), expectedSize, c.size()); - } - } - - @NotNull - protected T disposeOnTearDown(@NotNull T disposable) { - Disposer.register(getTestRootDisposable(), disposable); - return disposable; - } - - public static void assertSameLines(@NotNull String expected, @NotNull String actual) { - assertSameLines(null, expected, actual); - } - - public static void assertSameLines(@Nullable String message, @NotNull String expected, @NotNull String actual) { - String expectedText = StringUtil.convertLineSeparators(expected.trim()); - String actualText = StringUtil.convertLineSeparators(actual.trim()); - Assert.assertEquals(message, expectedText, actualText); - } - - public static void assertExists(@NotNull File file){ - assertTrue("File should exist " + file, file.exists()); - } - - public static void assertDoesntExist(@NotNull File file){ - assertFalse("File should not exist " + file, file.exists()); - } - - @NotNull - protected String getTestName(boolean lowercaseFirstLetter) { - return getTestName(getName(), lowercaseFirstLetter); - } - - @NotNull - public static String getTestName(@Nullable String name, boolean lowercaseFirstLetter) { - return name == null ? "" : PlatformTestUtil.getTestName(name, lowercaseFirstLetter); - } - - @NotNull - protected String getTestDirectoryName() { - final String testName = getTestName(true); - return testName.replaceAll("_.*", ""); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText) { - assertSameLinesWithFile(filePath, actualText, true); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - @NotNull Supplier messageProducer) { - assertSameLinesWithFile(filePath, actualText, true, messageProducer); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText, boolean trimBeforeComparing) { - assertSameLinesWithFile(filePath, actualText, trimBeforeComparing, null); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - boolean trimBeforeComparing, - @Nullable Supplier messageProducer) { - String fileText; - try { - if (OVERWRITE_TESTDATA) { - VfsTestUtil.overwriteTestData(filePath, actualText); - //noinspection UseOfSystemOutOrSystemErr - System.out.println("File " + filePath + " created."); - } - fileText = FileUtil.loadFile(new File(filePath), StandardCharsets.UTF_8); - } - catch (FileNotFoundException e) { - VfsTestUtil.overwriteTestData(filePath, actualText); - throw new AssertionFailedError("No output text found. File " + filePath + " created."); - } - catch (IOException e) { - throw new RuntimeException(e); - } - String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); - String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); - if (!Comparing.equal(expected, actual)) { - throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); - } - } - - protected static void clearFields(@NotNull Object test) throws IllegalAccessException { - Class aClass = test.getClass(); - while (aClass != null) { - clearDeclaredFields(test, aClass); - aClass = aClass.getSuperclass(); - } - } - - public static void clearDeclaredFields(@NotNull Object test, @NotNull Class aClass) throws IllegalAccessException { - for (final Field field : aClass.getDeclaredFields()) { - final String name = field.getDeclaringClass().getName(); - if (!name.startsWith("junit.framework.") && !name.startsWith("com.intellij.testFramework.")) { - final int modifiers = field.getModifiers(); - if ((modifiers & Modifier.FINAL) == 0 && (modifiers & Modifier.STATIC) == 0 && !field.getType().isPrimitive()) { - field.setAccessible(true); - field.set(test, null); - } - } - } - } - - private static void checkCodeStyleSettingsEqual(@NotNull CodeStyleSettings expected, @NotNull CodeStyleSettings settings) { - if (!expected.equals(settings)) { - Element oldS = new Element("temp"); - expected.writeExternal(oldS); - Element newS = new Element("temp"); - settings.writeExternal(newS); - - String newString = JDOMUtil.writeElement(newS); - String oldString = JDOMUtil.writeElement(oldS); - Assert.assertEquals("Code style settings damaged", oldString, newString); - } - } - - private static void checkCodeInsightSettingsEqual(@NotNull CodeInsightSettings oldSettings, @NotNull CodeInsightSettings settings) { - if (!oldSettings.equals(settings)) { - Element newS = new Element("temp"); - settings.writeExternal(newS); - Assert.assertEquals("Code insight settings damaged", DEFAULT_SETTINGS_EXTERNALIZED, JDOMUtil.writeElement(newS)); - } - } - - public boolean isPerformanceTest() { - String testName = getName(); - String className = getClass().getSimpleName(); - return TestFrameworkUtil.isPerformanceTest(testName, className); - } - - /** - * @return true for a test which performs A LOT of computations. - * Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations. - * If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow". - * For example: {@code public void testStressPSIFromDifferentThreads()} - */ - public boolean isStressTest() { - return isStressTest(getName(), getClass().getName()); - } - - private static boolean isStressTest(String testName, String className) { - return TestFrameworkUtil.isPerformanceTest(testName, className) || - containsStressWords(testName) || - containsStressWords(className); - } - - private static boolean containsStressWords(@Nullable String name) { - return name != null && (name.contains("Stress") || name.contains("Slow")); - } - - public static void doPostponedFormatting(@NotNull Project project) { - DocumentUtil.writeInRunUndoTransparentAction(() -> { - PsiDocumentManager.getInstance(project).commitAllDocuments(); - PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(); - }); - } - - /** - * Checks that code block throw corresponding exception. - * - * @param exceptionCase Block annotated with some exception type - */ - protected void assertException(@NotNull AbstractExceptionCase exceptionCase) { - assertException(exceptionCase, null); - } - - /** - * Checks that code block throw corresponding exception with expected error msg. - * If expected error message is null it will not be checked. - * - * @param exceptionCase Block annotated with some exception type - * @param expectedErrorMsg expected error message - */ - @SuppressWarnings("unchecked") - protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); - } - - /** - * Checks that the code block throws an exception of the specified class. - * - * @param exceptionClass Expected exception type - * @param runnable Block annotated with some exception type - */ - public static void assertThrows(@NotNull Class exceptionClass, - @NotNull ThrowableRunnable runnable) { - assertThrows(exceptionClass, null, runnable); - } - - /** - * Checks that the code block throws an exception of the specified class with expected error msg. - * If expected error message is null it will not be checked. - * - * @param exceptionClass Expected exception type - * @param expectedErrorMsgPart expected error message, of any - * @param runnable Block annotated with some exception type - */ - @SuppressWarnings({"unchecked", "SameParameterValue"}) - public static void assertThrows(@NotNull Class exceptionClass, - @Nullable String expectedErrorMsgPart, - @NotNull ThrowableRunnable runnable) { - assertExceptionOccurred(true, new AbstractExceptionCase() { - @Override - public Class getExpectedExceptionClass() { - return (Class)exceptionClass; - } - - @Override - public void tryClosure() throws Throwable { - runnable.run(); - } - }, expectedErrorMsgPart); - } - - /** - * Checks that code block doesn't throw corresponding exception. - * - * @param exceptionCase Block annotated with some exception type - */ - protected void assertNoException(@NotNull AbstractExceptionCase exceptionCase) throws T { - assertExceptionOccurred(false, exceptionCase, null); - } - - protected void assertNoThrowable(@NotNull Runnable closure) { - String throwableName = null; - try { - closure.run(); - } - catch (Throwable thr) { - throwableName = thr.getClass().getName(); - } - assertNull(throwableName); - } - - private static void assertExceptionOccurred(boolean shouldOccur, - @NotNull AbstractExceptionCase exceptionCase, - String expectedErrorMsgPart) throws T { - boolean wasThrown = false; - try { - exceptionCase.tryClosure(); - } - catch (Throwable e) { - Throwable cause = e; - - if (shouldOccur) { - wasThrown = true; - assertInstanceOf(cause, exceptionCase.getExpectedExceptionClass()); - if (expectedErrorMsgPart != null) { - assertTrue(cause.getMessage(), cause.getMessage().contains(expectedErrorMsgPart)); - } - } - else if (exceptionCase.getExpectedExceptionClass().equals(cause.getClass())) { - wasThrown = true; - - //noinspection UseOfSystemOutOrSystemErr - System.out.println(); - //noinspection UseOfSystemOutOrSystemErr - e.printStackTrace(System.out); - - fail("Exception isn't expected here. Exception message: " + cause.getMessage()); - } - else { - throw e; - } - } - finally { - if (shouldOccur && !wasThrown) { - fail(exceptionCase.getExpectedExceptionClass().getName() + " must be thrown."); - } - } - } - - protected boolean annotatedWith(@NotNull Class annotationClass) { - Class aClass = getClass(); - String methodName = "test" + getTestName(false); - boolean methodChecked = false; - while (aClass != null && aClass != Object.class) { - if (aClass.getAnnotation(annotationClass) != null) return true; - if (!methodChecked) { - Method method = ReflectionUtil.getDeclaredMethod(aClass, methodName); - if (method != null) { - if (method.getAnnotation(annotationClass) != null) return true; - methodChecked = true; - } - } - aClass = aClass.getSuperclass(); - } - return false; - } - - @NotNull - protected String getHomePath() { - return PathManager.getHomePath().replace(File.separatorChar, '/'); - } - - public static void refreshRecursively(@NotNull VirtualFile file) { - VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() { - @Override - public boolean visitFile(@NotNull VirtualFile file) { - file.getChildren(); - return true; - } - }); - file.refresh(false, true); - } - - public static VirtualFile refreshAndFindFile(@NotNull final File file) { - return UIUtil.invokeAndWaitIfNeeded(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); - } - - public static void waitForAppLeakingThreads(long timeout, @NotNull TimeUnit timeUnit) { - EdtTestUtil.runInEdtAndWait(() -> { - Application app = ApplicationManager.getApplication(); - if (app != null && !app.isDisposed()) { - FileBasedIndexImpl index = (FileBasedIndexImpl)app.getServiceIfCreated(FileBasedIndex.class); - if (index != null) { - index.getChangedFilesCollector().waitForVfsEventsExecuted(timeout, timeUnit); - } - - DocumentCommitThread commitThread = (DocumentCommitThread)app.getServiceIfCreated(DocumentCommitProcessor.class); - if (commitThread != null) { - commitThread.waitForAllCommits(timeout, timeUnit); - } - } - }); - } - - protected class TestDisposable implements Disposable { - private volatile boolean myDisposed; - - public TestDisposable() { - } - - @Override - public void dispose() { - myDisposed = true; - } - - public boolean isDisposed() { - return myDisposed; - } - - @Override - public String toString() { - String testName = getTestName(false); - return KtUsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); - } - } -} \ No newline at end of file diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/platformUtils.kt.201 b/compiler/util/src/org/jetbrains/kotlin/utils/platformUtils.kt.201 deleted file mode 100644 index c3fc229149b..00000000000 --- a/compiler/util/src/org/jetbrains/kotlin/utils/platformUtils.kt.201 +++ /dev/null @@ -1,17 +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.utils - -import com.intellij.util.containers.ConcurrentMultiMap -import com.intellij.util.containers.Interner -import com.intellij.util.containers.MultiMap -import com.intellij.util.containers.StringInterner - -fun createStringInterner(): Interner = - StringInterner() - -fun createConcurrentMultiMap(): MultiMap = - ConcurrentMultiMap() diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 deleted file mode 100644 index 8ec36bb4715..00000000000 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as41 +++ /dev/null @@ -1,1312 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.generators.tests - -import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest -import org.jetbrains.kotlin.addImport.AbstractAddImportTest -import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen -import org.jetbrains.kotlin.allopen.AbstractIrBytecodeListingTestForAllOpen -import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest -import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest -import org.jetbrains.kotlin.checkers.* -import org.jetbrains.kotlin.copyright.AbstractUpdateKotlinCopyrightTest -import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest -import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest -import org.jetbrains.kotlin.formatter.AbstractFormatterTest -import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase -import org.jetbrains.kotlin.generators.TestGroup -import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite -import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS -import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_OR_KTS_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.generators.util.TestGeneratorUtil.KT_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest -import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest -import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest -import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest -import org.jetbrains.kotlin.idea.caches.resolve.* -import org.jetbrains.kotlin.idea.codeInsight.* -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateToStringActionTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveLeftRightTest -import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveStatementTest -import org.jetbrains.kotlin.idea.codeInsight.postfix.AbstractPostfixTemplateProviderTest -import org.jetbrains.kotlin.idea.codeInsight.surroundWith.AbstractSurroundWithTest -import org.jetbrains.kotlin.idea.codeInsight.unwrap.AbstractUnwrapRemoveTest -import org.jetbrains.kotlin.idea.completion.test.* -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractBasicCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractCompletionCharFilterTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractKeywordCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractSmartCompletionHandlerTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest -import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractSmartCompletionWeigherTest -import org.jetbrains.kotlin.idea.configuration.AbstractGradleConfigureProjectByChangingFileTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralKotlinToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralTextToKotlinCopyPasteTest -import org.jetbrains.kotlin.idea.conversion.copy.AbstractTextJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.idea.coverage.AbstractKotlinCoverageOutputFilesTest -import org.jetbrains.kotlin.idea.debugger.evaluate.* -import org.jetbrains.kotlin.idea.debugger.test.sequence.exec.AbstractSequenceTraceTestCase -import org.jetbrains.kotlin.idea.debugger.test.* -import org.jetbrains.kotlin.idea.debugger.test.AbstractFileRankingTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToDecompiledLibraryTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTest -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTestWithJS -import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateJavaToLibrarySourceTest -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractClsStubBuilderTest -import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractLoadJavaClsStubTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJsDecompiledTextFromJsMetadataTest -import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJvmDecompiledTextTest -import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest -import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest -import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest -import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest -import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest -import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest -import org.jetbrains.kotlin.idea.highlighter.* -import org.jetbrains.kotlin.idea.imports.AbstractJsOptimizeImportsTest -import org.jetbrains.kotlin.idea.imports.AbstractJvmOptimizeImportsTest -import org.jetbrains.kotlin.idea.inspections.AbstractLocalInspectionTest -import org.jetbrains.kotlin.idea.inspections.AbstractMultiFileLocalInspectionTest -import org.jetbrains.kotlin.idea.intentions.AbstractConcatenatedStringGeneratorTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest -import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest2 -import org.jetbrains.kotlin.idea.intentions.AbstractMultiFileIntentionTest -import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest -import org.jetbrains.kotlin.idea.internal.AbstractBytecodeToolWindowTest -import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest -import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest -import org.jetbrains.kotlin.idea.navigation.* -import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest -import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest -import org.jetbrains.kotlin.idea.refactoring.AbstractNameSuggestionProviderTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractCopyTest -import org.jetbrains.kotlin.idea.refactoring.copy.AbstractMultiModuleCopyTest -import org.jetbrains.kotlin.idea.refactoring.inline.AbstractInlineTest -import org.jetbrains.kotlin.idea.refactoring.introduce.AbstractExtractionTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMoveTest -import org.jetbrains.kotlin.idea.refactoring.move.AbstractMultiModuleMoveTest -import org.jetbrains.kotlin.idea.refactoring.pullUp.AbstractPullUpTest -import org.jetbrains.kotlin.idea.refactoring.pushDown.AbstractPushDownTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractMultiModuleRenameTest -import org.jetbrains.kotlin.idea.refactoring.rename.AbstractRenameTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractMultiModuleSafeDeleteTest -import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractSafeDeleteTest -import org.jetbrains.kotlin.idea.repl.AbstractIdeReplCompletionTest -import org.jetbrains.kotlin.idea.resolve.* -import org.jetbrains.kotlin.idea.scratch.AbstractScratchLineMarkersTest -import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest -import org.jetbrains.kotlin.idea.script.* -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerLeafGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerNullnessGroupingTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerTreeTest -import org.jetbrains.kotlin.idea.slicer.AbstractSlicerMultiplatformTest -import org.jetbrains.kotlin.idea.structureView.AbstractKotlinFileStructureTest -import org.jetbrains.kotlin.idea.stubs.AbstractMultiFileHighlightingTest -import org.jetbrains.kotlin.idea.stubs.AbstractResolveByStubTest -import org.jetbrains.kotlin.idea.stubs.AbstractStubBuilderTest -import org.jetbrains.kotlin.incremental.* -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterForWebDemoTest -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterMultiFileTest -import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterSingleFileTest -//import org.jetbrains.kotlin.jps.build.* -//import org.jetbrains.kotlin.jps.incremental.AbstractJsProtoComparisonTest -//import org.jetbrains.kotlin.jps.incremental.AbstractJvmProtoComparisonTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractArgumentParsingTest -import org.jetbrains.kotlin.kapt.cli.test.AbstractKaptToolIntegrationTest -import org.jetbrains.kotlin.kapt3.test.AbstractClassFileToSourceStubConverterTest -import org.jetbrains.kotlin.kapt3.test.AbstractKotlinKaptContextTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterMultiFileTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterSingleFileTest -import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionTest -import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest -import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest -import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest -import org.jetbrains.kotlin.noarg.* -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBoxTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeBytecodeListingTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBoxTest -import org.jetbrains.kotlin.parcelize.test.AbstractParcelizeIrBytecodeListingTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeCheckerTest -import org.jetbrains.kotlin.pacelize.ide.test.AbstractParcelizeQuickFixTest -import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest -import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest -import org.jetbrains.kotlin.search.AbstractAnnotatedMembersSearchTest -import org.jetbrains.kotlin.search.AbstractInheritorsSearchTest -import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest -import org.jetbrains.kotlin.test.TargetBackend -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest -import org.jetbrains.kotlinx.serialization.idea.AbstractSerializationPluginIdeDiagnosticTest -import org.jetbrains.kotlinx.serialization.idea.AbstractSerializationQuickFixTest - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - generateTestGroupSuite(args) { - testGroup("idea/jvm-debugger/jvm-debugger-test/test", "idea/jvm-debugger/jvm-debugger-test/testData") { - testClass { - model( - "stepping/stepIntoAndSmartStepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doStepIntoTest", - testClassName = "StepInto" - ) - model( - "stepping/stepIntoAndSmartStepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doSmartStepIntoTest", - testClassName = "SmartStepInto" - ) - model( - "stepping/stepInto", - pattern = KT_WITHOUT_DOTS_IN_NAME, - testMethod = "doStepIntoTest", - testClassName = "StepIntoOnly" - ) - model("stepping/stepOut", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOutTest") - model("stepping/stepOver", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverTest") - model("stepping/filters", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest") - model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest") - } - - testClass { - model("evaluation/singleBreakpoint", testMethod = "doSingleBreakpointTest") - model("evaluation/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest") - } - - testClass { - model("selectExpression", recursive = false) - model("selectExpression/disallowMethodCalls", testMethod = "doTestWoMethodCalls") - } - - testClass { - model("positionManager", recursive = false, extension = "kt", testClassName = "SingleFile") - model("positionManager", recursive = false, extension = null, testClassName = "MultiFile") - } - - testClass { - model("smartStepInto") - } - - testClass { - model("breakpointApplicability") - } - - testClass { - model("fileRanking") - } - - testClass { - model("asyncStackTrace") - } - - testClass { - // TODO: implement mapping logic for terminal operations - model("sequence/streams/sequence", excludeDirs = listOf("terminal")) - } - } - - testGroup("idea/tests", "idea/testData") { - testClass { - model("resolve/additionalLazyResolve") - } - - testClass { - model("resolve/partialBodyResolve") - } - - testClass { - model("checker", recursive = false) - model("checker/regression") - model("checker/recovery") - model("checker/rendering") - model("checker/scripts", extension = "kts") - model("checker/duplicateJvmSignature") - model("checker/infos", testMethod = "doTestWithInfos") - model("checker/diagnosticsMessage") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - model("kotlinAndJavaChecker/javaWithKotlin") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - } - - testClass { - model("unifier") - } - - testClass { - model("checker/codeFragments", extension = "kt", recursive = false) - model("checker/codeFragments/imports", testMethod = "doTestWithImport", extension = "kt") - } - - testClass { - model("quickfix.special/codeFragmentAutoImport", extension = "kt", recursive = false) - } - - testClass { - model("checker/js") - } - - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass { - model("navigation/gotoSuper", extension = "test", recursive = false) - } - - testClass { - model("navigation/gotoTypeDeclaration", extension = "test") - } - - testClass { - model("navigation/gotoDeclaration", extension = "test") - } - - testClass { - model( - "parameterInfo", - pattern = "^([\\w\\-_]+)\\.kt$", recursive = true, - excludeDirs = listOf("withLib1/sharedLib", "withLib2/sharedLib", "withLib3/sharedLib") - ) - } - - testClass { - model("navigation/gotoClass", testMethod = "doClassTest") - model("navigation/gotoSymbol", testMethod = "doSymbolTest") - } - - testClass() { - model("decompiler/navigation/usercode") - } - - testClass() { - model("decompiler/navigation/userJavaCode", pattern = "^(.+)\\.java$") - } - - testClass() { - model("decompiler/navigation/usercode", testClassName = "UsercodeWithJSModule") - } - - testClass { - model("decompiler/navigation/usercode") - } - - testClass { - model("navigation/implementations", recursive = false) - } - - testClass { - model("navigation/gotoTestOrCode", pattern = "^(.+)\\.main\\..+\$") - } - - testClass { - model("search/inheritance") - } - - testClass { - model("search/annotations") - } - - testClass { - model("quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("typealiasExpansionIndex") - } - - testClass { - model("highlighter") - } - - testClass { - model("dslHighlighter") - } - - testClass { - model("usageHighlighter") - } - - testClass { - model("folding/noCollapse") - model("folding/checkCollapse", testMethod = "doSettingsFoldingTest") - } - - testClass { - model("codeInsight/surroundWith/if", testMethod = "doTestWithIfSurrounder") - model("codeInsight/surroundWith/ifElse", testMethod = "doTestWithIfElseSurrounder") - model("codeInsight/surroundWith/ifElseExpression", testMethod = "doTestWithIfElseExpressionSurrounder") - model("codeInsight/surroundWith/ifElseExpressionBraces", testMethod = "doTestWithIfElseExpressionBracesSurrounder") - model("codeInsight/surroundWith/not", testMethod = "doTestWithNotSurrounder") - model("codeInsight/surroundWith/parentheses", testMethod = "doTestWithParenthesesSurrounder") - model("codeInsight/surroundWith/stringTemplate", testMethod = "doTestWithStringTemplateSurrounder") - model("codeInsight/surroundWith/when", testMethod = "doTestWithWhenSurrounder") - model("codeInsight/surroundWith/tryCatch", testMethod = "doTestWithTryCatchSurrounder") - model("codeInsight/surroundWith/tryCatchExpression", testMethod = "doTestWithTryCatchExpressionSurrounder") - model("codeInsight/surroundWith/tryCatchFinally", testMethod = "doTestWithTryCatchFinallySurrounder") - model("codeInsight/surroundWith/tryCatchFinallyExpression", testMethod = "doTestWithTryCatchFinallyExpressionSurrounder") - model("codeInsight/surroundWith/tryFinally", testMethod = "doTestWithTryFinallySurrounder") - model("codeInsight/surroundWith/functionLiteral", testMethod = "doTestWithFunctionLiteralSurrounder") - model("codeInsight/surroundWith/withIfExpression", testMethod = "doTestWithSurroundWithIfExpression") - model("codeInsight/surroundWith/withIfElseExpression", testMethod = "doTestWithSurroundWithIfElseExpression") - } - - testClass { - model("joinLines") - } - - testClass { - model("codeInsight/breadcrumbs") - } - - testClass { - model("intentions", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("intentions/loopToCallChain", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("concatenatedStringGenerator", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("intentions", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspections", pattern = "^(inspections\\.test)$", singleClass = true) - model("inspectionsLocal", pattern = "^(inspections\\.test)$", singleClass = true) - } - - testClass { - model("inspectionsLocal", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") - } - - testClass { - model("hierarchy/class/type", extension = null, recursive = false, testMethod = "doTypeClassHierarchyTest") - model("hierarchy/class/super", extension = null, recursive = false, testMethod = "doSuperClassHierarchyTest") - model("hierarchy/class/sub", extension = null, recursive = false, testMethod = "doSubClassHierarchyTest") - model("hierarchy/calls/callers", extension = null, recursive = false, testMethod = "doCallerHierarchyTest") - model("hierarchy/calls/callersJava", extension = null, recursive = false, testMethod = "doCallerJavaHierarchyTest") - model("hierarchy/calls/callees", extension = null, recursive = false, testMethod = "doCalleeHierarchyTest") - model("hierarchy/overrides", extension = null, recursive = false, testMethod = "doOverrideHierarchyTest") - } - - testClass { - model("hierarchy/withLib", extension = null, recursive = false) - } - - testClass { - model("codeInsight/moveUpDown/classBodyDeclarations", pattern = KT_OR_KTS, testMethod = "doTestClassBodyDeclaration") - model("codeInsight/moveUpDown/closingBraces", testMethod = "doTestExpression") - model("codeInsight/moveUpDown/expressions", pattern = KT_OR_KTS, testMethod = "doTestExpression") - model("codeInsight/moveUpDown/parametersAndArguments", testMethod = "doTestExpression") - model("codeInsight/moveUpDown/trailingComma", testMethod = "doTestExpressionWithTrailingComma") - } - - testClass { - model("codeInsight/moveLeftRight") - } - - testClass { - model("refactoring/inline", pattern = "^(\\w+)\\.kt$") - } - - testClass { - model("codeInsight/unwrapAndRemove/removeExpression", testMethod = "doTestExpressionRemover") - model("codeInsight/unwrapAndRemove/unwrapThen", testMethod = "doTestThenUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapElse", testMethod = "doTestElseUnwrapper") - model("codeInsight/unwrapAndRemove/removeElse", testMethod = "doTestElseRemover") - model("codeInsight/unwrapAndRemove/unwrapLoop", testMethod = "doTestLoopUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapTry", testMethod = "doTestTryUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapCatch", testMethod = "doTestCatchUnwrapper") - model("codeInsight/unwrapAndRemove/removeCatch", testMethod = "doTestCatchRemover") - model("codeInsight/unwrapAndRemove/unwrapFinally", testMethod = "doTestFinallyUnwrapper") - model("codeInsight/unwrapAndRemove/removeFinally", testMethod = "doTestFinallyRemover") - model("codeInsight/unwrapAndRemove/unwrapLambda", testMethod = "doTestLambdaUnwrapper") - model("codeInsight/unwrapAndRemove/unwrapFunctionParameter", testMethod = "doTestFunctionParameterUnwrapper") - } - - testClass { - model("codeInsight/expressionType") - } - - testClass { - model("editor/backspaceHandler") - } - - testClass { - model("editor/enterHandler/multilineString") - } - - testClass { - model("editor/quickDoc", pattern = """^([^_]+)\.(kt|java)$""") - } - - testClass { - model("refactoring/safeDelete/deleteClass/kotlinClass", testMethod = "doClassTest") - model("refactoring/safeDelete/deleteClass/kotlinClassWithJava", testMethod = "doClassTestWithJava") - model("refactoring/safeDelete/deleteClass/javaClassWithKotlin", extension = "java", testMethod = "doJavaClassTest") - model("refactoring/safeDelete/deleteObject/kotlinObject", testMethod = "doObjectTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunction", testMethod = "doFunctionTest") - model("refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava", testMethod = "doFunctionTestWithJava") - model("refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin", testMethod = "doJavaMethodTest") - model("refactoring/safeDelete/deleteProperty/kotlinProperty", testMethod = "doPropertyTest") - model("refactoring/safeDelete/deleteProperty/kotlinPropertyWithJava", testMethod = "doPropertyTestWithJava") - model("refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin", testMethod = "doJavaPropertyTest") - model("refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias", testMethod = "doTypeAliasTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter", testMethod = "doTypeParameterTest") - model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", testMethod = "doTypeParameterTestWithJava") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameter", testMethod = "doValueParameterTest") - model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava", testMethod = "doValueParameterTestWithJava") - } - - testClass { - model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - model("resolve/referenceInJava/sourceOnly", extension = "java") - } - - testClass { - model("resolve/referenceInJava/binaryAndSource", extension = "java") - } - - testClass { - model("resolve/referenceWithLib", recursive = false) - } - - testClass { - model("resolve/referenceInLib", recursive = false) - } - - testClass { - model("resolve/referenceToJavaWithWrongFileStructure", recursive = false) - } - - testClass { - model("findUsages/kotlin", pattern = """^(.+)\.0\.(kt|kts)$""") - model("findUsages/java", pattern = """^(.+)\.0\.java$""") - model("findUsages/propertyFiles", pattern = """^(.+)\.0\.properties$""") - } - - testClass { - model("findUsages/libraryUsages", pattern = """^(.+)\.0\.kt$""") - } - - testClass { - model("refactoring/move", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copy", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/moveMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/copyMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/safeDeleteMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("multiFileIntentions", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileLocalInspections", extension = "test", singleClass = true, filenameStartsLowerCase = true) - } - - testClass { - model("multiFileInspections", extension = "test", singleClass = true) - } - - testClass { - model("formatter", pattern = """^([^\.]+)\.after\.kt.*$""") - model( - "formatter/trailingComma", pattern = """^([^\.]+)\.call\.after\.kt.*$""", - testMethod = "doTestCallSite", testClassName = "FormatterCallSite" - ) - model( - "formatter", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", - testMethod = "doTestInverted", testClassName = "FormatterInverted" - ) - model( - "formatter/trailingComma", pattern = """^([^\.]+)\.call\.after\.inv\.kt.*$""", - testMethod = "doTestInvertedCallSite", testClassName = "FormatterInvertedCallSite" - ) - } - - testClass { - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.kt.*$""", testMethod = "doNewlineTest", - testClassName = "DirectSettings") - model("indentationOnNewline", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", testMethod = "doNewlineTestWithInvert", - testClassName = "InvertedSettings") - } - - testClass { - model("diagnosticMessage", recursive = false) - } - - testClass { - model("diagnosticMessage/js", recursive = false, targetBackend = TargetBackend.JS) - } - - testClass { - model("refactoring/rename", extension = "test", singleClass = true) - } - - testClass { - model("refactoring/renameMultiModule", extension = "test", singleClass = true) - } - - testClass { - model("codeInsight/outOfBlock", pattern = KT_OR_KTS) - } - - testClass { - model("dataFlowValueRendering") - } - - testClass { - model("copyPaste/conversion", pattern = """^([^\.]+)\.java$""") - } - - testClass { - model("copyPaste/plainTextConversion", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/plainTextLiteral", pattern = """^([^\.]+)\.txt$""") - } - - testClass { - model("copyPaste/literal", pattern = """^([^\.]+)\.kt$""") - } - - testClass { - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCopy", testClassName = "Copy", recursive = false) - model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCut", testClassName = "Cut", recursive = false) - } - - testClass { - model("copyPaste/moveDeclarations", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTest") - } - - testClass { - model("copyright", pattern = KT_OR_KTS, testMethod = "doTest") - } - - testClass { - model("exitPoints") - } - - testClass { - model("codeInsight/lineMarker") - } - - testClass { - model("codeInsightInLibrary/lineMarker", testMethod = "doTestWithLibrary") - } - - testClass { - model("multiModuleLineMarker", extension = null, recursive = false) - } - - testClass { - model("shortenRefs", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("addImport", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("smartSelection", testMethod = "doTestSmartSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("structureView/fileStructure", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("expressionSelection", testMethod = "doTestExpressionSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledTextJvm", pattern = """^([^\.]+)$""") - } - - testClass { - model("decompiler/decompiledText", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/decompiledTextJs", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) - } - - testClass { - model("decompiler/stubBuilder", extension = null, recursive = false) - } - - testClass { - model("editor/optimizeImports/jvm", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - testClass { - model("editor/optimizeImports/js", pattern = KT_WITHOUT_DOTS_IN_NAME) - model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("debugger/exceptionFilter", pattern = """^([^\.]+)$""", recursive = false) - } - - testClass { - model("stubs", extension = "kt") - } - - testClass { - model("multiFileHighlighting", recursive = false) - } - - testClass { - model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null) - } - - testClass { - model("multiModuleQuickFix", extension = null, deep = 1) - } - - testClass { - model("navigation/implementations/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/relatedSymbols/multiModule", recursive = false, extension = null) - } - - testClass { - model("navigation/gotoSuper/multiModule", recursive = false, extension = null) - } - - testClass { - model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest") - model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest") - model("refactoring/introduceProperty", pattern = KT_OR_KTS, testMethod = "doIntroducePropertyTest") - model("refactoring/introduceParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceSimpleParameterTest") - model("refactoring/introduceLambdaParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceLambdaParameterTest") - model("refactoring/introduceJavaParameter", extension = "java", testMethod = "doIntroduceJavaParameterTest") - model("refactoring/introduceTypeParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeParameterTest") - model("refactoring/introduceTypeAlias", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeAliasTest") - model("refactoring/extractSuperclass", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractSuperclassTest") - model("refactoring/extractInterface", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractInterfaceTest") - } - - testClass { - model("refactoring/pullUp/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") - model("refactoring/pullUp/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") - model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") - } - - testClass { - model("refactoring/pushDown/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") - model("refactoring/pushDown/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") - model("refactoring/pushDown/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") - } - - testClass { - model("coverage/outputFiles") - } - - testClass { - model("internal/toolWindow", recursive = false, extension = null) - } - - testClass("org.jetbrains.kotlin.idea.kdoc.KdocResolveTestGenerated") { - model("kdoc/resolve") - } - - testClass { - model("kdoc/highlighting") - } - - testClass { - model("kdoc/typing") - } - - testClass { - model("codeInsight/generate/testFrameworkSupport") - } - - testClass { - model("codeInsight/generate/equalsWithHashCode") - } - - testClass { - model("codeInsight/generate/secondaryConstructors") - } - - testClass { - model("codeInsight/generate/toString") - } - - testClass { - model("repl/completion") - } - - testClass { - model("codeInsight/postfix") - } - - testClass { - model("script/definition/highlighting", extension = null, recursive = false) - model("script/definition/complex", extension = null, recursive = false, testMethod = "doComplexTest") - } - - testClass { - model("script/definition/navigation", extension = null, recursive = false) - } - - testClass { - model("script/definition/completion", extension = null, recursive = false) - } - - testClass { - model("script/definition/order", extension = null, recursive = false) - } - - testClass { - model("refactoring/nameSuggestionProvider") - } - - testClass { - model("slicer", excludeDirs = listOf("mpp")) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/mpp", recursive = false, extension = null) - } - } - - testGroup("idea/scripting-support/test", "idea/scripting-support/testData") { - testClass { - model( - "scratch", - extension = "kts", - testMethod = "doScratchCompilingTest", - testClassName = "ScratchCompiling", - recursive = false - ) - model("scratch", extension = "kts", testMethod = "doScratchReplTest", testClassName = "ScratchRepl", recursive = false) - model( - "scratch/multiFile", - extension = null, - testMethod = "doScratchMultiFileTest", - testClassName = "ScratchMultiFile", - recursive = false - ) - - model( - "worksheet", - extension = "ws.kts", - testMethod = "doWorksheetCompilingTest", - testClassName = "WorksheetCompiling", - recursive = false - ) - model( - "worksheet", - extension = "ws.kts", - testMethod = "doWorksheetReplTest", - testClassName = "WorksheetRepl", - recursive = false - ) - model( - "worksheet/multiFile", - extension = null, - testMethod = "doWorksheetMultiFileTest", - testClassName = "WorksheetMultiFile", - recursive = false - ) - - model( - "scratch/rightPanelOutput", - extension = "kts", - testMethod = "doRightPreviewPanelOutputTest", - testClassName = "ScratchRightPanelOutput", - recursive = false - ) - } - - testClass { - model("scratch/lineMarker", testMethod = "doScratchTest", pattern = KT_OR_KTS) - } - - testClass { - model("script/templatesFromDependencies", extension = null, recursive = false) - } - } - - /* - // Maven and Gradle are not relevant for AS branch - - testGroup("idea/idea-maven/test", "idea/idea-maven/testData") { - testClass { - model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven") - model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven") - } - - testClass { - model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true) - } - } - - testGroup("idea/idea-gradle/tests", "idea/testData") { - testClass { - model("configuration/gradle", extension = null, recursive = false, testMethod = "doTestGradle") - model("configuration/gsk", extension = null, recursive = false, testMethod = "doTestGradle") - } - } - - */ - - testGroup("idea/tests", "compiler/testData") { - testClass { - model("loadJava/compiledKotlin") - } - - testClass { - model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("delegation", "script"), pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("asJava/script/ide", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - } - - testGroup("idea/idea-completion/tests", "idea/idea-completion/testData") { - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava", extension = "java", recursive = false) - } - - testClass { - model("injava/stdlib", extension = "java", recursive = false) - } - - testClass { - model("weighers/basic", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("weighers/smart", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("basic/common") - model("basic/js") - } - - testClass { - model("basic/common") - model("basic/java") - } - - testClass { - model("smart") - } - - testClass { - model("keywords", recursive = false) - } - - testClass { - model("basic/withLib", recursive = false) - } - - testClass { - model("handlers/basic", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("handlers/smart") - } - - testClass { - model("handlers/keywords") - } - - testClass { - model("handlers/charFilter") - } - - testClass { - model("basic/multifile", extension = null, recursive = false) - } - - testClass { - model("smartMultiFile", extension = null, recursive = false) - } - - testClass("KDocCompletionTestGenerated") { - model("kdoc") - } - - testClass { - model("basic/java8") - } - - testClass { - model("incrementalResolve") - } - - testClass { - model("multiPlatform", recursive = false, extension = null) - } - } - - //TODO: move these tests into idea-completion module - testGroup("idea/tests", "idea/idea-completion/testData") { - testClass { - model("handlers/runtimeCast") - } - - testClass { - model("basic/codeFragments", extension = "kt") - } - } - - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("multiFile", extension = null, recursive = false) - } - } - testGroup("j2k/tests", "j2k/testData") { - testClass { - model("fileOrElement", extension = "java") - } - } - - testGroup("nj2k/tests", "nj2k/testData") { - testClass { - model("newJ2k", pattern = """^([^\.]+)\.java$""") - } - testClass { - model("inference/common") - } - testClass { - model("inference/nullability") - } - testClass { - model("inference/mutability") - } - testClass { - model("copyPaste", pattern = """^([^\.]+)\.java$""") - } - testClass { - model("copyPastePlainText", pattern = """^([^\.]+)\.txt$""") - } - testClass { - model("multiFile", extension = null, recursive = false) - } - } - - /* There is no jps in AS - .... - */ - testGroup("compiler/incremental-compilation-impl/test", "jps-plugin/testData") { - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true) - model("incremental/withJava", extension = null, excludeParentDirs = true) - model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/classHierarchyAffected", extension = null, recursive = false) - model("incremental/js", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/js/friendsModuleDisabled", extension = null, recursive = false) - } - - testClass { - model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) - } - testClass { - model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) - } - } - - testGroup("plugins/android-extensions/android-extensions-compiler/test", "plugins/android-extensions/android-extensions-compiler/testData") { - testClass { - model("descriptors", recursive = false, extension = null) - } - - testClass { - model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest") - model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke") - } - - testClass { - model("codegen/bytecodeShape", recursive = false, extension = null) - } - - testClass { - model("parcel/codegen") - } - } - - testGroup("plugins/parcelize/parcelize-compiler/tests", "plugins/parcelize/parcelize-compiler/testData") { - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - - testClass { - model("box", targetBackend = TargetBackend.JVM_IR) - } - - testClass { - model("codegen", targetBackend = TargetBackend.JVM) - } - - testClass { - model("codegen", targetBackend = TargetBackend.JVM_IR) - } - } - - testGroup("plugins/parcelize/parcelize-ide/tests", "plugins/parcelize/parcelize-ide/testData") { - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass { - model("checker", extension = "kt") - } - } - - testGroup("plugins/kapt3/kapt3-compiler/test", "plugins/kapt3/kapt3-compiler/testData") { - testClass { - model("converter") - } - - testClass { - model("kotlinRunner") - } - } - - testGroup("plugins/kapt3/kapt3-cli/test", "plugins/kapt3/kapt3-cli/testData") { - testClass { - model("argumentParsing", extension = "txt") - } - - testClass { - model("integration", recursive = false, extension = null) - } - } - - testGroup("plugins/allopen/allopen-cli/test", "plugins/allopen/allopen-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - testClass { - model("bytecodeListing", extension = "kt") - } - } - - testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { - testClass { model("diagnostics", extension = "kt") } - - testClass { - model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM) - } - testClass { - model("bytecodeListing", extension = "kt", targetBackend = TargetBackend.JVM_IR) - } - - testClass { model("box", targetBackend = TargetBackend.JVM) } - testClass { model("box", targetBackend = TargetBackend.JVM_IR) } - } - - testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { - testClass { - model("diagnostics") - } - testClass { - model("script", extension = "kts") - } - } - - testGroup( - "plugins/kotlin-serialization/kotlin-serialization-compiler/test", - "plugins/kotlin-serialization/kotlin-serialization-compiler/testData" - ) { - testClass { - model("diagnostics") - } - - testClass { - model("codegen") - } - - testClass { - model("codegen") - } - } - - testGroup( - "plugins/kotlin-serialization/kotlin-serialization-ide/test", - "plugins/kotlin-serialization/kotlin-serialization-ide/testData" - ) { - testClass { - model("diagnostics") - } - testClass { - model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - } - /* - testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") { - testClass { - model("android/completion", recursive = false, extension = null) - } - - testClass { - model("android/goto", recursive = false, extension = null) - } - - testClass { - model("android/rename", recursive = false, extension = null) - } - - testClass { - model("android/renameLayout", recursive = false, extension = null) - } - - testClass { - model("android/findUsages", recursive = false, extension = null) - } - - testClass { - model("android/usageHighlighting", recursive = false, extension = null) - } - - testClass { - model("android/extraction", recursive = false, extension = null) - } - - testClass { - model("android/parcel/checker", excludeParentDirs = true) - } - - testClass { - model("android/parcel/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - } - - testGroup("idea/idea-android/tests", "idea/testData") { - testClass { - model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle") - model("configuration/android-gsk", pattern = """(\w+)_before\.gradle.kts$""", testMethod = "doTestAndroidGradle") - } - - testClass { - model("android/intention", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/resourceIntention", extension = "test", singleClass = true) - } - - testClass { - model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") - } - - testClass { - model("android/lint", excludeParentDirs = true) - } - - testClass { - model("android/lintQuickfix", pattern = "^([\\w\\-_]+)\\.kt$") - } - - testClass { - model("android/folding") - } - - testClass { - model("android/gutterIcon") - } - } - */ - } -} diff --git a/gradle/versions.properties.201 b/gradle/versions.properties.201 deleted file mode 100644 index d5839bf4638..00000000000 --- a/gradle/versions.properties.201 +++ /dev/null @@ -1,19 +0,0 @@ -versions.intellijSdk=201.7223.91 -versions.idea.NodeJS=193.6494.7 -versions.jar.asm-all=7.0.1 -versions.jar.guava=28.2-jre -versions.jar.groovy-all=2.4.17 -versions.jar.lombok-ast=0.2.3 -versions.jar.swingx-core=1.6.2-2 -versions.jar.kxml2=2.3.0 -versions.jar.streamex=0.7.2 -versions.jar.gson=2.8.6 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -versions.jar.serviceMessages=2019.1.4 -versions.jar.lz4-java=1.7.1 -ignore.jar.snappy-in-java=true -versions.gradle-api=4.5.1 -versions.shadow=6.1.0 -versions.junit-bom=5.7.0 -versions.org.junit.platform=1.7.0 diff --git a/gradle/versions.properties.as41 b/gradle/versions.properties.as41 deleted file mode 100644 index dcdc3f09e14..00000000000 --- a/gradle/versions.properties.as41 +++ /dev/null @@ -1,23 +0,0 @@ -versions.intellijSdk=201.7223.91 -versions.idea.NodeJS=193.6494.7 -versions.androidStudioRelease=4.1.0.18 -versions.androidStudioBuild=201.6823847 -versions.jar.asm-all=7.0.1 -versions.jar.guava=28.2-jre -versions.jar.groovy-all=2.4.17 -versions.jar.lombok-ast=0.2.3 -versions.jar.swingx-core=1.6.2-2 -versions.jar.kxml2=2.3.0 -versions.jar.streamex=0.7.2 -versions.jar.gson=2.8.6 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -versions.jar.serviceMessages=2019.1.4 -versions.jar.lz4-java=1.7.1 -ignore.jar.snappy-in-java=true -versions.gradle-api=4.5.1 -versions.shadow=6.1.0 -ignore.jar.common=true -ignore.jar.lombok-ast=true -versions.junit-bom=5.7.0 -versions.org.junit.platform=1.7.0 diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 b/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 deleted file mode 100644 index 40cb12de4ac..00000000000 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysEmptyString/PropertyKeysEmptyString.kt.201 +++ /dev/null @@ -1,13 +0,0 @@ -import org.jetbrains.annotations.PropertyKey - -fun message(@PropertyKey(resourceBundle = "PropertyKeysEmptyString") key: String) = key - -fun test() { - message("") -} - -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysEmptyString" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysEmptyString" } -// NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 b/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 deleted file mode 100644 index e3412202680..00000000000 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysNoPrefix/PropertyKeysNoPrefix.kt.201 +++ /dev/null @@ -1,13 +0,0 @@ -import org.jetbrains.annotations.PropertyKey - -fun message(@PropertyKey(resourceBundle = "PropertyKeysNoPrefix") key: String) = key - -fun test() { - message("foo") -} - -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "bar.baz", itemText: "bar.baz", tailText: "2", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysNoPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysNoPrefix" } -// NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 b/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 deleted file mode 100644 index c6459771214..00000000000 --- a/idea/idea-completion/testData/basic/multifile/PropertyKeysWithPrefix/PropertyKeysWithPrefix.kt.201 +++ /dev/null @@ -1,12 +0,0 @@ -import org.jetbrains.annotations.PropertyKey - -fun message(@PropertyKey(resourceBundle = "PropertyKeysWithPrefix") key: String) = key - -fun test() { - message("foo.") -} - -// EXIST: { lookupString: "foo.bar", itemText: "foo.bar", tailText: "1", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.bar.baz", itemText: "foo.bar.baz", tailText: "3", typeText: "PropertyKeysWithPrefix" } -// EXIST: { lookupString: "foo.test", itemText: "foo.test", tailText: "4", typeText: "PropertyKeysWithPrefix" } -// NOTHING_ELSE \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 b/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 deleted file mode 100644 index 526a762cab2..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/DaemonCodeAnalyzerStatusService.kt.201 +++ /dev/null @@ -1,43 +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 - -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer -import com.intellij.openapi.Disposable -import com.intellij.openapi.fileEditor.FileEditor -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.idea.util.application.getServiceSafe - -class DaemonCodeAnalyzerStatusService(project: Project) : Disposable { - companion object { - fun getInstance(project: Project): DaemonCodeAnalyzerStatusService = project.getServiceSafe() - } - - @Volatile - var daemonRunning: Boolean = false - private set - - init { - val messageBusConnection = project.messageBus.connect(this) - messageBusConnection.subscribe(DaemonCodeAnalyzer.DAEMON_EVENT_TOPIC, object : DaemonCodeAnalyzer.DaemonListener { - override fun daemonStarting(fileEditors: MutableCollection) { - daemonRunning = true - } - - override fun daemonFinished(fileEditors: MutableCollection) { - daemonRunning = false - } - - override fun daemonCancelEventOccurred(reason: String) { - daemonRunning = false - } - }) - } - - override fun dispose() { - - } -} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as41 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as41 deleted file mode 100644 index 0e1adf9ff46..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as41 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.statistics - -open class KotlinFUSLogger { - companion object { - fun log(group: FUSEventGroups, event: String) { - // Not whitelisted for AS - } - - fun log(group: FUSEventGroups, event: String, eventData: Map) { - // Not whitelisted for AS - } - } -} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as41 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as41 deleted file mode 100644 index 3fe75589e1c..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as41 +++ /dev/null @@ -1,3 +0,0 @@ -class ProjectConfigurationCollector { - // Not whitelisted -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 deleted file mode 100644 index b103d5e48be..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/actions/ShowKotlinGradleDslLogs.kt.201 +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2010-2019 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.actions - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.ide.actions.RevealFileAction -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.DumbAware -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.MessageType -import com.intellij.openapi.ui.popup.JBPopupFactory -import com.intellij.openapi.util.SystemInfo -import com.intellij.openapi.wm.WindowManager -import com.intellij.psi.PsiFile -import com.intellij.ui.BrowserHyperlinkListener -import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle -import java.io.File - -class ShowKotlinGradleDslLogs : IntentionAction, AnAction(), DumbAware { - override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { - openLogsDirIfPresent(project) - } - - override fun actionPerformed(e: AnActionEvent) { - val project = e.project ?: return - openLogsDirIfPresent(project) - } - - override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?) = RevealFileAction.isSupported() - - override fun update(e: AnActionEvent) { - val presentation = e.presentation - presentation.isEnabledAndVisible = e.project != null && RevealFileAction.isSupported() - presentation.text = NAME - } - - private fun openLogsDirIfPresent(project: Project) { - val logsDir = findLogsDir() - if (logsDir != null) { - RevealFileAction.openDirectory(logsDir) - } else { - val parent = WindowManager.getInstance().getStatusBar(project)?.component - ?: WindowManager.getInstance().findVisibleFrame().rootPane - JBPopupFactory.getInstance() - .createHtmlTextBalloonBuilder( - KotlinIdeaGradleBundle.message( - "text.gradle.dsl.logs.cannot.be.found.automatically.see.how.to.find.logs", - gradleTroubleshootingLink - ), - MessageType.ERROR, - BrowserHyperlinkListener.INSTANCE - ) - .setFadeoutTime(5000) - .createBalloon() - .showInCenterOf(parent) - } - } - - /** The way how to find Gradle logs is described here - * @see org.jetbrains.kotlin.idea.actions.ShowKotlinGradleDslLogs.gradleTroubleshootingLink - */ - private fun findLogsDir(): File? { - val userHome = System.getProperty("user.home") - return when { - SystemInfo.isMac -> File("$userHome/Library/Logs/gradle-kotlin-dsl") - SystemInfo.isLinux -> File("$userHome/.gradle-kotlin-dsl/logs") - SystemInfo.isWindows -> File("$userHome/AppData/Local/gradle-kotlin-dsl/log") - else -> null - }.takeIf { it?.exists() == true } - } - - override fun startInWriteAction() = false - - override fun getText() = NAME - - override fun getFamilyName() = NAME - - companion object { - private const val gradleTroubleshootingLink = "https://docs.gradle.org/current/userguide/kotlin_dsl.html#troubleshooting" - - val NAME = KotlinIdeaGradleBundle.message("action.text.show.kotlin.gradle.dsl.logs.in", RevealFileAction.getFileManagerName()) - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as41 deleted file mode 100644 index 6bbb8c73dc3..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as41 +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2019 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.gradle - -fun KaptImportingTest.isAndroidStudio() = true diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as41 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as41 deleted file mode 100644 index bd96057db50..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as41 +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2010-2019 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.codeInsight.gradle - -fun isGradleInspectionTestApplicable() = false \ No newline at end of file diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt index 73cf9b5bf34..6d485c9908c 100644 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.isGradle import org.jetbrains.plugins.gradle.service.project.open.linkAndRefreshGradleProject import java.nio.file.Path -// FIX ME WHEN BUNCH 201 REMOVED class IdeaGradleWizardService(private val project: Project) : ProjectImportingWizardService, IdeaWizardService { override fun isSuitableFor(buildSystemType: BuildSystemType): Boolean = diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as41 b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as41 deleted file mode 100644 index 47feb237c39..00000000000 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as41 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2019 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.tools.projectWizard.wizard.service - -import com.intellij.openapi.project.Project -import java.nio.file.Path - -class MavenProjectImporter(private val project: Project) { - fun importProject(path: Path) { - // AS does not support Maven - } -} \ No newline at end of file diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt index 7aad9c609b6..7579e9b2465 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCase.kt @@ -95,7 +95,6 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix } - runPostStartupActivitiesOnce(project) VfsRootAccess.allowRootAccess(project, KtTestUtil.getHomeDirectory()) EditorTracker.getInstance(project) diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 deleted file mode 100644 index 0b25e4f48ce..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.201 +++ /dev/null @@ -1,98 +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.test; - -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; -import com.intellij.testFramework.TempFiles; -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import gnu.trove.THashSet; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.WithMutedInDatabaseRunTest; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.nio.charset.Charset; -import java.util.Collection; - -@WithMutedInDatabaseRunTest -public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase { - @NotNull - @Override - public Project getProject() { - return super.getProject(); - } - - @NotNull - @Override - public Editor getEditor() { - return super.getEditor(); - } - - @Override - public PsiFile getFile() { - return super.getFile(); - } - - protected final Collection myFilesToDelete = new THashSet<>(); - private final TempFiles myTempFiles = new TempFiles(myFilesToDelete); - - @Override - protected void tearDown() throws Exception { - myTempFiles.deleteAll(); - super.tearDown(); - } - - @NotNull - public VirtualFile createTempFile( - @NonNls @NotNull String ext, - @Nullable byte[] bom, - @NonNls @NotNull String content, - @NotNull Charset charset - ) throws IOException { - File temp = FileUtil.createTempFile("copy", "." + ext); - setContentOnDisk(temp, bom, content, charset); - - myFilesToDelete.add(temp); - final VirtualFile file = getVirtualFile(temp); - assert file != null : temp; - return file; - } - - public static void setContentOnDisk(@NotNull File file, @Nullable byte[] bom, @NotNull String content, @NotNull Charset charset) - throws IOException { - FileOutputStream stream = new FileOutputStream(file); - if (bom != null) { - stream.write(bom); - } - try (OutputStreamWriter writer = new OutputStreamWriter(stream, charset)) { - writer.write(content); - } - } - - protected static VirtualFile getVirtualFile(@NotNull File file) { - return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); - } - - @Override - protected void runTest() throws Throwable { - //noinspection Convert2MethodRef - KotlinTestUtils.runTestWithThrowable(this, () -> super.runTest()); - } - - protected boolean isFirPlugin() { - return false; - } -} diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt index af9f0577a4c..4b19e134619 100644 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightPlatformCodeInsightFixtureTestCase.kt @@ -26,7 +26,6 @@ abstract class KotlinLightPlatformCodeInsightFixtureTestCase : LightPlatformCode override fun setUp() { super.setUp() enableKotlinOfficialCodeStyle(project) - runPostStartupActivitiesOnce(project) VfsRootAccess.allowRootAccess(KtTestUtil.getHomeDirectory()) if (!isFirPlugin()) { invalidateLibraryCache(project) diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 deleted file mode 100644 index 0c36902154f..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/PluginTestCaseBase.java.201 +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.test; - -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.projectRoots.JavaSdk; -import com.intellij.openapi.projectRoots.ProjectJdkTable; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; -import kotlin.jvm.functions.Function0; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.TestOnly; -import org.jetbrains.kotlin.idea.util.IjPlatformUtil; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TestJdkKind; -import org.jetbrains.kotlin.test.util.KtTestUtil; - -import java.io.File; - -public class PluginTestCaseBase { - public static final String TEST_DATA_DIR = "idea/testData"; - public static final String TEST_DATA_PROJECT_RELATIVE = "/" + TEST_DATA_DIR; - - private PluginTestCaseBase() { - } - - @NotNull - public static String getTestDataPathBase() { - return KtTestUtil.getHomeDirectory() + TEST_DATA_PROJECT_RELATIVE; - } - - @NotNull - @TestOnly - private static Sdk createMockJdk(@NotNull String name, String path) { - return ((JavaSdkImpl)JavaSdk.getInstance()).createMockJdk(name, path, false); - } - - @NotNull - private static Sdk getSdk(String sdkHome, String name) { - ProjectJdkTable table = IjPlatformUtil.getProjectJdkTableSafe(); - Sdk existing = table.findJdk(name); - if (existing != null) { - return existing; - } - return JavaSdk.getInstance().createJdk(name, sdkHome, true); - } - - @NotNull - public static Sdk mockJdk() { - return getSdk("compiler/testData/mockJDK/jre", "Mock JDK"); - } - - @NotNull - public static Sdk mockJdk6() { - return getSdk("compiler/testData/mockJDK/jre", "1.6"); - } - - @NotNull - public static Sdk mockJdk8() { - // Using JDK 6, but with version 1.8 - return getSdk("compiler/testData/mockJDK/jre", "1.8"); - } - - @TestOnly - @NotNull - public static Sdk mockJdk9() { - return getSdk("compiler/testData/mockJDK9/jre", "9"); - } - - @NotNull - public static Sdk fullJdk() { - String javaHome = System.getProperty("java.home"); - assert new File(javaHome).isDirectory(); - return getSdk(javaHome, "Full JDK"); - } - - @NotNull - public static Sdk addJdk(@NotNull Disposable disposable, @NotNull Function0 getJdk) { - Sdk jdk = getJdk.invoke(); - Sdk[] allJdks = IjPlatformUtil.getProjectJdkTableSafe().getAllJdks(); - for (Sdk existingJdk : allJdks) { - if (existingJdk == jdk) { - return existingJdk; - } - } - ApplicationManager.getApplication().runWriteAction(() -> IjPlatformUtil.getProjectJdkTableSafe().addJdk(jdk, disposable)); - return jdk; - } - - @NotNull - public static Sdk jdk(@NotNull TestJdkKind kind) { - switch (kind) { - case MOCK_JDK: - return mockJdk(); - case FULL_JDK_9: - String jre9 = KtTestUtil.getJdk9Home().getPath(); - VfsRootAccess.allowRootAccess(jre9); - return getSdk(jre9, "Full JDK 9"); - case FULL_JDK: - return fullJdk(); - default: - throw new UnsupportedOperationException(kind.toString()); - } - } - - public static boolean isAllFilesPresentTest(@NotNull String testName) { - return StringUtil.startsWithIgnoreCase(testName, "allFilesPresentIn"); - } - - @TestOnly - public static void clearSdkTable(@NotNull Disposable disposable) { - Disposer.register(disposable, () -> ApplicationManager.getApplication().runWriteAction(() -> { - ProjectJdkTable jdkTable = IjPlatformUtil.getProjectJdkTableSafe(); - for (Sdk sdk : jdkTable.getAllJdks()) { - jdkTable.removeJdk(sdk); - } - })); - } -} diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt deleted file mode 100644 index 546cf746145..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt +++ /dev/null @@ -1,11 +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.test - -import com.intellij.openapi.project.Project - -fun runPostStartupActivitiesOnce(project: Project) { -} diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 deleted file mode 100644 index 7a30408b6e9..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.201 +++ /dev/null @@ -1,15 +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.test - -import com.intellij.ide.startup.impl.StartupManagerImpl -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager - -// FIX ME WHEN BUNCH 201 REMOVED -fun runPostStartupActivitiesOnce(project: Project) { - (StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivitiesRegisteredDynamically() -} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 deleted file mode 100644 index 45902d36701..00000000000 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt.201 +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2010-2019 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.debugger.render - -import com.intellij.debugger.DebuggerManagerEx -import com.intellij.debugger.engine.DebuggerManagerThreadImpl -import com.intellij.debugger.engine.evaluation.EvaluationContext -import com.intellij.debugger.settings.NodeRendererSettings -import com.intellij.debugger.ui.impl.watch.MessageDescriptor -import com.intellij.debugger.ui.impl.watch.NodeManagerImpl -import com.intellij.debugger.ui.tree.DebuggerTreeNode -import com.intellij.debugger.ui.tree.ValueDescriptor -import com.intellij.debugger.ui.tree.render.ChildrenBuilder -import com.intellij.debugger.ui.tree.render.ClassRenderer -import com.intellij.debugger.ui.tree.render.DescriptorLabelListener -import com.intellij.openapi.diagnostic.Logger -import com.intellij.xdebugger.settings.XDebuggerSettingsManager -import com.sun.jdi.* -import org.jetbrains.kotlin.idea.debugger.* -import org.jetbrains.kotlin.load.java.JvmAbi -import java.util.* - -private val LOG = Logger.getInstance(KotlinClassWithDelegatedPropertyRenderer::class.java) -private fun notPreparedClassMessage(referenceType: ReferenceType) = - "$referenceType ${referenceType.isPrepared} ${referenceType.sourceName()}" - -class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() { - private val rendererSettings = NodeRendererSettings.getInstance() - - override fun isApplicable(jdiType: Type?): Boolean { - if (!super.isApplicable(jdiType) || jdiType !is ReferenceType || !jdiType.isPrepared || !jdiType.isInKotlinSources()) { - return false - } - - try { - return jdiType.allFields().any { it.name().endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX) } - } catch (notPrepared: ClassNotPreparedException) { - LOG.error(notPreparedClassMessage(jdiType), notPrepared) - } - - return false - } - - override fun calcLabel( - descriptor: ValueDescriptor, - evaluationContext: EvaluationContext, - listener: DescriptorLabelListener - ): String { - val res = calcToStringLabel(descriptor, evaluationContext, listener) - if (res != null) { - return res - } - - return super.calcLabel(descriptor, evaluationContext, listener) - } - - private fun calcToStringLabel( - descriptor: ValueDescriptor, evaluationContext: EvaluationContext, - listener: DescriptorLabelListener - ): String? { - val toStringRenderer = rendererSettings.toStringRenderer - if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) { - if (toStringRenderer.isApplicable(descriptor.type)) { - return toStringRenderer.calcLabel(descriptor, evaluationContext, listener) - } - } - return null - } - - override fun buildChildren(value: Value?, builder: ChildrenBuilder, context: EvaluationContext) { - DebuggerManagerThreadImpl.assertIsManagerThread() - - if (value !is ObjectReference) return - - val nodeManager = builder.nodeManager!! - val nodeDescriptorFactory = builder.descriptorManager!! - - val fields = value.referenceType().allFields() - if (fields.isEmpty()) { - builder.setChildren(listOf(nodeManager.createMessageNode(MessageDescriptor.CLASS_HAS_NO_FIELDS.label))) - return - } - - val children = ArrayList() - for (field in fields) { - if (!shouldDisplay(context, value, field)) { - continue - } - - val fieldDescriptor = nodeDescriptorFactory.getFieldDescriptor(builder.parentDescriptor, value, field) - - if (field.name().endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX)) { - val shouldRenderDelegatedProperty = KotlinDebuggerSettings.getInstance().renderDelegatedProperties - if (shouldRenderDelegatedProperty && !ToggleKotlinVariablesState.getService().kotlinVariableView) { - children.add(nodeManager.createNode(fieldDescriptor, context)) - } - - val delegatedPropertyDescriptor = DelegatedPropertyFieldDescriptor( - context.debugProcess.project!!, - value, - field, - shouldRenderDelegatedProperty - ) - children.add(nodeManager.createNode(delegatedPropertyDescriptor, context)) - } else { - children.add(nodeManager.createNode(fieldDescriptor, context)) - } - } - - if (XDebuggerSettingsManager.getInstance()!!.dataViewSettings.isSortValues) { - children.sortedWith(NodeManagerImpl.getNodeComparator()) - } - - builder.setChildren(children) - } - -} diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 deleted file mode 100644 index 4766c4f70d9..00000000000 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractKotlinEvaluateExpressionTest.kt.201 +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2010-2019 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.debugger.test - -import com.intellij.debugger.engine.ContextUtil -import com.intellij.debugger.engine.SuspendContextImpl -import com.intellij.debugger.engine.evaluation.CodeFragmentKind -import com.intellij.debugger.engine.evaluation.EvaluateException -import com.intellij.debugger.engine.evaluation.TextWithImportsImpl -import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl -import com.intellij.debugger.impl.DebuggerContextImpl -import com.intellij.debugger.impl.DebuggerContextImpl.createDebuggerContext -import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl -import com.intellij.openapi.util.io.FileUtil -import com.intellij.ui.treeStructure.Tree -import com.intellij.xdebugger.impl.ui.tree.ValueMarkup -import com.sun.jdi.ObjectReference -import org.jetbrains.eval4j.ObjectValue -import org.jetbrains.eval4j.Value -import org.jetbrains.eval4j.jdi.asValue -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinCodeFragmentFactory -import org.jetbrains.kotlin.idea.debugger.test.preference.DebuggerPreferences -import org.jetbrains.kotlin.idea.debugger.test.util.FramePrinter -import org.jetbrains.kotlin.idea.debugger.test.util.FramePrinterDelegate -import org.jetbrains.kotlin.idea.debugger.test.util.KotlinOutputChecker -import org.jetbrains.kotlin.idea.debugger.test.util.SteppingInstruction -import org.jetbrains.kotlin.idea.util.application.runReadAction -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.InTextDirectivesUtils.findLinesWithPrefixesRemoved -import org.jetbrains.kotlin.test.InTextDirectivesUtils.findStringWithPrefixes -import org.jetbrains.kotlin.test.KotlinBaseTest -import org.jetbrains.kotlin.test.TargetBackend -import java.io.File -import java.util.concurrent.ConcurrentHashMap -import javax.swing.tree.TreeNode - -private data class CodeFragment(val text: String, val result: String, val kind: CodeFragmentKind) - -private data class DebugLabel(val name: String, val localName: String) - -private class EvaluationTestData( - val instructions: List, - val fragments: List, - val debugLabels: List -) - -abstract class AbstractKotlinEvaluateExpressionTest : KotlinDescriptorTestCaseWithStepping(), FramePrinterDelegate { - private companion object { - private val ID_PART_REGEX = "id=[0-9]*".toRegex() - } - - override val debuggerContext: DebuggerContextImpl - get() = super.debuggerContext - - private var isMultipleBreakpointsTest = false - - private var framePrinter: FramePrinter? = null - - private val exceptions = ConcurrentHashMap() - - fun doSingleBreakpointTest(path: String) { - isMultipleBreakpointsTest = false - doTest(path) - } - - fun doMultipleBreakpointsTest(path: String) { - isMultipleBreakpointsTest = true - doTest(path) - } - - override fun doMultiFileTest(files: TestFiles, preferences: DebuggerPreferences) { - val wholeFile = files.wholeFile - - val instructions = SteppingInstruction.parse(wholeFile) - val expressions = loadExpressions(wholeFile) - val blocks = loadCodeBlocks(files.originalFile) - val debugLabels = loadDebugLabels(wholeFile) - - val data = EvaluationTestData(instructions, expressions + blocks, debugLabels) - - framePrinter = FramePrinter(myDebuggerSession, this, preferences, testRootDisposable) - - if (isMultipleBreakpointsTest) { - performMultipleBreakpointTest(data) - } else { - performSingleBreakpointTest(data) - } - } - - override fun tearDown() { - framePrinter?.close() - framePrinter = null - exceptions.clear() - - super.tearDown() - } - - private fun performSingleBreakpointTest(data: EvaluationTestData) { - process(data.instructions) - - doOnBreakpoint { - createDebugLabels(data.debugLabels) - - val exceptions = linkedMapOf() - - for ((expression, expected, kind) in data.fragments) { - mayThrow(expression) { - evaluate(this, expression, kind, expected) - } - } - - val completion = { resume(this) } - framePrinter?.printFrame(completion) ?: completion() - } - - finish() - } - - private fun performMultipleBreakpointTest(data: EvaluationTestData) { - for ((expression, expected) in data.fragments) { - doOnBreakpoint { - mayThrow(expression) { - try { - evaluate(this, expression, CodeFragmentKind.EXPRESSION, expected) - } finally { - val completion = { resume(this) } - framePrinter?.printFrame(completion) ?: completion() - } - } - } - } - finish() - } - - override fun evaluate(suspendContext: SuspendContextImpl, textWithImports: TextWithImportsImpl) { - evaluate(suspendContext, textWithImports, null) - } - - private fun evaluate(suspendContext: SuspendContextImpl, text: String, codeFragmentKind: CodeFragmentKind, expectedResult: String?) { - val textWithImports = TextWithImportsImpl(codeFragmentKind, text, "", KotlinFileType.INSTANCE) - return evaluate(suspendContext, textWithImports, expectedResult) - } - - private fun evaluate(suspendContext: SuspendContextImpl, item: TextWithImportsImpl, expectedResult: String?) { - val evaluationContext = this.evaluationContext - val sourcePosition = ContextUtil.getSourcePosition(suspendContext) - - // Default test debuggerContext doesn't provide a valid stackFrame so we have to create one more for evaluation purposes. - val frameProxy = suspendContext.frameProxy - val threadProxy = frameProxy?.threadProxy() - val debuggerContext = createDebuggerContext(myDebuggerSession, suspendContext, threadProxy, frameProxy) - debuggerContext.initCaches() - - val contextElement = ContextUtil.getContextElement(debuggerContext)!! - - assert(KotlinCodeFragmentFactory().isContextAccepted(contextElement)) { - val text = runReadAction { contextElement.text } - "KotlinCodeFragmentFactory should be accepted for context element otherwise default evaluator will be called. " + - "ContextElement = $text" - } - - contextElement.putCopyableUserData(KotlinCodeFragmentFactory.DEBUG_CONTEXT_FOR_TESTS, debuggerContext) - - suspendContext.runActionInSuspendCommand { - try { - val evaluator = runReadAction { - EvaluatorBuilderImpl.build( - item, - contextElement, - sourcePosition, - this@AbstractKotlinEvaluateExpressionTest.project - ) - } - ?: throw AssertionError("Cannot create an Evaluator for Evaluate Expression") - - val value = evaluator.evaluate(evaluationContext) - val actualResult = value.asValue().asString() - if (expectedResult != null) { - assertEquals( - "Evaluate expression returns wrong result for ${item.text}:\n" + - "expected = $expectedResult\n" + - "actual = $actualResult\n", - expectedResult, actualResult - ) - } - } catch (e: EvaluateException) { - val expectedMessage = e.message?.replaceFirst( - ID_PART_REGEX, - "id=ID" - ) - assertEquals( - "Evaluate expression throws wrong exception for ${item.text}:\n" + - "expected = $expectedResult\n" + - "actual = $expectedMessage\n", - expectedResult, - expectedMessage - ) - } - } - } - - override fun logDescriptor(descriptor: NodeDescriptorImpl, text: String) { - super.logDescriptor(descriptor, text) - } - - override fun expandAll(tree: Tree, runnable: () -> Unit, filter: (TreeNode) -> Boolean, suspendContext: SuspendContextImpl) { - super.expandAll(tree, runnable, HashSet(), filter, suspendContext) - } - - private fun mayThrow(expression: String, f: () -> Unit) { - try { - f() - } catch (e: Throwable) { - exceptions[expression] = e - } - } - - override fun throwExceptionsIfAny() { - if (exceptions.isNotEmpty()) { - val isIgnored = InTextDirectivesUtils.isIgnoredTarget( - if (useIrBackend()) TargetBackend.JVM_IR else TargetBackend.JVM, - getExpectedOutputFile() - ) - - if (!isIgnored) { - for (exc in exceptions.values) { - exc.printStackTrace() - } - val expressionsText = exceptions.entries.joinToString("\n") { (k, v) -> "expression: $k, exception: ${v.message}" } - throw AssertionError("Test failed:\n$expressionsText") - } else { - (checker as KotlinOutputChecker).threwException = true - } - } - } - - private fun Value.asString(): String { - if (this is ObjectValue && this.value is ObjectReference) { - return this.toString().replaceFirst(ID_PART_REGEX, "id=ID") - } - return this.toString() - } - - private fun loadExpressions(testFile: KotlinBaseTest.TestFile): List { - val directives = findLinesWithPrefixesRemoved(testFile.content, "// EXPRESSION: ") - val expected = findLinesWithPrefixesRemoved(testFile.content, "// RESULT: ") - assert(directives.size == expected.size) { "Sizes of test directives are different" } - return directives.zip(expected).map { (text, result) -> CodeFragment(text, result, CodeFragmentKind.EXPRESSION) } - } - - private fun loadCodeBlocks(wholeFile: File): List { - val regexp = (Regex.escape(wholeFile.name) + ".fragment\\d*").toRegex() - val fragmentFiles = wholeFile.parentFile.listFiles { _, name -> regexp.matches(name) } ?: emptyArray() - - val codeFragments = mutableListOf() - - for (fragmentFile in fragmentFiles) { - val contents = FileUtil.loadFile(fragmentFile, true) - val value = findStringWithPrefixes(contents, "// RESULT: ") ?: error("'RESULT' directive is missing in $fragmentFile") - codeFragments += CodeFragment(contents, value, CodeFragmentKind.CODE_BLOCK) - } - - return codeFragments - } - - private fun loadDebugLabels(testFile: KotlinBaseTest.TestFile): List { - return findLinesWithPrefixesRemoved(testFile.content, "// DEBUG_LABEL: ") - .map { text -> - val labelParts = text.split("=") - assert(labelParts.size == 2) { "Wrong format for DEBUG_LABEL directive: // DEBUG_LABEL: {localVariableName} = {labelText}" } - - val localName = labelParts[0].trim() - val name = labelParts[1].trim() - DebugLabel(name, localName) - } - } - - private fun createDebugLabels(labels: List) { - if (labels.isEmpty()) { - return - } - - val markupMap = NodeDescriptorImpl.getMarkupMap(debugProcess) ?: return - - for ((name, localName) in labels) { - val localVariable = evaluationContext.frameProxy!!.visibleVariableByName(localName) - assert(localVariable != null) { "Cannot find localVariable for label: name = $localName" } - - val localVariableValue = evaluationContext.frameProxy!!.getValue(localVariable) as? ObjectReference - assert(localVariableValue != null) { "Local variable $localName should be an ObjectReference" } - - markupMap[localVariableValue] = ValueMarkup(name, null, name) - } - } -} diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/FramePrinter.kt b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/FramePrinter.kt index 6b569335a6c..14e549185fb 100644 --- a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/FramePrinter.kt +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/util/FramePrinter.kt @@ -221,11 +221,7 @@ private class Printer(private val delegate: FramePrinterDelegate, private val co if (config.shouldRenderExpression() && descriptor is ValueDescriptorImpl) { val expression = debugProcess.invokeInManagerThread { debuggerContextImpl -> - descriptor.getTreeEvaluation((node as XValueNodeImpl).valueContainer as JavaValue, debuggerContextImpl).let { - // FIX ME WHEN BUNCH 201 REMOVED: getTreeEvaluation in 202 returns CompletableFuture but in older platforms it's PsiElement - @Suppress("UNCHECKED_CAST") - (it as? CompletableFuture)?.get() ?: it - } as? PsiExpression + descriptor.getTreeEvaluation((node as XValueNodeImpl).valueContainer as JavaValue, debuggerContextImpl).get() } if (expression != null) { diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 deleted file mode 100644 index 65ef655c68d..00000000000 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.201 +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2010-2019 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.testFramework - -import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder -import com.intellij.openapi.externalSystem.service.execution.ProgressExecutionMode -import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.externalSystem.util.ExternalSystemUtil -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager -import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings -import org.jetbrains.plugins.gradle.settings.GradleProjectSettings -import org.jetbrains.plugins.gradle.settings.GradleSettings -import org.jetbrains.plugins.gradle.util.GradleConstants -import org.jetbrains.plugins.gradle.util.GradleLog -import java.io.File -import kotlin.test.assertNotNull - -fun refreshGradleProject(projectPath: String, project: Project) { - _importProject(File(projectPath).absolutePath, project) - - dispatchAllInvocationEvents() -} - -const val GRADLE_JDK_NAME = "Gradle JDK" - -/** - * inspired by org.jetbrains.plugins.gradle.service.project.open.importProject(projectDirectory, project) - */ -private fun _importProject(projectPath: String, project: Project) { - GradleLog.LOG.info("Import project at $projectPath") - val projectSdk = ProjectRootManager.getInstance(project).projectSdk - assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath") - val gradleProjectSettings = GradleProjectSettings() - - GradleSettings.getInstance(project).gradleVmOptions = - "-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}" - - setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk) - gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME - - GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings -> - linkedProjectSettings.gradleJvm = GRADLE_JDK_NAME - } - - _attachGradleProjectAndRefresh(gradleProjectSettings, project) -} - -/** - * inspired by org.jetbrains.plugins.gradle.service.project.open.attachGradleProjectAndRefresh(gradleProjectSettings, project) - * except everything is MODAL_SYNC - */ -private fun _attachGradleProjectAndRefresh( - gradleProjectSettings: GradleProjectSettings, - project: Project -) { - val externalProjectPath = gradleProjectSettings.externalProjectPath - ExternalProjectsManagerImpl.getInstance(project).runWhenInitialized { - DumbService.getInstance(project).runWhenSmart { - ExternalSystemUtil.ensureToolWindowInitialized(project, GradleConstants.SYSTEM_ID) - } - } - val settings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID) - if (settings.getLinkedProjectSettings(externalProjectPath) == null) { - settings.linkProject(gradleProjectSettings) - } - - StatefulTestGradleProjectRefreshCallback(externalProjectPath, project).use { callback -> - ExternalSystemUtil.refreshProject( - externalProjectPath, - ImportSpecBuilder(project, GradleConstants.SYSTEM_ID) - .use(ProgressExecutionMode.MODAL_SYNC) - .callback(callback) - .build() - ) - } -} diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 deleted file mode 100644 index 185f5d5167c..00000000000 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.201 +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2010-2019 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.testFramework - -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings -import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl -import com.intellij.ide.startup.impl.StartupManagerImpl -import com.intellij.lang.LanguageAnnotators -import com.intellij.lang.LanguageExtensionPoint -import com.intellij.lang.annotation.Annotator -import com.intellij.openapi.Disposable -import com.intellij.openapi.application.impl.NonBlockingReadActionImpl -import com.intellij.openapi.editor.Document -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.ex.ProjectManagerEx -import com.intellij.openapi.startup.StartupManager -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.impl.PsiDocumentManagerBase -import com.intellij.testFramework.ExtensionTestUtil -import com.intellij.testFramework.TestApplicationManager -import com.intellij.testFramework.runInEdtAndWait -import com.intellij.util.ui.UIUtil -import org.jetbrains.kotlin.idea.perf.util.logMessage -import org.jetbrains.kotlin.idea.test.runPostStartupActivitiesOnce -import java.nio.file.Paths - -fun commitAllDocuments() { - val fileDocumentManager = FileDocumentManager.getInstance() - runInEdtAndWait { - fileDocumentManager.saveAllDocuments() - } - - ProjectManagerEx.getInstanceEx().openProjects.forEach { project -> - val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase - - runInEdtAndWait { - psiDocumentManagerBase.clearUncommittedDocuments() - psiDocumentManagerBase.commitAllDocuments() - } - } -} - -fun commitDocument(project: Project, document: Document) { - val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase - runInEdtAndWait { - psiDocumentManagerBase.commitDocument(document) - } -} - -fun saveDocument(document: Document) { - val fileDocumentManager = FileDocumentManager.getInstance() - - runInEdtAndWait { - fileDocumentManager.saveDocument(document) - } -} - -fun dispatchAllInvocationEvents() { - runInEdtAndWait { - UIUtil.dispatchAllInvocationEvents() - NonBlockingReadActionImpl.waitForAsyncTaskCompletion(); - } -} - -fun loadProjectWithName(path: String, name: String): Project? = - ProjectManagerEx.getInstanceEx().loadProject(Paths.get(path), name) - -fun TestApplicationManager.closeProject(project: Project) { - val name = project.name - val startupManagerImpl = StartupManager.getInstance(project) as StartupManagerImpl - val daemonCodeAnalyzerSettings = DaemonCodeAnalyzerSettings.getInstance() - val daemonCodeAnalyzerImpl = DaemonCodeAnalyzer.getInstance(project) as DaemonCodeAnalyzerImpl - - setDataProvider(null) - daemonCodeAnalyzerSettings.isImportHintEnabled = true // return default value to avoid unnecessary save - startupManagerImpl.checkCleared() - daemonCodeAnalyzerImpl.cleanupAfterTest() - - logMessage { "project '$name' is about to be closed" } - dispatchAllInvocationEvents() - val projectManagerEx = ProjectManagerEx.getInstanceEx() - projectManagerEx.forceCloseProject(project) - logMessage { "project '$name' successfully closed" } -} - -fun runStartupActivities(project: Project) { - with(StartupManager.getInstance(project) as StartupManagerImpl) { - //scheduleInitialVfsRefresh() - runStartupActivities() - } - runPostStartupActivitiesOnce(project) -} - -fun waitForAllEditorsFinallyLoaded(project: Project) { - // routing is obsolete in 192 -} - -fun replaceWithCustomHighlighter(parentDisposable: Disposable, fromImplementationClass: String, toImplementationClass: String) { - val pointName = ExtensionPointName.create>(LanguageAnnotators.EP_NAME.name) - val extensionPoint = pointName.getPoint(null) - - val point = LanguageExtensionPoint() - point.language = "kotlin" - point.implementationClass = toImplementationClass - - val extensions = extensionPoint.extensions - val filteredExtensions = - extensions.filter { it.language != "kotlin" || it.implementationClass != fromImplementationClass } - .toList() - // custom highlighter is already registered if filteredExtensions has the same size as extensions - if (filteredExtensions.size < extensions.size) { - ExtensionTestUtil.maskExtensions(pointName, filteredExtensions + listOf(point), parentDisposable) - } -} \ No newline at end of file diff --git a/idea/resources-descriptors/META-INF/plugin.xml.201 b/idea/resources-descriptors/META-INF/plugin.xml.201 deleted file mode 100644 index 697bf318802..00000000000 --- a/idea/resources-descriptors/META-INF/plugin.xml.201 +++ /dev/null @@ -1,221 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - 1.5.0-M2 -
    -
  • SAM adapters use `invokedynamic` on the JVM by default.
  • -
  • Deprecation of `-Xjvm-default=enable` and `-Xjvm-default=compatibility` compiler modes and `@JvmDefault` annotation.
  • -
  • Standard library: math functions `floorDiv()` and `mod()`, collection function `firstNotNullOf()`, strict version of String.toBoolean().
  • -
- Learn more about Kotlin 1.5.0-M2 in the changelog and this blog post. -

-

1.5.0-M1

- Released: March 3, 2021 -
    -
  • JVM IR backend by default.
  • -
  • New language features by default: inline value classes, sealed interfaces, and JVM records support.
  • -
  • Kotlin/JVM: new default target: 1.8 (1.6 is deprecated), string concatenation uses `invokedynamic` by default.
  • -
  • Kotlin/Native compilation time improvements.
  • -
  • Fixed compiler exceptions.
  • -
- Learn more about Kotlin 1.5.0-M1 in the changelog. -

-

1.4.30

- Released: February 4, 2021 -
    -
  • Preview of new language features: JVM records support, sealed interfaces, and stable inline classes.
  • -
  • Kotlin/JVM: IR backend is now in Beta.
  • -
  • Kotlin/Native: performance improvements, new `watchosX64` simulator target, support for Xcode 12.2 libraries.
  • -
  • Kotlin/JS: prototype lazy initialization of top-level properties.
  • -
  • Support for Gradle configuration cache.
  • -
  • Standard library API improvements: locale-agnostic API for upper/lowercasing text and clear Char-to-code and Char-to-digit conversions.
  • -
- For more details, see What’s New in Kotlin 1.4.30 and this blog post. -

-

1.4.20

- Released: November 23, 2020 -
    -
  • Kotlin/JS: New project templates, improved Gradle plugin, experimental compilation with errors mode in the IR compiler.
  • -
  • Kotlin/Native: New escape analysis mechanism, wrapping of Objective-C exceptions, various functional and performance improvements.
  • -
  • IDE: Experimental support for Code Vision, the Redirect input from option in Kotlin run configurations, and more.
  • -
  • JEP 280 (invokedynamic) string concatenation is available on the JVM.
  • -
  • Changes to the layout of multiplatform projects.
  • -
  • Improved CocoaPods support.
  • -
  • Standard library improvements: Extensions for java.nio.file.Path and performance optimizations.
  • -
  • Deprecation of the kotlin-android-extensions compiler plugin. Parcelable implementation generator has moved to the new kotlin-parcelize plugin.
  • -
- For more details, see What’s New in Kotlin 1.4.20 and this blog post. -

-

1.4.0

- Released: August 17, 2020 -
    -
  • New compiler with better type inference.
  • -
  • IR backends for JVM and JS in Alpha mode (requires opt-in).
  • -
  • A new flexible Kotlin Project Wizard for easy creation and configuration of different types of projects.
  • -
  • New IDE functionality to debug coroutines.
  • -
  • IDE performance improvements: many actions, such as project opening and autocomplete suggestions now complete up to 4 times faster.
  • -
  • New language features such as SAM conversions, trailing comma, and other.
  • -
  • Type annotations in the JVM bytecode and new modes for generating default interfaces in Kotlin/JVM.
  • -
  • New Gradle DSL for Kotlin/JS.
  • -
  • Improved performance and interop with Swift and Objective-C in Kotlin/Native.
  • -
  • Support for sharing code in several targets thanks to the hierarchical structure in multiplatform projects.
  • -
  • New collection operators, delegated properties improvements, the double-ended queue implementation ArrayDeque, and much more new things in the standard library.
  • -
- For more details, see What’s New in Kotlin 1.4.0 and this blog post. -

- To get the most out of the changes and improvements introduced in Kotlin 1.4, join our Online Event where you will be able to enjoy four days of Kotlin talks, Q&As with the Kotlin team, and more. - ]]> -
- - com.intellij.modules.platform - - JUnit - com.intellij.gradle - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - Coverage - com.intellij.java-i18n - org.jetbrains.java.decompiler - Git4Idea - org.jetbrains.debugger.streams - com.intellij.stats.completion - - - - - com.intellij.modules.idea - com.intellij.modules.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/idea/resources-descriptors/META-INF/plugin.xml.as41 b/idea/resources-descriptors/META-INF/plugin.xml.as41 deleted file mode 100644 index 22ee14d35c5..00000000000 --- a/idea/resources-descriptors/META-INF/plugin.xml.as41 +++ /dev/null @@ -1,203 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - 1.5.0-M2 -
    -
  • SAM adapters use `invokedynamic` on the JVM by default.
  • -
  • Deprecation of `-Xjvm-default=enable` and `-Xjvm-default=compatibility` compiler modes and `@JvmDefault` annotation.
  • -
  • Standard library: math functions `floorDiv()` and `mod()`, collection function `firstNotNullOf()`, strict version of String.toBoolean().
  • -
- Learn more about Kotlin 1.5.0-M2 in the changelog and this blog post. -

-

1.5.0-M1

- Released: March 3, 2021 -
    -
  • JVM IR backend by default.
  • -
  • New language features by default: inline value classes, sealed interfaces, and JVM records support.
  • -
  • Kotlin/JVM: new default target: 1.8 (1.6 is deprecated), string concatenation uses `invokedynamic` by default.
  • -
  • Kotlin/Native compilation time improvements.
  • -
  • Fixed compiler exceptions.
  • -
- Learn more about Kotlin 1.5.0-M1 in the changelog. -

-

1.4.30

- Released: February 4, 2021 -
    -
  • Preview of new language features: JVM records support, sealed interfaces, and stable inline classes.
  • -
  • Kotlin/JVM: IR backend is now in Beta.
  • -
  • Kotlin/Native: performance improvements, new `watchosX64` simulator target, support for Xcode 12.2 libraries.
  • -
  • Kotlin/JS: prototype lazy initialization of top-level properties.
  • -
  • Support for Gradle configuration cache.
  • -
  • Standard library API improvements: locale-agnostic API for upper/lowercasing text and clear Char-to-code and Char-to-digit conversions.
  • -
- For more details, see What’s New in Kotlin 1.4.30 and this blog post. -

-

1.4.20

- Released: November 23, 2020 -
    -
  • Kotlin/JS: New project templates, improved Gradle plugin, experimental compilation with errors mode in the IR compiler.
  • -
  • Kotlin/Native: New escape analysis mechanism, wrapping of Objective-C exceptions, various functional and performance improvements.
  • -
  • IDE: Experimental support for Code Vision, the Redirect input from option in Kotlin run configurations, and more.
  • -
  • JEP 280 (invokedynamic) string concatenation is available on the JVM.
  • -
  • Changes to the layout of multiplatform projects.
  • -
  • Improved CocoaPods support.
  • -
  • Standard library improvements: Extensions for java.nio.file.Path and performance optimizations.
  • -
  • Deprecation of the kotlin-android-extensions compiler plugin. Parcelable implementation generator has moved to the new kotlin-parcelize plugin.
  • -
- For more details, see What’s New in Kotlin 1.4.20 and this blog post. -

-

1.4.0

- Released: August 17, 2020 -
    -
  • New compiler with better type inference.
  • -
  • IR backends for JVM and JS in Alpha mode (requires opt-in).
  • -
  • A new flexible Kotlin Project Wizard for easy creation and configuration of different types of projects.
  • -
  • New IDE functionality to debug coroutines.
  • -
  • IDE performance improvements: many actions, such as project opening and autocomplete suggestions now complete up to 4 times faster.
  • -
  • New language features such as SAM conversions, trailing comma, and other.
  • -
  • Type annotations in the JVM bytecode and new modes for generating default interfaces in Kotlin/JVM.
  • -
  • New Gradle DSL for Kotlin/JS.
  • -
  • Improved performance and interop with Swift and Objective-C in Kotlin/Native.
  • -
  • Support for sharing code in several targets thanks to the hierarchical structure in multiplatform projects.
  • -
  • New collection operators, delegated properties improvements, the double-ended queue implementation ArrayDeque, and much more new things in the standard library.
  • -
- For more details, see What’s New in Kotlin 1.4.0 and this blog post. -

- To get the most out of the changes and improvements introduced in Kotlin 1.4, join our Online Event where you will be able to enjoy four days of Kotlin talks, Q&As with the Kotlin team, and more. - ]]> -
- - com.intellij.modules.platform - com.intellij.modules.androidstudio - - JUnit - com.intellij.gradle - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - Coverage - com.intellij.java-i18n - org.jetbrains.java.decompiler - Git4Idea - org.jetbrains.debugger.streams - - - - - com.intellij.modules.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/idea/resources/META-INF/android-lint.xml.as41 b/idea/resources/META-INF/android-lint.xml.as41 deleted file mode 100644 index 5a029687008..00000000000 --- a/idea/resources/META-INF/android-lint.xml.as41 +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 deleted file mode 100644 index c3ab8a37d34..00000000000 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/AbstractScratchRunActionTest.kt.201 +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright 2010-2019 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.scratch - -import com.intellij.ide.scratch.ScratchFileService -import com.intellij.ide.scratch.ScratchRootType -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.module.Module -import com.intellij.openapi.roots.CompilerModuleExtension -import com.intellij.openapi.roots.ModuleRootModificationUtil -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess -import com.intellij.testFramework.FileEditorManagerTestCase -import com.intellij.testFramework.MapDataContext -import com.intellij.testFramework.PsiTestUtil -import com.intellij.testFramework.TestActionEvent -import com.intellij.util.ui.UIUtil -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.actions.KOTLIN_WORKSHEET_EXTENSION -import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager -import org.jetbrains.kotlin.idea.debugger.coroutine.util.logger -import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingUtil -import org.jetbrains.kotlin.idea.scratch.actions.ClearScratchAction -import org.jetbrains.kotlin.idea.scratch.actions.RunScratchAction -import org.jetbrains.kotlin.idea.scratch.actions.ScratchCompilationSupport -import org.jetbrains.kotlin.idea.scratch.output.InlayScratchFileRenderer -import org.jetbrains.kotlin.idea.scratch.ui.KtScratchFileEditorWithPreview -import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.parsing.KotlinParserDefinition.Companion.STD_SCRIPT_SUFFIX -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.MockLibraryUtil -import org.jetbrains.kotlin.test.util.KtTestUtil -import org.jetbrains.kotlin.utils.PathUtil -import org.junit.Assert -import java.io.File - -abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() { - - fun doRightPreviewPanelOutputTest(fileName: String) { - doRightPreviewPanelOutputTest(fileName = fileName, isRepl = false) - } - - fun doWorksheetReplTest(fileName: String) { - doInlayOutputTest(fileName = fileName, isRepl = true, isWorksheet = true) - } - - fun doScratchReplTest(fileName: String) { - doInlayOutputTest(fileName = fileName, isRepl = true, isWorksheet = false) - } - - fun doWorksheetCompilingTest(fileName: String) { - doInlayOutputTest(fileName = fileName, isRepl = false, isWorksheet = true) - } - - fun doScratchCompilingTest(fileName: String) { - doInlayOutputTest(fileName = fileName, isRepl = false, isWorksheet = false) - } - - fun doWorksheetMultiFileTest(dirName: String) { - doMultiFileTest(dirName, isWorksheet = true) - } - - fun doScratchMultiFileTest(dirName: String) { - doMultiFileTest(dirName, isWorksheet = false) - } - - private fun doMultiFileTest(dirName: String, isWorksheet: Boolean) { - val mainFileExtension = if (isWorksheet) KOTLIN_WORKSHEET_EXTENSION else STD_SCRIPT_SUFFIX - - val javaFiles = arrayListOf() - val kotlinFiles = arrayListOf() - val baseDir = File(testDataPath, dirName) - baseDir.walk().forEach { - if (it.isFile) { - if (it.extension == "java") javaFiles.add(it) - if (it.extension == "kt") kotlinFiles.add(it) - } - } - - val testDataPathFile = File(myFixture.testDataPath) - javaFiles.forEach { - myFixture.copyFileToProject( - FileUtil.getRelativePath(testDataPathFile, it)!!, - FileUtil.getRelativePath(baseDir, it)!! - ) - } - kotlinFiles.forEach { - myFixture.copyFileToProject( - FileUtil.getRelativePath(testDataPathFile, it)!!, - FileUtil.getRelativePath(baseDir, it)!! - ) - } - - val outputDir = FileUtil.createTempDirectory(dirName, "") - - if (javaFiles.isNotEmpty()) { - val options = listOf("-d", outputDir.path) - KotlinTestUtils.compileJavaFiles(javaFiles, options) - } - - MockLibraryUtil.compileKotlin(baseDir.path, outputDir) - - PsiTestUtil.setCompilerOutputPath(myFixture.module, outputDir.path, false) - - val mainFileName = "$dirName/${getTestName(true)}.$mainFileExtension" - doInlayOutputTest(mainFileName, isRepl = false, isWorksheet = isWorksheet) - - launchAction(ClearScratchAction()) - - doInlayOutputTest(mainFileName, isRepl = true, isWorksheet = isWorksheet) - - ModuleRootModificationUtil.updateModel(myFixture.module) { model -> - model.getModuleExtension(CompilerModuleExtension::class.java).inheritCompilerOutputPath(true) - } - } - - private fun doInlayOutputTest(fileName: String, isRepl: Boolean, isWorksheet: Boolean) { - configureAndLaunchScratch(fileName = fileName, isRepl = isRepl, isWorksheet = isWorksheet) - - val actualOutput = getFileTextWithInlays() - - val expectedFile = getExpectedFile(fileName, isRepl, suffix = "after") - KotlinTestUtils.assertEqualsToFile(expectedFile, actualOutput) - } - - private fun doRightPreviewPanelOutputTest(fileName: String, isRepl: Boolean) { - configureAndLaunchScratch(fileName = fileName, isRepl = isRepl, isWorksheet = false) - - val previewTextWithFoldings = getPreviewTextWithFoldings() - - val expectedFile = getExpectedFile(fileName, isRepl, suffix = "preview") - KotlinTestUtils.assertEqualsToFile(expectedFile, previewTextWithFoldings) - } - - private fun configureAndLaunchScratch(fileName: String, isRepl: Boolean, isWorksheet: Boolean) { - val sourceFile = File(testDataPath, fileName) - val fileText = sourceFile.readText().inlinePropertiesValues(isRepl) - - if (isWorksheet) { - configureWorksheetByText(sourceFile.name, fileText) - } else { - configureScratchByText(sourceFile.name, fileText) - } - - if (!KotlinHighlightingUtil.shouldHighlight(myFixture.file)) error("Highlighting for scratch file is switched off") - - launchScratch() - waitUntilScratchFinishes(isRepl) - } - - private fun getExpectedFile(fileName: String, isRepl: Boolean, suffix: String): File { - val expectedFileName = if (isRepl) { - fileName.replace(".kts", ".repl.$suffix") - } else { - fileName.replace(".kts", ".comp.$suffix") - } - - return File(testDataPath, expectedFileName) - } - - protected fun String.inlinePropertiesValues( - isRepl: Boolean = false, - isInteractiveMode: Boolean = false - ): String { - return replace("~REPL_MODE~", isRepl.toString()).replace("~INTERACTIVE_MODE~", isInteractiveMode.toString()) - } - - protected fun getFileTextWithInlays(): String { - val doc = myFixture.getDocument(myFixture.file) ?: error("Document for ${myFixture.file.name} is null") - val actualOutput = StringBuilder(myFixture.file.text) - for (line in doc.lineCount - 1 downTo 0) { - getInlays(doc.getLineStartOffset(line), doc.getLineEndOffset(line)) - .forEach { inlay -> - val str = inlay.toString() - val offset = doc.getLineEndOffset(line) - actualOutput.insert( - offset, - "${str.takeWhile { it.isWhitespace() }}// ${str.trim()}" - ) - } - } - return actualOutput.toString().trim() - } - - private fun getPreviewTextWithFoldings(): String { - val scratchFileEditor = getScratchEditorForSelectedFile(myManager, myFixture.file.virtualFile) - ?: error("Couldn't find scratch panel") - - val previewEditor = scratchFileEditor.getPreviewEditor() - return getFoldingData(previewEditor.editor, withCollapseStatus = false) - } - - protected fun getInlays(start: Int = 0, end: Int = myFixture.file.textLength): List { - val inlineElementsInRange = myFixture.editor.inlayModel - .getAfterLineEndElementsInRange(start, end) - .filter { it.renderer is InlayScratchFileRenderer } - return inlineElementsInRange.map { it.renderer as InlayScratchFileRenderer } - } - - protected fun configureScratchByText(name: String, text: String): ScratchFile { - val scratchVirtualFile = ScratchRootType.getInstance().createScratchFile( - project, - name, - KotlinLanguage.INSTANCE, - text, - ScratchFileService.Option.create_if_missing - ) ?: error("Couldn't create scratch file") - - myFixture.openFileInEditor(scratchVirtualFile) - - ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file) - - val scratchFileEditor = getScratchEditorForSelectedFile(myManager, myFixture.file.virtualFile) - ?: error("Couldn't find scratch file") - - configureOptions(scratchFileEditor, text, myFixture.module) - - return scratchFileEditor.scratchFile - } - - protected fun configureWorksheetByText(name: String, text: String): ScratchFile { - val worksheetFile = myFixture.configureByText(name, text).virtualFile - - ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file) - - val scratchFileEditor = getScratchEditorForSelectedFile(myManager, myFixture.file.virtualFile) - ?: error("Couldn't find scratch panel") - - // We want to check that correct module is selected automatically, - // that's why we set `module` to null so it wouldn't be changed - configureOptions(scratchFileEditor, text, null) - - return scratchFileEditor.scratchFile - } - - - protected fun launchScratch() { - val action = RunScratchAction() - launchAction(action) - } - - protected fun launchAction(action: AnAction) { - val e = getActionEvent(myFixture.file.virtualFile, action) - action.beforeActionPerformedUpdate(e) - Assert.assertTrue(e.presentation.isEnabled && e.presentation.isVisible) - action.actionPerformed(e) - } - - protected fun waitUntilScratchFinishes(shouldStopRepl: Boolean = true) { - UIUtil.dispatchAllInvocationEvents() - - val start = System.currentTimeMillis() - // wait until output is displayed in editor or for 1 minute - while (ScratchCompilationSupport.isAnyInProgress()) { - if ((System.currentTimeMillis() - start) > TIME_OUT) { - LOG.warn("Waiting timeout $TIME_OUT ms is exceed") - break - } - Thread.sleep(100) - } - - if (shouldStopRepl) stopReplProcess() - - UIUtil.dispatchAllInvocationEvents() - } - - protected fun stopReplProcess() { - if (myFixture.file != null) { - val scratchFile = getScratchEditorForSelectedFile(myManager, myFixture.file.virtualFile)?.scratchFile - ?: error("Couldn't find scratch panel") - scratchFile.replScratchExecutor?.stopAndWait() - } - - UIUtil.dispatchAllInvocationEvents() - } - - private fun getActionEvent(virtualFile: VirtualFile, action: AnAction): TestActionEvent { - val context = MapDataContext() - context.put(CommonDataKeys.VIRTUAL_FILE_ARRAY, arrayOf(virtualFile)) - context.put(CommonDataKeys.PROJECT, project) - context.put(CommonDataKeys.EDITOR, myFixture.editor) - return TestActionEvent(context, action) - } - - protected fun testScratchText(): String { - return File(testDataPath, "idea/scripting-support/testData/scratch/custom/test_scratch.kts").readText() - } - - override fun getTestDataPath() = KtTestUtil.getHomeDirectory() - - - override fun getProjectDescriptor(): com.intellij.testFramework.LightProjectDescriptor { - val testName = getTestName(false) - - return when { - testName.endsWith("WithKotlinTest") -> INSTANCE_WITH_KOTLIN_TEST - testName.endsWith("NoRuntime") -> INSTANCE_WITHOUT_RUNTIME - testName.endsWith("ScriptRuntime") -> INSTANCE_WITH_SCRIPT_RUNTIME - else -> KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK - } - } - - override fun setUp() { - super.setUp() - - VfsRootAccess.allowRootAccess(KtTestUtil.getHomeDirectory()) - - PluginTestCaseBase.addJdk(myFixture.projectDisposable) { PluginTestCaseBase.fullJdk() } - } - - override fun tearDown() { - super.tearDown() - - VfsRootAccess.disallowRootAccess(KtTestUtil.getHomeDirectory()) - - ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ -> - runWriteAction { file.delete(this) } - } - } - - companion object { - private const val TIME_OUT = 60000 // 1 min - - private val INSTANCE_WITH_KOTLIN_TEST = object : KotlinWithJdkAndRuntimeLightProjectDescriptor( - arrayListOf( - ForTestCompileRuntime.runtimeJarForTests(), - PathUtil.kotlinPathsForDistDirectory.kotlinTestPath - ) - ) { - override fun getSdk() = PluginTestCaseBase.fullJdk() - } - - private val INSTANCE_WITHOUT_RUNTIME = object : KotlinLightProjectDescriptor() { - override fun getSdk() = PluginTestCaseBase.fullJdk() - } - - private val INSTANCE_WITH_SCRIPT_RUNTIME = object : KotlinWithJdkAndRuntimeLightProjectDescriptor( - arrayListOf( - ForTestCompileRuntime.runtimeJarForTests(), - ForTestCompileRuntime.scriptRuntimeJarForTests() - ) - ) { - override fun getSdk() = PluginTestCaseBase.fullJdk() - } - - fun configureOptions( - scratchFileEditor: KtScratchFileEditorWithPreview, - fileText: String, - module: Module? - ) { - val scratchFile = scratchFileEditor.scratchFile - - if (InTextDirectivesUtils.getPrefixedBoolean(fileText, "// INTERACTIVE_MODE: ") != true) { - scratchFile.saveOptions { copy(isInteractiveMode = false) } - } - - if (InTextDirectivesUtils.getPrefixedBoolean(fileText, "// REPL_MODE: ") == true) { - scratchFile.saveOptions { copy(isRepl = true) } - } - - if (module != null && !InTextDirectivesUtils.isDirectiveDefined(fileText, "// NO_MODULE")) { - scratchFile.setModule(module) - } - - val isPreviewEnabled = InTextDirectivesUtils.getPrefixedBoolean(fileText, "// PREVIEW_ENABLED: ") == true - scratchFileEditor.setPreviewEnabled(isPreviewEnabled) - } - - } -} diff --git a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 b/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 deleted file mode 100644 index ccc27114fbe..00000000000 --- a/idea/scripting-support/test/org/jetbrains/kotlin/idea/scratch/ScratchLineMarkersTest.kt.201 +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2010-2019 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.scratch - -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.ide.scratch.ScratchFileService -import com.intellij.ide.scratch.ScratchRootType -import com.intellij.openapi.editor.Document -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiDocumentManager -import com.intellij.testFramework.ExpectedHighlightingData -import com.intellij.testFramework.FileEditorManagerTestCase -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.codeInsight.AbstractLineMarkersTest -import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager -import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest.Companion.configureOptions -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.psi.KtFile -import java.io.File - -abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() { - fun doScratchTest(path: String) { - val fileText = FileUtil.loadFile(File(path)) - - val scratchVirtualFile = ScratchRootType.getInstance().createScratchFile( - project, - "scratch.kts", - KotlinLanguage.INSTANCE, - fileText, - ScratchFileService.Option.create_if_missing - ) ?: error("Couldn't create scratch file") - - myFixture.openFileInEditor(scratchVirtualFile) - - ScriptConfigurationManager.updateScriptDependenciesSynchronously(myFixture.file) - - val scratchFileEditor = getScratchEditorForSelectedFile(FileEditorManager.getInstance(project), myFixture.file.virtualFile) - ?: error("Couldn't find scratch panel") - - configureOptions(scratchFileEditor, fileText, null) - - val project = myFixture.project - val document = myFixture.editor.document - - val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) - data.init() - - PsiDocumentManager.getInstance(project).commitAllDocuments() - - val markers = doAndCheckHighlighting(document, data, File(path)) - - AbstractLineMarkersTest.assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) - } - - override fun tearDown() { - super.tearDown() - - ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ -> - runWriteAction { file.delete(this) } - } - } - - private fun doAndCheckHighlighting( - documentToAnalyze: Document, expectedHighlighting: ExpectedHighlightingData, expectedFile: File - ): List> { - myFixture.doHighlighting() - - return AbstractLineMarkersTest.checkHighlighting(myFixture.project, documentToAnalyze, expectedHighlighting, expectedFile) - } - -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as41 deleted file mode 100644 index 939c6c53fe5..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/IDESettingsFUSCollector.kt.as41 +++ /dev/null @@ -1,3 +0,0 @@ -class IDESettingsFUSCollector { - // Not whitelisted -} diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt index 91c6bd97c3b..6efd0df12b2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import java.util.function.Consumer -// FIX ME WHEN BUNCH 201 REMOVED + class KotlinDocumentationProvider : KotlinDocumentationProviderCompatBase() { override fun collectDocComments(file: PsiFile, sink: Consumer) { diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.203 b/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.203 index e9504f41ff6..6c1262ab685 100644 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.203 +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.203 @@ -14,7 +14,6 @@ import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import java.util.function.Consumer -// FIX ME WHEN BUNCH 201 REMOVED class KotlinDocumentationProvider : KotlinDocumentationProviderCompatBase() { override fun collectDocComments(file: PsiFile, sink: Consumer) { diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java b/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java index db2dcdb44d9..3ec7456c074 100644 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java +++ b/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java @@ -34,18 +34,14 @@ import org.jetbrains.kotlin.resolve.jvm.KotlinJavaPsiFacade; import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm; import org.jetbrains.kotlin.resolve.konan.diagnostics.ErrorsNative; -import static org.jetbrains.kotlin.idea.TestResourceBundleKt.registerAdditionalResourceBundleInTests; public class PluginStartupActivity implements StartupActivity { private static final Logger LOG = Logger.getInstance(PluginStartupActivity.class); @Override public void runActivity(@NotNull Project project) { - if (ApplicationManager.getApplication().isUnitTestMode()) { - registerAdditionalResourceBundleInTests(); - } - StartupCompatKt.runActivity(project); + StartupKt.runActivity(project); PluginStartupService.Companion.getInstance(project).register(project); project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 b/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 deleted file mode 100644 index 570237a05fa..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/actions/NewKotlinFileAction.kt.201 +++ /dev/null @@ -1,274 +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.actions - -import com.intellij.ide.actions.CreateFileFromTemplateAction -import com.intellij.ide.actions.CreateFileFromTemplateDialog -import com.intellij.ide.actions.CreateFromTemplateAction -import com.intellij.ide.fileTemplates.FileTemplate -import com.intellij.ide.fileTemplates.FileTemplateManager -import com.intellij.ide.fileTemplates.actions.AttributesDefaults -import com.intellij.ide.fileTemplates.ui.CreateFromTemplateDialog -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.actionSystem.LangDataKeys -import com.intellij.openapi.actionSystem.PlatformDataKeys -import com.intellij.openapi.editor.LogicalPosition -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleUtilCore -import com.intellij.openapi.project.DumbAware -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager -import com.intellij.openapi.ui.InputValidatorEx -import com.intellij.psi.PsiDirectory -import com.intellij.psi.PsiFile -import com.intellij.util.IncorrectOperationException -import org.jetbrains.annotations.TestOnly -import org.jetbrains.kotlin.config.LanguageFeature -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.KotlinIcons -import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings -import org.jetbrains.kotlin.idea.statistics.FUSEventGroups -import org.jetbrains.kotlin.idea.statistics.KotlinFUSLogger -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.parsing.KotlinParserDefinition.Companion.STD_SCRIPT_SUFFIX -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtNamedDeclaration -import java.util.* - -class NewKotlinFileAction : CreateFileFromTemplateAction( - KotlinBundle.message("action.new.file.text"), - KotlinBundle.message("action.new.file.description"), - KotlinFileType.INSTANCE.icon -), DumbAware { - override fun postProcess(createdElement: PsiFile?, templateName: String?, customProperties: Map?) { - super.postProcess(createdElement, templateName, customProperties) - - val module = ModuleUtilCore.findModuleForPsiElement(createdElement!!) - - if (createdElement is KtFile) { - if (module != null) { - for (hook in NewKotlinFileHook.EP_NAME.extensions) { - hook.postProcess(createdElement, module) - } - } - - val ktClass = createdElement.declarations.singleOrNull() as? KtNamedDeclaration - if (ktClass != null) { - CreateFromTemplateAction.moveCaretAfterNameIdentifier(ktClass) - } else { - val editor = FileEditorManager.getInstance(createdElement.project).selectedTextEditor ?: return - if (editor.document == createdElement.viewProvider.document) { - val lineCount = editor.document.lineCount - if (lineCount > 0) { - editor.caretModel.moveToLogicalPosition(LogicalPosition(lineCount - 1, 0)) - } - } - } - } - } - - override fun buildDialog(project: Project, directory: PsiDirectory, builder: CreateFileFromTemplateDialog.Builder) { - builder.setTitle(KotlinBundle.message("action.new.file.dialog.title")) - .addKind( - KotlinBundle.message("action.new.file.dialog.class.title"), - KotlinIcons.CLASS, - "Kotlin Class" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.file.title"), - KotlinFileType.INSTANCE.icon, - "Kotlin File" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.interface.title"), - KotlinIcons.INTERFACE, - "Kotlin Interface" - ) - - if (project.getLanguageVersionSettings().supportsFeature(LanguageFeature.SealedInterfaces)) { - builder.addKind( - KotlinBundle.message("action.new.file.dialog.sealed.interface.title"), - KotlinIcons.INTERFACE, - "Kotlin Sealed Interface" - ) - } - - builder.addKind( - KotlinBundle.message("action.new.file.dialog.data.class.title"), - KotlinIcons.CLASS, - "Kotlin Data Class" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.enum.title"), - KotlinIcons.ENUM, - "Kotlin Enum" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.sealed.class.title"), - KotlinIcons.CLASS, - "Kotlin Sealed Class" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.annotation.title"), - KotlinIcons.ANNOTATION, - "Kotlin Annotation" - ) - .addKind( - KotlinBundle.message("action.new.file.dialog.object.title"), - KotlinIcons.OBJECT, - "Kotlin Object" - ) - - builder.setValidator(NameValidator) - } - - override fun getActionName(directory: PsiDirectory, newName: String, templateName: String): String = - KotlinBundle.message("action.new.file.text") - - override fun isAvailable(dataContext: DataContext): Boolean { - if (super.isAvailable(dataContext)) { - val ideView = LangDataKeys.IDE_VIEW.getData(dataContext)!! - val project = PlatformDataKeys.PROJECT.getData(dataContext)!! - val projectFileIndex = ProjectRootManager.getInstance(project).fileIndex - return ideView.directories.any { projectFileIndex.isInSourceContent(it.virtualFile) } - } - - return false - } - - override fun hashCode(): Int = 0 - - override fun equals(other: Any?): Boolean = other is NewKotlinFileAction - - override fun startInWriteAction() = false - - override fun createFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory) = - createFileFromTemplateWithStat(name, template, dir) - - companion object { - private object NameValidator : InputValidatorEx { - override fun getErrorText(inputString: String): String? { - if (inputString.trim().isEmpty()) { - return KotlinBundle.message("action.new.file.error.empty.name") - } - - val parts: List = inputString.split(*FQNAME_SEPARATORS) - if (parts.any { it.trim().isEmpty() }) { - return KotlinBundle.message("action.new.file.error.empty.name.part") - } - - return null - } - - override fun checkInput(inputString: String): Boolean = true - - override fun canClose(inputString: String): Boolean = getErrorText(inputString) == null - } - - @get:TestOnly - val nameValidator: InputValidatorEx - get() = NameValidator - - private fun findOrCreateTarget(dir: PsiDirectory, name: String, directorySeparators: CharArray): Pair { - var className = removeKotlinExtensionIfPresent(name) - var targetDir = dir - - for (splitChar in directorySeparators) { - if (splitChar in className) { - val names = className.trim().split(splitChar) - - for (dirName in names.dropLast(1)) { - targetDir = targetDir.findSubdirectory(dirName) ?: runWriteAction { - targetDir.createSubdirectory(dirName) - } - } - - className = names.last() - break - } - } - return Pair(className, targetDir) - } - - private fun removeKotlinExtensionIfPresent(name: String): String = when { - name.endsWith(".$KOTLIN_WORKSHEET_EXTENSION") -> name.removeSuffix(".$KOTLIN_WORKSHEET_EXTENSION") - name.endsWith(".$STD_SCRIPT_SUFFIX") -> name.removeSuffix(".$STD_SCRIPT_SUFFIX") - name.endsWith(".${KotlinFileType.EXTENSION}") -> name.removeSuffix(".${KotlinFileType.EXTENSION}") - else -> name - } - - private fun createFromTemplate(dir: PsiDirectory, className: String, template: FileTemplate): PsiFile? { - val project = dir.project - val defaultProperties = FileTemplateManager.getInstance(project).defaultProperties - - val properties = Properties(defaultProperties) - - val element = try { - CreateFromTemplateDialog( - project, dir, template, - AttributesDefaults(className).withFixedName(true), - properties - ).create() - } catch (e: IncorrectOperationException) { - throw e - } catch (e: Exception) { - LOG.error(e) - return null - } - - return element?.containingFile - } - - private val FILE_SEPARATORS = charArrayOf('/', '\\') - private val FQNAME_SEPARATORS = charArrayOf('/', '\\', '.') - - fun createFileFromTemplateWithStat(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? { - KotlinFUSLogger.log(FUSEventGroups.NewFileTemplate, template.name) - return createFileFromTemplate(name, template, dir) - } - - - fun createFileFromTemplate(name: String, template: FileTemplate, dir: PsiDirectory): PsiFile? { - val directorySeparators = when (template.name) { - "Kotlin File" -> FILE_SEPARATORS - else -> FQNAME_SEPARATORS - } - val (className, targetDir) = findOrCreateTarget(dir, name, directorySeparators) - - val service = DumbService.getInstance(dir.project) - service.isAlternativeResolveEnabled = true - try { - val psiFile = createFromTemplate(targetDir, className, template) - if (psiFile is KtFile) { - val singleClass = psiFile.declarations.singleOrNull() as? KtClass - if (singleClass != null && !singleClass.isEnum() && !singleClass.isInterface() && name.contains("Abstract")) { - runWriteAction { - singleClass.addModifier(KtTokens.ABSTRACT_KEYWORD) - } - } - } - return psiFile - } finally { - service.isAlternativeResolveEnabled = false - } - } - } -} - -abstract class NewKotlinFileHook { - companion object { - val EP_NAME: ExtensionPointName = - ExtensionPointName.create("org.jetbrains.kotlin.newFileHook") - } - - abstract fun postProcess(createdElement: KtFile, module: Module) -} diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt deleted file mode 100644 index feae10da8d9..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt +++ /dev/null @@ -1,15 +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.codeInsight - -import com.intellij.ide.ui.UISettings -import com.intellij.ui.breadcrumbs.BreadcrumbsProvider - -// FIX ME WHEN BUNCH 201 REMOVED -abstract class BreadcrumbsProviderCompatBase : BreadcrumbsProvider { - override fun isShownByDefault(): Boolean = - !UISettings.instance.showMembersInNavigationBar -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt index dd55099238c..456a507a3fe 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt @@ -5,11 +5,13 @@ package org.jetbrains.kotlin.idea.codeInsight +import com.intellij.ide.ui.UISettings import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.IndexNotReadyException import com.intellij.psi.ElementDescriptionUtil import com.intellij.psi.PsiElement import com.intellij.refactoring.util.RefactoringDescriptionLocation +import com.intellij.ui.breadcrumbs.BreadcrumbsProvider import com.intellij.usageView.UsageViewShortNameLocation import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.idea.KotlinBundle @@ -23,8 +25,7 @@ import org.jetbrains.kotlin.renderer.render import org.jetbrains.kotlin.resolve.calls.callUtil.getValueArgumentsInParentheses import kotlin.reflect.KClass -// FIX ME WHEN BUNCH 201 REMOVED -class KotlinBreadcrumbsInfoProvider : BreadcrumbsProviderCompatBase() { +class KotlinBreadcrumbsInfoProvider : BreadcrumbsProvider { private abstract class ElementHandler(val type: KClass) { abstract fun elementInfo(element: TElement): String abstract fun elementTooltip(element: TElement): String @@ -428,6 +429,9 @@ class KotlinBreadcrumbsInfoProvider : BreadcrumbsProviderCompatBase() { } } + override fun isShownByDefault(): Boolean = + !UISettings.instance.showMembersInNavigationBar + private companion object { enum class TextKind(val maxTextLength: Int) { INFO(16), TOOLTIP(100) diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as41 deleted file mode 100644 index d1d25c9b8bd..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt.as41 +++ /dev/null @@ -1,16 +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.configuration - -internal object MLCompletionForKotlin { - const val isAvailable: Boolean = false - - var isEnabled: Boolean - get() = false - set(value) { - throw UnsupportedOperationException() - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 deleted file mode 100644 index 6e32fa682c0..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightExitPointsHandlerFactory.kt.201 +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.highlighter - -import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase -import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerFactoryBase -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.impl.source.tree.LeafPsiElement -import com.intellij.psi.tree.TokenSet -import com.intellij.psi.util.PsiTreeUtil -import com.intellij.util.Consumer -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.parents -import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsResultOfLambda -import org.jetbrains.kotlin.resolve.inline.InlineUtil -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode - -class KotlinHighlightExitPointsHandlerFactory : HighlightUsagesHandlerFactoryBase() { - companion object { - private val RETURN_AND_THROW = TokenSet.create(KtTokens.RETURN_KEYWORD, KtTokens.THROW_KEYWORD) - - private fun getOnReturnOrThrowUsageHandler(editor: Editor, file: PsiFile, target: PsiElement): HighlightUsagesHandlerBase<*>? { - if (target !is LeafPsiElement || target.elementType !in RETURN_AND_THROW) { - return null - } - - val returnOrThrow = PsiTreeUtil.getParentOfType( - target, - KtReturnExpression::class.java, - KtThrowExpression::class.java - ) ?: return null - - return OnExitUsagesHandler(editor, file, returnOrThrow) - } - - private fun getOnLambdaCallUsageHandler(editor: Editor, file: PsiFile, target: PsiElement): HighlightUsagesHandlerBase<*>? { - if (target !is LeafPsiElement || target.elementType != KtTokens.IDENTIFIER) { - return null - } - - val refExpr = target.parent as? KtNameReferenceExpression ?: return null - val call = refExpr.parent as? KtCallExpression ?: return null - if (call.calleeExpression != refExpr) return null - - val lambda = call.lambdaArguments.singleOrNull() ?: return null - val literal = lambda.getLambdaExpression()?.functionLiteral ?: return null - - return OnExitUsagesHandler(editor, file, literal, highlightReferences = true) - } - } - - override fun createHighlightUsagesHandler(editor: Editor, file: PsiFile, target: PsiElement): HighlightUsagesHandlerBase<*>? { - return getOnReturnOrThrowUsageHandler(editor, file, target) - ?: getOnLambdaCallUsageHandler(editor, file, target) - } - - private class OnExitUsagesHandler(editor: Editor, file: PsiFile, val target: KtExpression, val highlightReferences: Boolean = false) : - HighlightUsagesHandlerBase(editor, file) { - - override fun getTargets() = listOf(target) - - override fun selectTargets(targets: MutableList, selectionConsumer: Consumer>) { - selectionConsumer.consume(targets) - } - - override fun computeUsages(targets: MutableList?) { - val relevantFunction: KtDeclarationWithBody? = - if (target is KtFunctionLiteral) { - target - } else { - target.getRelevantDeclaration() - } - - relevantFunction?.accept(object : KtVisitorVoid() { - override fun visitKtElement(element: KtElement) { - element.acceptChildren(this) - } - - override fun visitExpression(expression: KtExpression) { - if (relevantFunction is KtFunctionLiteral) { - if (occurrenceForFunctionLiteralReturnExpression(expression)) { - return - } - } - - super.visitExpression(expression) - } - - private fun occurrenceForFunctionLiteralReturnExpression(expression: KtExpression): Boolean { - if (!KtPsiUtil.isStatement(expression)) return false - - if (expression is KtIfExpression || expression is KtWhenExpression || expression is KtBlockExpression) { - return false - } - - val bindingContext = expression.analyze(BodyResolveMode.FULL) - if (!expression.isUsedAsResultOfLambda(bindingContext)) { - return false - } - - if (expression.getRelevantDeclaration() != relevantFunction) { - return false - } - - addOccurrence(expression) - return true - } - - private fun visitReturnOrThrow(expression: KtExpression) { - if (expression.getRelevantDeclaration() == relevantFunction) { - addOccurrence(expression) - } - } - - override fun visitReturnExpression(expression: KtReturnExpression) { - visitReturnOrThrow(expression) - } - - override fun visitThrowExpression(expression: KtThrowExpression) { - visitReturnOrThrow(expression) - } - }) - } - - override fun highlightReferences() = highlightReferences - } -} - -private fun KtExpression.getRelevantDeclaration(): KtDeclarationWithBody? { - if (this is KtReturnExpression) { - (this.getTargetLabel()?.mainReference?.resolve() as? KtFunction)?.let { - return it - } - } - - if (this is KtThrowExpression || this is KtReturnExpression) { - for (parent in parents) { - if (parent is KtDeclarationWithBody) { - if (parent is KtPropertyAccessor) { - return parent - } - - if (InlineUtil.canBeInlineArgument(parent) && - !InlineUtil.isInlinedArgument(parent as KtFunction, parent.analyze(BodyResolveMode.FULL), false) - ) { - return parent - } - } - } - - return null - } - - return parents.filterIsInstance().firstOrNull() -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 deleted file mode 100644 index 8ba248cd6ce..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinHighlightImplicitItHandlerFactory.kt.201 +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.highlighter - -import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerBase -import com.intellij.codeInsight.highlighting.HighlightUsagesHandlerFactoryBase -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.impl.source.tree.LeafPsiElement -import com.intellij.util.Consumer -import org.jetbrains.kotlin.idea.intentions.getLambdaByImplicitItReference -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.KtNameReferenceExpression -import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import org.jetbrains.kotlin.psi.KtTreeVisitorVoid - -class KotlinHighlightImplicitItHandlerFactory : HighlightUsagesHandlerFactoryBase() { - override fun createHighlightUsagesHandler(editor: Editor, file: PsiFile, target: PsiElement): HighlightUsagesHandlerBase<*>? { - if (!(target is LeafPsiElement && target.elementType == KtTokens.IDENTIFIER)) return null - val refExpr = target.parent as? KtNameReferenceExpression ?: return null - val lambda = getLambdaByImplicitItReference(refExpr) ?: return null - return object : HighlightUsagesHandlerBase(editor, file) { - override fun getTargets() = listOf(refExpr) - - override fun selectTargets( - targets: MutableList, - selectionConsumer: Consumer> - ) = selectionConsumer.consume(targets) - - override fun computeUsages(targets: MutableList?) { - lambda.accept( - object : KtTreeVisitorVoid() { - override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { - if (expression is KtNameReferenceExpression && getLambdaByImplicitItReference(expression) == lambda) { - addOccurrence(expression) - } - } - } - ) - } - } - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 deleted file mode 100644 index 0d5b0b629d2..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt.201 +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.highlighter - -import com.intellij.codeHighlighting.Pass -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.codeInsight.daemon.LineMarkerProvider -import com.intellij.icons.AllIcons -import com.intellij.openapi.editor.markup.GutterIconRenderer -import com.intellij.openapi.progress.ProgressManager -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.highlighter.markers.LineMarkerInfos -import org.jetbrains.kotlin.idea.inspections.RecursivePropertyAccessorInspection -import org.jetbrains.kotlin.idea.util.getReceiverTargetDescriptor -import org.jetbrains.kotlin.lexer.KtToken -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.parents -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.inline.InlineUtil -import org.jetbrains.kotlin.resolve.scopes.receivers.Receiver -import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue -import org.jetbrains.kotlin.types.expressions.OperatorConventions -import org.jetbrains.kotlin.util.OperatorNameConventions -import java.util.* - -class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider { - override fun getLineMarkerInfo(element: PsiElement) = null - - override fun collectSlowLineMarkers(elements: MutableList, result: LineMarkerInfos) { - val markedLineNumbers = HashSet() - - for (element in elements) { - ProgressManager.checkCanceled() - if (element is KtElement) { - val lineNumber = element.getLineNumber() - if (lineNumber !in markedLineNumbers && isRecursiveCall(element)) { - markedLineNumbers.add(lineNumber) - result.add(RecursiveMethodCallMarkerInfo(getElementForLineMark(element))) - } - } - } - } - - private fun getEnclosingFunction(element: KtElement, stopOnNonInlinedLambdas: Boolean): KtNamedFunction? { - for (parent in element.parents) { - when (parent) { - is KtFunctionLiteral -> if (stopOnNonInlinedLambdas && !InlineUtil.isInlinedArgument( - parent, - parent.analyze(), - false - ) - ) return null - is KtNamedFunction -> { - when (parent.parent) { - is KtBlockExpression, is KtClassBody, is KtFile, is KtScript -> return parent - else -> if (stopOnNonInlinedLambdas && !InlineUtil.isInlinedArgument(parent, parent.analyze(), false)) return null - } - } - is KtClassOrObject -> return null - } - } - return null - } - - private fun isRecursiveCall(element: KtElement): Boolean { - if (RecursivePropertyAccessorInspection.isRecursivePropertyAccess(element)) return true - if (RecursivePropertyAccessorInspection.isRecursiveSyntheticPropertyAccess(element)) return true - // Fast check for names without resolve - val resolveName = getCallNameFromPsi(element) ?: return false - val enclosingFunction = getEnclosingFunction(element, false) ?: return false - - val enclosingFunctionName = enclosingFunction.name - if (enclosingFunctionName != OperatorNameConventions.INVOKE.asString() - && enclosingFunctionName != resolveName.asString() - ) return false - - // Check that there were no not-inlined lambdas on the way to enclosing function - if (enclosingFunction != getEnclosingFunction(element, true)) return false - - val bindingContext = element.analyze() - val enclosingFunctionDescriptor = bindingContext[BindingContext.FUNCTION, enclosingFunction] ?: return false - - val call = bindingContext[BindingContext.CALL, element] ?: return false - val resolvedCall = bindingContext[BindingContext.RESOLVED_CALL, call] ?: return false - - if (resolvedCall.candidateDescriptor.original != enclosingFunctionDescriptor) return false - - fun isDifferentReceiver(receiver: Receiver?): Boolean { - if (receiver !is ReceiverValue) return false - - val receiverOwner = receiver.getReceiverTargetDescriptor(bindingContext) ?: return true - - return when (receiverOwner) { - is SimpleFunctionDescriptor -> receiverOwner != enclosingFunctionDescriptor - is ClassDescriptor -> receiverOwner != enclosingFunctionDescriptor.containingDeclaration - else -> return true - } - } - - if (isDifferentReceiver(resolvedCall.dispatchReceiver)) return false - return true - } - - private class RecursiveMethodCallMarkerInfo(callElement: PsiElement) : LineMarkerInfo( - callElement, - callElement.textRange, - AllIcons.Gutter.RecursiveMethod, - Pass.LINE_MARKERS, - { KotlinBundle.message("highlighter.tool.tip.text.recursive.call") }, - null, - GutterIconRenderer.Alignment.RIGHT - ) { - - override fun createGutterRenderer(): GutterIconRenderer? { - return object : LineMarkerInfo.LineMarkerGutterIconRenderer(this) { - override fun getClickAction() = null // to place breakpoint on mouse click - } - } - } - -} - -internal fun getElementForLineMark(callElement: PsiElement): PsiElement = - when (callElement) { - is KtSimpleNameExpression -> callElement.getReferencedNameElement() - else -> - // a fallback, - //but who knows what to reference in KtArrayAccessExpression ? - generateSequence(callElement, { it.firstChild }).last() - } - -private fun PsiElement.getLineNumber(): Int { - return PsiDocumentManager.getInstance(project).getDocument(containingFile)!!.getLineNumber(textOffset) -} - -private fun getCallNameFromPsi(element: KtElement): Name? { - when (element) { - is KtSimpleNameExpression -> { - val elementParent = element.getParent() - when (elementParent) { - is KtCallExpression -> return Name.identifier(element.getText()) - is KtOperationExpression -> { - val operationReference = elementParent.operationReference - if (element == operationReference) { - val node = operationReference.getReferencedNameElementType() - return if (node is KtToken) { - val conventionName = if (elementParent is KtPrefixExpression) - OperatorConventions.getNameForOperationSymbol(node, true, false) - else - OperatorConventions.getNameForOperationSymbol(node) - - conventionName ?: Name.identifier(element.getText()) - } else { - Name.identifier(element.getText()) - } - } - } - } - } - is KtArrayAccessExpression -> - return OperatorNameConventions.GET - is KtThisExpression -> - if (element.getParent() is KtCallExpression) { - return OperatorNameConventions.INVOKE - } - } - - return null -} diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 deleted file mode 100644 index 0b31d4eeffb..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinSuspendCallLineMarkerProvider.kt.201 +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2010-2018 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.highlighter - -import com.intellij.codeHighlighting.Pass -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.codeInsight.daemon.LineMarkerProvider -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.editor.markup.GutterIconRenderer -import com.intellij.openapi.progress.ProgressManager -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.descriptors.PropertyDescriptor -import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors -import org.jetbrains.kotlin.descriptors.accessors -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.KotlinIcons -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.highlighter.markers.LineMarkerInfos -import org.jetbrains.kotlin.idea.refactoring.getLineNumber -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.BindingContext.* -import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode - -class KotlinSuspendCallLineMarkerProvider : LineMarkerProvider { - private class SuspendCallMarkerInfo(callElement: PsiElement, message: String) : LineMarkerInfo( - callElement, - callElement.textRange, - KotlinIcons.SUSPEND_CALL, - Pass.LINE_MARKERS, - { message }, - null, - GutterIconRenderer.Alignment.RIGHT - ) { - override fun createGutterRenderer(): GutterIconRenderer? { - return object : LineMarkerInfo.LineMarkerGutterIconRenderer(this) { - override fun getClickAction(): AnAction? = null - } - } - } - - override fun getLineMarkerInfo(element: PsiElement): LineMarkerInfo<*>? = null - - override fun collectSlowLineMarkers( - elements: MutableList, - result: LineMarkerInfos - ) { - val markedLineNumbers = HashSet() - - for (element in elements) { - ProgressManager.checkCanceled() - - if (element !is KtExpression) continue - - val containingFile = element.containingFile - if (containingFile !is KtFile || containingFile is KtCodeFragment) { - continue - } - - val lineNumber = element.getLineNumber() - if (lineNumber in markedLineNumbers) continue - if (!element.hasSuspendCalls()) continue - - markedLineNumbers += lineNumber - result += if (element is KtForExpression) { - SuspendCallMarkerInfo( - getElementForLineMark(element.loopRange!!), - KotlinBundle.message("highlighter.message.suspending.iteration") - ) - } else { - SuspendCallMarkerInfo(getElementForLineMark(element), KotlinBundle.message("highlighter.message.suspend.function.call")) - } - } - } -} - -private fun KtExpression.isValidCandidateExpression(): Boolean { - if (this is KtParenthesizedExpression) return false - if (this is KtOperationReferenceExpression || this is KtForExpression || this is KtProperty || this is KtNameReferenceExpression) return true - val parent = parent - if (parent is KtCallExpression && parent.calleeExpression == this) return true - if (this is KtCallExpression && (calleeExpression is KtCallExpression || calleeExpression is KtParenthesizedExpression)) return true - return false -} - -fun KtExpression.hasSuspendCalls(bindingContext: BindingContext = analyze(BodyResolveMode.PARTIAL)): Boolean { - if (!isValidCandidateExpression()) return false - - return when (this) { - is KtForExpression -> { - val iteratorResolvedCall = bindingContext[LOOP_RANGE_ITERATOR_RESOLVED_CALL, loopRange] - val loopRangeHasNextResolvedCall = bindingContext[LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, loopRange] - val loopRangeNextResolvedCall = bindingContext[LOOP_RANGE_NEXT_RESOLVED_CALL, loopRange] - listOf(iteratorResolvedCall, loopRangeHasNextResolvedCall, loopRangeNextResolvedCall).any { - it?.resultingDescriptor?.isSuspend == true - } - } - is KtProperty -> { - if (hasDelegateExpression()) { - val variableDescriptor = bindingContext[DECLARATION_TO_DESCRIPTOR, this] as? VariableDescriptorWithAccessors - val accessors = variableDescriptor?.accessors ?: emptyList() - accessors.any { accessor -> - val delegatedFunctionDescriptor = bindingContext[DELEGATED_PROPERTY_RESOLVED_CALL, accessor]?.resultingDescriptor - delegatedFunctionDescriptor?.isSuspend == true - } - } else { - false - } - } - else -> { - val resolvedCall = getResolvedCall(bindingContext) - if ((resolvedCall?.resultingDescriptor as? FunctionDescriptor)?.isSuspend == true) true - else { - val propertyDescriptor = resolvedCall?.resultingDescriptor as? PropertyDescriptor - val s = propertyDescriptor?.fqNameSafe?.asString() - s?.startsWith("kotlin.coroutines.") == true && s.endsWith(".coroutineContext") - } - } - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 deleted file mode 100644 index 48f3ff2c06b..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/LineMarkerInfos.kt.201 +++ /dev/null @@ -1,10 +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.highlighter.markers - -import com.intellij.codeInsight.daemon.LineMarkerInfo - -typealias LineMarkerInfos = MutableCollection> \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt index 0dbc4cae3bb..3b55ac2bb1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.idea.KotlinIcons import org.jetbrains.kotlin.idea.highlighter.dsl.DslHighlighterExtension import javax.swing.Icon -// FIX ME WHEN BUNCH as41 REMOVED +// FIX ME WHEN BUNCH as42 REMOVED internal fun createDslStyleIcon(styleId: Int): Icon { val globalScheme = EditorColorsManager.getInstance().globalScheme val markersColor = globalScheme.getAttributes(DslHighlighterExtension.styleById(styleId)).foregroundColor diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 deleted file mode 100644 index f337f4c472a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as41 +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.highlighter.markers - -import com.intellij.icons.AllIcons -import javax.swing.Icon - -// FIX ME WHEN BUNCH as41 REMOVED -internal fun createDslStyleIcon(styleId: Int): Icon { - return AllIcons.Gutter.Colors -} diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 b/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 deleted file mode 100644 index 956127dd23d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/TrailingCommaInspection.kt.201 +++ /dev/null @@ -1,192 +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.inspections - -import com.intellij.application.options.CodeStyle -import com.intellij.codeInspection.LocalQuickFix -import com.intellij.codeInspection.ProblemDescriptor -import com.intellij.codeInspection.ProblemHighlightType -import com.intellij.codeInspection.ProblemsHolder -import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.TextRange -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiElementVisitor -import com.intellij.psi.codeStyle.CodeStyleManager -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.formatter.TrailingCommaVisitor -import org.jetbrains.kotlin.idea.formatter.kotlinCustomSettings -import org.jetbrains.kotlin.idea.formatter.trailingComma.* -import org.jetbrains.kotlin.idea.formatter.trailingCommaAllowedInModule -import org.jetbrains.kotlin.idea.util.isComma -import org.jetbrains.kotlin.idea.util.isLineBreak -import org.jetbrains.kotlin.idea.util.leafIgnoringWhitespaceAndComments -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.psiUtil.* -import javax.swing.JComponent -import kotlin.properties.Delegates - -class TrailingCommaInspection( - @JvmField - var addCommaWarning: Boolean = false -) : AbstractKotlinInspection() { - override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor = object : TrailingCommaVisitor() { - override val recursively: Boolean = false - private var useTrailingComma by Delegates.notNull() - - override fun process(trailingCommaContext: TrailingCommaContext) { - val element = trailingCommaContext.ktElement - val kotlinCustomSettings = CodeStyle.getSettings(element.project).kotlinCustomSettings - useTrailingComma = kotlinCustomSettings.addTrailingCommaIsAllowedFor(element) - when (trailingCommaContext.state) { - TrailingCommaState.MISSING, TrailingCommaState.EXISTS -> { - checkCommaPosition(element) - checkLineBreaks(element) - } - else -> Unit - } - - checkTrailingComma(trailingCommaContext) - } - - private fun checkLineBreaks(commaOwner: KtElement) { - val first = TrailingCommaHelper.elementBeforeFirstElement(commaOwner) - if (first?.nextLeaf(true)?.isLineBreak() == false) { - first.nextSibling?.let { - registerProblemForLineBreak(commaOwner, it, ProblemHighlightType.INFORMATION) - } - } - - val last = TrailingCommaHelper.elementAfterLastElement(commaOwner) - if (last?.prevLeaf(true)?.isLineBreak() == false) { - registerProblemForLineBreak( - commaOwner, - last, - if (addCommaWarning) ProblemHighlightType.GENERIC_ERROR_OR_WARNING else ProblemHighlightType.INFORMATION, - ) - } - } - - private fun checkCommaPosition(commaOwner: KtElement) { - for (invalidComma in TrailingCommaHelper.findInvalidCommas(commaOwner)) { - reportProblem( - invalidComma, - KotlinBundle.message("inspection.trailing.comma.comma.loses.the.advantages.in.this.position"), - KotlinBundle.message("inspection.trailing.comma.fix.comma.position") - ) - } - } - - private fun checkTrailingComma(trailingCommaContext: TrailingCommaContext) { - val commaOwner = trailingCommaContext.ktElement - val trailingCommaOrLastElement = TrailingCommaHelper.trailingCommaOrLastElement(commaOwner) ?: return - when (trailingCommaContext.state) { - TrailingCommaState.MISSING -> { - if (!trailingCommaAllowedInModule(commaOwner)) return - reportProblem( - trailingCommaOrLastElement, - KotlinBundle.message("inspection.trailing.comma.missing.trailing.comma"), - KotlinBundle.message("inspection.trailing.comma.add.trailing.comma"), - if (addCommaWarning) ProblemHighlightType.GENERIC_ERROR_OR_WARNING else ProblemHighlightType.INFORMATION, - ) - } - TrailingCommaState.REDUNDANT -> { - reportProblem( - trailingCommaOrLastElement, - KotlinBundle.message("inspection.trailing.comma.useless.trailing.comma"), - KotlinBundle.message("inspection.trailing.comma.remove.trailing.comma"), - ProblemHighlightType.LIKE_UNUSED_SYMBOL, - checkTrailingCommaSettings = false, - ) - } - else -> Unit - } - } - - private fun reportProblem( - commaOrElement: PsiElement, - message: String, - fixMessage: String, - highlightType: ProblemHighlightType = ProblemHighlightType.GENERIC_ERROR_OR_WARNING, - checkTrailingCommaSettings: Boolean = true, - ) { - val commaOwner = commaOrElement.parent as KtElement - // case for KtFunctionLiteral, where PsiWhiteSpace after KtTypeParameterList isn't included in this list - val problemOwner = commaOwner.parent - holder.registerProblem( - problemOwner, - message, - highlightType.applyCondition(!checkTrailingCommaSettings || useTrailingComma), - commaOrElement.textRangeOfCommaOrSymbolAfter.shiftLeft(problemOwner.startOffset), - createQuickFix(fixMessage, commaOwner), - ) - } - - private fun registerProblemForLineBreak( - commaOwner: KtElement, - elementForTextRange: PsiElement, - highlightType: ProblemHighlightType, - ) { - val problemElement = commaOwner.parent - holder.registerProblem( - problemElement, - KotlinBundle.message("inspection.trailing.comma.missing.line.break"), - highlightType.applyCondition(useTrailingComma), - TextRange.from(elementForTextRange.startOffset, 1).shiftLeft(problemElement.startOffset), - createQuickFix(KotlinBundle.message("inspection.trailing.comma.add.line.break"), commaOwner), - ) - } - - private fun ProblemHighlightType.applyCondition(condition: Boolean): ProblemHighlightType = when { - ApplicationManager.getApplication().isUnitTestMode -> ProblemHighlightType.GENERIC_ERROR_OR_WARNING - condition -> this - else -> ProblemHighlightType.INFORMATION - } - - private fun createQuickFix( - fixMessage: String, - commaOwner: KtElement, - ): LocalQuickFix = object : LocalQuickFix { - val commaOwnerPointer = commaOwner.createSmartPointer() - - override fun getFamilyName(): String = fixMessage - - override fun applyFix(project: Project, problemDescriptor: ProblemDescriptor) { - val element = commaOwnerPointer.element ?: return - val range = createFormatterTextRange(element) - val settings = CodeStyle.getSettings(project).clone() - settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA = true - settings.kotlinCustomSettings.ALLOW_TRAILING_COMMA_ON_CALL_SITE = true - CodeStyle.doWithTemporarySettings(project, settings) { - CodeStyleManager.getInstance(project).reformatRange(element, range.startOffset, range.endOffset) - } - } - } - - private fun createFormatterTextRange(commaOwner: KtElement): TextRange { - val startElement = TrailingCommaHelper.elementBeforeFirstElement(commaOwner) ?: commaOwner - val endElement = TrailingCommaHelper.elementAfterLastElement(commaOwner) ?: commaOwner - return TextRange.create(startElement.startOffset, endElement.endOffset) - } - - private val PsiElement.textRangeOfCommaOrSymbolAfter: TextRange - get() { - val textRange = textRange - if (isComma) return textRange - - return nextLeaf()?.leafIgnoringWhitespaceAndComments(false)?.endOffset?.takeIf { it > 0 }?.let { - TextRange.create(it - 1, it).intersection(textRange) - } ?: TextRange.create(textRange.endOffset - 1, textRange.endOffset) - } - } - - override fun createOptionsPanel(): JComponent? { - val panel = MultipleCheckboxOptionsPanel(this) - panel.addCheckbox(KotlinBundle.message("inspection.trailing.comma.report.also.a.missing.comma"), "addCommaWarning") - return panel - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java deleted file mode 100644 index 4c0d1a7b3ab..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java +++ /dev/null @@ -1,27 +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.refactoring.changeSignature; - -import com.intellij.psi.PsiElement; -import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.refactoring.util.TextOccurrencesUtil; -import com.intellij.usageView.UsageInfo; - -import java.util.Collection; - -// FIX ME WHEN BUNCH 201 REMOVED -final class BunchedDeprecation { - public static void findNonCodeUsages( - PsiElement element, - String stringToSearch, - boolean searchInStringsAndComments, - boolean searchInNonJavaFiles, - String newQName, - Collection results) { - TextOccurrencesUtil.findNonCodeUsages(element, GlobalSearchScope.projectScope(element.getProject()), - stringToSearch, searchInStringsAndComments, searchInNonJavaFiles, newQName, results); - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt index f6b9d612d09..665a1f8acfc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt @@ -10,6 +10,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.Ref import com.intellij.psi.* import com.intellij.psi.codeStyle.JavaCodeStyleManager +import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.searches.MethodReferencesSearch import com.intellij.psi.search.searches.OverridingMethodsSearch import com.intellij.psi.search.searches.ReferencesSearch @@ -20,6 +21,7 @@ import com.intellij.refactoring.rename.UnresolvableCollisionUsageInfo import com.intellij.refactoring.util.CommonRefactoringUtil import com.intellij.refactoring.util.MoveRenameUsageInfo import com.intellij.refactoring.util.RefactoringUIUtil +import com.intellij.refactoring.util.TextOccurrencesUtil import com.intellij.usageView.UsageInfo import com.intellij.util.containers.MultiMap import org.jetbrains.kotlin.asJava.elements.KtLightMethod @@ -269,7 +271,10 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor { val oldName = changeInfo.oldName if (oldName != null) { - BunchedDeprecation.findNonCodeUsages(functionPsi, oldName, true, true, changeInfo.newName, result) + TextOccurrencesUtil.findNonCodeUsages( + functionPsi, GlobalSearchScope.projectScope(functionPsi.project), + oldName, true, true, changeInfo.newName, result + ) } val oldParameters = (functionPsi as KtNamedDeclaration).getValueParameters() diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 deleted file mode 100644 index 903769e65e0..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinMutableMethodDescriptor.kt.201 +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010-2019 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.refactoring.changeSignature - -import org.jetbrains.kotlin.descriptors.DescriptorVisibility - -class KotlinMutableMethodDescriptor(override val original: KotlinMethodDescriptor) : KotlinMethodDescriptor by original { - private val parameters: MutableList = original.parameters - - override var receiver: KotlinParameterInfo? = original.receiver - set(value: KotlinParameterInfo?) { - if (value != null && value !in parameters) { - parameters.add(value) - } - field = value - } - - fun addParameter(parameter: KotlinParameterInfo) { - parameters.add(parameter) - } - - fun addParameter(index: Int, parameter: KotlinParameterInfo) { - parameters.add(index, parameter) - } - - fun removeParameter(index: Int) { - val paramInfo = parameters.removeAt(index) - if (paramInfo == receiver) { - receiver = null - } - } - - fun renameParameter(index: Int, newName: String) { - parameters[index].name = newName - } - - fun clearNonReceiverParameters() { - parameters.clear() - receiver?.let { parameters.add(it) } - } - - override fun getVisibility(): DescriptorVisibility { - return original.visibility - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java deleted file mode 100644 index 04e417a5d18..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java +++ /dev/null @@ -1,27 +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.refactoring.move.moveDeclarations; - -import com.intellij.psi.PsiElement; -import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.refactoring.util.TextOccurrencesUtil; -import com.intellij.usageView.UsageInfo; - -import java.util.Collection; - -// FIX ME WHEN BUNCH 201 REMOVED -final class BunchedDeprecation { - public static void findNonCodeUsages( - PsiElement element, - String stringToSearch, - boolean searchInStringsAndComments, - boolean searchInNonJavaFiles, - String newQName, - Collection results) { - TextOccurrencesUtil.findNonCodeUsages(element, GlobalSearchScope.projectScope(element.getProject()), - stringToSearch, searchInStringsAndComments, searchInNonJavaFiles, newQName, results); - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt index 72418c8a515..d2f0ac19086 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt @@ -22,6 +22,7 @@ import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassHandler import com.intellij.refactoring.rename.RenameUtil import com.intellij.refactoring.util.NonCodeUsageInfo import com.intellij.refactoring.util.RefactoringUIUtil +import com.intellij.refactoring.util.TextOccurrencesUtil import com.intellij.usageView.UsageInfo import com.intellij.usageView.UsageViewBundle import com.intellij.usageView.UsageViewDescriptor @@ -224,8 +225,9 @@ class MoveKotlinDeclarationsProcessor( val name = lightElement.getKotlinFqName()?.quoteIfNeeded()?.asString() if (name != null) { fun searchForKotlinNameUsages(results: ArrayList) { - BunchedDeprecation.findNonCodeUsages( + TextOccurrencesUtil.findNonCodeUsages( lightElement, + GlobalSearchScope.projectScope(lightElement.project), name, descriptor.searchInCommentsAndStrings, descriptor.searchInNonCode, @@ -242,8 +244,9 @@ class MoveKotlinDeclarationsProcessor( elementName ) - BunchedDeprecation.findNonCodeUsages( + TextOccurrencesUtil.findNonCodeUsages( lightElement, + GlobalSearchScope.projectScope(lightElement.project), oldFqNameWithFacade, descriptor.searchInCommentsAndStrings, descriptor.searchInNonCode, diff --git a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as41 deleted file mode 100644 index f6dcd38c87e..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as41 +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010-2019 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.reporter - -import com.intellij.diagnostic.ITNReporter -import com.intellij.openapi.diagnostic.IdeaLoggingEvent -import com.intellij.openapi.diagnostic.SubmittedReportInfo -import com.intellij.util.Consumer -import java.awt.Component - -abstract class ITNReporterCompat : ITNReporter() { - final override fun submit( - events: Array, - additionalInfo: String?, - parentComponent: Component?, - consumer: Consumer - ): Boolean { - return submitCompat(events, additionalInfo, parentComponent, consumer) - } - - open fun submitCompat( - events: Array, - additionalInfo: String?, - parentComponent: Component?, - consumer: Consumer - ): Boolean { - @Suppress("IncompatibleAPI") - return super.submit(events, additionalInfo, parentComponent, consumer) - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 deleted file mode 100644 index c93f6ab7474..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.201 +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2010-2019 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.search.ideaExtensions - -import com.intellij.codeInsight.JavaTargetElementEvaluator -import com.intellij.codeInsight.TargetElementEvaluatorEx -import com.intellij.codeInsight.TargetElementUtil -import com.intellij.codeInsight.TargetElementUtilExtender -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiReference -import com.intellij.util.BitUtil -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource -import org.jetbrains.kotlin.idea.intentions.isAutoCreatedItUsage -import org.jetbrains.kotlin.idea.references.KtDestructuringDeclarationReference -import org.jetbrains.kotlin.idea.references.KtSimpleNameReference -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.idea.references.resolveMainReferenceToDescriptors -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.* -import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension -import org.jetbrains.kotlin.resolve.source.getPsi - -class KotlinTargetElementEvaluator : TargetElementEvaluatorEx, TargetElementUtilExtender { - companion object { - const val DO_NOT_UNWRAP_LABELED_EXPRESSION = 0x100 - const val BYPASS_IMPORT_ALIAS = 0x200 - - // Place caret after the open curly brace in lambda for generated 'it' - fun findLambdaOpenLBraceForGeneratedIt(ref: PsiReference): PsiElement? { - val element: PsiElement = ref.element - if (element.text != "it") return null - - if (element !is KtNameReferenceExpression || !isAutoCreatedItUsage(element)) return null - - val itDescriptor = element.resolveMainReferenceToDescriptors().singleOrNull() ?: return null - val descriptorWithSource = itDescriptor.containingDeclaration as? DeclarationDescriptorWithSource ?: return null - val lambdaExpression = descriptorWithSource.source.getPsi()?.parent as? KtLambdaExpression ?: return null - return lambdaExpression.leftCurlyBrace.treeNext?.psi - } - - // Navigate to receiver element for this in extension declaration - fun findReceiverForThisInExtensionFunction(ref: PsiReference): PsiElement? { - val element: PsiElement = ref.element - if (element.text != "this") return null - - if (element !is KtNameReferenceExpression) return null - val callableDescriptor = element.resolveMainReferenceToDescriptors().singleOrNull() as? CallableDescriptor ?: return null - - if (!callableDescriptor.isExtension) return null - val callableDeclaration = callableDescriptor.source.getPsi() as? KtCallableDeclaration ?: return null - - return callableDeclaration.receiverTypeReference - } - } - - override fun getAdditionalDefinitionSearchFlags() = 0 - - override fun getAdditionalReferenceSearchFlags() = DO_NOT_UNWRAP_LABELED_EXPRESSION or BYPASS_IMPORT_ALIAS - - override fun getAllAdditionalFlags() = additionalDefinitionSearchFlags + additionalReferenceSearchFlags - - override fun includeSelfInGotoImplementation(element: PsiElement): Boolean = !(element is KtClass && element.isAbstract()) - - override fun getElementByReference(ref: PsiReference, flags: Int): PsiElement? { - if (ref is KtSimpleNameReference && ref.expression is KtLabelReferenceExpression) { - val refTarget = ref.resolve() as? KtExpression ?: return null - if (!BitUtil.isSet(flags, DO_NOT_UNWRAP_LABELED_EXPRESSION)) { - return refTarget.getLabeledParent(ref.expression.getReferencedName()) ?: refTarget - } - return refTarget - } - - if (!BitUtil.isSet(flags, BYPASS_IMPORT_ALIAS)) { - (ref.element as? KtSimpleNameExpression)?.mainReference?.getImportAlias()?.let { return it } - } - - // prefer destructing declaration entry to its target if element name is accepted - if (ref is KtDestructuringDeclarationReference && BitUtil.isSet(flags, TargetElementUtil.ELEMENT_NAME_ACCEPTED)) { - return ref.element - } - - val refExpression = ref.element as? KtSimpleNameExpression - val calleeExpression = refExpression?.getParentOfTypeAndBranch { calleeExpression } - if (calleeExpression != null) { - (ref.resolve() as? KtConstructor<*>)?.let { - return if (flags and JavaTargetElementEvaluator().additionalReferenceSearchFlags != 0) it else it.containingClassOrObject - } - } - - if (BitUtil.isSet(flags, TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED)) { - return findLambdaOpenLBraceForGeneratedIt(ref) - ?: findReceiverForThisInExtensionFunction(ref) - } - - return null - } - - override fun isIdentifierPart(file: PsiFile, text: CharSequence?, offset: Int): Boolean { - val elementAtCaret = file.findElementAt(offset) - - if (elementAtCaret?.node?.elementType == KtTokens.IDENTIFIER) return true - // '(' is considered identifier part if it belongs to primary constructor without 'constructor' keyword - return elementAtCaret?.getNonStrictParentOfType()?.textOffset == offset - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 deleted file mode 100644 index e4fcf5ffe4a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinSliceProvider.kt.201 +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.slicer - -import com.intellij.codeInsight.Nullability -import com.intellij.ide.util.treeView.AbstractTreeStructure -import com.intellij.openapi.actionSystem.DefaultActionGroup -import com.intellij.psi.PsiElement -import com.intellij.psi.util.parentOfType -import com.intellij.slicer.* -import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny -import org.jetbrains.kotlin.idea.references.KtReference -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.isPlainWithEscapes -import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf -import org.jetbrains.kotlin.psi2ir.deparenthesize -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode -import org.jetbrains.kotlin.types.TypeUtils -import org.jetbrains.kotlin.types.isError -import org.jetbrains.kotlin.types.isNullabilityFlexible - -class KotlinSliceProvider : SliceLanguageSupportProvider, SliceUsageTransformer { - companion object { - val LEAF_ELEMENT_EQUALITY = object : SliceLeafEquality() { - override fun substituteElement(element: PsiElement) = (element as? KtReference)?.resolve() ?: element - } - } - - class KotlinGroupByNullnessAction(treeBuilder: SliceTreeBuilder) : GroupByNullnessActionBase(treeBuilder) { - override fun isAvailable() = true - } - - val leafAnalyzer by lazy { SliceLeafAnalyzer(LEAF_ELEMENT_EQUALITY, this) } - - val nullnessAnalyzer: HackedSliceNullnessAnalyzerBase by lazy { - object : HackedSliceNullnessAnalyzerBase(LEAF_ELEMENT_EQUALITY, this) { - override fun checkNullability(element: PsiElement?): Nullability { - val types = when (element) { - is KtCallableDeclaration -> listOfNotNull((element.resolveToDescriptorIfAny() as? CallableDescriptor)?.returnType) - is KtDeclaration -> emptyList() - is KtExpression -> listOfNotNull(element.analyze(BodyResolveMode.PARTIAL).getType(element)) - else -> emptyList() - } - return when { - types.isEmpty() -> return Nullability.UNKNOWN - types.all { KotlinBuiltIns.isNullableNothing(it) } -> Nullability.NULLABLE - types.any { it.isError || TypeUtils.isNullableType(it) || it.isNullabilityFlexible() } -> Nullability.UNKNOWN - else -> Nullability.NOT_NULL - } - } - } - } - - override fun createRootUsage(element: PsiElement, params: SliceAnalysisParams) = KotlinSliceUsage(element, params) - - override fun transform(usage: SliceUsage): Collection? { - if (usage is KotlinSliceUsage) return null - return listOf(KotlinSliceUsage(usage.element, usage.parent, KotlinSliceAnalysisMode.Default, false)) - } - - override fun getExpressionAtCaret(atCaret: PsiElement, dataFlowToThis: Boolean): KtElement? { - val element = atCaret.parentsWithSelf - .filterIsInstance() - .firstOrNull(::isSliceElement) - ?.deparenthesize() ?: return null - - if (dataFlowToThis) { - if (element is KtConstantExpression) return null - if (element is KtStringTemplateExpression && element.isPlainWithEscapes()) return null - if (element is KtClassLiteralExpression) return null - if (element is KtCallableReferenceExpression) return null - } - - return element - } - - private fun isSliceElement(element: KtElement): Boolean { - return when { - element is KtProperty -> true - element is KtParameter -> true - element is KtDeclarationWithBody -> true - element is KtClass && !element.hasExplicitPrimaryConstructor() -> true - element is KtExpression && element !is KtDeclaration && element.parentOfType() == null -> true - element is KtTypeReference && element == (element.parent as? KtCallableDeclaration)?.receiverTypeReference -> true - else -> false - } - } - - override fun getElementForDescription(element: PsiElement): PsiElement { - return (element as? KtSimpleNameExpression)?.mainReference?.resolve() ?: element - } - - override fun getRenderer() = KotlinSliceUsageCellRenderer - - override fun startAnalyzeLeafValues(structure: AbstractTreeStructure, finalRunnable: Runnable) { - leafAnalyzer.startAnalyzeValues(structure, finalRunnable) - } - - override fun startAnalyzeNullness(structure: AbstractTreeStructure, finalRunnable: Runnable) { - nullnessAnalyzer.startAnalyzeNullness(structure, finalRunnable) - } - - override fun registerExtraPanelActions(group: DefaultActionGroup, builder: SliceTreeBuilder) { - if (builder.dataFlowToThis) { - group.add(GroupByLeavesAction(builder)) - group.add(KotlinGroupByNullnessAction(builder)) - } - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/startupCompat.kt b/idea/src/org/jetbrains/kotlin/idea/startup.kt similarity index 97% rename from idea/src/org/jetbrains/kotlin/idea/startupCompat.kt rename to idea/src/org/jetbrains/kotlin/idea/startup.kt index 391616ac93a..60d8f730955 100644 --- a/idea/src/org/jetbrains/kotlin/idea/startupCompat.kt +++ b/idea/src/org/jetbrains/kotlin/idea/startup.kt @@ -14,7 +14,6 @@ import com.intellij.psi.search.GlobalSearchScope import com.intellij.util.concurrency.AppExecutorUtil import java.util.concurrent.Callable -// FIX ME WHEN BUNCH 201 REMOVED fun runActivity(project: Project) { nonBlocking(Callable { diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt deleted file mode 100644 index 0a8095a4e69..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2018 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 - -// Remove the function, when there's no dependency to cidr during running Kotlin tests. -// FIX ME WHEN BUNCH as41 REMOVED -fun registerAdditionalResourceBundleInTests() { -} diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as41 deleted file mode 100644 index a445c3bf2a9..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as41 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2018 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. - */ - -@file:Suppress("DEPRECATION") - -package org.jetbrains.kotlin.idea - -import com.intellij.featureStatistics.FeatureStatisticsBundleEP -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.Extensions -import com.jetbrains.cidr.lang.OCBundle - -// Remove the function, when there's no dependency to cidr during running Kotlin tests. -fun registerAdditionalResourceBundleInTests() { - if (!ApplicationManager.getApplication().isUnitTestMode) { - return - } - - val extensionPoint = Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleEP.EP_NAME) - if (extensionPoint.extensions.none { it.qualifiedName == TestOCBundleProvider.qualifiedName }) { - extensionPoint.registerExtension(TestOCBundleProvider) - } -} - -object TestOCBundleProvider : FeatureStatisticsBundleEP() { - init { - qualifiedName = OCBundle.BUNDLE - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as42 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as42 deleted file mode 100644 index 2697b7a4e4a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as42 +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 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. - */ - -@file:Suppress("DEPRECATION") - -package org.jetbrains.kotlin.idea - -// Remove the function, when there's no dependency to cidr during running Kotlin tests. -fun registerAdditionalResourceBundleInTests() { -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as41 deleted file mode 100644 index dc9c96c6175..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as41 +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2010-2019 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.update - -import com.intellij.ide.plugins.IdeaPluginDescriptor -import com.intellij.ide.plugins.PluginManagerCore -import com.intellij.ide.plugins.PluginNode -import com.intellij.openapi.diagnostic.Logger -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.util.isDev -import org.jetbrains.kotlin.idea.util.isEap -import java.io.IOException -import java.net.URL -import java.util.* -import javax.xml.bind.JAXBContext -import javax.xml.bind.JAXBException -import javax.xml.bind.annotation.* - -class GooglePluginUpdateVerifier : PluginUpdateVerifier() { - override val verifierName: String - get() = KotlinBundle.message("update.name.android.studio") - - // Verifies if a plugin can be installed in Android Studio 3.2+. - // Currently used only by KotlinPluginUpdater. - override fun verify(pluginDescriptor: IdeaPluginDescriptor): PluginVerifyResult? { - if (pluginDescriptor.pluginId.idString != KOTLIN_PLUGIN_ID) { - return null - } - - val version = pluginDescriptor.version - if (isEap(version) || isDev(version)) { - return PluginVerifyResult.accept() - } - - try { - val url = URL(METADATA_FILE_URL) - val stream = url.openStream() - val context = JAXBContext.newInstance(PluginCompatibility::class.java) - val unmarshaller = context.createUnmarshaller() - val pluginCompatibility = unmarshaller.unmarshal(stream) as PluginCompatibility - - val release = getRelease(pluginCompatibility) - ?: return PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.no.verified.versions.for.this.build")) - - return if (release.plugins().any { KOTLIN_PLUGIN_ID == it.id && version == it.version }) - PluginVerifyResult.accept() - else - PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.version.to.be.verified")) - } catch (e: Exception) { - LOG.info("Exception when verifying plugin ${pluginDescriptor.pluginId.idString} version $version", e) - return when (e) { - is IOException -> - PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.unable.to.connect.to.compatibility.verification.repository")) - is JAXBException -> PluginVerifyResult.decline(KotlinBundle.message("update.reason.text.unable.to.parse.compatibility.verification.metadata")) - else -> PluginVerifyResult.decline( - KotlinBundle.message("update.reason.text.exception.during.verification", - e.message.toString() - ) - ) - } - } - } - - private fun getRelease(pluginCompatibility: PluginCompatibility): StudioRelease? { - for (studioRelease in pluginCompatibility.releases()) { - if (buildInRange(studioRelease.name, studioRelease.sinceBuild, studioRelease.untilBuild)) { - return studioRelease - } - } - return null - } - - private fun buildInRange(name: String?, sinceBuild: String?, untilBuild: String?): Boolean { - val descriptor = PluginNode() - descriptor.name = name - descriptor.sinceBuild = sinceBuild - descriptor.untilBuild = untilBuild - return PluginManagerCore.isCompatible(descriptor) - } - - companion object { - private const val KOTLIN_PLUGIN_ID = "org.jetbrains.kotlin" - private const val METADATA_FILE_URL = "https://dl.google.com/android/studio/plugins/compatibility.xml" - - private val LOG = Logger.getInstance(GooglePluginUpdateVerifier::class.java) - - private fun PluginCompatibility.releases() = studioRelease ?: emptyArray() - private fun StudioRelease.plugins() = ideaPlugin ?: emptyArray() - - @XmlRootElement(name = "plugin-compatibility") - @XmlAccessorType(XmlAccessType.FIELD) - class PluginCompatibility { - @XmlElement(name = "studio-release") - var studioRelease: Array? = null - - override fun toString(): String { - return "PluginCompatibility(studioRelease=${Arrays.toString(studioRelease)})" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class StudioRelease { - @XmlAttribute(name = "until-build") - var untilBuild: String? = null - @XmlAttribute(name = "since-build") - var sinceBuild: String? = null - @XmlAttribute - var name: String? = null - @XmlAttribute - var channel: String? = null - - @XmlElement(name = "idea-plugin") - var ideaPlugin: Array? = null - - override fun toString(): String { - return "StudioRelease(" + - "untilBuild=$untilBuild, name=$name, ideaPlugin=${Arrays.toString(ideaPlugin)}, " + - "sinceBuild=$sinceBuild, channel=$channel" + - ")" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class IdeaPlugin { - @XmlAttribute - var id: String? = null - @XmlAttribute - var sha256: String? = null - @XmlAttribute - var channel: String? = null - @XmlAttribute - var version: String? = null - - @XmlElement(name = "idea-version") - var ideaVersion: IdeaVersion? = null - - override fun toString(): String { - return "IdeaPlugin(id=$id, sha256=$sha256, ideaVersion=$ideaVersion, channel=$channel, version=$version)" - } - } - - @XmlAccessorType(XmlAccessType.FIELD) - class IdeaVersion { - @XmlAttribute(name = "until-build") - var untilBuild: String? = null - @XmlAttribute(name = "since-build") - var sinceBuild: String? = null - - override fun toString(): String { - return "IdeaVersion(untilBuild=$untilBuild, sinceBuild=$sinceBuild)" - } - } - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as41 b/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as41 deleted file mode 100644 index 8ee62b0a17c..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as41 +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2010-2018 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.update - -import com.intellij.ide.plugins.IdeaPluginDescriptor -import com.intellij.openapi.util.registry.Registry -import org.jetbrains.kotlin.idea.PluginUpdateStatus - -// Do an additional verification with PluginUpdateVerifier. Enabled only in AS 3.2+ -fun verify(updateStatus: PluginUpdateStatus.Update): PluginUpdateStatus { - @Suppress("InvalidBundleOrProperty") - val pluginVerifierEnabled = Registry.`is`("kotlin.plugin.update.verifier.enabled", true) - if (!pluginVerifierEnabled) { - return updateStatus - } - - val pluginDescriptor: IdeaPluginDescriptor = updateStatus.pluginDescriptor - val pluginVerifiers = PluginUpdateVerifier.EP_NAME.extensions - - for (pluginVerifier in pluginVerifiers) { - val verifyResult = pluginVerifier.verify(pluginDescriptor) ?: continue - if (!verifyResult.verified) { - return PluginUpdateStatus.Unverified( - pluginVerifier.verifierName, - verifyResult.declineMessage, - updateStatus - ) - } - } - - return updateStatus -} \ No newline at end of file diff --git a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as41 b/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as41 deleted file mode 100644 index 916ff6fe794..00000000000 --- a/idea/testData/gradle/testRunConfigurations/kotlinJUnitSettings/src/test/kotlin/MyKotlinTest.kt.as41 +++ /dev/null @@ -1,7 +0,0 @@ -import org.junit.Test - -class MyKotlinTest { - @Test - fun testA() { - } -} \ No newline at end of file diff --git a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as41 b/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as41 deleted file mode 100644 index e5ec5c75062..00000000000 --- a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.as41 +++ /dev/null @@ -1,11 +0,0 @@ -import org.junit.Test - -class MyKotlinTest { - @Test - fun testA() { - } - - @Test - fun testB() { - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 deleted file mode 100644 index 7d4eed9812d..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index bf76052dcb8..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddImplicitPrimaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 deleted file mode 100644 index 7d4eed9812d..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index bf76052dcb8..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddPrimaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 deleted file mode 100644 index 7d4eed9812d..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index bf76052dcb8..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkAddSecondaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'K'" "true" - -public class J { - void foo() { - new K(1); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 deleted file mode 100644 index 5ce3da92778..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" - -public class J { - void foo() { - new K(1, "2"); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index 5ce3da92778..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkChangePrimaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" - -public class J { - void foo() { - new K(1, "2"); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 deleted file mode 100644 index 5ce3da92778..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" - -public class J { - void foo() { - new K(1, "2"); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index 5ce3da92778..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkChangeSecondaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Change 2nd parameter of method 'K' from 'boolean' to 'String'" "true" - -public class J { - void foo() { - new K(1, "2"); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 deleted file mode 100644 index aeb5b60e0c7..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'Foo'" "true" - -public class J { - void test() { - new Foo(1, 2); - } -} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 deleted file mode 100644 index aeb5b60e0c7..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter1.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 1st parameter to method 'Foo'" "true" - -public class J { - void test() { - new Foo(1, 2); - } -} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 deleted file mode 100644 index 74eb5b27f38..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 2nd parameter to method 'Foo'" "true" - -public class J { - void test() { - new Foo(1, 2); - } -} diff --git a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 deleted file mode 100644 index 74eb5b27f38..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkKeepValOnAddingParameter2.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Add 'int' as 2nd parameter to method 'Foo'" "true" - -public class J { - void test() { - new Foo(1, 2); - } -} diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 deleted file mode 100644 index da2e824b7dd..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Remove 1st parameter from method 'K'" "true" - -public class J { - void foo() { - new K(); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index da2e824b7dd..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkRemovePrimaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Remove 1st parameter from method 'K'" "true" - -public class J { - void foo() { - new K(); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 deleted file mode 100644 index da2e824b7dd..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.after.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Remove 1st parameter from method 'K'" "true" - -public class J { - void foo() { - new K(); - } -} \ No newline at end of file diff --git a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 b/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 deleted file mode 100644 index da2e824b7dd..00000000000 --- a/idea/testData/quickfix/changeSignature/jk/jkRemoveSecondaryConstructorParameter.before.Main.java.201 +++ /dev/null @@ -1,7 +0,0 @@ -// "Remove 1st parameter from method 'K'" "true" - -public class J { - void foo() { - new K(); - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/CustomUsageSearcherTest.kt b/idea/tests/org/jetbrains/kotlin/findUsages/CustomUsageSearcherTest.kt index 6c8974ceb03..ed9ee38f25d 100644 --- a/idea/tests/org/jetbrains/kotlin/findUsages/CustomUsageSearcherTest.kt +++ b/idea/tests/org/jetbrains/kotlin/findUsages/CustomUsageSearcherTest.kt @@ -11,6 +11,7 @@ import com.intellij.psi.PsiElement import com.intellij.usageView.UsageInfo import com.intellij.usages.Usage import com.intellij.usages.UsageInfo2UsageAdapter +import com.intellij.util.Processor import org.jetbrains.kotlin.idea.KotlinFileType import org.jetbrains.kotlin.idea.maskExtensions import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase @@ -23,7 +24,11 @@ class CustomUsageSearcherTest : KotlinLightCodeInsightFixtureTestCaseBase() { fun testAddCustomUsagesForKotlin() { val customUsageSearcher = object : CustomUsageSearcher() { - override fun processElementUsages(element: PsiElement, processor: ProcessorInCompat, options: FindUsagesOptions) { + override fun processElementUsages( + element: PsiElement, + processor: Processor, + options: FindUsagesOptions + ) { runReadAction { processor.process(UsageInfo2UsageAdapter(UsageInfo(element))) } } } diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt b/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt deleted file mode 100644 index af83951f5ef..00000000000 --- a/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt +++ /dev/null @@ -1,11 +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.findUsages - -import com.intellij.util.Processor - -// FIX ME WHEN BUNCH 201 REMOVED -typealias ProcessorInCompat = Processor \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 deleted file mode 100644 index 658aedc5efd..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTest.kt.201 +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2010-2019 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.codeInsight - -import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl -import com.intellij.openapi.editor.Document -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiDocumentManager -import com.intellij.rt.execution.junit.FileComparisonFailure -import com.intellij.testFramework.ExpectedHighlightingData -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.PlatformTestUtil -import com.intellij.testFramework.UsefulTestCase -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.highlighter.markers.TestableLineMarkerNavigator -import org.jetbrains.kotlin.idea.navigation.NavigationTestUtils -import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.TagsTestDataUtil -import org.jetbrains.kotlin.test.util.renderAsGotoImplementation -import org.junit.Assert -import java.io.File - -abstract class AbstractLineMarkersTest : KotlinLightCodeInsightFixtureTestCase() { - - override fun getProjectDescriptor(): LightProjectDescriptor { - return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - } - - fun doTest(path: String) = doTest(path) {} - - protected fun doAndCheckHighlighting( - project: Project, - documentToAnalyze: Document, - expectedHighlighting: ExpectedHighlightingData, - expectedFile: File - ): List> { - myFixture.doHighlighting() - - return checkHighlighting(project, documentToAnalyze, expectedHighlighting, expectedFile) - } - - fun doTest(path: String, additionalCheck: () -> Unit) { - val fileText = FileUtil.loadFile(testDataFile()) - try { - ConfigLibraryUtil.configureLibrariesByDirective(myFixture.module, PlatformTestUtil.getCommunityPath(), fileText) - if (InTextDirectivesUtils.findStringWithPrefixes(fileText, "METHOD_SEPARATORS") != null) { - DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = true - } - - myFixture.configureByFile(fileName()) - val project = myFixture.project - val document = myFixture.editor.document - - val data = ExpectedHighlightingData(document, false, false, false, myFixture.file) - data.init() - - PsiDocumentManager.getInstance(project).commitAllDocuments() - - val markers = doAndCheckHighlighting(myFixture.project, document, data, testDataFile()) - - assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers) - additionalCheck() - } catch (exc: Exception) { - throw RuntimeException(exc) - } finally { - ConfigLibraryUtil.unconfigureLibrariesByDirective(module, fileText) - DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS = false - } - - } - - companion object { - - @Suppress("SpellCheckingInspection") - private const val LINE_MARKER_PREFIX = "LINEMARKER:" - private const val TARGETS_PREFIX = "TARGETS" - - fun assertNavigationElements(project: Project, file: KtFile, markers: List>) { - val navigationDataComments = KotlinTestUtils.getLastCommentsInFile( - file, KotlinTestUtils.CommentType.BLOCK_COMMENT, false - ) - if (navigationDataComments.isEmpty()) return - - for ((navigationCommentIndex, navigationComment) in navigationDataComments.reversed().withIndex()) { - val description = getLineMarkerDescription(navigationComment) - val navigateMarkers = markers.filter { it.lineMarkerTooltip?.startsWith(description) == true } - val navigateMarker = navigateMarkers.singleOrNull() ?: navigateMarkers.getOrNull(navigationCommentIndex) - - TestCase.assertNotNull( - String.format("Can't find marker for navigation check with description \"%s\"", description), - navigateMarker - ) - - val handler = navigateMarker!!.navigationHandler - if (handler is TestableLineMarkerNavigator) { - val navigateElements = handler.getTargetsPopupDescriptor(navigateMarker.element)?.targets?.sortedBy { - it.renderAsGotoImplementation() - } - val actualNavigationData = NavigationTestUtils.getNavigateElementsText(project, navigateElements) - - UsefulTestCase.assertSameLines(getExpectedNavigationText(navigationComment), actualNavigationData) - } else { - Assert.fail("Only TestableLineMarkerNavigator are supported in navigate check") - } - } - } - - private fun getLineMarkerDescription(navigationComment: String): String { - val firstLineEnd = navigationComment.indexOf("\n") - TestCase.assertTrue( - "The first line in block comment must contain description of marker for navigation check", firstLineEnd != -1 - ) - - var navigationMarkerText = navigationComment.substring(0, firstLineEnd) - - TestCase.assertTrue( - String.format("Add %s directive in first line of comment", LINE_MARKER_PREFIX), - navigationMarkerText.startsWith(LINE_MARKER_PREFIX) - ) - - navigationMarkerText = navigationMarkerText.substring(LINE_MARKER_PREFIX.length) - - return navigationMarkerText.trim { it <= ' ' } - } - - private fun getExpectedNavigationText(navigationComment: String): String { - val firstLineEnd = navigationComment.indexOf("\n") - - var expectedNavigationText = navigationComment.substring(firstLineEnd + 1) - - TestCase.assertTrue( - String.format("Marker %s is expected before navigation data", TARGETS_PREFIX), - expectedNavigationText.startsWith(TARGETS_PREFIX) - ) - - expectedNavigationText = expectedNavigationText.substring(expectedNavigationText.indexOf("\n") + 1) - - return expectedNavigationText - } - - fun checkHighlighting( - project: Project, - documentToAnalyze: Document, - expectedHighlighting: ExpectedHighlightingData, - expectedFile: File - ): MutableList> { - val markers = DaemonCodeAnalyzerImpl.getLineMarkers(documentToAnalyze, project) - - try { - expectedHighlighting.checkLineMarkers(markers, documentToAnalyze.text) - - // This is a workaround for sad bug in ExpectedHighlightingData: - // the latter doesn't throw assertion error when some line markers are expected, but none are present. - if (FileUtil.loadFile(expectedFile).contains("".toRegex(), "") - val cleanFile = libraryClean.resolve(file.relativeTo(libraryOriginal).path) - cleanFile.createFile() - cleanFile.write(text) - } - this.libraryClean = File(libraryCleanPath) - } - return object : SdkAndMockLibraryProjectDescriptor(getLibraryCleanPath(), false) { - override fun configureModule(module: Module, model: ModifiableRootModel) { - super.configureModule(module, model) - - val library = model.moduleLibraryTable.getLibraryByName(LIBRARY_NAME)!! - val modifiableModel = library.modifiableModel - - modifiableModel.addRoot(LocalFileSystem.getInstance().findFileByIoFile(libraryClean!!)!!, OrderRootType.SOURCES) - modifiableModel.commit() - } - } - } - - fun doTestWithLibrary(path: String) { - doTest(path) { - val fileSystem = VirtualFileManager.getInstance().getFileSystem("file") - val libraryOriginal = File(getLibraryOriginalPath()) - val project = myFixture.project - for (file in libraryOriginal.walkTopDown().filter { !it.isDirectory }) { - myFixture.openFileInEditor(fileSystem.findFileByPath(file.absolutePath)!!) - val data = ExpectedHighlightingData( - myFixture.editor.document, false, false, false, myFixture.file - ) - data.init() - - val librarySourceFile = libraryClean!!.resolve(file.relativeTo(libraryOriginal).path) - myFixture.openFileInEditor(fileSystem.findFileByPath(librarySourceFile.absolutePath)!!) - val document = myFixture.editor.document - PsiDocumentManager.getInstance(project).commitAllDocuments() - - if (!ProjectRootsUtil.isLibrarySourceFile(project, myFixture.file.virtualFile)) { - throw AssertionError("File ${myFixture.file.virtualFile.path} should be in library sources!") - } - - doAndCheckHighlighting(myFixture.project, document, data, file) - } - } - } - - override fun tearDown() { - libraryClean?.deleteRecursively() - ConfigLibraryUtil.removeLibrary(module, SdkAndMockLibraryProjectDescriptor.LIBRARY_NAME) - - super.tearDown() - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt index 8b029f4b1a7..90ee3769035 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.test.InTextDirectivesUtils -//BUNCH 201 + abstract class AbstractRenderingKDocTest : KotlinLightCodeInsightFixtureTestCase() { override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 deleted file mode 100644 index 7c2314647a2..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinInTempDirTest.kt.201 +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2019 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.configuration - -import com.intellij.openapi.util.io.FileUtil -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.junit.Assert -import java.io.File -import java.nio.file.Path - -abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() { - override fun getProjectDirOrFile(): Path { - val tempDir = FileUtil.generateRandomTemporaryPath() - FileUtil.createTempDirectory("temp", null) - myFilesToDelete.add(tempDir) - - FileUtil.copyDir(File(projectRoot), tempDir) - - val kotlinRuntime = File(tempDir, "lib/kotlin-stdlib.jar") - if (getTestName(true).toLowerCase().contains("latestruntime") && kotlinRuntime.exists()) { - ForTestCompileRuntime.runtimeJarForTests().copyTo(kotlinRuntime, overwrite = true) - } - - val projectRoot = tempDir.path - - val projectFilePath = projectRoot + "/projectFile.ipr" - if (!File(projectFilePath).exists()) { - val dotIdeaPath = projectRoot + "/.idea" - Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists()) - return File(projectRoot).toPath() - } - - return File(projectFilePath).toPath() - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 deleted file mode 100644 index ea5d0592859..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.201 +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright 2010-2019 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.configuration - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.PathMacros -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.ex.ProjectManagerEx -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ProjectRootManager -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.util.io.FileUtilRt -import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess -import com.intellij.testFramework.PlatformTestCase -import com.intellij.testFramework.UsefulTestCase -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState -import org.jetbrains.kotlin.idea.framework.KotlinSdkType -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase.* -import org.jetbrains.kotlin.test.WithMutedInDatabaseRunTest -import org.jetbrains.kotlin.test.runTest -import org.jetbrains.kotlin.test.util.KtTestUtil -import org.jetbrains.kotlin.utils.PathUtil -import java.io.File -import java.nio.file.Path - -@WithMutedInDatabaseRunTest -abstract class AbstractConfigureKotlinTest : PlatformTestCase() { - override fun setUp() { - super.setUp() - - VfsRootAccess.allowRootAccess(KtTestUtil.getHomeDirectory()) - } - - @Throws(Exception::class) - override fun tearDown() { - VfsRootAccess.disallowRootAccess(KtTestUtil.getHomeDirectory()) - PathMacros.getInstance().removeMacro(TEMP_DIR_MACRO_KEY) - - super.tearDown() - } - - @Throws(Exception::class) - override fun initApplication() { - super.initApplication() - - KotlinSdkType.setUpIfNeeded(testRootDisposable) - - ApplicationManager.getApplication().runWriteAction { - addJdk(testRootDisposable, ::mockJdk6) - addJdk(testRootDisposable, ::mockJdk8) - addJdk(testRootDisposable, ::mockJdk9) - } - - val tempLibDir = FileUtil.createTempDirectory("temp", null) - PathMacros.getInstance().setMacro(TEMP_DIR_MACRO_KEY, FileUtilRt.toSystemDependentName(tempLibDir.absolutePath)) - } - - protected fun doTestConfigureModulesWithNonDefaultSetup(configurator: KotlinWithLibraryConfigurator) { - assertNoFilesInDefaultPaths() - - val modules = modules - for (module in modules) { - assertNotConfigured(module, configurator) - } - - configurator.configure(myProject, emptyList()) - - assertNoFilesInDefaultPaths() - - for (module in modules) { - assertProperlyConfigured(module, configurator) - } - } - - protected fun doTestOneJavaModule(jarState: FileState) { - doTestOneModule(jarState, JAVA_CONFIGURATOR) - } - - protected fun doTestOneJsModule(jarState: FileState) { - doTestOneModule(jarState, JS_CONFIGURATOR) - } - - private fun doTestOneModule(jarState: FileState, configurator: KotlinWithLibraryConfigurator) { - val module = module - - assertNotConfigured(module, configurator) - configure(module, jarState, configurator) - assertProperlyConfigured(module, configurator) - } - - override fun getModule(): Module { - val modules = ModuleManager.getInstance(myProject).modules - assert(modules.size == 1) { "One module should be loaded " + modules.size } - myModule = modules[0] - return super.getModule() - } - - val modules: Array - get() = ModuleManager.getInstance(myProject).modules - - override fun getProjectDirOrFile(): Path { - val projectFilePath = "$projectRoot/projectFile.ipr" - val file = File(projectFilePath).absoluteFile - TestCase.assertTrue("Project file should exists $projectFilePath", file.exists()) - return file.toPath() - } - - override fun doCreateProject(projectFile: Path): Project { - return (ProjectManagerEx.getInstanceEx()).loadProject(projectFile) - } - - private val projectName: String - get() { - val testName = getTestName(true) - return if (testName.contains("_")) { - testName.substring(0, testName.indexOf("_")) - } else - testName - } - - protected val projectRoot: String - get() = BASE_PATH + projectName - - override fun setUpModule() {} - - private fun assertNoFilesInDefaultPaths() { - UsefulTestCase.assertDoesntExist(File(JAVA_CONFIGURATOR.getDefaultPathToJarFile(project))) - UsefulTestCase.assertDoesntExist(File(JS_CONFIGURATOR.getDefaultPathToJarFile(project))) - } - - override fun runTest() { - return runTest { super.runTest() } - } - - companion object { - private val BASE_PATH = "idea/testData/configuration/" - private val TEMP_DIR_MACRO_KEY = "TEMP_TEST_DIR" - protected val JAVA_CONFIGURATOR: KotlinJavaModuleConfigurator by lazy { - object : KotlinJavaModuleConfigurator() { - override fun getDefaultPathToJarFile(project: Project) = getPathRelativeToTemp("default_jvm_lib") - } - } - - protected val JS_CONFIGURATOR: KotlinJsModuleConfigurator by lazy { - object : KotlinJsModuleConfigurator() { - override fun getDefaultPathToJarFile(project: Project) = getPathRelativeToTemp("default_js_lib") - } - } - - private fun configure( - modules: List, - runtimeState: FileState, - configurator: KotlinWithLibraryConfigurator, - jarFromDist: String, - jarFromTemp: String - ) { - val project = modules.first().project - val collector = createConfigureKotlinNotificationCollector(project) - - val pathToJar = getPathToJar(runtimeState, jarFromDist, jarFromTemp) - for (module in modules) { - configurator.configureModule(module, pathToJar, pathToJar, collector, runtimeState) - } - collector.showNotification() - } - - private fun getPathToJar(runtimeState: FileState, jarFromDist: String, jarFromTemp: String) = when (runtimeState) { - FileState.EXISTS -> jarFromDist - FileState.COPY -> jarFromTemp - FileState.DO_NOT_COPY -> jarFromDist - } - - - private val pathToExistentRuntimeJar: String - get() = PathUtil.kotlinPathsForDistDirectory.stdlibPath.parent - - private val pathToExistentJsJar: String - get() = PathUtil.kotlinPathsForDistDirectory.jsStdLibJarPath.parent - - protected fun assertNotConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - TestCase.assertFalse( - String.format("Module %s should not be configured as %s Module", module.name, configurator.presentableText), - configurator.isConfigured(module) - ) - } - - protected fun assertConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - TestCase.assertTrue( - String.format( - "Module %s should be configured with configurator '%s'", module.name, - configurator.presentableText - ), - configurator.isConfigured(module) - ) - } - - protected fun assertProperlyConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - assertConfigured(module, configurator) - assertNotConfigured(module, getOppositeConfigurator(configurator)) - } - - private fun getOppositeConfigurator(configurator: KotlinWithLibraryConfigurator): KotlinWithLibraryConfigurator { - if (configurator === JAVA_CONFIGURATOR) return JS_CONFIGURATOR - if (configurator === JS_CONFIGURATOR) return JAVA_CONFIGURATOR - - throw IllegalArgumentException("Only JS_CONFIGURATOR and JAVA_CONFIGURATOR are supported") - } - - private fun getPathRelativeToTemp(relativePath: String): String { - val tempPath = PathMacros.getInstance().getValue(TEMP_DIR_MACRO_KEY) - return tempPath + '/' + relativePath - } - } - - protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) { - if (configurator is KotlinJavaModuleConfigurator) { - configure( - listOf(module), jarState, - configurator as KotlinWithLibraryConfigurator, - pathToExistentRuntimeJar, pathToNonexistentRuntimeJar - ) - } - if (configurator is KotlinJsModuleConfigurator) { - configure( - listOf(module), jarState, - configurator as KotlinWithLibraryConfigurator, - pathToExistentJsJar, pathToNonexistentJsJar - ) - } - } - - private val pathToNonexistentRuntimeJar: String - get() { - val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) - return pathToTempKotlinRuntimeJar - } - - private val pathToNonexistentJsJar: String - get() { - val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME - myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) - return pathToTempKotlinRuntimeJar - } - - override fun getTestProjectJdk(): Sdk { - val projectRootManager = ProjectRootManager.getInstance(project) - return projectRootManager.projectSdk ?: throw IllegalStateException("SDK ${projectRootManager.projectSdkName} was not found") - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 deleted file mode 100644 index a7baabe6813..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/quickDoc/QuickDocInHierarchyTest.kt.201 +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010-2019 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.editor.quickDoc - -import com.intellij.codeInsight.CodeInsightTestCase -import com.intellij.ide.hierarchy.HierarchyBrowserBaseEx -import com.intellij.ide.hierarchy.LanguageTypeHierarchy -import com.intellij.ide.hierarchy.actions.BrowseHierarchyActionBase -import com.intellij.ide.hierarchy.type.TypeHierarchyNodeDescriptor -import com.intellij.ide.hierarchy.type.TypeHierarchyTreeStructure -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiElement -import com.intellij.testFramework.MapDataContext -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.KotlinDocumentationProvider -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.junit.runner.RunWith - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class QuickDocInHierarchyTest() : CodeInsightTestCase() { - override fun getTestDataPath(): String { - return PluginTestCaseBase.getTestDataPathBase() + "/kdoc/inTypeHierarchy/" - } - - fun testSimple() { - configureByFile(getTestName(true) + ".kt") - - val context = MapDataContext() - context.put(CommonDataKeys.PROJECT, project) - context.put(CommonDataKeys.EDITOR, editor) - - val provider = BrowseHierarchyActionBase.findProvider(LanguageTypeHierarchy.INSTANCE, file, file, context)!! - val hierarchyTreeStructure = TypeHierarchyTreeStructure( - project, - provider.getTarget(context) as PsiClass?, - HierarchyBrowserBaseEx.SCOPE_PROJECT - ) - val hierarchyNodeDescriptor = hierarchyTreeStructure.baseDescriptor as TypeHierarchyNodeDescriptor - val doc = KotlinDocumentationProvider().generateDoc(hierarchyNodeDescriptor.psiClass as PsiElement, null)!! - - TestCase.assertTrue("Invalid doc\n: $doc", doc.contains("Very special class")) - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 deleted file mode 100644 index af60955cc81..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/AbstractUsageHighlightingTest.kt.201 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2010-2019 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.highlighter - -import com.intellij.codeInsight.daemon.impl.HighlightInfo -import com.intellij.codeInsight.daemon.impl.HighlightInfoType -import com.intellij.codeInsight.highlighting.HighlightUsagesHandler -import com.intellij.openapi.editor.colors.EditorColors -import com.intellij.openapi.editor.colors.EditorColorsManager -import com.intellij.openapi.editor.markup.RangeHighlighter -import com.intellij.openapi.editor.markup.TextAttributes -import com.intellij.testFramework.ExpectedHighlightingData -import org.jetbrains.kotlin.idea.test.* - -abstract class AbstractUsageHighlightingTest : KotlinLightCodeInsightFixtureTestCase() { - companion object { - // Not standard to leave it in text after configureByFile and remove manually after collecting highlighting information - const val CARET_TAG = "~" - } - - protected fun doTest(unused: String) { - myFixture.configureByFile(fileName()) - val document = myFixture.editor.document - val data = ExpectedHighlightingData(document, false, false, true, false, myFixture.file) - data.init() - - val caret = document.extractMarkerOffset(project, CARET_TAG) - assert(caret != -1) { "Caret marker '$CARET_TAG' expected" } - editor.caretModel.moveToOffset(caret) - - HighlightUsagesHandler.invoke(project, editor, myFixture.file) - val highlighters = myFixture.editor.markupModel.allHighlighters - - val infos = highlighters - .filter { isUsageHighlighting(it) } - .map { highlighter -> - var startOffset = highlighter.startOffset - var endOffset = highlighter.endOffset - - if (startOffset > caret) startOffset += CARET_TAG.length - if (endOffset > caret) endOffset += CARET_TAG.length - - HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION) - .range(startOffset, endOffset) - .create() - } - - data.checkResult(infos, StringBuilder(document.text).insert(caret, CARET_TAG).toString()) - } - - private fun isUsageHighlighting(info: RangeHighlighter): Boolean { - val globalScheme = EditorColorsManager.getInstance().globalScheme - - val readAttributes: TextAttributes = - globalScheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES) - val writeAttributes: TextAttributes = - globalScheme.getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES) - - return info.textAttributes == readAttributes || info.textAttributes == writeAttributes - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 deleted file mode 100644 index 27f4b2a6db9..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/inspections/InspectionDescriptionTest.kt.201 +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2010-2019 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.inspections - -import com.intellij.codeInspection.InspectionEP -import com.intellij.codeInspection.InspectionProfileEntry -import com.intellij.codeInspection.LocalInspectionEP -import com.intellij.codeInspection.LocalInspectionTool -import com.intellij.codeInspection.ex.InspectionToolRegistrar -import com.intellij.codeInspection.ex.InspectionToolWrapper -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.util.text.StringUtil -import com.intellij.testFramework.LightPlatformTestCase -import com.intellij.testFramework.UsefulTestCase -import gnu.trove.THashMap -import org.jetbrains.kotlin.idea.KotlinPluginUtil -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.junit.runner.RunWith - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class InspectionDescriptionTest : LightPlatformTestCase() { - - fun testDescriptionsAndShortNames() { - val shortNames = THashMap>() - - val inspectionTools = loadKotlinInspections() - val errors = StringBuilder() - for (toolWrapper in inspectionTools) { - val description = toolWrapper.loadDescription() - - if (description == null) { - errors.append("description is null for inspection '").append(desc(toolWrapper)) - } - - val shortName = toolWrapper.shortName - val tool = shortNames[shortName] - if (tool != null) { - errors.append( - "Short names must be unique: " + shortName + "\n" + - "inspection: '" + desc(tool) + "\n" + - " and '" + desc(toolWrapper) - ) - } - shortNames.put(shortName, toolWrapper) - } - - UsefulTestCase.assertEmpty(errors.toString()) - } - - private fun loadKotlinInspections(): List> { - return InspectionToolRegistrar.getInstance().createTools().filter { - it.extension.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID - } - } - - private fun loadKotlinInspectionExtensions() = - LocalInspectionEP.LOCAL_INSPECTION.extensions.filter { - it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID - } - - private fun desc(tool: InspectionToolWrapper): String { - return tool.toString() + " ('" + tool.descriptionContextClass + "') " + - "in " + if (tool.extension == null) null else tool.extension.pluginDescriptor - } - - fun testExtensionPoints() { - val shortNames = THashMap() - - @Suppress("DEPRECATION") - val inspectionEPs = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION) - - val tools = inspectionEPs.size - val errors = StringBuilder() - for (ep in inspectionEPs) { - val shortName = ep.getShortName() - val ep1 = shortNames[shortName] - if (ep1 != null) { - errors.append( - "Short names must be unique: '" + shortName + "':\n" + - "inspection: '" + ep1.implementationClass + "' in '" + ep1.pluginDescriptor + "'\n" + - "; and '" + ep.implementationClass + "' in '" + ep.pluginDescriptor + "'" - ) - } - shortNames.put(shortName, ep) - } - println("$tools inspection tools total via EP") - - UsefulTestCase.assertEmpty(errors.toString()) - } - - fun testInspectionMappings() { - val toolWrappers = loadKotlinInspections() - val errors = StringBuilder() - toolWrappers.filter({ toolWrapper -> toolWrapper.extension == null }).forEach { toolWrapper -> - errors.append("Please add XML mapping for ").append(toolWrapper.tool::class.java) - } - - UsefulTestCase.assertEmpty(errors.toString()) - } - - fun testMismatchedIds() { - val failMessages = mutableListOf() - for (ep in loadKotlinInspectionExtensions()) { - val toolName = ep.implementationClass - val tool = ep.instantiateTool() - if (tool is LocalInspectionTool) { - checkValue(failMessages, toolName, "suppressId", ep.id, ep.getShortName(), tool.id) - checkValue(failMessages, toolName, "alternateId", ep.alternativeId, null, tool.alternativeID) - checkValue(failMessages, toolName, "shortName", ep.getShortName(), null, tool.shortName) - checkValue(failMessages, toolName, "runForWholeFile", null, "false", tool.runForWholeFile().toString()) - } - } - - UsefulTestCase.assertEmpty(StringUtil.join(failMessages, "\n"), failMessages) - } - - fun testNotEmptyToolNames() { - val failMessages = mutableListOf() - for (ep in LocalInspectionEP.LOCAL_INSPECTION.extensions) { - val toolName = ep.implementationClass - if (ep.getDisplayName().isNullOrEmpty()) { - failMessages.add(toolName + ": toolName is not set, tool won't be available in `run inspection` action") - } - } - UsefulTestCase.assertEmpty(failMessages.joinToString("\n"), failMessages) - } - - private fun checkValue( - failMessages: MutableCollection, - toolName: String, - attributeName: String, - xmlValue: String?, - defaultXmlValue: String?, - javaValue: String? - ) { - if (StringUtil.isNotEmpty(xmlValue)) { - if (javaValue != xmlValue) { - failMessages.add("$toolName: mismatched $attributeName. Xml: $xmlValue; Java: $javaValue") - } - } else if (StringUtil.isNotEmpty(javaValue)) { - if (javaValue != defaultXmlValue) { - failMessages.add("$toolName: $attributeName overridden in wrong way, will work in tests only. Please set appropriate $attributeName value in XML ($javaValue)") - } - } - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 deleted file mode 100644 index 2d8d8c3cbbc..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionDescriptionTest.kt.201 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2010-2019 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.intentions - -import com.intellij.codeInsight.intention.IntentionActionBean -import com.intellij.codeInsight.intention.IntentionManager -import com.intellij.openapi.extensions.Extensions -import com.intellij.testFramework.LightPlatformTestCase -import com.intellij.testFramework.UsefulTestCase -import org.jetbrains.kotlin.idea.KotlinPluginUtil -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.junit.runner.RunWith -import java.io.File - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class IntentionDescriptionTest : LightPlatformTestCase() { - - private val necessaryNormalNames = listOf("description.html", "before.kt.template", "after.kt.template") - private val necessaryXmlNames = listOf("description.html", "before.xml.template", "after.xml.template") - private val necessaryMavenNames = listOf("description.html") - - fun testDescriptionsAndShortNames() { - val intentionTools = loadKotlinIntentions() - val errors = StringBuilder() - for (tool in intentionTools) { - val className = tool.className - val shortName = className.substringAfterLast(".").replace("$", "") - val directory = File("idea/resources-en/intentionDescriptions/$shortName") - if (!directory.exists() || !directory.isDirectory) { - if (tool.categories != null) { - errors.append("No description directory for intention '").append(className).append("'\n") - } - } else { - val necessaryNames = when { - shortName.isMavenIntentionName() -> necessaryMavenNames - shortName.isXmlIntentionName() -> necessaryXmlNames - else -> necessaryNormalNames - } - for (fileName in necessaryNames) { - val file = directory.resolve(fileName) - if (!file.exists() || !file.isFile) { - errors.append("No description file $fileName for intention '").append(className).append("'\n") - } - } - } - } - - UsefulTestCase.assertEmpty(errors.toString()) - } - - private fun String.isMavenIntentionName() = startsWith("MavenPlugin") - - private fun String.isXmlIntentionName() = startsWith("Add") && endsWith("ToManifest") - - private fun loadKotlinIntentions(): List { - val extensionPoint = Extensions.getRootArea().getExtensionPoint(IntentionManager.EP_INTENTION_ACTIONS) - return extensionPoint.extensions.toList().filter { - it.pluginDescriptor.pluginId == KotlinPluginUtil.KOTLIN_PLUGIN_ID - } - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/kdoc/KdocRenameTest.java b/idea/tests/org/jetbrains/kotlin/idea/kdoc/KdocRenameTest.java index 0a218b6d08c..cb1c39b3ea6 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/kdoc/KdocRenameTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/kdoc/KdocRenameTest.java @@ -10,7 +10,6 @@ import com.intellij.psi.PsiElement; import com.intellij.refactoring.rename.RenameProcessor; import com.intellij.testFramework.LightCodeInsightTestCase; import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.idea.test.CompatKt; import org.jetbrains.kotlin.idea.test.PluginTestCaseBase; import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner; import org.junit.runner.RunWith; @@ -39,7 +38,6 @@ public class KdocRenameTest extends LightCodeInsightTestCase { @Override protected void setUp() throws Exception { super.setUp(); - CompatKt.runPostStartupActivitiesOnce(getProject()); } private void doTest(String newName) { diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 deleted file mode 100644 index a4d3b083838..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigation/GotoCheck.kt.201 +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2010-2019 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.navigation - -import com.intellij.ide.util.gotoByName.FilteringGotoByModel -import com.intellij.lang.Language -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiElement -import com.intellij.testFramework.UsefulTestCase -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import org.jetbrains.kotlin.test.util.renderAsGotoImplementation -import org.junit.Assert -import kotlin.test.assertEquals -import kotlin.test.assertTrue - -object GotoCheck { - @JvmStatic - @JvmOverloads - fun checkGotoDirectives( - model: FilteringGotoByModel, - editor: Editor, - nonProjectSymbols: Boolean = false, - checkNavigation: Boolean = false - ) { - val documentText = editor.document.text - val searchTextList = InTextDirectivesUtils.findListWithPrefixes(documentText, "// SEARCH_TEXT:") - Assert.assertFalse( - "There's no search text in test data file given. Use '// SEARCH_TEXT:' directive", - searchTextList.isEmpty() - ) - - val expectedReferences = - InTextDirectivesUtils.findLinesWithPrefixesRemoved(documentText, "// REF:").map { input -> input.trim { it <= ' ' } } - val includeNonProjectSymbols = nonProjectSymbols || InTextDirectivesUtils.isDirectiveDefined(documentText, "// CHECK_BOX") - - val searchText = searchTextList.first() - - val foundSymbols = model.getNames(includeNonProjectSymbols).filter { it?.startsWith(searchText) ?: false }.flatMap { - model.getElementsByName(it, includeNonProjectSymbols, "$it*").toList() - } - - val inexactMatching = InTextDirectivesUtils.isDirectiveDefined(documentText, "// ALLOW_MORE_RESULTS") - val renderedSymbols = foundSymbols.map { (it as PsiElement).renderAsGotoImplementation() }.toSet() - - if (checkNavigation && (expectedReferences.size != 1 || inexactMatching)) { - error("Cannot check navigation targets when multiple references are expected") - } - - if (inexactMatching) { - UsefulTestCase.assertContainsElements(renderedSymbols, expectedReferences) - } else { - UsefulTestCase.assertOrderedEquals(renderedSymbols.sorted(), expectedReferences) - } - if (!checkNavigation) return - - assertTrue(foundSymbols.isNotEmpty()) - foundSymbols.forEach { - assertNavigationElementMatches(it as PsiElement, documentText) - } - } - - @JvmStatic - fun assertNavigationElementMatches(resolved: PsiElement, textWithDirectives: String) { - val expectedBinaryFile = InTextDirectivesUtils.findStringWithPrefixes(textWithDirectives, "// BINARY:") - val expectedSourceFile = InTextDirectivesUtils.findStringWithPrefixes(textWithDirectives, "// SRC:") - assertEquals(expectedBinaryFile, getFileWithDir(resolved)) - val srcElement = resolved.navigationElement - Assert.assertNotEquals(srcElement, resolved) - assertEquals(expectedSourceFile, getFileWithDir(srcElement)) - } - - // TODO: move somewhere - fun getFileWithDir(resolved: PsiElement): String { - val targetFile = resolved.containingFile - val targetDir = targetFile.parent - return targetDir!!.name + "/" + targetFile.name - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 deleted file mode 100644 index d27ea625de0..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.201 +++ /dev/null @@ -1,729 +0,0 @@ -/* - * Copyright 2010-2019 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.quickfix - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.lang.jvm.JvmClass -import com.intellij.lang.jvm.JvmElement -import com.intellij.lang.jvm.JvmModifier -import com.intellij.lang.jvm.actions.* -import com.intellij.lang.jvm.types.JvmSubstitutor -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Pair.pair -import com.intellij.psi.* -import com.intellij.testFramework.fixtures.CodeInsightTestFixture -import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase -import junit.framework.TestCase -import org.jetbrains.kotlin.asJava.toLightElements -import org.jetbrains.kotlin.idea.search.allScope -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.psi.KtModifierListOwner -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.jetbrains.uast.toUElement -import org.junit.Assert -import org.junit.runner.RunWith - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { - private class SimpleMethodRequest( - project: Project, - private val methodName: String, - private val modifiers: Collection = emptyList(), - private val returnType: ExpectedTypes = emptyList(), - private val annotations: Collection = emptyList(), - @Suppress("MissingRecentApi") parameters: List = emptyList(), - private val targetSubstitutor: JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY) - ) : CreateMethodRequest { - private val expectedParameters = parameters - - override fun getTargetSubstitutor(): JvmSubstitutor = targetSubstitutor - - override fun getModifiers() = modifiers - - override fun getMethodName() = methodName - - override fun getAnnotations() = annotations - - @Suppress("MissingRecentApi") - override fun getExpectedParameters(): List = expectedParameters - - override fun getReturnType() = returnType - - override fun isValid(): Boolean = true - - } - - override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK - - fun testMakeNotFinal() { - myFixture.configureByText( - "foo.kt", """ - class Foo { - fun bar(){} - } - """ - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.FINAL, false) - ).findWithText("Make 'bar' 'open'") - ) - myFixture.checkResult( - """ - class Foo { - open fun bar(){} - } - """ - ) - } - - fun testMakePrivate() { - myFixture.configureByText( - "foo.kt", """ - class Foo { - fun bar(){} - } - """ - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.PRIVATE, true) - ).findWithText("Make 'Foo' 'private'") - ) - myFixture.checkResult( - """ - private class Foo { - fun bar(){} - } - """ - ) - } - - fun testMakeNotPrivate() { - myFixture.configureByText( - "foo.kt", """ - private class Foo { - fun bar(){} - } - """.trim() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.PRIVATE, false) - ).findWithText("Remove 'private' modifier") - ) - myFixture.checkResult( - """ - class Foo { - fun bar(){} - } - """.trim(), true - ) - } - - fun testMakePrivatePublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | private fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'private' modifier") - ) - myFixture.checkResult( - """class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testMakeProtectedPublic() { - myFixture.configureByText( - "foo.kt", """open class Foo { - | protected fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'protected' modifier") - ) - myFixture.checkResult( - """open class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testMakeInternalPublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | internal fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'internal' modifier") - ) - myFixture.checkResult( - """class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testAddAnnotation() { - myFixture.configureByText( - "foo.kt", """class Foo { - | fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createAddAnnotationActions( - myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, - annotationRequest("kotlin.jvm.JvmName", stringAttribute("name", "foo")) - ).single() - ) - myFixture.checkResult( - """class Foo { - | @JvmName(name = "foo") - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testAddJavaAnnotationValue() { - - myFixture.addFileToProject( - "pkg/myannotation/JavaAnnotation.java", """ - package pkg.myannotation - - public @interface JavaAnnotation { - String value(); - int param() default 0; - } - """.trimIndent() - ) - - myFixture.configureByText( - "foo.kt", """class Foo { - | fun bar(){} - | fun baz(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createAddAnnotationActions( - myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, - annotationRequest("pkg.myannotation.JavaAnnotation", stringAttribute("value", "foo"), intAttribute("param", 2)) - ).single() - ) - myFixture.launchAction( - createAddAnnotationActions( - myFixture.findElementByText("baz", KtModifierListOwner::class.java).toLightElements().single() as PsiMethod, - annotationRequest("pkg.myannotation.JavaAnnotation", intAttribute("param", 2), stringAttribute("value", "foo")) - ).single() - ) - myFixture.checkResult( - """import pkg.myannotation.JavaAnnotation - | - |class Foo { - | @JavaAnnotation("foo", param = 2) - | fun bar(){} - | @JavaAnnotation(param = 2, value = "foo") - | fun baz(){} - |}""".trim().trimMargin(), true - ) - } - - - fun testAddJavaAnnotationOnFieldWithoutTarget() { - - myFixture.addFileToProject( - "pkg/myannotation/JavaAnnotation.java", """ - package pkg.myannotation - - import java.lang.annotation.ElementType; - import java.lang.annotation.Retention; - import java.lang.annotation.RetentionPolicy; - import java.lang.annotation.Target; - - //no @Target - @Retention(RetentionPolicy.RUNTIME) - public @interface JavaAnnotation { - String value(); - int param() default 0; - } - """.trimIndent() - ) - - myFixture.configureByText( - "foo.kt", """class Foo { - | val bar: String = null - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createAddAnnotationActions( - myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single { it is PsiField } as PsiField, - annotationRequest("pkg.myannotation.JavaAnnotation") - ).single() - ) - - myFixture.checkResult( - """ - import pkg.myannotation.JavaAnnotation - - class Foo { - @field:JavaAnnotation - val bar: String = null - } - """.trimIndent(), true - ) - - TestCase.assertEquals( - "KtUltraLightMethodForSourceDeclaration -> org.jetbrains.annotations.NotNull," + - " KtUltraLightFieldForSourceDeclaration -> pkg.myannotation.JavaAnnotation, org.jetbrains.annotations.NotNull", - annotationsString(myFixture.findElementByText("bar", KtModifierListOwner::class.java)) - ) - } - - - fun testAddJavaAnnotationOnField() { - - myFixture.addFileToProject( - "pkg/myannotation/JavaAnnotation.java", """ - package pkg.myannotation - - import java.lang.annotation.ElementType; - import java.lang.annotation.Retention; - import java.lang.annotation.RetentionPolicy; - import java.lang.annotation.Target; - - @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) - @Retention(RetentionPolicy.RUNTIME) - public @interface JavaAnnotation { - String value(); - int param() default 0; - } - """.trimIndent() - ) - - myFixture.configureByText( - "foo.kt", """class Foo { - | val bar: String = null - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createAddAnnotationActions( - myFixture.findElementByText("bar", KtModifierListOwner::class.java).toLightElements().single { it is PsiField } as PsiField, - annotationRequest("pkg.myannotation.JavaAnnotation") - ).single() - ) - - myFixture.checkResult( - """ - import pkg.myannotation.JavaAnnotation - - class Foo { - @JavaAnnotation - val bar: String = null - } - """.trimIndent(), true - ) - - TestCase.assertEquals( - "KtUltraLightMethodForSourceDeclaration -> org.jetbrains.annotations.NotNull," + - " KtUltraLightFieldForSourceDeclaration -> pkg.myannotation.JavaAnnotation, org.jetbrains.annotations.NotNull", - annotationsString(myFixture.findElementByText("bar", KtModifierListOwner::class.java)) - ) - } - - private fun annotationsString(findElementByText: KtModifierListOwner) = findElementByText.toLightElements() - .joinToString { elem -> - "${elem.javaClass.simpleName} -> ${(elem as PsiModifierListOwner).annotations.mapNotNull { it.qualifiedName }.joinToString()}" - } - - fun testDontMakePublicPublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | fun bar(){} - |}""".trim().trimMargin() - ) - - assertEmpty(createModifierActions(myFixture.atCaret(), TestModifierRequest(JvmModifier.PUBLIC, true))) - } - - fun testDontMakeFunInObjectsOpen() { - myFixture.configureByText( - "foo.kt", """ - object Foo { - fun bar(){} - } - """.trim() - ) - assertEmpty(createModifierActions(myFixture.atCaret(), TestModifierRequest(JvmModifier.FINAL, false))) - } - - fun testAddVoidVoidMethod() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - methodRequest(project, "baz", JvmModifier.PRIVATE, PsiType.VOID) - ).findWithText("Add method 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | fun bar() {} - | private fun baz() { - | - | } - |} - """.trim().trimMargin(), true - ) - } - - fun testAddIntIntMethod() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - SimpleMethodRequest( - project, - methodName = "baz", - modifiers = listOf(JvmModifier.PUBLIC), - returnType = expectedTypes(PsiType.INT), - parameters = expectedParams(PsiType.INT) - ) - ).findWithText("Add method 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | fun bar() {} - | fun baz(param0: Int): Int { - | TODO("Not yet implemented") - | } - |} - """.trim().trimMargin(), true - ) - } - - fun testAddIntPrimaryConstructor() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add primary constructor to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo(param0: Int) { - |} - """.trim().trimMargin(), true - ) - } - - fun testAddIntSecondaryConstructor() { - myFixture.configureByText( - "foo.kt", """ - |class Foo() { - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add secondary constructor to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo() { - | constructor(param0: Int) { - | - | } - |} - """.trim().trimMargin(), true - ) - } - - fun testChangePrimaryConstructorInt() { - myFixture.configureByText( - "foo.kt", """ - |class Foo() { - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add 'int' as 1st parameter to method 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo(param0: Int) { - |} - """.trim().trimMargin(), true - ) - } - - fun testRemoveConstructorParameters() { - myFixture.configureByText( - "foo.kt", """ - |class Foo(i: Int) { - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, emptyList()) - ).findWithText("Remove 1st parameter from method 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo() { - |} - """.trim().trimMargin(), true - ) - } - - fun testAddStringVarProperty() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - SimpleMethodRequest( - project, - methodName = "setBaz", - modifiers = listOf(JvmModifier.PUBLIC), - returnType = expectedTypes(), - parameters = expectedParams(PsiType.getTypeByName("java.lang.String", project, project.allScope())) - ) - ).findWithText("Add 'var' property 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | var baz: String = TODO("initialize me") - | - | fun bar() {} - |} - """.trim().trimMargin(), true - ) - } - - fun testAddLateInitStringVarProperty() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - SimpleMethodRequest( - project, - methodName = "setBaz", - modifiers = listOf(JvmModifier.PUBLIC), - returnType = expectedTypes(), - parameters = expectedParams(PsiType.getTypeByName("java.lang.String", project, project.allScope())) - ) - ).findWithText("Add 'lateinit var' property 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | lateinit var baz: String - | - | fun bar() {} - |} - """.trim().trimMargin(), true - ) - } - - fun testAddStringVarField() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - myFixture.launchAction( - createFieldActions( - myFixture.atCaret(), - FieldRequest(project, emptyList(), "java.util.Date", "baz") - ).findWithText("Add 'var' property 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |import java.util.Date - | - |class Foo { - | @JvmField - | var baz: Date = TODO("initialize me") - | - | fun bar() {} - |} - """.trim().trimMargin(), true - ) - } - - fun testAddLateInitStringVarField() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createFieldActions( - myFixture.atCaret(), - FieldRequest(project, listOf(JvmModifier.PRIVATE), "java.lang.String", "baz") - ).findWithText("Add 'lateinit var' property 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | private lateinit var baz: String - | - | fun bar() {} - |} - """.trim().trimMargin(), true - ) - } - - - private fun createFieldActions(atCaret: JvmClass, fieldRequest: CreateFieldRequest): List = - EP_NAME.extensions.flatMap { it.createAddFieldActions(atCaret, fieldRequest) } - - fun testAddStringValProperty() { - myFixture.configureByText( - "foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin() - ) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - SimpleMethodRequest( - project, - methodName = "getBaz", - modifiers = listOf(JvmModifier.PUBLIC), - returnType = expectedTypes(PsiType.getTypeByName("java.lang.String", project, project.allScope())), - parameters = expectedParams() - ) - ).findWithText("Add 'val' property 'baz' to 'Foo'") - ) - myFixture.checkResult( - """ - |class Foo { - | val baz: String = TODO("initialize me") - | - | fun bar() {} - |} - """.trim().trimMargin(), true - ) - } - - - private fun expectedTypes(vararg psiTypes: PsiType) = psiTypes.map { expectedType(it) } - - private fun expectedParams(vararg psyTypes: PsiType) = - psyTypes.mapIndexed { index, psiType -> expectedParameter(expectedTypes(psiType), "param$index") } - - class FieldRequest( - private val project: Project, - val modifiers: List, - val type: String, - val name: String - ) : CreateFieldRequest { - override fun getTargetSubstitutor(): JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY) - - override fun getModifiers(): Collection = modifiers - - override fun isConstant(): Boolean = false - - override fun getFieldType(): List = - expectedTypes(PsiType.getTypeByName(type, project, project.allScope())) - - override fun getFieldName(): String = name - - override fun isValid(): Boolean = true - } - -} - -internal inline fun CodeInsightTestFixture.atCaret() = elementAtCaret.toUElement() as T - -@Suppress("MissingRecentApi") -private class TestModifierRequest(private val _modifier: JvmModifier, private val shouldBePresent: Boolean) : ChangeModifierRequest { - override fun shouldBePresent(): Boolean = shouldBePresent - override fun isValid(): Boolean = true - override fun getModifier(): JvmModifier = _modifier -} - -@Suppress("CAST_NEVER_SUCCEEDS") -internal fun List.findWithText(text: String): IntentionAction = - this.firstOrNull { it.text == text } - ?: Assert.fail("intention with text '$text' was not found, only ${this.joinToString { "\"${it.text}\"" }} available") as Nothing - - - diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 deleted file mode 100644 index 94a1868b5d8..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/AbstractAdditionalResolveDescriptorRendererTest.kt.201 +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2010-2019 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.resolve - -import com.intellij.mock.MockProject -import com.intellij.pom.PomModel -import com.intellij.pom.core.impl.PomModelImpl -import com.intellij.pom.tree.TreeAspect -import org.jetbrains.kotlin.container.ComponentProvider -import org.jetbrains.kotlin.container.get -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener -import org.jetbrains.kotlin.idea.project.IdeaEnvironment -import org.jetbrains.kotlin.idea.project.ResolveElementCache -import org.jetbrains.kotlin.psi.KtAnonymousInitializer -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtPsiUtil -import org.jetbrains.kotlin.renderer.AbstractDescriptorRendererTest -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.TargetEnvironment -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode -import org.jetbrains.kotlin.resolve.lazy.ResolveSession -import org.picocontainer.MutablePicoContainer - -abstract class AbstractAdditionalResolveDescriptorRendererTest : AbstractDescriptorRendererTest() { - override fun setUp() { - super.setUp() - - val pomModelImpl = PomModelImpl(project) - val treeAspect = TreeAspect(pomModelImpl) - - val mockProject = project as MockProject - createAndRegisterKotlinCodeBlockModificationListener(mockProject, pomModelImpl, treeAspect) - } - - override fun tearDown() { - unregisterKotlinCodeBlockModificationListener(project as MockProject) - - super.tearDown() - } - - override fun getDescriptor(declaration: KtDeclaration, container: ComponentProvider): DeclarationDescriptor { - if (declaration is KtAnonymousInitializer || KtPsiUtil.isLocal(declaration)) { - return container.get() - .resolveToElements(listOf(declaration), BodyResolveMode.FULL) - .get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)!! - } - return container.get().resolveToDescriptor(declaration) - } - - override val targetEnvironment: TargetEnvironment - get() = IdeaEnvironment -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 deleted file mode 100644 index c579bd25f57..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/slicer/SlicerTestUtil.kt.201 +++ /dev/null @@ -1,135 +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.slicer - -import com.intellij.analysis.AnalysisScope -import com.intellij.ide.projectView.TreeStructureProvider -import com.intellij.ide.util.treeView.AbstractTreeStructureBase -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.slicer.DuplicateMap -import com.intellij.slicer.SliceAnalysisParams -import com.intellij.slicer.SliceNode -import com.intellij.slicer.SliceRootNode -import com.intellij.usages.TextChunk -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.psiUtil.contains -import org.jetbrains.kotlin.psi.psiUtil.startOffset -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.awt.Font - -internal class TestSliceTreeStructure(private val rootNode: SliceNode) : AbstractTreeStructureBase(rootNode.project) { - override fun getProviders() = emptyList() - - override fun getRootElement() = rootNode - - override fun commit() { - } - - override fun hasSomethingToCommit() = false -} - -internal fun buildTreeRepresentation(rootNode: SliceNode): String { - val project = rootNode.element!!.project!! - val projectScope = GlobalSearchScope.projectScope(project) - - fun TextChunk.render(): String { - var text = text - if (attributes.fontType == Font.BOLD) { - text = "$text" - } - return text - } - - fun SliceNode.isSliceLeafValueClassNode() = this is HackedSliceLeafValueClassNode - - fun process(node: SliceNode, indent: Int): String { - val usage = node.element!!.value - - node.calculateDupNode() - val isDuplicated = !node.isSliceLeafValueClassNode() && node.duplicate != null - - return buildString { - when { - node is SliceRootNode && usage.element is KtFile -> { - node.sortedChildren.forEach { append(process(it, indent)) } - return@buildString - } - - // SliceLeafValueClassNode is package-private - node.isSliceLeafValueClassNode() -> append("[${node.nodeText}]\n") - - else -> { - val chunks = usage.text - if (!projectScope.contains(usage.element)) { - append("LIB ") - } else { - append(chunks.first().render() + " ") - } - - repeat(indent) { append('\t') } - - if (usage is KotlinSliceDereferenceUsage) { - append("DEREFERENCE: ") - } - - if (usage is KotlinSliceUsage) { - usage.mode.inlineCallStack.forEach { - append("(INLINE CALL ${it.function?.name}) ") - } - usage.mode.behaviourStack.reversed().joinTo(this, separator = "") { it.testPresentationPrefix } - } - - if (isDuplicated) { - append("DUPLICATE: ") - } - - chunks.slice(1 until chunks.size).joinTo(this, separator = "") { it.render() } - - KotlinSliceUsageCellRenderer.containerSuffix(usage)?.let { - append(" ($it)") - } - - append("\n") - } - } - - if (!isDuplicated) { - node.sortedChildren.forEach { append(process(it, indent + 1)) } - } - }.replace(Regex(""), "") - } - - return process(rootNode, 0) -} - -private val SliceNode.sortedChildren: List - get() = children.sortedBy { it.value.element?.startOffset ?: -1 } - -internal fun testSliceFromOffset( - file: KtFile, - offset: Int, - doTest: (sliceProvider: KotlinSliceProvider, rootNode: SliceRootNode) -> Unit -) { - val fileText = file.text - val flowKind = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// FLOW: ") - val withDereferences = InTextDirectivesUtils.isDirectiveDefined(fileText, "// WITH_DEREFERENCES") - val analysisParams = SliceAnalysisParams().apply { - dataFlowToThis = when (flowKind) { - "IN" -> true - "OUT" -> false - else -> throw AssertionError("Invalid flow kind: $flowKind") - } - showInstanceDereferences = withDereferences - scope = AnalysisScope(file.project) - } - - val elementAtCaret = file.findElementAt(offset)!! - val sliceProvider = KotlinSliceProvider() - val expression = sliceProvider.getExpressionAtCaret(elementAtCaret, analysisParams.dataFlowToThis)!! - val rootUsage = sliceProvider.createRootUsage(expression, analysisParams) - val rootNode = SliceRootNode(file.project, DuplicateMap(), rootUsage) - doTest(sliceProvider, rootNode) -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 b/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 deleted file mode 100644 index 5948b82f5fb..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/stubs/AbstractMultiHighlightingTest.kt.201 +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010-2019 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.stubs - -import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl -import com.intellij.codeInsight.daemon.impl.HighlightInfo -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.project.DumbService -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.impl.cache.CacheManager -import com.intellij.psi.impl.source.tree.TreeElement -import com.intellij.psi.impl.source.tree.TreeUtil -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.search.UsageSearchContext -import com.intellij.testFramework.ExpectedHighlightingData - -abstract class AbstractMultiHighlightingTest : AbstractMultiModuleTest() { - - protected open val shouldCheckLineMarkers = false - - protected open val shouldCheckResult = true - - override fun checkHighlighting(data: ExpectedHighlightingData): Collection { - data.init() - PsiDocumentManager.getInstance(myProject).commitAllDocuments() - - //to load text - ApplicationManager.getApplication().runWriteAction { TreeUtil.clearCaches(myFile.node as TreeElement) } - - //to initialize caches - if (!DumbService.isDumb(project)) { - CacheManager.SERVICE.getInstance(myProject) - .getFilesWithWord("XXX", UsageSearchContext.IN_COMMENTS, GlobalSearchScope.allScope(myProject), true) - } - - val infos = doHighlighting() - - val text = myEditor.document.text - if (shouldCheckLineMarkers) { - data.checkLineMarkers(DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), project), text) - } - if (shouldCheckResult) { - data.checkResult(infos, text) - } - return infos - } -} \ No newline at end of file diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 deleted file mode 100644 index 9a897743bbe..00000000000 --- a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.201 +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.j2k - -import com.intellij.codeInsight.ContainerProvider -import com.intellij.codeInsight.NullableNotNullManager -import com.intellij.codeInsight.NullableNotNullManagerImpl -import com.intellij.codeInsight.runner.JavaMainMethodProvider -import com.intellij.core.CoreApplicationEnvironment -import com.intellij.core.JavaCoreApplicationEnvironment -import com.intellij.core.JavaCoreProjectEnvironment -import com.intellij.lang.MetaLanguage -import com.intellij.lang.jvm.facade.JvmElementProvider -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.extensions.ExtensionsArea -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.* -import com.intellij.psi.augment.PsiAugmentProvider -import com.intellij.psi.augment.TypeAnnotationModifier -import com.intellij.psi.compiled.ClassFileDecompilers -import com.intellij.psi.impl.JavaClassSupersImpl -import com.intellij.psi.impl.PsiTreeChangePreprocessor -import com.intellij.psi.meta.MetaDataContributor -import com.intellij.psi.util.JavaClassSupers -import junit.framework.TestCase -import org.jetbrains.kotlin.utils.PathUtil -import java.io.File -import java.net.URLClassLoader - -abstract class AbstractJavaToKotlinConverterForWebDemoTest : TestCase() { - val DISPOSABLE = Disposer.newDisposable() - - fun doTest(javaPath: String) { - try { - val fileContents = FileUtil.loadFile(File(javaPath), true) - val javaCoreEnvironment: JavaCoreProjectEnvironment = setUpJavaCoreEnvironment() - translateToKotlin(fileContents, javaCoreEnvironment.project) - } - finally { - Disposer.dispose(DISPOSABLE) - } - } - - fun setUpJavaCoreEnvironment(): JavaCoreProjectEnvironment { - // FIXME: There is no `Extensions.cleanRootArea` in 193 platform - // Extensions.cleanRootArea(DISPOSABLE) - val area = Extensions.getRootArea() - - registerExtensionPoints(area) - - val applicationEnvironment = JavaCoreApplicationEnvironment(DISPOSABLE) - val javaCoreEnvironment = object : JavaCoreProjectEnvironment(DISPOSABLE, applicationEnvironment) { - override fun preregisterServices() { - val projectArea = Extensions.getArea(project) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiElementFinder.EP_NAME, PsiElementFinder::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, JvmElementProvider.EP_NAME, JvmElementProvider::class.java) - } - } - - javaCoreEnvironment.project.registerService(NullableNotNullManager::class.java, object : NullableNotNullManagerImpl(javaCoreEnvironment.project) { - override fun isNullable(owner: PsiModifierListOwner, checkBases: Boolean) = !isNotNull(owner, checkBases) - override fun isNotNull(owner: PsiModifierListOwner, checkBases: Boolean) = true - override fun hasHardcodedContracts(element: PsiElement): Boolean = false - override fun getNullables() = emptyList() - override fun setNullables(vararg p0: String) = Unit - override fun getNotNulls() = emptyList() - override fun setNotNulls(vararg p0: String) = Unit - override fun getDefaultNullable() = "" - override fun setDefaultNullable(defaultNullable: String) = Unit - override fun getDefaultNotNull() = "" - override fun setDefaultNotNull(p0: String) = Unit - override fun setInstrumentedNotNulls(p0: List) = Unit - override fun getInstrumentedNotNulls() = emptyList() - }) - - applicationEnvironment.application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java) - - for (root in PathUtil.getJdkClassesRootsFromCurrentJre()) { - javaCoreEnvironment.addJarToClassPath(root) - } - val annotations: File? = findAnnotations() - if (annotations != null && annotations.exists()) { - javaCoreEnvironment.addJarToClassPath(annotations) - } - return javaCoreEnvironment - } - - private fun registerExtensionPoints(area: ExtensionsArea) { - CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, JavaModuleSystem.EP_NAME, JavaModuleSystem::class.java) - } - - fun findAnnotations(): File? { - var classLoader = JavaToKotlinTranslator::class.java.classLoader - while (classLoader != null) { - val loader = classLoader - if (loader is URLClassLoader) { - for (url in loader.urLs) { - if ("file" == url.protocol && url.file!!.endsWith("/annotations.jar")) { - return File(url.file!!) - } - } - } - classLoader = classLoader.parent - } - return null - } -} diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as41 b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 deleted file mode 100644 index 4ebe4e21252..00000000000 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/parcel/ParcelableClinitClassBuilderInterceptorExtension.kt.201 +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.android.synthetic.codegen - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.android.parcel.isParcelize -import org.jetbrains.kotlin.codegen.AbstractClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilderFactory -import org.jetbrains.kotlin.codegen.DelegatingClassBuilder -import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension -import org.jetbrains.kotlin.diagnostics.DiagnosticSink -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin -import org.jetbrains.org.objectweb.asm.MethodVisitor -import org.jetbrains.org.objectweb.asm.Opcodes -import org.jetbrains.org.objectweb.asm.Opcodes.ACC_STATIC -import org.jetbrains.org.objectweb.asm.Type -import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter - -class ParcelableClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { - override fun interceptClassBuilderFactory( - interceptedFactory: ClassBuilderFactory, - bindingContext: BindingContext, - diagnostics: DiagnosticSink - ): ClassBuilderFactory { - return ParcelableClinitClassBuilderFactory(interceptedFactory, bindingContext) - } - - private inner class ParcelableClinitClassBuilderFactory( - private val delegateFactory: ClassBuilderFactory, - val bindingContext: BindingContext - ) : ClassBuilderFactory { - - override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { - return AndroidOnDestroyCollectorClassBuilder(origin, delegateFactory.newClassBuilder(origin), bindingContext) - } - - override fun getClassBuilderMode() = delegateFactory.classBuilderMode - - override fun asText(builder: ClassBuilder?): String? { - return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun asBytes(builder: ClassBuilder?): ByteArray? { - return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun close() { - delegateFactory.close() - } - } - - private inner class AndroidOnDestroyCollectorClassBuilder( - val declarationOrigin: JvmDeclarationOrigin, - internal val delegateClassBuilder: ClassBuilder, - val bindingContext: BindingContext - ) : DelegatingClassBuilder() { - private var currentClass: KtClassOrObject? = null - private var currentClassName: String? = null - private var isClinitGenerated = false - - override fun getDelegate() = delegateClassBuilder - - override fun defineClass( - origin: PsiElement?, - version: Int, - access: Int, - name: String, - signature: String?, - superName: String, - interfaces: Array - ) { - if (origin is KtClassOrObject) { - currentClass = origin - } else { - currentClass = null - } - - currentClassName = name - isClinitGenerated = false - - super.defineClass(origin, version, access, name, signature, superName, interfaces) - } - - override fun done() { - if (!isClinitGenerated && currentClass != null && currentClassName != null) { - val descriptor = bindingContext[BindingContext.CLASS, currentClass] - if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { - val baseVisitor = super.newMethod(JvmDeclarationOrigin.NO_ORIGIN, ACC_STATIC, "", "()V", null, null) - val visitor = ClinitAwareMethodVisitor(currentClassName!!, baseVisitor) - - visitor.visitCode() - visitor.visitInsn(Opcodes.RETURN) - visitor.visitEnd() - } - } - - super.done() - } - - override fun newMethod( - origin: JvmDeclarationOrigin, - access: Int, - name: String, - desc: String, - signature: String?, - exceptions: Array? - ): MethodVisitor { - if (name == "" && currentClass != null && currentClassName != null) { - isClinitGenerated = true - - val descriptor = bindingContext[BindingContext.CLASS, currentClass] - if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { - return ClinitAwareMethodVisitor( - currentClassName!!, - super.newMethod(origin, access, name, desc, signature, exceptions)) - } - } - - return super.newMethod(origin, access, name, desc, signature, exceptions) - } - } - - private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { - override fun visitInsn(opcode: Int) { - if (opcode == Opcodes.RETURN) { - val iv = InstructionAdapter(this) - val creatorName = "$parcelableName\$Creator" - val creatorType = Type.getObjectType(creatorName) - - iv.anew(creatorType) - iv.dup() - iv.invokespecial(creatorName, "", "()V", false) - iv.putstatic(parcelableName, "CREATOR", "Landroid/os/Parcelable\$Creator;") - } - - super.visitInsn(opcode) - } - } -} diff --git a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 b/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 deleted file mode 100644 index 15e71b8c17f..00000000000 --- a/plugins/android-extensions/android-extensions-compiler/src/org/jetbrains/kotlin/android/synthetic/codegen/AndroidOnDestroyClassBuilderInterceptorExtension.kt.201 +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.android.synthetic.codegen - -import com.intellij.psi.PsiElement -import kotlinx.android.extensions.CacheImplementation -import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.CLEAR_CACHE_METHOD_NAME -import org.jetbrains.kotlin.android.synthetic.codegen.AbstractAndroidExtensionsExpressionCodegenExtension.Companion.ON_DESTROY_METHOD_NAME -import org.jetbrains.kotlin.android.synthetic.descriptors.ContainerOptionsProxy -import org.jetbrains.kotlin.codegen.AbstractClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilderFactory -import org.jetbrains.kotlin.codegen.DelegatingClassBuilder -import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension -import org.jetbrains.kotlin.diagnostics.DiagnosticSink -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin -import org.jetbrains.org.objectweb.asm.MethodVisitor -import org.jetbrains.org.objectweb.asm.Opcodes -import org.jetbrains.org.objectweb.asm.Type -import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter - -abstract class AbstractAndroidOnDestroyClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { - override fun interceptClassBuilderFactory( - interceptedFactory: ClassBuilderFactory, - bindingContext: BindingContext, - diagnostics: DiagnosticSink - ): ClassBuilderFactory { - return AndroidOnDestroyClassBuilderFactory(interceptedFactory, bindingContext) - } - - abstract fun getGlobalCacheImpl(element: KtElement): CacheImplementation - - private inner class AndroidOnDestroyClassBuilderFactory( - private val delegateFactory: ClassBuilderFactory, - val bindingContext: BindingContext - ) : ClassBuilderFactory { - - override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { - return AndroidOnDestroyCollectorClassBuilder(delegateFactory.newClassBuilder(origin), bindingContext) - } - - override fun getClassBuilderMode() = delegateFactory.classBuilderMode - - override fun asText(builder: ClassBuilder?): String? { - return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun asBytes(builder: ClassBuilder?): ByteArray? { - return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun close() { - delegateFactory.close() - } - } - - private inner class AndroidOnDestroyCollectorClassBuilder( - internal val delegateClassBuilder: ClassBuilder, - val bindingContext: BindingContext - ) : DelegatingClassBuilder() { - private var currentClass: KtClass? = null - private var currentClassName: String? = null - - override fun getDelegate() = delegateClassBuilder - - override fun defineClass( - origin: PsiElement?, - version: Int, - access: Int, - name: String, - signature: String?, - superName: String, - interfaces: Array - ) { - if (origin is KtClass) { - currentClass = origin - currentClassName = name - } - super.defineClass(origin, version, access, name, signature, superName, interfaces) - } - - override fun newMethod( - origin: JvmDeclarationOrigin, - access: Int, - name: String, - desc: String, - signature: String?, - exceptions: Array? - ): MethodVisitor { - return object : MethodVisitor(Opcodes.API_VERSION, super.newMethod(origin, access, name, desc, signature, exceptions)) { - override fun visitInsn(opcode: Int) { - if (opcode == Opcodes.RETURN) { - generateClearCacheMethodCall() - } - - super.visitInsn(opcode) - } - - private fun generateClearCacheMethodCall() { - val currentClass = currentClass - if (name != ON_DESTROY_METHOD_NAME || currentClass == null) return - if (Type.getArgumentTypes(desc).isNotEmpty()) return - if (Type.getReturnType(desc) != Type.VOID_TYPE) return - - val containerType = currentClassName?.let { Type.getObjectType(it) } ?: return - - val container = bindingContext.get(BindingContext.CLASS, currentClass) ?: return - val entityOptions = ContainerOptionsProxy.create(container) - if (!entityOptions.containerType.isFragment || !(entityOptions.cache ?: getGlobalCacheImpl(currentClass)).hasCache) return - - val iv = InstructionAdapter(this) - iv.load(0, containerType) - iv.invokevirtual(currentClassName, CLEAR_CACHE_METHOD_NAME, "()V", false) - } - } - } - } - -} diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as41 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as41 b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as41 b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 b/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 deleted file mode 100644 index 3657aebecfb..00000000000 --- a/plugins/parcelize/parcelize-compiler/src/org/jetbrains/kotlin/parcelize/ParcelizeClinitClassBuilderInterceptorExtension.kt.201 +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.parcelize - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.codegen.AbstractClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilder -import org.jetbrains.kotlin.codegen.ClassBuilderFactory -import org.jetbrains.kotlin.codegen.DelegatingClassBuilder -import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension -import org.jetbrains.kotlin.diagnostics.DiagnosticSink -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin -import org.jetbrains.org.objectweb.asm.MethodVisitor -import org.jetbrains.org.objectweb.asm.Opcodes -import org.jetbrains.org.objectweb.asm.Type -import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter - -class ParcelizeClinitClassBuilderInterceptorExtension : ClassBuilderInterceptorExtension { - override fun interceptClassBuilderFactory( - interceptedFactory: ClassBuilderFactory, - bindingContext: BindingContext, - diagnostics: DiagnosticSink - ): ClassBuilderFactory { - return ParcelableClinitClassBuilderFactory(interceptedFactory, bindingContext) - } - - private inner class ParcelableClinitClassBuilderFactory( - private val delegateFactory: ClassBuilderFactory, - val bindingContext: BindingContext - ) : ClassBuilderFactory { - - override fun newClassBuilder(origin: JvmDeclarationOrigin): ClassBuilder { - return AndroidOnDestroyCollectorClassBuilder(origin, delegateFactory.newClassBuilder(origin), bindingContext) - } - - override fun getClassBuilderMode() = delegateFactory.classBuilderMode - - override fun asText(builder: ClassBuilder?): String? { - return delegateFactory.asText((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun asBytes(builder: ClassBuilder?): ByteArray? { - return delegateFactory.asBytes((builder as AndroidOnDestroyCollectorClassBuilder).delegateClassBuilder) - } - - override fun close() { - delegateFactory.close() - } - } - - private class AndroidOnDestroyCollectorClassBuilder( - val declarationOrigin: JvmDeclarationOrigin, - val delegateClassBuilder: ClassBuilder, - val bindingContext: BindingContext - ) : DelegatingClassBuilder() { - private var currentClass: KtClassOrObject? = null - private var currentClassName: String? = null - private var isClinitGenerated = false - - override fun getDelegate() = delegateClassBuilder - - override fun defineClass( - origin: PsiElement?, - version: Int, - access: Int, - name: String, - signature: String?, - superName: String, - interfaces: Array - ) { - currentClass = origin as? KtClassOrObject - currentClassName = name - isClinitGenerated = false - - super.defineClass(origin, version, access, name, signature, superName, interfaces) - } - - override fun done() { - if (!isClinitGenerated && currentClass != null && currentClassName != null) { - val descriptor = bindingContext[BindingContext.CLASS, currentClass] - if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { - val baseVisitor = super.newMethod(JvmDeclarationOrigin.NO_ORIGIN, Opcodes.ACC_STATIC, "", "()V", null, null) - val visitor = ClinitAwareMethodVisitor(currentClassName!!, baseVisitor) - - visitor.visitCode() - visitor.visitInsn(Opcodes.RETURN) - visitor.visitEnd() - } - } - - super.done() - } - - override fun newMethod( - origin: JvmDeclarationOrigin, - access: Int, - name: String, - desc: String, - signature: String?, - exceptions: Array? - ): MethodVisitor { - if (name == "" && currentClass != null && currentClassName != null) { - isClinitGenerated = true - - val descriptor = bindingContext[BindingContext.CLASS, currentClass] - if (descriptor != null && declarationOrigin.descriptor == descriptor && descriptor.isParcelize) { - return ClinitAwareMethodVisitor( - currentClassName!!, - super.newMethod(origin, access, name, desc, signature, exceptions) - ) - } - } - - return super.newMethod(origin, access, name, desc, signature, exceptions) - } - } - - private class ClinitAwareMethodVisitor(val parcelableName: String, mv: MethodVisitor) : MethodVisitor(Opcodes.API_VERSION, mv) { - override fun visitInsn(opcode: Int) { - if (opcode == Opcodes.RETURN) { - val iv = InstructionAdapter(this) - val creatorName = "$parcelableName\$Creator" - val creatorType = Type.getObjectType(creatorName) - - iv.anew(creatorType) - iv.dup() - iv.invokespecial(creatorName, "", "()V", false) - iv.putstatic(parcelableName, "CREATOR", "Landroid/os/Parcelable\$Creator;") - } - - super.visitInsn(opcode) - } - } -} diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as41 b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as41 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 deleted file mode 100644 index 58b2c58d163..00000000000 --- a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.201 +++ /dev/null @@ -1,429 +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.uast.kotlin.generate - -import com.intellij.lang.Language -import com.intellij.openapi.diagnostic.logger -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiClassType -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiType -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade -import org.jetbrains.kotlin.idea.core.KotlinNameSuggester -import org.jetbrains.kotlin.idea.core.ShortenReferences -import org.jetbrains.kotlin.idea.refactoring.fqName.fqName -import org.jetbrains.kotlin.idea.util.getResolutionScope -import org.jetbrains.kotlin.idea.util.resolveToKotlinType -import org.jetbrains.kotlin.incremental.components.NoLookupLocation -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.* -import org.jetbrains.kotlin.resolve.scopes.utils.findClassifier -import org.jetbrains.kotlin.utils.addToStdlib.cast -import org.jetbrains.kotlin.utils.addToStdlib.safeAs -import org.jetbrains.uast.* -import org.jetbrains.uast.generate.UParameterInfo -import org.jetbrains.uast.generate.UastCodeGenerationPlugin -import org.jetbrains.uast.generate.UastElementFactory -import org.jetbrains.uast.kotlin.* -import org.jetbrains.uast.kotlin.internal.KotlinFakeUElement -import org.jetbrains.uast.kotlin.internal.toSourcePsiFakeAware - -class KotlinUastCodeGenerationPlugin : UastCodeGenerationPlugin { - override val language: Language - get() = KotlinLanguage.INSTANCE - - override fun getElementFactory(project: Project): UastElementFactory = - KotlinUastElementFactory(project) - - override fun replace(oldElement: UElement, newElement: T, elementType: Class): T? { - val oldPsi = oldElement.toSourcePsiFakeAware().singleOrNull() ?: return null - val newPsi = newElement.sourcePsi?.let { - when { - it is KtCallExpression && it.parent is KtQualifiedExpression -> it.parent - else -> it - } - } ?: return null - - val psiFactory = KtPsiFactory(oldPsi.project) - val oldParentPsi = oldPsi.parent - val (updOldPsi, updNewPsi) = when { - oldParentPsi is KtStringTemplateExpression && oldParentPsi.entries.size == 1 -> - oldParentPsi to newPsi - - oldPsi is KtStringTemplateEntry && newPsi !is KtStringTemplateEntry && newPsi is KtExpression -> - oldPsi to psiFactory.createBlockStringTemplateEntry(newPsi) - - oldPsi is KtBlockExpression && newPsi is KtBlockExpression -> { - if (!hasBraces(oldPsi) && hasBraces(newPsi)) { - oldPsi to psiFactory.createLambdaExpression("none", newPsi.statements.joinToString("\n") { "println()" }).bodyExpression!!.also { - it.statements.zip(newPsi.statements).forEach { it.first.replace(it.second) } - } - } else - oldPsi to newPsi - } - - else -> - oldPsi to newPsi - } - - return when (val replaced = updOldPsi.replace(updNewPsi)?.safeAs()?.let { ShortenReferences.DEFAULT.process(it) }) { - is KtCallExpression, is KtQualifiedExpression -> replaced.cast().getPossiblyQualifiedCallExpression() - else -> replaced - }?.toUElementOfExpectedTypes(elementType) - } -} - -private fun hasBraces(oldPsi: KtBlockExpression): Boolean = oldPsi.lBrace != null && oldPsi.rBrace != null - -class KotlinUastElementFactory(project: Project) : UastElementFactory { - private val psiFactory = KtPsiFactory(project) - - @Deprecated("use version with context parameter") - override fun createQualifiedReference(qualifiedName: String, context: UElement?): UQualifiedReferenceExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createQualifiedReference(qualifiedName, context?.sourcePsi) - } - - /*override*/ fun createQualifiedReference(qualifiedName: String, context: PsiElement?): UQualifiedReferenceExpression? { - return psiFactory.createExpression(qualifiedName).let { - when (it) { - is KtDotQualifiedExpression -> KotlinUQualifiedReferenceExpression(it, null) - is KtSafeQualifiedExpression -> KotlinUSafeQualifiedExpression(it, null) - else -> null - } - - } - } - - override fun createCallExpression( - receiver: UExpression?, - methodName: String, - parameters: List, - expectedReturnType: PsiType?, - kind: UastCallKind, - context: PsiElement? - ): UCallExpression? { - if (kind != UastCallKind.METHOD_CALL) return null - - val typeParams = (context as? KtElement)?.let { kontext -> - val resolutionFacade = kontext.getResolutionFacade() - (expectedReturnType as? PsiClassType)?.parameters?.map { it.resolveToKotlinType(resolutionFacade) } - } - - val name = methodName.quoteIfNeeded() - val methodCall = psiFactory.createExpression( - buildString { - if (receiver != null) - append("a.") - append(name) - if (typeParams != null) { - append(typeParams.joinToString(", ", "<", ">") { type -> - type.fqName?.asString() ?: "" - }) - } - append("()") - } - ).getPossiblyQualifiedCallExpression() ?: return null - - if (receiver != null) { - methodCall.parent.safeAs()?.receiverExpression?.replace(wrapULiteral(receiver).sourcePsi!!) - } - - val valueArgumentList = methodCall.valueArgumentList - for (parameter in parameters) { - valueArgumentList?.addArgument(psiFactory.createArgument(wrapULiteral(parameter).sourcePsi as KtExpression)) - } - - return KotlinUFunctionCallExpression(methodCall, null) - - } - - override fun createStringLiteralExpression(text: String, context: PsiElement?): ULiteralExpression? { - return KotlinStringULiteralExpression(psiFactory.createExpression(StringUtil.wrapWithDoubleQuote(text)), null) - } - - /*override*/ fun createNullLiteral(context: PsiElement?): ULiteralExpression { - return psiFactory.createExpression("null").toUElementOfType()!! - } - - /*override*/ fun createIntLiteral(value: Int, context: PsiElement?): ULiteralExpression { - return psiFactory.createExpression(value.toString()).toUElementOfType()!! - } - - private fun KtExpression.ensureBlockExpressionBraces(): KtExpression { - if (this !is KtBlockExpression || hasBraces(this)) return this - val blockExpression = psiFactory.createBlock(this.statements.joinToString("\n") { "println()" }) - for ((placeholder, statement) in blockExpression.statements.zip(this.statements)) { - placeholder.replace(statement) - } - return blockExpression - } - - @Deprecated("use version with context parameter") - override fun createIfExpression(condition: UExpression, thenBranch: UExpression, elseBranch: UExpression?): UIfExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createIfExpression(condition, thenBranch, elseBranch, null) - } - - /*override*/ fun createIfExpression( - condition: UExpression, - thenBranch: UExpression, - elseBranch: UExpression?, - context: PsiElement? - ): UIfExpression? { - val conditionPsi = condition.sourcePsi as? KtExpression ?: return null - val thenBranchPsi = thenBranch.sourcePsi as? KtExpression ?: return null - val elseBranchPsi = elseBranch?.sourcePsi as? KtExpression - - return KotlinUIfExpression(psiFactory.createIf(conditionPsi, thenBranchPsi.ensureBlockExpressionBraces(), elseBranchPsi?.ensureBlockExpressionBraces()), null) - } - - @Deprecated("use version with context parameter") - override fun createParenthesizedExpression(expression: UExpression): UParenthesizedExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createParenthesizedExpression(expression, null) - } - - /*override*/ fun createParenthesizedExpression(expression: UExpression, context: PsiElement?): UParenthesizedExpression? { - val source = expression.sourcePsi ?: return null - val parenthesized = psiFactory.createExpression("(${source.text})") as? KtParenthesizedExpression ?: return null - return KotlinUParenthesizedExpression(parenthesized, null) - } - - @Deprecated("use version with context parameter") - override fun createSimpleReference(name: String): USimpleNameReferenceExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createSimpleReference(name, null) - } - - /*override*/ fun createSimpleReference(name: String, context: PsiElement?): USimpleNameReferenceExpression? { - return KotlinUSimpleReferenceExpression(psiFactory.createSimpleName(name), null) - } - - @Deprecated("use version with context parameter") - override fun createSimpleReference(variable: UVariable): USimpleNameReferenceExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createSimpleReference(variable, null) - } - - /*override*/ fun createSimpleReference(variable: UVariable, context: PsiElement?): USimpleNameReferenceExpression? { - return createSimpleReference(variable.name ?: return null, context) - } - - @Deprecated("use version with context parameter") - override fun createReturnExpresion(expression: UExpression?, inLambda: Boolean): UReturnExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createReturnExpresion(expression, inLambda, null) - } - - /*override*/ fun createReturnExpresion(expression: UExpression?, inLambda: Boolean, context: PsiElement?): UReturnExpression? { - val label = if (inLambda && context != null) getParentLambdaLabelName(context)?.let { "@$it" } ?: "" else "" - val returnExpression = psiFactory.createExpression("return$label 1") as KtReturnExpression - val sourcePsi = expression?.sourcePsi - if (sourcePsi != null) { - returnExpression.returnedExpression!!.replace(sourcePsi) - } else { - returnExpression.returnedExpression?.delete() - } - return KotlinUReturnExpression(returnExpression, null) - } - - private fun getParentLambdaLabelName(context: PsiElement): String? { - val lambdaExpression = context.getParentOfType(false) ?: return null - lambdaExpression.parent.safeAs()?.let { return it.getLabelName() } - val callExpression = lambdaExpression.getStrictParentOfType() ?: return null - callExpression.valueArguments.find { - it.getArgumentExpression()?.unpackFunctionLiteral(allowParentheses = false) === lambdaExpression - } ?: return null - return callExpression.getCallNameExpression()?.text - } - - @Deprecated("use version with context parameter") - override fun createBinaryExpression( - leftOperand: UExpression, - rightOperand: UExpression, - operator: UastBinaryOperator - ): UBinaryExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createBinaryExpression(leftOperand, rightOperand, operator, null) - } - - /*override*/ fun createBinaryExpression( - leftOperand: UExpression, - rightOperand: UExpression, - operator: UastBinaryOperator, - context: PsiElement? - ): UBinaryExpression? { - val binaryExpression = joinBinaryExpression(leftOperand, rightOperand, operator) ?: return null - return KotlinUBinaryExpression(binaryExpression, null) - } - - private fun joinBinaryExpression( - leftOperand: UExpression, - rightOperand: UExpression, - operator: UastBinaryOperator - ): KtBinaryExpression? { - val leftPsi = leftOperand.sourcePsi ?: return null - val rightPsi = rightOperand.sourcePsi ?: return null - - val binaryExpression = psiFactory.createExpression("a ${operator.text} b") as? KtBinaryExpression ?: return null - binaryExpression.left?.replace(leftPsi) - binaryExpression.right?.replace(rightPsi) - return binaryExpression - } - - @Deprecated("use version with context parameter") - override fun createFlatBinaryExpression( - leftOperand: UExpression, - rightOperand: UExpression, - operator: UastBinaryOperator - ): UPolyadicExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createFlatBinaryExpression(leftOperand, rightOperand, operator, null) - } - - /*override*/ fun createFlatBinaryExpression( - leftOperand: UExpression, - rightOperand: UExpression, - operator: UastBinaryOperator, - context: PsiElement? - ): UPolyadicExpression? { - - fun unwrapParentheses(exp: KtExpression?) { - if (exp !is KtParenthesizedExpression) return - if (!KtPsiUtil.areParenthesesUseless(exp)) return - exp.expression?.let { exp.replace(it) } - } - - val binaryExpression = joinBinaryExpression(leftOperand, rightOperand, operator) ?: return null - unwrapParentheses(binaryExpression.left) - unwrapParentheses(binaryExpression.right) - - return psiFactory.createExpression(binaryExpression.text).toUElementOfType()!! - } - - @Deprecated("use version with context parameter") - override fun createBlockExpression(expressions: List): UBlockExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createBlockExpression(expressions, null) - } - - /*override*/ fun createBlockExpression(expressions: List, context: PsiElement?): UBlockExpression? { - val sourceExpressions = expressions.flatMap { it.toSourcePsiFakeAware() } - val block = psiFactory.createBlock( - sourceExpressions.joinToString(separator = "\n") { "println()" } - ) - for ((placeholder, psiElement) in block.statements.zip(sourceExpressions)) { - placeholder.replace(psiElement) - } - return KotlinUBlockExpression(block, null) - } - - @Deprecated("use version with context parameter") - override fun createDeclarationExpression(declarations: List): UDeclarationsExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createDeclarationExpression(declarations, null) - } - - /*override*/ fun createDeclarationExpression(declarations: List, context: PsiElement?): UDeclarationsExpression? { - return object : KotlinUDeclarationsExpression(null), KotlinFakeUElement { - override var declarations: List = declarations - override fun unwrapToSourcePsi(): List = declarations.flatMap { it.toSourcePsiFakeAware() } - } - } - - /*override*/ fun createLambdaExpression( - parameters: List, - body: UExpression, - context: PsiElement? - ): ULambdaExpression? { - val resolutionFacade = (context as? KtElement)?.getResolutionFacade() - val validator = (context as? KtElement)?.let { usedNamesFilter(it) } ?: { true } - - val newLambdaStatements = if (body is UBlockExpression) { - body.expressions.flatMap { member -> - when { - member is UReturnExpression -> member.returnExpression?.toSourcePsiFakeAware().orEmpty() - else -> member.toSourcePsiFakeAware() - } - } - } else - listOf(body.sourcePsi!!) - - val ktLambdaExpression = psiFactory.createLambdaExpression( - parameters.joinToString(", ") { p -> - val ktype = resolutionFacade?.let { p.type?.resolveToKotlinType(it) } - StringBuilder().apply { - append(p.suggestedName ?: ktype?.let { KotlinNameSuggester.suggestNamesByType(it, validator).firstOrNull() }) - ?: KotlinNameSuggester.suggestNameByName("v", validator) - ktype?.fqName?.toString()?.let { append(": ").append(it) } - } - }, - newLambdaStatements.joinToString("\n") { "placeholder" } - ) - - for ((old, new) in ktLambdaExpression.bodyExpression!!.statements.zip(newLambdaStatements)) { - old.replace(new) - } - - return ktLambdaExpression.toUElementOfType()!! - } - - @Deprecated("use version with context parameter") - override fun createLambdaExpression(parameters: List, body: UExpression): ULambdaExpression? { - logger().error("Please switch caller to the version with a context parameter") - return createLambdaExpression(parameters, body, null) - } - - /*override*/ fun createLocalVariable( - suggestedName: String?, - type: PsiType?, - initializer: UExpression, - immutable: Boolean, - context: PsiElement? - ): ULocalVariable? { - val resolutionFacade = (context as? KtElement)?.getResolutionFacade() - val validator = (context as? KtElement)?.let { usedNamesFilter(it) } ?: { true } - val ktype = resolutionFacade?.let { type?.resolveToKotlinType(it) } - - val function = psiFactory.createFunction( - buildString { - append("fun foo() { ") - append(if (immutable) "val" else "var") - append(" ") - append(suggestedName ?: ktype?.let { KotlinNameSuggester.suggestNamesByType(it, validator).firstOrNull() }) - ?: KotlinNameSuggester.suggestNameByName("v", validator) - ktype?.fqName?.toString()?.let { append(": ").append(it) } - append(" = null") - append("}") - } - ) - - val ktVariable = PsiTreeUtil.findChildOfType(function, KtVariableDeclaration::class.java)!! - val newVariable = ktVariable.initializer!!.replace(initializer.sourcePsi!!).parent - return newVariable.toUElementOfType() as ULocalVariable - } - - @Deprecated("use version with context parameter") - override fun createLocalVariable( - suggestedName: String?, - type: PsiType?, - initializer: UExpression, - immutable: Boolean - ): ULocalVariable? { - logger().error("Please switch caller to the version with a context parameter") - return createLocalVariable(suggestedName, type, initializer, immutable, null) - } -} - -private fun usedNamesFilter(context: KtElement): (String) -> Boolean { - val scope = context.getResolutionScope() - return { name: String -> scope.findClassifier(Name.identifier(name), NoLookupLocation.FROM_IDE) == null } -} \ No newline at end of file diff --git a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 deleted file mode 100644 index dddfe20241f..00000000000 --- a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.201 +++ /dev/null @@ -1,37 +0,0 @@ -package org.jetbrains.uast.test.kotlin - -import com.intellij.psi.PsiElement -import org.jetbrains.uast.* -import org.jetbrains.uast.test.common.UElementToParentMap -import org.jetbrains.uast.test.common.kotlin.IdentifiersTestBase -import org.jetbrains.uast.test.common.visitUFileAndGetResult -import org.jetbrains.uast.test.env.assertEqualsToFile -import java.io.File -import kotlin.test.assertNotNull - - -abstract class AbstractKotlinIdentifiersTest : AbstractKotlinUastTest(), IdentifiersTestBase { - - private fun getTestFile(testName: String, ext: String) = - File(File(TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext) - - override fun getIdentifiersFile(testName: String): File = getTestFile(testName, "identifiers.txt") - - override fun check(testName: String, file: UFile) { - super.check(testName, file) - assertEqualsToFile("refNames", getTestFile(testName, "refNames.txt"), file.asRefNames()) - } -} - -private fun refNameRetriever(psiElement: PsiElement): UElement? = - when (val uElement = psiElement.toUElementOfExpectedTypes(UCallExpression::class.java, UReferenceExpression::class.java)) { - is UReferenceExpression -> uElement.referenceNameElement - is UCallExpression -> uElement.classReference?.referenceNameElement - else -> null - }?.also { - assertNotNull(it.sourcePsi, "referenceNameElement should have physical source, origin = $psiElement") - } - -fun UFile.asRefNames() = object : UElementToParentMap(::refNameRetriever) { - override fun renderSource(element: PsiElement): String = element.javaClass.simpleName -}.visitUFileAndGetResult(this) \ No newline at end of file diff --git a/tests/mute-platform.csv.201 b/tests/mute-platform.csv.201 deleted file mode 100644 index 69c5b260bc7..00000000000 --- a/tests/mute-platform.csv.201 +++ /dev/null @@ -1,115 +0,0 @@ -Test key, Issue, State (optional: MUTE or FAIL), Status (optional: FLAKY) -"org.jetbrains.kotlin.gradle.HierarchicalMultiplatformProjectImportingTest.testJvmWithJavaOnHMPP", No module dependency found,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.simpleAndroidAppWithCommonModule, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testDependenciesReachableViaImpl, Gradle Tests in 201,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFileInProjectWithAndroid, NPE - no facet configured,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithNonDefaultConfig, Gradle Tests in 201,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplement, Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDetectAndroidSources", Gradle Import Tests,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP", Gradle Import Tests,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJavaTransitiveOnMPP", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJvmWithJava", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testNestedDependencies", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testProjectDependency", Gradle Tests in 201,, -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, NPE during import,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Val.testValWithTypeWoInitializer,,, FLAKY -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Common.StaticMembers.testJavaStaticMethodsFromImports, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testNullableReceiver, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSafeCall, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSyntheticExtensions1, KT-32919,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunCallInLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunInnerClassFromLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testCoroutineContextCheck, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testDispatchersTypeDetection, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testNestedFunctionsInsideSuspendLambda, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testSimpleCoroutineScope, KT-34659,, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression2, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression3, KT-34672, FAIL, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterPrimaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterSecondaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testBlankLineBetween, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testPropertyWithAnnotation, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.NestedIfs.testBlockBody, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testFunctionWithOneLineReturn, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY -org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.rename.RenameTestGenerated.testOverloadsWithSameOrigin_OverloadsWithSameOrigin, Bad imports after rename,, FLAKY -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.test1, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImport, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImportWithBlankLineInsertion, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImportWithBlankLinesRemoval, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testCommentTyping, Additional signature,, -org.jetbrains.kotlin.idea.slicer.SlicerTreeTestGenerated.testInflow_SecondaryConstructorParameter, IDEA-234737 element.parent must not be null,, -org.jetbrains.kotlin.idea.slicer.SlicerTreeTestGenerated.testInflow_SecondaryConstructorParameterWithDefault, IDEA-234737 element.parent must not be null,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testAnnotationArgBySpELRefInXMLConf_AnnotationArgBySpELRefInXMLConf, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testAnnotationArgBySpELRefInXMLConf_AnnotationArgBySpELRefInXMLConf, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testIsPropertyWithXmlRefsBySpelRef_IsPropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testIsPropertyWithXmlRefsBySpelRef_IsPropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJavaAnnotated_JavaSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJavaAnnotated_JavaSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJava_JavaSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJava_JavaSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKtAnnotated_JavaSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKtAnnotated_JavaSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKt_JavaSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKt_JavaSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJavaAnnotated_KtSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJavaAnnotated_KtSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJava_KtSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJava_KtSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKtAnnotated_KtSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKtAnnotated_KtSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKt_KtSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKt_KtSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testParameterWithXmlRefsBySpelRef_ParameterWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testParameterWithXmlRefsBySpelRef_ParameterWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testPropertyWithXmlRefsBySpelRef_PropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testPropertyWithXmlRefsBySpelRef_PropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.jps.build.IncrementalConstantSearchTest.testJavaConstantChangedUsedInKotlin, Incremental compilation in 201,, -org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.testConstantChanged, Incremental compilation in 201,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, \ No newline at end of file diff --git a/tests/mute-platform.csv.as41 b/tests/mute-platform.csv.as41 deleted file mode 100644 index c82ed8c1ba7..00000000000 --- a/tests/mute-platform.csv.as41 +++ /dev/null @@ -1,117 +0,0 @@ -Test key, Issue, State (optional: MUTE or FAIL), Status (optional: FLAKY) -"org.jetbrains.kotlin.gradle.HierarchicalMultiplatformProjectImportingTest.testJvmWithJavaOnHMPP", No module dependency found,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.simpleAndroidAppWithCommonModule, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testDependenciesReachableViaImpl, Gradle Tests in 201,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFileInProjectWithAndroid, NPE - no facet configured,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithNonDefaultConfig, Gradle Tests in 201,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplement, Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDetectAndroidSources", Gradle Import Tests,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP", Gradle Import Tests,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJavaTransitiveOnMPP", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJvmWithJava", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testNestedDependencies", Gradle Tests in 201,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testProjectDependency", Gradle Tests in 201,, -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testAndroidGradleJsDetection, NPE during import,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Val.testValWithTypeWoInitializer,,, FLAKY -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Common.StaticMembers.testJavaStaticMethodsFromImports, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testNullableReceiver, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSafeCall, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSyntheticExtensions1, KT-32919,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunCallInLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunInnerClassFromLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testCoroutineContextCheck, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testDispatchersTypeDetection, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testNestedFunctionsInsideSuspendLambda, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testSimpleCoroutineScope, KT-34659,, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression2, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression3, KT-34672, FAIL, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterPrimaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterSecondaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testBlankLineBetween, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testPropertyWithAnnotation, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.NestedIfs.testBlockBody, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testFunctionWithOneLineReturn, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY -org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.rename.RenameTestGenerated.testOverloadsWithSameOrigin_OverloadsWithSameOrigin, Bad imports after rename,, FLAKY -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.test1, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImport, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImportWithBlankLineInsertion, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testAddImportWithBlankLinesRemoval, Additional signature,, -org.jetbrains.kotlin.idea.refactoring.suggested.KotlinSuggestedRefactoringChangeListenerTest.testCommentTyping, Additional signature,, -org.jetbrains.kotlin.idea.slicer.SlicerTreeTestGenerated.testInflow_SecondaryConstructorParameter, IDEA-234737 element.parent must not be null,, -org.jetbrains.kotlin.idea.slicer.SlicerTreeTestGenerated.testInflow_SecondaryConstructorParameterWithDefault, IDEA-234737 element.parent must not be null,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testAnnotationArgBySpELRefInXMLConf_AnnotationArgBySpELRefInXMLConf, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testAnnotationArgBySpELRefInXMLConf_AnnotationArgBySpELRefInXMLConf, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testIsPropertyWithXmlRefsBySpelRef_IsPropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testIsPropertyWithXmlRefsBySpelRef_IsPropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJavaAnnotated_JavaSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJavaAnnotated_JavaSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJava_JavaSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToJava_JavaSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKtAnnotated_JavaSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKtAnnotated_JavaSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKt_JavaSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testJavaSpelRefToKt_JavaSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJavaAnnotated_KtSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJavaAnnotated_KtSpelRefToJavaAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJava_KtSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToJava_KtSpelRefToJava, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKtAnnotated_KtSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKtAnnotated_KtSpelRefToKtAnnotated, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKt_KtSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testKtSpelRefToKt_KtSpelRefToKt, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testParameterWithXmlRefsBySpelRef_ParameterWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testParameterWithXmlRefsBySpelRef_ParameterWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testPropertyWithXmlRefsBySpelRef_PropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.idea.spring.tests.rename.SpringRenameTestGenerated.testPropertyWithXmlRefsBySpelRef_PropertyWithXmlRefBySpelRef, Rename failed in Spring,, -org.jetbrains.kotlin.jps.build.IncrementalConstantSearchTest.testJavaConstantChangedUsedInKotlin, Incremental compilation in 201,, -org.jetbrains.kotlin.jps.build.IncrementalJvmJpsTestGenerated.WithJava.JavaUsedInKotlin.testConstantChanged, Incremental compilation in 201,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testChangeInsideNonKtsFileInvalidatesOtherFiles, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testTwoFilesChanged, Unprocessed,, -org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptListenerTest.testLoadedConfigurationWhenExternalFileChanged, Unprocessed,, -org.jetbrains.kotlin.idea.debugger.test.KotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib, Unprocessed,, -org.jetbrains.kotlin.idea.debugger.test.IrKotlinSteppingTestGenerated.Custom.testFunctionBreakpointInStdlib,,, \ No newline at end of file