From 254dc8f71c71b02fcf365302db88f7327a678604 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Wed, 18 Dec 2019 20:29:48 +0300 Subject: [PATCH] Build: Drop IntelliJ 2018.3 and Android Studio 3.4 support Delete *.183 and *.as34 bunch-files --- buildSrc/gradle.properties.as34 | 8 - .../tests/AndroidJpsBuildTestCase.java.as34 | 0 .../android/tests/AndroidRunner.java.as34 | 0 .../MockExternalAnnotationsManager.kt.183 | 57 - compiler/compiler.pro.183 | 272 ---- compiler/compiler.pro.as34 | 272 ---- .../fir/java/FirJavaElementFinder.kt.183 | 284 ---- .../generators/tests/GenerateTests.kt.183 | 1381 ----------------- .../generators/tests/GenerateTests.kt.as34 | 1232 --------------- gradle.properties.as34 | 23 - gradle/versions.properties.183 | 15 - gradle/versions.properties.as34 | 19 - .../project/userDataModuleInfoUtil.kt.183 | 17 - .../project/userDataModuleInfoUtil.kt.as34 | 90 -- .../idea/caches/userDataModuleInfo.kt.183 | 0 .../kotlin/idea/userDataModuleInfo.kt.as34 | 34 - .../completion/LookupCancelWatcher.kt.183 | 114 -- .../completion/LookupCancelWatcher.kt.as34 | 114 -- ...nGradleScriptFileTypeSchemaDetector.kt.183 | 0 ...GradleScriptFileTypeSchemaDetector.kt.as34 | 0 .../statistics/IDESettingsFUSCollector.kt.183 | 3 - .../IDESettingsFUSCollector.kt.as34 | 3 - .../idea/statistics/KotlinFUSLogger.kt.183 | 18 - .../idea/statistics/KotlinFUSLogger.kt.as34 | 18 - .../ProjectConfigurationCollector.kt.183 | 3 - .../ProjectConfigurationCollector.kt.as34 | 3 - .../KotlinExplicitMovementProvider.kt.as34 | 0 ...adleNativeLibrariesInIDENamingTest.kt.as34 | 0 ...adleNativeLibrariesPropagationTest.kt.as34 | 0 .../configuration/kotlinResolverUtil.kt.183 | 8 - ...otlinMPPGradleProjectTaskRunnerUtil.kt.183 | 14 - ...estClassGradleConfigurationProducer.kt.183 | 88 -- ...stMethodGradleConfigurationProducer.kt.183 | 87 -- .../KotlinMPPGradleTestTasksProvider.kt.183 | 0 .../run/MultiplatformTestTasksChooser.kt.183 | 0 .../gradle/GradleScriptInputsWatcher.kt.as34 | 66 - .../GradleMultiplatformWizardTest.kt.as34 | 0 ...alMultiplatformProjectImportingTest.kt.183 | 0 .../kotlin/gradle/KaptImportingTest.kt.183 | 9 - .../kotlin/gradle/KaptImportingTest.kt.as34 | 9 - .../MultiplatformProjectImportingTest.kt.as34 | 0 ...ltiplatformTestCompatibilityMatrix.kt.as34 | 8 - ...ltiplatformKaptProjectImportingTest.kt.183 | 70 - ...ewMultiplatformProjectImportingTest.kt.183 | 639 -------- ...wMultiplatformProjectImportingTest.kt.as34 | 0 .../gradle/PackagePrefixImportingTest.kt.183 | 0 .../gradle/PackagePrefixImportingTest.kt.as34 | 0 .../jetbrains/kotlin/gradle/TaskUtils.kt.183 | 13 - .../gradle/AbstractModelBuilderTest.java.183 | 261 ---- .../gradle/GradleFacetImportTest.kt.as34 | 0 ...eInspectionTestCompatibilityMatrix.kt.as34 | 8 - .../config/KotlinResourceRootType.kt.183 | 30 - .../config/KotlinResourceRootType.kt.as34 | 28 - .../kotlin/config/KotlinRootType.kt.183 | 24 - .../kotlin/config/KotlinSourceRootType.kt.183 | 31 - .../config/KotlinSourceRootType.kt.as34 | 31 - .../idea/scratch/output/commandHelper.kt.183 | 13 - .../idea/scratch/output/inlayHelper.kt.183 | 19 - .../scratch/ui/ModulesComboBoxAction.kt.183 | 79 - .../ui/SmallBorderCheckboxAction.kt.183 | 19 - ...tlinMavenArtifactsDownloadScheduler.kt.183 | 21 - ...otlinSyntheticTypeComponentProvider.kt.183 | 8 - .../idea/testFramework/projectRoutines.kt.183 | 102 -- idea/resources/META-INF/android-lint.xml.as34 | 5 - .../resources/META-INF/extensions/ide.xml.183 | 131 -- .../META-INF/extensions/ide.xml.as34 | 122 -- idea/resources/META-INF/git4idea.xml.as34 | 4 - idea/resources/META-INF/gradle-java.xml.183 | 54 - idea/resources/META-INF/gradle-java.xml.as34 | 54 - idea/resources/META-INF/gradle.xml.183 | 43 - idea/resources/META-INF/jvm.xml.183 | 226 --- idea/resources/META-INF/plugin.xml.183 | 71 - idea/resources/META-INF/plugin.xml.as34 | 75 - .../highlighter/markers/dslStyleIcon.kt.as34 | 15 - .../quickfix/expectactual/escapeXML.kt.183 | 10 - .../MoveKotlinDeclarationsProcessor.kt.183 | 395 ----- .../idea/reporter/ITNReporterCompat.kt.as34 | 33 - .../KotlinTargetElementEvaluator.kt.183 | 122 -- .../idea/slicer/compat/nullability.kt.183 | 11 - .../kotlin/idea/testResourceBundle.kt.as34 | 39 - .../update/GooglePluginUpdateVerifier.kt.as34 | 152 -- .../kotlin/idea/update/verify.kt.as34 | 35 - .../invalidBundleOrProperty/expected.xml.183 | 81 - .../highlighter/duplicateHighlighting.kt.183 | 12 - .../kotlin/jps/build/ideaPlatform.kt.as34 | 13 - .../AllOpenMavenProjectImportHandler.kt.as34 | 0 .../impl/AndroidModuleInfoProviderImpl.kt.183 | 78 - .../AndroidModuleInfoProviderImpl.kt.as34 | 78 - .../src/AbstractMavenImportHandler.kt.as34 | 0 .../idea/KaptProjectResolverExtension.kt.183 | 200 --- .../idea/KaptProjectResolverExtension.kt.as34 | 169 -- ...linSerializationMavenImportHandler.kt.as34 | 0 .../NoArgMavenProjectImportHandler.kt.as34 | 0 ...hReceiverMavenProjectImportHandler.kt.as34 | 0 .../uast/kotlin/KotlinAbstractUElement.kt.183 | 251 --- .../kotlin/KotlinUastLanguagePlugin.kt.183 | 615 -------- .../kotlin/declarations/KotlinUClass.kt.183 | 386 ----- .../kotlin/declarations/KotlinUMethod.kt.183 | 195 --- .../KotlinEvaluatorExtension.kt.183 | 56 - .../kotlin/expressions/ElvisExpression.kt.183 | 121 -- ...inStringTemplateUPolyadicExpression.kt.183 | 34 - .../KotlinUCallableReferenceExpression.kt.183 | 55 - .../KotlinUClassLiteralExpression.kt.183 | 40 - .../KotlinUObjectLiteralExpression.kt.183 | 89 -- ...KotlinUQualifiedReferenceExpression.kt.183 | 39 - .../KotlinUSimpleReferenceExpression.kt.183 | 261 ---- .../KotlinUSwitchExpression.kt.183 | 94 -- .../expressions/KotlinUTryExpression.kt.183 | 45 - .../testData/Anonymous.refNames.txt.183 | 0 .../testData/ClassAnnotation.altlog.txt.183 | 0 .../ClassAnnotation.identifiers.txt.183 | 13 - .../testData/ClassAnnotation.refNames.txt.183 | 0 .../testData/Constructors.refNames.txt.183 | 0 .../testData/InnerClasses.altlog.txt.183 | 0 .../testData/InnerClasses.splog.txt.183 | 0 .../testData/LocalDeclarations.altlog.txt.183 | 0 .../LocalDeclarations.refNames.txt.183 | 0 .../testData/ManyAlternatives.kt.183 | 0 ...meterPropertyWithAnnotation.altlog.txt.183 | 0 .../testData/SimpleAnnotated.refNames.txt.183 | 0 ...ingTemplateComplexForUInjectionHost.kt.183 | 0 ...mplateComplexForUInjectionHost.log.txt.183 | 0 ...ateComplexForUInjectionHost.render.txt.183 | 0 .../testData/SuperCalls.refNames.txt.183 | 0 .../AbstractKotlinIdentifiersTest.kt.183 | 15 - .../tests/AlternativesRenderLogTest.kt.183 | 0 .../tests/KotlinUastAlternativesTest.kt.183 | 0 .../tests/KotlinUastApiTest.kt.183 | 587 ------- .../tests/KotlinUastReferencesTest.kt.183 | 126 -- .../tests/MultiplesRequiredTypesTest.kt.183 | 0 .../tests/SimpleKotlinRenderLogTest.kt.183 | 108 -- tests/mute.csv.as34 | 13 - 132 files changed, 11036 deletions(-) delete mode 100644 buildSrc/gradle.properties.as34 delete mode 100644 compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as34 delete mode 100644 compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as34 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.183 delete mode 100644 compiler/compiler.pro.183 delete mode 100644 compiler/compiler.pro.as34 delete mode 100644 compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt.183 delete mode 100644 generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.183 delete mode 100644 generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as34 delete mode 100644 gradle.properties.as34 delete mode 100644 gradle/versions.properties.183 delete mode 100644 gradle/versions.properties.as34 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.183 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.as34 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/userDataModuleInfo.kt.183 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/userDataModuleInfo.kt.as34 delete mode 100644 idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.183 delete mode 100644 idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.as34 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.183 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.as34 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.183 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as34 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.183 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as34 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.183 delete mode 100644 idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as34 delete mode 100644 idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.as34 delete mode 100644 idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt.as34 delete mode 100644 idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt.as34 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/kotlinResolverUtil.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunnerUtil.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestClassGradleConfigurationProducer.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestMethodGradleConfigurationProducer.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/MultiplatformTestTasksChooser.kt.183 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleScriptInputsWatcher.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/TaskUtils.kt.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.183 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as34 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as34 delete mode 100644 idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.183 delete mode 100644 idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.as34 delete mode 100644 idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt.183 delete mode 100644 idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.183 delete mode 100644 idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.as34 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/commandHelper.kt.183 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/inlayHelper.kt.183 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/ModulesComboBoxAction.kt.183 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/SmallBorderCheckboxAction.kt.183 delete mode 100644 idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenArtifactsDownloadScheduler.kt.183 delete mode 100644 idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt.183 delete mode 100644 idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.183 delete mode 100644 idea/resources/META-INF/android-lint.xml.as34 delete mode 100644 idea/resources/META-INF/extensions/ide.xml.183 delete mode 100644 idea/resources/META-INF/extensions/ide.xml.as34 delete mode 100644 idea/resources/META-INF/git4idea.xml.as34 delete mode 100644 idea/resources/META-INF/gradle-java.xml.183 delete mode 100644 idea/resources/META-INF/gradle-java.xml.as34 delete mode 100644 idea/resources/META-INF/gradle.xml.183 delete mode 100644 idea/resources/META-INF/jvm.xml.183 delete mode 100644 idea/resources/META-INF/plugin.xml.183 delete mode 100644 idea/resources/META-INF/plugin.xml.as34 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as34 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/quickfix/expectactual/escapeXML.kt.183 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt.183 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as34 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.183 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/slicer/compat/nullability.kt.183 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as34 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as34 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as34 delete mode 100644 idea/testData/multiFileInspections/invalidBundleOrProperty/expected.xml.183 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/highlighter/duplicateHighlighting.kt.183 delete mode 100644 jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as34 delete mode 100644 plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as34 delete mode 100644 plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.183 delete mode 100644 plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as34 delete mode 100644 plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as34 delete mode 100644 plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.183 delete mode 100644 plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as34 delete mode 100644 plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as34 delete mode 100644 plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as34 delete mode 100644 plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as34 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/evaluation/KotlinEvaluatorExtension.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/ElvisExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinStringTemplateUPolyadicExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCallableReferenceExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUClassLiteralExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUQualifiedReferenceExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSwitchExpression.kt.183 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUTryExpression.kt.183 delete mode 100644 plugins/uast-kotlin/testData/Anonymous.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/testData/ClassAnnotation.altlog.txt.183 delete mode 100644 plugins/uast-kotlin/testData/ClassAnnotation.identifiers.txt.183 delete mode 100644 plugins/uast-kotlin/testData/ClassAnnotation.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/testData/Constructors.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/testData/InnerClasses.altlog.txt.183 delete mode 100644 plugins/uast-kotlin/testData/InnerClasses.splog.txt.183 delete mode 100644 plugins/uast-kotlin/testData/LocalDeclarations.altlog.txt.183 delete mode 100644 plugins/uast-kotlin/testData/LocalDeclarations.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/testData/ManyAlternatives.kt.183 delete mode 100644 plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.altlog.txt.183 delete mode 100644 plugins/uast-kotlin/testData/SimpleAnnotated.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt.183 delete mode 100644 plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.log.txt.183 delete mode 100644 plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.render.txt.183 delete mode 100644 plugins/uast-kotlin/testData/SuperCalls.refNames.txt.183 delete mode 100644 plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/AlternativesRenderLogTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/KotlinUastAlternativesTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/KotlinUastApiTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/KotlinUastReferencesTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/MultiplesRequiredTypesTest.kt.183 delete mode 100644 plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 delete mode 100644 tests/mute.csv.as34 diff --git a/buildSrc/gradle.properties.as34 b/buildSrc/gradle.properties.as34 deleted file mode 100644 index a2e24c7566f..00000000000 --- a/buildSrc/gradle.properties.as34 +++ /dev/null @@ -1,8 +0,0 @@ -org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 - -cacheRedirectorEnabled=true - -#buildSrc.kotlin.repo=https://jcenter.bintray.com -#buildSrc.kotlin.version=1.1.50 - -intellijUltimateEnabled=false diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as34 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as34 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.183 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.183 deleted file mode 100644 index a6d2a7575f0..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.183 +++ /dev/null @@ -1,57 +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.cli.jvm.compiler - -import com.intellij.codeInsight.ExternalAnnotationsManager -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.* - -class MockExternalAnnotationsManager : ExternalAnnotationsManager() { - override fun chooseAnnotationsPlace(element: PsiElement): AnnotationPlace? = null - - override fun isExternalAnnotationWritable(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean = false - override fun isExternalAnnotation(annotation: PsiAnnotation): Boolean = false - - override fun findExternalAnnotationsFiles(listOwner: PsiModifierListOwner): List? = null - override fun findExternalAnnotation(listOwner: PsiModifierListOwner, annotationFQN: String): PsiAnnotation? = null - override fun findExternalAnnotations(listOwner: PsiModifierListOwner): Array? = null - - override fun annotateExternally( - listOwner: PsiModifierListOwner, - annotationFQName: String, - fromFile: PsiFile, - value: Array? - ) { - throw UnsupportedOperationException("not implemented") - } - - override fun deannotate(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun editExternalAnnotation( - listOwner: PsiModifierListOwner, - annotationFQN: String, - value: Array? - ): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun hasAnnotationRootsForFile(file: VirtualFile): Boolean { - throw UnsupportedOperationException("not implemented") - } -} diff --git a/compiler/compiler.pro.183 b/compiler/compiler.pro.183 deleted file mode 100644 index 8c8934a0a67..00000000000 --- a/compiler/compiler.pro.183 +++ /dev/null @@ -1,272 +0,0 @@ --injars ''( -!org/apache/log4j/jmx/Agent*, -!org/apache/log4j/net/JMS*, -!org/apache/log4j/net/SMTP*, -!org/apache/log4j/or/jms/MessageRenderer*, -!org/jdom/xpath/Jaxen*, -!org/jline/builtins/ssh/**, -!org/mozilla/javascript/xml/impl/xmlbeans/**, -!net/sf/cglib/**, -!META-INF/maven**, -**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps, -META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF, -messages/**) - --outjars '' - --dontnote ** --dontwarn com.intellij.util.ui.IsRetina* --dontwarn com.intellij.util.RetinaImage* --dontwarn apple.awt.* --dontwarn dk.brics.automaton.* --dontwarn org.fusesource.** --dontwarn org.imgscalr.Scalr** --dontwarn org.xerial.snappy.SnappyBundleActivator --dontwarn com.intellij.util.CompressionUtil --dontwarn com.intellij.util.SnappyInitializer --dontwarn com.intellij.util.SVGLoader --dontwarn com.intellij.util.SVGLoader$MyTranscoder --dontwarn net.sf.cglib.** --dontwarn org.objectweb.asm.** # this is ASM3, the old version that we do not use --dontwarn com.sun.jna.NativeString --dontwarn com.sun.jna.WString --dontwarn com.intellij.psi.util.PsiClassUtil --dontwarn org.apache.hadoop.io.compress.* --dontwarn com.google.j2objc.annotations.Weak --dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionInputStream --dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionOutputStream --dontwarn com.google.common.util.concurrent.* --dontwarn org.apache.xerces.dom.** --dontwarn org.apache.xerces.util.** --dontwarn org.w3c.dom.ElementTraversal --dontwarn javaslang.match.annotation.Unapply --dontwarn javaslang.match.annotation.Patterns --dontwarn javaslang.* --dontwarn com.google.errorprone.** --dontwarn com.google.j2objc.** --dontwarn javax.crypto.** --dontwarn java.lang.invoke.MethodHandle --dontwarn org.jline.builtins.Nano$Buffer --dontwarn org.jetbrains.annotations.ReadOnly --dontwarn org.jetbrains.annotations.Mutable --dontwarn com.intellij.util.io.TarUtil --dontwarn com.intellij.util.io.Compressor$Tar --dontwarn org.slf4j.** - -# Annotations from intellijCore/annotations.jar that not presented in org.jetbrains.annotations --dontwarn org.jetbrains.annotations.Async* --dontwarn org.jetbrains.annotations.Nls$Capitalization - -# Nullability annotations used in Guava --dontwarn org.checkerframework.checker.nullness.compatqual.NullableDecl --dontwarn org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl --dontwarn org.checkerframework.checker.nullness.qual.Nullable --dontwarn org.checkerframework.checker.nullness.qual.MonotonicNonNull - -# Depends on apache batick which has lots of dependencies --dontwarn com.intellij.util.SVGLoader* --dontwarn org.apache.batik.script.rhino.RhinoInterpreter --dontwarn org.apache.batik.script.rhino.RhinoInterpreterFactory - -# The appropriate jar is either loaded separately or added explicitly to the classpath then needed --dontwarn org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar - --dontwarn org.jdom.xpath.jaxen.* --dontwarn com.intellij.util.io.Decompressor* --dontwarn org.w3c.dom.Location --dontwarn org.w3c.dom.Window - - -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' - --dontoptimize --dontobfuscate - --keep class org.fusesource.** { *; } --keep class com.sun.jna.** { *; } - --keep class org.jetbrains.annotations.** { - public protected *; -} - --keep class javax.inject.** { - public protected *; -} - --keep class org.jetbrains.kotlin.** { - public protected *; -} - --keep class org.jetbrains.kotlin.compiler.plugin.** { - public protected *; -} - --keep class org.jetbrains.kotlin.extensions.** { - public protected *; -} - --keep class org.jetbrains.kotlin.protobuf.** { - public protected *; -} - --keep class org.jetbrains.kotlin.container.** { *; } - --keep class org.jetbrains.org.objectweb.asm.Opcodes { *; } - --keep class org.jetbrains.kotlin.codegen.extensions.** { - public protected *; -} - --keepclassmembers class com.intellij.openapi.vfs.VirtualFile { - public protected *; -} - --keep class com.intellij.openapi.vfs.StandardFileSystems { - public static *; -} - -# needed for jar cache cleanup in the gradle plugin and compile daemon --keepclassmembers class com.intellij.openapi.vfs.impl.ZipHandler { - public static void clearFileAccessorCache(); -} - --keep class jet.** { - public protected *; -} - --keep class com.intellij.psi.** { - public protected *; -} - -# This is needed so that the platform code which parses XML wouldn't fail, see KT-16968 -# This API is used from org.jdom.input.SAXBuilder via reflection. --keep class org.jdom.input.JAXPParserFactory { public ** createParser(...); } -# Without this class PluginManagerCore.loadDescriptorFromJar fails --keep class org.jdom.output.XMLOutputter { *; } - -# for kdoc & dokka --keep class com.intellij.openapi.util.TextRange { *; } --keep class com.intellij.lang.impl.PsiBuilderImpl* { - public protected *; -} --keep class com.intellij.openapi.util.text.StringHash { *; } - -# for j2k --keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; } - -# for gradle (see KT-12549) --keep class com.intellij.lang.properties.charset.Native2AsciiCharsetProvider { *; } - -# for kotlin-build-common (consider repacking compiler together with kotlin-build-common and remove this part afterwards) --keep class com.intellij.util.io.IOUtil { public *; } --keep class com.intellij.openapi.util.io.FileUtil { public *; } --keep class com.intellij.util.SystemProperties { public *; } --keep class com.intellij.util.containers.hash.LinkedHashMap { *; } --keep class com.intellij.util.containers.ConcurrentIntObjectMap { *; } --keep class com.intellij.util.containers.ComparatorUtil { *; } --keep class com.intellij.util.io.PersistentHashMapValueStorage { *; } --keep class com.intellij.util.io.PersistentHashMap { *; } --keep class com.intellij.util.io.BooleanDataDescriptor { *; } --keep class com.intellij.util.io.EnumeratorStringDescriptor { *; } --keep class com.intellij.util.io.ExternalIntegerKeyDescriptor { *; } --keep class com.intellij.util.containers.hash.EqualityPolicy { *; } --keep class com.intellij.util.containers.hash.EqualityPolicy.* { *; } --keep class com.intellij.util.containers.Interner { *; } --keep class gnu.trove.TIntHashSet { *; } --keep class gnu.trove.TIntIterator { *; } --keep class org.iq80.snappy.SlowMemory { *; } --keep class javaslang.match.PatternsProcessor { *; } - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keepclassmembers class * { - ** toString(); - ** hashCode(); - void start(); - void stop(); - void dispose(); -} - --keep class org.jetbrains.org.objectweb.asm.tree.AnnotationNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.ClassNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.LocalVariableNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.MethodNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.FieldNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.ParameterNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.TypeAnnotationNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.InsnList { *; } - --keep class org.jetbrains.org.objectweb.asm.signature.SignatureReader { *; } --keep class org.jetbrains.org.objectweb.asm.signature.SignatureVisitor { *; } - --keep class org.jetbrains.org.objectweb.asm.Type { - public protected *; -} - --keepclassmembers class org.jetbrains.org.objectweb.asm.ClassReader { - *** SKIP_CODE; - *** SKIP_DEBUG; - *** SKIP_FRAMES; -} - --keepclassmembers class com.intellij.openapi.project.Project { - ** getBasePath(); -} - -# for kotlin-android-extensions in maven --keep class com.intellij.openapi.module.ModuleServiceManager { public *; } - -# for building kotlin-build-common-test --keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; } - -# for tools.jar --keep class com.sun.tools.javac.** { *; } --keep class com.sun.source.** { *; } - -# for coroutines --keep class kotlinx.coroutines.** { *; } - -# for webdemo --keep class com.intellij.openapi.progress.ProgressManager { *; } - -# for kapt --keep class com.intellij.openapi.project.Project { *; } --keepclassmembers class com.intellij.util.PathUtil { - public static java.lang.String getJarPathForClass(java.lang.Class); -} - --keepclassmembers class com.intellij.util.PathUtil { - public static java.lang.String getJarPathForClass(java.lang.Class); -} - -# remove when KT-18563 would be fixed --keep class org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt { *; } - --keep class net.jpountz.lz4.* { *; } - -# used in LazyScriptDescriptor --keep class org.jetbrains.kotlin.utils.addToStdlib.AddToStdlibKt { *; } - --keep class com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem { *; } - -# used in REPL -# TODO: pack jline directly to scripting-compiler jars instead --keep class org.jline.reader.LineReaderBuilder { *; } --keep class org.jline.reader.LineReader { *; } --keep class org.jline.reader.History { *; } --keep class org.jline.reader.EndOfFileException { *; } --keep class org.jline.reader.UserInterruptException { *; } --keep class org.jline.terminal.impl.jna.JnaSupportImpl { *; } --keep class org.jline.terminal.impl.jansi.JansiSupportImpl { *; } - --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; -} diff --git a/compiler/compiler.pro.as34 b/compiler/compiler.pro.as34 deleted file mode 100644 index 77149cf4281..00000000000 --- a/compiler/compiler.pro.as34 +++ /dev/null @@ -1,272 +0,0 @@ --injars ''( -!org/apache/log4j/jmx/Agent*, -!org/apache/log4j/net/JMS*, -!org/apache/log4j/net/SMTP*, -!org/apache/log4j/or/jms/MessageRenderer*, -!org/jdom/xpath/Jaxen*, -!org/jline/builtins/ssh/**, -!org/mozilla/javascript/xml/impl/xmlbeans/**, -!net/sf/cglib/**, -!META-INF/maven**, -**.class,**.properties,**.kt,**.kotlin_*,**.jnilib,**.so,**.dll,**.txt,**.caps, -META-INF/services/**,META-INF/native/**,META-INF/extensions/**,META-INF/MANIFEST.MF, -messages/**) - --outjars '' - --dontnote ** --dontwarn com.intellij.util.ui.IsRetina* --dontwarn com.intellij.util.ui.UIUtilities --dontwarn com.intellij.util.RetinaImage* --dontwarn apple.awt.* --dontwarn dk.brics.automaton.* --dontwarn org.fusesource.** --dontwarn org.imgscalr.Scalr** --dontwarn org.xerial.snappy.SnappyBundleActivator --dontwarn com.intellij.util.CompressionUtil --dontwarn com.intellij.util.SnappyInitializer --dontwarn com.intellij.util.SVGLoader --dontwarn com.intellij.util.SVGLoader$MyTranscoder --dontwarn net.sf.cglib.** --dontwarn org.objectweb.asm.** # this is ASM3, the old version that we do not use --dontwarn com.sun.jna.NativeString --dontwarn com.sun.jna.WString --dontwarn com.intellij.psi.util.PsiClassUtil --dontwarn org.apache.hadoop.io.compress.* --dontwarn com.google.j2objc.annotations.Weak --dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionInputStream --dontwarn org.iq80.snappy.HadoopSnappyCodec$SnappyCompressionOutputStream --dontwarn com.google.common.util.concurrent.* --dontwarn org.apache.xerces.dom.** --dontwarn org.apache.xerces.util.** --dontwarn org.w3c.dom.ElementTraversal --dontwarn javaslang.match.annotation.Unapply --dontwarn javaslang.match.annotation.Patterns --dontwarn javaslang.* --dontwarn com.google.errorprone.** --dontwarn com.google.j2objc.** --dontwarn javax.crypto.** --dontwarn java.lang.invoke.MethodHandle --dontwarn org.jline.builtins.Nano$Buffer --dontwarn org.jetbrains.annotations.ReadOnly --dontwarn org.jetbrains.annotations.Mutable --dontwarn com.intellij.util.io.TarUtil --dontwarn com.intellij.util.io.Compressor$Tar --dontwarn org.slf4j.** - -# Annotations from intellijCore/annotations.jar that not presented in org.jetbrains.annotations --dontwarn org.jetbrains.annotations.Async* --dontwarn org.jetbrains.annotations.Nls$Capitalization - -# Nullability annotations used in Guava --dontwarn org.checkerframework.checker.nullness.compatqual.NullableDecl --dontwarn org.checkerframework.checker.nullness.compatqual.MonotonicNonNullDecl --dontwarn org.checkerframework.checker.nullness.qual.Nullable --dontwarn org.checkerframework.checker.nullness.qual.MonotonicNonNull - -# Depends on apache batick which has lots of dependencies --dontwarn com.intellij.util.SVGLoader* --dontwarn org.apache.batik.script.rhino.RhinoInterpreter --dontwarn org.apache.batik.script.rhino.RhinoInterpreterFactory - -# The appropriate jar is either loaded separately or added explicitly to the classpath then needed --dontwarn org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar - --dontwarn org.jdom.xpath.jaxen.* --dontwarn com.intellij.util.io.Decompressor* --dontwarn org.w3c.dom.Location --dontwarn org.w3c.dom.Window - - -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' -#-libraryjars '' - --dontoptimize --dontobfuscate - --keep class org.fusesource.** { *; } --keep class com.sun.jna.** { *; } - --keep class org.jetbrains.annotations.** { - public protected *; -} - --keep class javax.inject.** { - public protected *; -} - --keep class org.jetbrains.kotlin.** { - public protected *; -} - --keep class org.jetbrains.kotlin.compiler.plugin.** { - public protected *; -} - --keep class org.jetbrains.kotlin.extensions.** { - public protected *; -} - --keep class org.jetbrains.kotlin.protobuf.** { - public protected *; -} - --keep class org.jetbrains.kotlin.container.** { *; } - --keep class org.jetbrains.org.objectweb.asm.Opcodes { *; } - --keep class org.jetbrains.kotlin.codegen.extensions.** { - public protected *; -} - --keepclassmembers class com.intellij.openapi.vfs.VirtualFile { - public protected *; -} - --keep class com.intellij.openapi.vfs.StandardFileSystems { - public static *; -} - -# needed for jar cache cleanup in the gradle plugin and compile daemon --keepclassmembers class com.intellij.openapi.vfs.impl.ZipHandler { - public static void clearFileAccessorCache(); -} - --keep class jet.** { - public protected *; -} - --keep class com.intellij.psi.** { - public protected *; -} - -# This is needed so that the platform code which parses XML wouldn't fail, see KT-16968 -# This API is used from org.jdom.input.SAXBuilder via reflection. --keep class org.jdom.input.JAXPParserFactory { public ** createParser(...); } -# Without this class PluginManagerCore.loadDescriptorFromJar fails --keep class org.jdom.output.XMLOutputter { *; } - -# for kdoc & dokka --keep class com.intellij.openapi.util.TextRange { *; } --keep class com.intellij.lang.impl.PsiBuilderImpl* { - public protected *; -} --keep class com.intellij.openapi.util.text.StringHash { *; } - -# for j2k --keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; } - -# for gradle (see KT-12549) --keep class com.intellij.lang.properties.charset.Native2AsciiCharsetProvider { *; } - -# for kotlin-build-common (consider repacking compiler together with kotlin-build-common and remove this part afterwards) --keep class com.intellij.util.io.IOUtil { public *; } --keep class com.intellij.openapi.util.io.FileUtil { public *; } --keep class com.intellij.util.SystemProperties { public *; } --keep class com.intellij.util.containers.hash.LinkedHashMap { *; } --keep class com.intellij.util.containers.ConcurrentIntObjectMap { *; } --keep class com.intellij.util.containers.ComparatorUtil { *; } --keep class com.intellij.util.io.PersistentHashMapValueStorage { *; } --keep class com.intellij.util.io.PersistentHashMap { *; } --keep class com.intellij.util.io.BooleanDataDescriptor { *; } --keep class com.intellij.util.io.EnumeratorStringDescriptor { *; } --keep class com.intellij.util.io.ExternalIntegerKeyDescriptor { *; } --keep class com.intellij.util.containers.hash.EqualityPolicy { *; } --keep class com.intellij.util.containers.hash.EqualityPolicy.* { *; } --keep class com.intellij.util.containers.Interner { *; } --keep class gnu.trove.TIntHashSet { *; } --keep class gnu.trove.TIntIterator { *; } --keep class org.iq80.snappy.SlowMemory { *; } --keep class javaslang.match.PatternsProcessor { *; } - --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} - --keepclassmembers class * { - ** toString(); - ** hashCode(); - void start(); - void stop(); - void dispose(); -} - --keep class org.jetbrains.org.objectweb.asm.tree.AnnotationNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.ClassNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.LocalVariableNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.MethodNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.FieldNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.ParameterNode { *; } --keep class org.jetbrains.org.objectweb.asm.tree.TypeAnnotationNode { *; } - --keep class org.jetbrains.org.objectweb.asm.signature.SignatureReader { *; } --keep class org.jetbrains.org.objectweb.asm.signature.SignatureVisitor { *; } - --keep class org.jetbrains.org.objectweb.asm.Type { - public protected *; -} - --keepclassmembers class org.jetbrains.org.objectweb.asm.ClassReader { - *** SKIP_CODE; - *** SKIP_DEBUG; - *** SKIP_FRAMES; -} - --keepclassmembers class com.intellij.openapi.project.Project { - ** getBasePath(); -} - -# for kotlin-android-extensions in maven --keep class com.intellij.openapi.module.ModuleServiceManager { public *; } - -# for building kotlin-build-common-test --keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; } - -# for tools.jar --keep class com.sun.tools.javac.** { *; } --keep class com.sun.source.** { *; } - -# for coroutines --keep class kotlinx.coroutines.** { *; } - -# for webdemo --keep class com.intellij.openapi.progress.ProgressManager { *; } - -# for kapt --keep class com.intellij.openapi.project.Project { *; } --keepclassmembers class com.intellij.util.PathUtil { - public static java.lang.String getJarPathForClass(java.lang.Class); -} - --keepclassmembers class com.intellij.util.PathUtil { - public static java.lang.String getJarPathForClass(java.lang.Class); -} - -# remove when KT-18563 would be fixed --keep class org.jetbrains.kotlin.psi.psiUtil.PsiUtilsKt { *; } - --keep class net.jpountz.lz4.* { *; } - -# used in LazyScriptDescriptor --keep class org.jetbrains.kotlin.utils.addToStdlib.AddToStdlibKt { *; } - --keep class com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem { *; } - -# used in REPL -# TODO: pack jline directly to scripting-compiler jars instead --keep class org.jline.reader.LineReaderBuilder { *; } --keep class org.jline.reader.LineReader { *; } --keep class org.jline.reader.History { *; } --keep class org.jline.reader.EndOfFileException { *; } --keep class org.jline.reader.UserInterruptException { *; } --keep class org.jline.terminal.impl.jna.JnaSupportImpl { *; } --keep class org.jline.terminal.impl.jansi.JansiSupportImpl { *; } - --keepclassmembers class * implements java.io.Serializable { - static final long serialVersionUID; -} diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt.183 b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt.183 deleted file mode 100644 index 15723a66689..00000000000 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaElementFinder.kt.183 +++ /dev/null @@ -1,284 +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.fir.java - -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Pair -import com.intellij.psi.* -import com.intellij.psi.impl.cache.ModifierFlags -import com.intellij.psi.impl.compiled.ClsClassImpl -import com.intellij.psi.impl.compiled.ClsFileImpl -import com.intellij.psi.impl.file.PsiPackageImpl -import com.intellij.psi.impl.java.stubs.* -import com.intellij.psi.impl.java.stubs.impl.* -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.stubs.StubElement -import com.intellij.util.ArrayUtil -import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.psi -import org.jetbrains.kotlin.fir.resolve.firProvider -import org.jetbrains.kotlin.fir.resolve.fullyExpandedType -import org.jetbrains.kotlin.fir.resolve.toSymbol -import org.jetbrains.kotlin.fir.resolve.transformers.resolveSupertypesInTheAir -import org.jetbrains.kotlin.fir.symbols.StandardClassIds -import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol -import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType -import org.jetbrains.kotlin.resolve.jvm.KotlinFinderMarker - -class FirJavaElementFinder( - private val session: FirSession, - project: Project -) : PsiElementFinder(), KotlinFinderMarker { - private val psiManager = PsiManager.getInstance(project) - private val firProvider = session.firProvider - - override fun findPackage(qualifiedName: String): PsiPackage? { - if (firProvider.getClassNamesInPackage(FqName(qualifiedName)).isEmpty()) return null - return PsiPackageImpl(psiManager, qualifiedName) - } - - override fun getClasses(psiPackage: PsiPackage, scope: GlobalSearchScope): Array { - return firProvider - .getClassNamesInPackage(FqName(psiPackage.qualifiedName)) - .mapNotNull { findClass(psiPackage.qualifiedName + "." + it.identifier, scope) } - .toTypedArray() - } - - override fun findClasses(qualifiedName: String, scope: GlobalSearchScope): Array { - return findClass(qualifiedName, scope)?.let(::arrayOf) ?: emptyArray() - } - - override fun findClass(qualifiedName: String, scope: GlobalSearchScope): PsiClass? { - if (qualifiedName.endsWith(".")) return null - val classId = ClassId.topLevel(FqName(qualifiedName)) - - val firClass = - firProvider.getFirClassifierByFqName(classId) as? FirRegularClass - ?: return null - - val ktFile = firClass.psi?.containingFile as? KtFile ?: return null - val fileStub = createJavaFileStub(classId.packageFqName, listOf(ktFile)) - - return buildStub(firClass, fileStub).psi - } - - private fun buildStub(firClass: FirRegularClass, parent: StubElement<*>): PsiClassStub<*> { - val classId = firClass.classId - val stub = PsiClassStubImpl( - JavaStubElementTypes.CLASS, parent, classId.asSingleFqName().asString(), firClass.name.identifier, null, - PsiClassStubImpl.packFlags( - false, - firClass.classKind == ClassKind.INTERFACE, - firClass.classKind == ClassKind.ENUM_CLASS, false, false, - firClass.classKind == ClassKind.ANNOTATION_CLASS, false, false, - false, false - ) - ) - - PsiModifierListStubImpl(stub, firClass.packFlags()) - - newTypeParameterList( - stub, - firClass.typeParameters.map { Pair(it.name.asString(), arrayOf(CommonClassNames.JAVA_LANG_OBJECT)) } - ) - - val superTypeRefs = when { - firClass.resolvePhase > FirResolvePhase.SUPER_TYPES -> firClass.superTypeRefs - else -> firClass.resolveSupertypesInTheAir(session) - } - - stub.addSupertypesReferencesLists(firClass, superTypeRefs, session) - - for (nestedClass in firClass.declarations.filterIsInstance()) { - buildStub(nestedClass, stub) - } - - return stub - } - -} - -private fun FirRegularClass.packFlags(): Int { - var flags = when (visibility) { - Visibilities.PRIVATE -> ModifierFlags.PRIVATE_MASK - Visibilities.PROTECTED -> ModifierFlags.PROTECTED_MASK - Visibilities.PUBLIC -> ModifierFlags.PUBLIC_MASK - else -> ModifierFlags.PACKAGE_LOCAL_MASK - } - - flags = flags or when (modality) { - Modality.FINAL -> ModifierFlags.FINAL_MASK - Modality.ABSTRACT -> ModifierFlags.ABSTRACT_MASK - else -> 0 - } - - if (classId.isNestedClass && !isInner) { - flags = flags or ModifierFlags.STATIC_MASK - } - - return flags -} - -private fun PsiClassStubImpl<*>.addSupertypesReferencesLists( - firRegularClass: FirRegularClass, - superTypeRefs: List, - session: FirSession -) { - require(superTypeRefs.all { it is FirResolvedTypeRef }) { - "Supertypes for light class $qualifiedName are being added too early" - } - - val isInterface = firRegularClass.classKind == ClassKind.INTERFACE - - val interfaceNames = mutableListOf() - var superName: String? = null - - for (superTypeRef in superTypeRefs) { - val superConeType = superTypeRef.coneTypeSafe() ?: continue - val supertypeFirClass = superConeType.toFirClass(session) ?: continue - - val canonicalString = superConeType.mapToCanonicalString(session) - - if (isInterface || supertypeFirClass.classKind == ClassKind.INTERFACE) { - interfaceNames.add(canonicalString) - } else { - superName = canonicalString - } - } - - if (this.isInterface) { - if (interfaceNames.isNotEmpty() && this.isAnnotationType) { - interfaceNames.remove(CommonClassNames.JAVA_LANG_ANNOTATION_ANNOTATION) - } - newReferenceList(JavaStubElementTypes.EXTENDS_LIST, this, ArrayUtil.toStringArray(interfaceNames)) - newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, this, ArrayUtil.EMPTY_STRING_ARRAY) - } else { - if (superName == null || "java/lang/Object" == superName || this.isEnum && "java/lang/Enum" == superName) { - newReferenceList(JavaStubElementTypes.EXTENDS_LIST, this, ArrayUtil.EMPTY_STRING_ARRAY) - } else { - newReferenceList(JavaStubElementTypes.EXTENDS_LIST, this, arrayOf(superName)) - } - newReferenceList(JavaStubElementTypes.IMPLEMENTS_LIST, this, ArrayUtil.toStringArray(interfaceNames)) - } - -} - -private fun newReferenceList(type: JavaClassReferenceListElementType, parent: StubElement<*>, types: Array) { - PsiClassReferenceListStubImpl(type, parent, types) -} - -private fun newTypeParameterList(parent: StubElement<*>, parameters: List>>) { - val listStub = PsiTypeParameterListStubImpl(parent) - for (parameter in parameters) { - val parameterStub = PsiTypeParameterStubImpl(listStub, parameter.first) - newReferenceList(JavaStubElementTypes.EXTENDS_BOUND_LIST, parameterStub, parameter.second) - } -} - -private fun createJavaFileStub(packageFqName: FqName, files: Collection): PsiJavaFileStub { - val javaFileStub = PsiJavaFileStubImpl(packageFqName.asString(), /*compiled = */true) - javaFileStub.psiFactory = ClsStubPsiFactory.INSTANCE - - val fakeFile = object : ClsFileImpl(files.first().viewProvider) { - override fun getStub() = javaFileStub - - override fun getPackageName() = packageFqName.asString() - - override fun isPhysical() = false - - override fun getText(): String { - return files.singleOrNull()?.text ?: super.getText() - } - } - - javaFileStub.psi = fakeFile - return javaFileStub -} - -private fun ConeClassLikeType.toFirClass(session: FirSession): FirRegularClass? { - val expandedType = this.fullyExpandedType(session) - return (expandedType.lookupTag.toSymbol(session) as? FirClassSymbol)?.fir as? FirRegularClass -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// JVM TYPE MAPPING -// TODO: reuse other type mapping implementations when possible -/////////////////////////////////////////////////////////////////////////////////////////////////////////////// -private const val ERROR_TYPE_STUB = CommonClassNames.JAVA_LANG_OBJECT - -private fun ConeKotlinType.mapToCanonicalString(session: FirSession): String { - return when (this) { - is ConeClassLikeType -> mapToCanonicalString(session) - is ConeTypeVariableType, is ConeFlexibleType, is ConeCapturedType, - is ConeDefinitelyNotNullType, is ConeIntersectionType, is ConeStubType, is ConeIntegerLiteralType -> - error("Unexpected type: $this [${this::class}]") - is ConeLookupTagBasedType -> lookupTag.name.asString() - } -} - -private fun ConeClassLikeType.mapToCanonicalString(session: FirSession): String { - return when (this) { - is ConeClassErrorType -> ERROR_TYPE_STUB - else -> fullyExpandedType(session).mapToCanonicalNoExpansionString(session) - } -} - -private fun ConeClassLikeType.mapToCanonicalNoExpansionString(session: FirSession): String { - if (lookupTag.classId == StandardClassIds.Array) { - return when (val typeProjection = typeArguments[0]) { - is ConeStarProjection -> CommonClassNames.JAVA_LANG_OBJECT - is ConeTypedProjection -> { - if (typeProjection.kind == ProjectionKind.IN) - CommonClassNames.JAVA_LANG_VOID - else - (typeProjection.type as ConeClassLikeType).mapToCanonicalString(session) - } - else -> ERROR_TYPE_STUB - } + "[]" - } - - val context = ConeTypeCheckerContext(isErrorTypeEqualsToAnything = false, isStubTypeEqualsToAnything = true, session = session) - - with(context) { - val typeConstructor = typeConstructor() - typeConstructor.getPrimitiveType()?.let { return JvmPrimitiveType.get(it).wrapperFqName.asString() } - typeConstructor.getPrimitiveArrayType()?.let { return JvmPrimitiveType.get(it).javaKeywordName + "[]" } - val kotlinClassFqName = typeConstructor.getClassFqNameUnsafe() ?: return ERROR_TYPE_STUB - val mapped = JavaToKotlinClassMap.mapKotlinToJava(kotlinClassFqName)?.asSingleFqName() ?: kotlinClassFqName - - return mapped.toString() + - typeArguments.takeIf { it.isNotEmpty() } - ?.joinToString(separator = ", ", prefix = "<", postfix = ">") { it.mapToCanonicalString(session) } - .orEmpty() - } - -} - -private fun ConeKotlinTypeProjection.mapToCanonicalString(session: FirSession): String { - return when (this) { - is ConeStarProjection -> "?" - is ConeTypedProjection -> { - val wildcard = when (kind) { - ProjectionKind.STAR -> error("Should be handled in the case above") - ProjectionKind.IN -> "? super " - ProjectionKind.OUT -> "? extends " - ProjectionKind.INVARIANT -> "" - } - - wildcard + type.mapToCanonicalString(session) - } - else -> ERROR_TYPE_STUB - } -} diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.183 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.183 deleted file mode 100644 index b0674ae9669..00000000000 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.183 +++ /dev/null @@ -1,1381 +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.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.asJava.classes.AbstractUltraLightClassLoadingTest -import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightClassSanityTest -import org.jetbrains.kotlin.asJava.classes.AbstractUltraLightFacadeClassTest -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.tests.generator.TestGroup -import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix -import org.jetbrains.kotlin.generators.tests.generator.testGroup -import org.jetbrains.kotlin.generators.util.KT_OR_KTS -import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.generators.util.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.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.fir.AbstractFirMultiModuleResolveTest -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.maven.AbstractKotlinMavenInspectionTest -import org.jetbrains.kotlin.idea.maven.configuration.AbstractMavenConfigureProjectByChangingFileTest -import org.jetbrains.kotlin.idea.navigation.* -import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest -import org.jetbrains.kotlin.idea.perf.* -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.AbstractScriptConfigurationCompletionTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationHighlightingTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationNavigationTest -import org.jetbrains.kotlin.idea.script.AbstractScriptDefinitionsOrderTest -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.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.build.dependeciestxt.actualizeMppJpsIncTestCaseDirs -import org.jetbrains.kotlin.jps.incremental.AbstractJsProtoComparisonTest -import org.jetbrains.kotlin.jps.incremental.AbstractJvmProtoComparisonTest -import org.jetbrains.kotlin.jvm.abi.AbstractCompareJvmAbiTest -import org.jetbrains.kotlin.jvm.abi.AbstractCompileAgainstJvmAbiTest -import org.jetbrains.kotlin.jvm.abi.AbstractJvmAbiContentTest -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.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg -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.kotlin.tools.projectWizard.cli.AbstractBuildFileGenerationTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - 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/stepOverForce", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverForceTest") - 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("checker", recursive = false) - model("checker/regression") - model("checker/recovery") - model("checker/rendering") - model("checker/duplicateJvmSignature") - model("checker/infos") - model("checker/diagnosticsMessage") - } - - testClass { - model("kotlinAndJavaChecker/javaAgainstKotlin") - model("kotlinAndJavaChecker/javaWithKotlin") - } - - 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(annotations = listOf(muteExtraSuffix(".libsrc"))) { - model("decompiler/navigation/usercode") - } - - testClass(annotations = listOf(muteExtraSuffix(".libsrcjs"))) { - 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") - } - - 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/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", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", - testMethod = "doTestInverted", testClassName = "FormatterInverted") - } - - 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("multiModuleHighlighting/hierarchicalExpectActualMatching/", 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", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - } - - 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("fir/multiModule", recursive = false, extension = null) - } - } - - 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", pattern = KT_OR_KTS) - } - testClass { - model("asJava/ultraLightClasses", pattern = KT_OR_KTS) - } - - testClass { - model("asJava/ultraLightFacades", pattern = KT_OR_KTS) - } - - 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) - } - } - - testGroup( - "libraries/tools/new-project-wizard/new-project-wizard-cli/tests", - "libraries/tools/new-project-wizard/new-project-wizard-cli/testData" - ) { - testClass { - model("buildFileGeneration", 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) - } - } - - testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") { - testClass { - model("incremental/multiModule/common", extension = null, excludeParentDirs = true) - model("incremental/multiModule/jvm", extension = null, excludeParentDirs = true) - model("incremental/multiModule/multiplatform/custom", extension = null, excludeParentDirs = true) - model("incremental/pureKotlin", extension = null, recursive = false) - model("incremental/withJava", extension = null, excludeParentDirs = true) - model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true) - model("incremental/classHierarchyAffected", extension = null, excludeParentDirs = true) - } - - actualizeMppJpsIncTestCaseDirs(testDataRoot, "incremental/multiModule/multiplatform/withGeneratedContent") - - testClass { - model("incremental/multiModule/common", extension = null, excludeParentDirs = true) - } - - testClass { - model( - "incremental/multiModule/multiplatform/withGeneratedContent", extension = null, excludeParentDirs = true, - testClassName = "MultiplatformMultiModule", recursive = true - ) - } - - testClass { - model("incremental/lookupTracker/jvm", extension = null, recursive = false) - } - testClass { - model("incremental/lookupTracker/js", extension = null, recursive = false) - } - - testClass { - model("incremental/lazyKotlinCaches", extension = null, excludeParentDirs = true) - model("incremental/changeIncrementalOption", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true) - } - - testClass { - model("incremental/cacheVersionChanged", extension = null, excludeParentDirs = true) - } - } - - testGroup("jps-plugin/jps-tests/test", "jps-plugin/testData") { - fun TestGroup.TestClass.commonProtoComparisonTests() { - model("comparison/classSignatureChange", extension = null, excludeParentDirs = true) - model("comparison/classPrivateOnlyChange", extension = null, excludeParentDirs = true) - model("comparison/classMembersOnlyChanged", extension = null, excludeParentDirs = true) - model("comparison/packageMembers", extension = null, excludeParentDirs = true) - model("comparison/unchanged", extension = null, excludeParentDirs = true) - } - - testClass { - commonProtoComparisonTests() - model("comparison/jvmOnly", extension = null, excludeParentDirs = true) - } - - testClass { - commonProtoComparisonTests() - model("comparison/jsOnly", extension = null, excludeParentDirs = true) - } - } - - 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(annotations = listOf(muteExtraSuffix(".jsklib"))) { - 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/singleModule/common", extension = null, excludeParentDirs = true) - } - testClass { - model("incremental/singleModule/common", 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/jvm-abi-gen/test", "plugins/jvm-abi-gen/testData") { - testClass { - model("compare", recursive = false, extension = null) - } - - testClass { - model("content", recursive = false, extension = null) - } - - testClass { - model("compile", recursive = false, extension = null) - } - } - - 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") - } - } - - testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - } - - 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("idea/performanceTests", "idea/testData") { - testClass { - model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""") - } - - testClass { - model("copyPaste/conversion", testMethod = "doPerfTest", pattern = """^([^\.]+)\.java$""") - } - - testClass { - model("copyPaste/literal", testMethod = "doPerfTest", pattern = """^([^\.]+)\.kt$""") - } - - testClass { - model("highlighter", testMethod = "doPerfTest") - } - - testClass { - model("addImport", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - - } - - testGroup("idea/performanceTests", "idea/idea-completion/testData") { - testClass { - model("incrementalResolve", testMethod = "doPerfTest") - } - - testClass { - model("handlers/basic", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - - testClass { - model("handlers/smart", testMethod = "doPerfTest") - } - - testClass { - model("handlers/keywords", testMethod = "doPerfTest") - } - - testClass { - model("handlers/charFilter", testMethod = "doPerfTest", pattern = KT_WITHOUT_DOTS_IN_NAME) - } - } -/* - 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/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as34 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as34 deleted file mode 100644 index 399e7858931..00000000000 --- a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as34 +++ /dev/null @@ -1,1232 +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.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.tests.generator.TestGroup -import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix -import org.jetbrains.kotlin.generators.tests.generator.testGroup -import org.jetbrains.kotlin.generators.util.KT_OR_KTS -import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME -import org.jetbrains.kotlin.generators.util.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.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.fir.AbstractFirMultiModuleResolveTest -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.AbstractScriptConfigurationCompletionTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationHighlightingTest -import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationNavigationTest -import org.jetbrains.kotlin.idea.script.AbstractScriptDefinitionsOrderTest -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.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.AbstractBlackBoxCodegenTestForNoArg -import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg -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.kotlin.tools.projectWizard.cli.AbstractBuildFileGenerationTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest -import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - 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/stepOverForce", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverForceTest") - 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("checker", recursive = false) - model("checker/regression") - model("checker/recovery") - model("checker/rendering") - model("checker/duplicateJvmSignature") - model("checker/infos") - 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(annotations = listOf(muteExtraSuffix(".libsrc"))) { - model("decompiler/navigation/usercode") - } - - testClass(annotations = listOf(muteExtraSuffix(".libsrcjs"))) { - 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") - } - - 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/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", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", - testMethod = "doTestInverted", testClassName = "FormatterInverted") - } - - 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("multiModuleHighlighting/hierarchicalExpectActualMatching/", 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", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - - testClass { - model("slicer/inflow", singleClass = true) - } - } - - 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("fir/multiModule", recursive = false, extension = null) - } - } - - /* - // 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) - } - } - - testGroup( - "libraries/tools/new-project-wizard/new-project-wizard-cli/tests", - "libraries/tools/new-project-wizard/new-project-wizard-cli/testData" - ) { - testClass { - model("buildFileGeneration", 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/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") - } - } - - testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { - testClass { - model("bytecodeListing", extension = "kt") - } - - testClass { - model("box", targetBackend = TargetBackend.JVM) - } - } - - 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/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.properties.as34 b/gradle.properties.as34 deleted file mode 100644 index 3530b13c2e9..00000000000 --- a/gradle.properties.as34 +++ /dev/null @@ -1,23 +0,0 @@ -org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 - -cacheRedirectorEnabled=true - -kotlin.compiler.effectSystemEnabled=true -kotlin.compiler.newInferenceEnabled=true -#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/ -#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev -#bootstrap.kotlin.version=1.1.50-dev-1451 -#signingRequired=true - -intellijUltimateEnabled=false - -## The following properties can be added to your local.properties file to customize the build: - -#jpsBuild=true -#cidrPluginsEnabled=true - -## Used for compare gradle and jps build - -#kotlin.build.postprocessing=false -#kotlin.build.java9=false -#kotlin.build.useBootstrapStdlib=true \ No newline at end of file diff --git a/gradle/versions.properties.183 b/gradle/versions.properties.183 deleted file mode 100644 index bcb212351b7..00000000000 --- a/gradle/versions.properties.183 +++ /dev/null @@ -1,15 +0,0 @@ -versions.intellijSdk=183.6156.11 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=181.3494.12 -versions.jar.guava=25.1-jre -versions.jar.groovy-all=2.4.15 -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.6.7 -versions.jar.gson=2.8.5 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -versions.jar.asm-all=7.0 -ignore.jar.snappy-in-java=true -versions.gradle-api=4.5.1 diff --git a/gradle/versions.properties.as34 b/gradle/versions.properties.as34 deleted file mode 100644 index 2dc862f4061..00000000000 --- a/gradle/versions.properties.as34 +++ /dev/null @@ -1,19 +0,0 @@ -versions.intellijSdk=183.4284.36 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=181.3494.12 -versions.androidStudioRelease=3.4.0.4 -versions.androidStudioBuild=183.5141831 -versions.jar.guava=25.1-jre -versions.jar.groovy-all=2.4.15 -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.6.7 -versions.jar.gson=2.8.5 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -ignore.jar.snappy-in-java=true -ignore.jar.common=true -ignore.jar.lombok-ast=true -versions.jar.asm-all=7.0 -versions.gradle-api=4.5.1 diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.183 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.183 deleted file mode 100644 index 4e712eb4fe7..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.183 +++ /dev/null @@ -1,17 +0,0 @@ -package org.jetbrains.kotlin.idea.caches.project - -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiElement - - -// NO-OP implementation, full implementation only for AS3.3, AS3.4 - -fun collectModuleInfoByUserData( - project: Project, - virtualFile: VirtualFile -): List = emptyList() - -fun collectModuleInfoByUserData( - psiElement: PsiElement -): List = emptyList() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.as34 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.as34 deleted file mode 100644 index 06954298618..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/userDataModuleInfoUtil.kt.as34 +++ /dev/null @@ -1,90 +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. - */ - -/* - * 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.caches.project - -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleUtilCore -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.idea.LIBRARY_KEY -import org.jetbrains.kotlin.idea.MODULE_ROOT_TYPE_KEY -import org.jetbrains.kotlin.idea.SDK_KEY -import org.jetbrains.kotlin.idea.caches.project.UserDataModuleContainer.ForPsiElement -import org.jetbrains.kotlin.idea.caches.project.UserDataModuleContainer.ForVirtualFile -import org.jetbrains.kotlin.idea.core.getSourceType -import org.jetbrains.kotlin.utils.addIfNotNull - -// This file declares non-exported API for overriding module info with user-data - - -private sealed class UserDataModuleContainer { - abstract fun getUserData(key: Key): T? - abstract fun getModule(): Module? - - data class ForVirtualFile(val virtualFile: VirtualFile, val project: Project) : UserDataModuleContainer() { - override fun getUserData(key: Key): T? = virtualFile.getUserData(key) - override fun getModule(): Module? = ModuleUtilCore.findModuleForFile(virtualFile, project) - } - - data class ForPsiElement(val psiElement: PsiElement) : UserDataModuleContainer() { - override fun getUserData(key: Key): T? { - return psiElement.getUserData(key) - ?: psiElement.containingFile?.getUserData(key) - ?: psiElement.containingFile?.originalFile?.virtualFile?.getUserData(key) - } - - override fun getModule(): Module? = ModuleUtilCore.findModuleForPsiElement(psiElement) - } -} - - -private fun collectModuleInfoByUserData( - project: Project, - container: UserDataModuleContainer -): List { - fun forModule(): ModuleSourceInfo? { - val rootType = container.getUserData(MODULE_ROOT_TYPE_KEY) ?: return null - val module = container.getModule() ?: return null - - return when (rootType.getSourceType()) { - null -> null - SourceType.PRODUCTION -> module.productionSourceInfo() - SourceType.TEST -> module.testSourceInfo() - } - } - - val result = mutableListOf() - result.addIfNotNull(forModule()) - - val library = container.getUserData(LIBRARY_KEY) - if (library != null) { - result.addAll(createLibraryInfo(project, library)) - } - - val sdk = container.getUserData(SDK_KEY) - if (sdk != null) { - result.add(SdkInfo(project, sdk)) - } - - return result -} - - -fun collectModuleInfoByUserData( - project: Project, - virtualFile: VirtualFile -): List = collectModuleInfoByUserData(project, ForVirtualFile(virtualFile, project)) - -fun collectModuleInfoByUserData( - psiElement: PsiElement -): List = collectModuleInfoByUserData(psiElement.project, ForPsiElement(psiElement)) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/userDataModuleInfo.kt.183 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/userDataModuleInfo.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/userDataModuleInfo.kt.as34 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/userDataModuleInfo.kt.as34 deleted file mode 100644 index e9bcb66a33e..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/userDataModuleInfo.kt.as34 +++ /dev/null @@ -1,34 +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 - -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.libraries.Library -import com.intellij.openapi.util.Key -import org.jetbrains.jps.model.module.JpsModuleSourceRootType - -// WARNING, this API is used by AS3.3+ - - -const val LIBRARY_KEY_NAME = "Kt_Library" -const val SDK_KEY_NAME = "Kt_Sdk" -const val MODULE_ROOT_TYPE_KEY_NAME = "Kt_SourceRootType" - -@JvmField -val MODULE_ROOT_TYPE_KEY = getOrCreateKey>(MODULE_ROOT_TYPE_KEY_NAME) - -@JvmField -val SDK_KEY = getOrCreateKey(SDK_KEY_NAME) - -@JvmField -val LIBRARY_KEY = getOrCreateKey(LIBRARY_KEY_NAME) - - -inline fun getOrCreateKey(name: String): Key { - @Suppress("DEPRECATION", "UNCHECKED_CAST") - val existingKey = Key.findKeyByName(name) as Key? - return existingKey ?: Key.create(name) -} diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.183 b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.183 deleted file mode 100644 index 509e3824273..00000000000 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.183 +++ /dev/null @@ -1,114 +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.completion - -import com.intellij.codeInsight.lookup.Lookup -import com.intellij.codeInsight.lookup.LookupEvent -import com.intellij.codeInsight.lookup.LookupListener -import com.intellij.codeInsight.lookup.LookupManager -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ProjectComponent -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.EditorFactory -import com.intellij.openapi.editor.RangeMarker -import com.intellij.openapi.editor.event.CaretEvent -import com.intellij.openapi.editor.event.CaretListener -import com.intellij.openapi.editor.event.EditorFactoryEvent -import com.intellij.openapi.editor.event.EditorFactoryListener -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key - -class LookupCancelWatcher(val project: Project) : ProjectComponent { - private class Reminiscence(editor: Editor, offset: Int) { - var editor: Editor? = editor - private var marker: RangeMarker? = editor.document.createRangeMarker(offset, offset) - - // forget about auto-popup cancellation when the caret is moved to the start or before it - private var editorListener: CaretListener? = object : CaretListener { - override fun caretPositionChanged(e: CaretEvent) { - if (!marker!!.isValid || editor.logicalPositionToOffset(e.newPosition) <= offset) { - dispose() - } - } - } - - init { - ApplicationManager.getApplication()!!.assertIsDispatchThread() - editor.caretModel.addCaretListener(editorListener!!) - } - - fun matches(editor: Editor, offset: Int): Boolean { - return editor == this.editor && marker?.startOffset == offset - } - - fun dispose() { - ApplicationManager.getApplication()!!.assertIsDispatchThread() - if (marker != null) { - editor!!.caretModel.removeCaretListener(editorListener!!) - marker = null - editor = null - editorListener = null - } - } - } - - private var lastReminiscence: Reminiscence? = null - - companion object { - fun getInstance(project: Project): LookupCancelWatcher = project.getComponent(LookupCancelWatcher::class.java)!! - - val AUTO_POPUP_AT = Key("LookupCancelWatcher.AUTO_POPUP_AT") - } - - fun wasAutoPopupRecentlyCancelled(editor: Editor, offset: Int): Boolean { - return lastReminiscence?.matches(editor, offset) ?: false - } - - private val lookupCancelListener = object : LookupListener { - override fun lookupCanceled(event: LookupEvent) { - val lookup = event.lookup - if (event.isCanceledExplicitly && lookup.isCompletion) { - val offset = lookup.currentItem?.getUserData(AUTO_POPUP_AT) - if (offset != null) { - lastReminiscence?.dispose() - if (offset <= lookup.editor.document.textLength) { - lastReminiscence = Reminiscence(lookup.editor, offset) - } - } - } - } - } - - override fun initComponent() { - EditorFactory.getInstance().addEditorFactoryListener( - object : EditorFactoryListener { - override fun editorReleased(event: EditorFactoryEvent) { - if (lastReminiscence?.editor == event.editor) { - lastReminiscence!!.dispose() - } - } - }, - project - ) - - LookupManager.getInstance(project).addPropertyChangeListener { event -> - if (event.propertyName == LookupManager.PROP_ACTIVE_LOOKUP) { - (event.newValue as Lookup?)?.addLookupListener(lookupCancelListener) - } - } - } -} diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.as34 b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.as34 deleted file mode 100644 index 509e3824273..00000000000 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/LookupCancelWatcher.kt.as34 +++ /dev/null @@ -1,114 +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.completion - -import com.intellij.codeInsight.lookup.Lookup -import com.intellij.codeInsight.lookup.LookupEvent -import com.intellij.codeInsight.lookup.LookupListener -import com.intellij.codeInsight.lookup.LookupManager -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ProjectComponent -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.EditorFactory -import com.intellij.openapi.editor.RangeMarker -import com.intellij.openapi.editor.event.CaretEvent -import com.intellij.openapi.editor.event.CaretListener -import com.intellij.openapi.editor.event.EditorFactoryEvent -import com.intellij.openapi.editor.event.EditorFactoryListener -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key - -class LookupCancelWatcher(val project: Project) : ProjectComponent { - private class Reminiscence(editor: Editor, offset: Int) { - var editor: Editor? = editor - private var marker: RangeMarker? = editor.document.createRangeMarker(offset, offset) - - // forget about auto-popup cancellation when the caret is moved to the start or before it - private var editorListener: CaretListener? = object : CaretListener { - override fun caretPositionChanged(e: CaretEvent) { - if (!marker!!.isValid || editor.logicalPositionToOffset(e.newPosition) <= offset) { - dispose() - } - } - } - - init { - ApplicationManager.getApplication()!!.assertIsDispatchThread() - editor.caretModel.addCaretListener(editorListener!!) - } - - fun matches(editor: Editor, offset: Int): Boolean { - return editor == this.editor && marker?.startOffset == offset - } - - fun dispose() { - ApplicationManager.getApplication()!!.assertIsDispatchThread() - if (marker != null) { - editor!!.caretModel.removeCaretListener(editorListener!!) - marker = null - editor = null - editorListener = null - } - } - } - - private var lastReminiscence: Reminiscence? = null - - companion object { - fun getInstance(project: Project): LookupCancelWatcher = project.getComponent(LookupCancelWatcher::class.java)!! - - val AUTO_POPUP_AT = Key("LookupCancelWatcher.AUTO_POPUP_AT") - } - - fun wasAutoPopupRecentlyCancelled(editor: Editor, offset: Int): Boolean { - return lastReminiscence?.matches(editor, offset) ?: false - } - - private val lookupCancelListener = object : LookupListener { - override fun lookupCanceled(event: LookupEvent) { - val lookup = event.lookup - if (event.isCanceledExplicitly && lookup.isCompletion) { - val offset = lookup.currentItem?.getUserData(AUTO_POPUP_AT) - if (offset != null) { - lastReminiscence?.dispose() - if (offset <= lookup.editor.document.textLength) { - lastReminiscence = Reminiscence(lookup.editor, offset) - } - } - } - } - } - - override fun initComponent() { - EditorFactory.getInstance().addEditorFactoryListener( - object : EditorFactoryListener { - override fun editorReleased(event: EditorFactoryEvent) { - if (lastReminiscence?.editor == event.editor) { - lastReminiscence!!.dispose() - } - } - }, - project - ) - - LookupManager.getInstance(project).addPropertyChangeListener { event -> - if (event.propertyName == LookupManager.PROP_ACTIVE_LOOKUP) { - (event.newValue as Lookup?)?.addLookupListener(lookupCancelListener) - } - } - } -} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.183 b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.as34 b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/KotlinGradleScriptFileTypeSchemaDetector.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.183 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.183 deleted file mode 100644 index 939c6c53fe5..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.183 +++ /dev/null @@ -1,3 +0,0 @@ -class IDESettingsFUSCollector { - // Not whitelisted -} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as34 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as34 deleted file mode 100644 index 939c6c53fe5..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as34 +++ /dev/null @@ -1,3 +0,0 @@ -class IDESettingsFUSCollector { - // Not whitelisted -} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.183 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.183 deleted file mode 100644 index b0093b0b02e..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.183 +++ /dev/null @@ -1,18 +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.statistics - -open class KotlinFUSLogger { - companion object { - fun log(group: FUSEventGroups, event: String) { - // Not whitelisted for 183 - } - - fun log(group: FUSEventGroups, event: String, eventData: Map) { - // Not whitelisted for 183 - } - } -} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as34 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as34 deleted file mode 100644 index 0e1adf9ff46..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as34 +++ /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.183 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.183 deleted file mode 100644 index 3fe75589e1c..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.183 +++ /dev/null @@ -1,3 +0,0 @@ -class ProjectConfigurationCollector { - // Not whitelisted -} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as34 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as34 deleted file mode 100644 index 3fe75589e1c..00000000000 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as34 +++ /dev/null @@ -1,3 +0,0 @@ -class ProjectConfigurationCollector { - // Not whitelisted -} \ No newline at end of file diff --git a/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.as34 b/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt.as34 b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesInIDENamingTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt.as34 b/idea/idea-gradle-native/tests/org/jetbrains/kotlin/ide/konan/gradle/GradleNativeLibrariesPropagationTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/kotlinResolverUtil.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/kotlinResolverUtil.kt.183 deleted file mode 100644 index acf58a54edb..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/kotlinResolverUtil.kt.183 +++ /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.configuration - -fun suggestNativeDebug(projectPath: String) {} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunnerUtil.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunnerUtil.kt.183 deleted file mode 100644 index 2059c58226c..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunnerUtil.kt.183 +++ /dev/null @@ -1,14 +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.gradle.execution - -import com.intellij.openapi.module.Module -import org.jetbrains.plugins.gradle.settings.GradleSystemRunningSettings - -//BUNCH: 183 -fun isDelegatedBuild(module: Module): Boolean { - return GradleSystemRunningSettings.getInstance().isUseGradleAwareMake() -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestClassGradleConfigurationProducer.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestClassGradleConfigurationProducer.kt.183 deleted file mode 100644 index 147ee76ae02..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestClassGradleConfigurationProducer.kt.183 +++ /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.run - -import com.intellij.execution.Location -import com.intellij.execution.actions.ConfigurationContext -import com.intellij.execution.actions.ConfigurationFromContext -import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration -import com.intellij.openapi.module.Module -import com.intellij.openapi.util.Ref -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.idea.caches.project.isNewMPPModule -import org.jetbrains.kotlin.idea.project.platform -import org.jetbrains.kotlin.platform.TargetPlatform -import org.jetbrains.plugins.gradle.execution.test.runner.* -import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration -import org.jetbrains.plugins.gradle.util.GradleConstants - -abstract class AbstractKotlinMultiplatformTestClassGradleConfigurationProducer : AbstractKotlinTestClassGradleConfigurationProducer() { - override val forceGradleRunner: Boolean get() = true - override val hasTestFramework: Boolean get() = true - - abstract fun isApplicable(module: Module, platform: TargetPlatform): Boolean - - final override fun isApplicable(module: Module): Boolean { - if (!module.isNewMPPModule) { - return false - } - - val platform = module.platform ?: return false - return isApplicable(module, platform) - } - - override fun isPreferredConfiguration(self: ConfigurationFromContext?, other: ConfigurationFromContext): Boolean { - return other.isJpsJunitConfiguration() - } - - override fun shouldReplace(self: ConfigurationFromContext, other: ConfigurationFromContext): Boolean { - return other.isJpsJunitConfiguration() - } -} - -abstract class AbstractKotlinTestClassGradleConfigurationProducer - : TestClassGradleConfigurationProducer(), KotlinGradleConfigurationProducer -{ - override fun isConfigurationFromContext(configuration: ExternalSystemRunConfiguration, context: ConfigurationContext): Boolean { - if (!context.check()) { - return false - } - - if (!forceGradleRunner) { - return super.isConfigurationFromContext(configuration, context) - } - - if (GradleConstants.SYSTEM_ID != configuration.settings.externalSystemId) return false - return doIsConfigurationFromContext(configuration, context) - } - - override fun setupConfigurationFromContext( - configuration: ExternalSystemRunConfiguration, - context: ConfigurationContext, - sourceElement: Ref - ): Boolean { - if (!context.check()) { - return false - } - - if (!forceGradleRunner) { - return super.setupConfigurationFromContext(configuration, context, sourceElement) - } - - if (GradleConstants.SYSTEM_ID != configuration.settings.externalSystemId) return false - if (sourceElement.isNull) return false - - (configuration as? GradleRunConfiguration)?.isScriptDebugEnabled = false - return doSetupConfigurationFromContext(configuration, context, sourceElement) - } - - private fun ConfigurationContext.check(): Boolean { - return hasTestFramework && module != null && isApplicable(module) - } - - override fun getPsiClassForLocation(contextLocation: Location<*>) = getTestClassForKotlinTest(contextLocation) - override fun getPsiMethodForLocation(contextLocation: Location<*>) = getTestMethodForKotlinTest(contextLocation) -} diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestMethodGradleConfigurationProducer.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestMethodGradleConfigurationProducer.kt.183 deleted file mode 100644 index 6d107c14195..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/AbstractKotlinTestMethodGradleConfigurationProducer.kt.183 +++ /dev/null @@ -1,87 +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.run - -import com.intellij.execution.Location -import com.intellij.execution.actions.ConfigurationContext -import com.intellij.execution.actions.ConfigurationFromContext -import com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration -import com.intellij.openapi.module.Module -import com.intellij.openapi.util.Ref -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.idea.caches.project.isNewMPPModule -import org.jetbrains.kotlin.idea.project.platform -import org.jetbrains.kotlin.platform.TargetPlatform -import org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer -import org.jetbrains.plugins.gradle.service.execution.GradleRunConfiguration -import org.jetbrains.plugins.gradle.util.GradleConstants - -abstract class AbstractKotlinMultiplatformTestMethodGradleConfigurationProducer : AbstractKotlinTestMethodGradleConfigurationProducer() { - override val forceGradleRunner: Boolean get() = true - override val hasTestFramework: Boolean get() = true - - abstract fun isApplicable(module: Module, platform: TargetPlatform): Boolean - - final override fun isApplicable(module: Module): Boolean { - if (!module.isNewMPPModule) { - return false - } - - val platform = module.platform ?: return false - return isApplicable(module, platform) - } - - override fun isPreferredConfiguration(self: ConfigurationFromContext?, other: ConfigurationFromContext): Boolean { - return other.isJpsJunitConfiguration() - } - - override fun shouldReplace(self: ConfigurationFromContext, other: ConfigurationFromContext): Boolean { - return other.isJpsJunitConfiguration() - } -} - -abstract class AbstractKotlinTestMethodGradleConfigurationProducer - : TestMethodGradleConfigurationProducer(), KotlinGradleConfigurationProducer -{ - override fun isConfigurationFromContext(configuration: ExternalSystemRunConfiguration, context: ConfigurationContext): Boolean { - if (!context.check()) { - return false - } - - if (!forceGradleRunner) { - return super.isConfigurationFromContext(configuration, context) - } - - if (GradleConstants.SYSTEM_ID != configuration.settings.externalSystemId) return false - return doIsConfigurationFromContext(configuration, context) - } - - override fun setupConfigurationFromContext( - configuration: ExternalSystemRunConfiguration, - context: ConfigurationContext, - sourceElement: Ref - ): Boolean { - if (!context.check()) { - return false - } - - if (!forceGradleRunner) { - return super.setupConfigurationFromContext(configuration, context, sourceElement) - } - - if (GradleConstants.SYSTEM_ID != configuration.settings.externalSystemId) return false - if (sourceElement.isNull) return false - - (configuration as? GradleRunConfiguration)?.isScriptDebugEnabled = false - return doSetupConfigurationFromContext(configuration, context, sourceElement) - } - - private fun ConfigurationContext.check(): Boolean { - return hasTestFramework && module != null && isApplicable(module) - } - - override fun getPsiMethodForLocation(contextLocation: Location<*>) = getTestMethodForKotlinTest(contextLocation) -} diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/KotlinMPPGradleTestTasksProvider.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/MultiplatformTestTasksChooser.kt.183 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/run/MultiplatformTestTasksChooser.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleScriptInputsWatcher.kt.as34 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleScriptInputsWatcher.kt.as34 deleted file mode 100644 index 394a7825e0d..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleScriptInputsWatcher.kt.as34 +++ /dev/null @@ -1,66 +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.scripting.gradle - -import com.intellij.openapi.externalSystem.service.project.autoimport.ConfigurationFileCrcFactory -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.openapi.vfs.VirtualFile -import org.jetbrains.plugins.gradle.settings.GradleLocalSettings -import java.nio.file.Paths -import java.util.* - -class GradleScriptInputsWatcher(val project: Project) { - private val comparator = Comparator { f1, f2 -> (f1.timeStamp - f2.timeStamp).toInt() } - - private val storage = TreeSet(comparator) - - init { - initStorage(project) - } - - private fun initStorage(project: Project) { - val localSettings = GradleLocalSettings.getInstance(project) - localSettings.externalConfigModificationStamps.forEach { (path, stamp) -> - val file = VfsUtil.findFile(Paths.get(path), true) - if (file != null && !file.isDirectory) { - val calculateCrc = ConfigurationFileCrcFactory(project, file).create() - if (calculateCrc != stamp) { - addToStorage(file) - } - } - } - } - - fun lastModifiedFileTimeStamp(file: VirtualFile): Long = lastModifiedRelatedFile(file)?.timeStamp ?: 0 - - fun areRelatedFilesUpToDate(file: VirtualFile, timeStamp: Long): Boolean { - return lastModifiedFileTimeStamp(file) <= timeStamp - } - - fun addToStorage(file: VirtualFile) { - if (storage.contains(file)) { - storage.remove(file) - } - storage.add(file) - } - - private fun lastModifiedRelatedFile(file: VirtualFile): VirtualFile? { - if (storage.isEmpty()) return null - - val iterator = storage.descendingIterator() - if (!iterator.hasNext()) return null - - var lastModifiedFile = iterator.next() - while (lastModifiedFile == file && iterator.hasNext()) { - lastModifiedFile = iterator.next() - } - - if (lastModifiedFile == file) return null - - return lastModifiedFile - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.183 deleted file mode 100644 index 3a81a698d67..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.183 +++ /dev/null @@ -1,9 +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 - -class KaptImportingTest { -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.as34 deleted file mode 100644 index 3a81a698d67..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/KaptImportingTest.kt.as34 +++ /dev/null @@ -1,9 +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 - -class KaptImportingTest { -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as34 deleted file mode 100644 index 6bbb8c73dc3..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as34 +++ /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/NewMultiplatformKaptProjectImportingTest.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt.183 deleted file mode 100644 index cdbe8faa030..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformKaptProjectImportingTest.kt.183 +++ /dev/null @@ -1,70 +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 - -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.roots.* -import com.intellij.openapi.roots.impl.ModulesOrderEnumerator -import com.intellij.util.text.VersionComparatorUtil -import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase -import org.jetbrains.kotlin.idea.util.sourceRoots -import org.junit.Test -import java.io.File - -class NewMultiplatformKaptProjectImportingTest : MultiplePluginVersionGradleImportingTestCase() { - override fun isApplicableTest(): Boolean { - val isOldGradlePlugin = gradleKotlinPluginVersion != MINIMAL_SUPPORTED_VERSION - && VersionComparatorUtil.compare(gradleKotlinPluginVersion, "1.3.40") < 0 - - return !isOldGradlePlugin && VersionComparatorUtil.compare(gradleVersion, "4.0") >= 0 - } - - @Test - fun testRuntimeClasspath() { - configureByFiles() - - val projectPath = this.projectPath - - val expectedRoots = listOf( - "build/tmp/kapt3/classes/main", - "build/classes/java/main", - "build/classes/kotlin/jvm/main", - "build/processedResources/jvm/main" - ).map { - File(projectPath, it).apply { mkdirs() } - } - - importProject() - - val jvmMainModule = ModuleManager.getInstance(project).modules.first { it.name == "project_jvmMain" } - - val enumerator = ModulesOrderEnumerator(listOf(jvmMainModule)) - val roots = enumerator.classesRoots - - fun isRootPresent(file: File) = roots.any { it.path == ExternalSystemApiUtil.toCanonicalPath(file.path) } - - val missingRoots = expectedRoots.filter { !isRootPresent(it) } - - assert(missingRoots.isEmpty()) { - "Missing roots found: " + missingRoots.joinToString() - } - } - - override fun importProject() { - val isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true - try { - super.importProject() - } finally { - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = isCreateEmptyContentRootDirectories - } - } - - override fun testDataDirName(): String { - return "newMultiplatformImport" - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.183 deleted file mode 100644 index aed1fd4dbff..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.183 +++ /dev/null @@ -1,639 +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.gradle - -import com.intellij.openapi.roots.DependencyScope -import com.intellij.util.text.VersionComparatorUtil -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.kotlin.config.* -import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase -import org.jetbrains.kotlin.platform.CommonPlatforms -import org.jetbrains.kotlin.platform.js.JsPlatforms -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.plugins.gradle.tooling.annotation.PluginTargetVersions -import org.junit.After -import org.junit.Before -import org.junit.Test - -class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportingTestCase() { - - @Before - fun saveSdksBeforeTest() { - val kotlinSdks = sdkCreationChecker?.getKotlinSdks() ?: emptyList() - if (kotlinSdks.isNotEmpty()) { - fail("Found Kotlin SDK before importing test. Sdk list: $kotlinSdks") - } - } - - @After - fun checkSdkCreated() { - if (sdkCreationChecker?.isKotlinSdkCreated() == false) { - fail("Kotlin SDK was not created during import of MPP Project.") - } - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.10+") - fun testProjectDependency() { - configureByFiles() - importProject() - - checkProjectStructure() { - allModules { - languageVersion("1.3") - apiVersion("1.3") - when (module.name) { - "project", "app", "lib" -> additionalArguments(null) - "app_jvmMain", "app_jvmTest", "lib_jvmMain", "lib_jvmTest" -> - additionalArguments( - if (VersionComparatorUtil.compare(gradleKotlinPluginVersion, "1.3.50") < 0) - "-version" - else - "-Xallow-no-source-files" - ) - else -> additionalArguments("-version") - } - } - - module("project") - module("app") - module("app_commonMain") { - platform(CommonPlatforms.defaultCommonPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - sourceFolder("app/src/commonMain/kotlin", SourceKotlinRootType) - sourceFolder("app/src/commonMain/resources", ResourceKotlinRootType) - inheritProjectOutput() - } - module("app_commonTest") { - platform(CommonPlatforms.defaultCommonPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("app_commonMain", DependencyScope.TEST) - sourceFolder("app/src/commonTest/kotlin", TestSourceKotlinRootType) - sourceFolder("app/src/commonTest/resources", TestResourceKotlinRootType) - inheritProjectOutput() - } - module("app_jsMain") { - platform(JsPlatforms.defaultJsPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("lib_jsMain", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - moduleDependency("app_commonMain", DependencyScope.COMPILE) - sourceFolder("app/src/jsMain/kotlin", SourceKotlinRootType) - sourceFolder("app/src/jsMain/resources", ResourceKotlinRootType) - outputPath("app/build/classes/kotlin/js/main", true) - } - module("app_jsTest") { - platform(JsPlatforms.defaultJsPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("lib_jsMain", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("app_commonMain", DependencyScope.TEST) - moduleDependency("app_commonTest", DependencyScope.TEST) - moduleDependency("app_jsMain", DependencyScope.TEST) - sourceFolder("app/src/jsTest/kotlin", TestSourceKotlinRootType) - sourceFolder("app/src/jsTest/resources", TestResourceKotlinRootType) - outputPath("app/build/classes/kotlin/js/test", false) - } - module("app_jvmMain") { - platform(JvmPlatforms.jvm16) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.COMPILE) - moduleDependency("lib_jvmMain", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - moduleDependency("app_main", DependencyScope.COMPILE) - moduleDependency("app_commonMain", DependencyScope.COMPILE) - sourceFolder("app/src/jvmMain/kotlin", JavaSourceRootType.SOURCE) - sourceFolder("app/src/jvmMain/resources", JavaResourceRootType.RESOURCE) - outputPath("app/build/classes/kotlin/jvm/main", true) - } - module("app_jvmTest") { - platform(JvmPlatforms.jvm16) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.TEST) - moduleDependency("lib_jvmMain", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("app_test", DependencyScope.TEST) - moduleDependency("app_jvmMain", DependencyScope.TEST) - moduleDependency("app_commonMain", DependencyScope.TEST) - moduleDependency("app_commonTest", DependencyScope.TEST) - sourceFolder("app/src/jvmTest/kotlin", JavaSourceRootType.TEST_SOURCE) - sourceFolder("app/src/jvmTest/resources", JavaResourceRootType.TEST_RESOURCE) - outputPath("app/build/classes/kotlin/jvm/test", false) - } - module("app_main") { - platform(JvmPlatforms.jvm18) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - sourceFolder("app/src/main/java", JavaSourceRootType.SOURCE) - sourceFolder("app/src/main/kotlin", JavaSourceRootType.SOURCE) - sourceFolder("app/src/main/resources", JavaResourceRootType.RESOURCE) - inheritProjectOutput() - } - module("app_test") { - platform(JvmPlatforms.jvm18) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("app_main", DependencyScope.TEST) - sourceFolder("app/src/test/java", JavaSourceRootType.TEST_SOURCE) - sourceFolder("app/src/test/kotlin", JavaSourceRootType.TEST_SOURCE) - sourceFolder("app/src/test/resources", JavaResourceRootType.TEST_RESOURCE) - inheritProjectOutput() - } - module("lib") - module("lib_commonMain") { - platform(CommonPlatforms.defaultCommonPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - sourceFolder("lib/src/commonMain/kotlin", SourceKotlinRootType) - sourceFolder("lib/src/commonMain/resources", ResourceKotlinRootType) - inheritProjectOutput() - } - module("lib_commonTest") { - platform(CommonPlatforms.defaultCommonPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - sourceFolder("lib/src/commonTest/kotlin", TestSourceKotlinRootType) - sourceFolder("lib/src/commonTest/resources", TestResourceKotlinRootType) - inheritProjectOutput() - } - module("lib_jsMain") { - platform(JsPlatforms.defaultJsPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - sourceFolder("lib/src/jsMain/kotlin", SourceKotlinRootType) - sourceFolder("lib/src/jsMain/resources", ResourceKotlinRootType) - outputPath("lib/build/classes/kotlin/js/main", true) - } - module("lib_jsTest") { - platform(JsPlatforms.defaultJsPlatform) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("lib_commonTest", DependencyScope.TEST) - moduleDependency("lib_jsMain", DependencyScope.TEST) - sourceFolder("lib/src/jsTest/kotlin", TestSourceKotlinRootType) - sourceFolder("lib/src/jsTest/resources", TestResourceKotlinRootType) - outputPath("lib/build/classes/kotlin/js/test", false) - } - module("lib_jvmMain") { - platform(JvmPlatforms.jvm16) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.COMPILE) - moduleDependency("lib_commonMain", DependencyScope.COMPILE) - sourceFolder("lib/src/jvmMain/kotlin", JavaSourceRootType.SOURCE) - sourceFolder("lib/src/jvmMain/resources", JavaResourceRootType.RESOURCE) - outputPath("lib/build/classes/kotlin/jvm/main", true) - } - module("lib_jvmTest") { - platform(JvmPlatforms.jvm16) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.TEST) - moduleDependency("lib_commonTest", DependencyScope.TEST) - moduleDependency("lib_commonMain", DependencyScope.TEST) - moduleDependency("lib_jvmMain", DependencyScope.TEST) - sourceFolder("lib/src/jvmTest/kotlin", JavaSourceRootType.TEST_SOURCE) - sourceFolder("lib/src/jvmTest/resources", JavaResourceRootType.TEST_RESOURCE) - outputPath("lib/build/classes/kotlin/jvm/test", false) - } - } - } - - @Test - fun testFileCollectionDependency() { - configureByFiles() - importProject() - - checkProjectStructure( - exhaustiveModuleList = false, - exhaustiveSourceSourceRootList = false - ) { - module("project_jvmMain") { - libraryDependencyByUrl("file://$projectPath/a", DependencyScope.COMPILE) - libraryDependencyByUrl("file://$projectPath/b", DependencyScope.COMPILE) - moduleDependency("project_commonMain", DependencyScope.COMPILE) - moduleDependency("project_main", DependencyScope.COMPILE) - } - } - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.30+") - fun testUnresolvedDependency() { - configureByFiles() - importProject() - - checkProjectStructure( - exhaustiveSourceSourceRootList = false, - exhaustiveDependencyList = false - ) { - module("project") - module("project_commonMain") - module("project_commonTest") - module("project_jvmMain") - module("project_jvmTest") - module("project_main") - module("project_test") - } - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.30+") - fun testAndroidDependencyOnMPP() { - configureByFiles() - createProjectSubFile( - "local.properties", - "sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()}" - ) - importProject() - - checkProjectStructure { - module("project") - module("app") { - libraryDependency("Gradle: android-android-26", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.core:common:1.1.0@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.core:runtime-1.1.0", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.lifecycle:common:1.1.0@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.lifecycle:livedata-core-1.1.0", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.lifecycle:runtime-1.1.0", DependencyScope.COMPILE) - libraryDependency("Gradle: android.arch.lifecycle:viewmodel-1.1.0", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support.constraint:constraint-layout-1.1.3", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support.constraint:constraint-layout-solver:1.1.3@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support.test.espresso:espresso-core-3.0.2", DependencyScope.TEST) - libraryDependency("Gradle: com.android.support.test.espresso:espresso-idling-resource-3.0.2", DependencyScope.TEST) - libraryDependency("Gradle: com.android.support.test:monitor-1.0.2", DependencyScope.TEST) - libraryDependency("Gradle: com.android.support.test:runner-1.0.2", DependencyScope.TEST) - libraryDependency("Gradle: com.android.support:animated-vector-drawable-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:appcompat-v7-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-annotations:27.1.1@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-compat-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-core-ui-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-core-utils-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-fragment-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.android.support:support-vector-drawable-27.1.1", DependencyScope.COMPILE) - libraryDependency("Gradle: com.google.code.findbugs:jsr305:2.0.1@jar", DependencyScope.TEST) - libraryDependency("Gradle: com.squareup:javawriter:2.1.1@jar", DependencyScope.TEST) - libraryDependency("Gradle: javax.inject:javax.inject:1@jar", DependencyScope.TEST) - libraryDependency("Gradle: junit:junit:4.12@jar", DependencyScope.TEST) - libraryDependency("Gradle: net.sf.kxml:kxml2:2.3.0@jar", DependencyScope.TEST) - libraryDependency("Gradle: org.hamcrest:hamcrest-core:1.3@jar", DependencyScope.TEST) - libraryDependency("Gradle: org.hamcrest:hamcrest-integration:1.3@jar", DependencyScope.TEST) - libraryDependency("Gradle: org.hamcrest:hamcrest-library:1.3@jar", DependencyScope.TEST) - if (gradleKotlinPluginVersion != MINIMAL_SUPPORTED_VERSION) { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-android-extensions-runtime:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE) - } - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}@jar", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains:annotations:13.0@jar", DependencyScope.COMPILE) - moduleDependency("shared", DependencyScope.COMPILE) - moduleDependency("shared_androidMain", DependencyScope.COMPILE) - moduleDependency("shared_androidTest", DependencyScope.TEST) - moduleDependency("shared_commonMain", DependencyScope.COMPILE) - moduleDependency("shared_commonTest", DependencyScope.TEST) - } - module("shared") - module("shared_commonMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - sourceFolder("shared/src/commonMain/kotlin", SourceKotlinRootType) - sourceFolder("shared/src/commonMain/resources", ResourceKotlinRootType) - } - module("shared_commonTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("shared_commonMain", DependencyScope.TEST) - sourceFolder("shared/src/commonTest/kotlin", TestSourceKotlinRootType) - sourceFolder("shared/src/commonTest/resources", TestResourceKotlinRootType) - } - module("shared_androidMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.COMPILE) - moduleDependency("shared_commonMain", DependencyScope.COMPILE) - sourceFolder("shared/src/androidMain/kotlin", JavaSourceRootType.SOURCE) - sourceFolder("shared/src/androidMain/resources", JavaResourceRootType.RESOURCE) - } - module("shared_androidTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib:${gradleKotlinPluginVersion}", DependencyScope.TEST) - libraryDependency("Gradle: org.jetbrains:annotations:13.0", DependencyScope.TEST) - moduleDependency("shared_androidMain", DependencyScope.TEST) - moduleDependency("shared_commonMain", DependencyScope.TEST) - moduleDependency("shared_commonTest", DependencyScope.TEST) - sourceFolder("shared/src/androidTest/kotlin", JavaSourceRootType.TEST_SOURCE) - sourceFolder("shared/src/androidTest/resources", JavaResourceRootType.TEST_RESOURCE) - } - var nativeVersion = gradleKotlinPluginVersion - module("shared_iOSMain") { - libraryDependency("Kotlin/Native $nativeVersion - stdlib", DependencyScope.PROVIDED) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("shared_commonMain", DependencyScope.COMPILE) - sourceFolder("shared/src/iOSMain/kotlin", SourceKotlinRootType) - sourceFolder("shared/src/iOSMain/resources", ResourceKotlinRootType) - } - module("shared_iOSTest") { - libraryDependency("Kotlin/Native $nativeVersion - stdlib", DependencyScope.PROVIDED) - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("shared_iOSMain", DependencyScope.TEST) - moduleDependency("shared_commonMain", DependencyScope.TEST) - moduleDependency("shared_commonTest", DependencyScope.TEST) - sourceFolder("shared/src/iOSTest/kotlin", TestSourceKotlinRootType) - sourceFolder("shared/src/iOSTest/resources", TestResourceKotlinRootType) - } - } - } - - @Test - fun testTestTasks() { - val files = configureByFiles() - importProject() - - checkProjectStructure(exhaustiveSourceSourceRootList = false) { - module("project") - module("common") - module("jvm") - module("js") - - module("project_commonMain") - module("project_commonTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - } - - module("project_jvmMain") { - moduleDependency("project_commonMain", DependencyScope.COMPILE) - } - - module("project_jvmTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - moduleDependency("project_commonTest", DependencyScope.TEST) - moduleDependency("project_jvmMain", DependencyScope.TEST) - } - } - - val commonTestFile = files.find { it.path.contains("commonTest") }!! - val commonTasks = findTasksToRun(commonTestFile) - if (commonTasks != null) { - assertEquals(listOf(":cleanJvmTest", ":jvmTest"), commonTasks) - } - - val jvmTestFile = files.find { it.path.contains("jvmTest") }!! - val jvmTasks = findTasksToRun(jvmTestFile) - if (jvmTasks != null) { - assertEquals(listOf(":cleanJvmTest", ":jvmTest"), jvmTasks) - } - } - - @Test - fun testDependencyOnRoot() { - configureByFiles() - importProject() - checkProjectStructure(exhaustiveSourceSourceRootList = false) { - - module("project") - module("project_commonMain") - module("project_commonTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - } - module("project_jvmMain") { - moduleDependency("project_commonMain", DependencyScope.COMPILE) - } - module("project_jvmTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - moduleDependency("project_commonTest", DependencyScope.TEST) - moduleDependency("project_jvmMain", DependencyScope.TEST) - } - - module("subproject") - module("subproject_commonMain") { - moduleDependency("project_commonMain", DependencyScope.COMPILE) - } - module("subproject_commonTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - moduleDependency("subproject_commonMain", DependencyScope.TEST) - } - module("subproject_jvmMain") { - moduleDependency("project_commonMain", DependencyScope.COMPILE) - moduleDependency("subproject_commonMain", DependencyScope.COMPILE) - moduleDependency("project_jvmMain", DependencyScope.COMPILE) - } - module("subproject_jvmTest") { - moduleDependency("project_commonMain", DependencyScope.TEST) - moduleDependency("subproject_commonMain", DependencyScope.TEST) - moduleDependency("subproject_commonTest", DependencyScope.TEST) - moduleDependency("project_jvmMain", DependencyScope.TEST) - moduleDependency("subproject_jvmMain", DependencyScope.TEST) - } - } - - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.10+") - fun testNestedDependencies() { - configureByFiles() - importProject() - - checkProjectStructure(exhaustiveSourceSourceRootList = false) { - module("project") - module("aaa") - module("aaa_commonMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("bbb_commonMain", DependencyScope.COMPILE) - moduleDependency("ccc_commonMain", DependencyScope.COMPILE) - } - module("aaa_commonTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("aaa_commonMain", DependencyScope.TEST) - moduleDependency("bbb_commonMain", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - } - module("aaa_jvmMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("aaa_commonMain", DependencyScope.COMPILE) - moduleDependency("bbb_commonMain", DependencyScope.COMPILE) - moduleDependency("bbb_jvmMain", DependencyScope.COMPILE) - moduleDependency("ccc_commonMain", DependencyScope.COMPILE) - moduleDependency("ccc_jvmMain", DependencyScope.COMPILE) - } - module("aaa_jvmTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("aaa_commonMain", DependencyScope.TEST) - moduleDependency("aaa_commonTest", DependencyScope.TEST) - moduleDependency("aaa_jvmMain", DependencyScope.TEST) - moduleDependency("bbb_commonMain", DependencyScope.TEST) - moduleDependency("bbb_jvmMain", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - moduleDependency("ccc_jvmMain", DependencyScope.TEST) - } - module("bbb") - module("bbb_commonMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("ccc_commonMain", DependencyScope.COMPILE) - } - module("bbb_commonTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("bbb_commonMain", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - } - module("bbb_jvmMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("bbb_commonMain", DependencyScope.COMPILE) - moduleDependency("ccc_commonMain", DependencyScope.COMPILE) - moduleDependency("ccc_jvmMain", DependencyScope.COMPILE) - } - module("bbb_jvmTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("bbb_commonMain", DependencyScope.TEST) - moduleDependency("bbb_commonTest", DependencyScope.TEST) - moduleDependency("bbb_jvmMain", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - moduleDependency("ccc_jvmMain", DependencyScope.TEST) - } - module("ccc") - module("ccc_commonMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - } - module("ccc_commonTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - } - module("ccc_jvmMain") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.COMPILE) - moduleDependency("ccc_commonMain", DependencyScope.COMPILE) - } - module("ccc_jvmTest") { - libraryDependency("Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:${gradleKotlinPluginVersion}", DependencyScope.TEST) - moduleDependency("ccc_commonMain", DependencyScope.TEST) - moduleDependency("ccc_commonTest", DependencyScope.TEST) - moduleDependency("ccc_jvmMain", DependencyScope.TEST) - } - } - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.20+") - fun testDetectAndroidSources() { - configureByFiles() - createProjectSubFile( - "local.properties", - "sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()}" - ) - importProject(true) - checkProjectStructure(exhaustiveModuleList = false, exhaustiveDependencyList = false, exhaustiveSourceSourceRootList = false) { - module("multiplatformb") { - sourceFolder("multiplatformb/src/androidMain/kotlin", JavaSourceRootType.SOURCE) - - - } - } - } - - /** - * This test is inherited form testPlatformToCommonExpectedByInComposite and actually tests - * dependencies in multiplatform project included in composite build - */ - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.20+") - fun testPlatformToCommonExpByInComposite() { - configureByFiles() - importProject(true) - - checkProjectStructure(exhaustiveSourceSourceRootList = false) { - module("project") - module("project.commonMain") - module("project.commonTest") { - moduleDependency("project.commonMain", DependencyScope.TEST) - } - module("toInclude") - module("toInclude.commonMain") - module("toInclude.commonTest") { - moduleDependency("toInclude.commonMain", DependencyScope.TEST) - } - module("toInclude.jsMain") { - moduleDependency("toInclude.commonMain", DependencyScope.COMPILE) - } - - module("toInclude.jsTest") { - moduleDependency("toInclude.commonMain", DependencyScope.TEST) - moduleDependency("toInclude.commonTest", DependencyScope.TEST) - moduleDependency("toInclude.jsMain", DependencyScope.TEST) - } - module("toInclude.jvmMain") { - moduleDependency("toInclude.commonMain", DependencyScope.COMPILE) - } - module("toInclude.jvmTest") { - moduleDependency("toInclude.commonMain", DependencyScope.TEST) - moduleDependency("toInclude.commonTest", DependencyScope.TEST) - moduleDependency("toInclude.jvmMain", DependencyScope.TEST) - } - } - } - - @Test - @PluginTargetVersions(gradleVersion = "4.0+", pluginVersion = "1.3.20+") - fun testProductionOnTestFlag() { - configureByFiles() - importProject(true) - - checkProjectStructure(false, false, false ) { - module("project.javaModule.test") { - moduleDependency("project.mppModule.jvmTest", DependencyScope.COMPILE, true) - } - } - } - - private fun checkProjectStructure( - exhaustiveModuleList: Boolean = true, - exhaustiveSourceSourceRootList: Boolean = true, - exhaustiveDependencyList: Boolean = true, - body: ProjectInfo.() -> Unit = {} - ) { - checkProjectStructure( - myProject, - projectPath, - exhaustiveModuleList, - exhaustiveSourceSourceRootList, - exhaustiveDependencyList, - false, - body) - } - - fun importProject(useQualifiedNames: Boolean) { - val isUseQualifiedModuleNames = currentExternalProjectSettings.isUseQualifiedModuleNames - currentExternalProjectSettings.isUseQualifiedModuleNames = useQualifiedNames - try { - importProject() - } finally { - currentExternalProjectSettings.isUseQualifiedModuleNames = isUseQualifiedModuleNames - } - } - - override fun importProject() { - val isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true - try { - super.importProject() - } finally { - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = isCreateEmptyContentRootDirectories - } - } - - override fun testDataDirName(): String { - return "newMultiplatformImport" - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/TaskUtils.kt.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/TaskUtils.kt.183 deleted file mode 100644 index 8cda77ac8cf..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/TaskUtils.kt.183 +++ /dev/null @@ -1,13 +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 - -import com.intellij.openapi.vfs.VirtualFile -import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase - -fun MultiplePluginVersionGradleImportingTestCase.findTasksToRun(file: VirtualFile): List? { - return null -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.183 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.183 deleted file mode 100644 index 2f36428d610..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.183 +++ /dev/null @@ -1,261 +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.idea.codeInsight.gradle; - -import com.google.common.collect.Multimap; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.io.StreamUtil; -import com.intellij.testFramework.IdeaTestUtil; -import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; -import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling; -import org.gradle.tooling.BuildActionExecuter; -import org.gradle.tooling.GradleConnector; -import org.gradle.tooling.ProjectConnection; -import org.gradle.tooling.internal.consumer.DefaultGradleConnector; -import org.gradle.tooling.model.DomainObjectSet; -import org.gradle.tooling.model.idea.IdeaModule; -import org.gradle.util.GradleVersion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.gradle.model.ExternalProject; -import org.jetbrains.plugins.gradle.model.ProjectImportAction; -import org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper; -import org.jetbrains.plugins.gradle.tooling.builder.ModelBuildScriptClasspathBuilderImpl; -import org.jetbrains.plugins.gradle.util.GradleConstants; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.*; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assume.assumeThat; - -// part of org.jetbrains.plugins.gradle.tooling.builder.AbstractModelBuilderTest -@RunWith(value = Parameterized.class) -public abstract class AbstractModelBuilderTest { - - public static final Object[][] SUPPORTED_GRADLE_VERSIONS = {{"4.9"}}; - - private static final Pattern TEST_METHOD_NAME_PATTERN = Pattern.compile("(.*)\\[(\\d*: with Gradle-.*)\\]"); - - private static File ourTempDir; - - @NotNull - private final String gradleVersion; - private File testDir; - private ProjectImportAction.AllModels allModels; - - @Rule public TestName name = new TestName(); - @Rule public VersionMatcherRule versionMatcherRule = new VersionMatcherRule(); - - public AbstractModelBuilderTest(@NotNull String gradleVersion) { - this.gradleVersion = gradleVersion; - } - - @Parameterized.Parameters(name = "{index}: with Gradle-{0}") - public static Collection data() { - return Arrays.asList(SUPPORTED_GRADLE_VERSIONS); - } - - - @Before - public void setUp() throws Exception { - assumeThat(gradleVersion, versionMatcherRule.getMatcher()); - - ensureTempDirCreated(); - - String methodName = name.getMethodName(); - Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName); - if (m.matches()) { - methodName = m.group(1); - } - - testDir = new File(ourTempDir, methodName); - FileUtil.ensureExists(testDir); - - InputStream buildScriptStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.DEFAULT_SCRIPT_NAME); - try { - FileUtil.writeToFile( - new File(testDir, GradleConstants.DEFAULT_SCRIPT_NAME), - FileUtil.loadTextAndClose(buildScriptStream) - ); - } - finally { - StreamUtil.closeStream(buildScriptStream); - } - - InputStream settingsStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.SETTINGS_FILE_NAME); - try { - if (settingsStream != null) { - FileUtil.writeToFile( - new File(testDir, GradleConstants.SETTINGS_FILE_NAME), - FileUtil.loadTextAndClose(settingsStream) - ); - } - } - finally { - StreamUtil.closeStream(settingsStream); - } - - GradleConnector connector = GradleConnector.newConnector(); - - URI distributionUri = new DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion)); - connector.useDistribution(distributionUri); - connector.forProjectDirectory(testDir); - int daemonMaxIdleTime = 10; - try { - daemonMaxIdleTime = Integer.parseInt(System.getProperty("gradleDaemonMaxIdleTime", "10")); - } - catch (NumberFormatException ignore) { - } - - ((DefaultGradleConnector) connector).daemonMaxIdleTime(daemonMaxIdleTime, TimeUnit.SECONDS); - ProjectConnection connection = connector.connect(); - - try { - ProjectImportAction projectImportAction = new ProjectImportAction(false); - projectImportAction.addExtraProjectModelClasses(getModels()); - BuildActionExecuter buildActionExecutor = connection.action(projectImportAction); - File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses()); - assertNotNull(initScript); - String jdkHome = IdeaTestUtil.requireRealJdkHome(); - buildActionExecutor.setJavaHome(new File(jdkHome)); - buildActionExecutor.setJvmArguments("-Xmx128m", "-XX:MaxPermSize=64m"); - buildActionExecutor - .withArguments("--info", "--recompile-scripts", GradleConstants.INIT_SCRIPT_CMD_OPTION, initScript.getAbsolutePath()); - allModels = buildActionExecutor.run(); - assertNotNull(allModels); - } - finally { - connection.close(); - } - } - - @NotNull - private static Set getToolingExtensionClasses() { - Set classes = ContainerUtil.set( - ExternalProject.class, - // gradle-tooling-extension-api jar - ProjectImportAction.class, - // gradle-tooling-extension-impl jar - ModelBuildScriptClasspathBuilderImpl.class, - Multimap.class, - ShortTypeHandling.class - ); - - ContainerUtil.addAllNotNull(classes, doGetToolingExtensionClasses()); - return classes; - } - - @NotNull - private static Set doGetToolingExtensionClasses() { - return Collections.emptySet(); - } - - @After - public void tearDown() throws Exception { - if (testDir != null) { - FileUtil.delete(testDir); - } - } - - protected abstract Set getModels(); - - - private Map getModulesMap(final Class aClass) { - DomainObjectSet ideaModules = allModels.getIdeaProject().getModules(); - - final String filterKey = "to_filter"; - Map map = ContainerUtil.map2Map(ideaModules, new Function>() { - @Override - public Pair fun(IdeaModule module) { - T value = allModels.getExtraProject(module, aClass); - String key = value != null ? module.getGradleProject().getPath() : filterKey; - return Pair.create(key, value); - } - }); - - map.remove(filterKey); - return map; - } - - private static void ensureTempDirCreated() throws IOException { - if (ourTempDir != null) return; - - ourTempDir = new File(FileUtil.getTempDirectory(), "gradleTests"); - FileUtil.delete(ourTempDir); - FileUtil.ensureExists(ourTempDir); - } - - public static class DistributionLocator { - private static final String RELEASE_REPOSITORY_ENV = "GRADLE_RELEASE_REPOSITORY"; - private static final String SNAPSHOT_REPOSITORY_ENV = "GRADLE_SNAPSHOT_REPOSITORY"; - private static final String GRADLE_RELEASE_REPO = "https://services.gradle.org/distributions"; - private static final String GRADLE_SNAPSHOT_REPO = "https://services.gradle.org/distributions-snapshots"; - - @NotNull private final String myReleaseRepoUrl; - @NotNull private final String mySnapshotRepoUrl; - - public DistributionLocator() { - this(DistributionLocator.getRepoUrl(false), DistributionLocator.getRepoUrl(true)); - } - - public DistributionLocator(@NotNull String releaseRepoUrl, @NotNull String snapshotRepoUrl) { - myReleaseRepoUrl = releaseRepoUrl; - mySnapshotRepoUrl = snapshotRepoUrl; - } - - @NotNull - public URI getDistributionFor(@NotNull GradleVersion version) throws URISyntaxException { - return getDistribution(getDistributionRepository(version), version, "gradle", "bin"); - } - - @NotNull - private String getDistributionRepository(@NotNull GradleVersion version) { - return version.isSnapshot() ? mySnapshotRepoUrl : myReleaseRepoUrl; - } - - private static URI getDistribution( - @NotNull String repositoryUrl, - @NotNull GradleVersion version, - @NotNull String archiveName, - @NotNull String archiveClassifier - ) throws URISyntaxException { - return new URI(String.format("%s/%s-%s-%s.zip", repositoryUrl, archiveName, version.getVersion(), archiveClassifier)); - } - - @NotNull - public static String getRepoUrl(boolean isSnapshotUrl) { - String envRepoUrl = System.getenv(isSnapshotUrl ? SNAPSHOT_REPOSITORY_ENV : RELEASE_REPOSITORY_ENV); - if (envRepoUrl != null) return envRepoUrl; - - return isSnapshotUrl ? GRADLE_SNAPSHOT_REPO : GRADLE_RELEASE_REPO; - } - } -} diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as34 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as34 deleted file mode 100644 index bd96057db50..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as34 +++ /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-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.183 b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.183 deleted file mode 100644 index b463decc3e8..00000000000 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.183 +++ /dev/null @@ -1,30 +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.config - -import org.jetbrains.jps.model.ex.JpsElementTypeBase -import org.jetbrains.jps.model.java.JavaResourceRootProperties -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JpsJavaExtensionService -import org.jetbrains.jps.model.module.JpsModuleSourceRootType - -sealed class KotlinResourceRootType(val isTest: Boolean) : JpsElementTypeBase(), - JpsModuleSourceRootType, KotlinRootType { - - override fun createDefaultProperties() = - JpsJavaExtensionService.getInstance().createResourceRootProperties("", false) - - override fun isTestRoot() = isTest - - override fun isForTests() = isTest - - override fun equals(other: Any?) = if (super.equals(other)) true else isSameRootType(this, other) -} - -object ResourceKotlinRootType : KotlinResourceRootType(false) -object TestResourceKotlinRootType : KotlinResourceRootType(true) - -val ALL_KOTLIN_RESOURCE_ROOT_TYPES = setOf(ResourceKotlinRootType, TestResourceKotlinRootType) \ No newline at end of file diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.as34 b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.as34 deleted file mode 100644 index 68a27ba200a..00000000000 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinResourceRootType.kt.as34 +++ /dev/null @@ -1,28 +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.config - -import org.jetbrains.jps.model.ex.JpsElementTypeBase -import org.jetbrains.jps.model.java.JavaResourceRootProperties -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JpsJavaExtensionService -import org.jetbrains.jps.model.module.JpsModuleSourceRootType - -sealed class KotlinResourceRootType(val isTest: Boolean) : JpsElementTypeBase(), - JpsModuleSourceRootType, KotlinRootType { - - override fun createDefaultProperties() = - JpsJavaExtensionService.getInstance().createResourceRootProperties("", false) - - override fun isTestRoot() = isTest - - override fun equals(other: Any?) = if (super.equals(other)) true else isSameRootType(this, other) -} - -object ResourceKotlinRootType : KotlinResourceRootType(false) -object TestResourceKotlinRootType : KotlinResourceRootType(true) - -val ALL_KOTLIN_RESOURCE_ROOT_TYPES = setOf(ResourceKotlinRootType, TestResourceKotlinRootType) \ No newline at end of file diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt.183 b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt.183 deleted file mode 100644 index a2549ea2e2c..00000000000 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt.183 +++ /dev/null @@ -1,24 +0,0 @@ -package org.jetbrains.kotlin.config - -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JavaSourceRootType - -interface KotlinRootType { - fun isTestRoot(): Boolean -} - -//Hack required to fix critical bug KT-27718 it should be removed after support of source root types other than JavaSourceRootType in Idea Core -fun isSameRootType(kotlinRoot: KotlinRootType, other: Any?): Boolean { - if (kotlinRoot.isTestRoot()) { - if (other is JavaResourceRootType || other is JavaSourceRootType) { - val invokeLevel = 3 - val stack = Thread.currentThread().stackTrace - if (stack.size > invokeLevel && "isTestSource" == stack[invokeLevel].methodName && "com.intellij.openapi.roots.impl.SourceFolderImpl" == stack[invokeLevel].className) { - if (JavaResourceRootType.TEST_RESOURCE == other || JavaSourceRootType.TEST_SOURCE == other) { - return true - } - } - } - } - return false -} diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.183 b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.183 deleted file mode 100644 index 2636a916213..00000000000 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.183 +++ /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. - */ - -package org.jetbrains.kotlin.config - -import org.jetbrains.jps.model.ex.JpsElementTypeBase -import org.jetbrains.jps.model.java.JavaSourceRootProperties -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.jps.model.java.JpsJavaExtensionService -import org.jetbrains.jps.model.module.JpsModuleSourceRootType - -sealed class KotlinSourceRootType(val isTest: Boolean) : JpsElementTypeBase(), JpsModuleSourceRootType, KotlinRootType { - - - override fun createDefaultProperties() = JpsJavaExtensionService.getInstance().createSourceRootProperties("") - - - override fun isTestRoot() = isTest - - override fun isForTests() = isTest - - override fun equals(other: Any?) = if (super.equals(other)) true else isSameRootType(this, other) -} - -object SourceKotlinRootType : KotlinSourceRootType(false) - -object TestSourceKotlinRootType : KotlinSourceRootType(true) - -val ALL_KOTLIN_SOURCE_ROOT_TYPES = setOf(SourceKotlinRootType, TestSourceKotlinRootType) diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.as34 b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.as34 deleted file mode 100644 index 07d7033c5d1..00000000000 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinSourceRootType.kt.as34 +++ /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. - */ - -package org.jetbrains.kotlin.config - -import org.jetbrains.jps.model.ex.JpsElementTypeBase -import org.jetbrains.jps.model.java.JavaSourceRootProperties -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.jps.model.java.JpsJavaExtensionService -import org.jetbrains.jps.model.module.JpsModuleSourceRootType - -sealed class KotlinSourceRootType(val isTest: Boolean) : JpsElementTypeBase(), JpsModuleSourceRootType, KotlinRootType { - - - override fun createDefaultProperties() = JpsJavaExtensionService.getInstance().createSourceRootProperties("") - - - override fun isTestRoot() = isTest - - fun isForTests() = isTest - - override fun equals(other: Any?) = if (super.equals(other)) true else isSameRootType(this, other) -} - -object SourceKotlinRootType : KotlinSourceRootType(false) - -object TestSourceKotlinRootType : KotlinSourceRootType(true) - -val ALL_KOTLIN_SOURCE_ROOT_TYPES = setOf(SourceKotlinRootType, TestSourceKotlinRootType) diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/commandHelper.kt.183 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/commandHelper.kt.183 deleted file mode 100644 index 40b8281aadf..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/commandHelper.kt.183 +++ /dev/null @@ -1,13 +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.output - -import com.intellij.openapi.command.CommandProcessor - -// BUNCH: 183 -fun executeCommand(command: () -> Unit) { - CommandProcessor.getInstance().executeCommand(null, command, null, null) -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/inlayHelper.kt.183 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/inlayHelper.kt.183 deleted file mode 100644 index 18907f5b182..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/inlayHelper.kt.183 +++ /dev/null @@ -1,19 +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. - */ - -@file:Suppress("UnstableApiUsage") - -package org.jetbrains.kotlin.idea.scratch.output - -import com.intellij.openapi.editor.InlayModel - -// BUNCH: 183 -fun InlayModel.addInlay(offset: Int, renderer: InlayScratchFileRenderer) { - addInlineElement(offset, true, renderer) -} - -// BUNCH: 183 -fun InlayModel.getInlays(start: Int, end: Int) = - getInlineElementsInRange(start, end).filter { it.renderer is InlayScratchFileRenderer } \ No newline at end of file diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/ModulesComboBoxAction.kt.183 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/ModulesComboBoxAction.kt.183 deleted file mode 100644 index 314f22af31e..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/ModulesComboBoxAction.kt.183 +++ /dev/null @@ -1,79 +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.ui - -import com.intellij.execution.ui.ConfigurationModuleSelector -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.DefaultActionGroup -import com.intellij.openapi.actionSystem.Presentation -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.module.ModuleType -import com.intellij.openapi.project.DumbAwareAction -import com.intellij.openapi.vcs.changes.committed.LabeledComboBoxAction -import com.intellij.util.ui.UIUtil -import org.jetbrains.annotations.TestOnly -import org.jetbrains.kotlin.idea.KotlinBundle -import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo -import org.jetbrains.kotlin.idea.caches.project.testSourceInfo -import org.jetbrains.kotlin.idea.scratch.ScratchFile -import org.jetbrains.kotlin.idea.scratch.isKotlinWorksheet -import javax.swing.JComponent - -class ModulesComboBoxAction(private val scratchFile: ScratchFile) : LabeledComboBoxAction(KotlinBundle.message("scratch.module.combobox")) { - override fun createPopupActionGroup(button: JComponent): DefaultActionGroup { - val actionGroup = DefaultActionGroup() - actionGroup.add(ModuleIsNotSelectedAction(ConfigurationModuleSelector.NO_MODULE_TEXT)) - - val modules = ModuleManager.getInstance(scratchFile.project).modules.filter { - it.productionSourceInfo() != null || it.testSourceInfo() != null - } - - actionGroup.addAll(modules.map { SelectModuleAction(it) }) - - return actionGroup - } - - /** - * By default this action uses big font for label, so we have to decrease it - * to make it look the same as in [CheckboxAction]. - */ - override fun createCustomComponent(presentation: Presentation): JComponent { - val customComponent = super.createCustomComponent(presentation) - customComponent.components.forEach { it.font = UIUtil.getFont(UIUtil.FontSize.SMALL, it.font) } - return customComponent - } - - override fun update(e: AnActionEvent) { - super.update(e) - val selectedModule = scratchFile.module?.takeIf { !it.isDisposed } - - e.presentation.apply { - icon = selectedModule?.let { ModuleType.get(it).icon } - text = selectedModule?.name ?: ConfigurationModuleSelector.NO_MODULE_TEXT - } - - e.presentation.isVisible = isModuleSelectorVisible() - } - - @TestOnly - fun isModuleSelectorVisible(): Boolean { - return !scratchFile.file.isKotlinWorksheet - } - - private inner class ModuleIsNotSelectedAction(placeholder: String) : DumbAwareAction(placeholder) { - override fun actionPerformed(e: AnActionEvent) { - scratchFile.setModule(null) - } - } - - private inner class SelectModuleAction(private val module: Module) : - DumbAwareAction(module.name, null, ModuleType.get(module).icon) { - override fun actionPerformed(e: AnActionEvent) { - scratchFile.setModule(module) - } - } -} \ No newline at end of file diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/SmallBorderCheckboxAction.kt.183 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/SmallBorderCheckboxAction.kt.183 deleted file mode 100644 index 855bae57d16..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/SmallBorderCheckboxAction.kt.183 +++ /dev/null @@ -1,19 +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.ui - -import com.intellij.openapi.actionSystem.Presentation -import com.intellij.openapi.actionSystem.ex.CheckboxAction -import com.intellij.util.ui.JBUI -import javax.swing.JComponent - -abstract class SmallBorderCheckboxAction(text: String, description: String? = null) : CheckboxAction(text, description, null) { - override fun createCustomComponent(presentation: Presentation): JComponent { - val checkbox = super.createCustomComponent(presentation) - checkbox.border = JBUI.Borders.emptyRight(4) - return checkbox - } -} \ No newline at end of file diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenArtifactsDownloadScheduler.kt.183 b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenArtifactsDownloadScheduler.kt.183 deleted file mode 100644 index 972e693d9c2..00000000000 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenArtifactsDownloadScheduler.kt.183 +++ /dev/null @@ -1,21 +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.maven - -import com.intellij.openapi.util.AsyncResult -import org.jetbrains.idea.maven.model.MavenArtifact -import org.jetbrains.idea.maven.project.MavenProject -import org.jetbrains.idea.maven.project.MavenProjectsManager - -//BUNCH: 183 -fun scheduleArtifactsDownloading( - projectsManager: MavenProjectsManager, - projects: List, - toBeDownloaded: List -) { - //true, false, AsyncResult() - projectsManager.scheduleArtifactsDownloading(projects, toBeDownloaded, true, false, AsyncResult()) -} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt.183 b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt.183 deleted file mode 100644 index 11bf246a472..00000000000 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt.183 +++ /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.debugger.filter - -class KotlinSyntheticTypeComponentProvider : KotlinSyntheticTypeComponentProviderBase() \ No newline at end of file diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.183 b/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.183 deleted file mode 100644 index 40908e67468..00000000000 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/testFramework/projectRoutines.kt.183 +++ /dev/null @@ -1,102 +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.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.editor.Document -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.fileEditor.FileEditorManager -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.EdtTestUtil -import com.intellij.testFramework.PlatformTestUtil -import com.intellij.testFramework.runInEdtAndWait -import com.intellij.util.ThrowableRunnable -import com.intellij.util.ui.UIUtil -import org.jetbrains.kotlin.idea.parameterInfo.HintType -import java.io.PrintWriter -import java.io.StringWriter - -fun commitAllDocuments() { - ProjectManagerEx.getInstanceEx().openProjects.forEach { project -> - val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase - - EdtTestUtil.runInEdtAndWait(ThrowableRunnable { - psiDocumentManagerBase.clearUncommittedDocuments() - psiDocumentManagerBase.commitAllDocuments() - }) - } -} - -fun commitDocument(project: Project, document: Document) { - val psiDocumentManagerBase = PsiDocumentManager.getInstance(project) as PsiDocumentManagerBase - - EdtTestUtil.runInEdtAndWait(ThrowableRunnable { - psiDocumentManagerBase.commitDocument(document) - }) -} - -fun saveDocument(document: Document) { - val fileDocumentManager = FileDocumentManager.getInstance() - - runInEdtAndWait { - fileDocumentManager.saveDocument(document) - } -} - -fun enableHints(enable: Boolean) = - HintType.values().forEach { it.option.set(enable) } - -fun dispatchAllInvocationEvents() { - runInEdtAndWait { - UIUtil.dispatchAllInvocationEvents() - } -} - -fun loadProjectWithName(path: String, name: String): Project? = - ProjectManagerEx.getInstanceEx().loadProject(name, path) - -fun closeProject(project: Project) { - dispatchAllInvocationEvents() - val projectManagerEx = ProjectManagerEx.getInstanceEx() - projectManagerEx.closeAndDispose(project) -} - -fun runStartupActivities(project: Project) { - with(StartupManager.getInstance(project) as StartupManagerImpl) { - scheduleInitialVfsRefresh() - runStartupActivities() - runPostStartupActivities() - } -} - -fun waitForAllEditorsFinallyLoaded(project: Project) { - // 183 does not have this public api -} - -// BUNCH: 183 -fun replaceWithCustomHighlighter(parentDisposable: Disposable, fromImplementationClass: String, toImplementationClass: String) { - // 183 does not have this public api -} - -fun logMessage(message: () -> String) { - println("-- ${message()}") -} - -fun logMessage(t: Throwable, message: () -> String) { - val writer = StringWriter() - PrintWriter(writer).use { - t.printStackTrace(it) - } - println("-- ${message()}:\n$writer") -} \ No newline at end of file diff --git a/idea/resources/META-INF/android-lint.xml.as34 b/idea/resources/META-INF/android-lint.xml.as34 deleted file mode 100644 index 5a029687008..00000000000 --- a/idea/resources/META-INF/android-lint.xml.as34 +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/idea/resources/META-INF/extensions/ide.xml.183 b/idea/resources/META-INF/extensions/ide.xml.183 deleted file mode 100644 index 4d90ad76ecc..00000000000 --- a/idea/resources/META-INF/extensions/ide.xml.183 +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/extensions/ide.xml.as34 b/idea/resources/META-INF/extensions/ide.xml.as34 deleted file mode 100644 index 035292e156f..00000000000 --- a/idea/resources/META-INF/extensions/ide.xml.as34 +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/git4idea.xml.as34 b/idea/resources/META-INF/git4idea.xml.as34 deleted file mode 100644 index 1bb24d148a3..00000000000 --- a/idea/resources/META-INF/git4idea.xml.as34 +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/idea/resources/META-INF/gradle-java.xml.183 b/idea/resources/META-INF/gradle-java.xml.183 deleted file mode 100644 index 8e6ce79e0f2..00000000000 --- a/idea/resources/META-INF/gradle-java.xml.183 +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/gradle-java.xml.as34 b/idea/resources/META-INF/gradle-java.xml.as34 deleted file mode 100644 index 5dad8343267..00000000000 --- a/idea/resources/META-INF/gradle-java.xml.as34 +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/gradle.xml.183 b/idea/resources/META-INF/gradle.xml.183 deleted file mode 100644 index df2d2e74693..00000000000 --- a/idea/resources/META-INF/gradle.xml.183 +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/jvm.xml.183 b/idea/resources/META-INF/jvm.xml.183 deleted file mode 100644 index 0fb4cc1c662..00000000000 --- a/idea/resources/META-INF/jvm.xml.183 +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - org.jetbrains.kotlin.idea.JvmPluginStartupComponent - - - - - - org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager - - - org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent - - - org.jetbrains.kotlin.idea.scratch.ScratchFileModuleInfoProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/plugin.xml.183 b/idea/resources/META-INF/plugin.xml.183 deleted file mode 100644 index 5270adef464..00000000000 --- a/idea/resources/META-INF/plugin.xml.183 +++ /dev/null @@ -1,71 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - com.intellij.modules.platform - - JUnit - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle.java - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - org.jetbrains.android - Coverage - com.intellij.java-i18n - org.jetbrains.java.decompiler - Git4Idea - org.jetbrains.debugger.streams - - - - - com.intellij.modules.idea - com.intellij.modules.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/idea/resources/META-INF/plugin.xml.as34 b/idea/resources/META-INF/plugin.xml.as34 deleted file mode 100644 index 2f042d70968..00000000000 --- a/idea/resources/META-INF/plugin.xml.as34 +++ /dev/null @@ -1,75 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - com.intellij.modules.platform - com.intellij.modules.androidstudio - - JUnit - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle.java - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - com.intellij.copyright - 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/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as34 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as34 deleted file mode 100644 index c1ae1f2d614..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as34 +++ /dev/null @@ -1,15 +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 - -// BUNCH: as35 -// BUNCH: as34 -internal fun createDslStyleIcon(styleId: Int): Icon { - return AllIcons.Gutter.Colors -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/expectactual/escapeXML.kt.183 b/idea/src/org/jetbrains/kotlin/idea/quickfix/expectactual/escapeXML.kt.183 deleted file mode 100644 index aaba5c50915..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/expectactual/escapeXML.kt.183 +++ /dev/null @@ -1,10 +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.expectactual - -import com.intellij.openapi.util.text.StringUtil - -fun escapeXml(text: String): String = StringUtil.escapeXml(text) \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt.183 b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt.183 deleted file mode 100644 index 4ffc971b26e..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt.183 +++ /dev/null @@ -1,395 +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.idea.refactoring.move.moveDeclarations - -import com.intellij.ide.highlighter.JavaFileType -import com.intellij.ide.util.EditorHelper -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Ref -import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiNamedElement -import com.intellij.psi.PsiReference -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.search.searches.ReferencesSearch -import com.intellij.refactoring.BaseRefactoringProcessor -import com.intellij.refactoring.move.MoveCallback -import com.intellij.refactoring.move.MoveMultipleElementsViewDescriptor -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 -import com.intellij.usageView.UsageViewUtil -import com.intellij.util.IncorrectOperationException -import com.intellij.util.containers.MultiMap -import gnu.trove.THashMap -import gnu.trove.TObjectHashingStrategy -import org.jetbrains.kotlin.asJava.elements.KtLightDeclaration -import org.jetbrains.kotlin.asJava.findFacadeClass -import org.jetbrains.kotlin.asJava.namedUnwrappedElement -import org.jetbrains.kotlin.asJava.toLightElements -import org.jetbrains.kotlin.idea.codeInsight.shorten.addToBeShortenedDescendantsToWaitingSet -import org.jetbrains.kotlin.idea.core.deleteSingle -import org.jetbrains.kotlin.idea.core.quoteIfNeeded -import org.jetbrains.kotlin.idea.refactoring.broadcastRefactoringExit -import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName -import org.jetbrains.kotlin.idea.refactoring.move.* -import org.jetbrains.kotlin.idea.refactoring.move.moveFilesOrDirectories.MoveKotlinClassHandler -import org.jetbrains.kotlin.idea.search.projectScope -import org.jetbrains.kotlin.idea.search.restrictByFileType -import org.jetbrains.kotlin.idea.util.projectStructure.module -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject -import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext -import org.jetbrains.kotlin.psi.psiUtil.isAncestor -import org.jetbrains.kotlin.utils.ifEmpty -import org.jetbrains.kotlin.utils.keysToMap -import java.util.* - -interface Mover : (KtNamedDeclaration, KtElement) -> KtNamedDeclaration { - object Default : Mover { - override fun invoke(originalElement: KtNamedDeclaration, targetContainer: KtElement): KtNamedDeclaration { - return when (targetContainer) { - is KtFile -> { - val declarationContainer: KtElement = - if (targetContainer.isScript()) targetContainer.script!!.blockExpression else targetContainer - declarationContainer.add(originalElement) as KtNamedDeclaration - } - is KtClassOrObject -> targetContainer.addDeclaration(originalElement) - else -> error("Unexpected element: ${targetContainer.getElementTextWithContext()}") - }.apply { - val container = originalElement.containingClassOrObject - if (container is KtObjectDeclaration && container.isCompanion() && container.declarations.singleOrNull() == originalElement) { - container.deleteSingle() - } - else { - originalElement.deleteSingle() - } - } - } - } -} - -sealed class MoveSource { - abstract val elementsToMove: Collection - - class Elements(override val elementsToMove: Collection) : MoveSource() - - class File(val file: KtFile) : MoveSource() { - override val elementsToMove: Collection - get() = file.declarations.filterIsInstance() - } -} - -fun MoveSource(declaration: KtNamedDeclaration) = MoveSource.Elements(listOf(declaration)) -fun MoveSource(declarations: Collection) = MoveSource.Elements(declarations) -fun MoveSource(file: KtFile) = MoveSource.File(file) - -class MoveDeclarationsDescriptor @JvmOverloads constructor( - val project: Project, - val moveSource: MoveSource, - val moveTarget: KotlinMoveTarget, - val delegate: MoveDeclarationsDelegate, - val searchInCommentsAndStrings: Boolean = true, - val searchInNonCode: Boolean = true, - val deleteSourceFiles: Boolean = false, - val moveCallback: MoveCallback? = null, - val openInEditor: Boolean = false, - val allElementsToMove: List? = null, - val analyzeConflicts: Boolean = true, - val searchReferences: Boolean = true -) - -class ConflictUsageInfo(element: PsiElement, val messages: Collection) : UsageInfo(element) - -private object ElementHashingStrategy : TObjectHashingStrategy { - override fun equals(e1: PsiElement?, e2: PsiElement?): Boolean { - if (e1 === e2) return true - // Name should be enough to distinguish different light elements based on the same original declaration - if (e1 is KtLightDeclaration<*, *> && e2 is KtLightDeclaration<*, *>) { - return e1.kotlinOrigin == e2.kotlinOrigin && e1.name == e2.name - } - return e1 == e2 - } - - override fun computeHashCode(e: PsiElement?): Int { - return when (e) { - null -> 0 - is KtLightDeclaration<*, *> -> (e.kotlinOrigin?.hashCode() ?: 0) * 31 + (e.name?.hashCode() ?: 0) - else -> e.hashCode() - } - } -} - -class MoveKotlinDeclarationsProcessor( - val descriptor: MoveDeclarationsDescriptor, - val mover: Mover = Mover.Default, - private val throwOnConflicts: Boolean = false) : BaseRefactoringProcessor(descriptor.project) { - companion object { - private val REFACTORING_NAME = "Move declarations" - val REFACTORING_ID = "move.kotlin.declarations" - } - - val project get() = descriptor.project - - private var nonCodeUsages: Array? = null - private val moveEntireFile = descriptor.moveSource is MoveSource.File - private val elementsToMove = descriptor.moveSource.elementsToMove.filter { e -> e.parent != descriptor.moveTarget.getTargetPsiIfExists(e) } - private val kotlinToLightElementsBySourceFile = elementsToMove - .groupBy { it.containingKtFile } - .mapValues { it.value.keysToMap { it.toLightElements().ifEmpty { listOf(it) } } } - private val conflicts = MultiMap() - - override fun getRefactoringId() = REFACTORING_ID - - override fun createUsageViewDescriptor(usages: Array): UsageViewDescriptor { - val targetContainerFqName = descriptor.moveTarget.targetContainerFqName?.let { - if (it.isRoot) UsageViewBundle.message("default.package.presentable.name") else it.asString() - } - return MoveMultipleElementsViewDescriptor(elementsToMove.toTypedArray(), targetContainerFqName) - } - - fun getConflictsAsUsages(): List = conflicts.entrySet().map { ConflictUsageInfo(it.key, it.value) } - - public override fun findUsages(): Array { - if (!descriptor.searchReferences || elementsToMove.isEmpty()) return UsageInfo.EMPTY_ARRAY - - val newContainerName = descriptor.moveTarget.targetContainerFqName?.asString() ?: "" - - fun getSearchScope(element: PsiElement): GlobalSearchScope? { - val projectScope = project.projectScope() - val ktDeclaration = element.namedUnwrappedElement as? KtNamedDeclaration ?: return projectScope - if (ktDeclaration.hasModifier(KtTokens.PRIVATE_KEYWORD)) return projectScope - val moveTarget = descriptor.moveTarget - val (oldContainer, newContainer) = descriptor.delegate.getContainerChangeInfo(ktDeclaration, moveTarget) - val targetModule = moveTarget.getTargetModule(project) ?: return projectScope - if (oldContainer != newContainer || ktDeclaration.module != targetModule) return projectScope - // Check if facade class may change - if (newContainer is ContainerInfo.Package) { - val javaScope = projectScope.restrictByFileType(JavaFileType.INSTANCE) - val currentFile = ktDeclaration.containingKtFile - val newFile = when (moveTarget) { - is KotlinMoveTargetForExistingElement -> moveTarget.targetElement as? KtFile ?: return null - is KotlinMoveTargetForDeferredFile -> return javaScope - else -> return null - } - val currentFacade = currentFile.findFacadeClass() - val newFacade = newFile.findFacadeClass() - return if (currentFacade?.qualifiedName != newFacade?.qualifiedName) javaScope else null - } - return null - } - - fun collectUsages(kotlinToLightElements: Map>, result: MutableCollection) { - kotlinToLightElements.values.flatten().flatMapTo(result) { lightElement -> - val searchScope = getSearchScope(lightElement) ?: return@flatMapTo emptyList() - - val newFqName = StringUtil.getQualifiedName(newContainerName, lightElement.name) - val newFqNameForKt = StringUtil.getQualifiedName( - newContainerName, - lightElement.namedUnwrappedElement?.name?: lightElement.name - ) - - val foundReferences = HashSet() - val results = ReferencesSearch - .search(lightElement, searchScope) - .mapNotNullTo(ArrayList()) { ref -> - if (foundReferences.add(ref) && elementsToMove.none { it.isAncestor(ref.element)}) { - createMoveUsageInfoIfPossible(ref, lightElement, true, false) - } - else null - } - - val name = lightElement.getKotlinFqName()?.quoteIfNeeded()?.asString() - if (name != null) { - TextOccurrencesUtil.findNonCodeUsages( - lightElement, - name, - descriptor.searchInCommentsAndStrings, - descriptor.searchInNonCode, - FqName(newFqName).quoteIfNeeded().asString(), - results - ) - } - - MoveClassHandler.EP_NAME.extensions.forEach { handler -> - if (handler !is MoveKotlinClassHandler) handler.preprocessUsages(results) - } - - results - .filter { it is NonCodeUsageInfo && it.file is KtFile } - .forEach { - val newText = NonCodeUsageInfo::class.java.getField("newText") - // A 'newText' is marked as final initially, but here we need to change it to prevent - // light-class names in kotlin files. - val oldAccessibility = newText.isAccessible - newText.isAccessible = true - newText.set(it, newFqNameForKt) - // Restore initial accessibility of 'newText' field. - newText.isAccessible = oldAccessibility - } - - results - } - } - - val usages = ArrayList() - val conflictChecker = MoveConflictChecker( - project, - elementsToMove, - descriptor.moveTarget, - elementsToMove.first(), - allElementsToMove = descriptor.allElementsToMove - ) - for ((sourceFile, kotlinToLightElements) in kotlinToLightElementsBySourceFile) { - val internalUsages = LinkedHashSet() - val externalUsages = LinkedHashSet() - - if (moveEntireFile) { - val changeInfo = ContainerChangeInfo( - ContainerInfo.Package(sourceFile.packageFqName), - descriptor.moveTarget.targetContainerFqName?.let { ContainerInfo.Package(it) } ?: ContainerInfo.UnknownPackage - ) - internalUsages += sourceFile.getInternalReferencesToUpdateOnPackageNameChange(changeInfo) - } - else { - kotlinToLightElements.keys.forEach { - val packageNameInfo = descriptor.delegate.getContainerChangeInfo(it, descriptor.moveTarget) - internalUsages += it.getInternalReferencesToUpdateOnPackageNameChange(packageNameInfo) - } - } - - internalUsages += descriptor.delegate.findInternalUsages(descriptor) - collectUsages(kotlinToLightElements, externalUsages) - if (descriptor.analyzeConflicts) { - conflictChecker.checkAllConflicts(externalUsages, internalUsages, conflicts) - descriptor.delegate.collectConflicts(descriptor, internalUsages, conflicts) - } - - usages += internalUsages - usages += externalUsages - } - - return UsageViewUtil.removeDuplicatedUsages(usages.toTypedArray()) - } - - override fun preprocessUsages(refUsages: Ref>): Boolean { - return showConflicts(conflicts, refUsages.get()) - } - - override fun showConflicts(conflicts: MultiMap, usages: Array?): Boolean { - if (throwOnConflicts && !conflicts.isEmpty) throw RefactoringConflictsFoundException() - return super.showConflicts(conflicts, usages) - } - - override fun performRefactoring(usages: Array) = doPerformRefactoring(usages.toList()) - - internal fun doPerformRefactoring(usages: List) { - fun moveDeclaration(declaration: KtNamedDeclaration, moveTarget: KotlinMoveTarget): KtNamedDeclaration { - val targetContainer = moveTarget.getOrCreateTargetPsi(declaration) - ?: throw AssertionError("Couldn't create Kotlin file for: ${declaration::class.java}: ${declaration.text}") - descriptor.delegate.preprocessDeclaration(descriptor, declaration) - if (moveEntireFile) return declaration - return mover(declaration, targetContainer).apply { - addToBeShortenedDescendantsToWaitingSet() - } - } - - val (oldInternalUsages, externalUsages) = usages.partition { it is KotlinMoveUsage && it.isInternal } - val newInternalUsages = ArrayList() - - markInternalUsages(oldInternalUsages) - - val usagesToProcess = ArrayList(externalUsages) - - try { - descriptor.delegate.preprocessUsages(descriptor, usages) - - val oldToNewElementsMapping = THashMap(ElementHashingStrategy) - - val newDeclarations = ArrayList() - - for ((sourceFile, kotlinToLightElements) in kotlinToLightElementsBySourceFile) { - for ((oldDeclaration, oldLightElements) in kotlinToLightElements) { - val elementListener = transaction?.getElementListener(oldDeclaration) - - val newDeclaration = moveDeclaration(oldDeclaration, descriptor.moveTarget) - newDeclarations += newDeclaration - - oldToNewElementsMapping[oldDeclaration] = newDeclaration - oldToNewElementsMapping[sourceFile] = newDeclaration.containingKtFile - - elementListener?.elementMoved(newDeclaration) - for ((oldElement, newElement) in oldLightElements.asSequence().zip(newDeclaration.toLightElements().asSequence())) { - oldToNewElementsMapping[oldElement] = newElement - } - - if (descriptor.openInEditor) { - EditorHelper.openInEditor(newDeclaration) - } - } - - if (descriptor.deleteSourceFiles) { - sourceFile.delete() - } - } - - val internalUsageScopes: List = if (moveEntireFile) { - newDeclarations.asSequence().map { it.containingKtFile }.distinct().toList() - } else { - newDeclarations - } - internalUsageScopes.forEach { newInternalUsages += restoreInternalUsages(it, oldToNewElementsMapping) } - - usagesToProcess += newInternalUsages - - nonCodeUsages = postProcessMoveUsages(usagesToProcess, oldToNewElementsMapping).toTypedArray() - } - catch (e: IncorrectOperationException) { - nonCodeUsages = null - RefactoringUIUtil.processIncorrectOperation(myProject, e) - } - finally { - cleanUpInternalUsages(newInternalUsages + oldInternalUsages) - } - } - - override fun performPsiSpoilingRefactoring() { - nonCodeUsages?.let { nonCodeUsages -> RenameUtil.renameNonCodeUsages(myProject, nonCodeUsages) } - descriptor.moveCallback?.refactoringCompleted() - } - - fun execute(usages: List) { - execute(usages.toTypedArray()) - } - - override fun doRun() { - try { - super.doRun() - } finally { - broadcastRefactoringExit(myProject, refactoringId) - } - } - - override fun getCommandName(): String = REFACTORING_NAME -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as34 b/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as34 deleted file mode 100644 index f6dcd38c87e..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as34 +++ /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.183 b/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.183 deleted file mode 100644 index 21391929097..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinTargetElementEvaluator.kt.183 +++ /dev/null @@ -1,122 +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.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.NEW_AS_CONSTRUCTOR != 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/compat/nullability.kt.183 b/idea/src/org/jetbrains/kotlin/idea/slicer/compat/nullability.kt.183 deleted file mode 100644 index d5f84240a69..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/compat/nullability.kt.183 +++ /dev/null @@ -1,11 +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.slicer.compat - -import com.intellij.psi.PsiElement - -// BUNCH: 183 -internal typealias PsiElement_N183_NN191 = PsiElement? \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as34 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as34 deleted file mode 100644 index 52783db2008..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as34 +++ /dev/null @@ -1,39 +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.FeatureStatisticsBundleProvider -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.Extensions -import java.lang.IllegalStateException - -private const val CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME = "com.jetbrains.cidr.lang.OCFeatureStatisticsBundleProvider" - -// Remove the function, when there's no dependency to cidr during running Kotlin tests. -fun registerAdditionalResourceBundleInTests() { - if (!ApplicationManager.getApplication().isUnitTestMode) { - return - } - - val isAlreadyRegistered = FeatureStatisticsBundleProvider.EP_NAME.extensions.any { provider -> - provider.javaClass.name == CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME - } - if (isAlreadyRegistered) { - throw IllegalStateException("Remove this registration for the current platform: bundle is already registered.") - } - - val cidrFSBundleProviderClass = try { - Class.forName(CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME) - } catch (_: ClassNotFoundException) { - return - } - - val cidrFSBundleProvider = cidrFSBundleProviderClass.newInstance() as FeatureStatisticsBundleProvider - - Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleProvider.EP_NAME).registerExtension(cidrFSBundleProvider) -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as34 b/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as34 deleted file mode 100644 index 972a0c0faba..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as34 +++ /dev/null @@ -1,152 +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.ide.plugins.PluginManagerCore -import com.intellij.ide.plugins.PluginNode -import com.intellij.openapi.diagnostic.Logger -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() = "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("No verified versions for this build.") - - return if (release.plugins().any { KOTLIN_PLUGIN_ID == it.id && version == it.version }) - PluginVerifyResult.accept() - else - PluginVerifyResult.decline("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("unable to connect to compatibility verification repository") - is JAXBException -> PluginVerifyResult.decline("unable to parse compatibility verification metadata") - else -> PluginVerifyResult.decline("exception during verification ${e.message}") - } - } - } - - 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.as34 b/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as34 deleted file mode 100644 index 8ee62b0a17c..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as34 +++ /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/multiFileInspections/invalidBundleOrProperty/expected.xml.183 b/idea/testData/multiFileInspections/invalidBundleOrProperty/expected.xml.183 deleted file mode 100644 index d7307dfe8b2..00000000000 --- a/idea/testData/multiFileInspections/invalidBundleOrProperty/expected.xml.183 +++ /dev/null @@ -1,81 +0,0 @@ - - - unresolvedPropertyReference.kt - 2 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - String literal 'foo.baz' doesn't appear to be valid property key - - - - unresolvedPropertyReference.kt - 3 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - String literal 'foo.baz' doesn't appear to be valid property key - - - - unresolvedPropertyReference.kt - 4 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - String literal 'foo.baz' doesn't appear to be valid property key - - - - unresolvedPropertyReference.kt - 5 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - String literal 'foo.baz' doesn't appear to be valid property key - - - - tooFewArguments.kt - 2 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - Property 'foo.bar' expected 1 parameter, passed 0 - - - - tooFewArguments.kt - 3 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - Property 'foo.bar' expected 1 parameter, passed 0 - - - - unresolvedBundleReference.kt - 3 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - Invalid resource bundle reference 'TestBundle2' - - - - unresolvedBundleReference.kt - 5 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - Invalid resource bundle reference 'TestBundle2' - - - unresolvedPropertyReference.kt - 6 - testInvalidBundleOrProperty_InvalidBundleOrProperty_0 - - Invalid property key - String literal 'www' doesn't appear to be valid property key - - diff --git a/idea/tests/org/jetbrains/kotlin/idea/highlighter/duplicateHighlighting.kt.183 b/idea/tests/org/jetbrains/kotlin/idea/highlighter/duplicateHighlighting.kt.183 deleted file mode 100644 index 7d82a59bf2d..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/highlighter/duplicateHighlighting.kt.183 +++ /dev/null @@ -1,12 +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 - -// Idea 191 has an additional check for duplicate highlighting -// BUNCH: 183 -fun expectedDuplicatedHighlighting(runnable: Runnable) { - runnable.run() -} \ No newline at end of file diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as34 b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as34 deleted file mode 100644 index 6546b2059d2..00000000000 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as34 +++ /dev/null @@ -1,13 +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.jps.build - -import org.jetbrains.jps.incremental.CompileContext -import org.jetbrains.jps.incremental.messages.CompilerMessage - -fun jpsReportInternalBuilderError(context: CompileContext, error: Throwable) { - KotlinBuilder.LOG.info(error) -} \ No newline at end of file diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as34 b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.183 b/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.183 deleted file mode 100644 index b64ab34b5f7..00000000000 --- a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.183 +++ /dev/null @@ -1,78 +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.android.model.impl - -import com.android.builder.model.SourceProvider -import com.android.tools.idea.gradle.project.GradleProjectInfo -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.android.tools.idea.res.AppResourceRepository -import com.intellij.openapi.module.Module -import com.intellij.openapi.vfs.VirtualFile -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.android.model.AndroidModuleInfoProvider -import java.io.File - -class AndroidModuleInfoProviderImpl(override val module: Module) : AndroidModuleInfoProvider { - private val androidFacet: AndroidFacet? - get() = AndroidFacet.getInstance(module) - - private val androidModuleModel: AndroidModuleModel? - get() = AndroidModuleModel.get(module) - - override fun isAndroidModule() = androidFacet != null - override fun isGradleModule() = GradleProjectInfo.getInstance(module.project).isBuildWithGradle - - override fun getAllResourceDirectories(): List { - return androidFacet?.allResourceDirectories ?: emptyList() - } - - override fun getApplicationPackage() = androidFacet?.manifest?.`package`?.toString() - - override fun getMainSourceProvider(): AndroidModuleInfoProvider.SourceProviderMirror? { - return androidFacet?.mainSourceProvider?.let(::SourceProviderMirrorImpl) - } - - override fun getApplicationResourceDirectories(createIfNecessary: Boolean): Collection { - return AppResourceRepository.getOrCreateInstance(module)?.resourceDirs ?: emptyList() - } - - override fun getAllSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.allSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getActiveSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.activeSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getFlavorSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - - val getFlavorSourceProvidersMethod = try { - AndroidFacet::class.java.getMethod("getFlavorSourceProviders") - } catch (e: NoSuchMethodException) { - null - } - - return if (getFlavorSourceProvidersMethod != null) { - @Suppress("UNCHECKED_CAST") - val sourceProviders = getFlavorSourceProvidersMethod.invoke(androidFacet) as? List - sourceProviders?.map(::SourceProviderMirrorImpl) ?: emptyList() - } else { - androidModuleModel.flavorSourceProviders.map(::SourceProviderMirrorImpl) - } - } - - private class SourceProviderMirrorImpl(val sourceProvider: SourceProvider) : - AndroidModuleInfoProvider.SourceProviderMirror { - override val name: String - get() = sourceProvider.name - - override val resDirectories: Collection - get() = sourceProvider.resDirectories - } -} \ No newline at end of file diff --git a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as34 b/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as34 deleted file mode 100644 index 7349215f4cb..00000000000 --- a/plugins/android-extensions/android-extensions-idea/src/org/jetbrains/kotlin/android/model/impl/AndroidModuleInfoProviderImpl.kt.as34 +++ /dev/null @@ -1,78 +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.android.model.impl - -import com.android.builder.model.SourceProvider -import com.android.tools.idea.gradle.project.GradleProjectInfo -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.android.tools.idea.res.ResourceRepositoryManager -import com.intellij.openapi.module.Module -import com.intellij.openapi.vfs.VirtualFile -import org.jetbrains.android.facet.AndroidFacet -import org.jetbrains.kotlin.android.model.AndroidModuleInfoProvider -import java.io.File - -class AndroidModuleInfoProviderImpl(override val module: Module) : AndroidModuleInfoProvider { - private val androidFacet: AndroidFacet? - get() = AndroidFacet.getInstance(module) - - private val androidModuleModel: AndroidModuleModel? - get() = AndroidModuleModel.get(module) - - override fun isAndroidModule() = androidFacet != null - override fun isGradleModule() = GradleProjectInfo.getInstance(module.project).isBuildWithGradle - - override fun getAllResourceDirectories(): List { - return androidFacet?.allResourceDirectories ?: emptyList() - } - - override fun getApplicationPackage() = androidFacet?.manifest?.`package`?.toString() - - override fun getMainSourceProvider(): AndroidModuleInfoProvider.SourceProviderMirror? { - return androidFacet?.mainSourceProvider?.let(::SourceProviderMirrorImpl) - } - - override fun getApplicationResourceDirectories(createIfNecessary: Boolean): Collection { - return ResourceRepositoryManager.getOrCreateInstance(module)?.getAppResources(createIfNecessary)?.resourceDirs ?: emptyList() - } - - override fun getAllSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.allSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getActiveSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - return androidModuleModel.activeSourceProviders.map(::SourceProviderMirrorImpl) - } - - override fun getFlavorSourceProviders(): List { - val androidModuleModel = this.androidModuleModel ?: return emptyList() - - val getFlavorSourceProvidersMethod = try { - AndroidFacet::class.java.getMethod("getFlavorSourceProviders") - } catch (e: NoSuchMethodException) { - null - } - - return if (getFlavorSourceProvidersMethod != null) { - @Suppress("UNCHECKED_CAST") - val sourceProviders = getFlavorSourceProvidersMethod.invoke(androidFacet) as? List - sourceProviders?.map(::SourceProviderMirrorImpl) ?: emptyList() - } else { - androidModuleModel.flavorSourceProviders.map(::SourceProviderMirrorImpl) - } - } - - private class SourceProviderMirrorImpl(val sourceProvider: SourceProvider) : - AndroidModuleInfoProvider.SourceProviderMirror { - override val name: String - get() = sourceProvider.name - - override val resDirectories: Collection - get() = sourceProvider.resDirectories - } -} \ No newline at end of file diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as34 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.183 b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.183 deleted file mode 100644 index a13345d26aa..00000000000 --- a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.183 +++ /dev/null @@ -1,200 +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.kapt.idea - -import com.android.tools.idea.gradle.project.model.AndroidModuleModel -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.* -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.tooling.model.idea.IdeaModule -import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder -import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension -import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder -import java.io.File -import java.io.Serializable -import java.lang.Exception -import java.lang.reflect.Modifier - -interface KaptSourceSetModel : Serializable { - val sourceSetName: String - val isTest: Boolean - val generatedSourcesDir: String - val generatedClassesDir: String - val generatedKotlinSourcesDir: String - - val generatedSourcesDirFile get() = generatedSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedClassesDirFile get() = generatedClassesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedKotlinSourcesDirFile get() = generatedKotlinSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) -} - -class KaptSourceSetModelImpl( - override val sourceSetName: String, - override val isTest: Boolean, - override val generatedSourcesDir: String, - override val generatedClassesDir: String, - override val generatedKotlinSourcesDir: String -) : KaptSourceSetModel - -interface KaptGradleModel : Serializable { - val isEnabled: Boolean - val buildDirectory: File - val sourceSets: List -} - -class KaptGradleModelImpl( - override val isEnabled: Boolean, - override val buildDirectory: File, - override val sourceSets: List -) : KaptGradleModel - -@Suppress("unused") -class KaptProjectResolverExtension : AbstractProjectResolverExtension() { - private companion object { - private val LOG = Logger.getInstance(KaptProjectResolverExtension::class.java) - } - - override fun getExtraProjectModelClasses() = setOf(KaptGradleModel::class.java) - override fun getToolingExtensionsClasses() = setOf(KaptModelBuilderService::class.java, Unit::class.java) - - override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode) { - val kaptModel = resolverCtx.getExtraProject(gradleModule, KaptGradleModel::class.java) - - if (kaptModel != null && kaptModel.isEnabled) { - for (sourceSet in kaptModel.sourceSets) { - populateAndroidModuleModelIfNeeded(ideModule, sourceSet) - - val sourceSetDataNode = ideModule.findGradleSourceSet(sourceSet.sourceSetName) ?: continue - - fun addSourceSet(path: String, type: ExternalSystemSourceType) { - val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path) - contentRootData.storePath(type, path) - sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) - } - - val sourceType = if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED - sourceSet.generatedSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - - sourceSet.generatedClassesDirFile?.let { generatedClassesDir -> - val libraryData = LibraryData(GRADLE_SYSTEM_ID, "kaptGeneratedClasses") - libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) - val libraryDependencyData = LibraryDependencyData(sourceSetDataNode.data, libraryData, LibraryLevel.MODULE) - sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) - } - } - } - - super.populateModuleExtraModels(gradleModule, ideModule) - } - - private fun populateAndroidModuleModelIfNeeded(ideModule: DataNode, sourceSet: KaptSourceSetModel) { - ideModule.findAndroidModuleModel()?.let { androidModelAny -> - // We can cast to AndroidModuleModel cause we already checked in findAndroidModuleModel() that the class exists - - val generatedKotlinSources = sourceSet.generatedKotlinSourcesDirFile ?: return - - val androidModel = androidModelAny.data as? AndroidModuleModel ?: return - val variant = androidModel.findVariantByName(sourceSet.sourceSetName) ?: return - - androidModel.registerExtraGeneratedSourceFolder(generatedKotlinSources) - - // TODO remove this when IDEA eventually migrate to the newer Android plugin - try { - variant.mainArtifact.generatedSourceFolders += generatedKotlinSources - } catch (e: Throwable) { - // There was an error being thrown here, but the code above doesn't work for the newer versions of Android Studio 3 - // (generatedSourceFolders returns a wrapped unmodifiable list), and the thrown exception breaks the import. - // The error will be moved back when I find a work-around for AS3. - } - } - } - - private fun DataNode.findAndroidModuleModel(): DataNode<*>? { - val modelClassName = "com.android.tools.idea.gradle.project.model.AndroidModuleModel" - val node = children.firstOrNull { it.key.dataType == modelClassName } ?: return null - return if (!hasClassInClasspath(modelClassName)) null else node - } - - private fun hasClassInClasspath(name: String): Boolean { - return try { - Class.forName(name) != null - } catch (thr: Throwable) { - false - } - } - - private fun DataNode.findGradleSourceSet(sourceSetName: String): DataNode? { - val moduleName = data.id - for (child in children) { - val gradleSourceSetData = child.data as? GradleSourceSetData ?: continue - if (gradleSourceSetData.id == "$moduleName:$sourceSetName") { - @Suppress("UNCHECKED_CAST") - return child as DataNode? - } - } - - return null - } -} - -class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() { - override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { - return ErrorMessageBuilder.create(project, e, "Gradle import errors") - .withDescription("Unable to build kotlin-kapt plugin configuration") - } - - override fun canBuild(modelName: String?): Boolean = modelName == KaptGradleModel::class.java.name - - override fun buildAll(modelName: String?, project: Project): Any { - val kaptPlugin: Plugin<*>? = project.plugins.findPlugin("kotlin-kapt") - val kaptIsEnabled = kaptPlugin != null - - val sourceSets = mutableListOf() - - if (kaptIsEnabled) { - project.getAllTasks(false)[project]?.forEach { compileTask -> - if (compileTask.javaClass.name !in kotlinCompileJvmTaskClasses) return@forEach - - val sourceSetName = compileTask.getSourceSetName() - val isTest = sourceSetName.toLowerCase().endsWith("test") - - val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName) - val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName) - val kaptGeneratedKotlinSourcesDir = getKaptDirectory("getKaptGeneratedKotlinSourcesDir", project, sourceSetName) - sourceSets += KaptSourceSetModelImpl( - sourceSetName, isTest, kaptGeneratedSourcesDir, kaptGeneratedClassesDir, kaptGeneratedKotlinSourcesDir) - } - } - - return KaptGradleModelImpl(kaptIsEnabled, project.buildDir, sourceSets) - } - - private fun getKaptDirectory(funName: String, project: Project, sourceSetName: String): String { - val kotlinKaptPlugin = project.plugins.findPlugin("kotlin-kapt") ?: return "" - - val targetMethod = kotlinKaptPlugin::class.java.methods.firstOrNull { - Modifier.isStatic(it.modifiers) && it.name == funName && it.parameterCount == 2 - } ?: return "" - - return (targetMethod(null, project, sourceSetName) as? File)?.absolutePath ?: "" - } -} \ No newline at end of file diff --git a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as34 b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as34 deleted file mode 100644 index 7e23bd99756..00000000000 --- a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as34 +++ /dev/null @@ -1,169 +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.kapt.idea - -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.* -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.tooling.model.idea.IdeaModule -import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder -import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension -import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder -import java.io.File -import java.io.Serializable -import java.lang.Exception -import java.lang.reflect.Modifier - -interface KaptSourceSetModel : Serializable { - val sourceSetName: String - val isTest: Boolean - val generatedSourcesDir: String - val generatedClassesDir: String - val generatedKotlinSourcesDir: String - - val generatedSourcesDirFile get() = generatedSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedClassesDirFile get() = generatedClassesDir.takeIf { it.isNotEmpty() }?.let(::File) - val generatedKotlinSourcesDirFile get() = generatedKotlinSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) -} - -class KaptSourceSetModelImpl( - override val sourceSetName: String, - override val isTest: Boolean, - override val generatedSourcesDir: String, - override val generatedClassesDir: String, - override val generatedKotlinSourcesDir: String -) : KaptSourceSetModel - -interface KaptGradleModel : Serializable { - val isEnabled: Boolean - val buildDirectory: File - val sourceSets: List -} - -class KaptGradleModelImpl( - override val isEnabled: Boolean, - override val buildDirectory: File, - override val sourceSets: List -) : KaptGradleModel - -@Suppress("unused") -class KaptProjectResolverExtension : AbstractProjectResolverExtension() { - private companion object { - private val LOG = Logger.getInstance(KaptProjectResolverExtension::class.java) - } - - override fun getExtraProjectModelClasses() = setOf(KaptGradleModel::class.java) - override fun getToolingExtensionsClasses() = setOf(KaptModelBuilderService::class.java, Unit::class.java) - - override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode) { - val kaptModel = resolverCtx.getExtraProject(gradleModule, KaptGradleModel::class.java) - - if (kaptModel != null && kaptModel.isEnabled) { - for (sourceSet in kaptModel.sourceSets) { - val parentDataNode = ideModule.findParentForSourceSetDataNode(sourceSet.sourceSetName) ?: continue - - fun addSourceSet(path: String, type: ExternalSystemSourceType) { - val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path) - contentRootData.storePath(type, path) - parentDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) - } - - val sourceType = - if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED - sourceSet.generatedSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } - - sourceSet.generatedClassesDirFile?.let { generatedClassesDir -> - val libraryData = LibraryData(GRADLE_SYSTEM_ID, "kaptGeneratedClasses") - val existingNode = - parentDataNode.children.map { (it.data as? LibraryDependencyData)?.target } - .firstOrNull { it?.externalName == libraryData.externalName } - if (existingNode != null) { - existingNode.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) - } else { - libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) - val libraryDependencyData = LibraryDependencyData(parentDataNode.data, libraryData, LibraryLevel.MODULE) - parentDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) - } - } - } - } - - super.populateModuleExtraModels(gradleModule, ideModule) - } - - private fun DataNode.findParentForSourceSetDataNode(sourceSetName: String): DataNode? { - val moduleName = data.id - for (child in children) { - val gradleSourceSetData = child.data as? GradleSourceSetData ?: continue - if (gradleSourceSetData.id == "$moduleName:$sourceSetName") { - @Suppress("UNCHECKED_CAST") - return child as? DataNode - } - } - - return this - } -} - -class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() { - override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { - return ErrorMessageBuilder.create(project, e, "Gradle import errors") - .withDescription("Unable to build kotlin-kapt plugin configuration") - } - - override fun canBuild(modelName: String?): Boolean = modelName == KaptGradleModel::class.java.name - - override fun buildAll(modelName: String?, project: Project): Any { - val kaptPlugin: Plugin<*>? = project.plugins.findPlugin("kotlin-kapt") - val kaptIsEnabled = kaptPlugin != null - - val sourceSets = mutableListOf() - - if (kaptIsEnabled) { - project.getAllTasks(false)[project]?.forEach { compileTask -> - if (compileTask.javaClass.name !in kotlinCompileJvmTaskClasses) return@forEach - - val sourceSetName = compileTask.getSourceSetName() - val isTest = sourceSetName.toLowerCase().endsWith("test") - - val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName) - val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName) - val kaptGeneratedKotlinSourcesDir = getKaptDirectory("getKaptGeneratedKotlinSourcesDir", project, sourceSetName) - sourceSets += KaptSourceSetModelImpl( - sourceSetName, isTest, kaptGeneratedSourcesDir, kaptGeneratedClassesDir, kaptGeneratedKotlinSourcesDir) - } - } - - return KaptGradleModelImpl(kaptIsEnabled, project.buildDir, sourceSets) - } - - private fun getKaptDirectory(funName: String, project: Project, sourceSetName: String): String { - val kotlinKaptPlugin = project.plugins.findPlugin("kotlin-kapt") ?: return "" - - val targetMethod = kotlinKaptPlugin::class.java.methods.firstOrNull { - Modifier.isStatic(it.modifiers) && it.name == funName && it.parameterCount == 2 - } ?: return "" - - return (targetMethod(null, project, sourceSetName) as? File)?.absolutePath ?: "" - } -} \ No newline at end of file diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as34 b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as34 b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as34 b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as34 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt.183 deleted file mode 100644 index 65d4faa6a96..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinAbstractUElement.kt.183 +++ /dev/null @@ -1,251 +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.uast.kotlin - -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiMethod -import org.jetbrains.kotlin.asJava.LightClassUtil -import org.jetbrains.kotlin.asJava.classes.KtLightClassForLocalDeclaration -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.asJava.toLightGetter -import org.jetbrains.kotlin.asJava.toLightSetter -import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject -import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType -import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter -import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.expressions.KotlinLocalFunctionULambdaExpression -import org.jetbrains.uast.kotlin.expressions.KotlinUElvisExpression -import org.jetbrains.uast.kotlin.internal.KotlinUElementWithComments -import org.jetbrains.uast.kotlin.psi.UastKotlinPsiVariable - -abstract class KotlinAbstractUElement(private val givenParent: UElement?) : KotlinUElementWithComments, - JvmDeclarationUElementPlaceholder { - - final override val uastParent: UElement? by lz { - givenParent ?: convertParent() - } - - protected open fun convertParent(): UElement? { - @Suppress("DEPRECATION") - val psi = psi //TODO: `psi` is deprecated but it seems that it couldn't be simply replaced for this case - var parent = psi?.parent ?: sourcePsi?.parent ?: psi?.containingFile - - if (psi is PsiMethod && psi !is KtLightMethod) { // handling of synthetic things not represented in lightclasses directly - when (parent) { - is KtClassBody -> { - val grandParent = parent.parent - doConvertParent(this, grandParent)?.let { return it } - parent = grandParent - } - is KtFile -> { - parent.toUElementOfType()?.let { return it } // mutlifile facade class - } - } - - } - - if (psi is KtLightClassForLocalDeclaration) { - val originParent = psi.kotlinOrigin.parent - parent = when (originParent) { - is KtClassBody -> originParent.parent - else -> originParent - } - } - - if (psi is KtAnnotationEntry) { - val parentUnwrapped = KotlinConverter.unwrapElements(parent) ?: return null - val target = psi.useSiteTarget?.getAnnotationUseSiteTarget() - when (target) { - AnnotationUseSiteTarget.PROPERTY_GETTER -> - parent = (parentUnwrapped as? KtProperty)?.getter - ?: (parentUnwrapped as? KtParameter)?.toLightGetter() - ?: parent - - AnnotationUseSiteTarget.PROPERTY_SETTER -> - parent = (parentUnwrapped as? KtProperty)?.setter - ?: (parentUnwrapped as? KtParameter)?.toLightSetter() - ?: parent - AnnotationUseSiteTarget.FIELD -> - parent = (parentUnwrapped as? KtProperty) - ?: (parentUnwrapped as? KtParameter) - ?.takeIf { it.isPropertyParameter() } - ?.let(LightClassUtil::getLightClassBackingField) - ?: parent - AnnotationUseSiteTarget.SETTER_PARAMETER -> - parent = (parentUnwrapped as? KtParameter) - ?.toLightSetter()?.parameterList?.parameters?.firstOrNull() ?: parent - } - } - if (psi is UastKotlinPsiVariable && parent != null) { - parent = parent.parent - } - - while (parent is KtStringTemplateEntryWithExpression || - parent is KtStringTemplateExpression && parent.entries.size == 1) { - parent = parent.parent - } - - if (parent is KtWhenConditionWithExpression) { - parent = parent.parent - } - - if (parent is KtImportList) { - parent = parent.parent - } - - if (psi is KtFunctionLiteral && parent is KtLambdaExpression) { - parent = parent.parent - } - - if (parent is KtLambdaArgument) { - parent = parent.parent - } - - if (psi is KtSuperTypeCallEntry) { - parent = parent?.parent - } - - if (parent is KtPropertyDelegate) { - parent = parent.parent - } - - val result = doConvertParent(this, parent) - if (result == this) { - throw IllegalStateException("Loop in parent structure when converting a $psi of type ${psi?.javaClass} with parent $parent of type ${parent?.javaClass} text: [${parent?.text}], result = $result") - } - - return result - } - - override fun equals(other: Any?): Boolean { - if (other !is UElement) { - return false - } - - return this.psi == other.psi - } - - override fun hashCode() = psi?.hashCode() ?: 0 -} - -fun doConvertParent(element: UElement, parent: PsiElement?): UElement? { - val parentUnwrapped = KotlinConverter.unwrapElements(parent) ?: return null - if (parent is KtValueArgument && parentUnwrapped is KtAnnotationEntry) { - return (KotlinUastLanguagePlugin().convertElementWithParent(parentUnwrapped, null) as? KotlinUAnnotation) - ?.findAttributeValueExpression(parent) - } - - if (parent is KtParameter) { - val annotationClass = findAnnotationClassFromConstructorParameter(parent) - if (annotationClass != null) { - return annotationClass.methods.find { it.name == parent.name } - } - } - - if (parent is KtClassInitializer) { - val containingClass = parent.containingClassOrObject - if (containingClass != null) { - val containingUClass = KotlinUastLanguagePlugin().convertElementWithParent(containingClass, null) as? KotlinUClass - containingUClass?.methods?.filterIsInstance()?.firstOrNull { it.isPrimary }?.let { - return it.uastBody - } - } - } - - val result = KotlinUastLanguagePlugin().convertElementWithParent(parentUnwrapped, null) - - if (result is KotlinUBlockExpression && element is UClass) { - return KotlinUDeclarationsExpression(result).apply { - declarations = listOf(element) - } - } - - if (result is UEnumConstant && element is UDeclaration) { - return result.initializingClass - } - - if (result is UCallExpression && result.uastParent is UEnumConstant) { - return result.uastParent - } - - if (result is USwitchClauseExpressionWithBody && !isInConditionBranch(element, result)) { - return result.body - } - - if (result is KotlinUDestructuringDeclarationExpression && - element.psi == (parent as KtDestructuringDeclaration).initializer) { - return result.tempVarAssignment - } - - if (result is KotlinUElvisExpression && parent is KtBinaryExpression) { - when (element.psi) { - parent.left -> return result.lhsDeclaration - parent.right -> return result.rhsIfExpression - } - } - - if ((result is UMethod || result is KotlinLocalFunctionULambdaExpression) - && result !is KotlinConstructorUMethod // no sense to wrap super calls with `return` - && element is UExpression - && element !is UBlockExpression - && element !is UTypeReferenceExpression // when element is a type in extension methods - ) { - return KotlinUBlockExpression.KotlinLazyUBlockExpression(result, { block -> - listOf(KotlinUImplicitReturnExpression(block).apply { returnExpression = element }) - }).expressions.single() - } - - if (result is KotlinULambdaExpression.Body && element is UExpression && result.implicitReturn?.returnExpression == element) { - return result.implicitReturn!! - } - - return result -} - -private fun isInConditionBranch(element: UElement, result: USwitchClauseExpressionWithBody) = - element.psi?.parentsWithSelf?.takeWhile { it !== result.psi }?.any { it is KtWhenCondition } ?: false - - -private fun findAnnotationClassFromConstructorParameter(parameter: KtParameter): UClass? { - val primaryConstructor = parameter.getStrictParentOfType() ?: return null - val containingClass = primaryConstructor.getContainingClassOrObject() - if (containingClass.isAnnotation()) { - return KotlinUastLanguagePlugin().convertElementWithParent(containingClass, null) as? UClass - } - return null -} - -abstract class KotlinAbstractUExpression(givenParent: UElement?) : - KotlinAbstractUElement(givenParent), - UExpression, - JvmDeclarationUElementPlaceholder { - - override val javaPsi: PsiElement? = null - - override val psi - get() = sourcePsi - - override val annotations: List - get() { - val annotatedExpression = sourcePsi?.parent as? KtAnnotatedExpression ?: return emptyList() - return annotatedExpression.annotationEntries.map { KotlinUAnnotation(it, this) } - } -} - diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt.183 deleted file mode 100644 index 6001ac52faa..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/KotlinUastLanguagePlugin.kt.183 +++ /dev/null @@ -1,615 +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.uast.kotlin - -import com.intellij.lang.Language -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.util.Key -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.impl.source.tree.LeafPsiElement -import org.jetbrains.kotlin.asJava.LightClassUtil -import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade -import org.jetbrains.kotlin.asJava.elements.* -import org.jetbrains.kotlin.asJava.findFacadeClass -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper -import org.jetbrains.kotlin.config.LanguageVersionSettings -import org.jetbrains.kotlin.descriptors.ConstructorDescriptor -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getParentOfType -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.KotlinConverter.convertDeclaration -import org.jetbrains.uast.kotlin.KotlinConverter.convertDeclarationOrElement -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier -import org.jetbrains.uast.kotlin.declarations.KotlinUMethod -import org.jetbrains.uast.kotlin.declarations.KotlinUMethodWithFakeLightDelegate -import org.jetbrains.uast.kotlin.expressions.* -import org.jetbrains.uast.kotlin.psi.UastKotlinPsiParameter -import org.jetbrains.uast.kotlin.psi.UastKotlinPsiVariable - -interface KotlinUastResolveProviderService { - fun getBindingContext(element: KtElement): BindingContext - fun getTypeMapper(element: KtElement): KotlinTypeMapper? - fun getLanguageVersionSettings(element: KtElement): LanguageVersionSettings - fun isJvmElement(psiElement: PsiElement): Boolean - fun getReferenceVariants(ktElement: KtElement, nameHint: String): Sequence -} - -var PsiElement.destructuringDeclarationInitializer: Boolean? by UserDataProperty(Key.create("kotlin.uast.destructuringDeclarationInitializer")) - -class KotlinUastLanguagePlugin : UastLanguagePlugin { - override val priority = 10 - - override val language: Language - get() = KotlinLanguage.INSTANCE - - override fun isFileSupported(fileName: String): Boolean { - return fileName.endsWith(".kt", false) || fileName.endsWith(".kts", false) - } - - private val PsiElement.isJvmElement: Boolean - get() { - val resolveProvider = ServiceManager.getService(project, KotlinUastResolveProviderService::class.java) - return resolveProvider.isJvmElement(this) - } - - override fun convertElement(element: PsiElement, parent: UElement?, requiredType: Class?): UElement? { - if (!element.isJvmElement) return null - return convertDeclarationOrElement(element, parent, requiredType) - } - - override fun convertElementWithParent(element: PsiElement, requiredType: Class?): UElement? { - if (!element.isJvmElement) return null - if (element is PsiFile) return convertDeclaration(element, null, requiredType) - if (element is KtLightClassForFacade) return convertDeclaration(element, null, requiredType) - - return convertDeclarationOrElement(element, null, requiredType) - } - - override fun getMethodCallExpression( - element: PsiElement, - containingClassFqName: String?, - methodName: String - ): UastLanguagePlugin.ResolvedMethod? { - if (element !is KtCallExpression) return null - val resolvedCall = element.getResolvedCall(element.analyze()) ?: return null - val resultingDescriptor = resolvedCall.resultingDescriptor - if (resultingDescriptor !is FunctionDescriptor || resultingDescriptor.name.asString() != methodName) return null - - val parent = element.parent - val parentUElement = convertElementWithParent(parent, null) ?: return null - - val uExpression = KotlinUFunctionCallExpression(element, parentUElement, resolvedCall) - val method = uExpression.resolve() ?: return null - if (method.name != methodName) return null - return UastLanguagePlugin.ResolvedMethod(uExpression, method) - } - - override fun getConstructorCallExpression( - element: PsiElement, - fqName: String - ): UastLanguagePlugin.ResolvedConstructor? { - if (element !is KtCallExpression) return null - val resolvedCall = element.getResolvedCall(element.analyze()) ?: return null - val resultingDescriptor = resolvedCall.resultingDescriptor - if (resultingDescriptor !is ConstructorDescriptor - || resultingDescriptor.returnType.constructor.declarationDescriptor?.name?.asString() != fqName) { - return null - } - - val parent = KotlinConverter.unwrapElements(element.parent) ?: return null - val parentUElement = convertElementWithParent(parent, null) ?: return null - - val uExpression = KotlinUFunctionCallExpression(element, parentUElement, resolvedCall) - val method = uExpression.resolve() ?: return null - val containingClass = method.containingClass ?: return null - return UastLanguagePlugin.ResolvedConstructor(uExpression, method, containingClass) - } - - override fun isExpressionValueUsed(element: UExpression): Boolean { - return when (element) { - is KotlinUSimpleReferenceExpression.KotlinAccessorCallExpression -> element.setterValue != null - is KotlinAbstractUExpression -> { - val ktElement = element.sourcePsi as? KtElement ?: return false - ktElement.analyze()[BindingContext.USED_AS_EXPRESSION, ktElement] ?: false - } - else -> false - } - } -} - -internal inline fun Class?.el(f: () -> UElement?): UElement? { - return if (this == null || isAssignableFrom(ActualT::class.java)) f() else null -} - -internal inline fun Class?.expr(f: () -> UExpression?): UExpression? { - return if (this == null || isAssignableFrom(ActualT::class.java)) f() else null -} - - - -internal object KotlinConverter { - internal tailrec fun unwrapElements(element: PsiElement?): PsiElement? = when (element) { - is KtValueArgumentList -> unwrapElements(element.parent) - is KtValueArgument -> unwrapElements(element.parent) - is KtDeclarationModifierList -> unwrapElements(element.parent) - is KtContainerNode -> unwrapElements(element.parent) - is KtSimpleNameStringTemplateEntry -> unwrapElements(element.parent) - is KtLightParameterList -> unwrapElements(element.parent) - is KtTypeElement -> unwrapElements(element.parent) - is KtSuperTypeList -> unwrapElements(element.parent) - else -> element - } - - private val identifiersTokens = - setOf(KtTokens.IDENTIFIER, KtTokens.CONSTRUCTOR_KEYWORD, KtTokens.THIS_KEYWORD, KtTokens.SUPER_KEYWORD, KtTokens.OBJECT_KEYWORD) - - internal fun convertPsiElement(element: PsiElement?, - givenParent: UElement?, - requiredType: Class?): UElement? { - fun

build(ctor: (P, UElement?) -> UElement): () -> UElement? { - return { - @Suppress("UNCHECKED_CAST") - ctor(element as P, givenParent) - } - } - - return with (requiredType) { when (element) { - is KtParameterList -> el { - val declarationsExpression = KotlinUDeclarationsExpression(givenParent) - declarationsExpression.apply { - declarations = element.parameters.mapIndexed { i, p -> - KotlinUParameter(UastKotlinPsiParameter.create(p, element, declarationsExpression, i), p, this) - } - } - } - is KtClassBody -> el(build(KotlinUExpressionList.Companion::createClassBody)) - is KtCatchClause -> el(build(::KotlinUCatchClause)) - is KtVariableDeclaration -> - if (element is KtProperty && !element.isLocal) { - el { - LightClassUtil.getLightClassBackingField(element)?.let { - KotlinUField(it, element, givenParent) - } - } - } - else { - el { - convertVariablesDeclaration(element, givenParent).declarations.singleOrNull() - } - } - - is KtExpression -> KotlinConverter.convertExpression(element, givenParent, requiredType) - is KtLambdaArgument -> element.getLambdaExpression()?.let { KotlinConverter.convertExpression(it, givenParent, requiredType) } - is KtLightElementBase -> { - val expression = element.kotlinOrigin - when (expression) { - is KtExpression -> KotlinConverter.convertExpression(expression, givenParent, requiredType) - else -> el { UastEmptyExpression(givenParent) } - } - } - is KtLiteralStringTemplateEntry, is KtEscapeStringTemplateEntry -> el(build(::KotlinStringULiteralExpression)) - is KtStringTemplateEntry -> element.expression?.let { convertExpression(it, givenParent, requiredType) } ?: expr { UastEmptyExpression } - is KtWhenEntry -> el(build(::KotlinUSwitchEntry)) - is KtWhenCondition -> convertWhenCondition(element, givenParent, requiredType) - is KtTypeReference -> el { LazyKotlinUTypeReferenceExpression(element, givenParent) } - is KtConstructorDelegationCall -> - el { KotlinUFunctionCallExpression(element, givenParent) } - is KtSuperTypeCallEntry -> - el { - (element.getParentOfType(true)?.parent as? KtObjectLiteralExpression) - ?.toUElementOfType() - ?: KotlinUFunctionCallExpression(element, givenParent) - } - is KtImportDirective -> el(build(::KotlinUImportStatement)) - else -> { - if (element is LeafPsiElement) { - if (element.elementType in identifiersTokens) - if (element.elementType != KtTokens.OBJECT_KEYWORD || element.getParentOfType(false)?.nameIdentifier == null) - el(build(::KotlinUIdentifier)) - else null - else if (element.elementType in KtTokens.OPERATIONS && element.parent is KtOperationReferenceExpression) - el(build(::KotlinUIdentifier)) - else if (element.elementType == KtTokens.LBRACKET && element.parent is KtCollectionLiteralExpression) - el { - UIdentifier( - element, - KotlinUCollectionLiteralExpression( - element.parent as KtCollectionLiteralExpression, - null - ) - ) - } - else null - } else null - } - }} - } - - - internal fun convertEntry(entry: KtStringTemplateEntry, - givenParent: UElement?, - requiredType: Class? = null): UExpression? { - return with(requiredType) { - if (entry is KtStringTemplateEntryWithExpression) { - expr { - KotlinConverter.convertOrEmpty(entry.expression, givenParent) - } - } - else { - expr { - if (entry is KtEscapeStringTemplateEntry) - KotlinStringULiteralExpression(entry, givenParent, entry.unescapedValue) - else - KotlinStringULiteralExpression(entry, givenParent) - } - } - } - } - - internal fun convertExpression(expression: KtExpression, - givenParent: UElement?, - requiredType: Class? = null): UExpression? { - fun

build(ctor: (P, UElement?) -> UExpression): () -> UExpression? { - return { - @Suppress("UNCHECKED_CAST") - ctor(expression as P, givenParent) - } - } - - return with (requiredType) { when (expression) { - is KtVariableDeclaration -> expr(build(::convertVariablesDeclaration)) - - is KtStringTemplateExpression -> { - when { - expression.entries.isEmpty() -> { - expr { KotlinStringULiteralExpression(expression, givenParent, "") } - } - expression.entries.size == 1 -> convertEntry(expression.entries[0], givenParent, requiredType) - else -> { - expr { KotlinStringTemplateUPolyadicExpression(expression, givenParent) } - } - } - } - is KtDestructuringDeclaration -> expr { - val declarationsExpression = KotlinUDestructuringDeclarationExpression(givenParent, expression) - declarationsExpression.apply { - val tempAssignment = KotlinULocalVariable(UastKotlinPsiVariable.create(expression, declarationsExpression), expression, declarationsExpression) - val destructuringAssignments = expression.entries.mapIndexed { i, entry -> - val psiFactory = KtPsiFactory(expression.project) - val initializer = psiFactory.createAnalyzableExpression("${tempAssignment.name}.component${i + 1}()", - expression.containingFile) - initializer.destructuringDeclarationInitializer = true - KotlinULocalVariable(UastKotlinPsiVariable.create(entry, tempAssignment.javaPsi, declarationsExpression, initializer), entry, declarationsExpression) - } - declarations = listOf(tempAssignment) + destructuringAssignments - } - } - is KtLabeledExpression -> expr(build(::KotlinULabeledExpression)) - is KtClassLiteralExpression -> expr(build(::KotlinUClassLiteralExpression)) - is KtObjectLiteralExpression -> expr(build(::KotlinUObjectLiteralExpression)) - is KtDotQualifiedExpression -> expr(build(::KotlinUQualifiedReferenceExpression)) - is KtSafeQualifiedExpression -> expr(build(::KotlinUSafeQualifiedExpression)) - is KtSimpleNameExpression -> expr(build(::KotlinUSimpleReferenceExpression)) - is KtCallExpression -> expr(build(::KotlinUFunctionCallExpression)) - is KtCollectionLiteralExpression -> expr(build(::KotlinUCollectionLiteralExpression)) - is KtBinaryExpression -> { - if (expression.operationToken == KtTokens.ELVIS) { - expr(build(::createElvisExpression)) - } - else expr(build(::KotlinUBinaryExpression)) - } - is KtParenthesizedExpression -> expr(build(::KotlinUParenthesizedExpression)) - is KtPrefixExpression -> expr(build(::KotlinUPrefixExpression)) - is KtPostfixExpression -> expr(build(::KotlinUPostfixExpression)) - is KtThisExpression -> expr(build(::KotlinUThisExpression)) - is KtSuperExpression -> expr(build(::KotlinUSuperExpression)) - is KtCallableReferenceExpression -> expr(build(::KotlinUCallableReferenceExpression)) - is KtIsExpression -> expr(build(::KotlinUTypeCheckExpression)) - is KtIfExpression -> expr(build(::KotlinUIfExpression)) - is KtWhileExpression -> expr(build(::KotlinUWhileExpression)) - is KtDoWhileExpression -> expr(build(::KotlinUDoWhileExpression)) - is KtForExpression -> expr(build(::KotlinUForEachExpression)) - is KtWhenExpression -> expr(build(::KotlinUSwitchExpression)) - is KtBreakExpression -> expr(build(::KotlinUBreakExpression)) - is KtContinueExpression -> expr(build(::KotlinUContinueExpression)) - is KtReturnExpression -> expr(build(::KotlinUReturnExpression)) - is KtThrowExpression -> expr(build(::KotlinUThrowExpression)) - is KtBlockExpression -> expr { - if (expression.parent is KtFunctionLiteral - && expression.parent.parent is KtLambdaExpression - && givenParent !is KotlinULambdaExpression - ) { - KotlinULambdaExpression(expression.parent.parent as KtLambdaExpression, givenParent).body - } else - KotlinUBlockExpression(expression, givenParent) - } - is KtConstantExpression -> expr(build(::KotlinULiteralExpression)) - is KtTryExpression -> expr(build(::KotlinUTryExpression)) - is KtArrayAccessExpression -> expr(build(::KotlinUArrayAccessExpression)) - is KtLambdaExpression -> expr(build(::KotlinULambdaExpression)) - is KtBinaryExpressionWithTypeRHS -> expr(build(::KotlinUBinaryExpressionWithType)) - is KtClassOrObject -> expr { - expression.toLightClass()?.let { lightClass -> - KotlinUDeclarationsExpression(givenParent).apply { - declarations = listOf(KotlinUClass.create(lightClass, this)) - } - } ?: UastEmptyExpression(givenParent) - } - is KtFunction -> if (expression.name.isNullOrEmpty()) { - expr(build(::createLocalFunctionLambdaExpression)) - } - else { - expr(build(::createLocalFunctionDeclaration)) - } - - else -> expr(build(::UnknownKotlinExpression)) - }} - } - - internal fun convertWhenCondition(condition: KtWhenCondition, - givenParent: UElement?, - requiredType: Class? = null - ): UExpression? { - return with(requiredType) { - when (condition) { - is KtWhenConditionInRange -> expr { - KotlinCustomUBinaryExpression(condition, givenParent).apply { - leftOperand = KotlinStringUSimpleReferenceExpression("it", this) - operator = when { - condition.isNegated -> KotlinBinaryOperators.NOT_IN - else -> KotlinBinaryOperators.IN - } - rightOperand = KotlinConverter.convertOrEmpty(condition.rangeExpression, this) - } - } - is KtWhenConditionIsPattern -> expr { - KotlinCustomUBinaryExpressionWithType(condition, givenParent).apply { - operand = KotlinStringUSimpleReferenceExpression("it", this) - operationKind = when { - condition.isNegated -> KotlinBinaryExpressionWithTypeKinds.NEGATED_INSTANCE_CHECK - else -> UastBinaryExpressionWithTypeKind.INSTANCE_CHECK - } - val typeRef = condition.typeReference - typeReference = typeRef?.let { - LazyKotlinUTypeReferenceExpression(it, this) { typeRef.toPsiType(this, boxed = true) } - } - } - } - - is KtWhenConditionWithExpression -> - condition.expression?.let { KotlinConverter.convertExpression(it, givenParent, requiredType) } - - else -> expr { UastEmptyExpression(givenParent) } - } - } - } - - private fun convertEnumEntry(original: KtEnumEntry, givenParent: UElement?): UElement? { - return LightClassUtil.getLightClassBackingField(original)?.let { psiField -> - if (psiField is KtLightFieldImpl.KtLightEnumConstant) { - KotlinUEnumConstant(psiField, psiField.kotlinOrigin, givenParent) - } else { - null - } - } - } - - - internal fun convertDeclaration( - element: PsiElement, - givenParent: UElement?, - requiredType: Class? - ): UElement? { - fun

build(ctor: (P, UElement?) -> UElement): () -> UElement? = { - @Suppress("UNCHECKED_CAST") - ctor(element as P, givenParent) - } - - fun

buildKt(ktElement: K, ctor: (P, K, UElement?) -> UElement): () -> UElement? = { - @Suppress("UNCHECKED_CAST") - ctor(element as P, ktElement, givenParent) - } - - fun

buildKtOpt(ktElement: K?, ctor: (P, K?, UElement?) -> UElement): () -> UElement? = { - @Suppress("UNCHECKED_CAST") - ctor(element as P, ktElement, givenParent) - } - - val original = element.originalElement - return with(requiredType) { - when (original) { - is KtLightMethod -> el(build(KotlinUMethod.Companion::create)) // .Companion is needed because of KT-13934 - is KtLightClass -> when (original.kotlinOrigin) { - is KtEnumEntry -> el { - convertEnumEntry(original.kotlinOrigin as KtEnumEntry, givenParent) - } - else -> el { KotlinUClass.create(original, givenParent) } - } - is KtLightFieldImpl.KtLightEnumConstant -> el(buildKtOpt(original.kotlinOrigin, ::KotlinUEnumConstant)) - is KtLightField -> el(buildKtOpt(original.kotlinOrigin, ::KotlinUField)) - is KtLightParameter -> el(buildKtOpt(original.kotlinOrigin, ::KotlinUParameter)) - is UastKotlinPsiParameter -> el(buildKt(original.ktParameter, ::KotlinUParameter)) - is UastKotlinPsiVariable -> el(buildKt(original.ktElement, ::KotlinUVariable)) - - is KtEnumEntry -> el { - convertEnumEntry(original, givenParent) - } - is KtClassOrObject -> el { - original.toLightClass()?.let { lightClass -> - KotlinUClass.create(lightClass, givenParent) - } - } - is KtFunction -> - if (original.isLocal) { - el { - val parent = original.parent - if (parent is KtLambdaExpression) { - KotlinULambdaExpression(parent, givenParent) // your parent is the ULambdaExpression - } else if (original.name.isNullOrEmpty()) { - createLocalFunctionLambdaExpression(original, givenParent) - } - else { - val uDeclarationsExpression = createLocalFunctionDeclaration(original, givenParent) - val localFunctionVar = uDeclarationsExpression.declarations.single() as KotlinLocalFunctionUVariable - localFunctionVar.uastInitializer - } - } - } - else { - el { - val lightMethod = LightClassUtil.getLightClassMethod(original) - if (lightMethod != null) - convertDeclaration(lightMethod, givenParent, requiredType) - else - KotlinUMethodWithFakeLightDelegate(original, givenParent) - } - } - - is KtPropertyAccessor -> el { - val lightMethod = LightClassUtil.getLightClassAccessorMethod(original) ?: return null - convertDeclaration(lightMethod, givenParent, requiredType) - } - - is KtProperty -> - if (original.isLocal) { - KotlinConverter.convertPsiElement(element, givenParent, requiredType) - } - else { - convertNonLocalProperty(original, givenParent, requiredType) - } - - is KtParameter -> el { - val lightMethod = when (val ownerFunction = original.ownerFunction) { - is KtFunction -> LightClassUtil.getLightClassMethod(ownerFunction) - is KtPropertyAccessor -> LightClassUtil.getLightClassAccessorMethod(ownerFunction) - else -> null - } ?: return null - val lightParameter = lightMethod.parameterList.parameters.find { it.name == original.name } ?: return null - KotlinUParameter(lightParameter, original, givenParent) - } - - is KtFile -> convertKtFile(original, givenParent, requiredType) - is FakeFileForLightClass -> el { KotlinUFile(original.navigationElement) } - is KtAnnotationEntry -> el(build(::KotlinUAnnotation)) - is KtCallExpression -> - if (requiredType != null && UAnnotation::class.java.isAssignableFrom(requiredType)) { - el { KotlinUNestedAnnotation.tryCreate(original, givenParent) } - } else null - is KtLightAnnotationForSourceEntry -> convertDeclarationOrElement(original.kotlinOrigin, givenParent, requiredType) - is KtDelegatedSuperTypeEntry -> el { - KotlinSupertypeDelegationUExpression(original, givenParent) - } - else -> null - } - } - } - - - fun convertDeclarationOrElement(element: PsiElement, givenParent: UElement?, requiredType: Class?): UElement? { - if (element is UElement) return element - - if (element.isValid) { - element.getUserData(KOTLIN_CACHED_UELEMENT_KEY)?.get()?.let { cachedUElement -> - return if (requiredType == null || requiredType.isInstance(cachedUElement)) cachedUElement else null - } - } - - val uElement = convertDeclaration(element, givenParent, requiredType) - ?: KotlinConverter.convertPsiElement(element, givenParent, requiredType) - /* - if (uElement != null) { - element.putUserData(KOTLIN_CACHED_UELEMENT_KEY, WeakReference(uElement)) - } - */ - return uElement - } - - private fun convertNonLocalProperty( - property: KtProperty, - givenParent: UElement?, - requiredType: Class? - ): UElement? { - val methods = LightClassUtil.getLightClassPropertyMethods(property) - return methods.backingField?.let { backingField -> - with(requiredType) { - el { KotlinUField(backingField, (backingField as? KtLightElement<*, *>)?.kotlinOrigin, givenParent) } - } - } ?: methods.getter?.let { getter -> - convertDeclaration(getter, givenParent, requiredType) - } - } - - private fun convertKtFile( - element: KtFile, - givenParent: UElement?, - requiredType: Class? - ): UElement? { - if (requiredType?.isAssignableFrom(KotlinUClass::class.java) == true) - return element.findFacadeClass()?.let { KotlinUClass.create(it, givenParent) } - if (requiredType?.isAssignableFrom(KotlinUFile::class.java) != false) - return KotlinUFile(element) - return null - } - - internal fun convertOrEmpty(expression: KtExpression?, parent: UElement?): UExpression { - return expression?.let { convertExpression(it, parent, null) } ?: UastEmptyExpression - } - - internal fun convertOrNull(expression: KtExpression?, parent: UElement?): UExpression? { - return if (expression != null) convertExpression(expression, parent, null) else null - } - - internal fun KtPsiFactory.createAnalyzableExpression(text: String, context: PsiElement): KtExpression = - createAnalyzableProperty("val x = $text", context).initializer ?: error("Failed to create expression from text: '$text'") - - internal fun KtPsiFactory.createAnalyzableProperty(text: String, context: PsiElement): KtProperty = - createAnalyzableDeclaration(text, context) - - internal fun KtPsiFactory.createAnalyzableDeclaration(text: String, context: PsiElement): TDeclaration { - val file = createAnalyzableFile("dummy.kt", text, context) - val declarations = file.declarations - assert(declarations.size == 1) { "${declarations.size} declarations in $text" } - @Suppress("UNCHECKED_CAST") - return declarations.first() as TDeclaration - } -} - -private fun convertVariablesDeclaration( - psi: KtVariableDeclaration, - parent: UElement? -): UDeclarationsExpression { - val declarationsExpression = parent as? KotlinUDeclarationsExpression - ?: psi.parent.toUElementOfType() as? KotlinUDeclarationsExpression - ?: KotlinUDeclarationsExpression(null, parent, psi) - val parentPsiElement = parent?.javaPsi //TODO: looks weird. mb look for the first non-null `javaPsi` in `parents` ? - val variable = KotlinUAnnotatedLocalVariable( - UastKotlinPsiVariable.create(psi, parentPsiElement, declarationsExpression), psi, declarationsExpression) { annotationParent -> - psi.annotationEntries.map { KotlinUAnnotation(it, annotationParent) } - } - return declarationsExpression.apply { declarations = listOf(variable) } -} - -val kotlinUastPlugin get() = UastLanguagePlugin.getInstances().find { it.language == KotlinLanguage.INSTANCE } ?: KotlinUastLanguagePlugin() diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt.183 deleted file mode 100644 index 4650a6c37a2..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt.183 +++ /dev/null @@ -1,386 +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.uast.kotlin - -import com.intellij.psi.* -import com.intellij.psi.impl.light.LightPsiClassBuilder -import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade -import org.jetbrains.kotlin.asJava.classes.KtLightClassForScript -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.load.java.JvmAbi -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments -import org.jetbrains.kotlin.utils.SmartList -import org.jetbrains.kotlin.utils.addIfNotNull -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull -import org.jetbrains.uast.* -import org.jetbrains.uast.internal.acceptList -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier -import org.jetbrains.uast.kotlin.declarations.KotlinUMethod -import org.jetbrains.uast.kotlin.declarations.UastLightIdentifier -import org.jetbrains.uast.kotlin.kinds.KotlinSpecialExpressionKinds -import org.jetbrains.uast.visitor.UastVisitor - -abstract class AbstractKotlinUClass(givenParent: UElement?) : KotlinAbstractUElement(givenParent), UClassTypeSpecific, UAnchorOwner, - JvmDeclarationUElementPlaceholder { - - override val uastDeclarations by lz { - mutableListOf().apply { - addAll(fields) - addAll(initializers) - addAll(methods) - addAll(innerClasses) - } - } - - open val ktClass: KtClassOrObject? get() = (psi as? KtLightClass)?.kotlinOrigin - - override val uastSuperTypes: List - get() = ktClass?.superTypeListEntries.orEmpty().mapNotNull { it.typeReference }.map { - LazyKotlinUTypeReferenceExpression(it, this) - } - - val delegateExpressions: List - get() = ktClass?.superTypeListEntries.orEmpty() - .filterIsInstance() - .map { KotlinSupertypeDelegationUExpression(it, this) } - - override fun accept(visitor: UastVisitor) { - if (visitor.visitClass(this)) return - delegateExpressions.acceptList(visitor) - annotations.acceptList(visitor) - uastDeclarations.acceptList(visitor) - visitor.afterVisitClass(this) - } - - override val annotations: List by lz { - (sourcePsi as? KtModifierListOwner)?.annotationEntries.orEmpty().map { KotlinUAnnotation(it, this) } - } - - override fun equals(other: Any?) = other is AbstractKotlinUClass && psi == other.psi - override fun hashCode() = psi.hashCode() - -} - -class KotlinSupertypeDelegationUExpression(override val sourcePsi: KtDelegatedSuperTypeEntry, givenParent: UElement?) : - KotlinAbstractUExpression(givenParent), UExpressionList { - - override val psi: PsiElement? get() = sourcePsi - - val typeReference: UTypeReferenceExpression? by lazy { - sourcePsi.typeReference?.let { KotlinUTypeReferenceExpression(it.toPsiType(this), it, this) } - } - - val delegateExpression: UExpression? by lazy { - sourcePsi.delegateExpression?.let { kotlinUastPlugin.convertElement(it, this, UExpression::class.java) as? UExpression } - } - - override val expressions: List - get() = listOfNotNull(typeReference, delegateExpression) - - override val kind: UastSpecialExpressionKind get() = KotlinSpecialExpressionKinds.SUPER_DELEGATION - -} - -open class KotlinUClass private constructor( - psi: KtLightClass, - givenParent: UElement? -) : AbstractKotlinUClass(givenParent), PsiClass by psi { - - final override val ktClass = psi.kotlinOrigin - - override val javaPsi: KtLightClass = psi - - override val sourcePsi: KtClassOrObject? = ktClass - - override val psi = unwrap(psi) - - override fun getSourceElement() = sourcePsi ?: this - - override fun getOriginalElement(): PsiElement? = super.getOriginalElement() - - override fun getNameIdentifier(): PsiIdentifier? = UastLightIdentifier(psi, ktClass) - - override fun getContainingFile(): PsiFile? = unwrapFakeFileForLightClass(psi.containingFile) - - override val uastAnchor by lazy { getIdentifierSourcePsi()?.let { KotlinUIdentifier(nameIdentifier, it, this) } } - - private fun getIdentifierSourcePsi(): PsiElement? { - ktClass?.nameIdentifier?.let { return it } - (ktClass as? KtObjectDeclaration)?.getObjectKeyword()?.let { return it } - return null - } - - override fun getInnerClasses(): Array { - // filter DefaultImpls to avoid processing same methods from original interface multiple times - // filter Enum entry classes to avoid duplication with PsiEnumConstant initializer class - return psi.innerClasses.filter { - it.name != JvmAbi.DEFAULT_IMPLS_CLASS_NAME && !it.isEnumEntryLightClass() - }.mapNotNull { - getLanguagePlugin().convertOpt(it, this) - }.toTypedArray() - } - - override fun getSuperClass(): UClass? = super.getSuperClass() - override fun getFields(): Array = super.getFields() - override fun getInitializers(): Array = super.getInitializers() - - override fun getMethods(): Array { - val hasPrimaryConstructor = ktClass?.hasPrimaryConstructor() ?: false - var secondaryConstructorsCount = 0 - - fun createUMethod(psiMethod: PsiMethod): UMethod { - return if (psiMethod is KtLightMethod && - psiMethod.isConstructor) { - if (!hasPrimaryConstructor && secondaryConstructorsCount++ == 0) - KotlinSecondaryConstructorWithInitializersUMethod(ktClass, psiMethod, this) - else - KotlinConstructorUMethod(ktClass, psiMethod, this) - } else { - getLanguagePlugin().convertOpt(psiMethod, this) ?: reportConvertFailure(psiMethod) - } - } - - fun isDelegatedMethod(psiMethod: PsiMethod) = psiMethod is KtLightMethod && psiMethod.isDelegated - - val result = ArrayList(javaPsi.methods.size) - val handledKtDeclarations = mutableSetOf() - - for (lightMethod in javaPsi.methods) { - if (isDelegatedMethod(lightMethod)) continue - val uMethod = createUMethod(lightMethod) - result.add(uMethod) - handledKtDeclarations.addIfNotNull(uMethod.sourcePsi) - } - - val ktDeclarations: List = run ktDeclarations@{ - ktClass?.let { return@ktDeclarations it.declarations } - (javaPsi as? KtLightClassForFacade)?.let { facade -> - return@ktDeclarations facade.files.flatMap { file -> file.declarations } - } - emptyList() - } - - ktDeclarations.asSequence() - .filterNot { handledKtDeclarations.contains(it) } - .mapNotNullTo(result) { KotlinConverter.convertDeclaration(it, this, null) as? UMethod } - - return result.toTypedArray() - } - - private fun PsiClass.isEnumEntryLightClass() = (this as? KtLightClass)?.kotlinOrigin is KtEnumEntry - - companion object { - fun create(psi: KtLightClass, containingElement: UElement?): UClass = when (psi) { - is PsiAnonymousClass -> KotlinUAnonymousClass(psi, containingElement) - is KtLightClassForScript -> KotlinScriptUClass(psi, containingElement) - else -> KotlinUClass(psi, containingElement) - } - } - -} - -open class KotlinConstructorUMethod( - private val ktClass: KtClassOrObject?, - override val psi: KtLightMethod, - givenParent: UElement? -) : KotlinUMethod(psi, psi.kotlinOrigin, givenParent) { - - val isPrimary: Boolean - get() = psi.kotlinOrigin.let { it is KtPrimaryConstructor || it is KtClassOrObject } - - override val uastBody: UExpression? by lz { - val delegationCall: KtCallElement? = psi.kotlinOrigin.let { - when { - isPrimary -> ktClass?.superTypeListEntries?.firstIsInstanceOrNull() - it is KtSecondaryConstructor -> it.getDelegationCall() - else -> null - } - } - val bodyExpressions = getBodyExpressions() - if (delegationCall == null && bodyExpressions.isEmpty()) return@lz null - KotlinUBlockExpression.KotlinLazyUBlockExpression(this) { uastParent -> - SmartList().apply { - delegationCall?.let { - add(KotlinUFunctionCallExpression(it, uastParent)) - } - bodyExpressions.forEach { - add(KotlinConverter.convertOrEmpty(it, uastParent)) - } - } - } - } - - override val uastAnchor: KotlinUIdentifier by lazy { - KotlinUIdentifier( - psi.nameIdentifier, - if (isPrimary) ktClass?.nameIdentifier else (psi.kotlinOrigin as? KtSecondaryConstructor)?.getConstructorKeyword(), - this - ) - } - - override val javaPsi = psi - - open protected fun getBodyExpressions(): List { - if (isPrimary) return getInitializers() - val bodyExpression = (psi.kotlinOrigin as? KtFunction)?.bodyExpression ?: return emptyList() - if (bodyExpression is KtBlockExpression) return bodyExpression.statements - return listOf(bodyExpression) - } - - protected fun getInitializers() = ktClass?.getAnonymousInitializers()?.mapNotNull { it.body } ?: emptyList() - -} - -// This class was created as a workaround for KT-21617 to be the only constructor which includes `init` block -// when there is no primary constructors in the class. -// It is expected to have only one constructor of this type in a UClass. -class KotlinSecondaryConstructorWithInitializersUMethod( - ktClass: KtClassOrObject?, - psi: KtLightMethod, - givenParent: UElement? -) : KotlinConstructorUMethod(ktClass, psi, givenParent) { - override fun getBodyExpressions(): List = getInitializers() + super.getBodyExpressions() -} - -class KotlinUAnonymousClass( - psi: PsiAnonymousClass, - givenParent: UElement? -) : AbstractKotlinUClass(givenParent), UAnonymousClass, PsiAnonymousClass by psi { - - override val psi: PsiAnonymousClass = unwrap(psi) - - override val javaPsi: PsiAnonymousClass = psi - - override val sourcePsi: KtClassOrObject? = ktClass - - override fun getOriginalElement(): PsiElement? = super.getOriginalElement() - - override fun getSuperClass(): UClass? = super.getSuperClass() - override fun getFields(): Array = super.getFields() - override fun getMethods(): Array = super.getMethods() - override fun getInitializers(): Array = super.getInitializers() - override fun getInnerClasses(): Array = super.getInnerClasses() - - override fun getContainingFile(): PsiFile = unwrapFakeFileForLightClass(psi.containingFile) - - override val uastAnchor by lazy { - val ktClassOrObject = (psi.originalElement as? KtLightClass)?.kotlinOrigin as? KtObjectDeclaration ?: return@lazy null - KotlinUIdentifier(ktClassOrObject.getObjectKeyword(), this) - } - -} - -class KotlinScriptUClass( - psi: KtLightClassForScript, - givenParent: UElement? -) : AbstractKotlinUClass(givenParent), PsiClass by psi { - override fun getContainingFile(): PsiFile = unwrapFakeFileForLightClass(psi.containingFile) - - override fun getNameIdentifier(): PsiIdentifier? = UastLightIdentifier(psi, psi.kotlinOrigin) - - override val uastAnchor by lazy { KotlinUIdentifier(nameIdentifier, sourcePsi?.nameIdentifier, this) } - - override val javaPsi: PsiClass = psi - - override val sourcePsi: KtClassOrObject? = psi.kotlinOrigin - - override val psi = unwrap(psi) - - override fun getSuperClass(): UClass? = super.getSuperClass() - - override fun getFields(): Array = super.getFields() - - override fun getInitializers(): Array = super.getInitializers() - - override fun getInnerClasses(): Array = - psi.innerClasses.mapNotNull { getLanguagePlugin().convertOpt(it, this) }.toTypedArray() - - override fun getMethods(): Array = psi.methods.map(this::createUMethod).toTypedArray() - - private fun createUMethod(method: PsiMethod): UMethod { - return if (method.isConstructor) { - KotlinScriptConstructorUMethod(psi.script, method as KtLightMethod, this) - } - else { - getLanguagePlugin().convertOpt(method, this) ?: reportConvertFailure(method) - } - } - - override fun getOriginalElement(): PsiElement? = psi.originalElement - - class KotlinScriptConstructorUMethod( - script: KtScript, - override val psi: KtLightMethod, - givenParent: UElement? - ) : KotlinUMethod(psi, psi.kotlinOrigin, givenParent) { - override val uastBody: UExpression? by lz { - val initializers = script.declarations.filterIsInstance() - KotlinUBlockExpression.create(initializers, this) - } - override val javaPsi = psi - } -} - -/** - * implementation of [UClass] for invalid code, when it is impossible to create a [KtLightClass] - */ -class KotlinInvalidUClass( - override val psi: PsiClass, - givenParent: UElement? -) : AbstractKotlinUClass(givenParent), PsiClass by psi { - - constructor(name: String, context: PsiElement, givenParent: UElement?) : this(LightPsiClassBuilder(context, name), givenParent) - - override fun getContainingFile(): PsiFile? = uastParent?.getContainingUFile()?.sourcePsi as? PsiFile - - override val sourcePsi: PsiElement? get() = null - - override val uastAnchor: UIdentifier? get() = null - - override val javaPsi: PsiClass get() = psi - - override fun getFields(): Array = emptyArray() - - override fun getInitializers(): Array = emptyArray() - - override fun getInnerClasses(): Array = emptyArray() - - override fun getMethods(): Array = emptyArray() - - override fun getSuperClass(): UClass? = null - - override fun getOriginalElement(): PsiElement? = null -} - -private fun reportConvertFailure(psiMethod: PsiMethod): Nothing { - val isValid = psiMethod.isValid - val report = KotlinExceptionWithAttachments( - "cant convert $psiMethod of ${psiMethod.javaClass} to UMethod" - + if (!isValid) " (method is not valid)" else "" - ) - - if (isValid) { - report.withAttachment("method", psiMethod.text) - psiMethod.containingFile?.let { - report.withAttachment("file", it.text) - } - } - - throw report -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt.183 deleted file mode 100644 index 74c99c5271c..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUMethod.kt.183 +++ /dev/null @@ -1,195 +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.uast.kotlin.declarations - -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiMethod -import com.intellij.psi.PsiNameIdentifierOwner -import com.intellij.psi.impl.light.LightMethodBuilder -import com.intellij.psi.impl.light.LightModifierList -import com.intellij.psi.impl.light.LightParameterListBuilder -import org.jetbrains.kotlin.asJava.elements.KtLightElement -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.asJava.elements.isGetter -import org.jetbrains.kotlin.asJava.elements.isSetter -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.asJava.findFacadeClass -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject -import org.jetbrains.kotlin.psi.psiUtil.getParentOfType -import org.jetbrains.kotlin.utils.SmartList -import org.jetbrains.uast.* -import org.jetbrains.uast.java.internal.JavaUElementWithComments -import org.jetbrains.uast.kotlin.* - -open class KotlinUMethod( - psi: PsiMethod, - final override val sourcePsi: KtDeclaration?, - givenParent: UElement? -) : KotlinAbstractUElement(givenParent), UMethodTypeSpecific, UAnchorOwner, JavaUElementWithComments, PsiMethod by psi { - - constructor(psi: KtLightMethod, givenParent: UElement?) : this(psi, psi.kotlinOrigin, givenParent) - - override val comments: List - get() = super.comments - - override val psi: PsiMethod = unwrap(psi) - - override val javaPsi = psi - - override fun getSourceElement() = sourcePsi ?: this - - private val kotlinOrigin = (psi.originalElement as? KtLightElement<*, *>)?.kotlinOrigin ?: sourcePsi - - override fun getContainingFile(): PsiFile? { - kotlinOrigin?.containingFile?.let { return it } - return unwrapFakeFileForLightClass(psi.containingFile) - } - - override fun getNameIdentifier() = UastLightIdentifier(psi, kotlinOrigin as KtNamedDeclaration?) - - override val annotations: List by lz { - psi.annotations - .mapNotNull { (it as? KtLightElement<*, *>)?.kotlinOrigin as? KtAnnotationEntry } - .map { KotlinUAnnotation(it, this) } - } - - private val receiver by lz { (sourcePsi as? KtCallableDeclaration)?.receiverTypeReference } - - override val uastParameters by lz { - val lightParams = psi.parameterList.parameters - val receiver = receiver ?: return@lz lightParams.map { - KotlinUParameter(it, (it as? KtLightElement<*, *>)?.kotlinOrigin, this) - } - val receiverLight = lightParams.firstOrNull() ?: return@lz emptyList() - val uParameters = SmartList(KotlinReceiverUParameter(receiverLight, receiver, this)) - lightParams.drop(1).mapTo(uParameters) { KotlinUParameter(it, (it as? KtLightElement<*, *>)?.kotlinOrigin, this) } - uParameters - } - - override val uastAnchor by lazy { - KotlinUIdentifier( - nameIdentifier, - sourcePsi.let { sourcePsi -> - when (sourcePsi) { - is PsiNameIdentifierOwner -> sourcePsi.nameIdentifier - is KtObjectDeclaration -> sourcePsi.getObjectKeyword() - else -> sourcePsi?.navigationElement - } - }, - this - ) - } - - - override val uastBody by lz { - if (kotlinOrigin?.canAnalyze() != true) return@lz null // EA-137193 - val bodyExpression = when (kotlinOrigin) { - is KtFunction -> kotlinOrigin.bodyExpression - is KtProperty -> when { - psi is KtLightMethod && psi.isGetter -> kotlinOrigin.getter?.bodyExpression - psi is KtLightMethod && psi.isSetter -> kotlinOrigin.setter?.bodyExpression - else -> null - } - else -> null - } ?: return@lz null - - wrapExpressionBody(this, bodyExpression) - } - - override val isOverride: Boolean - get() = (kotlinOrigin as? KtCallableDeclaration)?.hasModifier(KtTokens.OVERRIDE_KEYWORD) ?: false - - - override fun equals(other: Any?) = other is KotlinUMethod && psi == other.psi - - companion object { - fun create(psi: KtLightMethod, containingElement: UElement?): KotlinUMethod { - val kotlinOrigin = psi.kotlinOrigin - return if (kotlinOrigin is KtConstructor<*>) { - KotlinConstructorUMethod( - kotlinOrigin.containingClassOrObject, - psi, - containingElement - ) - } else if (kotlinOrigin is KtParameter && kotlinOrigin.getParentOfType(true)?.isAnnotation() == true) - KotlinUAnnotationMethod(psi, containingElement) - else - KotlinUMethod(psi, containingElement) - } - } -} - -open class KotlinUAnnotationMethod( - psi: KtLightMethod, - givenParent: UElement? -) : KotlinUMethod(psi, psi.kotlinOrigin, givenParent), UAnnotationMethod { - - override val psi: KtLightMethod = unwrap(psi) - - override val uastDefaultValue by lz { - val annotationParameter = sourcePsi as? KtParameter ?: return@lz null - val defaultValue = annotationParameter.defaultValue ?: return@lz null - getLanguagePlugin().convertElement(defaultValue, this) as? UExpression - } - - -} - -private fun buildLightMethodFake(original: KtFunction): PsiMethod = object : LightMethodBuilder( - original.manager, original.language, original.name, - LightParameterListBuilder(original.manager, original.language), - LightModifierList(original.manager) -) { - - init { - containingClass = original.containingClassOrObject?.toLightClass() ?: original.containingKtFile.findFacadeClass() - } - - override fun getParent(): PsiElement? = containingClass -} - -class KotlinUMethodWithFakeLightDelegate(val original: KtFunction, givenParent: UElement?) : - KotlinUMethod(buildLightMethodFake(original), original, givenParent) { - override val annotations: List - get() = original.annotationEntries.mapNotNull { it.toUElementOfType() } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - other as KotlinUMethodWithFakeLightDelegate - if (original != other.original) return false - return true - } - - override fun hashCode(): Int = original.hashCode() -} - -internal fun wrapExpressionBody(function: UElement, bodyExpression: KtExpression): UExpression? = when (bodyExpression) { - !is KtBlockExpression -> { - KotlinUBlockExpression.KotlinLazyUBlockExpression(function) { block -> - val implicitReturn = KotlinUImplicitReturnExpression(block) - val uBody = function.getLanguagePlugin().convertElement(bodyExpression, implicitReturn) as? UExpression - ?: return@KotlinLazyUBlockExpression emptyList() - listOf(implicitReturn.apply { returnExpression = uBody }) - } - - } - else -> function.getLanguagePlugin().convertElement(bodyExpression, function) as? UExpression -} diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/evaluation/KotlinEvaluatorExtension.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/evaluation/KotlinEvaluatorExtension.kt.183 deleted file mode 100644 index e2642d6bd8a..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/evaluation/KotlinEvaluatorExtension.kt.183 +++ /dev/null @@ -1,56 +0,0 @@ -package org.jetbrains.uast.kotlin.evaluation - -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.uast.UBinaryExpression -import org.jetbrains.uast.UastPostfixOperator -import org.jetbrains.uast.evaluation.AbstractEvaluatorExtension -import org.jetbrains.uast.evaluation.UEvaluationInfo -import org.jetbrains.uast.evaluation.UEvaluationState -import org.jetbrains.uast.kotlin.KotlinBinaryOperators -import org.jetbrains.uast.kotlin.KotlinPostfixOperators -import org.jetbrains.uast.values.* - -class KotlinEvaluatorExtension : AbstractEvaluatorExtension(KotlinLanguage.INSTANCE) { - - private data class Range(val from: UValue, val to: UValue) { - override fun toString() = "$from..$to" - } - - private class UClosedRangeConstant(override val value: Range, override val source: UBinaryExpression?) : UAbstractConstant() { - constructor(from: UValue, to: UValue, source: UBinaryExpression): this(Range(from, to), source) - } - - override fun evaluatePostfix( - operator: UastPostfixOperator, - operandValue: UValue, - state: UEvaluationState - ): UEvaluationInfo { - return when (operator) { - KotlinPostfixOperators.EXCLEXCL -> when (operandValue.toConstant()) { - UNullConstant -> UValue.UNREACHABLE - is UConstant -> operandValue - else -> UUndeterminedValue - } to state - else -> return super.evaluatePostfix(operator, operandValue, state) - } - } - - private fun UValue.contains(value: UValue): UValue { - val range = (this as? UClosedRangeConstant)?.value ?: return UUndeterminedValue - return (value greaterOrEquals range.from) and (value lessOrEquals range.to) - } - - override fun evaluateBinary( - binaryExpression: UBinaryExpression, - leftValue: UValue, - rightValue: UValue, - state: UEvaluationState - ): UEvaluationInfo { - return when (binaryExpression.operator) { - KotlinBinaryOperators.IN -> rightValue.contains(leftValue) - KotlinBinaryOperators.NOT_IN -> !rightValue.contains(leftValue) - KotlinBinaryOperators.RANGE_TO -> UClosedRangeConstant(leftValue, rightValue, binaryExpression) - else -> UUndeterminedValue - } to state - } -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/ElvisExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/ElvisExpression.kt.183 deleted file mode 100644 index 8249ed1a84a..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/ElvisExpression.kt.183 +++ /dev/null @@ -1,121 +0,0 @@ -package org.jetbrains.uast.kotlin.expressions - -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiMethod -import com.intellij.psi.PsiType -import org.jetbrains.kotlin.psi.KtBinaryExpression -import org.jetbrains.kotlin.psi.KtExpression -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.types.CommonSupertypes -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.* -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier -import org.jetbrains.uast.kotlin.kinds.KotlinSpecialExpressionKinds -import org.jetbrains.uast.kotlin.psi.UastKotlinPsiVariable - - -private fun createVariableReferenceExpression(variable: UVariable, containingElement: UElement?) = - object : USimpleNameReferenceExpression, JvmDeclarationUElementPlaceholder { - override val psi: PsiElement? = null - override fun resolve(): PsiElement? = variable - override val uastParent: UElement? = containingElement - override val resolvedName: String? = variable.name - override val annotations: List = emptyList() - override val identifier: String = variable.name.orAnonymous() - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = null - } - -private fun createNullLiteralExpression(containingElement: UElement?) = - object : ULiteralExpression, JvmDeclarationUElementPlaceholder { - override val psi: PsiElement? = null - override val uastParent: UElement? = containingElement - override val value: Any? = null - override val annotations: List = emptyList() - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = null - } - -private fun createNotEqWithNullExpression(variable: UVariable, containingElement: UElement?) = - object : UBinaryExpression, JvmDeclarationUElementPlaceholder { - override val psi: PsiElement? = null - override val uastParent: UElement? = containingElement - override val leftOperand: UExpression by lz { createVariableReferenceExpression(variable, this) } - override val rightOperand: UExpression by lz { createNullLiteralExpression(this) } - override val operator: UastBinaryOperator = UastBinaryOperator.NOT_EQUALS - override val operatorIdentifier: UIdentifier? = KotlinUIdentifier(null, this) - override fun resolveOperator(): PsiMethod? = null - override val annotations: List = emptyList() - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = null - } - -private fun createElvisExpressions( - left: KtExpression, - right: KtExpression, - containingElement: UElement?, - psiParent: PsiElement): List { - - val declaration = KotlinUDeclarationsExpression(containingElement) - val tempVariable = KotlinULocalVariable(UastKotlinPsiVariable.create(left, declaration, psiParent), left, declaration) - declaration.declarations = listOf(tempVariable) - - val ifExpression = object : UIfExpression, JvmDeclarationUElementPlaceholder { - override val psi: PsiElement? = null - override val uastParent: UElement? = containingElement - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = null - override val condition: UExpression by lz { createNotEqWithNullExpression(tempVariable, this) } - override val thenExpression: UExpression? by lz { createVariableReferenceExpression(tempVariable, this) } - override val elseExpression: UExpression? by lz { KotlinConverter.convertExpression(right, this ) } - override val isTernary: Boolean = false - override val annotations: List = emptyList() - override val ifIdentifier: UIdentifier = KotlinUIdentifier(null, this) - override val elseIdentifier: UIdentifier? = KotlinUIdentifier(null, this) - } - - return listOf(declaration, ifExpression) -} - -fun createElvisExpression(elvisExpression: KtBinaryExpression, givenParent: UElement?): UExpression { - val left = elvisExpression.left ?: return UastEmptyExpression(givenParent) - val right = elvisExpression.right ?: return UastEmptyExpression(givenParent) - - return KotlinUElvisExpression(elvisExpression, left, right, givenParent) -} - -class KotlinUElvisExpression( - private val elvisExpression: KtBinaryExpression, - private val left: KtExpression, - private val right: KtExpression, - givenParent: UElement? -) : KotlinAbstractUElement(givenParent), UExpressionList, KotlinEvaluatableUElement { - - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = elvisExpression - override val psi: PsiElement? = sourcePsi - override val kind = KotlinSpecialExpressionKinds.ELVIS - override val annotations: List = emptyList() - override val expressions: List by lz { - createElvisExpressions(left, right, this, elvisExpression.parent) - } - - val lhsDeclaration get() = (expressions[0] as UDeclarationsExpression).declarations.single() - val rhsIfExpression get() = expressions[1] as UIfExpression - - override fun asRenderString(): String { - return kind.name + " " + - expressions.joinToString(separator = "\n", prefix = "{\n", postfix = "\n}") { - it.asRenderString().withMargin - } - } - - override fun getExpressionType(): PsiType? { - val leftType = left.analyze()[BindingContext.EXPRESSION_TYPE_INFO, left]?.type ?: return null - val rightType = right.analyze()[BindingContext.EXPRESSION_TYPE_INFO, right]?.type ?: return null - - return CommonSupertypes - .commonSupertype(listOf(leftType, rightType)) - .toPsiType(this, elvisExpression, boxed = false) - } -} diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinStringTemplateUPolyadicExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinStringTemplateUPolyadicExpression.kt.183 deleted file mode 100644 index 3f6d20a1891..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinStringTemplateUPolyadicExpression.kt.183 +++ /dev/null @@ -1,34 +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.uast.kotlin - -import org.jetbrains.kotlin.psi.KtStringTemplateExpression -import org.jetbrains.uast.UElement -import org.jetbrains.uast.UExpression -import org.jetbrains.uast.UPolyadicExpression -import org.jetbrains.uast.UastBinaryOperator - -class KotlinStringTemplateUPolyadicExpression( - override val sourcePsi: KtStringTemplateExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), - UPolyadicExpression, - KotlinUElementWithType, - KotlinEvaluatableUElement { - override val operands: List by lz { sourcePsi.entries.map { KotlinConverter.convertEntry(it, this)!! } } - override val operator = UastBinaryOperator.PLUS -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCallableReferenceExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCallableReferenceExpression.kt.183 deleted file mode 100644 index 5c4d4ff3b38..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUCallableReferenceExpression.kt.183 +++ /dev/null @@ -1,55 +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.uast.kotlin - -import com.intellij.psi.PsiNamedElement -import com.intellij.psi.ResolveResult -import org.jetbrains.kotlin.psi.KtCallableReferenceExpression -import org.jetbrains.kotlin.resolve.BindingContext.DOUBLE_COLON_LHS -import org.jetbrains.uast.UCallableReferenceExpression -import org.jetbrains.uast.UElement -import org.jetbrains.uast.UExpression -import org.jetbrains.uast.UMultiResolvable -import org.jetbrains.uast.kotlin.internal.getResolveResultVariants - -class KotlinUCallableReferenceExpression( - override val sourcePsi: KtCallableReferenceExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), UCallableReferenceExpression, UMultiResolvable, KotlinUElementWithType { - override val qualifierExpression: UExpression? - get() { - if (qualifierType != null) return null - val receiverExpression = sourcePsi.receiverExpression ?: return null - return KotlinConverter.convertExpression(receiverExpression, this) - } - - override val qualifierType by lz { - val ktType = sourcePsi.analyze()[DOUBLE_COLON_LHS, sourcePsi.receiverExpression]?.type ?: return@lz null - ktType.toPsiType(this, sourcePsi, boxed = true) - } - - override val callableName: String - get() = sourcePsi.callableReference.getReferencedName() - - override val resolvedName: String? - get() = (resolve() as? PsiNamedElement)?.name - - override fun resolve() = sourcePsi.callableReference.resolveCallToDeclaration() - - override fun multiResolve(): Iterable = getResolveResultVariants(sourcePsi.callableReference) - -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUClassLiteralExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUClassLiteralExpression.kt.183 deleted file mode 100644 index 14684154a92..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUClassLiteralExpression.kt.183 +++ /dev/null @@ -1,40 +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.uast.kotlin - -import org.jetbrains.kotlin.psi.KtClassLiteralExpression -import org.jetbrains.kotlin.resolve.BindingContext.DOUBLE_COLON_LHS -import org.jetbrains.uast.UClassLiteralExpression -import org.jetbrains.uast.UElement -import org.jetbrains.uast.UExpression - -class KotlinUClassLiteralExpression( - override val sourcePsi: KtClassLiteralExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), UClassLiteralExpression, KotlinUElementWithType { - override val type by lz { - val ktType = sourcePsi.analyze()[DOUBLE_COLON_LHS, sourcePsi.receiverExpression]?.type ?: return@lz null - ktType.toPsiType(this, sourcePsi, boxed = true) - } - - override val expression: UExpression? - get() { - if (type != null) return null - val receiverExpression = sourcePsi.receiverExpression ?: return null - return KotlinConverter.convertExpression(receiverExpression, this) - } -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt.183 deleted file mode 100644 index 25dcfc67a7e..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt.183 +++ /dev/null @@ -1,89 +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.uast.kotlin - -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiMethod -import com.intellij.psi.PsiType -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.psi.KtObjectLiteralExpression -import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry -import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.internal.DelegatedMultiResolve - -class KotlinUObjectLiteralExpression( - override val sourcePsi: KtObjectLiteralExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), UObjectLiteralExpression, UCallExpressionEx, DelegatedMultiResolve, KotlinUElementWithType { - - override val declaration: UClass by lz { - sourcePsi.objectDeclaration.toLightClass() - ?.let { getLanguagePlugin().convert(it, this) } - ?: KotlinInvalidUClass("", sourcePsi, this) - } - - override fun getExpressionType() = sourcePsi.objectDeclaration.toPsiType() - - private val superClassConstructorCall by lz { - sourcePsi.objectDeclaration.superTypeListEntries.firstOrNull { it is KtSuperTypeCallEntry } as? KtSuperTypeCallEntry - } - - override val classReference: UReferenceExpression? by lz { superClassConstructorCall?.let { ObjectLiteralClassReference(it, this) } } - - override val valueArgumentCount: Int - get() = superClassConstructorCall?.valueArguments?.size ?: 0 - - override val valueArguments by lz { - val psi = superClassConstructorCall ?: return@lz emptyList() - psi.valueArguments.map { KotlinConverter.convertOrEmpty(it.getArgumentExpression(), this) } - } - - override val typeArgumentCount: Int - get() = superClassConstructorCall?.typeArguments?.size ?: 0 - - override val typeArguments by lz { - val psi = superClassConstructorCall ?: return@lz emptyList() - psi.typeArguments.map { it.typeReference.toPsiType(this, boxed = true) } - } - - override fun resolve() = superClassConstructorCall?.resolveCallToDeclaration() as? PsiMethod - - override fun getArgumentForParameter(i: Int): UExpression? = - superClassConstructorCall?.let { it.getResolvedCall(it.analyze()) }?.let { getArgumentExpressionByIndex(i, it, this) } - - private class ObjectLiteralClassReference( - override val sourcePsi: KtSuperTypeCallEntry, - givenParent: UElement? - ) : KotlinAbstractUElement(givenParent), USimpleNameReferenceExpression { - - override val javaPsi: PsiElement? get() = null - override val psi: KtSuperTypeCallEntry get() = sourcePsi - - override fun resolve() = (sourcePsi.resolveCallToDeclaration() as? PsiMethod)?.containingClass - - override val annotations: List - get() = emptyList() - - override val resolvedName: String? - get() = identifier - - override val identifier: String - get() = psi.name ?: "" - } - -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUQualifiedReferenceExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUQualifiedReferenceExpression.kt.183 deleted file mode 100644 index 9e9709798a3..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUQualifiedReferenceExpression.kt.183 +++ /dev/null @@ -1,39 +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.uast.kotlin - -import com.intellij.psi.PsiNamedElement -import org.jetbrains.kotlin.psi.KtDotQualifiedExpression -import org.jetbrains.uast.UElement -import org.jetbrains.uast.UQualifiedReferenceExpression -import org.jetbrains.uast.UastQualifiedExpressionAccessType -import org.jetbrains.uast.kotlin.internal.DelegatedMultiResolve - -class KotlinUQualifiedReferenceExpression( - override val sourcePsi: KtDotQualifiedExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), UQualifiedReferenceExpression, DelegatedMultiResolve, - KotlinUElementWithType, KotlinEvaluatableUElement { - override val receiver by lz { KotlinConverter.convertOrEmpty(sourcePsi.receiverExpression, this) } - override val selector by lz { KotlinConverter.convertOrEmpty(sourcePsi.selectorExpression, this) } - override val accessType = UastQualifiedExpressionAccessType.SIMPLE - - override fun resolve() = sourcePsi.selectorExpression?.resolveCallToDeclaration() - - override val resolvedName: String? - get() = (resolve() as? PsiNamedElement)?.name -} diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.183 deleted file mode 100644 index 0d0f09b8ef1..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSimpleReferenceExpression.kt.183 +++ /dev/null @@ -1,261 +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.uast.kotlin - -import com.intellij.psi.* -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.load.java.sam.SamConstructorDescriptor -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getAssignmentByLHS -import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelectorOrThis -import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.ImportedFromObjectCallableDescriptor -import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall -import org.jetbrains.kotlin.resolve.calls.tower.NewResolvedCallImpl -import org.jetbrains.kotlin.resolve.source.getPsi -import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor -import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor -import org.jetbrains.kotlin.utils.addToStdlib.constant -import org.jetbrains.uast.* -import org.jetbrains.uast.internal.log -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier -import org.jetbrains.uast.kotlin.internal.DelegatedMultiResolve -import org.jetbrains.uast.visitor.UastVisitor - -open class KotlinUSimpleReferenceExpression( - override val sourcePsi: KtSimpleNameExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), USimpleNameReferenceExpression, KotlinUElementWithType, KotlinEvaluatableUElement { - private val resolvedDeclaration: PsiElement? by lz { - sourcePsi.resolveCallToDeclaration()?.let { return@lz it } - - var declarationDescriptor = sourcePsi.analyze()[BindingContext.REFERENCE_TARGET, sourcePsi] ?: return@lz null - if (declarationDescriptor is ImportedFromObjectCallableDescriptor<*>) { - declarationDescriptor = declarationDescriptor.callableFromObject - } - if (declarationDescriptor is SyntheticJavaPropertyDescriptor) { - declarationDescriptor = when (sourcePsi.readWriteAccess()) { - ReferenceAccess.WRITE, ReferenceAccess.READ_WRITE -> - declarationDescriptor.setMethod ?: declarationDescriptor.getMethod - ReferenceAccess.READ -> declarationDescriptor.getMethod - } - } - - if (declarationDescriptor is PackageViewDescriptor) { - return@lz JavaPsiFacade.getInstance(sourcePsi.project).findPackage(declarationDescriptor.fqName.asString()) - } - - resolveToPsiClass(this, declarationDescriptor, sourcePsi)?.let { return@lz it } - if (declarationDescriptor is DeclarationDescriptorWithSource) { - declarationDescriptor.source.getPsi()?.let { it.getMaybeLightElement() ?: it }?.let { return@lz it } - } - return@lz resolveDeserialized(sourcePsi, declarationDescriptor, sourcePsi.readWriteAccess()) - } - - override val identifier get() = sourcePsi.getReferencedName() - - override fun resolve() = resolvedDeclaration - - override val resolvedName: String? - get() = (resolvedDeclaration as? PsiNamedElement)?.name - - override fun accept(visitor: UastVisitor) { - visitor.visitSimpleNameReferenceExpression(this) - - if (sourcePsi.parent.destructuringDeclarationInitializer != true) { - visitAccessorCalls(visitor) - } - - visitor.afterVisitSimpleNameReferenceExpression(this) - } - - private fun visitAccessorCalls(visitor: UastVisitor) { - // Visit Kotlin get-set synthetic Java property calls as function calls - val bindingContext = sourcePsi.analyze() - val access = sourcePsi.readWriteAccess() - val resolvedCall = sourcePsi.getResolvedCall(bindingContext) - val resultingDescriptor = resolvedCall?.resultingDescriptor as? SyntheticJavaPropertyDescriptor - if (resultingDescriptor != null) { - val setterValue = if (access.isWrite) { - findAssignment(sourcePsi, sourcePsi.parent)?.right ?: run { - visitor.afterVisitSimpleNameReferenceExpression(this) - return - } - } else { - null - } - - if (resolvedCall != null) { - if (access.isRead) { - val getDescriptor = resultingDescriptor.getMethod - KotlinAccessorCallExpression(sourcePsi, this, resolvedCall, getDescriptor, null).accept(visitor) - } - - if (access.isWrite && setterValue != null) { - val setDescriptor = resultingDescriptor.setMethod - if (setDescriptor != null) { - KotlinAccessorCallExpression(sourcePsi, this, resolvedCall, setDescriptor, setterValue).accept(visitor) - } - } - } - } - } - - private tailrec fun findAssignment(prev: PsiElement?, element: PsiElement?): KtBinaryExpression? = when (element) { - is KtBinaryExpression -> if (element.left == prev && element.operationToken == KtTokens.EQ) element else null - is KtQualifiedExpression -> findAssignment(element, element.parent) - is KtSimpleNameExpression -> findAssignment(element, element.parent) - else -> null - } - - class KotlinAccessorCallExpression( - override val sourcePsi: KtSimpleNameExpression, - override val uastParent: KotlinUSimpleReferenceExpression, - private val resolvedCall: ResolvedCall<*>, - private val accessorDescriptor: DeclarationDescriptor, - val setterValue: KtExpression? - ) : UCallExpressionEx, DelegatedMultiResolve, JvmDeclarationUElementPlaceholder { - override val methodName: String? - get() = accessorDescriptor.name.asString() - - override val receiver: UExpression? - get() { - val containingElement = uastParent.uastParent - return if (containingElement is UQualifiedReferenceExpression && containingElement.selector == this) - containingElement.receiver - else - null - } - - override val javaPsi: PsiElement? get() = null - override val psi: PsiElement? get() = sourcePsi - - override val annotations: List - get() = emptyList() - - override val receiverType by lz { - val type = (resolvedCall.dispatchReceiver ?: resolvedCall.extensionReceiver)?.type ?: return@lz null - type.toPsiType(this, sourcePsi, boxed = true) - } - - override val methodIdentifier: UIdentifier? by lazy { KotlinUIdentifier(sourcePsi.getReferencedNameElement(), this) } - - override val classReference: UReferenceExpression? - get() = null - - override val valueArgumentCount: Int - get() = if (setterValue != null) 1 else 0 - - override val valueArguments by lz { - if (setterValue != null) - listOf(KotlinConverter.convertOrEmpty(setterValue, this)) - else - emptyList() - } - - override fun getArgumentForParameter(i: Int): UExpression? = valueArguments.getOrNull(i) - - override val typeArgumentCount: Int - get() = resolvedCall.typeArguments.size - - override val typeArguments by lz { - resolvedCall.typeArguments.values.map { it.toPsiType(this, sourcePsi, true) } - } - - override val returnType by lz { - (accessorDescriptor as? CallableDescriptor)?.returnType?.toPsiType(this, sourcePsi, boxed = false) - } - - override val kind: UastCallKind - get() = UastCallKind.METHOD_CALL - - override fun resolve(): PsiMethod? { - val source = accessorDescriptor.toSource() - return resolveSource(sourcePsi, accessorDescriptor, source) - } - } - - private fun KtExpression.readWriteAccess(): ReferenceAccess { - var expression = getQualifiedExpressionForSelectorOrThis() - loop@ while (true) { - val parent = expression.parent - when (parent) { - is KtParenthesizedExpression, is KtAnnotatedExpression, is KtLabeledExpression -> expression = parent as KtExpression - else -> break@loop - } - } - - val assignment = expression.getAssignmentByLHS() - if (assignment != null) { - return when (assignment.operationToken) { - KtTokens.EQ -> ReferenceAccess.WRITE - else -> ReferenceAccess.READ_WRITE - } - } - - return if ((expression.parent as? KtUnaryExpression)?.operationToken - in constant { setOf(KtTokens.PLUSPLUS, KtTokens.MINUSMINUS) } - ) - ReferenceAccess.READ_WRITE - else - ReferenceAccess.READ - } -} - -class KotlinClassViaConstructorUSimpleReferenceExpression( - override val sourcePsi: KtCallElement, - override val identifier: String, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), USimpleNameReferenceExpression, KotlinUElementWithType { - override val resolvedName: String? - get() = (resolved as? PsiNamedElement)?.name - - private val resolved by lazy { - when (val resultingDescriptor = sourcePsi.getResolvedCall(sourcePsi.analyze())?.descriptorForResolveViaConstructor()) { - is ConstructorDescriptor -> { - resultingDescriptor.constructedClass.toSource()?.getMaybeLightElement() - ?: (resultingDescriptor as? DeserializedCallableMemberDescriptor)?.let { resolveContainingDeserializedClass(sourcePsi, it) } - } - is SamConstructorDescriptor -> - (resultingDescriptor.returnType?.getFunctionalInterfaceType(this, sourcePsi) as? PsiClassType)?.resolve() - else -> null - } - } - - override fun resolve(): PsiElement? = resolved - - override fun asLogString(): String = log("identifier = $identifier, resolvesTo = $resolvedName") - - // In new inference, SAM constructor is substituted with a function descriptor, so we use candidate descriptor to preserve behavior - private fun ResolvedCall<*>.descriptorForResolveViaConstructor(): CallableDescriptor? { - return if (this is NewResolvedCallImpl) candidateDescriptor else resultingDescriptor - } -} - -class KotlinStringUSimpleReferenceExpression( - override val identifier: String, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), USimpleNameReferenceExpression { - override val psi: PsiElement? - get() = null - - override fun resolve() = null - override val resolvedName: String? - get() = identifier -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSwitchExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSwitchExpression.kt.183 deleted file mode 100644 index 160dceeaab7..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUSwitchExpression.kt.183 +++ /dev/null @@ -1,94 +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.uast.kotlin - -import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.psi.KtBlockExpression -import org.jetbrains.kotlin.psi.KtWhenEntry -import org.jetbrains.kotlin.psi.KtWhenExpression -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier -import org.jetbrains.uast.kotlin.kinds.KotlinSpecialExpressionKinds - -class KotlinUSwitchExpression( - override val sourcePsi: KtWhenExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), USwitchExpression, KotlinUElementWithType { - override val expression by lz { KotlinConverter.convertOrNull(sourcePsi.subjectExpression, this) } - - override val body: UExpressionList by lz { - object : KotlinUExpressionList(sourcePsi, KotlinSpecialExpressionKinds.WHEN, this@KotlinUSwitchExpression) { - override fun asRenderString() = expressions.joinToString("\n") { it.asRenderString().withMargin } - }.apply { - expressions = this@KotlinUSwitchExpression.sourcePsi.entries.map { KotlinUSwitchEntry(it, this) } - } - } - - override fun asRenderString() = buildString { - val expr = expression?.let { "(" + it.asRenderString() + ") " } ?: "" - appendln("switch $expr {") - appendln(body.asRenderString()) - appendln("}") - } - - override val switchIdentifier: UIdentifier - get() = KotlinUIdentifier(null, this) -} - -class KotlinUSwitchEntry( - override val sourcePsi: KtWhenEntry, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), USwitchClauseExpressionWithBody { - override val caseValues by lz { - sourcePsi.conditions.map { KotlinConverter.convertWhenCondition(it, this) ?: UastEmptyExpression } - } - - override val body: UExpressionList by lz { - object : KotlinUExpressionList(sourcePsi, KotlinSpecialExpressionKinds.WHEN_ENTRY, this@KotlinUSwitchEntry) { - override fun asRenderString() = buildString { - appendln("{") - expressions.forEach { appendln(it.asRenderString().withMargin) } - appendln("}") - } - }.apply { - val exprPsi = this@KotlinUSwitchEntry.sourcePsi.expression - val userExpressions = when (exprPsi) { - is KtBlockExpression -> exprPsi.statements.map { KotlinConverter.convertOrEmpty(it, this) } - else -> listOf(KotlinConverter.convertOrEmpty(exprPsi, this)) - } - expressions = userExpressions + object : UBreakExpression, JvmDeclarationUElementPlaceholder { - override val javaPsi: PsiElement? = null - override val sourcePsi: PsiElement? = null - override val psi: PsiElement? - get() = null - override val label: String? - get() = null - override val uastParent: UElement? - get() = this@KotlinUSwitchEntry - override val annotations: List - get() = emptyList() - } - } - } - - override fun convertParent(): UElement? { - val result = KotlinConverter.unwrapElements(sourcePsi.parent)?.let { parentUnwrapped -> - KotlinUastLanguagePlugin().convertElementWithParent(parentUnwrapped, null) - } - return (result as? KotlinUSwitchExpression)?.body ?: result - } -} \ No newline at end of file diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUTryExpression.kt.183 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUTryExpression.kt.183 deleted file mode 100644 index 0dda625a878..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUTryExpression.kt.183 +++ /dev/null @@ -1,45 +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.uast.kotlin - -import org.jetbrains.kotlin.psi.KtTryExpression -import org.jetbrains.uast.UElement -import org.jetbrains.uast.UIdentifier -import org.jetbrains.uast.UTryExpression -import org.jetbrains.uast.UVariable -import org.jetbrains.uast.kotlin.declarations.KotlinUIdentifier - -class KotlinUTryExpression( - override val sourcePsi: KtTryExpression, - givenParent: UElement? -) : KotlinAbstractUExpression(givenParent), UTryExpression, KotlinUElementWithType { - override val tryClause by lz { KotlinConverter.convertOrEmpty(sourcePsi.tryBlock, this) } - override val catchClauses by lz { sourcePsi.catchClauses.map { KotlinUCatchClause(it, this) } } - override val finallyClause by lz { sourcePsi.finallyBlock?.finalExpression?.let { KotlinConverter.convertExpression(it, this) } } - - override val resourceVariables: List - get() = emptyList() - - override val hasResources: Boolean - get() = false - - override val tryIdentifier: UIdentifier - get() = KotlinUIdentifier(null, this) - - override val finallyIdentifier: UIdentifier? - get() = null -} \ No newline at end of file diff --git a/plugins/uast-kotlin/testData/Anonymous.refNames.txt.183 b/plugins/uast-kotlin/testData/Anonymous.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/ClassAnnotation.altlog.txt.183 b/plugins/uast-kotlin/testData/ClassAnnotation.altlog.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/ClassAnnotation.identifiers.txt.183 b/plugins/uast-kotlin/testData/ClassAnnotation.identifiers.txt.183 deleted file mode 100644 index b26c4c639f6..00000000000 --- a/plugins/uast-kotlin/testData/ClassAnnotation.identifiers.txt.183 +++ /dev/null @@ -1,13 +0,0 @@ -Test -> UAnnotation (fqName = null) -A -> UClass (name = A) -MyAnnotation -> UClass (name = MyAnnotation) -text -> [!] UnknownKotlinExpression (VALUE_PARAMETER) -String -> USimpleNameReferenceExpression (identifier = String) -MyAnnotation -> UAnnotation (fqName = MyAnnotation) -B -> UClass (name = B) -MyAnnotation -> UAnnotation (fqName = MyAnnotation) -InB -> UClass (name = InB) -MyAnnotation -> UAnnotation (fqName = MyAnnotation) -object -> UClass (name = Companion) -MyAnnotation -> UAnnotation (fqName = MyAnnotation) -Obj -> UClass (name = Obj) diff --git a/plugins/uast-kotlin/testData/ClassAnnotation.refNames.txt.183 b/plugins/uast-kotlin/testData/ClassAnnotation.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/Constructors.refNames.txt.183 b/plugins/uast-kotlin/testData/Constructors.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/InnerClasses.altlog.txt.183 b/plugins/uast-kotlin/testData/InnerClasses.altlog.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/InnerClasses.splog.txt.183 b/plugins/uast-kotlin/testData/InnerClasses.splog.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.altlog.txt.183 b/plugins/uast-kotlin/testData/LocalDeclarations.altlog.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/LocalDeclarations.refNames.txt.183 b/plugins/uast-kotlin/testData/LocalDeclarations.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/ManyAlternatives.kt.183 b/plugins/uast-kotlin/testData/ManyAlternatives.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.altlog.txt.183 b/plugins/uast-kotlin/testData/ParameterPropertyWithAnnotation.altlog.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/SimpleAnnotated.refNames.txt.183 b/plugins/uast-kotlin/testData/SimpleAnnotated.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt.183 b/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.log.txt.183 b/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.log.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.render.txt.183 b/plugins/uast-kotlin/testData/StringTemplateComplexForUInjectionHost.render.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/testData/SuperCalls.refNames.txt.183 b/plugins/uast-kotlin/testData/SuperCalls.refNames.txt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.183 b/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.183 deleted file mode 100644 index ff2b42742d8..00000000000 --- a/plugins/uast-kotlin/tests/AbstractKotlinIdentifiersTest.kt.183 +++ /dev/null @@ -1,15 +0,0 @@ -package org.jetbrains.uast.test.kotlin - -import org.jetbrains.uast.test.common.kotlin.IdentifiersTestBase -import java.io.File - - -abstract class AbstractKotlinIdentifiersTest : AbstractKotlinUastTest(), IdentifiersTestBase { - - private fun getTestFile(testName: String, ext: String) = - File(File(AbstractKotlinUastTest.TEST_KOTLIN_MODEL_DIR, testName).canonicalPath + '.' + ext) - - override fun getIdentifiersFile(testName: String): File = getTestFile(testName, "identifiers.txt") - - -} \ No newline at end of file diff --git a/plugins/uast-kotlin/tests/AlternativesRenderLogTest.kt.183 b/plugins/uast-kotlin/tests/AlternativesRenderLogTest.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/tests/KotlinUastAlternativesTest.kt.183 b/plugins/uast-kotlin/tests/KotlinUastAlternativesTest.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/tests/KotlinUastApiTest.kt.183 b/plugins/uast-kotlin/tests/KotlinUastApiTest.kt.183 deleted file mode 100644 index 3d374de7a1b..00000000000 --- a/plugins/uast-kotlin/tests/KotlinUastApiTest.kt.183 +++ /dev/null @@ -1,587 +0,0 @@ -package org.jetbrains.uast.test.kotlin - -import com.intellij.psi.PsiAnnotation -import com.intellij.psi.PsiClass -import com.intellij.psi.PsiModifier -import com.intellij.testFramework.RunAll -import com.intellij.testFramework.UsefulTestCase -import com.intellij.util.ThrowableRunnable -import org.jetbrains.kotlin.asJava.toLightAnnotation -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getParentOfType -import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase -import org.jetbrains.kotlin.utils.addToStdlib.assertedCast -import org.jetbrains.kotlin.utils.addToStdlib.cast -import org.jetbrains.kotlin.utils.sure -import org.jetbrains.uast.* -import org.jetbrains.uast.kotlin.KotlinUastLanguagePlugin -import org.jetbrains.uast.test.env.kotlin.findElementByText -import org.jetbrains.uast.test.env.kotlin.findElementByTextFromPsi -import org.jetbrains.uast.visitor.AbstractUastVisitor -import org.junit.Assert -import org.junit.Test -import kotlin.test.fail as kfail - - -class KotlinUastApiTest : AbstractKotlinUastTest() { - override fun check(testName: String, file: UFile) { - } - - @Test fun testAnnotationParameters() { - doTest("AnnotationParameters") { _, file -> - val annotation = file.findElementByText("@IntRange(from = 10, to = 0)") - assertEquals(annotation.findAttributeValue("from")?.evaluate(), 10) - val toAttribute = annotation.findAttributeValue("to")!! - assertEquals(toAttribute.evaluate(), 0) - KtUsefulTestCase.assertInstanceOf(annotation.psi.toUElement(), UAnnotation::class.java) - KtUsefulTestCase.assertInstanceOf( - annotation.psi.cast().toLightAnnotation().toUElement(), - UAnnotation::class.java - ) - KtUsefulTestCase.assertInstanceOf(toAttribute.uastParent, UNamedExpression::class.java) - KtUsefulTestCase.assertInstanceOf(toAttribute.psi.toUElement()?.uastParent, UNamedExpression::class.java) - } - } - - @Test fun testConvertStringTemplate() { - doTest("StringTemplateInClass") { _, file -> - val literalExpression = file.findElementByText("lorem") - val psi = literalExpression.psi!! - Assert.assertTrue(psi is KtLiteralStringTemplateEntry) - val literalExpressionAgain = psi.toUElement() - Assert.assertTrue(literalExpressionAgain is ULiteralExpression) - - } - } - - @Test fun testConvertStringTemplateWithExpectedType() { - doTest("StringTemplateWithVar") { _, file -> - val index = file.psi.text.indexOf("foo") - val stringTemplate = file.psi.findElementAt(index)!!.getParentOfType(false) - val uLiteral = stringTemplate.toUElementOfType() - assertNull(uLiteral) - } - } - - @Test fun testNameContainingFile() { - doTest("NameContainingFile") { _, file -> - val foo = file.findElementByText("class Foo") - assertEquals(file.psi, foo.nameIdentifier!!.containingFile) - - val bar = file.findElementByText("fun bar() {}") - assertEquals(file.psi, bar.nameIdentifier!!.containingFile) - - val xyzzy = file.findElementByText("val xyzzy: Int = 0") - assertEquals(file.psi, xyzzy.nameIdentifier!!.containingFile) - } - } - - @Test fun testInterfaceMethodWithBody() { - doTest("DefaultImpls") { _, file -> - val bar = file.findElementByText("fun bar() = \"Hello!\"") - assertFalse(bar.containingFile.text!!, bar.psi.modifierList.hasExplicitModifier(PsiModifier.DEFAULT)) - assertTrue(bar.containingFile.text!!, bar.psi.modifierList.hasModifierProperty(PsiModifier.DEFAULT)) - } - } - - @Test - fun testSAM() { - doTest("SAM") { _, file -> - runAll( - { assertNull(file.findElementByText("{ /* Not SAM */ }").functionalInterfaceType) }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{/* Variable */}").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{/* Assignment */}").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{/* Type Cast */}").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{/* Argument */}").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{/* Return */}").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{ /* SAM */ }").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{ println(\"hello1\") }").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.lang.Runnable", - file.findElementByText("{ println(\"hello2\") }").functionalInterfaceType?.canonicalText - ) - }, { - val call = file.findElementByText("Runnable { println(\"hello2\") }") - assertEquals( - "java.lang.Runnable", - (call.classReference?.resolve() as? PsiClass)?.qualifiedName - ) - }, { - assertEquals( - "java.util.function.Supplier", - file.findElementByText("{ \"Supplier\" }").functionalInterfaceType?.canonicalText - ) - }, { - assertEquals( - "java.util.concurrent.Callable", - file.findElementByText("{ \"Callable\" }").functionalInterfaceType?.canonicalText - ) - } - ) - } - } - - @Test fun testParameterPropertyWithAnnotation() { - doTest("ParameterPropertyWithAnnotation") { _, file -> - val test1 = file.classes.find { it.name == "Test1" }!! - - val constructor1 = test1.methods.find { it.name == "Test1" }!! - assertTrue(constructor1.uastParameters.first().annotations.any { it.qualifiedName == "MyAnnotation" }) - - val getter1 = test1.methods.find { it.name == "getBar" }!! - assertFalse(getter1.annotations.any { it.qualifiedName == "MyAnnotation" }) - - val setter1 = test1.methods.find { it.name == "setBar" }!! - assertFalse(setter1.annotations.any { it.qualifiedName == "MyAnnotation" }) - assertFalse(setter1.uastParameters.first().annotations.any { it.qualifiedName == "MyAnnotation" }) - - - val test2 = file.classes.find { it.name == "Test2" }!! - val constructor2 = test2.methods.find { it.name == "Test2" }!! - assertFalse(constructor2.uastParameters.first().annotations.any { it.qualifiedName?.startsWith("MyAnnotation") ?: false }) - - val getter2 = test2.methods.find { it.name == "getBar" }!! - getter2.annotations.single { it.qualifiedName == "MyAnnotation" } - - val setter2 = test2.methods.find { it.name == "setBar" }!! - setter2.annotations.single { it.qualifiedName == "MyAnnotation2" } - setter2.uastParameters.first().annotations.single { it.qualifiedName == "MyAnnotation3" } - - test2.fields.find { it.name == "bar" }!!.annotations.single { it.qualifiedName == "MyAnnotation5" } - } - } - - @Test fun testConvertTypeInAnnotation() { - doTest("TypeInAnnotation") { _, file -> - val index = file.psi.text.indexOf("Test") - val element = file.psi.findElementAt(index)!!.getParentOfType(false)!! - assertNotNull(element.getUastParentOfType(UAnnotation::class.java)) - } - } - - @Test fun testElvisType() { - doTest("ElvisType") { _, file -> - val elvisExpression = file.findElementByText("text ?: return") - assertEquals("String", elvisExpression.getExpressionType()!!.presentableText) - } - } - - @Test fun testFindAttributeDefaultValue() { - doTest("AnnotationParameters") { _, file -> - val witDefaultValue = file.findElementByText("@WithDefaultValue") - assertEquals(42, witDefaultValue.findAttributeValue("value")!!.evaluate()) - assertEquals(42, witDefaultValue.findAttributeValue(null)!!.evaluate()) - } - } - - @Test fun testIfCondition() { - doTest("IfStatement") { _, file -> - val psiFile = file.psi - val element = psiFile.findElementAt(psiFile.text.indexOf("\"abc\""))!! - val binaryExpression = element.getParentOfType(false)!! - val uBinaryExpression = KotlinUastLanguagePlugin().convertElementWithParent(binaryExpression, null)!! - UsefulTestCase.assertInstanceOf(uBinaryExpression.uastParent, UIfExpression::class.java) - } - } - - @Test - fun testWhenStringLiteral() { - doTest("WhenStringLiteral") { _, file -> - - file.findElementByTextFromPsi("abc").let { literalExpression -> - val psi = literalExpression.psi!! - Assert.assertTrue(psi is KtLiteralStringTemplateEntry) - UsefulTestCase.assertInstanceOf(literalExpression.uastParent, USwitchClauseExpressionWithBody::class.java) - } - - file.findElementByTextFromPsi("def").let { literalExpression -> - val psi = literalExpression.psi!! - Assert.assertTrue(psi is KtLiteralStringTemplateEntry) - UsefulTestCase.assertInstanceOf(literalExpression.uastParent, USwitchClauseExpressionWithBody::class.java) - } - - file.findElementByTextFromPsi("def1").let { literalExpression -> - val psi = literalExpression.psi!! - Assert.assertTrue(psi is KtLiteralStringTemplateEntry) - UsefulTestCase.assertInstanceOf(literalExpression.uastParent, UBlockExpression::class.java) - } - - - } - } - - @Test - fun testWhenAndDestructing() { - doTest("WhenAndDestructing") { _, file -> - - file.findElementByTextFromPsi("val (bindingContext, statementFilter) = arr").let { e -> - val uBlockExpression = e.getParentOfType() - Assert.assertNotNull(uBlockExpression) - val uMethod = uBlockExpression!!.getParentOfType() - Assert.assertNotNull(uMethod) - } - - } - } - - @Test - fun testBrokenMethodTypeResolve() { - doTest("BrokenMethod") { _, file -> - - file.accept(object : AbstractUastVisitor() { - override fun visitCallExpression(node: UCallExpression): Boolean { - node.returnType - return false - } - }) - } - } - - @Test - fun testSimpleAnnotated() { - doTest("SimpleAnnotated") { _, file -> - file.findElementByTextFromPsi("@kotlin.SinceKotlin(\"1.0\")\n val property: String = \"Mary\"").let { field -> - val annotation = field.annotations.assertedFind("kotlin.SinceKotlin") { it.qualifiedName } - Assert.assertEquals("1.0", annotation.findDeclaredAttributeValue("version")?.evaluateString()) - Assert.assertEquals("SinceKotlin", annotation.cast().uastAnchor?.sourcePsi?.text) - } - } - } - - - fun UFile.checkUastSuperTypes(refText: String, superTypes: List) { - findElementByTextFromPsi(refText, false).let { - assertEquals("base classes", superTypes, it.uastSuperTypes.map { it.getQualifiedName() }) - } - } - - - @Test - fun testSuperTypes() { - doTest("SuperCalls") { _, file -> - file.checkUastSuperTypes("B", listOf("A")) - file.checkUastSuperTypes("O", listOf("A")) - file.checkUastSuperTypes("innerObject ", listOf("A")) - file.checkUastSuperTypes("InnerClass", listOf("A")) - file.checkUastSuperTypes("object : A(\"textForAnon\")", listOf("A")) - } - } - - @Test - fun testAnonymousSuperTypes() { - doTest("Anonymous") { _, file -> - file.checkUastSuperTypes("object : Runnable { override fun run() {} }", listOf("java.lang.Runnable")) - file.checkUastSuperTypes( - "object : Runnable, Closeable { override fun close() {} override fun run() {} }", - listOf("java.lang.Runnable", "java.io.Closeable") - ) - file.checkUastSuperTypes( - "object : InputStream(), Runnable { override fun read(): Int = 0; override fun run() {} }", - listOf("java.io.InputStream", "java.lang.Runnable") - ) - } - } - - @Test - fun testLiteralArraysTypes() { - doTest("AnnotationParameters") { _, file -> - file.findElementByTextFromPsi("intArrayOf(1, 2, 3)").let { field -> - Assert.assertEquals("PsiType:int[]", field.returnType.toString()) - } - file.findElementByTextFromPsi("[1, 2, 3]").let { field -> - Assert.assertEquals("PsiType:int[]", field.returnType.toString()) - Assert.assertEquals("PsiType:int", field.typeArguments.single().toString()) - } - file.findElementByTextFromPsi("[\"a\", \"b\", \"c\"]").let { field -> - Assert.assertEquals("PsiType:String[]", field.returnType.toString()) - Assert.assertEquals("PsiType:String", field.typeArguments.single().toString()) - } - - } - } - - @Test - fun testTypeAliases() { - doTest("TypeAliases") { _, file -> - val g = (file.psi as KtFile).declarations.single { it.name == "G" } as KtTypeAlias - val originalType = g.getTypeReference()!!.typeElement as KtFunctionType - val originalTypeParameters = originalType.parameterList.toUElement() as UDeclarationsExpression - Assert.assertTrue((originalTypeParameters.declarations.single() as UParameter).type.isValid) - } - } - - @Test - fun testNestedAnnotation() = doTest("AnnotationComplex") { _, file -> - file.findElementByTextFromPsi("@AnnotationArray(value = Annotation(\"sv1\", \"sv2\"))") - .findElementByTextFromPsi("Annotation(\"sv1\", \"sv2\")") - .sourcePsiElement - .let { referenceExpression -> - val convertedUAnnotation = referenceExpression - .cast() - .toUElementOfType() - ?: throw AssertionError("haven't got annotation from $referenceExpression(${referenceExpression?.javaClass})") - - checkDescriptorsLeak(convertedUAnnotation) - assertEquals("Annotation", convertedUAnnotation.qualifiedName) - val lightAnnotation = convertedUAnnotation.getAsJavaPsiElement(PsiAnnotation::class.java) - ?: throw AssertionError("can't get lightAnnotation from $convertedUAnnotation") - assertEquals("Annotation", lightAnnotation.qualifiedName) - assertEquals("Annotation", (convertedUAnnotation as UAnchorOwner).uastAnchor?.sourcePsi?.text) - } - } - - @Test - fun testNestedAnnotationParameters() = doTest("AnnotationComplex") { _, file -> - - fun UFile.annotationAndParam(refText: String, check: (PsiAnnotation, String?) -> Unit) { - findElementByTextFromPsi(refText) - .let { expression -> - val (annotation: PsiAnnotation, paramname: String?) = - getContainingAnnotationEntry(expression) ?: kfail("annotation not found for '$refText' ($expression)") - check(annotation, paramname) - } - } - - file.annotationAndParam("sv1") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals(null, paramname) - } - file.annotationAndParam("sv2") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals(null, paramname) - } - file.annotationAndParam("sar1") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals("strings", paramname) - } - file.annotationAndParam("sar2") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals("strings", paramname) - } - file.annotationAndParam("[sar]1") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals("strings", paramname) - } - file.annotationAndParam("[sar]2") { annotation, paramname -> - assertEquals("Annotation", annotation.qualifiedName) - assertEquals("strings", paramname) - } - } - - - @Test - fun testParametersDisorder() = doTest("ParametersDisorder") { _, file -> - - fun assertArguments(argumentsInPositionalOrder: List?, refText: String) = - file.findElementByTextFromPsi(refText).let { call -> - if (call !is UCallExpressionEx) throw AssertionError("${call.javaClass} is not a UCallExpressionEx") - Assert.assertEquals( - argumentsInPositionalOrder, - call.resolve()?.let { psiMethod -> - (0 until psiMethod.parameterList.parametersCount).map { - call.getArgumentForParameter(it)?.asRenderString() - } - } - ) - } - - - assertArguments(listOf("2", "2.2"), "global(b = 2.2F, a = 2)") - assertArguments(listOf(null, "\"bbb\""), "withDefault(d = \"bbb\")") - assertArguments(listOf("1.3", "3.4"), "atan2(1.3, 3.4)") - assertArguments(null, "unresolvedMethod(\"param1\", \"param2\")") - assertArguments(listOf("\"%i %i %i\"", "varargs 1 : 2 : 3"), "format(\"%i %i %i\", 1, 2, 3)") - assertArguments(listOf("\"%i %i %i\"", "varargs arrayOf(1, 2, 3)"), "format(\"%i %i %i\", arrayOf(1, 2, 3))") - assertArguments( - listOf("\"%i %i %i\"", "varargs arrayOf(1, 2, 3) : arrayOf(4, 5, 6)"), - "format(\"%i %i %i\", arrayOf(1, 2, 3), arrayOf(4, 5, 6))" - ) - assertArguments(listOf("\"%i %i %i\"", "\"\".chunked(2).toTypedArray()"), "format(\"%i %i %i\", *\"\".chunked(2).toTypedArray())") - assertArguments(listOf("\"def\"", "8", "7.0"), "with2Receivers(8, 7.0F)") - assertArguments(listOf("\"foo\"", "1"), "object : Parent(b = 1, a = \"foo\")\n") - } - - @Test - fun testResolvedDeserializedMethod() = doTest("Resolve") { _, file -> - - fun UElement.assertResolveCall(callText: String, methodName: String = callText.substringBefore("(")) { - this.findElementByTextFromPsi(callText).let { - val resolve = it.resolve().sure { "resolving '$callText'" } - assertEquals(methodName, resolve.name) - } - } - - file.findElementByTextFromPsi("bar").getParentOfType()!!.let { barMethod -> - barMethod.assertResolveCall("foo()") - barMethod.assertResolveCall("inlineFoo()") - barMethod.assertResolveCall("forEach { println(it) }", "forEach") - barMethod.assertResolveCall("joinToString()") - barMethod.assertResolveCall("last()") - barMethod.assertResolveCall("setValue(\"123\")") - barMethod.assertResolveCall("contains(2 as Int)", "longRangeContains") - barMethod.assertResolveCall("IntRange(1, 2)") - } - - file.findElementByTextFromPsi("barT").getParentOfType()!!.let { barMethod -> - barMethod.assertResolveCall("foo()") - } - - file.findElementByTextFromPsi("listT").getParentOfType()!!.let { barMethod -> - barMethod.assertResolveCall("isEmpty()") - barMethod.assertResolveCall("foo()") - } - - } - - @Test - fun testUtilsStreamLambda() { - doTest("Lambdas") { _, file -> - val lambda = file.findElementByTextFromPsi("{ it.isEmpty() }") - assertEquals( - "java.util.function.Predicate", - lambda.functionalInterfaceType?.canonicalText - ) - assertEquals( - "kotlin.jvm.functions.Function1", - lambda.getExpressionType()?.canonicalText - ) - val uCallExpression = lambda.uastParent.assertedCast { "UCallExpression expected" } - assertTrue(uCallExpression.valueArguments.contains(lambda)) - } - } - - @Test - fun testLambdaParamCall() { - doTest("Lambdas") { _, file -> - val lambdaCall = file.findElementByTextFromPsi("selectItemFunction()") - assertEquals( - "UIdentifier (Identifier (selectItemFunction))", - lambdaCall.methodIdentifier?.asLogString() - ) - assertEquals( - "selectItemFunction", - lambdaCall.methodIdentifier?.name - ) - assertEquals( - "invoke", - lambdaCall.methodName - ) - val receiver = lambdaCall.receiver ?: kfail("receiver expected") - assertEquals("UReferenceExpression", receiver.asLogString()) - val uParameter = (receiver as UReferenceExpression).resolve().toUElement() ?: kfail("uelement expected") - assertEquals("UParameter (name = selectItemFunction)", uParameter.asLogString()) - } - } - - @Test - fun testLocalLambdaCall() { - doTest("Lambdas") { _, file -> - val lambdaCall = file.findElementByTextFromPsi("baz()") - assertEquals( - "UIdentifier (Identifier (baz))", - lambdaCall.methodIdentifier?.asLogString() - ) - assertEquals( - "baz", - lambdaCall.methodIdentifier?.name - ) - assertEquals( - "invoke", - lambdaCall.methodName - ) - val receiver = lambdaCall.receiver ?: kfail("receiver expected") - assertEquals("UReferenceExpression", receiver.asLogString()) - val uParameter = (receiver as UReferenceExpression).resolve().toUElement() ?: kfail("uelement expected") - assertEquals("ULocalVariable (name = baz)", uParameter.asLogString()) - } - } - - @Test - fun testLocalDeclarationCall() { - doTest("LocalDeclarations") { _, file -> - val localFunction = file.findElementByTextFromPsi("bar() == Local()"). - findElementByText("bar()") - assertEquals( - "UIdentifier (Identifier (bar))", - localFunction.methodIdentifier?.asLogString() - ) - assertEquals( - "bar", - localFunction.methodIdentifier?.name - ) - assertEquals( - "bar", - localFunction.methodName - ) - assertNull(localFunction.resolve()) - val receiver = localFunction.receiver ?: kfail("receiver expected") - assertEquals("UReferenceExpression", receiver.asLogString()) - val uParameter = (receiver as UReferenceExpression).resolve().toUElement() ?: kfail("uelement expected") - assertEquals("ULambdaExpression", uParameter.asLogString()) - } - } - - @Test - fun testVariablesTypeReferences() { - doTest("TypeReferences") { _, file -> - run { - val localVariable = file.findElementByTextFromPsi("val varWithType: String? = \"Not Null\"") - val typeReference = localVariable.typeReference - assertEquals("java.lang.String", typeReference?.getQualifiedName()) - val sourcePsi = typeReference?.sourcePsi ?: kfail("no sourcePsi") - assertTrue("sourcePsi = $sourcePsi should be physical", sourcePsi.isPhysical) - assertEquals("String?", sourcePsi.text) - } - - run { - val localVariable = file.findElementByTextFromPsi("val varWithoutType = \"lorem ipsum\"") - val typeReference = localVariable.typeReference - assertEquals("java.lang.String", typeReference?.getQualifiedName()) - assertNull(typeReference?.sourcePsi) - } - - run { - val localVariable = file.findElementByTextFromPsi("parameter: Int") - val typeReference = localVariable.typeReference - assertEquals("int", typeReference?.type?.presentableText) - val sourcePsi = typeReference?.sourcePsi ?: kfail("no sourcePsi") - assertTrue("sourcePsi = $sourcePsi should be physical", sourcePsi.isPhysical) - assertEquals("Int", sourcePsi.text) - } - } - } - -} - -fun Iterable.assertedFind(value: R, transform: (T) -> R): T = - find { transform(it) == value } ?: throw AssertionError("'$value' not found, only ${this.joinToString { transform(it).toString() }}") - -fun runAll(vararg asserts: () -> Unit) = RunAll(*asserts.map { ThrowableRunnable(it) }.toTypedArray()).run() \ No newline at end of file diff --git a/plugins/uast-kotlin/tests/KotlinUastReferencesTest.kt.183 b/plugins/uast-kotlin/tests/KotlinUastReferencesTest.kt.183 deleted file mode 100644 index 8604436a874..00000000000 --- a/plugins/uast-kotlin/tests/KotlinUastReferencesTest.kt.183 +++ /dev/null @@ -1,126 +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.uast.test.kotlin - -import com.intellij.openapi.Disposable -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.util.Disposer -import com.intellij.patterns.uast.literalExpression -import com.intellij.psi.* -import com.intellij.psi.impl.source.resolve.reference.PsiReferenceContributorEP -import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry -import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl -import com.intellij.psi.util.PropertyUtil -import com.intellij.testFramework.LightProjectDescriptor -import com.intellij.testFramework.registerServiceInstance -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.jetbrains.uast.UExpression -import org.jetbrains.uast.evaluateString -import org.jetbrains.uast.toUElementOfType -import org.junit.Test -import org.junit.runner.RunWith -import kotlin.test.fail - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class KotlinUastReferencesTest : KotlinLightCodeInsightFixtureTestCase() { - - override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - - - @Test - fun `test original getter is visible when reference is under renaming`() { - - registerReferenceProviders(testRootDisposable) { - registerUastReferenceProvider(literalExpression(), uastLiteralReferenceProvider { _, psiLanguageInjectionHost -> - arrayOf(GetterReference("KotlinBean", psiLanguageInjectionHost)) - }) - } - - myFixture.configureByText( - "KotlinBean.kt", """ - data class KotlinBean(val myField: String) - - val reference = "myField" - - """.trimIndent() - ) - - myFixture.renameElementAtCaret("myRenamedField") - - myFixture.checkResult( - """ - data class KotlinBean(val myRenamedField: String) - - val reference = "myRenamedField" - - """.trimIndent() - ) - - } - -} - -private class GetterReference( - val className: String, - psiElement: PsiElement -) : PsiReferenceBase(psiElement) { - override fun resolve(): PsiMethod? { - val psiClass = JavaPsiFacade.getInstance(element.project).findClass(className, element.resolveScope) ?: return null - val name = element.toUElementOfType()?.evaluateString() ?: return null - return PropertyUtil.getGetters(psiClass, name).firstOrNull() - } - - override fun handleElementRename(newElementName: String): PsiElement { - val resolve = resolve() - ?: fail("can't resolve during rename, looks like someone renamed or removed the source element before updating references") - - val newName = - if (PropertyUtil.getPropertyName(resolve) != null) - PropertyUtil.getPropertyName(newElementName) ?: newElementName - else newElementName - - return super.handleElementRename(newName) - } - - override fun getVariants(): Array = emptyArray() -} - - -fun registerReferenceProviders(disposable: Disposable, registerContributors: PsiReferenceRegistrar.() -> Unit) { - registerReferenceContributor(object : PsiReferenceContributor() { - override fun registerReferenceProviders(registrar: PsiReferenceRegistrar) = registrar.registerContributors() - }, disposable) -} - -fun registerReferenceContributor(contributor: PsiReferenceContributor, disposable: Disposable) { - val referenceContributorEp = Extensions.getArea(null).getExtensionPoint(PsiReferenceContributor.EP_NAME.name) - - val contributorEp = object : PsiReferenceContributorEP() { - override fun getInstance(): PsiReferenceContributor = contributor - } - - referenceContributorEp.registerExtension(contributorEp) - - val application = ApplicationManager.getApplication() - - //we need a fresh ReferenceProvidersRegistry after updating ReferenceContributors - val oldReferenceProviderRegistry = - application.picoContainer.getComponentInstance(ReferenceProvidersRegistry::class.java) as ReferenceProvidersRegistry - application.registerServiceInstance(ReferenceProvidersRegistry::class.java, ReferenceProvidersRegistryImpl()) - - Disposer.register(disposable, Disposable { - referenceContributorEp.unregisterExtension(contributorEp) - application.registerServiceInstance(ReferenceProvidersRegistry::class.java, oldReferenceProviderRegistry) - }) - -} - - - - diff --git a/plugins/uast-kotlin/tests/MultiplesRequiredTypesTest.kt.183 b/plugins/uast-kotlin/tests/MultiplesRequiredTypesTest.kt.183 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 b/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 deleted file mode 100644 index d987e7a00b7..00000000000 --- a/plugins/uast-kotlin/tests/SimpleKotlinRenderLogTest.kt.183 +++ /dev/null @@ -1,108 +0,0 @@ -package org.jetbrains.uast.test.kotlin - -import org.junit.Test - -class SimpleKotlinRenderLogTest : AbstractKotlinRenderLogTest() { - @Test fun testLocalDeclarations() = doTest("LocalDeclarations") - - @Test fun testSimple() = doTest("Simple") - - @Test fun testWhenIs() = doTest("WhenIs") - - @Test fun testDefaultImpls() = doTest("DefaultImpls") - - @Test fun testElvis() = doTest("Elvis") - - @Test fun testPropertyAccessors() = doTest("PropertyAccessors") - - @Test fun testPropertyInitializer() = doTest("PropertyInitializer") - - @Test fun testPropertyInitializerWithoutSetter() = doTest("PropertyInitializerWithoutSetter") - - @Test fun testAnnotationParameters() = doTest("AnnotationParameters") - - @Test fun testEnumValueMembers() = doTest("EnumValueMembers") - - @Test fun testStringTemplate() = doTest("StringTemplate") - - @Test fun testStringTemplateComplex() = doTest("StringTemplateComplex") - - @Test fun testQualifiedConstructorCall() = doTest("QualifiedConstructorCall") - - @Test fun testPropertyDelegate() = doTest("PropertyDelegate") - - @Test fun testLocalVariableWithAnnotation() = doTest("LocalVariableWithAnnotation") - - @Test fun testPropertyWithAnnotation() = doTest("PropertyWithAnnotation") - - @Test fun testIfStatement() = doTest("IfStatement") - - @Test fun testInnerClasses() = doTest("InnerClasses") - - @Test fun testSimpleScript() = doTest("SimpleScript") { testName, file -> check(testName, file, false) } - - @Test fun testDestructuringDeclaration() = doTest("DestructuringDeclaration") - - @Test fun testDefaultParameterValues() = doTest("DefaultParameterValues") - - @Test fun testParameterPropertyWithAnnotation() = doTest("ParameterPropertyWithAnnotation") - - @Test fun testParametersWithDefaultValues() = doTest("ParametersWithDefaultValues") - - @Test - fun testUnexpectedContainer() = doTest("UnexpectedContainerException") - - @Test - fun testWhenStringLiteral() = doTest("WhenStringLiteral") - - @Test - fun testWhenAndDestructing() = doTest("WhenAndDestructing") { testName, file -> check(testName, file, false) } - - @Test - fun testSuperCalls() = doTest("SuperCalls") - - @Test - fun testConstructors() = doTest("Constructors") - - @Test - fun testClassAnnotation() = doTest("ClassAnnotation") - - @Test - fun testReceiverFun() = doTest("ReceiverFun") - - @Test - fun testAnonymous() = doTest("Anonymous") - - @Test - fun testAnnotationComplex() = doTest("AnnotationComplex") - - @Test - fun testParametersDisorder() = doTest("ParametersDisorder") { testName, file -> - // disabled due to inconsistent parents for 2-receivers call (KT-22344) - check(testName, file, false) - } - - @Test - fun testLambdas() = doTest("Lambdas") - - @Test - fun testTypeReferences() = doTest("TypeReferences") - - @Test - fun testDelegate() = doTest("Delegate") - - @Test - fun testConstructorDelegate() = doTest("ConstructorDelegate") - - @Test - fun testLambdaReturn() = doTest("LambdaReturn") - - @Test - fun testReified() = doTest("Reified") - - @Test - fun testSuspend() = doTest("Suspend") - - @Test - fun testDeprecatedHidden() = doTest("DeprecatedHidden") -} diff --git a/tests/mute.csv.as34 b/tests/mute.csv.as34 deleted file mode 100644 index 1aaff53ad37..00000000000 --- a/tests/mute.csv.as34 +++ /dev/null @@ -1,13 +0,0 @@ -Test key, Issue, State (optional: MUTE or FAIL) -org.jetbrains.kotlin.checkers.JavaAgainstKotlinSourceCheckerTestGenerated.JavaAgainstKotlin.testExtendingMutableInterfaces, KT-34105 -org.jetbrains.kotlin.checkers.JavaAgainstKotlinSourceCheckerTestGenerated.JavaAgainstKotlin.testExtendingReadOnlyInterfaces, KT-34105 -org.jetbrains.kotlin.checkers.JavaAgainstKotlinSourceCheckerWithoutUltraLightTestGenerated.JavaAgainstKotlin.testExtendingMutableInterfaces, KT-34105 -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleHighlightingTest.testLazyResolvers -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleHighlightingTest.testRecomputeResolversOnChange -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testOverridingDeprecatedMember_inspectionData_Inspections_test, KT-32856 -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testRecursivePropertyAccessor_inspectionData_Inspections_test, KT-32856 -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testRemoveSetterParameterType_inspectionData_Inspections_test, KT-32856 -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Intentions.testRemoveExplicitSuperQualifier_inspectionData_Inspections_test, KT-32856 -org.jetbrains.kotlin.idea.refactoring.move.MultiModuleMoveTestGenerated.testMoveFromJsModuleToJvmModule_MoveFromJsModuleToJvmModule, KT-34106 -org.jetbrains.kotlin.idea.refactoring.move.MultiModuleMoveTestGenerated.testMoveFromJvmModuleToJsModule_MoveFromJvmModuleToJsModule, KT-34106 -org.jetbrains.kotlin.idea.refactoring.move.MultiModuleMoveTestGenerated.testMoveJdkDependentToJsModule_MoveJdkDependentToJsModule, KT-34106 \ No newline at end of file