From 952d2b6287185b7977bb01101c78241ac7ce6b58 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Fri, 19 Apr 2019 18:43:37 +0300 Subject: [PATCH] Remove 181 bunch files --- buildSrc/src/main/kotlin/instrument.kt.181 | 195 -- .../inline/LegacyInlineSuspendUtil.kt.181 | 54 - compiler/compiler.pro.181 | 237 -- .../kotlin/fir/AbstractFir2IrTextTest.kt.181 | 89 - .../AbstractFirDiagnosticsSmokeTest.kt.181 | 159 -- ...stractFirResolveWithSessionTestCase.kt.181 | 32 - .../AbstractFirTypeEnhancementTest.kt.181 | 235 -- .../kotlin/psi/KtCodeFragmentBase.kt.181 | 15 - .../jetbrains/kotlin/psi/KtConstructor.kt.181 | 96 - .../kotlin/psi/KtObjectDeclaration.kt.181 | 71 - .../kotlin/util/AstLoadingUtil.kt.181 | 22 - gradle/versions.properties.181 | 13 - .../compatibility/ExecutorProcessor.kt.181 | 14 - .../BaseKotlinCompilerSettings.kt.181 | 132 - .../Kotlin2JsCompilerArgumentsHolder.kt.181 | 39 - .../Kotlin2JvmCompilerArgumentsHolder.kt.181 | 38 - ...KotlinCommonCompilerArgumentsHolder.kt.181 | 56 - .../KotlinCompilerSettings.kt.181 | 35 - .../idea/highlighter/ErrorIconUtil.java.181 | 12 - .../OutsidersPsiFileSupportWrapper.kt.181 | 18 - .../idea/util/compat/psiSearchHelper.kt.181 | 15 - ...tlinAndroidGradleLibraryDataService.kt.181 | 65 - ...inAndroidGradleMPPModuleDataService.kt.181 | 236 -- .../kotlin/android/AndroidTestCase.java.181 | 388 --- .../kotlin/android/TestUtils.java.181 | 40 - .../git/KotlinExplicitMovementProvider.kt.181 | 0 .../KotlinMPPGradleProjectTaskRunner.java.181 | 0 .../GradleMultiplatformWizardTest.kt.181 | 31 - ...ultiplatformTestCompatibilityMatrix.kt.181 | 17 - .../gradle/GradleFacetImportTest.kt.181 | 2524 ----------------- .../idea/internal/baseDecompiler.kt.181 | 18 - .../platform/JsIdePlatformKindTooling.kt.181 | 128 - .../kotlin/idea/run/jvmMppUtils.kt.181 | 22 - ...inMultiplatformRunLocationsProvider.kt.181 | 0 .../KtScratchFileCreationHelper.kt.181 | 0 .../idea/scratch/scratchRunnerUtil.kt.181 | 13 - ...ghtCodeInsightFixtureTestCaseBase.java.181 | 42 - .../build.gradle.kts.181 | 21 - .../src/KotlinMPPGradleModelBuilder.kt.181 | 445 --- idea/resources/META-INF/git4idea.xml.181 | 4 - idea/resources/META-INF/gradle-java.xml.181 | 0 idea/resources/META-INF/gradle.xml.181 | 96 - idea/resources/META-INF/jvm.xml.181 | 192 -- idea/resources/META-INF/plugin.xml.181 | 74 - .../idea/icons/kotlin_gradle_script.png.181 | Bin 460 -> 0 bytes .../icons/kotlin_gradle_script@2x.png.181 | Bin 714 -> 0 bytes .../idea/actions/JavaToKotlinAction.kt.181 | 243 -- .../QuickFixFactoryCompatibility.kt.181 | 14 - .../jetbrains/kotlin/idea/js/jsUtils.kt.181 | 59 - .../idea/jvm/KotlinDeclarationSearcher.kt.181 | 0 .../KotlinAddOrderEntryActionFactory.kt.181 | 67 - .../KotlinElementActionsFactory.kt.181 | 410 --- .../KotlinRenameDispatcherHandler.kt.181 | 55 - .../KotlinVariableInplaceRenameHandler.kt.181 | 71 - .../RenameBackingFieldReferenceHandler.kt.181 | 45 - .../rename/RenameDynamicMemberHandler.kt.181 | 49 - ...RenameKotlinImplicitLambdaParameter.kt.181 | 48 - ...RenameOnSecondaryConstructorHandler.kt.181 | 54 - ...theticDeclarationByReferenceHandler.kt.181 | 41 - ...KotlinUsageContextDataFlowPanelBase.kt.181 | 141 - .../util/PopupChooserBuilderWrapper.kt.181 | 13 - .../idea/util/compat/Nullability.kt.181 | 40 - .../android/lint/javaPerformance.kt.181 | 193 -- .../valAtLambaArgumentInCall.kt.after.181 | 5 - .../smartStepIntoInlinedFunLiteral.out.181 | 12 - ...tepIntoInlinedFunctionalExpression.out.181 | 12 - .../quickDoc/JavaClassUsedInKotlin.kt.181 | 8 - .../quickDoc/JavaDocFromOverridenClass.kt.181 | 9 - .../JavaDocFromOverridenInterface.kt.181 | 9 - .../quickDoc/JavaMethodUsedInKotlin.kt.181 | 9 - .../quickDoc/OnEnumValueOfFunction.kt.181 | 12 - .../OnFunctionDeclarationWithPackage.kt.181 | 18 - .../editor/quickDoc/OnMethodUsage.kt.181 | 18 - .../OnMethodUsageWithBracketsInParam.kt.181 | 18 - .../OnMethodUsageWithMultilineParam.kt.181 | 17 - .../quickDoc/OnMethodUsageWithReceiver.kt.181 | 18 - .../OnMethodUsageWithReturnAndLink.kt.181 | 19 - .../OnMethodUsageWithReturnAndThrows.kt.181 | 20 - .../quickDoc/OnMethodUsageWithSee.kt.181 | 20 - .../OnMethodUsageWithTypeParameter.kt.181 | 19 - idea/testData/editor/quickDoc/Samples.kt.181 | 29 - .../fqName/code/usage.kt.181 | 18 - .../simple/code/usage.kt.181 | 10 - .../ThrowsOnGenericMethod.java.181 | 8 - ...FunctionWithBodyWithComments2.kt.after.181 | 5 - .../paramTypeLambdaMismatch.kt.181 | 12 - .../unusedSuppressAnnotation/simple.kt.181 | 7 - .../simple.kt.after.181 | 7 - .../AbstractConfigureKotlinTest.kt.181 | 240 -- .../ConfigureKotlinTest.java.181 | 379 --- .../idea/debugger/KotlinOutputChecker.kt.181 | 119 - .../AbstractKotlinFoldingTest.java.181 | 101 - .../KotlinJvmDeclarationSearcherTest.kt.181 | 0 .../multiplatform/multiPlatformSetup.kt.181 | 215 -- .../CommonIntentionActionsTest.kt.181 | 422 --- .../MoveKotlinDeclarationsHandlerTest.kt.181 | 208 -- .../idea/run/RunConfigurationTest.kt.181 | 297 -- .../test/HierarchyViewTestFixture.kt.181 | 10 - ...JavaToKotlinConverterForWebDemoTest.kt.181 | 128 - .../kotlin/jps/build/ideaPlatform.kt.181 | 13 - .../kotlin/specificJavaPsiPlaceholders.kt.181 | 15 - .../resources/META-INF/kotlin-spring.xml.181 | 53 - .../META-INF/ultimate-plugin.xml.181 | 10 - ...calModelDependenciesDiagramProvider.kt.181 | 156 - ...KotlinSpringModelDependenciesAction.kt.181 | 36 - ...odelDependenciesModuleDiagramAction.kt.181 | 25 - .../spring/el/KotlinSpringELInjector.kt.181 | 79 - ...rateKotlinAutowiredDependencyAction.kt.181 | 37 - ...ateKotlinSpringBeanDependencyAction.kt.181 | 41 - ...KotlinSpringBeanXmlDependencyAction.kt.181 | 60 - .../generateAutowiredDependenciesUtils.kt.181 | 126 - .../generate/generateDependenciesUtils.kt.181 | 513 ---- ...KotlinSpringComponentScanInspection.kt.181 | 57 - .../KotlinSpringFacetCodeInspection.kt.181 | 43 - ...ingKotlinAutowiredMembersInspection.kt.181 | 40 - ...ModelDependenciesLineMarkerProvider.kt.181 | 83 - .../kotlin/idea/spring/springUtils.kt.181 | 43 - .../inspectionData/inspections.test.181 | 2 - .../autowiring/ambiguousConstructors.kt.181 | 60 - .../inspectionData/expected.xml.181 | 97 - .../multipleAutowiredConstructors.kt.181 | 37 - .../inspectionData/expected.xml.181 | 18 - .../inspectionData/inspections.test.181 | 3 - .../inspectionData/inspections.test.181 | 3 - ...duplicatingPropertyAnnotationConfig.kt.181 | 20 - ...atingPropertyAnnotationConfig.kt.after.181 | 22 - .../duplicatingPropertyXmlConfig.kt.181 | 12 - .../duplicatingPropertyXmlConfig.kt.after.181 | 14 - .../multiplePropertiesAnnotationConfig.kt.181 | 19 - ...plePropertiesAnnotationConfig.kt.after.181 | 24 - .../multiplePropertiesXmlConfig.kt.181 | 10 - .../multiplePropertiesXmlConfig.kt.after.181 | 16 - ...opertyWithQualifierAnnotationConfig.kt.181 | 22 - ...WithQualifierAnnotationConfig.kt.after.181 | 27 - .../propertyWithQualifierXmlConfig.kt.181 | 12 - ...ropertyWithQualifierXmlConfig.kt.after.181 | 18 - .../singlePropertyAnnotationConfig.kt.181 | 19 - ...inglePropertyAnnotationConfig.kt.after.181 | 22 - .../singlePropertyXmlConfig.kt.181 | 10 - .../singlePropertyXmlConfig.kt.after.181 | 14 - .../spring-config.xml.181 | 9 - .../factoryBean-config.xml.181 | 9 - .../factoryBean-config.xml.after.181 | 11 - .../factoryBean.kt.after.181 | 13 - .../factoryBean.kt_disabled.181 | 13 - .../factoryMethod-config.xml.181 | 8 - .../factoryMethod-config.xml.after.181 | 10 - .../factoryMethod.kt.after.181 | 14 - .../factoryMethod.kt_disabled.181 | 9 - .../firstConstructor-config.xml.181 | 8 - .../firstConstructor-config.xml.after.181 | 10 - .../firstConstructor.kt.181 | 9 - .../firstConstructor.kt.after.181 | 9 - .../primaryConstructorAddParam-config.xml.181 | 11 - ...ryConstructorAddParam-config.xml.after.181 | 12 - .../primaryConstructorAddParam.kt.181 | 11 - .../primaryConstructorAddParam.kt.after.181 | 11 - .../property-config.xml.181 | 8 - .../property-config.xml.after.181 | 10 - .../beanDependenciesByXml/property.kt.181 | 9 - .../property.kt.after.181 | 10 - .../secondaryConstructor-config.xml.181 | 8 - .../secondaryConstructor-config.xml.after.181 | 8 - .../secondaryConstructor.kt.after.181 | 10 - .../secondaryConstructor.kt_disabled.181 | 9 - ...econdaryConstructorAddParam-config.xml.181 | 11 - ...ryConstructorAddParam-config.xml.after.181 | 12 - .../secondaryConstructorAddParam.kt.181 | 12 - .../secondaryConstructorAddParam.kt.after.181 | 12 - .../setter-config.xml.181 | 8 - .../setter-config.xml.after.181 | 10 - .../beanDependenciesByXml/setter.kt.181 | 9 - .../beanDependenciesByXml/setter.kt.after.181 | 10 - .../autowiredBeanCandidates/Bean.kt.181 | 17 - .../autowiredBeanCandidates.test.181 | 9 - .../autowiredBeanCandidates/config.xml.181 | 11 - .../gutter/autowiredConstructor/Bean.kt.181 | 3 - .../autowiredConstructor.test.181 | 8 - .../autowiredConstructor/config.xml.181 | 11 - .../core/gutter/autowiredProperty/Bean.kt.181 | 6 - .../autowiredProperty.test.181 | 8 - .../gutter/autowiredProperty/config.xml.181 | 11 - .../core/gutter/autowiredSetter/Bean.kt.181 | 6 - .../autowiredSetter/autowiredSetter.test.181 | 9 - .../gutter/autowiredSetter/config.xml.181 | 11 - .../core/gutter/classGutter/Bean.kt.181 | 7 - .../gutter/classGutter/classGutter.test.181 | 8 - .../core/gutter/classGutter/config.xml.181 | 6 - .../AbstractBean.kt.181 | 1 - .../AbstractBeanInheritor.kt.181 | 1 - .../AbstractBeanInheritor2.kt.181 | 1 - ...utterAbstractShowMappedInheritors.test.181 | 8 - .../inheritors.xml.181 | 8 - .../core/gutter/componentScan/Bean.kt.181 | 3 - .../gutter/componentScan/ComponentScan.kt.181 | 6 - .../componentScan/beans/MyController.kt.181 | 6 - .../componentScan/beans/ResourceGutter.kt.181 | 18 - .../componentScan/componentScan.test.181 | 8 - .../Config.kt.181 | 8 - .../bar/beans.kt.181 | 8 - ...mponentScanWithBasePackageClasses.test.181 | 8 - .../foo/beans.kt.181 | 8 - .../Config.kt.181 | 6 - .../bar/beans.kt.181 | 8 - .../componentScanWithBasePackages.test.181 | 8 - .../foo/beans.kt.181 | 8 - .../ContextBeanInjectionPoints.kt.181 | 21 - .../contextBeanInjectionPoints/FooBar.kt.181 | 5 - .../contextBeanInjectionPoints.test.181 | 8 - ...extBeanWithQualifierInjectionPoints.kt.181 | 22 - ...tBeanWithQualifierInjectionPoints.test.181 | 9 - .../pkg/FooBar.kt.181 | 5 - .../gutter/importConfigClasses/Config.kt.181 | 7 - .../importConfigClasses/bar/beans.kt.181 | 8 - .../importConfigClasses/baz/Config2.kt.181 | 10 - .../importConfigClasses/foo/beans.kt.181 | 8 - .../importConfigClasses.test.181 | 8 - .../core/gutter/innerBean/InnerBean.kt.181 | 1 - .../core/gutter/innerBean/innerBean.test.181 | 8 - .../gutter/innerBean/innerBeanGutter.xml.181 | 10 - .../methodTypeDefaultInitMethod/Bean.kt.181 | 4 - .../config.xml.181 | 7 - .../methodTypeDefaultInitMethod.test.181 | 8 - .../core/gutter/methodTypeFactory/Bean.kt.181 | 6 - .../gutter/methodTypeFactory/config.xml.181 | 6 - .../methodTypeFactory.test.181 | 9 - .../gutter/methodTypeInitMethod/Bean.kt.181 | 4 - .../methodTypeInitMethod/config.xml.181 | 6 - .../methodTypeInitMethod.test.181 | 8 - .../gutter/methodTypeMultiple/Bean.kt.181 | 4 - .../gutter/methodTypeMultiple/config.xml.181 | 6 - .../methodTypeMultiple.test.181 | 8 - .../BeanWithProperties.kt.181 | 3 - .../propertyGutter.xml.181 | 10 - .../propertyGutterForProperty.test.181 | 8 - .../BeanWithProperties.kt.181 | 3 - .../propertyGutter.xml.181 | 10 - .../propertyGutterForSetter.test.181 | 8 - .../core/gutter/resourceGutter/Bean.kt.181 | 3 - .../gutter/resourceGutter/Resource.kt.181 | 3 - .../beans/ResourceGutter.kt.181 | 13 - .../resourceGutter/resourceGutter.test.181 | 8 - .../resourceGutter/resourceGutter.xml.181 | 19 - ...tGenerateSpringDependencyActionTest.kt.181 | 77 - ...ringDependencyActionTestGenerated.java.181 | 105 - .../AbstractSpringClassAnnotatorTest.kt.181 | 105 - ...SpringClassAnnotatorTestGenerated.java.181 | 147 - .../tests/gutter/springGutterTestUtils.kt.181 | 80 - .../kotlin/tests/GenerateUltimateTests.kt.181 | 70 - 249 files changed, 13329 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/instrument.kt.181 delete mode 100644 compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LegacyInlineSuspendUtil.kt.181 delete mode 100644 compiler/compiler.pro.181 delete mode 100644 compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt.181 delete mode 100644 compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsSmokeTest.kt.181 delete mode 100644 compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveWithSessionTestCase.kt.181 delete mode 100644 compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt.181 delete mode 100644 compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragmentBase.kt.181 delete mode 100644 compiler/psi/src/org/jetbrains/kotlin/psi/KtConstructor.kt.181 delete mode 100644 compiler/psi/src/org/jetbrains/kotlin/psi/KtObjectDeclaration.kt.181 delete mode 100644 compiler/psi/src/org/jetbrains/kotlin/util/AstLoadingUtil.kt.181 delete mode 100644 gradle/versions.properties.181 delete mode 100644 idea/ide-common/src/org/jetbrains/kotlin/compatibility/ExecutorProcessor.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/BaseKotlinCompilerSettings.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JsCompilerArgumentsHolder.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JvmCompilerArgumentsHolder.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCommonCompilerArgumentsHolder.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerSettings.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/ErrorIconUtil.java.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/OutsidersPsiFileSupportWrapper.kt.181 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/compat/psiSearchHelper.kt.181 delete mode 100644 idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.181 delete mode 100644 idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.181 delete mode 100644 idea/idea-android/tests/org/jetbrains/kotlin/android/AndroidTestCase.java.181 delete mode 100644 idea/idea-android/tests/org/jetbrains/kotlin/android/TestUtils.java.181 delete mode 100644 idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.181 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java.181 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.181 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.181 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/baseDecompiler.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JsIdePlatformKindTooling.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/jvmMppUtils.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/multiplatform/KotlinMultiplatformRunLocationsProvider.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/KtScratchFileCreationHelper.kt.181 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/scratchRunnerUtil.kt.181 delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.181 delete mode 100644 idea/kotlin-gradle-tooling/build.gradle.kts.181 delete mode 100644 idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 delete mode 100644 idea/resources/META-INF/git4idea.xml.181 delete mode 100644 idea/resources/META-INF/gradle-java.xml.181 delete mode 100644 idea/resources/META-INF/gradle.xml.181 delete mode 100644 idea/resources/META-INF/jvm.xml.181 delete mode 100644 idea/resources/META-INF/plugin.xml.181 delete mode 100644 idea/resources/org/jetbrains/kotlin/idea/icons/kotlin_gradle_script.png.181 delete mode 100644 idea/resources/org/jetbrains/kotlin/idea/icons/kotlin_gradle_script@2x.png.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/inspections/QuickFixFactoryCompatibility.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/js/jsUtils.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/jvm/KotlinDeclarationSearcher.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinAddOrderEntryActionFactory.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinRenameDispatcherHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinVariableInplaceRenameHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameBackingFieldReferenceHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameDynamicMemberHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinImplicitLambdaParameter.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameOnSecondaryConstructorHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameSyntheticDeclarationByReferenceHandler.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/util/PopupChooserBuilderWrapper.kt.181 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/util/compat/Nullability.kt.181 delete mode 100644 idea/testData/android/lint/javaPerformance.kt.181 delete mode 100644 idea/testData/codeInsight/postfix/valAtLambaArgumentInCall.kt.after.181 delete mode 100644 idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunLiteral.out.181 delete mode 100644 idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunctionalExpression.out.181 delete mode 100644 idea/testData/editor/quickDoc/JavaClassUsedInKotlin.kt.181 delete mode 100644 idea/testData/editor/quickDoc/JavaDocFromOverridenClass.kt.181 delete mode 100644 idea/testData/editor/quickDoc/JavaDocFromOverridenInterface.kt.181 delete mode 100644 idea/testData/editor/quickDoc/JavaMethodUsedInKotlin.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnEnumValueOfFunction.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnFunctionDeclarationWithPackage.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsage.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithBracketsInParam.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithMultilineParam.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithReceiver.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndThrows.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithSee.kt.181 delete mode 100644 idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt.181 delete mode 100644 idea/testData/editor/quickDoc/Samples.kt.181 delete mode 100644 idea/testData/kdoc/multiModuleSamples/fqName/code/usage.kt.181 delete mode 100644 idea/testData/kdoc/multiModuleSamples/simple/code/usage.kt.181 delete mode 100644 idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.java.181 delete mode 100644 idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.181 delete mode 100644 idea/testData/quickfix/typeMismatch/paramTypeLambdaMismatch.kt.181 delete mode 100644 idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.181 delete mode 100644 idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinOutputChecker.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/run/RunConfigurationTest.kt.181 delete mode 100644 idea/tests/org/jetbrains/kotlin/test/HierarchyViewTestFixture.kt.181 delete mode 100644 j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.181 delete mode 100644 jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.181 delete mode 100644 plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/specificJavaPsiPlaceholders.kt.181 delete mode 100644 ultimate/resources/META-INF/kotlin-spring.xml.181 delete mode 100644 ultimate/resources/META-INF/ultimate-plugin.xml.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/KotlinSpringLocalModelDependenciesDiagramProvider.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesAction.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesModuleDiagramAction.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/el/KotlinSpringELInjector.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinAutowiredDependencyAction.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanDependencyAction.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanXmlDependencyAction.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateAutowiredDependenciesUtils.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateDependenciesUtils.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringComponentScanInspection.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringFacetCodeInspection.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/SpringKotlinAutowiredMembersInspection.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/lineMarking/KotlinSpringModelDependenciesLineMarkerProvider.kt.181 delete mode 100644 ultimate/src/org/jetbrains/kotlin/idea/spring/springUtils.kt.181 delete mode 100644 ultimate/testData/inspections/spring/autowiredMembersInInvalidClass/inspectionData/inspections.test.181 delete mode 100644 ultimate/testData/inspections/spring/autowiring/ambiguousConstructors.kt.181 delete mode 100644 ultimate/testData/inspections/spring/autowiring/inspectionData/expected.xml.181 delete mode 100644 ultimate/testData/inspections/spring/autowiring/multipleAutowiredConstructors.kt.181 delete mode 100644 ultimate/testData/inspections/spring/componentScan/inspectionData/expected.xml.181 delete mode 100644 ultimate/testData/inspections/spring/componentScan/inspectionData/inspections.test.181 delete mode 100644 ultimate/testData/inspections/spring/unconfiguredFacet/inspectionData/inspections.test.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/autowiredDependencies/spring-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt_disabled.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt_disabled.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt_disabled.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.after.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.181 delete mode 100644 ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.after.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredBeanCandidates/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredBeanCandidates/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredConstructor/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredConstructor/autowiredConstructor.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredConstructor/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredProperty/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredProperty/autowiredProperty.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredProperty/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredSetter/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredSetter/autowiredSetter.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/autowiredSetter/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutter/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutter/classGutter.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutter/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor2.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/inheritors.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScan/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScan/ComponentScan.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScan/beans/MyController.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScan/beans/ResourceGutter.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScan/componentScan.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/Config.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/bar/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/foo/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackages/Config.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackages/bar/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackages/componentScanWithBasePackages.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/componentScanWithBasePackages/foo/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/ContextBeanInjectionPoints.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/FooBar.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/contextBeanInjectionPoints.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/ContextBeanWithQualifierInjectionPoints.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/pkg/FooBar.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/importConfigClasses/Config.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/importConfigClasses/bar/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/importConfigClasses/baz/Config2.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/importConfigClasses/foo/beans.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/importConfigClasses/importConfigClasses.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/innerBean/InnerBean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/innerBean/innerBean.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/innerBean/innerBeanGutter.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeFactory/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeFactory/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeFactory/methodTypeFactory.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeInitMethod/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeInitMethod/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeInitMethod/methodTypeInitMethod.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeMultiple/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeMultiple/config.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/methodTypeMultiple/methodTypeMultiple.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForProperty/BeanWithProperties.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutter.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutterForProperty.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForSetter/BeanWithProperties.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutter.xml.181 delete mode 100644 ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutterForSetter.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/resourceGutter/Bean.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/resourceGutter/Resource.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/resourceGutter/beans/ResourceGutter.kt.181 delete mode 100644 ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.test.181 delete mode 100644 ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.xml.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/AbstractGenerateSpringDependencyActionTest.kt.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/GenerateSpringDependencyActionTestGenerated.java.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/AbstractSpringClassAnnotatorTest.kt.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/SpringClassAnnotatorTestGenerated.java.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/springGutterTestUtils.kt.181 delete mode 100644 ultimate/tests/org/jetbrains/kotlin/tests/GenerateUltimateTests.kt.181 diff --git a/buildSrc/src/main/kotlin/instrument.kt.181 b/buildSrc/src/main/kotlin/instrument.kt.181 deleted file mode 100644 index 6af034f266f..00000000000 --- a/buildSrc/src/main/kotlin/instrument.kt.181 +++ /dev/null @@ -1,195 +0,0 @@ -@file:Suppress("unused") - -/* - * 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. - */ - -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.ProjectDependency -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.FileCollection -import org.gradle.api.internal.ConventionTask -import org.gradle.api.plugins.ExtensionAware -import org.gradle.api.tasks.* -import org.gradle.api.tasks.compile.AbstractCompile -import org.gradle.kotlin.dsl.* -import java.io.File - -fun Project.configureFormInstrumentation() { - plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all { - // When we change the output classes directory, Gradle will automatically configure - // the test compile tasks to use the instrumented classes. Normally this is fine, - // however, it causes problems for Kotlin projects: - - // The "internal" modifier can be used to restrict access to the same module. - // To make it possible to use internal methods from the main source set in test classes, - // the Kotlin Gradle plugin adds the original output directory of the Java task - // as "friendly directory" which makes it possible to access internal members - // of the main module. Also this directory should be available on classpath during compilation - - // This fails when we change the classes dir. The easiest fix is to prepend the - // classes from the "friendly directory" to the compile classpath. - val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile? - testCompile?.doFirst { - testCompile.classpath = (testCompile.classpath - - mainSourceSet.output.classesDirs - + files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))) - } - } - - val instrumentationClasspathCfg = configurations.create("instrumentationClasspath") - - dependencies { - instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms", rootProject = rootProject) } - } - - afterEvaluate { - sourceSets.all { sourceSetParam -> - // This copy will ignore filters, but they are unlikely to be used. - val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection - - val classesDirsCopy = project.files(classesDirs.toTypedArray()).filter { it.exists() } - (sourceSetParam as ExtensionAware).extra.set("classesDirsCopy", classesDirsCopy) - - logger.info("Saving old sources dir for project ${project.name}") - val instrumentedClassesDir = File(project.buildDir, "classes/${sourceSetParam.name}-instrumented") - (sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir) - val instrumentTask = - project.tasks.create(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) - instrumentTask.apply { - dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty } - sourceSet = sourceSetParam - instrumentationClasspath = instrumentationClasspathCfg - originalClassesDirs = classesDirsCopy - output = instrumentedClassesDir - } - - instrumentTask.outputs.dir(instrumentedClassesDir) - // Ensure that our task is invoked when the source set is built - sourceSetParam.compiledBy(instrumentTask) - @Suppress("UNUSED_EXPRESSION") - true - } - } -} - -@CacheableTask -open class IntelliJInstrumentCodeTask : ConventionTask() { - companion object { - private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp" - private const val LOADER_REF = "java2.loader" - } - - var sourceSet: SourceSet? = null - - var instrumentationClasspath: Configuration? = null - - @Input - var originalClassesDirs: FileCollection? = null - - @get:Input - var instrumentNotNull: Boolean = false - - @get:InputFiles - val sourceDirs: FileCollection - get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() }) - - @get:OutputDirectory - lateinit var output: File - - @TaskAction - fun instrumentClasses() { - logger.info( - "input files are: ${originalClassesDirs?.joinToString( - "; ", - transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}" - ) - output.deleteRecursively() - copyOriginalClasses() - - val classpath = instrumentationClasspath!! - - ant.withGroovyBuilder { - "taskdef"( - "name" to "instrumentIdeaExtensions", - "classpath" to classpath.asPath, - "loaderref" to LOADER_REF, - "classname" to "com.intellij.ant.InstrumentIdeaExtensions" - ) - } - - logger.info("Compiling forms and instrumenting code with nullability preconditions") - if (instrumentNotNull) { - prepareNotNullInstrumenting(classpath.asPath) - } - - instrumentCode(sourceDirs, instrumentNotNull) - } - - private fun copyOriginalClasses() { - project.copy { - from(originalClassesDirs) - into(output) - } - } - - private fun prepareNotNullInstrumenting(classpath: String) { - ant.withGroovyBuilder { - "typedef"( - "name" to "skip", - "classpath" to classpath, - "loaderref" to LOADER_REF, - "classname" to FILTER_ANNOTATION_REGEXP_CLASS - ) - } - } - - private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) { - val headlessOldValue = System.setProperty("java.awt.headless", "true") - - // Instrumentation needs to have access to sources of forms for inclusion - val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java) - .map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories } - val instrumentationClasspath = - depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also { - logger.info("Using following dependency source dirs: $it") - } - - logger.info("Running instrumentIdeaExtensions with srcdir=${srcDirs.asPath}}, destdir=$output and classpath=$instrumentationClasspath") - - ant.withGroovyBuilder { - "instrumentIdeaExtensions"( - "srcdir" to srcDirs.asPath, - "destdir" to output, - "classpath" to instrumentationClasspath, - "includeantruntime" to false, - "instrumentNotNull" to instrumentNotNull - ) { - if (instrumentNotNull) { - ant.withGroovyBuilder { - "skip"("pattern" to "kotlin/Metadata") - } - } - } - } - - if (headlessOldValue != null) { - System.setProperty("java.awt.headless", headlessOldValue) - } else { - System.clearProperty("java.awt.headless") - } - } -} \ No newline at end of file diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LegacyInlineSuspendUtil.kt.181 b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LegacyInlineSuspendUtil.kt.181 deleted file mode 100644 index 1fd3c25d74c..00000000000 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/LegacyInlineSuspendUtil.kt.181 +++ /dev/null @@ -1,54 +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.codegen.inline - -import jdk.internal.org.objectweb.asm.Opcodes -import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor -import org.jetbrains.kotlin.descriptors.FunctionDescriptor -import org.jetbrains.kotlin.load.kotlin.getContainingKotlinJvmBinaryClass -import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter -import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode -import org.jetbrains.org.objectweb.asm.tree.MethodNode - -// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper -// before/after suspension point marks, so we detect those functions here and insert the corresponding marks - -fun insertLegacySuspendInlineMarks(node: MethodNode) { - with (node.instructions) { - // look for return instruction before the end and insert "afterSuspendMarker" there - insertBefore(findLastReturn(last) ?: return, produceSuspendMarker(false).instructions) - // insert "beforeSuspendMarker" at the beginning - insertBefore(first, produceSuspendMarker(true).instructions) - } - node.maxStack = node.maxStack.coerceAtLeast(2) // min stack need for suspend marker before return -} - -fun findLastReturn(node: AbstractInsnNode?): AbstractInsnNode? { - var cur = node - while (cur != null && cur.opcode != Opcodes.ARETURN) cur = cur.previous - return cur -} - -private fun produceSuspendMarker(isStartNotEnd: Boolean): MethodNode = - MethodNode().also { addSuspendMarker(InstructionAdapter(it), isStartNotEnd) } - -fun isLegacySuspendInlineFunction(descriptor: CallableMemberDescriptor): Boolean { - if (descriptor !is FunctionDescriptor) return false - if (!descriptor.isSuspend || !descriptor.isInline) return false - val jvmBytecodeVersion = descriptor.getContainingKotlinJvmBinaryClass()?.classHeader?.bytecodeVersion ?: return false - return !jvmBytecodeVersion.isAtLeast(1, 0, 2) -} diff --git a/compiler/compiler.pro.181 b/compiler/compiler.pro.181 deleted file mode 100644 index eeca2ef8bf0..00000000000 --- a/compiler/compiler.pro.181 +++ /dev/null @@ -1,237 +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 - -# Annotations from intellijCore/annotations.jar that not presented in org.jetbrains.annotations --dontwarn org.jetbrains.annotations.Async* --dontwarn org.jetbrains.annotations.Nls$Capitalization - -# Depends on apache batik which has lots of dependencies --dontwarn com.intellij.util.SVGLoader* - -# The appropriate jar is either loaded separately or added explicitly to the classpath then needed --dontwarn org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar - -#-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(...); } - -# 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 { *; } diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt.181 b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt.181 deleted file mode 100644 index 14771074a6f..00000000000 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/AbstractFir2IrTextTest.kt.181 +++ /dev/null @@ -1,89 +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.fir - -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElementFinder -import com.intellij.psi.search.GlobalSearchScope -import junit.framework.TestCase -import org.jetbrains.kotlin.asJava.finder.JavaElementFinder -import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM -import org.jetbrains.kotlin.config.languageVersionSettings -import org.jetbrains.kotlin.fir.backend.Fir2IrConverter -import org.jetbrains.kotlin.fir.builder.RawFirBuilder -import org.jetbrains.kotlin.fir.resolve.FirProvider -import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl -import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer -import org.jetbrains.kotlin.ir.AbstractIrTextTestCase -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import java.io.File - -abstract class AbstractFir2IrTextTest : AbstractIrTextTestCase() { - - private fun prepareProjectExtensions(project: Project) { - } - - override fun doTest(filePath: String?) { - if (filePath != null) { - val originalTextPath = filePath.replace(".kt", ".txt") - val firTextPath = filePath.replace(".kt", ".fir.txt") - val originalText = File(originalTextPath) - val firText = File(firTextPath) - if (originalText.exists() && firText.exists()) { - val originalLines = originalText.readLines() - val firLines = firText.readLines() - TestCase.assertFalse( - "Dumps via FIR & via old FE are the same. Please delete .fir.txt dump and add // FIR_IDENTICAL to test source", - firLines.withIndex().all { (index, line) -> - val trimmed = line.trim() - val originalTrimmed = originalLines.getOrNull(index)?.trim() - trimmed.isEmpty() && originalTrimmed?.isEmpty() != false || trimmed == originalTrimmed - } && originalLines.withIndex().all { (index, line) -> - index < firLines.size || line.trim().isEmpty() - } - ) - } - } - super.doTest(filePath) - } - - override fun getExpectedTextFileName(testFile: TestFile, name: String): String { - // NB: replace with if (true) to make test against old FE results - if ("// FIR_IDENTICAL" in testFile.content.split("\n")) { - return super.getExpectedTextFileName(testFile, name) - } - return name.replace(".txt", ".fir.txt").replace(".kt", ".fir.txt") - } - - override fun generateIrModule(ignoreErrors: Boolean): IrModuleFragment { - val psiFiles = myFiles.psiFiles - - val project = psiFiles.first().project - prepareProjectExtensions(project) - - val scope = GlobalSearchScope.filesScope(project, psiFiles.map { it.virtualFile }) - .uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project)) - val session = createSession(myEnvironment, scope) - - val builder = RawFirBuilder(session, stubMode = false) - - val resolveTransformer = FirTotalResolveTransformer() - val firFiles = psiFiles.map { - val firFile = builder.buildFirFile(it) - (session.service() as FirProviderImpl).recordFile(firFile) - firFile - }.also { - try { - resolveTransformer.processFiles(it) - } catch (e: Exception) { - throw e - } - } - - return Fir2IrConverter.createModuleFragment(session, firFiles, myEnvironment.configuration.languageVersionSettings) - } -} \ No newline at end of file diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsSmokeTest.kt.181 b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsSmokeTest.kt.181 deleted file mode 100644 index faf850cb352..00000000000 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticsSmokeTest.kt.181 +++ /dev/null @@ -1,159 +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.fir - -import com.intellij.openapi.extensions.Extensions -import com.intellij.psi.PsiElementFinder -import com.intellij.psi.search.GlobalSearchScope -import org.jetbrains.kotlin.analyzer.ModuleInfo -import org.jetbrains.kotlin.asJava.finder.JavaElementFinder -import org.jetbrains.kotlin.checkers.BaseDiagnosticsTest -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM -import org.jetbrains.kotlin.fir.builder.RawFirBuilder -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession -import org.jetbrains.kotlin.fir.java.FirLibrarySession -import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider -import org.jetbrains.kotlin.fir.resolve.FirProvider -import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl -import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.MultiTargetPlatform -import org.jetbrains.kotlin.resolve.TargetPlatform -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform -import java.io.File -import java.util.* - -abstract class AbstractFirDiagnosticsSmokeTest : BaseDiagnosticsTest() { - override fun analyzeAndCheck(testDataFile: File, files: List) { - try { - analyzeAndCheckUnhandled(files) - } catch (t: AssertionError) { - throw t - } catch (t: Throwable) { - throw t - } - } - - private fun analyzeAndCheckUnhandled(files: List) { - - val groupedByModule = files.groupBy(TestFile::module) - - val modules = createModules(groupedByModule) - - val sessionProvider = FirProjectSessionProvider(project) - - //For BuiltIns, registered in sessionProvider automatically - val allProjectScope = GlobalSearchScope.allScope(project) - FirLibrarySession.create( - builtInsModuleInfo, sessionProvider, allProjectScope, - environment - ) - - val configToSession = modules.mapValues { (config, info) -> - val moduleFiles = groupedByModule.getValue(config) - val scope = TopDownAnalyzerFacadeForJVM.newModuleSearchScope(project, moduleFiles.mapNotNull { it.ktFile }) - FirJavaModuleBasedSession(info, sessionProvider, scope) - } - - val firFiles = mutableListOf() - - for ((testModule, testFilesInModule) in groupedByModule) { - val ktFiles = getKtFiles(testFilesInModule, true) - - val session = configToSession.getValue(testModule) - - - val firBuilder = RawFirBuilder(session, false) - - ktFiles.mapTo(firFiles) { - val firFile = firBuilder.buildFirFile(it) - - (session.service() as FirProviderImpl).recordFile(firFile) - - firFile - } - } - - doFirResolveTestBench(firFiles, FirTotalResolveTransformer().transformers, gc = false) - - } - - - private fun createModules( - groupedByModule: Map> - ): MutableMap { - val modules = HashMap() - - for (testModule in groupedByModule.keys) { - val module = if (testModule == null) - createSealedModule() - else - createModule(testModule.name) - - modules[testModule] = module - } - - for (testModule in groupedByModule.keys) { - if (testModule == null) continue - - val module = modules[testModule]!! - val dependencies = ArrayList() - dependencies.add(module) - for (dependency in testModule.getDependencies()) { - dependencies.add(modules[dependency]!!) - } - - - dependencies.add(builtInsModuleInfo) - //dependencies.addAll(getAdditionalDependencies(module)) - (module as TestModuleInfo).dependencies.addAll(dependencies) - } - - return modules - } - - private val builtInsModuleInfo = BuiltInModuleInfo(Name.special("")) - - protected open fun createModule(moduleName: String): TestModuleInfo { - val nameSuffix = moduleName.substringAfterLast("-", "") - // TODO: use platform - @Suppress("UNUSED_VARIABLE") - val platform = - when { - nameSuffix.isEmpty() -> null - nameSuffix == "common" -> MultiTargetPlatform.Common - else -> MultiTargetPlatform.Specific(nameSuffix.toUpperCase()) - } - return TestModuleInfo(Name.special("<$moduleName>")) - } - - class BuiltInModuleInfo(override val name: Name) : ModuleInfo { - override val platform: TargetPlatform? - get() = JvmPlatform - - override fun dependencies(): List { - return listOf(this) - } - } - - protected class TestModuleInfo(override val name: Name) : ModuleInfo { - override val platform: TargetPlatform? - get() = JvmPlatform - - val dependencies = mutableListOf(this) - override fun dependencies(): List { - return dependencies - } - } - - protected open fun createSealedModule(): TestModuleInfo = - createModule("test-module").apply { - dependencies += builtInsModuleInfo - } - -} diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveWithSessionTestCase.kt.181 b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveWithSessionTestCase.kt.181 deleted file mode 100644 index 31bad68e9cf..00000000000 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/AbstractFirResolveWithSessionTestCase.kt.181 +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2010-2018 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.fir - -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElementFinder -import com.intellij.psi.search.GlobalSearchScope -import org.jetbrains.kotlin.asJava.finder.JavaElementFinder -import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession -import org.jetbrains.kotlin.fir.java.FirLibrarySession -import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider -import org.jetbrains.kotlin.test.KotlinTestWithEnvironment - -abstract class AbstractFirResolveWithSessionTestCase : KotlinTestWithEnvironment() { - - override fun setUp() { - super.setUp() - - prepareProjectExtensions(project) - } - - protected fun prepareProjectExtensions(project: Project) { - // No relevant API in 181 - // Extensions.getArea(project) - // .getExtensionPoint(PsiElementFinder.EP_NAME) - // .unregisterExtension(JavaElementFinder::class.java) - } -} diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt.181 b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt.181 deleted file mode 100644 index 891e38d8610..00000000000 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/java/AbstractFirTypeEnhancementTest.kt.181 +++ /dev/null @@ -1,235 +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.fir.java - -import com.intellij.lang.java.JavaLanguage -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.util.text.StringUtilRt -import com.intellij.psi.* -import com.intellij.psi.impl.PsiFileFactoryImpl -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.testFramework.LightVirtualFile -import org.jetbrains.kotlin.asJava.finder.JavaElementFinder -import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles -import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.fir.FirRenderer -import org.jetbrains.kotlin.fir.createSession -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass -import org.jetbrains.kotlin.fir.java.declarations.FirJavaConstructor -import org.jetbrains.kotlin.fir.java.declarations.FirJavaField -import org.jetbrains.kotlin.fir.java.declarations.FirJavaMethod -import org.jetbrains.kotlin.fir.java.scopes.JavaClassEnhancementScope -import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider -import org.jetbrains.kotlin.fir.resolve.impl.FirCompositeSymbolProvider -import org.jetbrains.kotlin.fir.scopes.ProcessorAction -import org.jetbrains.kotlin.fir.scopes.impl.FirCompositeScope -import org.jetbrains.kotlin.fir.service -import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType -import org.jetbrains.kotlin.test.* -import org.jetbrains.kotlin.test.KotlinTestUtils.getAnnotationsJar -import org.jetbrains.kotlin.test.KotlinTestUtils.newConfiguration -import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase -import java.io.File -import java.io.IOException - -abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() { - private lateinit var javaFilesDir: File - - private lateinit var environment: KotlinCoreEnvironment - - val project: Project - get() { - return environment.project - } - - @Throws(Exception::class) - override fun setUp() { - super.setUp() - javaFilesDir = KotlinTestUtils.tmpDirForTest(this) - } - - override fun tearDown() { - FileUtil.delete(javaFilesDir) - super.tearDown() - } - - private fun createJarWithForeignAnnotations(): File = - MockLibraryUtil.compileJavaFilesLibraryToJar(FOREIGN_ANNOTATIONS_SOURCES_PATH, "foreign-annotations") - - private fun createEnvironment(content: String): KotlinCoreEnvironment { - val classpath = mutableListOf(getAnnotationsJar(), ForTestCompileRuntime.runtimeJarForTests()) - if (InTextDirectivesUtils.isDirectiveDefined(content, "ANDROID_ANNOTATIONS")) { - classpath.add(ForTestCompileRuntime.androidAnnotationsForTests()) - } - if (InTextDirectivesUtils.isDirectiveDefined(content, "JVM_ANNOTATIONS")) { - classpath.add(ForTestCompileRuntime.jvmAnnotationsForTests()) - } - if (InTextDirectivesUtils.isDirectiveDefined(content, "FOREIGN_ANNOTATIONS")) { - classpath.add(createJarWithForeignAnnotations()) - } - return KotlinCoreEnvironment.createForTests( - testRootDisposable, - newConfiguration( - ConfigurationKind.JDK_NO_RUNTIME, TestJdkKind.FULL_JDK, classpath, listOf(javaFilesDir) - ), - EnvironmentConfigFiles.JVM_CONFIG_FILES - ) - } - - fun doTest(path: String) { - val javaFile = File(path) - val javaLines = javaFile.readLines() - val content = javaLines.joinToString(separator = "\n") - if (InTextDirectivesUtils.isDirectiveDefined(content, "SKIP_IN_FIR_TEST")) return - - val srcFiles = KotlinTestUtils.createTestFiles( - javaFile.name, FileUtil.loadFile(javaFile, true), - object : KotlinTestUtils.TestFileFactoryNoModules() { - override fun create(fileName: String, text: String, directives: Map): File { - var currentDir = javaFilesDir - if ("/" !in fileName) { - val packageFqName = - text.split("\n").firstOrNull { - it.startsWith("package") - }?.substringAfter("package")?.trim()?.substringBefore(";")?.let { name -> - FqName(name) - } ?: FqName.ROOT - for (segment in packageFqName.pathSegments()) { - currentDir = File(currentDir, segment.asString()).apply { mkdir() } - } - } - val targetFile = File(currentDir, fileName) - try { - FileUtil.writeToFile(targetFile, text) - } catch (e: IOException) { - throw AssertionError(e) - } - - return targetFile - } - }, "" - ) - environment = createEnvironment(content) - val virtualFiles = srcFiles.map { - object : LightVirtualFile( - it.name, JavaLanguage.INSTANCE, StringUtilRt.convertLineSeparators(it.readText()) - ) { - override fun getPath(): String { - //TODO: patch LightVirtualFile - return "/${it.name}" - } - } - } - val factory = PsiFileFactory.getInstance(project) as PsiFileFactoryImpl - val psiFiles = virtualFiles.map { factory.trySetupPsiForFile(it, JavaLanguage.INSTANCE, true, false)!! } - - val scope = GlobalSearchScope.filesScope(project, virtualFiles) - .uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project)) - val session = createSession(environment, scope) - - val topPsiClasses = psiFiles.flatMap { it.getChildrenOfType().toList() } - - val javaFirDump = StringBuilder().also { builder -> - val renderer = FirRenderer(builder) - val symbolProvider = session.service() as FirCompositeSymbolProvider - val javaProvider = symbolProvider.providers.filterIsInstance().first() - - fun processClassWithChildren(psiClass: PsiClass, parentFqName: FqName) { - val psiFile = psiClass.containingFile - val packageStatement = psiFile.children.filterIsInstance().firstOrNull() - val packageName = packageStatement?.packageName - val fqName = parentFqName.child(Name.identifier(psiClass.name!!)) - val classId = ClassId(packageName?.let { FqName(it) } ?: FqName.ROOT, fqName, false) - javaProvider.getClassLikeSymbolByFqName(classId) - ?: throw AssertionError(classId.asString()) - psiClass.innerClasses.forEach { - processClassWithChildren(psiClass = it, parentFqName = fqName) - } - } - for (psiClass in topPsiClasses) { - processClassWithChildren(psiClass, FqName.ROOT) - } - - val processedJavaClasses = mutableSetOf() - for (javaClass in javaProvider.getJavaTopLevelClasses().sortedBy { it.name }) { - if (javaClass !is FirJavaClass || javaClass in processedJavaClasses) continue - val enhancementScope = javaClass.buildClassSpecificUseSiteScope(session).let { - when (it) { - is FirCompositeScope -> it.scopes.filterIsInstance().first() - is JavaClassEnhancementScope -> it - else -> null - } - } - if (enhancementScope == null) { - javaClass.accept(renderer, null) - } else { - renderer.visitMemberDeclaration(javaClass) - renderer.renderSupertypes(javaClass) - renderer.renderInBraces { - val renderedDeclarations = mutableListOf() - for (declaration in javaClass.declarations) { - if (declaration in renderedDeclarations) continue - when (declaration) { - is FirJavaConstructor -> enhancementScope.processFunctionsByName(javaClass.name) { symbol -> - val enhanced = (symbol as? FirFunctionSymbol)?.fir - if (enhanced != null && enhanced !in renderedDeclarations) { - enhanced.accept(renderer, null) - renderer.newLine() - renderedDeclarations += enhanced - } - ProcessorAction.NEXT - } - is FirJavaMethod -> enhancementScope.processFunctionsByName(declaration.name) { symbol -> - val enhanced = (symbol as? FirFunctionSymbol)?.fir - if (enhanced != null && enhanced !in renderedDeclarations) { - enhanced.accept(renderer, null) - renderer.newLine() - renderedDeclarations += enhanced - } - ProcessorAction.NEXT - } - is FirJavaField -> enhancementScope.processPropertiesByName(declaration.name) { symbol -> - val enhanced = (symbol as? FirPropertySymbol)?.fir - if (enhanced != null && enhanced !in renderedDeclarations) { - enhanced.accept(renderer, null) - renderer.newLine() - renderedDeclarations += enhanced - } - ProcessorAction.NEXT - } - else -> { - declaration.accept(renderer, null) - renderer.newLine() - renderedDeclarations += declaration - } - } - } - } - } - processedJavaClasses += javaClass - } - }.toString() - - val expectedFile = File(javaFile.absolutePath.replace(".java", ".fir.txt")) - KotlinTestUtils.assertEqualsToFile(expectedFile, javaFirDump) - } - - companion object { - private const val FOREIGN_ANNOTATIONS_SOURCES_PATH = "third-party/annotations" - } -} - -abstract class AbstractOwnFirTypeEnhancementTest : AbstractFirTypeEnhancementTest() diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragmentBase.kt.181 b/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragmentBase.kt.181 deleted file mode 100644 index b1f5c98fd8c..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtCodeFragmentBase.kt.181 +++ /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.psi - -import com.intellij.psi.JavaCodeFragment -import com.intellij.psi.PsiClass - -interface KtCodeFragmentBase : JavaCodeFragment { - override fun importClass(aClass: PsiClass?): Boolean { - return true - } -} \ No newline at end of file diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtConstructor.kt.181 b/compiler/psi/src/org/jetbrains/kotlin/psi/KtConstructor.kt.181 deleted file mode 100644 index b25faf11ea6..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtConstructor.kt.181 +++ /dev/null @@ -1,96 +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.psi - -import com.intellij.lang.ASTNode -import com.intellij.navigation.ItemPresentationProviders -import com.intellij.psi.PsiElement -import com.intellij.psi.search.SearchScope -import com.intellij.util.IncorrectOperationException -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub -import org.jetbrains.kotlin.psi.stubs.elements.KtPlaceHolderStubElementType -import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes - -abstract class KtConstructor> : KtDeclarationStub>, KtFunction { - protected constructor(node: ASTNode) : super(node) - protected constructor(stub: KotlinPlaceHolderStub, nodeType: KtPlaceHolderStubElementType) : super(stub, nodeType) - - abstract fun getContainingClassOrObject(): KtClassOrObject - - override fun isLocal() = false - - override fun getValueParameterList() = getStubOrPsiChild(KtStubElementTypes.VALUE_PARAMETER_LIST) - - override fun getValueParameters() = valueParameterList?.parameters ?: emptyList() - - override fun getReceiverTypeReference() = null - - override fun getTypeReference() = null - - @Throws(IncorrectOperationException::class) - override fun setTypeReference(typeRef: KtTypeReference?) = throw IncorrectOperationException("setTypeReference to constructor") - - override fun getColon() = findChildByType(KtTokens.COLON) - - override fun getBodyExpression(): KtBlockExpression? = null - - override fun getEqualsToken() = null - - override fun hasBlockBody() = bodyExpression != null - - override fun hasBody() = bodyExpression != null - - override fun hasDeclaredReturnType() = false - - override fun getTypeParameterList() = null - - override fun getTypeConstraintList() = null - - override fun getTypeConstraints() = emptyList() - - override fun getTypeParameters() = emptyList() - - override fun getName(): String? = getContainingClassOrObject().name - - override fun getNameAsSafeName() = KtPsiUtil.safeName(name) - - override fun getFqName() = null - - override fun getNameAsName() = nameAsSafeName - - override fun getNameIdentifier() = null - - @Throws(IncorrectOperationException::class) - override fun setName(name: String): PsiElement = throw IncorrectOperationException("setName to constructor") - - override fun getPresentation() = ItemPresentationProviders.getItemPresentation(this) - - open fun getConstructorKeyword(): PsiElement? = findChildByType(KtTokens.CONSTRUCTOR_KEYWORD) - - fun hasConstructorKeyword(): Boolean = stub != null || getConstructorKeyword() != null - - override fun getTextOffset(): Int { - return getConstructorKeyword()?.textOffset - ?: valueParameterList?.textOffset - ?: super.getTextOffset() - } - - override fun getUseScope(): SearchScope { - return getContainingClassOrObject().useScope - } -} diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtObjectDeclaration.kt.181 b/compiler/psi/src/org/jetbrains/kotlin/psi/KtObjectDeclaration.kt.181 deleted file mode 100644 index 66e7bba9096..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtObjectDeclaration.kt.181 +++ /dev/null @@ -1,71 +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.psi - -import com.intellij.lang.ASTNode -import com.intellij.psi.PsiElement -import org.jetbrains.annotations.NonNls -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.name.SpecialNames -import org.jetbrains.kotlin.psi.stubs.KotlinObjectStub -import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes - -class KtObjectDeclaration : KtClassOrObject { - constructor(node: ASTNode) : super(node) - constructor(stub: KotlinObjectStub) : super(stub, KtStubElementTypes.OBJECT_DECLARATION) - - private val _stub: KotlinObjectStub? - get() = stub as? KotlinObjectStub - - override fun getName(): String? { - super.getName()?.let { return it } - - if (isCompanion() && !isTopLevel()) { - //NOTE: a hack in PSI that simplifies writing frontend code - return SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT.toString() - } - - return null - } - - override fun setName(@NonNls name: String): PsiElement { - return if (nameIdentifier == null) { - val psiFactory = KtPsiFactory(project) - val result = addAfter(psiFactory.createIdentifier(name), getObjectKeyword()!!) - addAfter(psiFactory.createWhiteSpace(), getObjectKeyword()!!) - - result - } else { - super.setName(name) - } - } - - fun isCompanion(): Boolean = _stub?.isCompanion() ?: hasModifier(KtTokens.COMPANION_KEYWORD) - - override fun getTextOffset(): Int = nameIdentifier?.textRange?.startOffset - ?: getObjectKeyword()!!.textRange.startOffset - - override fun accept(visitor: KtVisitor, data: D): R { - return visitor.visitObjectDeclaration(this, data) - } - - fun isObjectLiteral(): Boolean = _stub?.isObjectLiteral() ?: (parent is KtObjectLiteralExpression) - - fun getObjectKeyword(): PsiElement? = findChildByType(KtTokens.OBJECT_KEYWORD) - - override fun getCompanionObjects(): List = emptyList() -} diff --git a/compiler/psi/src/org/jetbrains/kotlin/util/AstLoadingUtil.kt.181 b/compiler/psi/src/org/jetbrains/kotlin/util/AstLoadingUtil.kt.181 deleted file mode 100644 index 43c569894bd..00000000000 --- a/compiler/psi/src/org/jetbrains/kotlin/util/AstLoadingUtil.kt.181 +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010-2018 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.util - -import com.intellij.openapi.util.ThrowableComputable -import com.intellij.psi.PsiFile - -/** - * Absent in 181. Methods were renamed in 183. - * - * BUNCH: 182 - */ -@Suppress("IncompatibleAPI", "MissingRecentApi") -object AstLoadingFilter { - @JvmStatic - fun forceAllowTreeLoading(psiFile: PsiFile, computable: ThrowableComputable): T { - return computable.compute() - } -} \ No newline at end of file diff --git a/gradle/versions.properties.181 b/gradle/versions.properties.181 deleted file mode 100644 index a3423983af6..00000000000 --- a/gradle/versions.properties.181 +++ /dev/null @@ -1,13 +0,0 @@ -versions.intellijSdk=181.5540.7 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=181.3494.12 -versions.jar.guava=21.0 -versions.jar.groovy-all=2.4.12 -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.5 -versions.jar.gson=2.8.2 -versions.jar.oro=2.0.8 -versions.jar.snappy-in-java=0.5.1 -versions.gradle-api=4.4 diff --git a/idea/ide-common/src/org/jetbrains/kotlin/compatibility/ExecutorProcessor.kt.181 b/idea/ide-common/src/org/jetbrains/kotlin/compatibility/ExecutorProcessor.kt.181 deleted file mode 100644 index 19f50784245..00000000000 --- a/idea/ide-common/src/org/jetbrains/kotlin/compatibility/ExecutorProcessor.kt.181 +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 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.compatibility - -import com.intellij.util.Processor - -/** - * Processor till IDEA 181 and Processor since 182. - * BUNCH: 181 - */ -typealias ExecutorProcessor = Processor \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/BaseKotlinCompilerSettings.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/BaseKotlinCompilerSettings.kt.181 deleted file mode 100644 index 244d4e1fb5b..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/BaseKotlinCompilerSettings.kt.181 +++ /dev/null @@ -1,132 +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.compiler.configuration - -import com.intellij.openapi.components.PersistentStateComponent -import com.intellij.openapi.components.StoragePathMacros.PROJECT_CONFIG_DIR -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Comparing -import com.intellij.openapi.util.JDOMUtil -import com.intellij.util.ReflectionUtil -import com.intellij.util.messages.Topic -import com.intellij.util.xmlb.Accessor -import com.intellij.util.xmlb.SerializationFilterBase -import com.intellij.util.xmlb.XmlSerializer -import gnu.trove.THashMap -import org.jdom.Element -import org.jetbrains.kotlin.cli.common.arguments.* -import org.jetbrains.kotlin.config.SettingConstants -import org.jetbrains.kotlin.idea.syncPublisherWithDisposeCheck -import kotlin.reflect.KClass - -abstract class BaseKotlinCompilerSettings protected constructor(private val project: Project) : PersistentStateComponent, Cloneable { - // Based on com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters - private object DefaultValuesFilter : SerializationFilterBase() { - private val defaultBeans = THashMap, Any>() - - private fun createDefaultBean(beanClass: Class): Any { - return ReflectionUtil.newInstance(beanClass).apply { - if (this is K2JSCompilerArguments) { - sourceMapPrefix = "" - } - } - } - - private fun getDefaultValue(accessor: Accessor, bean: Any): Any? { - if (bean is K2JSCompilerArguments && accessor.name == K2JSCompilerArguments::sourceMapEmbedSources.name) { - return if (bean.sourceMap) K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING else null - } - - val beanClass = bean.javaClass - val defaultBean = defaultBeans.getOrPut(beanClass) { createDefaultBean(beanClass) } - return accessor.read(defaultBean) - } - - override fun accepts(accessor: Accessor, bean: Any, beanValue: Any?): Boolean { - val defValue = getDefaultValue(accessor, bean) - return if (defValue is Element && beanValue is Element) { - !JDOMUtil.areElementsEqual(beanValue, defValue) - } else { - !Comparing.equal(beanValue, defValue) - } - } - } - - @Suppress("LeakingThis", "UNCHECKED_CAST") - private var _settings: T = createSettings().frozen() as T - private set(value) { - field = value.frozen() as T - } - - var settings: T - get() = _settings - set(value) { - validateNewSettings(value) - _settings = value - - project.syncPublisherWithDisposeCheck(KotlinCompilerSettingsListener.TOPIC).settingsChanged(value) - } - - fun update(changer: T.() -> Unit) { - @Suppress("UNCHECKED_CAST") - settings = (settings.unfrozen() as T).apply { changer() } - } - - protected fun validateInheritedFieldsUnchanged(settings: T) { - @Suppress("UNCHECKED_CAST") - val inheritedProperties = collectProperties(settings::class as KClass, true) - val defaultInstance = createSettings() - val invalidFields = inheritedProperties.filter { it.get(settings) != it.get(defaultInstance) } - if (invalidFields.isNotEmpty()) { - throw IllegalArgumentException("Following fields are expected to be left unchanged in ${settings.javaClass}: ${invalidFields.joinToString { it.name }}") - } - } - - protected open fun validateNewSettings(settings: T) { - - } - - protected abstract fun createSettings(): T - - override fun getState() = XmlSerializer.serialize(_settings, DefaultValuesFilter) - - override fun loadState(state: Element) { - _settings = ReflectionUtil.newInstance(_settings.javaClass).apply { - if (this is CommonCompilerArguments) { - freeArgs = mutableListOf() - internalArguments = mutableListOf() - } - XmlSerializer.deserializeInto(this, state) - } - - project.syncPublisherWithDisposeCheck(KotlinCompilerSettingsListener.TOPIC).settingsChanged(settings) - } - - public override fun clone(): Any = super.clone() - - companion object { - const val KOTLIN_COMPILER_SETTINGS_PATH = PROJECT_CONFIG_DIR + "/" + SettingConstants.KOTLIN_COMPILER_SETTINGS_FILE - } -} - -interface KotlinCompilerSettingsListener { - fun settingsChanged(newSettings: T) - - companion object { - val TOPIC = Topic.create("KotlinCompilerSettingsListener", KotlinCompilerSettingsListener::class.java) - } -} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JsCompilerArgumentsHolder.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JsCompilerArgumentsHolder.kt.181 deleted file mode 100644 index eb22f4611cb..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JsCompilerArgumentsHolder.kt.181 +++ /dev/null @@ -1,39 +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.compiler.configuration - -import com.intellij.openapi.components.* -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments -import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION -import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH - -@State(name = KOTLIN_TO_JS_COMPILER_ARGUMENTS_SECTION, - storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE), - Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED))) -class Kotlin2JsCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings(project) { - override fun createSettings() = K2JSCompilerArguments() - - override fun validateNewSettings(settings: K2JSCompilerArguments) { - validateInheritedFieldsUnchanged(settings) - } - - companion object { - fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JsCompilerArgumentsHolder::class.java)!! - - } -} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JvmCompilerArgumentsHolder.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JvmCompilerArgumentsHolder.kt.181 deleted file mode 100644 index 9a008248b7f..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/Kotlin2JvmCompilerArgumentsHolder.kt.181 +++ /dev/null @@ -1,38 +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.compiler.configuration - -import com.intellij.openapi.components.* -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments -import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION -import org.jetbrains.kotlin.idea.compiler.configuration.BaseKotlinCompilerSettings.Companion.KOTLIN_COMPILER_SETTINGS_PATH - -@State(name = KOTLIN_TO_JVM_COMPILER_ARGUMENTS_SECTION, - storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE), - Storage(file = KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED))) -class Kotlin2JvmCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings(project) { - override fun createSettings() = K2JVMCompilerArguments() - - override fun validateNewSettings(settings: K2JVMCompilerArguments) { - validateInheritedFieldsUnchanged(settings) - } - - companion object { - fun getInstance(project: Project) = ServiceManager.getService(project, Kotlin2JvmCompilerArgumentsHolder::class.java)!! - } -} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCommonCompilerArgumentsHolder.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCommonCompilerArgumentsHolder.kt.181 deleted file mode 100644 index c63afd13ef4..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCommonCompilerArgumentsHolder.kt.181 +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.compiler.configuration - -import com.intellij.openapi.components.* -import com.intellij.openapi.project.Project -import com.intellij.util.text.VersionComparatorUtil -import org.jdom.Element -import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.setApiVersionToLanguageVersionIfNeeded -import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION -import org.jetbrains.kotlin.config.detectVersionAutoAdvance -import org.jetbrains.kotlin.config.dropVersionsIfNecessary - -@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION, - storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE), - Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH, - scheme = StorageScheme.DIRECTORY_BASED))) -class KotlinCommonCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings(project) { - override fun getState(): Element { - return super.getState().apply { - dropVersionsIfNecessary(settings) - } - } - - override fun loadState(state: Element) { - super.loadState(state) - - update { - // To fix earlier configurations with incorrect combination of language and API version - setApiVersionToLanguageVersionIfNeeded() - detectVersionAutoAdvance() - } - } - - override fun createSettings() = CommonCompilerArguments.DummyImpl() - - companion object { - fun getInstance(project: Project) = - ServiceManager.getService(project, KotlinCommonCompilerArgumentsHolder::class.java)!! - } -} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerSettings.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerSettings.kt.181 deleted file mode 100644 index d6e02b4ecff..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerSettings.kt.181 +++ /dev/null @@ -1,35 +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.compiler.configuration - -import com.intellij.openapi.components.* -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.config.CompilerSettings -import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMPILER_SETTINGS_SECTION - -@State(name = KOTLIN_COMPILER_SETTINGS_SECTION, - storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE), - Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH, scheme = StorageScheme.DIRECTORY_BASED))) -class KotlinCompilerSettings(project: Project) : BaseKotlinCompilerSettings(project) { - override fun createSettings() = CompilerSettings() - - - - companion object { - fun getInstance(project: Project) = ServiceManager.getService(project, KotlinCompilerSettings::class.java)!! - } -} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/ErrorIconUtil.java.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/ErrorIconUtil.java.181 deleted file mode 100644 index 58441fbf91d..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/ErrorIconUtil.java.181 +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 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; - -public class ErrorIconUtil { - public static String getErrorIconUrl() { - return "/general/error.png"; - } -} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/OutsidersPsiFileSupportWrapper.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/OutsidersPsiFileSupportWrapper.kt.181 deleted file mode 100644 index 1be7d2a1b65..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/OutsidersPsiFileSupportWrapper.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2018 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 - -import com.intellij.openapi.vfs.VirtualFile - -object OutsidersPsiFileSupportWrapper { - fun isOutsiderFile(virtualFile: VirtualFile): Boolean { - return false - } - - fun getOriginalFilePath(virtualFile: VirtualFile): String? { - return null - } -} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/compat/psiSearchHelper.kt.181 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/compat/psiSearchHelper.kt.181 deleted file mode 100644 index ca937c9d59a..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/util/compat/psiSearchHelper.kt.181 +++ /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.util.compat - -import com.intellij.openapi.project.Project -import com.intellij.psi.search.PsiSearchHelper - -// BUNCH: 181 -@Suppress("IncompatibleAPI", "MissingRecentApi") -fun psiSearchHelperInstance(project: Project): PsiSearchHelper { - return PsiSearchHelper.SERVICE.getInstance(project) -} \ No newline at end of file diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.181 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.181 deleted file mode 100644 index 0770030b883..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleLibraryDataService.kt.181 +++ /dev/null @@ -1,65 +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.android.configure - -import com.android.tools.idea.gradle.project.model.JavaModuleModel -import com.android.tools.idea.gradle.project.sync.idea.data.service.AndroidProjectKeys -import com.android.tools.idea.gradle.util.FilePaths -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.project.ModuleData -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider -import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.impl.libraries.LibraryEx -import com.intellij.openapi.roots.libraries.Library -import org.jetbrains.kotlin.idea.configuration.detectPlatformKindByPlugin -import org.jetbrains.kotlin.idea.framework.detectLibraryKind -import org.jetbrains.kotlin.idea.platform.tooling -import java.io.File - -class KotlinAndroidGradleLibraryDataService : AbstractProjectDataService() { - override fun getTargetDataKey() = AndroidProjectKeys.JAVA_MODULE_MODEL - - override fun postProcess( - toImport: MutableCollection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider - ) { - for (dataNode in toImport) { - @Suppress("UNCHECKED_CAST") - val targetLibraryKind = detectPlatformKindByPlugin(dataNode.parent as DataNode)?.tooling?.libraryKind - if (targetLibraryKind != null) { - for (dep in dataNode.data.jarLibraryDependencies) { - val library = modelsProvider.findLibraryByBinaryPath(dep.binaryPath) as LibraryEx? ?: continue - if (library.kind == null) { - val model = modelsProvider.getModifiableLibraryModel(library) as LibraryEx.ModifiableModelEx - detectLibraryKind(model.getFiles(OrderRootType.CLASSES))?.let { model.kind = it } - } - } - } - } - } - - private fun IdeModifiableModelsProvider.findLibraryByBinaryPath(path: File?): Library? { - if (path == null) return null - val url = FilePaths.pathToIdeaUrl(path) - return allLibraries.firstOrNull { url in getModifiableLibraryModel(it).getUrls(OrderRootType.CLASSES) } - } -} diff --git a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.181 b/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.181 deleted file mode 100644 index d6e21dd0529..00000000000 --- a/idea/idea-android/src/org/jetbrains/kotlin/android/configure/KotlinAndroidGradleMPPModuleDataService.kt.181 +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright 2010-2018 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.android.configure - -import com.android.tools.idea.gradle.project.sync.idea.data.service.AndroidProjectKeys -import com.android.tools.idea.gradle.util.ContentEntries.findParentContentEntry -import com.android.tools.idea.gradle.util.FilePaths -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.externalSystem.ExternalSystemModulePropertyManager -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.ProjectKeys -import com.intellij.openapi.externalSystem.model.project.ModuleData -import com.intellij.openapi.externalSystem.model.project.ProjectData -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider -import com.intellij.openapi.externalSystem.service.project.manage.AbstractProjectDataService -import com.intellij.openapi.externalSystem.service.project.manage.ContentRootDataService.CREATE_EMPTY_DIRECTORIES -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.DependencyScope -import com.intellij.openapi.roots.ModifiableRootModel -import com.intellij.openapi.vfs.VfsUtil -import com.intellij.util.SmartList -import com.intellij.util.containers.stream -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.jps.model.module.JpsModuleSourceRootType -import org.jetbrains.kotlin.gradle.KotlinCompilation -import org.jetbrains.kotlin.gradle.KotlinPlatform -import org.jetbrains.kotlin.gradle.KotlinSourceSet -import org.jetbrains.kotlin.idea.addModuleDependencyIfNeeded -import org.jetbrains.kotlin.idea.configuration.* -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.utils.addIfNotNull -import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData -import java.io.File -import java.io.IOException -import org.jetbrains.kotlin.idea.configuration.kotlinSourceSet - -class KotlinAndroidGradleMPPModuleDataService : AbstractProjectDataService() { - override fun getTargetDataKey() = ProjectKeys.MODULE - - private fun shouldCreateEmptySourceRoots( - moduleDataNode: DataNode, - module: Module - ): Boolean { - val projectDataNode = ExternalSystemApiUtil.findParent(moduleDataNode, ProjectKeys.PROJECT) ?: return false - if (projectDataNode.getUserData(CREATE_EMPTY_DIRECTORIES) == true) return true - - val projectSystemId = projectDataNode.data.owner - val externalSystemSettings = ExternalSystemApiUtil.getSettings(module.project, projectSystemId) - - val path = ExternalSystemModulePropertyManager.getInstance(module).getRootProjectPath() ?: return false - return externalSystemSettings.getLinkedProjectSettings(path)?.isCreateEmptyContentRootDirectories ?: false - } - - override fun postProcess( - toImport: MutableCollection>, - projectData: ProjectData?, - project: Project, - modelsProvider: IdeModifiableModelsProvider - ) { - for (nodeToImport in toImport) { - val projectNode = ExternalSystemApiUtil.findParent(nodeToImport, ProjectKeys.PROJECT) ?: continue - val moduleData = nodeToImport.data - val module = modelsProvider.findIdeModule(moduleData) ?: continue - val shouldCreateEmptySourceRoots = shouldCreateEmptySourceRoots(nodeToImport, module) - val rootModel = modelsProvider.getModifiableRootModel(module) - val kotlinAndroidSourceSets = nodeToImport.kotlinAndroidSourceSets ?: emptyList() - for (sourceSetInfo in kotlinAndroidSourceSets) { - val compilation = sourceSetInfo.kotlinModule as? KotlinCompilation ?: continue - for (sourceSet in compilation.sourceSets) { - if (sourceSet.platform == KotlinPlatform.ANDROID) { - val sourceType = if (sourceSet.isTestModule) JavaSourceRootType.TEST_SOURCE else JavaSourceRootType.SOURCE - val resourceType = if (sourceSet.isTestModule) JavaResourceRootType.TEST_RESOURCE else JavaResourceRootType.RESOURCE - sourceSet.sourceDirs.forEach { addSourceRoot(it, sourceType, rootModel, shouldCreateEmptySourceRoots) } - sourceSet.resourceDirs.forEach { addSourceRoot(it, resourceType, rootModel, shouldCreateEmptySourceRoots) } - } - } - } - addExtraDependeeModules(nodeToImport, projectNode, modelsProvider, rootModel, false) - addExtraDependeeModules(nodeToImport, projectNode, modelsProvider, rootModel, true) - - if (nodeToImport.kotlinAndroidSourceSets == null) { - continue - } - - val androidModel = getAndroidModuleModel(nodeToImport) ?: continue - val variantName = androidModel.selectedVariant.name - val activeSourceSetInfos = nodeToImport.kotlinAndroidSourceSets?.filter { it.kotlinModule.name.startsWith(variantName) } ?: emptyList() - for (activeSourceSetInfo in activeSourceSetInfos) { - val activeCompilation = activeSourceSetInfo.kotlinModule as? KotlinCompilation ?: continue - for (sourceSet in activeCompilation.sourceSets) { - if (sourceSet.platform != KotlinPlatform.ANDROID) { - val sourceSetId = activeSourceSetInfo.sourceSetIdsByName[sourceSet.name] ?: continue - val sourceSetNode = ExternalSystemApiUtil.findFirstRecursively(projectNode) { - (it.data as? ModuleData)?.id == sourceSetId - } as? DataNode? ?: continue - val sourceSetData = sourceSetNode.data as? ModuleData ?: continue - val sourceSetModule = modelsProvider.findIdeModule(sourceSetData) ?: continue - addModuleDependencyIfNeeded( - rootModel, - sourceSetModule, - activeSourceSetInfo.isTestModule, - sourceSetNode.kotlinSourceSet?.isTestModule ?: false - ) - } - } - } - - val mainSourceSetInfo = activeSourceSetInfos.firstOrNull { it.kotlinModule.name == variantName } - if (mainSourceSetInfo != null) { - KotlinSourceSetDataService.configureFacet(moduleData, mainSourceSetInfo, nodeToImport, module, modelsProvider) - } - - val kotlinFacet = KotlinFacet.get(module) - if (kotlinFacet != null) { - GradleProjectImportHandler.getInstances(project).forEach { it.importByModule(kotlinFacet, nodeToImport) } - } - } - } - - private fun getDependeeModuleNodes( - moduleNode: DataNode, - projectNode: DataNode, - modelsProvider: IdeModifiableModelsProvider, - testScope: Boolean - ): List> { - val androidModel = getAndroidModuleModel(moduleNode) - if (androidModel != null) { - val dependencies = if (testScope) { - androidModel.selectedAndroidTestCompileDependencies - } else { - androidModel.selectedMainCompileLevel2Dependencies - } ?: return emptyList() - return dependencies - .moduleDependencies - .mapNotNull { projectNode.findChildModuleById(it.projectPath) } - } - - val javaModel = getJavaModuleModel(moduleNode) - if (javaModel != null) { - val scope = if (testScope) DependencyScope.TEST.name else DependencyScope.COMPILE.name - val moduleNames = javaModel - .javaModuleDependencies - .filter { scope == it.scope ?: DependencyScope.COMPILE.name } - .mapTo(HashSet()) { it.moduleName } - return ExternalSystemApiUtil - .getChildren(projectNode, ProjectKeys.MODULE) - .filter { modelsProvider.findIdeModule(it.data)?.name in moduleNames } - } - - return emptyList() - } - - private fun List>.firstByPlatformOrNull(platform: KotlinPlatform) = firstOrNull { - it.kotlinSourceSet?.platform == platform - } - - private fun addExtraDependeeModules( - moduleNode: DataNode, - projectNode: DataNode, - modelsProvider: IdeModifiableModelsProvider, - rootModel: ModifiableRootModel, - testScope: Boolean - ) { - val dependeeModuleNodes = getDependeeModuleNodes(moduleNode, projectNode, modelsProvider, testScope) - val relevantNodes = dependeeModuleNodes - .flatMap { ExternalSystemApiUtil.getChildren(it, GradleSourceSetData.KEY) } - .filter { - val ktModule = it.kotlinSourceSet?.kotlinModule - ktModule != null && ktModule.isTestModule == testScope - } - val commonSourceSetName = KotlinSourceSet.commonName(testScope) - val isAndroidModule = getAndroidModuleModel(moduleNode) != null - - val gradleSourceSetDataNodes = SmartList>() - .apply { - addIfNotNull( - (if (isAndroidModule) relevantNodes.firstByPlatformOrNull(KotlinPlatform.ANDROID) else null) - ?: relevantNodes.firstByPlatformOrNull(KotlinPlatform.JVM) - ) - addIfNotNull( - relevantNodes.firstOrNull { - it.kotlinSourceSet?.platform == KotlinPlatform.COMMON && it.kotlinSourceSet?.kotlinModule?.name == commonSourceSetName - } - ) - } - - val testKotlinModules = - gradleSourceSetDataNodes.filter { it.kotlinSourceSet?.isTestModule ?: false }.mapNotNull { modelsProvider.findIdeModule(it.data) } - .toSet() - - gradleSourceSetDataNodes.forEach { node -> - val module = modelsProvider.findIdeModule(node.data) ?: return - addModuleDependencyIfNeeded(rootModel, module, testScope, node.kotlinSourceSet?.isTestModule ?: false) - val dependeeRootModel = modelsProvider.getModifiableRootModel(module) - dependeeRootModel.getModuleDependencies(testScope).forEach { transitiveDependee -> - addModuleDependencyIfNeeded(rootModel, transitiveDependee, testScope, testKotlinModules.contains(transitiveDependee)) - } - } - } - - private fun getAndroidModuleModel(moduleNode: DataNode) = - ExternalSystemApiUtil.getChildren(moduleNode, AndroidProjectKeys.ANDROID_MODEL).firstOrNull()?.data - - private fun getJavaModuleModel(moduleNode: DataNode) = - ExternalSystemApiUtil.getChildren(moduleNode, AndroidProjectKeys.JAVA_MODULE_MODEL).firstOrNull()?.data - - private fun addSourceRoot( - sourceRoot: File, - type: JpsModuleSourceRootType<*>, - rootModel: ModifiableRootModel, - shouldCreateEmptySourceRoots: Boolean - ) { - val parent = findParentContentEntry(sourceRoot, rootModel.contentEntries.stream()) ?: return - val url = FilePaths.pathToIdeaUrl(sourceRoot) - parent.addSourceFolder(url, type) - if (shouldCreateEmptySourceRoots) { - ExternalSystemApiUtil.doWriteAction { - try { - VfsUtil.createDirectoryIfMissing(sourceRoot.path) - } catch (e: IOException) { - LOG.warn(String.format("Unable to create directory for the path: %s", sourceRoot.path), e) - } - } - } - } - - companion object { - private val LOG = Logger.getInstance(KotlinAndroidGradleMPPModuleDataService::class.java) - } -} \ No newline at end of file diff --git a/idea/idea-android/tests/org/jetbrains/kotlin/android/AndroidTestCase.java.181 b/idea/idea-android/tests/org/jetbrains/kotlin/android/AndroidTestCase.java.181 deleted file mode 100644 index ba5b74fa1d3..00000000000 --- a/idea/idea-android/tests/org/jetbrains/kotlin/android/AndroidTestCase.java.181 +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.android; - -import com.android.SdkConstants; -import com.android.tools.idea.rendering.RenderSecurityManager; -import com.android.tools.idea.startup.AndroidCodeStyleSettingsModifier; -import com.intellij.analysis.AnalysisScope; -import com.intellij.codeInspection.GlobalInspectionTool; -import com.intellij.codeInspection.InspectionManager; -import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper; -import com.intellij.codeInspection.ex.InspectionManagerEx; -import com.intellij.facet.FacetManager; -import com.intellij.facet.ModifiableFacetModel; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.projectRoots.ProjectJdkTable; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.LanguageLevelProjectExtension; -import com.intellij.openapi.roots.ModuleRootModificationUtil; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess; -import com.intellij.pom.java.LanguageLevel; -import com.intellij.psi.codeStyle.CodeStyleSchemes; -import com.intellij.psi.codeStyle.CodeStyleSettings; -import com.intellij.psi.codeStyle.CodeStyleSettingsManager; -import com.intellij.testFramework.InspectionTestUtil; -import com.intellij.testFramework.ThreadTracker; -import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; -import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; -import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; -import com.intellij.testFramework.fixtures.JavaTestFixtureFactory; -import com.intellij.testFramework.fixtures.TestFixtureBuilder; -import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; -import com.intellij.testFramework.fixtures.impl.GlobalInspectionContextForTests; -import com.intellij.util.ArrayUtil; -import org.jetbrains.android.facet.AndroidFacet; -import org.jetbrains.android.facet.AndroidRootUtil; -import org.jetbrains.android.formatter.AndroidXmlCodeStyleSettings; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.picocontainer.MutablePicoContainer; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Copied from AS 2.3 sources - */ -@SuppressWarnings({"JUnitTestCaseWithNonTrivialConstructors"}) -public abstract class AndroidTestCase extends AndroidTestBase { - protected Module myModule; - protected List myAdditionalModules; - - protected AndroidFacet myFacet; - protected CodeStyleSettings mySettings; - - private List myAllowedRoots = new ArrayList<>(); - private boolean myUseCustomSettings; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory()); - - TestFixtureBuilder projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName()); - myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture()); - JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class); - File moduleRoot = new File(myFixture.getTempDirPath()); - - if (!moduleRoot.exists()) { - assertTrue(moduleRoot.mkdirs()); - } - initializeModuleFixtureBuilderWithSrcAndGen(moduleFixtureBuilder, moduleRoot.toString()); - - ArrayList modules = new ArrayList<>(); - configureAdditionalModules(projectBuilder, modules); - - myFixture.setUp(); - myFixture.setTestDataPath(getTestDataPath()); - myModule = moduleFixtureBuilder.getFixture().getModule(); - - // Must be done before addAndroidFacet, and must always be done, even if a test provides - // its own custom manifest file. However, in that case, we will delete it shortly below. - createManifest(); - - myFacet = addAndroidFacet(myModule); - - LanguageLevel languageLevel = getLanguageLevel(); - if (languageLevel != null) { - LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myModule.getProject()); - if (extension != null) { - extension.setLanguageLevel(languageLevel); - } - } - - // TODO: myFixture.copyDirectoryToProject(getResDir(), "res"); - - myAdditionalModules = new ArrayList<>(); - for (MyAdditionalModuleData data : modules) { - Module additionalModule = data.myModuleFixtureBuilder.getFixture().getModule(); - myAdditionalModules.add(additionalModule); - AndroidFacet facet = addAndroidFacet(additionalModule); - facet.setProjectType(data.myProjectType); - String rootPath = getAdditionalModulePath(data.myDirName); - myFixture.copyDirectoryToProject(getResDir(), rootPath + "/res"); - myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, rootPath + '/' + SdkConstants.FN_ANDROID_MANIFEST_XML); - if (data.myIsMainModuleDependency) { - ModuleRootModificationUtil.addDependency(myModule, additionalModule); - } - } - - if (providesCustomManifest()) { - deleteManifest(); - } - - if (RenderSecurityManager.RESTRICT_READS) { - // Unit test class loader includes disk directories which security manager does not allow access to - RenderSecurityManager.sEnabled = false; - } - - ArrayList allowedRoots = new ArrayList<>(); - collectAllowedRoots(allowedRoots); - // TODO: registerAllowedRoots(allowedRoots, myTestRootDisposable); - mySettings = CodeStyleSettingsManager.getSettings(getProject()).clone(); - AndroidCodeStyleSettingsModifier.modify(mySettings); - CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(mySettings); - myUseCustomSettings = getAndroidCodeStyleSettings().USE_CUSTOM_SETTINGS; - getAndroidCodeStyleSettings().USE_CUSTOM_SETTINGS = true; - - // Layoutlib rendering thread will be shutdown when the app is closed so do not report it as a leak - ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Layoutlib"); - } - - @Override - protected void tearDown() throws Exception { - try { - Sdk androidSdk = ProjectJdkTable.getInstance().findJdk(ANDROID_SDK_NAME); - if (androidSdk != null) { - ApplicationManager.getApplication().runWriteAction(() -> ProjectJdkTable.getInstance().removeJdk(androidSdk)); - } - - CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings(); - myModule = null; - myAdditionalModules = null; - myFixture.tearDown(); - myFixture = null; - myFacet = null; - getAndroidCodeStyleSettings().USE_CUSTOM_SETTINGS = myUseCustomSettings; - if (RenderSecurityManager.RESTRICT_READS) { - RenderSecurityManager.sEnabled = true; - } - } - finally { - super.tearDown(); - VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()); - } - } - - private static void initializeModuleFixtureBuilderWithSrcAndGen(JavaModuleFixtureBuilder moduleFixtureBuilder, String moduleRoot) { - moduleFixtureBuilder.addContentRoot(moduleRoot); - - //noinspection ResultOfMethodCallIgnored - new File(moduleRoot + "/src/").mkdir(); - moduleFixtureBuilder.addSourceRoot("src"); - - //noinspection ResultOfMethodCallIgnored - new File(moduleRoot + "/gen/").mkdir(); - moduleFixtureBuilder.addSourceRoot("gen"); - } - - /** - * Returns the path that any additional modules registered by - * {@link #configureAdditionalModules(TestFixtureBuilder, List)} or - * {@link #addModuleWithAndroidFacet(TestFixtureBuilder, List, String, int, boolean)} are - * installed into. - */ - protected static String getAdditionalModulePath(@NotNull String moduleName) { - return "/additionalModules/" + moduleName; - } - - /** - * Indicates whether this class provides its own {@code AndroidManifest.xml} for its tests. If - * {@code true}, then {@link #setUp()} calls {@link #deleteManifest()} before finishing. - */ - protected boolean providesCustomManifest() { - return false; - } - - /** - * Get the "res" directory for this SDK. Children classes can override this if they need to - * provide a custom "res" location for tests. - */ - protected String getResDir() { - return "res"; - } - - /** - * Defines the project level to set for the test project, or null to get the default language - * level associated with the test project. - */ - @Nullable - protected LanguageLevel getLanguageLevel() { - return null; - } - - protected static AndroidXmlCodeStyleSettings getAndroidCodeStyleSettings() { - return AndroidXmlCodeStyleSettings.getInstance(CodeStyleSchemes.getInstance().getDefaultScheme().getCodeStyleSettings()); - } - - /** - * Hook point for child test classes to register directories that can be safely accessed by all - * of its tests. - * - * @see {@link VfsRootAccess} - */ - protected void collectAllowedRoots(List roots) throws IOException { - } - - private void registerAllowedRoots(List roots, @NotNull Disposable disposable) { - List newRoots = new ArrayList<>(roots); - newRoots.removeAll(myAllowedRoots); - - String[] newRootsArray = ArrayUtil.toStringArray(newRoots); - VfsRootAccess.allowRootAccess(newRootsArray); - myAllowedRoots.addAll(newRoots); - - Disposer.register(disposable, () -> { - VfsRootAccess.disallowRootAccess(newRootsArray); - myAllowedRoots.removeAll(newRoots); - }); - } - - public static AndroidFacet addAndroidFacet(Module module) { - return addAndroidFacet(module, true); - } - - private static AndroidFacet addAndroidFacet(Module module, boolean attachSdk) { - FacetManager facetManager = FacetManager.getInstance(module); - AndroidFacet facet = facetManager.createFacet(AndroidFacet.getFacetType(), "Android", null); - - if (attachSdk) { - addLatestAndroidSdk(module); - } - ModifiableFacetModel facetModel = facetManager.createModifiableModel(); - facetModel.addFacet(facet); - ApplicationManager.getApplication().runWriteAction(facetModel::commit); - return facet; - } - - protected void configureAdditionalModules( - @NotNull TestFixtureBuilder projectBuilder, @NotNull List modules) { - } - - protected final void addModuleWithAndroidFacet( - @NotNull TestFixtureBuilder projectBuilder, - @NotNull List modules, - @NotNull String dirName, - int projectType) { - // By default, created module is declared as a main module's dependency - addModuleWithAndroidFacet(projectBuilder, modules, dirName, projectType, true); - } - - protected final void addModuleWithAndroidFacet( - @NotNull TestFixtureBuilder projectBuilder, - @NotNull List modules, - @NotNull String dirName, - int projectType, - boolean isMainModuleDependency) { - JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class); - String moduleDirPath = myFixture.getTempDirPath() + getAdditionalModulePath(dirName); - //noinspection ResultOfMethodCallIgnored - new File(moduleDirPath).mkdirs(); - initializeModuleFixtureBuilderWithSrcAndGen(moduleFixtureBuilder, moduleDirPath); - modules.add(new MyAdditionalModuleData(moduleFixtureBuilder, dirName, projectType, isMainModuleDependency)); - } - - protected void createManifest() throws IOException { - myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, SdkConstants.FN_ANDROID_MANIFEST_XML); - } - - protected final void createProjectProperties() throws IOException { - myFixture.copyFileToProject(SdkConstants.FN_PROJECT_PROPERTIES, SdkConstants.FN_PROJECT_PROPERTIES); - } - - protected final void deleteManifest() throws IOException { - deleteManifest(myModule); - } - - protected final void deleteManifest(final Module module) throws IOException { - AndroidFacet facet = AndroidFacet.getInstance(module); - assertNotNull(facet); - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - String manifestRelativePath = facet.getProperties().MANIFEST_FILE_RELATIVE_PATH; - VirtualFile manifest = AndroidRootUtil.getFileByRelativeModulePath(module, manifestRelativePath, true); - if (manifest != null) { - try { - manifest.delete(this); - } - catch (IOException e) { - fail("Could not delete default manifest"); - } - } - } - }); - } - - protected final void doGlobalInspectionTest( - @NotNull GlobalInspectionTool inspection, @NotNull String globalTestDir, @NotNull AnalysisScope scope) { - doGlobalInspectionTest(new GlobalInspectionToolWrapper(inspection), globalTestDir, scope); - } - - /** - * Given an inspection and a path to a directory that contains an "expected.xml" file, run the - * inspection on the current test project and verify that its output matches that of the - * expected file. - */ - protected final void doGlobalInspectionTest( - @NotNull GlobalInspectionToolWrapper wrapper, @NotNull String globalTestDir, @NotNull AnalysisScope scope) { - myFixture.enableInspections(wrapper.getTool()); - - scope.invalidate(); - - InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject()); - GlobalInspectionContextForTests globalContext = - CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, wrapper); - - InspectionTestUtil.runTool(wrapper, scope, globalContext); - InspectionTestUtil.compareToolResults(globalContext, wrapper, false, getTestDataPath() + globalTestDir); - } - - protected static class MyAdditionalModuleData { - final JavaModuleFixtureBuilder myModuleFixtureBuilder; - final String myDirName; - final int myProjectType; - final boolean myIsMainModuleDependency; - - private MyAdditionalModuleData( - @NotNull JavaModuleFixtureBuilder moduleFixtureBuilder, @NotNull String dirName, int projectType, boolean isMainModuleDependency) { - myModuleFixtureBuilder = moduleFixtureBuilder; - myDirName = dirName; - myProjectType = projectType; - myIsMainModuleDependency = isMainModuleDependency; - } - } - - @NotNull - protected T registerApplicationComponent(@NotNull Class key, @NotNull T instance) throws Exception { - MutablePicoContainer picoContainer = (MutablePicoContainer)ApplicationManager.getApplication().getPicoContainer(); - @SuppressWarnings("unchecked") - T old = (T)picoContainer.getComponentInstance(key.getName()); - picoContainer.unregisterComponent(key.getName()); - picoContainer.registerComponentInstance(key.getName(), instance); - return old; - } - - @NotNull - protected T registerProjectComponent(@NotNull Class key, @NotNull T instance) { - MutablePicoContainer picoContainer = (MutablePicoContainer)getProject().getPicoContainer(); - @SuppressWarnings("unchecked") - T old = (T)picoContainer.getComponentInstance(key.getName()); - picoContainer.unregisterComponent(key.getName()); - picoContainer.registerComponentInstance(key.getName(), instance); - return old; - } -} diff --git a/idea/idea-android/tests/org/jetbrains/kotlin/android/TestUtils.java.181 b/idea/idea-android/tests/org/jetbrains/kotlin/android/TestUtils.java.181 deleted file mode 100644 index 8e984c33b0f..00000000000 --- a/idea/idea-android/tests/org/jetbrains/kotlin/android/TestUtils.java.181 +++ /dev/null @@ -1,40 +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.android; - - -import com.android.annotations.NonNull; -import com.intellij.openapi.application.PathManager; -import org.jetbrains.kotlin.test.KotlinTestUtils; - -import java.io.File; - -/** - * Stub for com.android.testutils.TestUtils - * stabbed to minimize changes in AndroidTestBase - */ -public class TestUtils { - @NonNull - public static File getSdk() { - return KotlinTestUtils.findAndroidSdk(); - } - - @NonNull - public static String getLatestAndroidPlatform() { - return "android-26"; - } -} diff --git a/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.181 b/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java.181 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/gradle/execution/KotlinMPPGradleProjectTaskRunner.java.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.181 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.181 deleted file mode 100644 index 67525c49971..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.181 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2018 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.gradle - -import org.jetbrains.kotlin.idea.configuration.KotlinGradleSharedMultiplatformModuleBuilder -import org.jetbrains.kotlin.idea.configuration.KotlinGradleWebMultiplatformModuleBuilder -import org.jetbrains.kotlin.idea.test.KotlinSdkCreationChecker -import org.junit.Test - -class GradleMultiplatformWizardTest : AbstractGradleMultiplatformWizardTest() { - - lateinit var sdkCreationChecker: KotlinSdkCreationChecker - - override fun setUp() { - super.setUp() - sdkCreationChecker = KotlinSdkCreationChecker() - } - - override fun tearDown() { - sdkCreationChecker.removeNewKotlinSdk() - super.tearDown() - } - - @Test - fun testWeb() { - testImportFromBuilder(KotlinGradleWebMultiplatformModuleBuilder(), "SampleTests", "SampleTestsJVM") - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.181 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.181 deleted file mode 100644 index df81b4f716c..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.181 +++ /dev/null @@ -1,17 +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.gradle - -import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase - -//BUNCH 181 -fun MultiplatformProjectImportingTest.shouldRunTest(kotlinPluginVersion: String, gradleVersion: String): Boolean { - return kotlinPluginVersion != MultiplePluginVersionGradleImportingTestCase.MINIMAL_SUPPORTED_VERSION -} - -fun NewMultiplatformProjectImportingTest.shouldRunTest(kotlinPluginVersion: String, gradleVersion: String): Boolean { - return !gradleVersion.startsWith("3.") -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.181 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.181 deleted file mode 100644 index dad2610b484..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.181 +++ /dev/null @@ -1,2524 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.codeInsight.gradle - -import com.intellij.openapi.application.Result -import com.intellij.openapi.application.WriteAction -import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.projectRoots.JavaSdk -import com.intellij.openapi.projectRoots.ProjectJdkTable -import com.intellij.openapi.roots.LibraryOrderEntry -import com.intellij.openapi.roots.ModuleRootManager -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.impl.libraries.LibraryEx -import junit.framework.TestCase -import org.jetbrains.jps.model.java.JavaResourceRootType -import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.jps.model.module.JpsModuleSourceRootType -import org.jetbrains.kotlin.caches.resolve.KotlinCacheService -import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments -import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments -import org.jetbrains.kotlin.config.* -import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo -import org.jetbrains.kotlin.idea.caches.project.testSourceInfo -import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder -import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinStatus -import org.jetbrains.kotlin.idea.configuration.ModuleSourceRootMap -import org.jetbrains.kotlin.idea.configuration.allConfigurators -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.idea.framework.CommonLibraryKind -import org.jetbrains.kotlin.idea.framework.JSLibraryKind -import org.jetbrains.kotlin.idea.framework.KotlinSdkType -import org.jetbrains.kotlin.idea.project.languageVersionSettings -import org.jetbrains.kotlin.idea.util.projectStructure.allModules -import org.jetbrains.kotlin.idea.util.projectStructure.sdk -import org.jetbrains.kotlin.js.resolve.JsPlatform -import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind -import org.jetbrains.kotlin.platform.impl.isCommon -import org.jetbrains.kotlin.platform.impl.isJavaScript -import org.jetbrains.kotlin.resolve.TargetPlatform -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.junit.Assert -import org.junit.Test -import java.util.* - -internal fun GradleImportingTestCase.facetSettings(moduleName: String) = KotlinFacet.get(getModule(moduleName))!!.configuration.settings - -internal val GradleImportingTestCase.facetSettings: KotlinFacetSettings - get() = facetSettings("project_main") - -internal val GradleImportingTestCase.testFacetSettings: KotlinFacetSettings - get() = facetSettings("project_test") - -internal fun GradleImportingTestCase.getSourceRootInfos(moduleName: String): List>> { - return ModuleRootManager.getInstance(getModule(moduleName)).contentEntries.flatMap { - it.sourceFolders.map { it.url.replace(projectPath, "") to it.rootType } - } -} - -class GradleFacetImportTest : GradleImportingTestCase() { - private var isCreateEmptyContentRootDirectories = true - - override fun setUp() { - super.setUp() - isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true - } - - override fun tearDown() { - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = isCreateEmptyContentRootDirectories - super.tearDown() - } - - private fun assertSameKotlinSdks(vararg moduleNames: String) { - val sdks = moduleNames.map { getModule(it).sdk!! } - val refSdk = sdks.firstOrNull() ?: return - Assert.assertTrue(refSdk.sdkType is KotlinSdkType) - Assert.assertTrue(sdks.all { it === refSdk }) - } - - @Test - fun testJvmImport() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } - - assertAllModulesConfigured() - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJvmImportWithPlugin() { - createProjectSubFile( - "build.gradle", """ -buildscript { - repositories { - mavenCentral() - } -} - -plugins { - id "org.jetbrains.kotlin.jvm" version "1.1.3" -} - -version '1.0-SNAPSHOT' - -apply plugin: 'java' - -sourceCompatibility = 1.8 - -repositories { - mavenCentral() -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.3" - testCompile group: 'junit', name: 'junit', version: '4.12' -} - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - """ - ) - importProject() - - assertAllModulesConfigured() - } - - @Test - fun testJvmImport_1_1_2() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-5") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-5" - } - - compileKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJvmImportWithCustomSourceSets() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileMyMainKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileMyTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } - - assertAllModulesConfigured() - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJvmImportWithCustomSourceSets_1_1_2() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-5") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } - } - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.2-5" - } - - compileMyMainKotlin { - kotlinOptions.jvmTarget = "1.7" - kotlinOptions.freeCompilerArgs = ["-Xsingle-module", "-Xdump-declarations-to", "tmp"] - } - - compileMyTestKotlin { - kotlinOptions.jvmTarget = "1.6" - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-Xdump-declarations-to", "tmpTest"] - } - """ - ) - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), platform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xdump-declarations-to=tmpTest", - compilerSettings!!.additionalArguments - ) - } - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testCoroutineImportByOptions() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - kotlin { - experimental { - coroutines 'enable' - } - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testCoroutineImportByProperties() { - createProjectSubFile("gradle.properties", "kotlin.coroutines=enable") - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testJsImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - - compileKotlin2Js { - kotlinOptions.sourceMap = true - kotlinOptions.freeCompilerArgs = ["-module-kind", "plain", "-main", "callMain"] - } - - compileTestKotlin2Js { - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-module-kind", "umd", "-main", "callTest"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(true, sourceMap) - Assert.assertEquals("plain", moduleKind) - } - Assert.assertEquals( - "-main callMain", - compilerSettings!!.additionalArguments - ) - } - - with(testFacetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(false, sourceMap) - Assert.assertEquals("umd", moduleKind) - } - Assert.assertEquals( - "-main callTest", - compilerSettings!!.additionalArguments - ) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project_main")) - val stdlib = rootManager.orderEntries.filterIsInstance().single().library - assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind) - assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty()) - - assertSameKotlinSdks("project_main", "project_test") - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - - assertAllModulesConfigured() - } - - @Test - fun testJsImportTransitive() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-test-js:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project_main")) - val stdlib = rootManager.orderEntries - .filterIsInstance() - .map { it.library as LibraryEx } - .first { "kotlin-stdlib-js" in it.name!! } - assertEquals(JSLibraryKind, stdlib.kind) - - assertAllModulesConfigured() - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJsImportWithCustomSourceSets() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - - compileMyMainKotlin2Js { - kotlinOptions.sourceMap = true - kotlinOptions.freeCompilerArgs = ["-module-kind", "plain", "-main", "callMain"] - } - - compileMyTestKotlin2Js { - kotlinOptions.apiVersion = "1.0" - kotlinOptions.freeCompilerArgs = ["-module-kind", "umd", "-main", "callTest"] - } - """ - ) - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(true, sourceMap) - Assert.assertEquals("plain", moduleKind) - } - Assert.assertEquals( - "-main callMain", - compilerSettings!!.additionalArguments - ) - } - - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(false, sourceMap) - Assert.assertEquals("umd", moduleKind) - } - Assert.assertEquals( - "-main callTest", - compilerSettings!!.additionalArguments - ) - } - - assertAllModulesConfigured() - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testDetectOldJsStdlib() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.6") - } - } - - apply plugin: 'kotlin2js' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-js-library:1.0.6" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertTrue(platform.isJavaScript) - } - } - - @Test - fun testJvmImportByPlatformPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - } - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJsImportByPlatformPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project_main")) - val libraries = rootManager.orderEntries.filterIsInstance().mapNotNull { it.library as LibraryEx } - assertEquals(JSLibraryKind, libraries.single { it.name?.contains("kotlin-stdlib-js") == true }.kind) - assertEquals(CommonLibraryKind, libraries.single { it.name?.contains("kotlin-stdlib-common") == true }.kind) - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testCommonImportByPlatformPlugin() { - if (gradleVersion >= "4.8") return - - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isCommon) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project_main")) - val stdlib = rootManager.orderEntries.filterIsInstance().single().library - assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind) - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testCommonImportByPlatformPlugin_SingleModule() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """ - ) - importProjectUsingSingeModulePerGradleProject() - - with(facetSettings("project")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isCommon) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project")) - val stdlib = rootManager.orderEntries.filterIsInstance().mapTo(HashSet()) { it.library }.single() - assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind) - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project") - ) - } - - @Test - fun testJvmImportByKotlinPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertEquals(JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), platform) - } - - Assert.assertEquals( - listOf("file:///src/main/java" to JavaSourceRootType.SOURCE, - "file:///src/main/kotlin" to JavaSourceRootType.SOURCE, - "file:///src/main/resources" to JavaResourceRootType.RESOURCE), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/kotlin" to JavaSourceRootType.TEST_SOURCE, - "file:///src/test/resources" to JavaResourceRootType.TEST_RESOURCE), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testJsImportByKotlin2JsPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin2js' - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(platform.isJavaScript) - } - - Assert.assertEquals( - listOf("file:///src/main/java" to SourceKotlinRootType, - "file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/java" to TestSourceKotlinRootType, - "file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testArgumentEscaping() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - compileKotlin { - kotlinOptions.freeCompilerArgs = ["-module", "module with spaces"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - listOf("-Xbuild-file=module with spaces"), - compilerSettings!!.additionalArgumentsAsList - ) - } - } - - @Test - fun testNoPluginsInAdditionalArgs() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10") - classpath("org.jetbrains.kotlin:kotlin-allopen:1.2.10") - } - } - - apply plugin: 'kotlin' - apply plugin: "kotlin-spring" - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - "-version", - compilerSettings!!.additionalArguments - ) - Assert.assertEquals( - listOf( - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.stereotype.Component", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.transaction.annotation.Transactional", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.scheduling.annotation.Async", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.cache.annotation.Cacheable", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.boot.test.context.SpringBootTest", - "plugin:org.jetbrains.kotlin.allopen:annotation=org.springframework.validation.annotation.Validated" - ), - compilerArguments!!.pluginOptions!!.toList() - ) - } - } - - @Test - fun testNoArgInvokeInitializers() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10") - classpath("org.jetbrains.kotlin:kotlin-noarg:1.2.10") - } - } - - apply plugin: 'kotlin' - apply plugin: "kotlin-noarg" - - noArg { - invokeInitializers = true - annotation("NoArg") - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals( - "-version", - compilerSettings!!.additionalArguments - ) - Assert.assertEquals( - listOf( - "plugin:org.jetbrains.kotlin.noarg:annotation=NoArg", - "plugin:org.jetbrains.kotlin.noarg:invokeInitializers=true" - ), - compilerArguments!!.pluginOptions!!.toList() - ) - } - } - - @Test - fun testAndroidGradleJsDetection() { - createProjectSubFile( - "android-module/build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - jcenter() - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - } - } - - apply plugin: 'com.android.application' - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - - defaultConfig { - minSdkVersion 11 - targetSdkVersion 23 - versionCode 1002003 - versionName version - } - - dataBinding { - enabled = true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - versionNameSuffix "-debug" - } - release { - minifyEnabled true - shrinkResources true - } - } - } - """ - ) - createProjectSubFile( - "android-module/src/main/AndroidManifest.xml", """ - - - """ - ) - createProjectSubFile( - "js-module/build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40") - } - } - - apply plugin: 'kotlin2js' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - } - """ - ) - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenLocal() - maven { - url='https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - jcenter() - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0" - } - } - - ext { - androidBuildToolsVersion = '23.0.1' - } - - allprojects { - repositories { - mavenLocal() - maven { - url='https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - jcenter() - } - } - """ - ) - createProjectSubFile( - "settings.gradle", """ - rootProject.name = "android-js-test" - include ':android-module' - include ':js-module' - """ - ) - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - importProject() - - with(facetSettings("js-module")) { - Assert.assertTrue(platform.isJavaScript) - } - - val rootManager = ModuleRootManager.getInstance(getModule("js-module")) - val stdlib = rootManager - .orderEntries - .filterIsInstance() - .first { it.libraryName?.startsWith("Gradle: kotlin-stdlib-js-") ?: false } - .library!! - assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty()) - assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind) - } - - @Test - fun testKotlinAndroidPluginDetection() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - jcenter() - mavenCentral() - } - dependencies { - classpath "com.android.tools.build:gradle:2.3.0" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50" - } - } - - apply plugin: 'com.android.application' - apply plugin: 'kotlin-android' - - android { - compileSdkVersion 26 - buildToolsVersion "23.0.1" - - defaultConfig { - minSdkVersion 11 - targetSdkVersion 23 - versionCode 1002003 - versionName version - } - - dataBinding { - enabled = true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - buildTypes { - debug { - applicationIdSuffix ".debug" - versionNameSuffix "-debug" - } - release { - minifyEnabled true - shrinkResources true - } - } - } - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - freeCompilerArgs = ['-progressive'] - } - } - """ - ) - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - createProjectSubFile( - "src/main/AndroidManifest.xml", """ - - - """ - ) - importProject() - - val kotlinFacet = KotlinFacet.get(getModule("project"))!! - Assert.assertTrue(kotlinFacet.configuration.settings.mergedCompilerArguments!!.progressiveMode) - } - - @Test - fun testNoFacetInModuleWithoutKotlinPlugin() { - createProjectSubFile( - "build.gradle", """ - group 'gr01' - version '1.0-SNAPSHOT' - - apply plugin: 'java' - apply plugin: 'kotlin' - - sourceCompatibility = 1.8 - - repositories { - mavenCentral() - } - - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1" - } - } - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.1" - } - """ - ) - createProjectSubFile( - "settings.gradle", """ - rootProject.name = 'gr01' - include 'm1' - """ - ) - createProjectSubFile( - "m1/build.gradle", """ - group 'gr01' - version '1.0-SNAPSHOT' - - apply plugin: 'java' - - sourceCompatibility = 1.8 - - repositories { - mavenCentral() - } - - buildscript { - repositories { - mavenCentral() - } - } - dependencies { - testCompile group: 'junit', name: 'junit', version: '4.11' - } - """ - ) - importProject() - - Assert.assertNotNull(KotlinFacet.get(getModule("gr01_main"))) - Assert.assertNotNull(KotlinFacet.get(getModule("gr01_test"))) - Assert.assertNull(KotlinFacet.get(getModule("m1_main"))) - Assert.assertNull(KotlinFacet.get(getModule("m1_test"))) - } - - @Test - fun testClasspathWithDependenciesImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - - compileKotlin { - kotlinOptions.freeCompilerArgs += ["-cp", "tmp.jar"] - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("tmp.jar", (compilerArguments as K2JVMCompilerArguments).classpath) - } - } - - @Test - fun testDependenciesClasspathImport() { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals(null, (compilerArguments as K2JVMCompilerArguments).classpath) - } - } - - @Test - fun testJDKImport() { - object : WriteAction() { - override fun run(result: Result) { - val jdk = JavaSdk.getInstance().createJdk("myJDK", "my/path/to/jdk") - ProjectJdkTable.getInstance().addJdk(jdk) - } - }.execute() - - try { - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - compile "org.apache.logging.log4j:log4j-core:2.7" - } - - compileKotlin { - kotlinOptions.jdkHome = "my/path/to/jdk" - } - """ - ) - importProject() - - val moduleSDK = ModuleRootManager.getInstance(getModule("project_main")).sdk!! - Assert.assertTrue(moduleSDK.sdkType is JavaSdk) - Assert.assertEquals("myJDK", moduleSDK.name) - Assert.assertEquals("my/path/to/jdk", moduleSDK.homePath) - } finally { - object : WriteAction() { - override fun run(result: Result) { - val jdkTable = ProjectJdkTable.getInstance() - jdkTable.removeJdk(jdkTable.findJdk("myJDK")!!) - } - }.execute() - } - } - - @Test - fun testImplementsDependency() { - if (gradleVersion >= "4.8") return - - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - - importProject() - - Assert.assertEquals(listOf("MultiTest_main"), facetSettings("MultiTest-jvm_main").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_test"), facetSettings("MultiTest-jvm_test").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_main"), facetSettings("MultiTest-js_main").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_test"), facetSettings("MultiTest-js_test").implementedModuleNames) - } - - @Test - fun testImplementsDependencyWithCustomSourceSets() { - if (gradleVersion >= "4.8") return - - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-common' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.1.0" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - implement project(":") - } - - """.trimIndent() - ) - - importProject() - - Assert.assertEquals(listOf("MultiTest_myMain"), facetSettings("MultiTest-jvm_myMain").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myTest"), facetSettings("MultiTest-jvm_myTest").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myMain"), facetSettings("MultiTest-js_myMain").implementedModuleNames) - Assert.assertEquals(listOf("MultiTest_myTest"), facetSettings("MultiTest-js_myTest").implementedModuleNames) - } - - @Test - fun testAPIVersionExceedingLanguageVersion() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - - compileKotlin { - kotlinOptions.languageVersion = "1.1" - kotlinOptions.apiVersion = "1.2" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testIgnoreProjectLanguageAndAPIVersion() { - KotlinCommonCompilerArgumentsHolder.getInstance(myProject).update { - languageVersion = "1.0" - apiVersion = "1.0" - } - - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0") - } - } - - apply plugin: 'kotlin' - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0" - } - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testCommonArgumentsImport() { - if (gradleVersion >= "4.8") return - - createProjectSubFile( - "build.gradle", """ - group 'Again' - version '1.0-SNAPSHOT' - - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.2' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.40") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap-1.2' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.40" - } - - compileKotlinCommon{ - kotlinOptions { - languageVersion = 1.1 - apiVersion = 1.0 - freeCompilerArgs += ["-cp", "my/classpath"] - freeCompilerArgs += ["-d", "my/destination"] - } - } - - compileTestKotlinCommon{ - kotlinOptions { - languageVersion = 1.1 - apiVersion = 1.0 - freeCompilerArgs += ["-cp", "my/test/classpath"] - freeCompilerArgs += ["-d", "my/test/destination"] - } - } - - """ - ) - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isCommon) - Assert.assertEquals("my/classpath", (compilerArguments as K2MetadataCompilerArguments).classpath) - Assert.assertEquals("my/destination", (compilerArguments as K2MetadataCompilerArguments).destination) - } - - with(facetSettings("project_test")) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(platform.isCommon) - Assert.assertEquals("my/test/classpath", (compilerArguments as K2MetadataCompilerArguments).classpath) - Assert.assertEquals("my/test/destination", (compilerArguments as K2MetadataCompilerArguments).destination) - } - - val rootManager = ModuleRootManager.getInstance(getModule("project_main")) - val stdlib = rootManager.orderEntries.filterIsInstance().single().library - assertEquals(CommonLibraryKind, (stdlib as LibraryEx).kind) - - assertSameKotlinSdks("project_main", "project_test") - - Assert.assertEquals( - listOf("file:///src/main/kotlin" to SourceKotlinRootType, - "file:///src/main/resources" to ResourceKotlinRootType), - getSourceRootInfos("project_main") - ) - Assert.assertEquals( - listOf("file:///src/test/kotlin" to TestSourceKotlinRootType, - "file:///src/test/resources" to TestResourceKotlinRootType), - getSourceRootInfos("project_test") - ) - } - - @Test - fun testInternalArgumentsFacetImporting() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.50" - } - - compileKotlin { - kotlinOptions.freeCompilerArgs = ["-XXLanguage:+InlineClasses"] - kotlinOptions.languageVersion = "1.2" - } - """ - ) - importProject() - - // Version is indeed 1.2 - Assert.assertEquals(LanguageVersion.KOTLIN_1_2, facetSettings.languageLevel) - - // We haven't lost internal argument during importing to facet - Assert.assertEquals("-XXLanguage:+InlineClasses", facetSettings.compilerSettings?.additionalArguments) - - // Inline classes are enabled even though LV = 1.2 - Assert.assertEquals( - LanguageFeature.State.ENABLED, - getModule("project_main").languageVersionSettings.getFeatureSupport(LanguageFeature.InlineClasses) - ) - - assertAllModulesConfigured() - } - - @Test - fun testStableModuleNameWhileUsingGradle_JS() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50") - } - } - - apply plugin: 'kotlin2js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.50" - } - - """ - ) - importProject() - - checkStableModuleName("project_main", "project", JsPlatform, isProduction = true) - // Note "_test" suffix: this is current behavior of K2JS Compiler - checkStableModuleName("project_test", "project_test", JsPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testStableModuleNameWhileUsingGradle_JVM() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.50") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.50" - } - - compileKotlin { - kotlinOptions.languageVersion = "1.2" - } - """ - ) - importProject() - - checkStableModuleName("project_main", "project", JvmPlatform, isProduction = true) - checkStableModuleName("project_test", "project", JvmPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testNoFriendPathsAreShown() { - createProjectSubFile( - "build.gradle", """ - buildscript { - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.70-eap-4") - } - } - - apply plugin: 'kotlin' - - repositories { - mavenCentral() - maven { - url 'https://dl.bintray.com/kotlin/kotlin-dev' - } - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.70-eap-4" - } - """ - ) - importProject() - - Assert.assertEquals( - "-version", - testFacetSettings.compilerSettings!!.additionalArguments - ) - - assertAllModulesConfigured() - } - - @Test - fun testSharedLanguageVersion() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.60" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-js' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-jvm' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.2", holder.settings.languageVersion) - } - - @Test - fun testNonSharedLanguageVersion() { - createProjectSubFile( - "build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-common' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-common:1.2.60" - } - - compileKotlinCommon { - kotlinOptions.languageVersion = "1.1" - } - - """.trimIndent() - ) - createProjectSubFile( - "settings.gradle", - """ - rootProject.name = 'MultiTest' - include 'MultiTest-jvm', 'MultiTest-js' - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-js/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-js' - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - createProjectSubFile( - "MultiTest-jvm/build.gradle", - """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.60") - } - } - - apply plugin: 'kotlin-platform-jvm' - - sourceSets { - myMain { - kotlin { - srcDir 'src' - } - } - myTest { - kotlin { - srcDir 'test' - } - } - } - - repositories { - mavenCentral() - } - - dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.60" - implement project(":") - } - - """.trimIndent() - ) - - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.1", holder.settings.languageVersion) - } - - private fun checkStableModuleName(projectName: String, expectedName: String, platform: TargetPlatform, isProduction: Boolean) { - val module = getModule(projectName) - val moduleInfo = if (isProduction) module.productionSourceInfo() else module.testSourceInfo() - - val resolutionFacade = KotlinCacheService.getInstance(myProject).getResolutionFacadeByModuleInfo(moduleInfo!!, platform)!! - val moduleDescriptor = resolutionFacade.moduleDescriptor - - Assert.assertEquals("<$expectedName>", moduleDescriptor.stableName?.asString()) - } - - private fun assertAllModulesConfigured() { - runReadAction { - for (moduleGroup in ModuleSourceRootMap(myProject).groupByBaseModules(myProject.allModules())) { - val configurator = allConfigurators().find { - it.getStatus(moduleGroup) == ConfigureKotlinStatus.CAN_BE_CONFIGURED - } - Assert.assertNull("Configurator $configurator tells that ${moduleGroup.baseModule} can be configured", configurator) - } - } - } -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/baseDecompiler.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/baseDecompiler.kt.181 deleted file mode 100644 index 5bcc51cbe8e..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/internal/baseDecompiler.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2018 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.internal - -import org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler -import java.io.File - -/** - * `addSpace` method is deprecated in 182. `addSource` and `addLibrary` were introduced instead. - * BUNCH: 181 - */ -@Suppress("IncompatibleAPI") -fun BaseDecompiler.addSpaceEx(file: File, isOwn: Boolean) { - addSpace(file, isOwn) -} \ No newline at end of file diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JsIdePlatformKindTooling.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JsIdePlatformKindTooling.kt.181 deleted file mode 100644 index a92575f794c..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/JsIdePlatformKindTooling.kt.181 +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2010-2018 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.core.platform.impl - -import com.intellij.execution.PsiLocation -import com.intellij.execution.actions.ConfigurationContext -import com.intellij.execution.actions.RunConfigurationProducer -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.libraries.Library -import com.intellij.openapi.util.io.FileUtil -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.descriptors.ClassDescriptorWithResolutionScopes -import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -import org.jetbrains.kotlin.gradle.KotlinPlatform -import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JsCompilerArgumentsHolder -import org.jetbrains.kotlin.idea.framework.JSLibraryKind -import org.jetbrains.kotlin.idea.framework.JSLibraryStdDescription -import org.jetbrains.kotlin.idea.framework.JsLibraryStdDetectionUtil -import org.jetbrains.kotlin.idea.highlighter.KotlinTestRunLineMarkerContributor.Companion.getTestStateIcon -import org.jetbrains.kotlin.idea.js.KotlinJSRunConfigurationDataProvider -import org.jetbrains.kotlin.idea.platform.IdePlatformKindTooling -import org.jetbrains.kotlin.idea.util.string.joinWithEscape -import org.jetbrains.kotlin.js.resolve.JsAnalyzerFacade -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtFunction -import org.jetbrains.kotlin.psi.KtNamedDeclaration -import org.jetbrains.kotlin.psi.KtNamedFunction -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject -import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf -import org.jetbrains.kotlin.utils.PathUtil -import org.jetbrains.kotlin.utils.ifEmpty -import javax.swing.Icon - -class JsIdePlatformKindTooling : IdePlatformKindTooling() { - companion object { - private const val MAVEN_OLD_JS_STDLIB_ID = "kotlin-js-library" - - private val TEST_FQ_NAME = FqName("kotlin.test.Test") - private val IGNORE_FQ_NAME = FqName("kotlin.test.Ignore") - } - - override val kind = JsIdePlatformKind - - override fun compilerArgumentsForProject(project: Project) = Kotlin2JsCompilerArgumentsHolder.getInstance(project).settings - - override val resolverForModuleFactory = JsAnalyzerFacade - - override val mavenLibraryIds = listOf(PathUtil.JS_LIB_NAME, MAVEN_OLD_JS_STDLIB_ID) - override val gradlePluginId = "kotlin-platform-js" - override val gradlePlatformIds: List get() = listOf(KotlinPlatform.JS) - - override val libraryKind = JSLibraryKind - override fun getLibraryDescription(project: Project) = JSLibraryStdDescription(project) - - override fun getLibraryVersionProvider(project: Project) = { library: Library -> - JsLibraryStdDetectionUtil.getJsLibraryStdVersion(library, project) - } - - override fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon? { - if (!descriptor.isTest()) return null - - val contexts by lazy { computeConfigurationContexts(declaration) } - - val runConfigData = RunConfigurationProducer - .getProducers(declaration.project) - .asSequence() - .filterIsInstance>() - .filter { it.isForTests } - .flatMap { provider -> contexts.map { context -> provider.getConfigurationData(context) } } - .firstOrNull { it != null } ?: return null - - val locations = ArrayList() - - locations += FileUtil.toSystemDependentName(runConfigData.jsOutputFilePath) - - val klass = when (declaration) { - is KtClassOrObject -> declaration - is KtNamedFunction -> declaration.containingClassOrObject ?: return null - else -> return null - } - locations += klass.parentsWithSelf.filterIsInstance().mapNotNull { it.name }.toList().asReversed() - - val testName = (declaration as? KtNamedFunction)?.name - if (testName != null) { - locations += "$testName" - } - - val prefix = if (testName != null) "test://" else "suite://" - - val url = prefix + locations.joinWithEscape('.') - - return getTestStateIcon(url, declaration.project) - } - - override fun acceptsAsEntryPoint(function: KtFunction): Boolean { - val contexts by lazy { computeConfigurationContexts(function) } - - return RunConfigurationProducer - .getProducers(function.project) - .asSequence() - .filterIsInstance>() - .filter { !it.isForTests } - .flatMap { provider -> contexts.map { context -> provider.getConfigurationData(context) } } - .any { it != null } - } - - private fun computeConfigurationContexts(declaration: KtNamedDeclaration): Sequence { - return sequenceOf(ConfigurationContext(declaration)) - } - - private fun DeclarationDescriptor.isIgnored(): Boolean = - annotations.any { it.fqName == IGNORE_FQ_NAME } || ((containingDeclaration as? ClassDescriptor)?.isIgnored() ?: false) - - private fun DeclarationDescriptor.isTest(): Boolean { - if (isIgnored()) return false - - if (annotations.any { it.fqName == TEST_FQ_NAME }) return true - if (this is ClassDescriptorWithResolutionScopes) { - return declaredCallableMembers.any { it.isTest() } - } - return false - } -} \ No newline at end of file diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/jvmMppUtils.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/jvmMppUtils.kt.181 deleted file mode 100644 index c0ea875cfc6..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/jvmMppUtils.kt.181 +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2010-2018 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.run - -import com.intellij.openapi.module.Module -import org.jetbrains.kotlin.idea.caches.project.implementingModules -import org.jetbrains.kotlin.idea.project.platform -import org.jetbrains.kotlin.platform.impl.isCommon -import org.jetbrains.kotlin.platform.impl.isJvm - -fun Module.asJvmModule(): Module? { - if (platform.isJvm) return this - - if (platform.isCommon) { - return implementingModules.firstOrNull { it.platform.isJvm } - } - return null -} - diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/multiplatform/KotlinMultiplatformRunLocationsProvider.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/multiplatform/KotlinMultiplatformRunLocationsProvider.kt.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/KtScratchFileCreationHelper.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/KtScratchFileCreationHelper.kt.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/scratchRunnerUtil.kt.181 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/scratchRunnerUtil.kt.181 deleted file mode 100644 index 6cb39bc6f70..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/scratchRunnerUtil.kt.181 +++ /dev/null @@ -1,13 +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.scratch - -import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VirtualFile - -fun isScratchChanged(project: Project, file: VirtualFile) : Boolean { - return true -} \ No newline at end of file diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.181 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.181 deleted file mode 100644 index 4c235cac0e3..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/KotlinLightCodeInsightFixtureTestCaseBase.java.181 +++ /dev/null @@ -1,42 +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.test; - -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.project.Project; -import com.intellij.psi.PsiFile; -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; -import org.jetbrains.annotations.NotNull; - -public abstract class KotlinLightCodeInsightFixtureTestCaseBase extends LightCodeInsightFixtureTestCase { - @NotNull - @Override - public Project getProject() { - return super.getProject(); - } - - @NotNull - @Override - public Editor getEditor() { - return super.getEditor(); - } - - @Override - public PsiFile getFile() { - return super.getFile(); - } -} diff --git a/idea/kotlin-gradle-tooling/build.gradle.kts.181 b/idea/kotlin-gradle-tooling/build.gradle.kts.181 deleted file mode 100644 index 4cf63a4542f..00000000000 --- a/idea/kotlin-gradle-tooling/build.gradle.kts.181 +++ /dev/null @@ -1,21 +0,0 @@ - -description = "Kotlin Gradle Tooling support" - -plugins { - kotlin("jvm") - id("jps-compatible") -} - -dependencies { - compile(kotlinStdlib()) - compile(project(":compiler:cli-common")) - compile(intellijPluginDep("gradle")) - compileOnly(intellijDep()) { includeJars("slf4j-api-1.7.10") } -} - -sourceSets { - "main" { projectDefault() } - "test" {} -} - -runtimeJar() diff --git a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 b/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 deleted file mode 100644 index db79341fe22..00000000000 --- a/idea/kotlin-gradle-tooling/src/KotlinMPPGradleModelBuilder.kt.181 +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 2010-2018 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.gradle - -import org.gradle.api.Named -import org.gradle.api.NamedDomainObjectContainer -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.Dependency -import org.gradle.api.artifacts.component.ProjectComponentIdentifier -import org.gradle.api.file.FileCollection -import org.gradle.api.file.SourceDirectorySet -import org.gradle.api.logging.Logging -import org.gradle.api.provider.Property -import org.jetbrains.kotlin.gradle.KotlinMPPGradleModel.Companion.NO_KOTLIN_NATIVE_HOME -import org.jetbrains.plugins.gradle.model.* -import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder -import org.jetbrains.plugins.gradle.tooling.ModelBuilderService -import org.jetbrains.plugins.gradle.tooling.util.DependencyResolver -import org.jetbrains.plugins.gradle.tooling.util.DependencyResolverImpl -import org.jetbrains.plugins.gradle.tooling.util.SourceSetCachedFinder -import java.io.File -import java.lang.reflect.Method - -class KotlinMPPGradleModelBuilder : ModelBuilderService { - override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { - return ErrorMessageBuilder - .create(project, e, "Gradle import errors") - .withDescription("Unable to build Kotlin project configuration") - } - - override fun canBuild(modelName: String?): Boolean { - return modelName == KotlinMPPGradleModel::class.java.name - } - - override fun buildAll(modelName: String, project: Project): Any? { - val dependencyResolver = DependencyResolverImpl( - project, - false, - false, - true, - SourceSetCachedFinder(project) - ) - val sourceSets = buildSourceSets(dependencyResolver, project) ?: return null - val sourceSetMap = sourceSets.map { it.name to it }.toMap() - val targets = buildTargets(sourceSetMap, dependencyResolver, project) ?: return null - computeSourceSetsDeferredInfo(sourceSets, targets) - val coroutinesState = getCoroutinesState(project) - reportUnresolvedDependencies(targets) - val kotlinNativeHome = KotlinNativeHomeEvaluator.getKotlinNativeHome(project) ?: NO_KOTLIN_NATIVE_HOME - return KotlinMPPGradleModelImpl(sourceSetMap, targets, ExtraFeaturesImpl(coroutinesState), kotlinNativeHome) - } - - private fun reportUnresolvedDependencies(targets: Collection) { - targets - .asSequence() - .flatMap { it.compilations.asSequence() } - .flatMap { it.dependencies.asSequence() } - .mapNotNull { (it as? UnresolvedExternalDependency)?.failureMessage } - .toSet() - .forEach { logger.warn(it) } - } - - private fun getCoroutinesState(project: Project): String? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getExperimental = kotlinExt.javaClass.getMethodOrNull("getExperimental") ?: return null - val experimentalExt = getExperimental(kotlinExt) ?: return null - val getCoroutines = experimentalExt.javaClass.getMethodOrNull("getCoroutines") ?: return null - return getCoroutines(experimentalExt) as? String - } - - private fun buildSourceSets(dependencyResolver: DependencyResolver, project: Project): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getSourceSets = kotlinExt.javaClass.getMethodOrNull("getSourceSets") ?: return null - @Suppress("UNCHECKED_CAST") - val sourceSets = - (getSourceSets(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - return sourceSets.mapNotNull { buildSourceSet(it, dependencyResolver, project) } - } - - private fun buildSourceSet( - gradleSourceSet: Named, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinSourceSetImpl? { - val sourceSetClass = gradleSourceSet.javaClass - val getLanguageSettings = sourceSetClass.getMethodOrNull("getLanguageSettings") ?: return null - val getSourceDirSet = sourceSetClass.getMethodOrNull("getKotlin") ?: return null - val getResourceDirSet = sourceSetClass.getMethodOrNull("getResources") ?: return null - val getDependsOn = sourceSetClass.getMethodOrNull("getDependsOn") ?: return null - val languageSettings = getLanguageSettings(gradleSourceSet)?.let { buildLanguageSettings(it) } ?: return null - val sourceDirs = (getSourceDirSet(gradleSourceSet) as? SourceDirectorySet)?.srcDirs ?: emptySet() - val resourceDirs = (getResourceDirSet(gradleSourceSet) as? SourceDirectorySet)?.srcDirs ?: emptySet() - val dependencies = buildSourceSetDependencies(gradleSourceSet, dependencyResolver, project) - @Suppress("UNCHECKED_CAST") - val dependsOnSourceSets = (getDependsOn(gradleSourceSet) as? Set)?.mapTo(LinkedHashSet()) { it.name } ?: emptySet() - return KotlinSourceSetImpl(gradleSourceSet.name, languageSettings, sourceDirs, resourceDirs, dependencies, dependsOnSourceSets) - } - - private fun buildLanguageSettings(gradleLanguageSettings: Any): KotlinLanguageSettings? { - val languageSettingsClass = gradleLanguageSettings.javaClass - val getLanguageVersion = languageSettingsClass.getMethodOrNull("getLanguageVersion") ?: return null - val getApiVersion = languageSettingsClass.getMethodOrNull("getApiVersion") ?: return null - val getProgressiveMode = languageSettingsClass.getMethodOrNull("getProgressiveMode") ?: return null - val getEnabledLanguageFeatures = languageSettingsClass.getMethodOrNull("getEnabledLanguageFeatures") ?: return null - val getExperimentalAnnotationsInUse = languageSettingsClass.getMethodOrNull("getExperimentalAnnotationsInUse") - val getCompilerPluginArguments = languageSettingsClass.getMethodOrNull("getCompilerPluginArguments") - val getCompilerPluginClasspath = languageSettingsClass.getMethodOrNull("getCompilerPluginClasspath") - @Suppress("UNCHECKED_CAST") - return KotlinLanguageSettingsImpl( - getLanguageVersion(gradleLanguageSettings) as? String, - getApiVersion(gradleLanguageSettings) as? String, - getProgressiveMode(gradleLanguageSettings) as? Boolean ?: false, - getEnabledLanguageFeatures(gradleLanguageSettings) as? Set ?: emptySet(), - getExperimentalAnnotationsInUse?.invoke(gradleLanguageSettings) as? Set ?: emptySet(), - getCompilerPluginArguments?.invoke(gradleLanguageSettings) as? List ?: emptyList(), - (getCompilerPluginClasspath?.invoke(gradleLanguageSettings) as? FileCollection)?.files ?: emptySet() - ) - } - - private fun buildDependencies( - dependencyHolder: Any, - dependencyResolver: DependencyResolver, - configurationNameAccessor: String, - scope: String, - project: Project - ): Collection { - val dependencyHolderClass = dependencyHolder.javaClass - val getConfigurationName = dependencyHolderClass.getMethodOrNull(configurationNameAccessor) ?: return emptyList() - val configurationName = getConfigurationName(dependencyHolder) as? String ?: return emptyList() - val configuration = project.configurations.findByName(configurationName) ?: return emptyList() - if (!configuration.isCanBeResolved) return emptyList() - - val dependencyAdjuster = DependencyAdjuster(configuration, scope, project) - - val resolvedDependencies = dependencyResolver - .resolveDependencies(configuration) - .apply { - forEach { (it as? AbstractExternalDependency)?.scope = scope } - } - .flatMap(dependencyAdjuster::adjustDependency) - val singleDependencyFiles = resolvedDependencies.mapNotNullTo(LinkedHashSet()) { - (it as? FileCollectionDependency)?.files?.singleOrNull() - } - // Workaround for duplicated dependencies specified as a file collection (KT-26675) - // Drop this code when the issue is fixed in the platform - return resolvedDependencies.filter { dependency -> - if (dependency !is FileCollectionDependency) return@filter true - val files = dependency.files - if (files.size <= 1) return@filter true - (files.any { it !in singleDependencyFiles }) - } - } - - private fun buildTargets( - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): Collection? { - return project.getTargets()?.mapNotNull { buildTarget(it, sourceSetMap, dependencyResolver, project) } - } - - private fun buildTarget( - gradleTarget: Named, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinTarget? { - val targetClass = gradleTarget.javaClass - val getPlatformType = targetClass.getMethodOrNull("getPlatformType") ?: return null - val getCompilations = targetClass.getMethodOrNull("getCompilations") ?: return null - val getDisambiguationClassifier = targetClass.getMethodOrNull("getDisambiguationClassifier") ?: return null - val platformId = (getPlatformType.invoke(gradleTarget) as? Named)?.name ?: return null - val platform = KotlinPlatform.byId(platformId) ?: return null - val disambiguationClassifier = getDisambiguationClassifier(gradleTarget) as? String - @Suppress("UNCHECKED_CAST") - val gradleCompilations = - (getCompilations.invoke(gradleTarget) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - val compilations = gradleCompilations.mapNotNull { - buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project) - } - val jar = buildTargetJar(gradleTarget, project) - val target = KotlinTargetImpl(gradleTarget.name, null, disambiguationClassifier, platform, compilations, jar) - compilations.forEach { - it.disambiguationClassifier = target.disambiguationClassifier - it.platform = target.platform - } - return target - } - - private fun buildTargetJar(gradleTarget: Named, project: Project): KotlinTargetJar? { - val targetClass = gradleTarget.javaClass - val getArtifactsTaskName = targetClass.getMethodOrNull("getArtifactsTaskName") ?: return null - val artifactsTaskName = getArtifactsTaskName(gradleTarget) as? String ?: return null - val jarTask = project.tasks.findByName(artifactsTaskName) ?: return null - val jarTaskClass = jarTask.javaClass - val getArchivePath = jarTaskClass.getMethodOrNull("getArchivePath") - val archiveFile = getArchivePath?.invoke(jarTask) as? File? - return KotlinTargetJarImpl(archiveFile) - } - - private fun buildCompilation( - gradleCompilation: Named, - classifier: String?, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): KotlinCompilationImpl? { - val compilationClass = gradleCompilation.javaClass - val getKotlinSourceSets = compilationClass.getMethodOrNull("getKotlinSourceSets") ?: return null - @Suppress("UNCHECKED_CAST") - val kotlinGradleSourceSets = (getKotlinSourceSets(gradleCompilation) as? Collection) ?: return null - val kotlinSourceSets = kotlinGradleSourceSets.mapNotNull { sourceSetMap[it.name] } - val getCompileKotlinTaskName = compilationClass.getMethodOrNull("getCompileKotlinTaskName") ?: return null - @Suppress("UNCHECKED_CAST") - val compileKotlinTaskName = (getCompileKotlinTaskName(gradleCompilation) as? String) ?: return null - val compileKotlinTask = project.tasks.findByName(compileKotlinTaskName) ?: return null - val output = buildCompilationOutput(gradleCompilation, compileKotlinTask) ?: return null - val arguments = buildCompilationArguments(compileKotlinTask) ?: return null - val dependencyClasspath = buildDependencyClasspath(compileKotlinTask) - val dependencies = buildCompilationDependencies(gradleCompilation, classifier, sourceSetMap, dependencyResolver, project) - return KotlinCompilationImpl(gradleCompilation.name, kotlinSourceSets, dependencies, output, arguments, dependencyClasspath) - } - - private fun buildCompilationDependencies( - gradleCompilation: Named, - classifier: String?, - sourceSetMap: Map, - dependencyResolver: DependencyResolver, - project: Project - ): Set { - return LinkedHashSet().apply { - this += buildDependencies( - gradleCompilation, dependencyResolver, "getCompileDependencyConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleCompilation, dependencyResolver, "getRuntimeDependencyConfigurationName", "RUNTIME", project - ) - this += sourceSetMap[compilationFullName(gradleCompilation.name, classifier)]?.dependencies ?: emptySet() - } - } - - private fun buildSourceSetDependencies( - gradleSourceSet: Named, - dependencyResolver: DependencyResolver, - project: Project - ): Set { - return LinkedHashSet().apply { - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getApiMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getImplementationMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getCompileOnlyMetadataConfigurationName", "COMPILE", project - ) - this += buildDependencies( - gradleSourceSet, dependencyResolver, "getRuntimeOnlyMetadataConfigurationName", "RUNTIME", project - ) - } - } - - @Suppress("UNCHECKED_CAST") - private fun safelyGetArguments(compileKotlinTask: Task, accessor: Method?) = try { - accessor?.invoke(compileKotlinTask) as? List - } catch (e: Exception) { - logger.info(e.message ?: "Unexpected exception: $e", e) - null - } ?: emptyList() - - private fun buildCompilationArguments(compileKotlinTask: Task): KotlinCompilationArguments? { - val compileTaskClass = compileKotlinTask.javaClass - val getCurrentArguments = compileTaskClass.getMethodOrNull("getSerializedCompilerArguments") - val getDefaultArguments = compileTaskClass.getMethodOrNull("getDefaultSerializedCompilerArguments") - val currentArguments = safelyGetArguments(compileKotlinTask, getCurrentArguments) - val defaultArguments = safelyGetArguments(compileKotlinTask, getDefaultArguments) - return KotlinCompilationArgumentsImpl(defaultArguments, currentArguments) - } - - private fun buildDependencyClasspath(compileKotlinTask: Task): List { - val abstractKotlinCompileClass = - compileKotlinTask.javaClass.classLoader.loadClass(AbstractKotlinGradleModelBuilder.ABSTRACT_KOTLIN_COMPILE_CLASS) - val getCompileClasspath = - abstractKotlinCompileClass.getDeclaredMethodOrNull("getCompileClasspath") ?: return emptyList() - @Suppress("UNCHECKED_CAST") - return (getCompileClasspath(compileKotlinTask) as? Collection)?.map { it.path } ?: emptyList() - } - - private fun buildCompilationOutput( - gradleCompilation: Named, - compileKotlinTask: Task - ): KotlinCompilationOutput? { - val compilationClass = gradleCompilation.javaClass - val getOutput = compilationClass.getMethodOrNull("getOutput") ?: return null - val gradleOutput = getOutput(gradleCompilation) ?: return null - val gradleOutputClass = gradleOutput.javaClass - val getClassesDirs = gradleOutputClass.getMethodOrNull("getClassesDirs") ?: return null - val getResourcesDir = gradleOutputClass.getMethodOrNull("getResourcesDir") ?: return null - val compileKotlinTaskClass = compileKotlinTask.javaClass - val getDestinationDir = compileKotlinTaskClass.getMethodOrNull("getDestinationDir") - val getOutputFile = compileKotlinTaskClass.getMethodOrNull("getOutputFile") - val classesDirs = getClassesDirs(gradleOutput) as? FileCollection ?: return null - val resourcesDir = getResourcesDir(gradleOutput) as? File ?: return null - val destinationDir = - getDestinationDir?.invoke(compileKotlinTask) as? File - //TODO: Hack for KotlinNativeCompile - ?: (getOutputFile?.invoke(compileKotlinTask) as? Property)?.orNull?.parentFile - ?: return null - return KotlinCompilationOutputImpl(classesDirs.files, destinationDir, resourcesDir) - } - - private fun computeSourceSetsDeferredInfo( - sourceSets: Collection, - targets: Collection - ) { - val sourceSetToCompilations = LinkedHashMap>() - for (target in targets) { - for (compilation in target.compilations) { - for (sourceSet in compilation.sourceSets) { - sourceSetToCompilations.getOrPut(sourceSet) { LinkedHashSet() } += compilation - } - } - } - for (sourceSet in sourceSets) { - val name = sourceSet.name - if (name == KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) { - sourceSet.platform = KotlinPlatform.COMMON - sourceSet.isTestModule = false - continue - } - if (name == KotlinSourceSet.COMMON_TEST_SOURCE_SET_NAME) { - sourceSet.platform = KotlinPlatform.COMMON - sourceSet.isTestModule = true - continue - } - - val compilations = sourceSetToCompilations[sourceSet] - if (compilations != null) { - sourceSet.platform = compilations.map { it.platform }.distinct().singleOrNull() ?: KotlinPlatform.COMMON - sourceSet.isTestModule = compilations.all { it.isTestModule } - } else { - // TODO: change me after design about it - sourceSet.isTestModule = "Test" in sourceSet.name - } - } - } - - private class DependencyAdjuster( - private val configuration: Configuration, - private val scope: String, - private val project: Project - ) { - private val adjustmentMap = HashMap>() - - val dependenciesByProjectPath by lazy { - configuration - .resolvedConfiguration - .lenientConfiguration - .allModuleDependencies - .mapNotNull { dependency -> - val artifact = dependency.moduleArtifacts.firstOrNull { - it.id.componentIdentifier is ProjectComponentIdentifier - } ?: return@mapNotNull null - dependency to artifact - } - .groupBy { (it.second.id.componentIdentifier as ProjectComponentIdentifier).projectPath } - } - - private fun wrapDependency(dependency: ExternalProjectDependency, newConfigurationName: String): ExternalProjectDependency { - return DefaultExternalProjectDependency(dependency).apply { - this.configurationName = newConfigurationName - - val nestedDependencies = this.dependencies.flatMap(::adjustDependency) - this.dependencies.clear() - this.dependencies.addAll(nestedDependencies) - } - } - - fun adjustDependency(dependency: ExternalDependency): List { - return adjustmentMap.getOrPut(dependency) { - if (dependency !is ExternalProjectDependency - || dependency.configurationName != Dependency.DEFAULT_CONFIGURATION - ) return@getOrPut listOf(dependency) - val artifacts = dependenciesByProjectPath[dependency.projectPath] ?: return@getOrPut listOf(dependency) - val artifactConfiguration = artifacts.mapTo(LinkedHashSet()) { - it.first.configuration - }.singleOrNull() ?: return@getOrPut listOf(dependency) - val taskGetterName = when (scope) { - "COMPILE" -> "getApiElementsConfigurationName" - "RUNTIME" -> "getRuntimeElementsConfigurationName" - else -> return@getOrPut listOf(dependency) - } - val dependencyProject = - if (project.rootProject.path == dependency.projectPath) - project.rootProject - else - project.rootProject.getChildProjectByPath(dependency.projectPath) - - val targets = dependencyProject?.getTargets() ?: return@getOrPut listOf(dependency) - val gradleTarget = targets.firstOrNull { - val getter = it.javaClass.getMethodOrNull(taskGetterName) ?: return@firstOrNull false - getter(it) == artifactConfiguration - } ?: return@getOrPut listOf(dependency) - val classifier = gradleTarget.javaClass.getMethodOrNull("getDisambiguationClassifier")?.invoke(gradleTarget) as? String - ?: return@getOrPut listOf(dependency) - val platformDependency = if (classifier != KotlinTarget.METADATA_TARGET_NAME) { - wrapDependency(dependency, compilationFullName(KotlinCompilation.MAIN_COMPILATION_NAME, classifier)) - } else null - val commonDependency = wrapDependency(dependency, KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME) - return if (platformDependency != null) listOf(platformDependency, commonDependency) else listOf(commonDependency) - } - } - } - - companion object { - private val logger = Logging.getLogger(KotlinMPPGradleModelBuilder::class.java) - - fun Project.getTargets(): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getTargets = kotlinExt.javaClass.getMethodOrNull("getTargets") ?: return null - @Suppress("UNCHECKED_CAST") - return (getTargets.invoke(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() - } - } -} - -private fun Project.getChildProjectByPath(path: String): Project? { - var project = this - for (name in path.split(":").asSequence().drop(1)) { - project = project.childProjects[name] ?: return null - } - return project -} - -private fun Project.getTargets(): Collection? { - val kotlinExt = project.extensions.findByName("kotlin") ?: return null - val getTargets = kotlinExt.javaClass.getMethodOrNull("getTargets") ?: return null - @Suppress("UNCHECKED_CAST") - return (getTargets.invoke(kotlinExt) as? NamedDomainObjectContainer)?.asMap?.values ?: emptyList() -} \ No newline at end of file diff --git a/idea/resources/META-INF/git4idea.xml.181 b/idea/resources/META-INF/git4idea.xml.181 deleted file mode 100644 index 1bb24d148a3..00000000000 --- a/idea/resources/META-INF/git4idea.xml.181 +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/idea/resources/META-INF/gradle-java.xml.181 b/idea/resources/META-INF/gradle-java.xml.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/resources/META-INF/gradle.xml.181 b/idea/resources/META-INF/gradle.xml.181 deleted file mode 100644 index 91219dffb19..00000000000 --- a/idea/resources/META-INF/gradle.xml.181 +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/jvm.xml.181 b/idea/resources/META-INF/jvm.xml.181 deleted file mode 100644 index f3944ae13db..00000000000 --- a/idea/resources/META-INF/jvm.xml.181 +++ /dev/null @@ -1,192 +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.ui.ScratchFileHook - - - org.jetbrains.kotlin.idea.scratch.ScratchFileModuleInfoProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/plugin.xml.181 b/idea/resources/META-INF/plugin.xml.181 deleted file mode 100644 index c5d35c6ddbf..00000000000 --- a/idea/resources/META-INF/plugin.xml.181 +++ /dev/null @@ -1,74 +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.remoteServers - - - org.jetbrains.kotlin.native.platform.deps - - JUnit - org.jetbrains.plugins.gradle - 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.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - org.jetbrains.kotlin.idea.caches.ProjectRootModificationTrackerFixer - - - - - - - - - - - - - - -
diff --git a/idea/resources/org/jetbrains/kotlin/idea/icons/kotlin_gradle_script.png.181 b/idea/resources/org/jetbrains/kotlin/idea/icons/kotlin_gradle_script.png.181 deleted file mode 100644 index 4ee5ed4c31dc39033df36f348cc7793701e4e211..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 460 zcmV;-0WxJ6$%6zvVjH4$wyMV5URld$;Ja9 zzXQbzfozx;>OtWGbHRUP+o78GBiRN5j!;AP!@LIMGqM0RBP&Wo3NQgQU&KRQ;)pEB zLMWa=w&0Uz0Xq2u&=oK~$bX8^I0uD`0N=X*@Br5Nd5vM+qi_cPzn@_07ce0u5)e=T z8rA@`^#aJxpeTi@#HN|E>QN%LXapr7MUcxt9FPlun)hSVj4L6*QsO}nb2w*@3rFq0AaDSelJNBgoLU-@tfOLO z@>F6-^ae<;{D{Er)#3`AJN+JbgW%f^gfUEYQcfNM1ji3!ub0O5LL(GNEbpjZ0~`oa z2>^HzE~iFvjR1+rAy<$*Cq3pw)fxf-N68L286CZ?S#qTUcjG zI!l1OFIm8At_=oAgwz*I^K}(+M%l1(n(>DpU>xVQM2xE=B=7aIZ8HCykICsF7-wF* zWhwx3q+(QoNB5fW+|yKOVOM1STjUh*Ese+YJgE~FD8_;D56|{N&hSFFGw{B}NGIul zfu;hs;)%pg2nm=^^PVg(>;t|uS#!OPQ}8g;%lDrOfYj}@dL?VCU$&f4?|L2-AvC^` z2ZxmHUDki{?pw-D?L4fix#wf+e9+6Vm8Jsq@rKm9H1NKS`#>jf$(0pNMx8`Jow403 zc-J(fR{UgX#fj6<41pB9s}mAH!?ILVq_VGfLNPcu4Q(qIZbyYQa0FiK)WzW62#^Ya zWQ=m)D7_1K(n?m9$_}J67vZcw`g+Zl;nBd1S{~ZM$v5#bory$CDg3nRvI79PN&t_C zR1=cb6K};tV#;+JV!-uD`He(2MP8icBe-a|5MjWrB(j1SM{vqSB%lQ&`T;mgqNhm~ w+uP>wXCo4TcWqmkm|68p<_P|!#D@R_0F+Ap$=F%Xt^fc407*qoM6N<$g4G#Es{jB1 diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.181 b/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.181 deleted file mode 100644 index 2bf704fc118..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/actions/JavaToKotlinAction.kt.181 +++ /dev/null @@ -1,243 +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.actions - -import com.intellij.codeInsight.navigation.NavigationUtil -import com.intellij.ide.highlighter.JavaFileType -import com.intellij.ide.scratch.ScratchFileService -import com.intellij.ide.scratch.ScratchRootType -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.command.CommandProcessor -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.fileEditor.FileEditorManager -import com.intellij.openapi.progress.ProgressManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.MessageType -import com.intellij.openapi.ui.Messages -import com.intellij.openapi.ui.ex.MessagesEx -import com.intellij.openapi.ui.popup.JBPopupFactory -import com.intellij.openapi.vfs.VfsUtilCore -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.vfs.VirtualFileVisitor -import com.intellij.openapi.wm.WindowManager -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiErrorElement -import com.intellij.psi.PsiJavaFile -import com.intellij.psi.PsiManager -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.j2k.IdeaJavaToKotlinServices -import org.jetbrains.kotlin.idea.j2k.JavaToKotlinConverterFactory -import org.jetbrains.kotlin.idea.refactoring.toPsiFile -import org.jetbrains.kotlin.idea.util.application.executeWriteCommand -import org.jetbrains.kotlin.idea.util.application.progressIndicatorNullable -import org.jetbrains.kotlin.idea.util.application.runReadAction -import org.jetbrains.kotlin.j2k.ConverterSettings -import org.jetbrains.kotlin.j2k.FilesResult -import org.jetbrains.kotlin.psi.KtFile -import java.io.File -import java.io.IOException -import java.util.* - -class JavaToKotlinAction : AnAction() { - companion object { - private fun uniqueKotlinFileName(javaFile: VirtualFile): String { - val ioFile = File(javaFile.path.replace('/', File.separatorChar)) - - var i = 0 - while (true) { - val fileName = javaFile.nameWithoutExtension + (if (i > 0) i else "") + ".kt" - if (!ioFile.resolveSibling(fileName).exists()) return fileName - i++ - } - } - - val title = "Convert Java to Kotlin" - - private fun saveResults(javaFiles: List, convertedTexts: List): List { - val result = ArrayList() - for ((psiFile, text) in javaFiles.zip(convertedTexts)) { - try { - val document = PsiDocumentManager.getInstance(psiFile.project).getDocument(psiFile) - if (document == null) { - MessagesEx.error(psiFile.project, "Failed to save conversion result: couldn't find document for " + psiFile.name).showLater() - continue - } - document.replaceString(0, document.textLength, text) - FileDocumentManager.getInstance().saveDocument(document) - - val virtualFile = psiFile.virtualFile - if (ScratchRootType.getInstance().containsFile(virtualFile)) { - val mapping = ScratchFileService.getInstance().scratchesMapping - mapping.setMapping(virtualFile, KotlinFileType.INSTANCE.language) - } - else { - val fileName = uniqueKotlinFileName(virtualFile) - virtualFile.rename(this, fileName) - } - } - catch (e: IOException) { - MessagesEx.error(psiFile.project, e.message ?: "").showLater() - } - } - return result - } - - fun convertFiles( - javaFiles: List, project: Project, - enableExternalCodeProcessing: Boolean = true, - askExternalCodeProcessing: Boolean = true - ): List { - var converterResult: FilesResult? = null - fun convert() { - val converter = - JavaToKotlinConverterFactory.createJavaToKotlinConverter( - project, - ConverterSettings.defaultSettings, - IdeaJavaToKotlinServices - ) - converterResult = converter.filesToKotlin( - javaFiles, - JavaToKotlinConverterFactory.createPostProcessor(formatCode = true), - ProgressManager.getInstance().progressIndicatorNullable!! - ) - } - - - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously( - ::convert, - title, - true, - project)) return emptyList() - - - var externalCodeUpdate: (() -> Unit)? = null - - if (enableExternalCodeProcessing && converterResult!!.externalCodeProcessing != null) { - val question = "Some code in the rest of your project may require corrections after performing this conversion. Do you want to find such code and correct it too?" - if (!askExternalCodeProcessing || (Messages.showYesNoDialog(project, question, title, Messages.getQuestionIcon()) == Messages.YES)) { - ProgressManager.getInstance().runProcessWithProgressSynchronously( - { - runReadAction { - externalCodeUpdate = converterResult!!.externalCodeProcessing!!.prepareWriteOperation( - ProgressManager.getInstance().progressIndicatorNullable!! - ) - } - }, - title, - true, - project) - } - } - - return project.executeWriteCommand("Convert files from Java to Kotlin", null) { - CommandProcessor.getInstance().markCurrentCommandAsGlobal(project) - - val newFiles = saveResults(javaFiles, converterResult!!.results) - - externalCodeUpdate?.invoke() - - PsiDocumentManager.getInstance(project).commitAllDocuments() - - newFiles.singleOrNull()?.let { - FileEditorManager.getInstance(project).openFile(it, true) - } - - newFiles.map { it.toPsiFile(project) as KtFile } - } - } - } - - override fun actionPerformed(e: AnActionEvent) { - val javaFiles = selectedJavaFiles(e).filter { it.isWritable }.toList() - val project = CommonDataKeys.PROJECT.getData(e.dataContext)!! - - if (javaFiles.isEmpty()) { - val statusBar = WindowManager.getInstance().getStatusBar(project) - JBPopupFactory.getInstance() - .createHtmlTextBalloonBuilder("Nothing to convert:
No writable Java files found", MessageType.ERROR, null) - .createBalloon() - .showInCenterOf(statusBar.component) - } - - val firstSyntaxError = javaFiles.asSequence().map { PsiTreeUtil.findChildOfType(it, PsiErrorElement::class.java) }.firstOrNull() - - if (firstSyntaxError != null) { - val count = javaFiles.filter { PsiTreeUtil.hasErrorElements(it) }.count() - val question = firstSyntaxError.containingFile.name + - (if (count > 1) " and ${count - 1} more Java files" else " file") + - " contain syntax errors, the conversion result may be incorrect" - - val okText = "Investigate Errors" - val cancelText = "Proceed with Conversion" - if (Messages.showOkCancelDialog( - project, - question, - title, - okText, - cancelText, - Messages.getWarningIcon() - ) == Messages.OK) { - NavigationUtil.activateFileWithPsiElement(firstSyntaxError.navigationElement) - return - } - } - - convertFiles(javaFiles, project) - } - - override fun update(e: AnActionEvent) { - val virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY) ?: return - val project = e.project ?: return - - e.presentation.isEnabled = isAnyJavaFileSelected(project, virtualFiles) - } - - private fun isAnyJavaFileSelected(project: Project, files: Array): Boolean { - if (files.any { it.isDirectory }) return true // Giving up on directories - val manager = PsiManager.getInstance(project) - return files.any { it.extension == JavaFileType.DEFAULT_EXTENSION && manager.findFile(it) is PsiJavaFile && it.isWritable } - } - - private fun selectedJavaFiles(e: AnActionEvent): Sequence { - val virtualFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY) ?: return sequenceOf() - val project = e.project ?: return sequenceOf() - return allJavaFiles(virtualFiles, project) - } - - private fun allJavaFiles(filesOrDirs: Array, project: Project): Sequence { - val manager = PsiManager.getInstance(project) - return allFiles(filesOrDirs) - .asSequence() - .mapNotNull { manager.findFile(it) as? PsiJavaFile } - } - - private fun allFiles(filesOrDirs: Array): Collection { - val result = ArrayList() - for (file in filesOrDirs) { - VfsUtilCore.visitChildrenRecursively(file, object : VirtualFileVisitor() { - override fun visitFile(file: VirtualFile): Boolean { - result.add(file) - return true - } - }) - } - return result - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/QuickFixFactoryCompatibility.kt.181 b/idea/src/org/jetbrains/kotlin/idea/inspections/QuickFixFactoryCompatibility.kt.181 deleted file mode 100644 index 6bdccec7687..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/QuickFixFactoryCompatibility.kt.181 +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2018 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.inspections - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.codeInsight.intention.QuickFixFactory -import com.intellij.openapi.project.Project - -fun createAddToDependencyInjectionAnnotationsFix(project: Project, fqName: String): IntentionAction { - return QuickFixFactory.getInstance().createAddToDependencyInjectionAnnotationsFix(project, fqName, "declarations") -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/js/jsUtils.kt.181 b/idea/src/org/jetbrains/kotlin/idea/js/jsUtils.kt.181 deleted file mode 100644 index a9792ab6613..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/js/jsUtils.kt.181 +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.js - -import com.intellij.openapi.module.Module -import com.intellij.openapi.roots.CompilerModuleExtension -import org.jetbrains.jps.util.JpsPathUtil -import org.jetbrains.kotlin.analyzer.common.CommonPlatform -import org.jetbrains.kotlin.idea.caches.project.implementingModules -import org.jetbrains.kotlin.idea.facet.KotlinFacet -import org.jetbrains.kotlin.idea.framework.isGradleModule -import org.jetbrains.kotlin.idea.project.TargetPlatformDetector -import org.jetbrains.kotlin.js.resolve.JsPlatform -import org.jetbrains.plugins.gradle.settings.GradleSystemRunningSettings - -val Module.jsTestOutputFilePath: String? - get() { - KotlinFacet.get(this)?.configuration?.settings?.testOutputPath?.let { return it } - - if (!shouldUseJpsOutput) return null - - val compilerExtension = CompilerModuleExtension.getInstance(this) - val outputDir = compilerExtension?.compilerOutputUrlForTests ?: return null - return JpsPathUtil.urlToPath("$outputDir/${name}_test.js") - } - -val Module.jsProductionOutputFilePath: String? - get() { - KotlinFacet.get(this)?.configuration?.settings?.productionOutputPath?.let { return it } - - if (!shouldUseJpsOutput) return null - - val compilerExtension = CompilerModuleExtension.getInstance(this) - val outputDir = compilerExtension?.compilerOutputUrl ?: return null - return JpsPathUtil.urlToPath("$outputDir/$name.js") - } - -fun Module.asJsModule(): Module? = when (TargetPlatformDetector.getPlatform(this)) { - is CommonPlatform -> implementingModules.firstOrNull { TargetPlatformDetector.getPlatform(it) is JsPlatform } - is JsPlatform -> this - else -> null -} - -val Module.shouldUseJpsOutput: Boolean - get() = !(isGradleModule() && GradleSystemRunningSettings.getInstance().isUseGradleAwareMake) \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/jvm/KotlinDeclarationSearcher.kt.181 b/idea/src/org/jetbrains/kotlin/idea/jvm/KotlinDeclarationSearcher.kt.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinAddOrderEntryActionFactory.kt.181 b/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinAddOrderEntryActionFactory.kt.181 deleted file mode 100644 index 09d18141bbe..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/KotlinAddOrderEntryActionFactory.kt.181 +++ /dev/null @@ -1,67 +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.quickfix - -import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix -import com.intellij.codeInsight.daemon.impl.quickfix.QuickFixActionRegistrarImpl -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.openapi.util.TextRange -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiReference -import com.intellij.psi.PsiReferenceBase -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.idea.references.KtSimpleNameReference.ShorteningMode -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.idea.util.application.executeWriteCommand -import org.jetbrains.kotlin.idea.util.runWhenSmart -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import org.jetbrains.kotlin.psi.psiUtil.getQualifiedElement -import org.jetbrains.kotlin.psi.psiUtil.startOffset - -object KotlinAddOrderEntryActionFactory : KotlinIntentionActionsFactory() { - override fun doCreateActions(diagnostic: Diagnostic): List { - val simpleExpression = diagnostic.psiElement as? KtSimpleNameExpression ?: return emptyList() - val refElement = simpleExpression.getQualifiedElement() - - val reference = object: PsiReferenceBase(refElement) { - override fun resolve() = null - - override fun getVariants() = PsiReference.EMPTY_ARRAY - - override fun getRangeInElement(): TextRange? { - val offset = simpleExpression.startOffset - refElement.startOffset - return TextRange(offset, offset + simpleExpression.textLength) - } - - override fun getCanonicalText() = refElement.text - - override fun bindToElement(element: PsiElement): PsiElement { - val project = element.project - project.runWhenSmart { - project.executeWriteCommand("") { - simpleExpression.mainReference.bindToElement(element, ShorteningMode.FORCED_SHORTENING) - } - } - return element - } - } - - @Suppress("UNCHECKED_CAST") - return OrderEntryFix.registerFixes(QuickFixActionRegistrarImpl(null), reference) as List? ?: emptyList() - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt.181 b/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt.181 deleted file mode 100644 index 9a9f2e8f5ae..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/crossLanguage/KotlinElementActionsFactory.kt.181 +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.quickfix.crossLanguage - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.codeInsight.intention.QuickFixFactory -import com.intellij.lang.jvm.JvmClass -import com.intellij.lang.jvm.JvmElement -import com.intellij.lang.jvm.JvmModifier -import com.intellij.lang.jvm.JvmModifiersOwner -import com.intellij.lang.jvm.actions.* -import com.intellij.openapi.project.Project -import com.intellij.psi.* -import com.intellij.psi.codeStyle.SuggestedNameInfo -import com.intellij.psi.impl.source.tree.java.PsiReferenceExpressionImpl -import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade -import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration -import org.jetbrains.kotlin.asJava.toLightMethods -import org.jetbrains.kotlin.asJava.unwrapped -import org.jetbrains.kotlin.caches.resolve.KotlinCacheService -import org.jetbrains.kotlin.descriptors.ClassKind -import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.SourceElement -import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor -import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl -import org.jetbrains.kotlin.descriptors.impl.MutablePackageFragmentDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade -import org.jetbrains.kotlin.idea.core.appendModifier -import org.jetbrains.kotlin.idea.quickfix.AddModifierFix -import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.* -import org.jetbrains.kotlin.idea.quickfix.createFromUsage.createCallable.CreateCallableFromUsageFix -import org.jetbrains.kotlin.idea.resolve.ResolutionFacade -import org.jetbrains.kotlin.idea.util.approximateFlexibleTypes -import org.jetbrains.kotlin.lexer.KtTokens -import org.jetbrains.kotlin.load.java.JvmAbi.JVM_FIELD_ANNOTATION_FQ_NAME -import org.jetbrains.kotlin.load.java.components.TypeUsage -import org.jetbrains.kotlin.load.java.lazy.JavaResolverComponents -import org.jetbrains.kotlin.load.java.lazy.LazyJavaResolverContext -import org.jetbrains.kotlin.load.java.lazy.TypeParameterResolver -import org.jetbrains.kotlin.load.java.lazy.child -import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaTypeParameterDescriptor -import org.jetbrains.kotlin.load.java.lazy.types.JavaTypeAttributes -import org.jetbrains.kotlin.load.java.lazy.types.JavaTypeResolver -import org.jetbrains.kotlin.load.java.structure.JavaTypeParameter -import org.jetbrains.kotlin.load.java.structure.impl.JavaTypeImpl -import org.jetbrains.kotlin.load.java.structure.impl.JavaTypeParameterImpl -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.visibilityModifierType -import org.jetbrains.kotlin.resolve.annotations.JVM_STATIC_ANNOTATION_FQ_NAME -import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatform -import org.jetbrains.kotlin.storage.LockBasedStorageManager -import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.Variance -import org.jetbrains.kotlin.types.typeUtil.supertypes - -class KotlinElementActionsFactory : JvmElementActionsFactory() { - companion object { - val javaPsiModifiersMapping = mapOf( - JvmModifier.PRIVATE to KtTokens.PRIVATE_KEYWORD, - JvmModifier.PUBLIC to KtTokens.PUBLIC_KEYWORD, - JvmModifier.PROTECTED to KtTokens.PUBLIC_KEYWORD, - JvmModifier.ABSTRACT to KtTokens.ABSTRACT_KEYWORD - ) - } - - private class FakeExpressionFromParameter(private val psiParam: PsiParameter) : PsiReferenceExpressionImpl() { - override fun getText(): String = psiParam.name!! - override fun getProject(): Project = psiParam.project - override fun getParent(): PsiElement = psiParam.parent - override fun getType(): PsiType? = psiParam.type - override fun isValid(): Boolean = true - override fun getContainingFile(): PsiFile = psiParam.containingFile - override fun getReferenceName(): String? = psiParam.name - override fun resolve(): PsiElement? = psiParam - } - - private class ModifierBuilder( - private val targetContainer: KtElement, - private val allowJvmStatic: Boolean = true - ) { - private val psiFactory = KtPsiFactory(targetContainer.project) - - val modifierList = psiFactory.createEmptyModifierList() - - private fun JvmModifier.transformAndAppend(): Boolean { - javaPsiModifiersMapping[this]?.let { - modifierList.appendModifier(it) - return true - } - - when (this) { - JvmModifier.STATIC -> { - if (allowJvmStatic && targetContainer is KtClassOrObject) { - addAnnotation(JVM_STATIC_ANNOTATION_FQ_NAME) - } - } - JvmModifier.ABSTRACT -> modifierList.appendModifier(KtTokens.ABSTRACT_KEYWORD) - JvmModifier.FINAL -> modifierList.appendModifier(KtTokens.FINAL_KEYWORD) - else -> return false - } - - return true - } - - var isValid = true - private set - - fun addJvmModifier(modifier: JvmModifier) { - isValid = isValid && modifier.transformAndAppend() - } - - fun addJvmModifiers(modifiers: Iterable) { - modifiers.forEach { addJvmModifier(it) } - } - - fun addAnnotation(fqName: FqName) { - if (!isValid) return - modifierList.add(psiFactory.createAnnotationEntry("@${fqName.asString()}")) - } - } - - class CreatePropertyFix( - private val targetClass: JvmClass, - contextElement: KtElement, - propertyInfo: PropertyInfo - ) : CreateCallableFromUsageFix(contextElement, listOf(propertyInfo)) { - override fun getFamilyName() = "Add property" - override fun getText(): String { - val info = callableInfos.first() as PropertyInfo - return buildString { - append("Add '") - if (info.isLateinitPreferred) { - append("lateinit ") - } - append(if (info.writable) "var" else "val") - append("' property '${info.name}' to '${targetClass.name}'") - } - } - } - - private fun JvmClass.toKtClassOrFile(): KtElement? { - val psi = sourceElement - return when (psi) { - is KtClassOrObject -> psi - is KtLightClassForSourceDeclaration -> psi.kotlinOrigin - is KtLightClassForFacade -> psi.files.firstOrNull() - else -> null - } - } - - private inline fun JvmElement.toKtElement() = sourceElement?.unwrapped as? T - - private fun fakeParametersExpressions(parameters: List>>, project: Project): Array? = - when { - parameters.isEmpty() -> emptyArray() - else -> JavaPsiFacade - .getElementFactory(project) - .createParameterList( - parameters.map { it.first.names.firstOrNull() }.toTypedArray(), - parameters.map { JvmPsiConversionHelper.getInstance(project).asPsiType(it) ?: return null }.toTypedArray() - ) - .parameters - .map(::FakeExpressionFromParameter) - .toTypedArray() - } - - private fun PsiType.collectTypeParameters(): List { - val results = ArrayList() - accept( - object : PsiTypeVisitor() { - override fun visitArrayType(arrayType: PsiArrayType) { - arrayType.componentType.accept(this) - } - - override fun visitClassType(classType: PsiClassType) { - (classType.resolve() as? PsiTypeParameter)?.let { results += it } - classType.parameters.forEach { it.accept(this) } - } - - override fun visitWildcardType(wildcardType: PsiWildcardType) { - wildcardType.bound?.accept(this) - } - } - ) - return results - } - - private fun PsiType.resolveToKotlinType(resolutionFacade: ResolutionFacade): KotlinType? { - val typeParameters = collectTypeParameters() - val components = resolutionFacade.getFrontendService(JavaResolverComponents::class.java) - val rootContext = LazyJavaResolverContext(components, TypeParameterResolver.EMPTY) { null } - val dummyPackageDescriptor = MutablePackageFragmentDescriptor(resolutionFacade.moduleDescriptor, FqName("dummy")) - val dummyClassDescriptor = ClassDescriptorImpl( - dummyPackageDescriptor, - Name.identifier("Dummy"), - Modality.FINAL, - ClassKind.CLASS, - emptyList(), - SourceElement.NO_SOURCE, - false, - LockBasedStorageManager.NO_LOCKS - ) - val typeParameterResolver = object : TypeParameterResolver { - override fun resolveTypeParameter(javaTypeParameter: JavaTypeParameter): TypeParameterDescriptor? { - val psiTypeParameter = (javaTypeParameter as JavaTypeParameterImpl).psi - val index = typeParameters.indexOf(psiTypeParameter) - if (index < 0) return null - return LazyJavaTypeParameterDescriptor(rootContext.child(this), javaTypeParameter, index, dummyClassDescriptor) - } - } - val typeResolver = JavaTypeResolver(rootContext, typeParameterResolver) - val attributes = JavaTypeAttributes(TypeUsage.COMMON) - return typeResolver.transformJavaType(JavaTypeImpl.create(this), attributes).approximateFlexibleTypes(preferNotNull = true) - } - - private fun ExpectedTypes.toKotlinTypeInfo(resolutionFacade: ResolutionFacade): TypeInfo { - val candidateTypes = flatMapTo(LinkedHashSet()) { - val ktType = (it.theType as? PsiType)?.resolveToKotlinType(resolutionFacade) ?: return@flatMapTo emptyList() - when (it.theKind) { - ExpectedType.Kind.EXACT, ExpectedType.Kind.SUBTYPE -> listOf(ktType) - ExpectedType.Kind.SUPERTYPE -> listOf(ktType) + ktType.supertypes() - } - } - if (candidateTypes.isEmpty()) { - val nullableAnyType = resolutionFacade.moduleDescriptor.builtIns.nullableAnyType - return TypeInfo(nullableAnyType, Variance.INVARIANT) - } - return TypeInfo.ByExplicitCandidateTypes(candidateTypes.toList()) - } - - override fun createChangeModifierActions(target: JvmModifiersOwner, request: MemberRequest.Modifier): List { - val kModifierOwner = target.toKtElement() ?: return emptyList() - - val modifier = request.modifier - val shouldPresent = request.shouldPresent - //TODO: make similar to `createAddMethodActions` - val (kToken, shouldPresentMapped) = when { - modifier == JvmModifier.FINAL -> KtTokens.OPEN_KEYWORD to !shouldPresent - modifier == JvmModifier.PUBLIC && shouldPresent -> - kModifierOwner.visibilityModifierType() - ?.takeIf { it != KtTokens.DEFAULT_VISIBILITY_KEYWORD } - ?.let { it to false } ?: return emptyList() - else -> javaPsiModifiersMapping[modifier] to shouldPresent - } - if (kToken == null) return emptyList() - - val action = if (shouldPresentMapped) - AddModifierFix.createIfApplicable(kModifierOwner, kToken) - else - RemoveModifierFix(kModifierOwner, kToken, false) - return listOfNotNull(action) - } - - override fun createAddConstructorActions(targetClass: JvmClass, request: CreateConstructorRequest): List { - val targetKtClass = targetClass.toKtClassOrFile() as? KtClass ?: return emptyList() - - val modifierBuilder = ModifierBuilder(targetKtClass).apply { addJvmModifiers(request.modifiers) } - if (!modifierBuilder.isValid) return emptyList() - val resolutionFacade = targetKtClass.getResolutionFacade() - val nullableAnyType = resolutionFacade.moduleDescriptor.builtIns.nullableAnyType - val helper = JvmPsiConversionHelper.getInstance(targetKtClass.project) - val parameters = request.parameters as List>> - val parameterInfos = parameters.mapIndexed { index, param: Pair> -> - val ktType = helper.asPsiType(param)?.resolveToKotlinType(resolutionFacade) ?: nullableAnyType - val name = param.first.names.firstOrNull() ?: "arg${index + 1}" - ParameterInfo(TypeInfo(ktType, Variance.IN_VARIANCE), listOf(name)) - } - val needPrimary = !targetKtClass.hasExplicitPrimaryConstructor() - val constructorInfo = ConstructorInfo( - parameterInfos, - targetKtClass, - isPrimary = needPrimary, - modifierList = modifierBuilder.modifierList, - withBody = true - ) - val targetClassName = targetClass.name - val addConstructorAction = object : CreateCallableFromUsageFix(targetKtClass, listOf(constructorInfo)) { - override fun getFamilyName() = "Add method" - override fun getText() = "Add ${if (needPrimary) "primary" else "secondary"} constructor to '$targetClassName'" - } - - val changePrimaryConstructorAction = run { - val primaryConstructor = targetKtClass.primaryConstructor ?: return@run null - val lightMethod = primaryConstructor.toLightMethods().firstOrNull() ?: return@run null - val project = targetKtClass.project - val fakeParametersExpressions = fakeParametersExpressions(parameters, project) ?: return@run null - QuickFixFactory.getInstance() - .createChangeMethodSignatureFromUsageFix( - lightMethod, - fakeParametersExpressions, - PsiSubstitutor.EMPTY, - targetKtClass, - false, - 2 - ).takeIf { it.isAvailable(project, null, targetKtClass.containingFile) } - } - - return listOfNotNull(changePrimaryConstructorAction, addConstructorAction) - } - - override fun createAddPropertyActions(targetClass: JvmClass, request: MemberRequest.Property): List { - val targetContainer = targetClass.toKtClassOrFile() ?: return emptyList() - - val modifierBuilder = ModifierBuilder(targetContainer).apply { addJvmModifier(request.visibilityModifier) } - if (!modifierBuilder.isValid) return emptyList() - - val resolutionFacade = targetContainer.getResolutionFacade() - val nullableAnyType = resolutionFacade.moduleDescriptor.builtIns.nullableAnyType - val ktType = (request.propertyType as? PsiType)?.resolveToKotlinType(resolutionFacade) ?: nullableAnyType - val propertyInfo = PropertyInfo( - request.propertyName, - TypeInfo.Empty, - TypeInfo(ktType, Variance.INVARIANT), - request.setterRequired, - listOf(targetContainer), - modifierList = modifierBuilder.modifierList, - withInitializer = true - ) - val propertyInfos = if (request.setterRequired) { - listOf(propertyInfo, propertyInfo.copyProperty(isLateinitPreferred = true)) - } - else { - listOf(propertyInfo) - } - return propertyInfos.map { CreatePropertyFix(targetClass, targetContainer, it) } - } - - override fun createAddFieldActions(targetClass: JvmClass, request: CreateFieldRequest): List { - val targetContainer = targetClass.toKtClassOrFile() ?: return emptyList() - - val modifierBuilder = ModifierBuilder(targetContainer, allowJvmStatic = false).apply { - addJvmModifiers(request.modifiers) - addAnnotation(JVM_FIELD_ANNOTATION_FQ_NAME) - } - if (!modifierBuilder.isValid) return emptyList() - - val resolutionFacade = targetContainer.getResolutionFacade() - val typeInfo = request.fieldType.toKotlinTypeInfo(resolutionFacade) - val writable = JvmModifier.FINAL !in request.modifiers - val propertyInfo = PropertyInfo( - request.fieldName, - TypeInfo.Empty, - typeInfo, - writable, - listOf(targetContainer), - isForCompanion = JvmModifier.STATIC in request.modifiers, - modifierList = modifierBuilder.modifierList, - withInitializer = true - ) - val propertyInfos = if (writable) { - listOf(propertyInfo, propertyInfo.copyProperty(isLateinitPreferred = true)) - } - else { - listOf(propertyInfo) - } - return propertyInfos.map { CreatePropertyFix(targetClass, targetContainer, it) } - } - - override fun createAddMethodActions(targetClass: JvmClass, request: CreateMethodRequest): List { - val targetContainer = targetClass.toKtClassOrFile() ?: return emptyList() - - val modifierBuilder = ModifierBuilder(targetContainer).apply { addJvmModifiers(request.modifiers) } - if (!modifierBuilder.isValid) return emptyList() - - val resolutionFacade = KotlinCacheService.getInstance(targetContainer.project) - .getResolutionFacadeByFile(targetContainer.containingFile, JvmPlatform) ?: return emptyList() - val returnTypeInfo = request.returnType.toKotlinTypeInfo(resolutionFacade) - val parameters = request.parameters as List>> - val parameterInfos = parameters.map { (suggestedNames, expectedTypes) -> - ParameterInfo(expectedTypes.toKotlinTypeInfo(resolutionFacade), suggestedNames.names.toList()) - } - val methodName = request.methodName - val functionInfo = FunctionInfo( - methodName, - TypeInfo.Empty, - returnTypeInfo, - listOf(targetContainer), - parameterInfos, - isForCompanion = JvmModifier.STATIC in request.modifiers, - modifierList = modifierBuilder.modifierList, - preferEmptyBody = true - ) - val targetClassName = targetClass.name - val action = object : CreateCallableFromUsageFix(targetContainer, listOf(functionInfo)) { - override fun getFamilyName() = "Add method" - override fun getText() = "Add method '$methodName' to '$targetClassName'" - } - return listOf(action) - } -} - -private fun JvmPsiConversionHelper.asPsiType(param: Pair>): PsiType? = - param.second.firstOrNull()?.theType?.let { convertType(it) } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinRenameDispatcherHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinRenameDispatcherHandler.kt.181 deleted file mode 100644 index 7ef8e91c293..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinRenameDispatcherHandler.kt.181 +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.refactoring.rename - -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.extensions.ExtensionPointName -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.refactoring.rename.RenameHandler -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull -import java.util.* - -class KotlinRenameDispatcherHandler : RenameHandler { - companion object { - val EP_NAME = ExtensionPointName("org.jetbrains.kotlin.renameHandler") - - private val handlers: Array get() = Extensions.getExtensions(EP_NAME) - } - - internal fun getRenameHandler(dataContext: DataContext?): RenameHandler? { - val availableHandlers = handlers.filterTo(LinkedHashSet()) { it.isRenaming(dataContext) } - availableHandlers.singleOrNull()?.let { return it } - availableHandlers.firstIsInstanceOrNull()?.let { availableHandlers -= it } - return availableHandlers.firstOrNull() - } - - override fun isAvailableOnDataContext(dataContext: DataContext?) = handlers.any { it.isAvailableOnDataContext(dataContext) } - - override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext) - - override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext?) { - getRenameHandler(dataContext)?.invoke(project, editor, file, dataContext) - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext?) { - getRenameHandler(dataContext)?.invoke(project, elements, dataContext) - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinVariableInplaceRenameHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinVariableInplaceRenameHandler.kt.181 deleted file mode 100644 index 5344790704f..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/KotlinVariableInplaceRenameHandler.kt.181 +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2000-2018 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.refactoring.rename - -import com.intellij.openapi.editor.Editor -import com.intellij.psi.* -import com.intellij.refactoring.RefactoringActionHandler -import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler -import com.intellij.refactoring.rename.inplace.VariableInplaceRenamer -import org.jetbrains.kotlin.idea.core.unquote -import org.jetbrains.kotlin.psi.* - -open class KotlinVariableInplaceRenameHandler : VariableInplaceRenameHandler() { - companion object { - fun isInplaceRenameAvailable(element: PsiElement): Boolean { - when (element) { - is KtTypeParameter -> return true - is KtDestructuringDeclarationEntry -> return true - is KtParameter -> { - val parent = element.parent - if (parent is KtForExpression) { - return true - } - if (parent is KtParameterList) { - val grandparent = parent.parent - return grandparent is KtCatchClause || grandparent is KtFunctionLiteral - } - } - is KtLabeledExpression, is KtImportAlias -> return true - } - return false - } - } - - protected open class RenamerImpl : VariableInplaceRenamer { - constructor(elementToRename: PsiNamedElement, editor: Editor): super(elementToRename, editor) - constructor( - elementToRename: PsiNamedElement, - editor: Editor, - currentName: String, - oldName: String - ) : super(elementToRename, editor, editor.project, currentName, oldName) - - override fun acceptReference(reference: PsiReference): Boolean { - val refElement = reference.element - val textRange = reference.rangeInElement - val referenceText = refElement.text.substring(textRange.startOffset, textRange.endOffset).unquote() - return referenceText == myElementToRename.name - } - - override fun startsOnTheSameElement(handler: RefactoringActionHandler?, element: PsiElement?): Boolean { - return variable == element && (handler is VariableInplaceRenameHandler || handler is KotlinRenameDispatcherHandler) - } - - override fun createInplaceRenamerToRestart(variable: PsiNamedElement, editor: Editor, initialName: String): VariableInplaceRenamer { - return RenamerImpl(variable, editor, initialName, myOldName) - } - } - - override fun createRenamer(elementToRename: PsiElement, editor: Editor): VariableInplaceRenamer? { - val currentElementToRename = elementToRename as PsiNameIdentifierOwner - val currentName = currentElementToRename.nameIdentifier?.text ?: "" - return RenamerImpl(currentElementToRename, editor, currentName, currentName) - } - - override public fun isAvailable(element: PsiElement?, editor: Editor, file: PsiFile) = - editor.settings.isVariableInplaceRenameEnabled && element != null && isInplaceRenameAvailable(element) -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameBackingFieldReferenceHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameBackingFieldReferenceHandler.kt.181 deleted file mode 100644 index 2fdb0e50667..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameBackingFieldReferenceHandler.kt.181 +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.refactoring.rename - -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.descriptors.impl.SyntheticFieldDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall -import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils -import org.jetbrains.kotlin.psi.KtSimpleNameExpression - -class RenameBackingFieldReferenceHandler: KotlinVariableInplaceRenameHandler() { - override fun isAvailable(element: PsiElement?, editor: Editor, file: PsiFile): Boolean { - val refExpression = file.findElementForRename(editor.caretModel.offset) ?: return false - if (refExpression.text != "field") return false - return refExpression.resolveToCall()?.resultingDescriptor is SyntheticFieldDescriptor - } - - override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) { - editor?.let { - CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to backing field reference", "Rename", null) - } - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext) { - // Do nothing: this method is called not from editor - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameDynamicMemberHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameDynamicMemberHandler.kt.181 deleted file mode 100644 index 0acf640e54e..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameDynamicMemberHandler.kt.181 +++ /dev/null @@ -1,49 +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.refactoring.rename - -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.util.PsiTreeUtil -import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils -import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall -import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic - -class RenameDynamicMemberHandler: KotlinVariableInplaceRenameHandler() { - override fun isAvailable(element: PsiElement?, editor: Editor, file: PsiFile): Boolean { - val callee = PsiTreeUtil.findElementOfClassAtOffset( - file, editor.caretModel.offset, KtSimpleNameExpression::class.java, false - ) ?: return false - val calleeDescriptor = callee.resolveToCall()?.resultingDescriptor ?: return false - return calleeDescriptor.isDynamic() - } - - override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) { - super.invoke(project, editor, file, dataContext) - editor?.let { - CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to dynamically invoked members", "Rename", null) - } - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext) { - // Do nothing: this method is called not from editor - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinImplicitLambdaParameter.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinImplicitLambdaParameter.kt.181 deleted file mode 100644 index 90ccd201c4d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinImplicitLambdaParameter.kt.181 +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.refactoring.rename - -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.idea.intentions.ReplaceItWithExplicitFunctionLiteralParamIntention -import org.jetbrains.kotlin.idea.intentions.isAutoCreatedItUsage -import org.jetbrains.kotlin.idea.util.application.executeWriteCommand -import org.jetbrains.kotlin.psi.KtNameReferenceExpression - -class RenameKotlinImplicitLambdaParameter : KotlinVariableInplaceRenameHandler() { - override fun isAvailable(element: PsiElement?, editor: Editor, file: PsiFile): Boolean { - val nameExpression = file.findElementForRename(editor.caretModel.offset) - - return nameExpression != null && isAutoCreatedItUsage(nameExpression) - } - - override fun invoke(project: Project, editor: Editor?, file: PsiFile?, dataContext: DataContext) { - val intention = ReplaceItWithExplicitFunctionLiteralParamIntention() - project.executeWriteCommand("Convert 'it' to explicit lambda parameter") { - file?.let { - intention.invoke(project, editor, file) - } - } - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext) { - // Do nothing: this method is called not from editor - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameOnSecondaryConstructorHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameOnSecondaryConstructorHandler.kt.181 deleted file mode 100644 index 9ccdea1addf..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameOnSecondaryConstructorHandler.kt.181 +++ /dev/null @@ -1,54 +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.refactoring.rename - -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.psi.util.PsiTreeUtil -import com.intellij.refactoring.rename.RenameHandler -import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils -import org.jetbrains.kotlin.psi.* - - -class RenameOnSecondaryConstructorHandler : RenameHandler { - override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean { - if (dataContext == null) return false - - val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false - val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false - - val element = PsiTreeUtil.findElementOfClassAtOffsetWithStopSet( - file, editor.caretModel.offset, KtSecondaryConstructor::class.java, false, - KtBlockExpression::class.java, KtValueArgumentList::class.java, KtParameterList::class.java, KtConstructorDelegationCall::class.java - ) - return element != null - } - - override fun isRenaming(dataContext: DataContext?): Boolean = isAvailableOnDataContext(dataContext) - - override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) { - CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to secondary constructors", "Rename", null) - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext?) { - // Do nothing: this method is called not from editor - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameSyntheticDeclarationByReferenceHandler.kt.181 b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameSyntheticDeclarationByReferenceHandler.kt.181 deleted file mode 100644 index 0e47f20e979..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameSyntheticDeclarationByReferenceHandler.kt.181 +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2018 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.refactoring.rename - -import org.jetbrains.kotlin.idea.statistics.KotlinStatisticsTrigger -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile -import com.intellij.refactoring.rename.RenameHandler -import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall -import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils -import org.jetbrains.kotlin.psi.KtSimpleNameExpression -import org.jetbrains.kotlin.resolve.calls.tower.isSynthesized -import org.jetbrains.kotlin.idea.statistics.KotlinEventTrigger - -class RenameSyntheticDeclarationByReferenceHandler : RenameHandler { - override fun isAvailableOnDataContext(dataContext: DataContext?): Boolean { - if (dataContext == null) return false - val file = CommonDataKeys.PSI_FILE.getData(dataContext) ?: return false - val editor = CommonDataKeys.EDITOR.getData(dataContext) ?: return false - val refExpression = file.findElementForRename(editor.caretModel.offset) ?: return false - return (refExpression.resolveToCall()?.resultingDescriptor)?.isSynthesized ?: false - } - - override fun isRenaming(dataContext: DataContext?) = isAvailableOnDataContext(dataContext) - - override fun invoke(project: Project, editor: Editor, file: PsiFile, dataContext: DataContext?) { - CodeInsightUtils.showErrorHint(project, editor, "Rename is not applicable to synthetic declaration", "Rename", null) - KotlinStatisticsTrigger.trigger(KotlinEventTrigger.KotlinIdeRefactoringTrigger, this::class.java.name) - } - - override fun invoke(project: Project, elements: Array, dataContext: DataContext?) { - // Do nothing: this method is not called from editor - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.181 b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.181 deleted file mode 100644 index 8c69c6ac451..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.181 +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2010-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.slicer - -import com.intellij.analysis.AnalysisScope -import com.intellij.openapi.Disposable -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.wm.ToolWindowId -import com.intellij.openapi.wm.ToolWindowManager -import com.intellij.psi.PsiElement -import com.intellij.slicer.DuplicateMap -import com.intellij.slicer.SliceAnalysisParams -import com.intellij.slicer.SlicePanel -import com.intellij.slicer.SliceRootNode -import com.intellij.usageView.UsageInfo -import com.intellij.usageView.UsageViewBundle -import com.intellij.usages.PsiElementUsageTarget -import com.intellij.usages.UsageContextPanel -import com.intellij.usages.UsageView -import com.intellij.usages.UsageViewPresentation -import com.intellij.usages.impl.UsageContextPanelBase -import com.intellij.usages.impl.UsageViewImpl -import org.jetbrains.kotlin.psi.KtDeclaration -import java.awt.BorderLayout -import javax.swing.JLabel -import javax.swing.JPanel -import javax.swing.SwingConstants - -sealed class KotlinUsageContextDataFlowPanelBase( - project: Project, - presentation: UsageViewPresentation, - private val isInflow: Boolean -) : UsageContextPanelBase(project, presentation) { - private var panel: JPanel? = null - - abstract class ProviderBase : UsageContextPanel.Provider { - override fun isAvailableFor(usageView: UsageView): Boolean { - val target = (usageView as UsageViewImpl).targets.firstOrNull() ?: return false - val element = (target as? PsiElementUsageTarget)?.element - return element is KtDeclaration && element.isValid - } - } - - private fun createParams(element: PsiElement): SliceAnalysisParams { - return SliceAnalysisParams().apply { - scope = AnalysisScope(element.project) - dataFlowToThis = isInflow - showInstanceDereferences = true - } - } - - protected fun createPanel(element: PsiElement, dataFlowToThis: Boolean): JPanel { - val toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.FIND) - val params = createParams(element) - - val rootNode = SliceRootNode(myProject, DuplicateMap(), KotlinSliceUsage(element, params)) - - return object : SlicePanel(myProject, dataFlowToThis, rootNode, false, toolWindow) { - override fun isToShowAutoScrollButton() = false - - override fun isToShowPreviewButton() = false - - override fun isToShowCloseButton() = false - - override fun isAutoScroll() = false - - override fun setAutoScroll(autoScroll: Boolean) {} - - override fun isPreview() = false - - override fun setPreview(preview: Boolean) {} - } - } - - public override fun updateLayoutLater(infos: List?) { - if (infos == null) { - removeAll() - val title = UsageViewBundle.message("select.the.usage.to.preview", myPresentation.usagesWord) - add(JLabel(title, SwingConstants.CENTER), BorderLayout.CENTER) - } - else { - val element = infos.firstOrNull()?.element ?: return - if (panel != null) { - Disposer.dispose(panel as Disposable) - } - - val panel = createPanel(element, isInflow) - Disposer.register(this, panel as Disposable) - removeAll() - add(panel, BorderLayout.CENTER) - this.panel = panel - } - revalidate() - } - - override fun dispose() { - super.dispose() - panel = null - } -} - -class KotlinUsageContextDataInflowPanel( - project: Project, - presentation: UsageViewPresentation -) : KotlinUsageContextDataFlowPanelBase(project, presentation, true) { - class Provider : ProviderBase() { - override fun create(usageView: UsageView): UsageContextPanel { - return KotlinUsageContextDataInflowPanel((usageView as UsageViewImpl).project, usageView.getPresentation()) - } - - override fun getTabTitle() = "Dataflow to Here" - } -} - -class KotlinUsageContextDataOutflowPanel( - project: Project, - presentation: UsageViewPresentation -) : KotlinUsageContextDataFlowPanelBase(project, presentation, false) { - class Provider : ProviderBase() { - override fun create(usageView: UsageView): UsageContextPanel { - return KotlinUsageContextDataOutflowPanel((usageView as UsageViewImpl).project, usageView.getPresentation()) - } - - override fun getTabTitle() = "Dataflow from Here" - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/util/PopupChooserBuilderWrapper.kt.181 b/idea/src/org/jetbrains/kotlin/idea/util/PopupChooserBuilderWrapper.kt.181 deleted file mode 100644 index 5e4cb710a27..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/util/PopupChooserBuilderWrapper.kt.181 +++ /dev/null @@ -1,13 +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.util - -import com.intellij.openapi.ui.popup.PopupChooserBuilder -import javax.swing.JList - -// BUNCH: 181 -@Suppress("IncompatibleAPI") -class PopupChooserBuilderWrapper(list: JList) : PopupChooserBuilder(list) \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/util/compat/Nullability.kt.181 b/idea/src/org/jetbrains/kotlin/idea/util/compat/Nullability.kt.181 deleted file mode 100644 index 40490cac58a..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/util/compat/Nullability.kt.181 +++ /dev/null @@ -1,40 +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. - */ - -@file:Suppress("MissingRecentApi", "IncompatibleAPI") - -package org.jetbrains.kotlin.idea.util.compat - -import com.intellij.codeInspection.dataFlow.Nullness -import com.intellij.codeInspection.dataFlow.DfaUtil -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiMethod -import com.intellij.psi.PsiVariable -import com.intellij.slicer.SliceLanguageSupportProvider -import com.intellij.slicer.SliceLeafEquality -import com.intellij.slicer.SliceNullnessAnalyzerBase - -// BUNCH: 181 -typealias Nullability = Nullness - -// BUNCH: 181 -fun dfaCheckNullability(variable: PsiVariable?, context: PsiElement?): Nullability = - DfaUtil.checkNullness(variable, context) - -// BUNCH: 181 -fun dfaInferMethodNullability(method: PsiMethod): Nullability = - DfaUtil.inferMethodNullity(method) - -// BUNCH: 181 -abstract class SliceNullnessAnalyzerBaseEx( - leafEquality: SliceLeafEquality, - provider: SliceLanguageSupportProvider -) : SliceNullnessAnalyzerBase(leafEquality, provider) { - override fun checkNullness(element: PsiElement?): Nullability { - return checkNullabilityEx(element) - } - - abstract fun checkNullabilityEx(element: PsiElement?): Nullability -} \ No newline at end of file diff --git a/idea/testData/android/lint/javaPerformance.kt.181 b/idea/testData/android/lint/javaPerformance.kt.181 deleted file mode 100644 index 454ea4ac4e8..00000000000 --- a/idea/testData/android/lint/javaPerformance.kt.181 +++ /dev/null @@ -1,193 +0,0 @@ -// INSPECTION_CLASS: com.android.tools.idea.lint.AndroidLintDrawAllocationInspection -// INSPECTION_CLASS2: com.android.tools.idea.lint.AndroidLintUseSparseArraysInspection -// INSPECTION_CLASS3: com.android.tools.idea.lint.AndroidLintUseValueOfInspection - -import android.annotation.SuppressLint -import java.util.HashMap -import android.content.Context -import android.graphics.* -import android.util.AttributeSet -import android.util.SparseArray -import android.widget.Button - -@SuppressWarnings("unused") -@Suppress("UsePropertyAccessSyntax", "UNUSED_VARIABLE", "unused", "UNUSED_PARAMETER", "DEPRECATION", "UNNECESSARY_NOT_NULL_ASSERTION", "NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") -class JavaPerformanceTest(context: Context, attrs: AttributeSet, defStyle: Int) : Button(context, attrs, defStyle) { - - private var cachedRect: Rect? = null - private var shader: LinearGradient? = null - private var lastHeight: Int = 0 - private var lastWidth: Int = 0 - - override fun onDraw(canvas: android.graphics.Canvas) { - super.onDraw(canvas) - - // Various allocations: - java.lang.String("foo") - val s = java.lang.String("bar") - - // This one should not be reported: - @SuppressLint("DrawAllocation") - val i = 5 - - // Cached object initialized lazily: should not complain about these - if (cachedRect == null) { - cachedRect = Rect(0, 0, 100, 100) - } - if (cachedRect == null || cachedRect!!.width() != 50) { - cachedRect = Rect(0, 0, 50, 100) - } - - val b = java.lang.Boolean.valueOf(true)!! // auto-boxing - dummy(1, 2) - - // Non-allocations - super.animate() - dummy2(1, 2) - - // This will involve allocations, but we don't track - // inter-procedural stuff here - someOtherMethod() - } - - internal fun dummy(foo: Int?, bar: Int) { - dummy2(foo!!, bar) - } - - internal fun dummy2(foo: Int, bar: Int) { - } - - internal fun someOtherMethod() { - // Allocations are okay here - java.lang.String("foo") - val s = java.lang.String("bar") - val b = java.lang.Boolean.valueOf(true)!! // auto-boxing - - - // Sparse array candidates - val myMap = HashMap() - // Should use SparseBooleanArray - val myBoolMap = HashMap() - // Should use SparseIntArray - val myIntMap = java.util.HashMap() - - // This one should not be reported: - @SuppressLint("UseSparseArrays") - val myOtherMap = HashMap() - } - - protected fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int, - x: Boolean) { - // wrong signature - java.lang.String("not an error") - } - - protected fun onMeasure(widthMeasureSpec: Int) { - // wrong signature - java.lang.String("not an error") - } - - protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, - bottom: Int, wrong: Int) { - // wrong signature - java.lang.String("not an error") - } - - protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int) { - // wrong signature - java.lang.String("not an error") - } - - override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, - bottom: Int) { - java.lang.String("flag me") - } - - @SuppressWarnings("null") // not real code - override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - java.lang.String("flag me") - - // Forbidden factory methods: - Bitmap.createBitmap(100, 100, null) - android.graphics.Bitmap.createScaledBitmap(null, 100, 100, false) - BitmapFactory.decodeFile(null) - val canvas: Canvas? = null - canvas!!.getClipBounds() // allocates on your behalf - canvas.clipBounds // allocates on your behalf - canvas.getClipBounds(null) // NOT an error - - val layoutWidth = width - val layoutHeight = height - if (mAllowCrop && (mOverlay == null || mOverlay!!.width != layoutWidth || - mOverlay!!.height != layoutHeight)) { - mOverlay = Bitmap.createBitmap(layoutWidth, layoutHeight, Bitmap.Config.ARGB_8888) - mOverlayCanvas = Canvas(mOverlay!!) - } - - if (widthMeasureSpec == 42) { - throw IllegalStateException("Test") // NOT an allocation - } - - // More lazy init tests - var initialized = false - if (!initialized) { - java.lang.String("foo") - initialized = true - } - - // NOT lazy initialization - if (!initialized || mOverlay == null) { - java.lang.String("foo") - } - } - - internal fun factories() { - val i1 = 42 - val l1 = 42L - val b1 = true - val c1 = 'c' - val f1 = 1.0f - val d1 = 1.0 - - // The following should not generate errors: - val i3 = Integer.valueOf(42) - } - - private val mAllowCrop: Boolean = false - private var mOverlayCanvas: Canvas? = null - private var mOverlay: Bitmap? = null - - override fun layout(l: Int, t: Int, r: Int, b: Int) { - // Using "this." to reference fields - if (this.shader == null) - this.shader = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(0), null, - Shader.TileMode.REPEAT) - - val width = width - val height = height - - if (shader == null || lastWidth != width || lastHeight != height) { - lastWidth = width - lastHeight = height - - shader = LinearGradient(0f, 0f, width.toFloat(), 0f, intArrayOf(0), null, Shader.TileMode.REPEAT) - } - } - - fun inefficientSparseArray() { - SparseArray() // Use SparseIntArray instead - SparseArray() // Use SparseLongArray instead - SparseArray() // Use SparseBooleanArray instead - SparseArray() // OK - } - - fun longSparseArray() { - // but only minSdkVersion >= 17 or if has v4 support lib - val myStringMap = HashMap() - } - - fun byteSparseArray() { - // bytes easily apply to ints - val myByteMap = HashMap() - } -} diff --git a/idea/testData/codeInsight/postfix/valAtLambaArgumentInCall.kt.after.181 b/idea/testData/codeInsight/postfix/valAtLambaArgumentInCall.kt.after.181 deleted file mode 100644 index 65f9497f7bb..00000000000 --- a/idea/testData/codeInsight/postfix/valAtLambaArgumentInCall.kt.after.181 +++ /dev/null @@ -1,5 +0,0 @@ -// ALLOW_MULTIPLE_EXPRESSIONS -fun bar(x: (Int) -> String) = x(1) -fun foo() { - val bar = bar() { y: Int -> "abc" } -} diff --git a/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunLiteral.out.181 b/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunLiteral.out.181 deleted file mode 100644 index 6fa03e855f1..00000000000 --- a/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunLiteral.out.181 +++ /dev/null @@ -1,12 +0,0 @@ -LineBreakpoint created at smartStepIntoInlinedFunLiteral.kt:6 -Run Java -Connected to the target VM -smartStepIntoInlinedFunLiteral.kt:6 -smartStepIntoInlinedFunLiteral.kt:11 -smartStepIntoInlinedFunLiteral.kt:12 -smartStepIntoInlinedFunLiteral.kt:17 -smartStepIntoInlinedFunLiteral.kt:18 -smartStepIntoInlinedFunLiteral.kt:1 -Disconnected from the target VM - -Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunctionalExpression.out.181 b/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunctionalExpression.out.181 deleted file mode 100644 index e7ec576d0cc..00000000000 --- a/idea/testData/debugger/tinyApp/src/stepping/custom/smartStepIntoInlinedFunctionalExpression.out.181 +++ /dev/null @@ -1,12 +0,0 @@ -LineBreakpoint created at smartStepIntoInlinedFunctionalExpression.kt:6 -Run Java -Connected to the target VM -smartStepIntoInlinedFunctionalExpression.kt:6 -smartStepIntoInlinedFunctionalExpression.kt:11 -smartStepIntoInlinedFunctionalExpression.kt:12 -smartStepIntoInlinedFunctionalExpression.kt:17 -smartStepIntoInlinedFunctionalExpression.kt:18 -smartStepIntoInlinedFunctionalExpression.kt:1 -Disconnected from the target VM - -Process finished with exit code 0 diff --git a/idea/testData/editor/quickDoc/JavaClassUsedInKotlin.kt.181 b/idea/testData/editor/quickDoc/JavaClassUsedInKotlin.kt.181 deleted file mode 100644 index 69728726e65..00000000000 --- a/idea/testData/editor/quickDoc/JavaClassUsedInKotlin.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -fun testing() { - SomeClass>() -} - -//INFO:
public class SomeClass<T extends List>
-//INFO: extends Object
-//INFO: Some Java Class -//INFO:

Type parameters:

<T> –
diff --git a/idea/testData/editor/quickDoc/JavaDocFromOverridenClass.kt.181 b/idea/testData/editor/quickDoc/JavaDocFromOverridenClass.kt.181 deleted file mode 100644 index 6cb3af1c474..00000000000 --- a/idea/testData/editor/quickDoc/JavaDocFromOverridenClass.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -class A : OverrideMe() { - override fun overrideMe() { - } -} - - -//INFO:
A
protected open fun overrideMe(): Unit

Description copied from class:

OverrideMe
-//INFO: Some comment -//INFO:

Overrides:

overrideMe in class OverrideMe

diff --git a/idea/testData/editor/quickDoc/JavaDocFromOverridenInterface.kt.181 b/idea/testData/editor/quickDoc/JavaDocFromOverridenInterface.kt.181 deleted file mode 100644 index b2a033087c4..00000000000 --- a/idea/testData/editor/quickDoc/JavaDocFromOverridenInterface.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -class A : OverrideMe { - override fun overrideMe() { - } -} - - -//INFO:
A
public open fun overrideMe(): Unit

Description copied from interface:

OverrideMe
-//INFO: Some comment -//INFO:

Specified by:

overrideMe in interface OverrideMe

diff --git a/idea/testData/editor/quickDoc/JavaMethodUsedInKotlin.kt.181 b/idea/testData/editor/quickDoc/JavaMethodUsedInKotlin.kt.181 deleted file mode 100644 index 236c74ac245..00000000000 --- a/idea/testData/editor/quickDoc/JavaMethodUsedInKotlin.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -fun ktTest() { - Test.foo("SomeTest") -} - -//INFO:
Test
@Contract(pure = true)  -//INFO: @NotNull  -//INFO: public static Object[] foo(String param)
-//INFO: Java Method -//INFO:

Inferred annotations:

@org.jetbrains.annotations.Contract(pure = true) @org.jetbrains.annotations.NotNull

diff --git a/idea/testData/editor/quickDoc/OnEnumValueOfFunction.kt.181 b/idea/testData/editor/quickDoc/OnEnumValueOfFunction.kt.181 deleted file mode 100644 index d8ce65d9d5a..00000000000 --- a/idea/testData/editor/quickDoc/OnEnumValueOfFunction.kt.181 +++ /dev/null @@ -1,12 +0,0 @@ -enum class E { - A -} - -fun use() { - E.valueOf("A") -} - - -//INFO:
E
public final fun valueOf( -//INFO: value: String -//INFO: ): E

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Throws:

IllegalArgumentException - if this enum type has no constant with the specified name

diff --git a/idea/testData/editor/quickDoc/OnFunctionDeclarationWithPackage.kt.181 b/idea/testData/editor/quickDoc/OnFunctionDeclarationWithPackage.kt.181 deleted file mode 100644 index 8d41702eade..00000000000 --- a/idea/testData/editor/quickDoc/OnFunctionDeclarationWithPackage.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -package test - -/** - - * - * - * Test function - - * - * @param first Some - * @param second Other - */ -fun testFun(first: String, second: Int) = 12 - -//INFO:
test OnFunctionDeclarationWithPackage.kt
public fun testFun( -//INFO: first: String, -//INFO: second: Int -//INFO: ): Int

Test function

Params:

first - Some

second - Other

diff --git a/idea/testData/editor/quickDoc/OnMethodUsage.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsage.kt.181 deleted file mode 100644 index aa3e96d39bc..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsage.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/** -Some documentation - - * @param a Some int - * @param b String - */ -fun testMethod(a: Int, b: String) { - -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsage.kt
public fun testMethod( -//INFO: a: Int, -//INFO: b: String -//INFO: ): Unit

Some documentation

Params:

a - Some int

b - String

diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithBracketsInParam.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithBracketsInParam.kt.181 deleted file mode 100644 index 06514ff6314..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithBracketsInParam.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/** -Some documentation - - * @param[a] Some int - * @param[b] String - */ -fun testMethod(a: Int, b: String) { - -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsageWithBracketsInParam.kt
public fun testMethod( -//INFO: a: Int, -//INFO: b: String -//INFO: ): Unit

Some documentation

Params:

a - Some int

b - String

diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithMultilineParam.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithMultilineParam.kt.181 deleted file mode 100644 index e998be01014..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithMultilineParam.kt.181 +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Some documentation - * on two lines. - * - * @param test String - * on two lines - */ -fun testMethod(test: String) { -} - -fun test() { - testMethod("") -} - -//INFO:
OnMethodUsageWithMultilineParam.kt
public fun testMethod( -//INFO: test: String -//INFO: ): Unit

Some documentation on two lines.

Params:

test - String on two lines

diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithReceiver.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithReceiver.kt.181 deleted file mode 100644 index 5714d922cd4..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithReceiver.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/** -Some documentation - - * @receiver Some int - * @param b String - * @return Return [a] and nothing else - */ -fun Int.testMethod(b: String) { - -} - -fun test() { - 1.testMethod("value") -} - -//INFO:
OnMethodUsageWithReceiver.kt
public fun Int.testMethod( -//INFO: b: String -//INFO: ): Unit

Some documentation

Receiver:

Some int

Params:

b - String

Returns:

Return a and nothing else
diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt.181 deleted file mode 100644 index d3486f55442..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndLink.kt.181 +++ /dev/null @@ -1,19 +0,0 @@ -/** -Some documentation - - * @param a Some int - * @param b String - * @return Return [a] and nothing else - */ -fun testMethod(a: Int, b: String) { - -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsageWithReturnAndLink.kt
public fun testMethod( -//INFO: a: Int, -//INFO: b: String -//INFO: ): Unit

Some documentation

Params:

a - Some int

b - String

Returns:

Return a and nothing else
diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndThrows.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndThrows.kt.181 deleted file mode 100644 index 910718215c6..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithReturnAndThrows.kt.181 +++ /dev/null @@ -1,20 +0,0 @@ -/** -Some documentation - - * @param a Some int - * @param b String - * @return Return value - * @throws IllegalArgumentException if the weather is bad - */ -fun testMethod(a: Int, b: String) { - -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsageWithReturnAndThrows.kt
public fun testMethod( -//INFO: a: Int, -//INFO: b: String -//INFO: ): Unit

Some documentation

Params:

a - Some int

b - String

Returns:

Return value

Throws:

IllegalArgumentException - if the weather is bad

diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithSee.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithSee.kt.181 deleted file mode 100644 index 31ff932dcb5..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithSee.kt.181 +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @see C - * @see D - * @see kotlin - */ -fun testMethod() { - -} - -class C { -} - -class D { -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsageWithSee.kt
public fun testMethod(): Unit

See Also:

C, D, kotlin
diff --git a/idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt.181 b/idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt.181 deleted file mode 100644 index 05920c5e641..00000000000 --- a/idea/testData/editor/quickDoc/OnMethodUsageWithTypeParameter.kt.181 +++ /dev/null @@ -1,19 +0,0 @@ -/** -Some documentation - - * @param T the type parameter - * @param a Some int - * @param b String - */ -fun testMethod(a: Int, b: String) { - -} - -fun test() { - testMethod(1, "value") -} - -//INFO:
OnMethodUsageWithTypeParameter.kt
public fun <T> testMethod( -//INFO: a: Int, -//INFO: b: String -//INFO: ): Unit

Some documentation

Params:

T - the type parameter

a - Some int

b - String

diff --git a/idea/testData/editor/quickDoc/Samples.kt.181 b/idea/testData/editor/quickDoc/Samples.kt.181 deleted file mode 100644 index 9ac8dbc7cb1..00000000000 --- a/idea/testData/editor/quickDoc/Samples.kt.181 +++ /dev/null @@ -1,29 +0,0 @@ -package magic - -object Samples { - fun sampleMagic() { - castTextSpell("[asd] [dse] [asz]") - } -} - -fun sampleScroll() { - val reader = Scroll("[asd] [dse] [asz]").reader() - castTextSpell(reader.readAll()) -} - -/** - * @sample Samples.sampleMagic - * @sample sampleScroll - */ -fun castTextSpell(spell: String) { - throw SecurityException("Magic prohibited outside Hogwarts") -} - -//INFO:
magic Samples.kt
public fun castTextSpell( -//INFO: spell: String -//INFO: ): Unit

Samples:

Samples.sampleMagic


-//INFO: castTextSpell("[asd] [dse] [asz]")
-//INFO: 

sampleScroll


-//INFO: val reader = Scroll("[asd] [dse] [asz]").reader()
-//INFO: castTextSpell(reader.readAll())
-//INFO: 
diff --git a/idea/testData/kdoc/multiModuleSamples/fqName/code/usage.kt.181 b/idea/testData/kdoc/multiModuleSamples/fqName/code/usage.kt.181 deleted file mode 100644 index fa7542af271..00000000000 --- a/idea/testData/kdoc/multiModuleSamples/fqName/code/usage.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @sample samples.SampleGroup.mySample - * @sample samples.megasamples.MegaSamplesGroup.megaSample - * @sample samples.notindir.NotInDirSamples.sssample - * @sample smaplez.a.b.c.Samplez.sssample - */ -fun some() { - -} - - -//INFO:
usage.kt
public fun some(): Unit

Samples:

samples.SampleGroup.mySample


-//INFO: println("Hello, world")
-//INFO: 

samples.megasamples.MegaSamplesGroup.megaSample


-//INFO: println("...---...")
-//INFO: 

samples.notindir.NotInDirSamples.sssample


-//INFO: println("location is samplesTest/")
-//INFO: 

smaplez.a.b.c.Samplez.sssample

// Unresolved
diff --git a/idea/testData/kdoc/multiModuleSamples/simple/code/usage.kt.181 b/idea/testData/kdoc/multiModuleSamples/simple/code/usage.kt.181 deleted file mode 100644 index dbd4c9cf438..00000000000 --- a/idea/testData/kdoc/multiModuleSamples/simple/code/usage.kt.181 +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @sample samples.sample - */ -fun some() { - -} - -//INFO:
usage.kt
public fun some(): Unit

Samples:

samples.sample


-//INFO: println("Hello, world")
-//INFO: 
diff --git a/idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.java.181 b/idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.java.181 deleted file mode 100644 index 86cd918380d..00000000000 --- a/idea/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.java.181 +++ /dev/null @@ -1,8 +0,0 @@ -package test; -import foo.A; - -public class ThrowsOnGenericMethod { - public static void main(String[] args) { - new A().foo(""); - } -} diff --git a/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.181 b/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.181 deleted file mode 100644 index cb337570a03..00000000000 --- a/idea/testData/quickfix/abstract/abstractFunctionWithBodyWithComments2.kt.after.181 +++ /dev/null @@ -1,5 +0,0 @@ -// "Remove function body" "true" -abstract class A() { - /*1*/ - abstract fun foo() // 3 -} diff --git a/idea/testData/quickfix/typeMismatch/paramTypeLambdaMismatch.kt.181 b/idea/testData/quickfix/typeMismatch/paramTypeLambdaMismatch.kt.181 deleted file mode 100644 index 23492a5fe55..00000000000 --- a/idea/testData/quickfix/typeMismatch/paramTypeLambdaMismatch.kt.181 +++ /dev/null @@ -1,12 +0,0 @@ -// "Surround with lambda" "false" -// ERROR: Type mismatch: inferred type is Object but () -> String was expected -// ACTION: Annotate constructor 'Object' as @Deprecated -// ACTION: Change parameter 'block' type of function 'str' to 'Object' -// ACTION: Create function 'str' -// ACTION: Edit method contract of 'Object' -// ACTION: Introduce import alias -fun fn() { - str(Object()) -} - -fun str(block: () -> String) {} \ No newline at end of file diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.181 b/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.181 deleted file mode 100644 index 70b02417c61..00000000000 --- a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.181 +++ /dev/null @@ -1,7 +0,0 @@ -// "Suppress for declarations annotated by 'xxx.XXX'" "true" -package xxx - -annotation class XXX - -@XXX -class UnusedClass diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.181 b/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.181 deleted file mode 100644 index 70b02417c61..00000000000 --- a/idea/testData/quickfix/unusedSuppressAnnotation/simple.kt.after.181 +++ /dev/null @@ -1,7 +0,0 @@ -// "Suppress for declarations annotated by 'xxx.XXX'" "true" -package xxx - -annotation class XXX - -@XXX -class UnusedClass diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.181 deleted file mode 100644 index 1a7942717bf..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt.181 +++ /dev/null @@ -1,240 +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.configuration - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.PathMacros -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.ModuleManager -import com.intellij.openapi.project.Project -import com.intellij.openapi.projectRoots.ProjectJdkTable -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ProjectRootManager -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.util.io.FileUtilRt -import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess -import com.intellij.testFramework.PlatformTestCase -import com.intellij.testFramework.UsefulTestCase -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState -import org.jetbrains.kotlin.idea.framework.KotlinSdkType -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.utils.PathUtil -import java.io.File -import java.nio.file.Path - -abstract class AbstractConfigureKotlinTest : PlatformTestCase() { - override fun setUp() { - super.setUp() - - VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory()) - } - - @Throws(Exception::class) - override fun tearDown() { - VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory()) - PathMacros.getInstance().removeMacro(TEMP_DIR_MACRO_KEY) - - super.tearDown() - } - - @Throws(Exception::class) - override fun initApplication() { - super.initApplication() - - KotlinSdkType.setUpIfNeeded() - - ApplicationManager.getApplication().runWriteAction { - ProjectJdkTable.getInstance().addJdk(PluginTestCaseBase.mockJdk6()) - ProjectJdkTable.getInstance().addJdk(PluginTestCaseBase.mockJdk8()) - ProjectJdkTable.getInstance().addJdk(PluginTestCaseBase.mockJdk9()) - } - - PluginTestCaseBase.clearSdkTable(testRootDisposable) - - val tempLibDir = FileUtil.createTempDirectory("temp", null) - PathMacros.getInstance().setMacro(TEMP_DIR_MACRO_KEY, FileUtilRt.toSystemDependentName(tempLibDir.absolutePath)) - } - - protected fun doTestConfigureModulesWithNonDefaultSetup(configurator: KotlinWithLibraryConfigurator) { - assertNoFilesInDefaultPaths() - - val modules = modules - for (module in modules) { - assertNotConfigured(module, configurator) - } - - configurator.configure(myProject, emptyList()) - - assertNoFilesInDefaultPaths() - - for (module in modules) { - assertProperlyConfigured(module, configurator) - } - } - - protected fun doTestOneJavaModule(jarState: FileState) { - doTestOneModule(jarState, JAVA_CONFIGURATOR) - } - - protected fun doTestOneJsModule(jarState: FileState) { - doTestOneModule(jarState, JS_CONFIGURATOR) - } - - private fun doTestOneModule(jarState: FileState, configurator: KotlinWithLibraryConfigurator) { - val module = module - - assertNotConfigured(module, configurator) - configure(module, jarState, configurator) - assertProperlyConfigured(module, configurator) - } - - override fun getModule(): Module { - val modules = ModuleManager.getInstance(myProject).modules - assert(modules.size == 1) { "One module should be loaded " + modules.size } - myModule = modules[0] - return super.getModule() - } - - val modules: Array - get() = ModuleManager.getInstance(myProject).modules - - override fun getProjectDirOrFile(): Path { - val projectFilePath = projectRoot + "/projectFile.ipr" - TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists()) - return File(projectFilePath).toPath() - } - - override fun doCreateProject(projectFile: Path): Project { - return myProjectManager.loadProject(projectFile.toFile().path)!! - } - - private val projectName: String - get() { - val testName = getTestName(true) - return if (testName.contains("_")) { - testName.substring(0, testName.indexOf("_")) - } - else testName - } - - protected val projectRoot: String - get() = BASE_PATH + projectName - - override fun setUpModule() {} - - private fun assertNoFilesInDefaultPaths() { - UsefulTestCase.assertDoesntExist(File(JAVA_CONFIGURATOR.getDefaultPathToJarFile(project))) - UsefulTestCase.assertDoesntExist(File(JS_CONFIGURATOR.getDefaultPathToJarFile(project))) - } - - companion object { - private val BASE_PATH = "idea/testData/configuration/" - private val TEMP_DIR_MACRO_KEY = "TEMP_TEST_DIR" - protected val JAVA_CONFIGURATOR: KotlinJavaModuleConfigurator by lazy { - object : KotlinJavaModuleConfigurator() { - override fun getDefaultPathToJarFile(project: Project) = getPathRelativeToTemp("default_jvm_lib") - } - } - - protected val JS_CONFIGURATOR: KotlinJsModuleConfigurator by lazy { - object : KotlinJsModuleConfigurator() { - override fun getDefaultPathToJarFile(project: Project) = getPathRelativeToTemp("default_js_lib") - } - } - - private fun configure( - modules: List, - runtimeState: FileState, - configurator: KotlinWithLibraryConfigurator, - jarFromDist: String, - jarFromTemp: String - ) { - val project = modules.first().project - val collector = createConfigureKotlinNotificationCollector(project) - - val pathToJar = getPathToJar(runtimeState, jarFromDist, jarFromTemp) - for (module in modules) { - configurator.configureModule(module, pathToJar, pathToJar, collector, runtimeState) - } - collector.showNotification() - } - - private fun getPathToJar(runtimeState: FileState, jarFromDist: String, jarFromTemp: String) = when (runtimeState) { - KotlinWithLibraryConfigurator.FileState.EXISTS -> jarFromDist - KotlinWithLibraryConfigurator.FileState.COPY -> jarFromTemp - KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> jarFromDist - } - - protected fun configure(module: Module, jarState: FileState, configurator: KotlinProjectConfigurator) { - if (configurator is KotlinJavaModuleConfigurator) { - configure(listOf(module), jarState, - configurator as KotlinWithLibraryConfigurator, - pathToExistentRuntimeJar, pathToNonexistentRuntimeJar) - } - if (configurator is KotlinJsModuleConfigurator) { - configure(listOf(module), jarState, - configurator as KotlinWithLibraryConfigurator, - pathToExistentJsJar, pathToNonexistentJsJar) - } - } - - private val pathToNonexistentRuntimeJar: String - get() { - val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR - PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) - return pathToTempKotlinRuntimeJar - } - - private val pathToNonexistentJsJar: String - get() { - val pathToTempKotlinRuntimeJar = FileUtil.getTempDirectory() + "/" + PathUtil.JS_LIB_JAR_NAME - PlatformTestCase.myFilesToDelete.add(File(pathToTempKotlinRuntimeJar)) - return pathToTempKotlinRuntimeJar - } - - private val pathToExistentRuntimeJar: String - get() = PathUtil.kotlinPathsForDistDirectory.stdlibPath.parent - - private val pathToExistentJsJar: String - get() = PathUtil.kotlinPathsForDistDirectory.jsStdLibJarPath.parent - - protected fun assertNotConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - TestCase.assertFalse( - String.format("Module %s should not be configured as %s Module", module.name, configurator.presentableText), - configurator.isConfigured(module)) - } - - protected fun assertConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - TestCase.assertTrue(String.format("Module %s should be configured with configurator '%s'", module.name, - configurator.presentableText), - configurator.isConfigured(module)) - } - - protected fun assertProperlyConfigured(module: Module, configurator: KotlinWithLibraryConfigurator) { - assertConfigured(module, configurator) - assertNotConfigured(module, getOppositeConfigurator(configurator)) - } - - private fun getOppositeConfigurator(configurator: KotlinWithLibraryConfigurator): KotlinWithLibraryConfigurator { - if (configurator === JAVA_CONFIGURATOR) return JS_CONFIGURATOR - if (configurator === JS_CONFIGURATOR) return JAVA_CONFIGURATOR - - throw IllegalArgumentException("Only JS_CONFIGURATOR and JAVA_CONFIGURATOR are supported") - } - - private fun getPathRelativeToTemp(relativePath: String): String { - val tempPath = PathMacros.getInstance().getValue(TEMP_DIR_MACRO_KEY) - return tempPath + '/' + relativePath - } - } - - override fun getTestProjectJdk(): Sdk { - val projectRootManager = ProjectRootManager.getInstance(project) - return projectRootManager.projectSdk ?: throw IllegalStateException("SDK ${projectRootManager.projectSdkName} was not found") - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java.181 b/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java.181 deleted file mode 100644 index c7d0d314d43..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinTest.java.181 +++ /dev/null @@ -1,379 +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.configuration; - -import com.intellij.jarRepository.RepositoryLibraryType; -import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProviderImpl; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.LibraryOrderEntry; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.RootPolicy; -import com.intellij.openapi.roots.impl.libraries.LibraryEx; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiJavaModule; -import com.intellij.psi.PsiRequiresStatement; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.kotlin.cli.common.arguments.InternalArgument; -import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments; -import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments; -import org.jetbrains.kotlin.config.*; -import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder; -import org.jetbrains.kotlin.idea.facet.FacetUtilsKt; -import org.jetbrains.kotlin.idea.facet.KotlinFacet; -import org.jetbrains.kotlin.idea.framework.JSLibraryKind; -import org.jetbrains.kotlin.idea.framework.JsLibraryStdDetectionUtil; -import org.jetbrains.kotlin.idea.framework.LibraryEffectiveKindProviderKt; -import org.jetbrains.kotlin.idea.project.PlatformKt; -import org.jetbrains.kotlin.idea.util.Java9StructureUtilKt; -import org.jetbrains.kotlin.idea.versions.KotlinRuntimeLibraryUtilKt; -import org.jetbrains.kotlin.platform.impl.JsIdePlatformKind; -import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind; -import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleKt; -import org.jetbrains.kotlin.utils.PathUtil; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.StreamSupport; - -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; - -public class ConfigureKotlinTest extends AbstractConfigureKotlinTest { - public void testNewLibrary_copyJar() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.COPY); - - ModuleRootManager.getInstance(getModule()).orderEntries().forEachLibrary(library -> { - assertSameElements( - Arrays.stream(library.getRootProvider().getFiles(OrderRootType.CLASSES)).map(VirtualFile::getName).toArray(), - PathUtil.KOTLIN_JAVA_STDLIB_JAR, PathUtil.KOTLIN_JAVA_REFLECT_JAR, PathUtil.KOTLIN_TEST_JAR); - - assertSameElements( - Arrays.stream(library.getRootProvider().getFiles(OrderRootType.SOURCES)).map(VirtualFile::getName).toArray(), - PathUtil.KOTLIN_JAVA_STDLIB_SRC_JAR, PathUtil.KOTLIN_REFLECT_SRC_JAR, PathUtil.KOTLIN_TEST_SRC_JAR); - - return true; - }); - } - - public void testNewLibrary_doNotCopyJar() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY); - } - - public void testLibraryWithoutPaths_jarExists() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.EXISTS); - } - - public void testNewLibrary_jarExists() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.EXISTS); - } - - public void testLibraryWithoutPaths_copyJar() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.COPY); - } - - public void testLibraryWithoutPaths_doNotCopyJar() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY); - } - - @SuppressWarnings("ConstantConditions") - public void testTwoModules_exists() { - Module[] modules = getModules(); - for (Module module : modules) { - if (module.getName().equals("module1")) { - Companion.configure(module, KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY, Companion.getJAVA_CONFIGURATOR()); - Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR()); - } - else if (module.getName().equals("module2")) { - Companion.assertNotConfigured(module, Companion.getJAVA_CONFIGURATOR()); - Companion.configure(module, KotlinWithLibraryConfigurator.FileState.EXISTS, Companion.getJAVA_CONFIGURATOR()); - Companion.assertConfigured(module, Companion.getJAVA_CONFIGURATOR()); - } - } - } - - public void testLibraryNonDefault_libExistInDefault() throws IOException { - Module module = getModule(); - - // Move fake runtime jar to default library path to pretend library is already configured - FileUtil.copy( - new File(getProject().getBasePath() + "/lib/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR), - new File(Companion.getJAVA_CONFIGURATOR().getDefaultPathToJarFile(getProject()) + "/" + PathUtil.KOTLIN_JAVA_STDLIB_JAR)); - - Companion.assertNotConfigured(module, Companion.getJAVA_CONFIGURATOR()); - Companion.getJAVA_CONFIGURATOR().configure(myProject, Collections.emptyList()); - Companion.assertProperlyConfigured(module, Companion.getJAVA_CONFIGURATOR()); - } - - public void testTwoModulesWithNonDefaultPath_doNotCopyInDefault() throws IOException { - doTestConfigureModulesWithNonDefaultSetup(Companion.getJAVA_CONFIGURATOR()); - assertEmpty(ConfigureKotlinInProjectUtilsKt.getCanBeConfiguredModules(myProject, Companion.getJS_CONFIGURATOR())); - } - - public void testTwoModulesWithJSNonDefaultPath_doNotCopyInDefault() throws IOException { - doTestConfigureModulesWithNonDefaultSetup(Companion.getJS_CONFIGURATOR()); - assertEmpty(ConfigureKotlinInProjectUtilsKt.getCanBeConfiguredModules(myProject, Companion.getJAVA_CONFIGURATOR())); - } - - public void testNewLibrary_jarExists_js() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.EXISTS); - } - - public void testNewLibrary_copyJar_js() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.COPY); - } - - public void testNewLibrary_doNotCopyJar_js() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY); - } - - public void testJsLibraryWithoutPaths_jarExists() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.EXISTS); - } - - public void testJsLibraryWithoutPaths_copyJar() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.COPY); - } - - public void testJsLibraryWithoutPaths_doNotCopyJar() { - doTestOneJsModule(KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY); - } - - public void testJsLibraryWrongKind() { - AbstractConfigureKotlinTest.Companion.assertProperlyConfigured(getModule(), AbstractConfigureKotlinTest.Companion.getJS_CONFIGURATOR()); - assertEquals(1, ModuleRootManager.getInstance(getModule()).orderEntries().process(new LibraryCountingRootPolicy(), 0).intValue()); - } - - public void testProjectWithoutFacetWithRuntime106WithoutLanguageLevel() { - assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion()); - assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion()); - } - - public void testProjectWithoutFacetWithRuntime11WithoutLanguageLevel() { - assertEquals(LanguageVersion.KOTLIN_1_1, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion()); - assertEquals(LanguageVersion.KOTLIN_1_1, PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion()); - } - - public void testProjectWithoutFacetWithRuntime11WithLanguageLevel10() { - assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion()); - assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion()); - } - - public void testProjectWithFacetWithRuntime11WithLanguageLevel10() { - assertEquals(LanguageVersion.KOTLIN_1_0, PlatformKt.getLanguageVersionSettings(getModule()).getLanguageVersion()); - assertEquals(LanguageVersion.LATEST_STABLE, PlatformKt.getLanguageVersionSettings(myProject, null).getLanguageVersion()); - } - - public void testJsLibraryVersion11() { - Library jsRuntime = KotlinRuntimeLibraryUtilKt.findAllUsedLibraries(myProject).keySet().iterator().next(); - String version = JsLibraryStdDetectionUtil.INSTANCE.getJsLibraryStdVersion(jsRuntime, myProject); - assertEquals("1.1.0", version); - } - - public void testJsLibraryVersion106() { - Library jsRuntime = KotlinRuntimeLibraryUtilKt.findAllUsedLibraries(myProject).keySet().iterator().next(); - String version = JsLibraryStdDetectionUtil.INSTANCE.getJsLibraryStdVersion(jsRuntime, myProject); - assertEquals("1.0.6", version); - } - - @SuppressWarnings("ConstantConditions") - public void testMavenProvidedTestJsKind() { - LibraryEx jsTest = (LibraryEx) ContainerUtil.find( - KotlinRuntimeLibraryUtilKt.findAllUsedLibraries(myProject).keySet(), - (library) -> library.getName().contains("kotlin-test-js") - ); - assertEquals(RepositoryLibraryType.REPOSITORY_LIBRARY_KIND, jsTest.getKind()); - assertEquals(JSLibraryKind.INSTANCE, LibraryEffectiveKindProviderKt.effectiveKind(jsTest, myProject)); - } - - @SuppressWarnings("ConstantConditions") - public void testJvmProjectWithV1FacetConfig() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - K2JVMCompilerArguments arguments = (K2JVMCompilerArguments) settings.getCompilerArguments(); - assertEquals(false, settings.getUseProjectSettings()); - assertEquals("1.1", settings.getLanguageLevel().getDescription()); - assertEquals("1.0", settings.getApiLevel().getDescription()); - assertEquals(new JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), settings.getPlatform()); - assertEquals("1.1", arguments.getLanguageVersion()); - assertEquals("1.0", arguments.getApiVersion()); - assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, CoroutineSupport.byCompilerArguments(arguments)); - assertEquals("1.7", arguments.getJvmTarget()); - assertEquals("-version -Xallow-kotlin-package -Xskip-metadata-version-check", settings.getCompilerSettings().getAdditionalArguments()); - } - - @SuppressWarnings("ConstantConditions") - public void testJsProjectWithV1FacetConfig() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - K2JSCompilerArguments arguments = (K2JSCompilerArguments) settings.getCompilerArguments(); - assertEquals(false, settings.getUseProjectSettings()); - assertEquals("1.1", settings.getLanguageLevel().getDescription()); - assertEquals("1.0", settings.getApiLevel().getDescription()); - assertEquals(JsIdePlatformKind.Platform.INSTANCE, settings.getPlatform()); - assertEquals("1.1", arguments.getLanguageVersion()); - assertEquals("1.0", arguments.getApiVersion()); - assertEquals(LanguageFeature.State.ENABLED_WITH_WARNING, CoroutineSupport.byCompilerArguments(arguments)); - assertEquals("amd", arguments.getModuleKind()); - assertEquals("-version -meta-info", settings.getCompilerSettings().getAdditionalArguments()); - } - - @SuppressWarnings("ConstantConditions") - public void testJvmProjectWithV2FacetConfig() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - K2JVMCompilerArguments arguments = (K2JVMCompilerArguments) settings.getCompilerArguments(); - assertEquals(false, settings.getUseProjectSettings()); - assertEquals("1.1", settings.getLanguageLevel().getDescription()); - assertEquals("1.0", settings.getApiLevel().getDescription()); - assertEquals(new JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), settings.getPlatform()); - assertEquals("1.1", arguments.getLanguageVersion()); - assertEquals("1.0", arguments.getApiVersion()); - assertEquals(LanguageFeature.State.ENABLED, CoroutineSupport.byCompilerArguments(arguments)); - assertEquals("1.7", arguments.getJvmTarget()); - assertEquals("-version -Xallow-kotlin-package -Xskip-metadata-version-check", settings.getCompilerSettings().getAdditionalArguments()); - } - - @SuppressWarnings("ConstantConditions") - public void testJsProjectWithV2FacetConfig() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - K2JSCompilerArguments arguments = (K2JSCompilerArguments) settings.getCompilerArguments(); - assertEquals(false, settings.getUseProjectSettings()); - assertEquals("1.1", settings.getLanguageLevel().getDescription()); - assertEquals("1.0", settings.getApiLevel().getDescription()); - assertEquals(JsIdePlatformKind.Platform.INSTANCE, settings.getPlatform()); - assertEquals("1.1", arguments.getLanguageVersion()); - assertEquals("1.0", arguments.getApiVersion()); - assertEquals(LanguageFeature.State.ENABLED_WITH_ERROR, CoroutineSupport.byCompilerArguments(arguments)); - assertEquals("amd", arguments.getModuleKind()); - assertEquals("-version -meta-info", settings.getCompilerSettings().getAdditionalArguments()); - } - - @SuppressWarnings("ConstantConditions") - public void testJvmProjectWithV3FacetConfig() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - K2JVMCompilerArguments arguments = (K2JVMCompilerArguments) settings.getCompilerArguments(); - assertEquals(false, settings.getUseProjectSettings()); - assertEquals("1.1", settings.getLanguageLevel().getDescription()); - assertEquals("1.0", settings.getApiLevel().getDescription()); - assertEquals(new JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), settings.getPlatform()); - assertEquals("1.1", arguments.getLanguageVersion()); - assertEquals("1.0", arguments.getApiVersion()); - assertEquals(LanguageFeature.State.ENABLED, CoroutineSupport.byCompilerArguments(arguments)); - assertEquals("1.7", arguments.getJvmTarget()); - assertEquals("-version -Xallow-kotlin-package -Xskip-metadata-version-check", settings.getCompilerSettings().getAdditionalArguments()); - } - - public void testJvmProjectWithJvmTarget11() { - KotlinFacetSettings settings = KotlinFacetSettingsProvider.Companion.getInstance(myProject).getInitializedSettings(getModule()); - assertEquals(new JvmIdePlatformKind.Platform(JvmTarget.JVM_11), settings.getPlatform()); - } - - public void testImplementsDependency() { - ModuleManager moduleManager = ModuleManager.getInstance(myProject); - - Module module1 = moduleManager.findModuleByName("module1"); - assert module1 != null; - - Module module2 = moduleManager.findModuleByName("module2"); - assert module2 != null; - - assertEquals(KotlinFacet.Companion.get(module1).getConfiguration().getSettings().getImplementedModuleNames(), emptyList()); - assertEquals(KotlinFacet.Companion.get(module2).getConfiguration().getSettings().getImplementedModuleNames(), singletonList("module1")); - } - - public void testJava9WithModuleInfo() { - checkAddStdlibModule(); - } - - public void testJava9WithModuleInfoWithStdlibAlready() { - checkAddStdlibModule(); - } - - public void testProjectWithFreeArgs() { - assertEquals( - Collections.singletonList("true"), - KotlinCommonCompilerArgumentsHolder.Companion.getInstance(myProject).getSettings().getFreeArgs() - ); - } - - public void testProjectWithInternalArgs() { - List internalArguments = - KotlinCommonCompilerArgumentsHolder.Companion.getInstance(myProject).getSettings().getInternalArguments(); - assertEquals( - 0, - internalArguments.size() - ); - } - - private void checkAddStdlibModule() { - doTestOneJavaModule(KotlinWithLibraryConfigurator.FileState.COPY); - - Module module = getModule(); - Sdk moduleSdk = ModuleRootManager.getInstance(getModule()).getSdk(); - assertNotNull("Module SDK is not defined", moduleSdk); - - PsiJavaModule javaModule = Java9StructureUtilKt.findFirstPsiJavaModule(module); - assertNotNull(javaModule); - - PsiRequiresStatement stdlibDirective = - Java9StructureUtilKt.findRequireDirective(javaModule, JavaModuleKt.KOTLIN_STDLIB_MODULE_NAME); - assertNotNull("Require directive for " + JavaModuleKt.KOTLIN_STDLIB_MODULE_NAME + " is expected", - stdlibDirective); - - long numberOfStdlib = StreamSupport.stream(javaModule.getRequires().spliterator(), false) - .filter((statement) -> JavaModuleKt.KOTLIN_STDLIB_MODULE_NAME.equals(statement.getModuleName())) - .count(); - - assertTrue("Only one standard library directive is expected", numberOfStdlib == 1); - } - - private void configureFacetAndCheckJvm(JvmTarget jvmTarget) { - IdeModifiableModelsProviderImpl modelsProvider = new IdeModifiableModelsProviderImpl(getProject()); - try { - KotlinFacet facet = FacetUtilsKt.getOrCreateFacet(getModule(), modelsProvider, false, null, false); - JvmIdePlatformKind.Platform platform = new JvmIdePlatformKind.Platform(jvmTarget); - FacetUtilsKt.configureFacet( - facet, - "1.1", - LanguageFeature.State.ENABLED, - platform, - modelsProvider - ); - assertEquals(platform, facet.getConfiguration().getSettings().getPlatform()); - assertEquals(jvmTarget.getDescription(), - ((K2JVMCompilerArguments) facet.getConfiguration().getSettings().getCompilerArguments()).getJvmTarget()); - } - finally { - modelsProvider.dispose(); - } - } - - @SuppressWarnings("ConstantConditions") - public void testJvm8InProjectJvm6InModule() { - configureFacetAndCheckJvm(JvmTarget.JVM_1_6); - } - - @SuppressWarnings("ConstantConditions") - public void testJvm6InProjectJvm8InModule() { - configureFacetAndCheckJvm(JvmTarget.JVM_1_8); - } - - public void testProjectWithoutFacetWithJvmTarget18() { - assertEquals(new JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), PlatformKt.getPlatform(getModule())); - } - - private static class LibraryCountingRootPolicy extends RootPolicy { - @Override - public Integer visitLibraryOrderEntry(LibraryOrderEntry libraryOrderEntry, Integer value) { - return value + 1; - } - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinOutputChecker.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinOutputChecker.kt.181 deleted file mode 100644 index 8992bcc137e..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinOutputChecker.kt.181 +++ /dev/null @@ -1,119 +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.debugger - -import com.intellij.debugger.impl.OutputChecker -import com.intellij.idea.IdeaLogger -import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.util.SystemInfo -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.util.io.FileUtilRt -import com.intellij.openapi.util.text.StringUtilRt -import com.intellij.openapi.vfs.CharsetToolkit -import org.junit.Assert -import java.io.File - -internal class KotlinOutputChecker( - private val testDir: String, - appPath: String, outputPath: String) : OutputChecker(appPath, outputPath) { - companion object { - @JvmStatic - private val LOG = Logger.getInstance(KotlinOutputChecker::class.java) - - private val CONNECT_PREFIX = "Connected to the target VM" - private val DISCONNECT_PREFIX = "Disconnected from the target VM" - private val RUN_JAVA = "Run Java" - - //ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 - private val JDI_BUG_OUTPUT_PATTERN_1 = Regex("ERROR:\\s+JDWP\\s+Unable\\s+to\\s+get\\s+JNI\\s+1\\.2\\s+environment,\\s+jvm->GetEnv\\(\\)\\s+return\\s+code\\s+=\\s+-2") - //JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820] - private val JDI_BUG_OUTPUT_PATTERN_2 = Regex("JDWP\\s+exit\\s+error\\s+AGENT_ERROR_NO_JNI_ENV.*]") - } - - // Copied from the base OutputChecker.checkValid(). Need to intercept call to base preprocessBuffer() method - override fun checkValid(jdk: Sdk, sortClassPath: Boolean) { - if (IdeaLogger.ourErrorsOccurred != null) { - throw IdeaLogger.ourErrorsOccurred - } - - val actual = preprocessBuffer(buildOutputString()) - - val outDir = File(testDir) - var outFile = File(outDir, myTestName + ".out") - if (!outFile.exists()) { - if (SystemInfo.isWindows) { - val winOut = File(outDir, myTestName + ".win.out") - if (winOut.exists()) { - outFile = winOut - } - } - else if (SystemInfo.isUnix) { - val unixOut = File(outDir, myTestName + ".unx.out") - if (unixOut.exists()) { - outFile = unixOut - } - } - } - - if (!outFile.exists()) { - FileUtil.writeToFile(outFile, actual) - LOG.error("Test file created ${outFile.path}\n**************** Don't forget to put it into VCS! *******************") - } - else { - val originalText = FileUtilRt.loadFile(outFile, CharsetToolkit.UTF8) - val expected = StringUtilRt.convertLineSeparators(originalText) - if (expected != actual) { - println("expected:") - println(originalText) - println("actual:") - println(actual) - - val len = Math.min(expected.length, actual.length) - if (expected.length != actual.length) { - println("Text sizes differ: expected " + expected.length + " but actual: " + actual.length) - } - if (expected.length > len) { - println("Rest from expected text is: \"" + expected.substring(len) + "\"") - } - else if (actual.length > len) { - println("Rest from actual text is: \"" + actual.substring(len) + "\"") - } - - Assert.assertEquals(originalText, actual) - } - } - } - - private fun preprocessBuffer(buffer: String): String { - val lines = buffer.lines().toMutableList() - - val connectedIndex = lines.indexOfFirst { it.startsWith(CONNECT_PREFIX) } - lines[connectedIndex] = CONNECT_PREFIX - - val runCommandIndex = connectedIndex - 1 - lines[runCommandIndex] = RUN_JAVA - - val disconnectedIndex = lines.indexOfFirst { it.startsWith(DISCONNECT_PREFIX) } - lines[disconnectedIndex] = DISCONNECT_PREFIX - - return lines.filter { !(it.matches(JDI_BUG_OUTPUT_PATTERN_1) || it.matches(JDI_BUG_OUTPUT_PATTERN_2)) }.joinToString("\n") - } - - private fun buildOutputString(): String { - // Call base method with reflection - val m = OutputChecker::class.java.getDeclaredMethod("buildOutputString")!! - val isAccessible = m.isAccessible - - try { - m.isAccessible = true - return m.invoke(this) as String - } - finally { - m.isAccessible = isAccessible - } - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java.181 b/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java.181 deleted file mode 100644 index 09de8f661ea..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/folding/AbstractKotlinFoldingTest.java.181 +++ /dev/null @@ -1,101 +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.folding; - -import com.intellij.codeInsight.folding.JavaCodeFoldingSettings; -import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsImpl; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.testFramework.PlatformTestCase; -import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase; -import org.jetbrains.kotlin.test.SettingsConfigurator; -import org.junit.Assert; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.function.Consumer; - -public abstract class AbstractKotlinFoldingTest extends KotlinLightCodeInsightFixtureTestCase { - protected void doTest(@NotNull String path) { - myFixture.testFolding(path); - } - - protected void doSettingsFoldingTest(@NotNull String path) throws IOException{ - String fileText = FileUtil.loadFile(new File(path), true); - - String directText = fileText.replaceAll("~true~", "true").replaceAll("~false~", "false"); - directText += "\n\n// Generated from: " + path; - - Consumer doExpandSettingsTestFunction = this::doExpandSettingsTest; - - doTestWithSettings(directText, doExpandSettingsTestFunction); - - String invertedText = fileText - .replaceAll("~false~", "true").replaceAll("~true~", "false") - .replaceAll(SettingsConfigurator.SET_TRUE_DIRECTIVE, "~TEMP_TRUE_DIRECTIVE~") - .replaceAll(SettingsConfigurator.SET_FALSE_DIRECTIVE, SettingsConfigurator.SET_TRUE_DIRECTIVE) - .replaceAll("~TEMP_TRUE_DIRECTIVE~", SettingsConfigurator.SET_FALSE_DIRECTIVE); - invertedText += "\n\n// Generated from: " + path + " with !INVERTED! settings"; - - doTestWithSettings(invertedText, doExpandSettingsTestFunction); - } - - protected static void doTestWithSettings(@NotNull String fileText, @NotNull Consumer runnable) { - JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance(); - JavaCodeFoldingSettingsImpl restoreSettings = new JavaCodeFoldingSettingsImpl(); - restoreSettings.loadState((JavaCodeFoldingSettingsImpl) settings); - - try { - SettingsConfigurator configurator = new SettingsConfigurator(fileText, settings); - configurator.configureSettings(); - - runnable.accept(fileText); - } - finally { - ((JavaCodeFoldingSettingsImpl) JavaCodeFoldingSettings.getInstance()).loadState(restoreSettings); - } - } - - private void doExpandSettingsTest(String fileText) { - try { - VirtualFile tempFile = PlatformTestCase.createTempFile("kt", null, fileText, Charset.defaultCharset()); - assertFoldingRegionsForFile(tempFile.getPath()); - } - catch (IOException e) { - throw new IllegalStateException(e); - } - } - - // Rewritten version of CodeInsightTestFixtureImpl.testFoldingRegions(verificationFileName, true). - // Configure test with custom file name to force creating different editors for normal and inverted tests. - private void assertFoldingRegionsForFile(String verificationFileName) { - String START_FOLD = ""; - String END_FOLD = ""; - - String expectedContent; - File file = new File(verificationFileName); - - try { - expectedContent = FileUtil.loadFile(file); - } - catch (IOException e) { - throw new RuntimeException(e); - } - Assert.assertNotNull(expectedContent); - - expectedContent = StringUtil.replace(expectedContent, "\r", ""); - String cleanContent = expectedContent.replaceAll(START_FOLD, "").replaceAll(END_FOLD, ""); - - myFixture.configureByText(file.getName(), cleanContent); - String actual = ((CodeInsightTestFixtureImpl)myFixture).getFoldingDescription(true); - - Assert.assertEquals(expectedContent, actual); - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt.181 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt.181 deleted file mode 100644 index df0547211b2..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/multiplatform/multiPlatformSetup.kt.181 +++ /dev/null @@ -1,215 +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.multiplatform - -import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.module.Module -import com.intellij.openapi.module.StdModuleTypes -import com.intellij.openapi.roots.CompilerModuleExtension -import com.intellij.openapi.roots.ModuleRootModificationUtil -import com.intellij.openapi.vfs.LocalFileSystem -import com.intellij.testFramework.PlatformTestCase -import junit.framework.TestCase -import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime -import org.jetbrains.kotlin.config.JvmTarget -import org.jetbrains.kotlin.idea.framework.CommonLibraryKind -import org.jetbrains.kotlin.idea.framework.JSLibraryKind -import org.jetbrains.kotlin.idea.stubs.AbstractMultiModuleTest -import org.jetbrains.kotlin.idea.stubs.createFacet -import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.platform.IdePlatform -import org.jetbrains.kotlin.platform.impl.* -import org.jetbrains.kotlin.test.TestJdkKind -import java.io.File - -// allows to configure a test mpp project -// testRoot is supposed to contain several directories which contain module sources roots -// configuration is based on those directories names -fun AbstractMultiModuleTest.setupMppProjectFromDirStructure(testRoot: File) { - assert(testRoot.isDirectory) { testRoot.absolutePath + " must be a directory" } - val dirs = testRoot.listFiles().filter { it.isDirectory } - val rootInfos = dirs.map { parseDirName(it) } - val infosByModuleId = rootInfos.groupBy { it.moduleId } - val modulesById = infosByModuleId.mapValues { (moduleId, infos) -> - createModuleWithRoots(moduleId, infos) - } - - infosByModuleId.entries.forEach { (id, rootInfos) -> - val module = modulesById[id]!! - rootInfos.flatMap { it.dependencies }.forEach { - val platform = id.platform - when (it) { - is ModuleDependency -> module.addDependency(modulesById[it.moduleId]!!) - is StdlibDependency -> { - when { - platform.isCommon -> module.addLibrary( - ForTestCompileRuntime.stdlibCommonForTests(), kind = CommonLibraryKind - ) - platform.isJvm -> module.addLibrary(ForTestCompileRuntime.runtimeJarForTests()) - platform.isJavaScript -> module.addLibrary(ForTestCompileRuntime.stdlibJsForTests(), kind = JSLibraryKind) - else -> error("Unknown platform $this") - } - } - is FullJdkDependency -> { - ConfigLibraryUtil.configureSdk(module, PluginTestCaseBase.addJdk(testRootDisposable) { - PluginTestCaseBase.jdk(TestJdkKind.FULL_JDK) - }) - } - is CoroutinesDependency -> module.enableCoroutines() - is KotlinTestDependency -> when { - platform.isJvm -> module.addLibrary(ForTestCompileRuntime.kotlinTestJUnitJarForTests()) - platform.isJavaScript -> module.addLibrary(ForTestCompileRuntime.kotlinTestJsJarForTests(), kind = JSLibraryKind) - } - } - } - } - - modulesById.forEach { (nameAndPlatform, module) -> - val (name, platform) = nameAndPlatform - when { - platform.isCommon -> module.createFacet(platform, useProjectSettings = false) - else -> { - val commonModuleId = ModuleId(name, CommonIdePlatformKind.Platform) - - module.createFacet(platform, implementedModuleName = commonModuleId.ideaModuleName()) - module.enableMultiPlatform() - - modulesById[commonModuleId]?.let { commonModule -> - module.addDependency(commonModule) - } - } - } - } -} - -private fun AbstractMultiModuleTest.createModuleWithRoots( - moduleId: ModuleId, - infos: List -): Module { - val module = createModule(moduleId.ideaModuleName()) - for ((_, isTestRoot, moduleRoot) in infos) { - addRoot(module, moduleRoot, isTestRoot) - - if (moduleId.platform.isJavaScript && isTestRoot) { - setupJsTestOutput(module) - } - } - return module -} - -// test line markers for JS do not work without additional setup -private fun setupJsTestOutput(module: Module) { - ModuleRootModificationUtil.updateModel(module) { - with(it.getModuleExtension(CompilerModuleExtension::class.java)!!) { - inheritCompilerOutputPath(false) - setCompilerOutputPathForTests("js_out") - } - } -} - -private fun AbstractMultiModuleTest.createModule(name: String): Module { - val moduleDir = PlatformTestCase.createTempDir("") - val module = createModule(moduleDir.toString() + "/" + name, StdModuleTypes.JAVA) - val root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleDir) - TestCase.assertNotNull(root) - object : WriteCommandAction.Simple(module.project) { - @Throws(Throwable::class) - override fun run() { - root!!.refresh(false, true) - } - }.execute().throwException() - return module -} - -private val testSuffixes = setOf("test", "tests") -private val platformNames = mapOf( - listOf("header", "common", "expect") to CommonIdePlatformKind.Platform, - listOf("java", "jvm") to JvmIdePlatformKind.defaultPlatform, - listOf("java8", "jvm8") to JvmIdePlatformKind.Platform(JvmTarget.JVM_1_8), - listOf("java6", "jvm6") to JvmIdePlatformKind.Platform(JvmTarget.JVM_1_6), - listOf("js", "javascript") to JsIdePlatformKind.Platform -) - -private fun parseDirName(dir: File): RootInfo { - val parts = dir.name.split("_") - return RootInfo(parseModuleId(parts), parseIsTestRoot(parts), dir, parseDependencies(parts)) -} - -private fun parseDependencies(parts: List) = - parts.filter { it.startsWith("dep(") && it.endsWith(")") }.map { - parseDependency(it) - } - -private fun parseDependency(it: String): Dependency { - val dependencyString = it.removePrefix("dep(").removeSuffix(")") - - return when { - dependencyString.equals("stdlib", ignoreCase = true) -> StdlibDependency - dependencyString.equals("fulljdk", ignoreCase = true) -> FullJdkDependency - dependencyString.equals("coroutines", ignoreCase = true) -> CoroutinesDependency - dependencyString.equals("kotlin-test", ignoreCase = true) -> KotlinTestDependency - else -> ModuleDependency(parseModuleId(dependencyString.split("-"))) - } -} - -private fun parseModuleId(parts: List): ModuleId { - val platform = parsePlatform(parts) - val name = parseModuleName(parts) - val id = parseIndex(parts) ?: 0 - assert(id == 0 || !platform.isCommon) - return ModuleId(name, platform, id) -} - -private fun parsePlatform(parts: List) = - platformNames.entries.single { (names, _) -> - names.any { name -> parts.any { part -> part.equals(name, ignoreCase = true) } } - }.value - -private fun parseModuleName(parts: List) = when { - parts.size > 1 -> parts.first() - else -> "testModule" -} - -private fun parseIsTestRoot(parts: List) = - testSuffixes.any { suffix -> parts.any { it.equals(suffix, ignoreCase = true) } } - -private fun parseIndex(parts: List): Int? { - return parts.singleOrNull() { it.startsWith("id") }?.substringAfter("id")?.toInt() -} - -private data class ModuleId( - val groupName: String, - val platform: IdePlatform<*, *>, - val index: Int = 0 -) { - fun ideaModuleName(): String { - val suffix = "_$index".takeIf { index != 0 } ?: "" - return "${groupName}_${platform.presentableName}$suffix" - } -} - -private val IdePlatform<*, *>.presentableName: String - get() = when { - isCommon -> "Common" - isJvm -> "JVM" - isJavaScript -> "JS" - else -> error("Unknown platform $this") - } - -private data class RootInfo( - val moduleId: ModuleId, - val isTestRoot: Boolean, - val moduleRoot: File, - val dependencies: List -) - -private sealed class Dependency -private class ModuleDependency(val moduleId: ModuleId) : Dependency() -private object StdlibDependency : Dependency() -private object FullJdkDependency : Dependency() -private object CoroutinesDependency : Dependency() -private object KotlinTestDependency : Dependency() \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.181 deleted file mode 100644 index dcdec106082..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/CommonIntentionActionsTest.kt.181 +++ /dev/null @@ -1,422 +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.quickfix - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.lang.jvm.JvmElement -import com.intellij.lang.jvm.JvmModifier -import com.intellij.lang.jvm.actions.* -import com.intellij.lang.jvm.types.JvmSubstitutor -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Pair.pair -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiJvmSubstitutor -import com.intellij.psi.PsiSubstitutor -import com.intellij.psi.PsiType -import com.intellij.psi.codeStyle.SuggestedNameInfo -import com.intellij.testFramework.fixtures.CodeInsightTestFixture -import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.search.allScope -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.uast.UParameter -import org.jetbrains.uast.UastContext -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.jetbrains.uast.toUElement -import org.junit.Assert -import org.junit.runner.RunWith - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() { - private class SimpleMethodRequest( - project: Project, - private val methodName: String, - private val modifiers: Collection = emptyList(), - private val returnType: ExpectedTypes = emptyList(), - private val annotations: Collection = emptyList(), - private val parameters: List>> = emptyList(), - private val targetSubstitutor: JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY) - ) : CreateMethodRequest { - override fun getTargetSubstitutor(): JvmSubstitutor = targetSubstitutor - - override fun getModifiers() = modifiers - - override fun getMethodName() = methodName - - override fun getAnnotations() = annotations - - override fun getParameters() = parameters - - override fun getReturnType() = returnType - - override fun isValid(): Boolean = true - - } - - private class NameInfo(vararg names: String) : SuggestedNameInfo(names) - - override fun getProjectDescriptor() = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK - - fun testMakeNotFinal() { - myFixture.configureByText("foo.kt", """ - class Foo { - fun bar(){} - } - """) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.FINAL, false) - ).findWithText("Make 'bar' open") - ) - myFixture.checkResult(""" - class Foo { - open fun bar(){} - } - """) - } - - fun testMakePrivate() { - myFixture.configureByText("foo.kt", """ - class Foo { - fun bar(){} - } - """) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PRIVATE, true) - ).findWithText("Make 'Foo' private") - ) - myFixture.checkResult(""" - private class Foo { - fun bar(){} - } - """) - } - - fun testMakeNotPrivate() { - myFixture.configureByText("foo.kt", """ - private class Foo { - fun bar(){} - } - """.trim()) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PRIVATE, false) - ).findWithText("Remove 'private' modifier") - ) - myFixture.checkResult(""" - class Foo { - fun bar(){} - } - """.trim(), true) - } - - fun testMakePrivatePublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | private fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'private' modifier") - ) - myFixture.checkResult( - """class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testMakeProtectedPublic() { - myFixture.configureByText( - "foo.kt", """open class Foo { - | protected fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'protected' modifier") - ) - myFixture.checkResult( - """open class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testMakeInternalPublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | internal fun bar(){} - |}""".trim().trimMargin() - ) - - myFixture.launchAction( - createModifierActions( - myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PUBLIC, true) - ).findWithText("Remove 'internal' modifier") - ) - myFixture.checkResult( - """class Foo { - | fun bar(){} - |}""".trim().trimMargin(), true - ) - } - - fun testDontMakePublicPublic() { - myFixture.configureByText( - "foo.kt", """class Foo { - | fun bar(){} - |}""".trim().trimMargin() - ) - - assertEmpty(createModifierActions(myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.PUBLIC, true))) - } - - fun testDontMakeFunInObjectsOpen() { - myFixture.configureByText("foo.kt", """ - object Foo { - fun bar(){} - } - """.trim()) - assertEmpty(createModifierActions(myFixture.atCaret(), MemberRequest.Modifier(JvmModifier.FINAL, false))) - } - - fun testAddVoidVoidMethod() { - myFixture.configureByText("foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - methodRequest(project, "baz", JvmModifier.PRIVATE, PsiType.VOID) - ).findWithText("Add method 'baz' to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo { - | fun bar() {} - | private fun baz() { - | - | } - |} - """.trim().trimMargin(), true) - } - - fun testAddIntIntMethod() { - myFixture.configureByText("foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createMethodActions( - myFixture.atCaret(), - SimpleMethodRequest(project, - methodName = "baz", - modifiers = listOf(JvmModifier.PUBLIC), - returnType = expectedTypes(PsiType.INT), - parameters = expectedParams(PsiType.INT)) - ).findWithText("Add method 'baz' to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo { - | fun bar() {} - | fun baz(param0: Int): Int { - | TODO("not implemented") //To change body of created functions use File | Settings | File Templates. - | } - |} - """.trim().trimMargin(), true) - } - - fun testAddIntPrimaryConstructor() { - myFixture.configureByText("foo.kt", """ - |class Foo { - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add primary constructor to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo(param0: Int) { - |} - """.trim().trimMargin(), true) - } - - fun testAddIntSecondaryConstructor() { - myFixture.configureByText("foo.kt", """ - |class Foo() { - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add secondary constructor to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo() { - | constructor(param0: Int) { - | - | } - |} - """.trim().trimMargin(), true) - } - - fun testChangePrimaryConstructorInt() { - myFixture.configureByText("foo.kt", """ - |class Foo() { - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, listOf(pair("param0", PsiType.INT as PsiType))) - ).findWithText("Add 'int' as 1st parameter to method 'Foo'") - ) - myFixture.checkResult(""" - |class Foo(param0: Int) { - |} - """.trim().trimMargin(), true) - } - - fun testRemoveConstructorParameters() { - myFixture.configureByText("foo.kt", """ - |class Foo(i: Int) { - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createConstructorActions( - myFixture.atCaret(), - constructorRequest(project, emptyList()) - ).findWithText("Remove 1st parameter from method 'Foo'") - ) - myFixture.checkResult(""" - |class Foo() { - |} - """.trim().trimMargin(), true) - } - - fun testAddStringVarProperty() { - myFixture.configureByText("foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createPropertyActions( - myFixture.atCaret(), - MemberRequest.Property( - propertyName = "baz", - visibilityModifier = JvmModifier.PUBLIC, - propertyType = PsiType.getTypeByName("java.lang.String", project, project.allScope()), - getterRequired = true, - setterRequired = true - ) - ).findWithText("Add 'var' property 'baz' to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo { - | var baz: String = TODO("initialize me") - | - | fun bar() {} - |} - """.trim().trimMargin(), true) - } - - fun testAddLateInitStringVarProperty() { - myFixture.configureByText("foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createPropertyActions( - myFixture.atCaret(), - MemberRequest.Property( - propertyName = "baz", - visibilityModifier = JvmModifier.PUBLIC, - propertyType = PsiType.getTypeByName("java.lang.String", project, project.allScope()), - getterRequired = true, - setterRequired = true - ) - ).findWithText("Add 'lateinit var' property 'baz' to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo { - | lateinit var baz: String - | - | fun bar() {} - |} - """.trim().trimMargin(), true) - } - - fun testAddStringValProperty() { - myFixture.configureByText("foo.kt", """ - |class Foo { - | fun bar() {} - |} - """.trim().trimMargin()) - - myFixture.launchAction( - createPropertyActions( - myFixture.atCaret(), - MemberRequest.Property( - propertyName = "baz", - visibilityModifier = JvmModifier.PUBLIC, - propertyType = PsiType.getTypeByName("java.lang.String", project, project.allScope()), - getterRequired = true, - setterRequired = false - ) - ).findWithText("Add 'val' property 'baz' to 'Foo'") - ) - myFixture.checkResult(""" - |class Foo { - | val baz: String = TODO("initialize me") - | - | fun bar() {} - |} - """.trim().trimMargin(), true) - } - - private fun makeParams(vararg psyTypes: PsiType): List { - val uastContext = UastContext(myFixture.project) - val factory = JavaPsiFacade.getElementFactory(myFixture.project) - val parameters = psyTypes.mapIndexed { index, psiType -> factory.createParameter("param$index", psiType) } - return parameters.map { uastContext.convertElement(it, null, UParameter::class.java) as UParameter } - } - - private fun expectedTypes(vararg psiTypes: PsiType) = psiTypes.map { expectedType(it) } - - private fun expectedParams(vararg psyTypes: PsiType) = - psyTypes.mapIndexed { index, psiType -> NameInfo("param$index") to expectedTypes(psiType) } - - private inline fun CodeInsightTestFixture.atCaret() = elementAtCaret.toUElement() as T - - @Suppress("CAST_NEVER_SUCCEEDS") - private fun List.findWithText(text: String): IntentionAction = - this.firstOrNull { it.text == text } ?: - Assert.fail("intention with text '$text' was not found, only ${this.joinToString { "\"${it.text}\"" }} available") as Nothing -} - diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt.181 deleted file mode 100644 index 75bfc4bf6f7..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinDeclarationsHandlerTest.kt.181 +++ /dev/null @@ -1,208 +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.refactoring.move - -import com.intellij.openapi.fileEditor.FileDocumentManager -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiElement -import com.intellij.testFramework.PlatformTestCase -import com.intellij.testFramework.PsiTestUtil -import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.MoveKotlinDeclarationsHandler -import org.jetbrains.kotlin.idea.refactoring.toPsiDirectory -import org.jetbrains.kotlin.idea.refactoring.toPsiFile -import org.jetbrains.kotlin.idea.test.KotlinMultiFileTestCase -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.idea.test.extractMultipleMarkerOffsets -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance -import org.junit.runner.RunWith - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class MoveKotlinDeclarationsHandlerTest : KotlinMultiFileTestCase() { - override fun getTestDataPath() = PluginTestCaseBase.getTestDataPathBase() - - override fun getTestRoot() = "/refactoring/moveHandler/declarations" - - private fun doTest(action: (rootDir: VirtualFile, handler: MoveKotlinDeclarationsHandler) -> Unit) { - val path = "$testDataPath$testRoot/${getTestName(true)}" - val rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, path, PlatformTestCase.myFilesToDelete, false) - prepareProject(rootDir) - PsiDocumentManager.getInstance(myProject).commitAllDocuments() - action(rootDir, MoveKotlinDeclarationsHandler()) - } - - private fun getPsiDirectory(rootDir: VirtualFile, path: String) = rootDir.findFileByRelativePath(path)!!.toPsiDirectory(project)!! - - private fun getPsiFile(rootDir: VirtualFile, path: String) = rootDir.findFileByRelativePath(path)!!.toPsiFile(project)!! - - private fun getElementAtCaret(rootDir: VirtualFile, path: String) = getElementsAtCarets(rootDir, path).single() - - private fun getElementsAtCarets(rootDir: VirtualFile, path: String): List { - val file = getPsiFile(rootDir, path) - val document = FileDocumentManager.getInstance().getDocument(file.virtualFile)!! - return document.extractMultipleMarkerOffsets(project).map { file.findElementAt(it)!! } - } - - fun testObjectLiteral() = doTest { rootDir, handler -> - val objectDeclaration = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(objectDeclaration), null)) - } - - fun testLocalClass() = doTest { rootDir, handler -> - val klass = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(klass), null)) - } - - fun testLocalFun() = doTest { rootDir, handler -> - val function = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(function), null)) - } - - fun testLocalVal() = doTest { rootDir, handler -> - val property = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(property), null)) - } - - fun testMemberFun() = doTest { rootDir, handler -> - val function = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(function), null)) - } - - fun testMemberVal() = doTest { rootDir, handler -> - val property = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(!handler.canMove(arrayOf(property), null)) - } - - fun testNestedClass() = doTest { rootDir, handler -> - val klass = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(klass), null)) - } - - fun testInnerClass() = doTest { rootDir, handler -> - val klass = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(klass), null)) - } - - fun testTopLevelClass() = doTest { rootDir, handler -> - val klass = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(klass), null)) - } - - fun testTopLevelFun() = doTest { rootDir, handler -> - val function = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(function), null)) - } - - fun testTopLevelVal() = doTest { rootDir, handler -> - val property = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(property), null)) - } - - fun testMultipleNestedClasses() = doTest { rootDir, handler -> - val classes = getElementsAtCarets(rootDir, "test.kt").map { it.getNonStrictParentOfType()!! } - assert(handler.canMove(classes.toTypedArray(), null)) - } - - fun testNestedAndTopLevelClass() = doTest { rootDir, handler -> - val classes = getElementsAtCarets(rootDir, "test.kt").map { it.getNonStrictParentOfType()!! } - assert(!handler.canMove(classes.toTypedArray(), null)) - } - - fun testMultipleTopLevelDeclarations() = doTest { rootDir, handler -> - val declarations = getElementsAtCarets(rootDir, "test.kt").map { it.getNonStrictParentOfType()!! } - assert(handler.canMove(declarations.toTypedArray(), null)) - } - - fun testMultipleTopLevelDeclarationsInDifferentFiles() = doTest { rootDir, handler -> - val declarations = listOf("test.kt", "test2.kt") - .flatMap { getElementsAtCarets(rootDir, it) } - .map { it.getNonStrictParentOfType()!! } - assert(handler.canMove(declarations.toTypedArray(), null)) - - val files = listOf("test.kt", "test2.kt").map { getPsiFile(rootDir, it) } - assert(handler.canMove(files.toTypedArray(), null)) - } - - fun testMultipleTopLevelDeclarationsInDifferentDirs() = doTest { rootDir, handler -> - val declarations = listOf("test1/test.kt", "test2/test2.kt") - .flatMap { getElementsAtCarets(rootDir, it) } - .map { it.getNonStrictParentOfType()!! } - assert(!handler.canMove(declarations.toTypedArray(), null)) - - val files = listOf("test1/test.kt", "test2/test2.kt").map { getPsiFile(rootDir, it) } - assert(!handler.canMove(files.toTypedArray(), null)) - } - - fun testFileAndTopLevelDeclarations() = doTest { rootDir, handler -> - val elements = getElementsAtCarets(rootDir, "test.kt").map { it.getNonStrictParentOfType()!! } + - getPsiFile(rootDir, "test2.kt") - assert(!handler.canMove(elements.toTypedArray(), null)) - } - - fun testCommonTargets() = doTest { rootDir, handler -> - val elementsToMove = arrayOf(getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!!) - - val targetPackage = JavaPsiFacade.getInstance(project).findPackage("pack")!! - assert(handler.canMove(elementsToMove, targetPackage)) - - val targetDirectory = getPsiDirectory(rootDir, "pack") - assert(handler.canMove(elementsToMove, targetDirectory)) - - val targetFile = getPsiFile(rootDir, "pack/test2.kt") - assert(handler.canMove(elementsToMove, targetFile)) - } - - fun testTopLevelClassToClass() = doTest { rootDir, handler -> - val elementsToMove = arrayOf(getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!!) - val targetFile = getPsiFile(rootDir, "test2.kt") as KtFile - - val topLevelTarget = targetFile.declarations.firstIsInstance() - assert(topLevelTarget.name == "B") - assert(!handler.canMove(elementsToMove, topLevelTarget)) - - val annotationTarget = targetFile.declarations.first { it.name == "Ann" } as KtClass - assert(!handler.canMove(elementsToMove, annotationTarget)) - - val nestedTarget = topLevelTarget.declarations.firstIsInstance() - assert(nestedTarget.name == "C") - assert(!handler.canMove(elementsToMove, nestedTarget)) - } - - fun testNestedClassToClass() = doTest { rootDir, handler -> - val elementsToMove = arrayOf(getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!!) - val targetFile = getPsiFile(rootDir, "test2.kt") as KtFile - - val topLevelTarget = targetFile.declarations.firstIsInstance() - assert(topLevelTarget.name == "B") - assert(handler.canMove(elementsToMove, topLevelTarget)) - - val annotationTarget = targetFile.declarations.first { it.name == "Ann" } as KtClass - assert(!handler.canMove(elementsToMove, annotationTarget)) - - val nestedTarget = topLevelTarget.declarations.firstIsInstance() - assert(nestedTarget.name == "C") - assert(handler.canMove(elementsToMove, nestedTarget)) - } - - fun testTypeAlias() = doTest { rootDir, handler -> - val typeAlias = getElementAtCaret(rootDir, "test.kt").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(typeAlias), null)) - } - - fun testTopLevelFunInScript() = doTest { rootDir, handler -> - val function = getElementAtCaret(rootDir, "test.kts").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(function), null)) - } - - fun testTopLevelValInScript() = doTest { rootDir, handler -> - val property = getElementAtCaret(rootDir, "test.kts").getNonStrictParentOfType()!! - assert(handler.canMove(arrayOf(property), null)) - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/run/RunConfigurationTest.kt.181 b/idea/tests/org/jetbrains/kotlin/idea/run/RunConfigurationTest.kt.181 deleted file mode 100644 index 0fa3e833422..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/run/RunConfigurationTest.kt.181 +++ /dev/null @@ -1,297 +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.run - -import com.intellij.execution.Location -import com.intellij.execution.PsiLocation -import com.intellij.execution.actions.ConfigurationContext -import com.intellij.openapi.module.Module -import com.intellij.openapi.projectRoots.Sdk -import com.intellij.openapi.roots.ModuleRootModificationUtil -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.JavaPsiFacade -import com.intellij.psi.PsiComment -import com.intellij.psi.PsiDocumentManager -import com.intellij.psi.PsiManager -import com.intellij.refactoring.RefactoringFactory -import com.intellij.testFramework.MapDataContext -import com.intellij.testFramework.PlatformTestCase -import com.intellij.testFramework.PsiTestUtil -import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl -import org.jetbrains.kotlin.idea.MainFunctionDetector -import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny -import org.jetbrains.kotlin.idea.search.allScope -import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex -import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex -import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil -import org.jetbrains.kotlin.idea.test.KotlinCodeInsightTestCase -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase.* -import org.jetbrains.kotlin.idea.test.configureLanguageAndApiVersion -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.allChildren -import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType -import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner -import org.junit.Assert -import org.junit.runner.RunWith -import java.io.File -import java.util.* - -private val RUN_PREFIX = "// RUN:" - -@RunWith(JUnit3WithIdeaConfigurationRunner::class) -class RunConfigurationTest: KotlinCodeInsightTestCase() { - fun getTestProject() = myProject!! - override fun getModule() = myModule!! - - fun testMainInTest() { - val createResult = configureModule(moduleDirPath("module"), getTestProject().baseDir!!) - configureLanguageAndApiVersion( - createResult.module.project, createResult.module, LanguageVersionSettingsImpl.DEFAULT.languageVersion.versionString - ) - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(createResult.module, addJdk(testRootDisposable, ::mockJdk)) - - val runConfiguration = createConfigurationFromMain("some.main") - val javaParameters = getJavaRunParameters(runConfiguration) - - Assert.assertTrue(javaParameters.classPath.rootDirs.contains(createResult.srcOutputDir)) - Assert.assertTrue(javaParameters.classPath.rootDirs.contains(createResult.testOutputDir)) - - fun functionVisitor(function: KtNamedFunction) { - val options = function.bodyExpression?.allChildren?.filterIsInstance()?.map { it.text.trim().replace("//", "").trim() }?.filter { it.isNotBlank() }?.toList() ?: emptyList() - if (options.isNotEmpty()) { - val assertIsMain = "yes" in options - val assertIsNotMain = "no" in options - - val isMainFunction = - MainFunctionDetector(LanguageVersionSettingsImpl.DEFAULT) { it.resolveToDescriptorIfAny() }.isMain(function) - - if (assertIsMain) { - Assert.assertTrue("The function ${function.fqName?.asString()} should be main", isMainFunction) - } - if (assertIsNotMain) { - Assert.assertFalse("The function ${function.fqName?.asString()} should NOT be main", isMainFunction) - } - - if (isMainFunction) { - createConfigurationFromMain(function.fqName?.asString()!!).checkConfiguration() - - Assert.assertNotNull("Kotlin configuration producer should produce configuration for ${function.fqName?.asString()}", - KotlinRunConfigurationProducer.getEntryPointContainer(function)) - } else { - try { - createConfigurationFromMain(function.fqName?.asString()!!).checkConfiguration() - Assert.fail("configuration for function ${function.fqName?.asString()} at least shouldn't pass checkConfiguration()") - } catch (expected: Throwable) { - } - - if (function.containingFile.text.startsWith("// entryPointExists")) { - Assert.assertNotNull( - "Kotlin configuration producer should produce configuration for ${function.fqName?.asString()}", - KotlinRunConfigurationProducer.getEntryPointContainer(function) - ) - } else { - Assert.assertNull( - "Kotlin configuration producer shouldn't produce configuration for ${function.fqName?.asString()}", - KotlinRunConfigurationProducer.getEntryPointContainer(function) - ) - } - } - } - } - - createResult.srcDir.children.filter { it.extension == "kt" }.forEach { - val psiFile = PsiManager.getInstance(createResult.module.project).findFile(it) - if (psiFile is KtFile) { - psiFile.acceptChildren(object : KtVisitorVoid() { - override fun visitNamedFunction(function: KtNamedFunction) { - functionVisitor(function) - } - }) - } - } - } - - fun testDependencyModuleClasspath() { - val dependencyModuleSrcDir = configureModule(moduleDirPath("module"), getTestProject().baseDir!!).srcOutputDir - - val moduleWithDependencyDir = runWriteAction { getTestProject().baseDir!!.createChildDirectory(this, "moduleWithDependency") } - - val moduleWithDependency = createModule("moduleWithDependency") - ModuleRootModificationUtil.setModuleSdk(moduleWithDependency, testProjectJdk) - - val moduleWithDependencySrcDir = configureModule( - moduleDirPath("moduleWithDependency"), moduleWithDependencyDir, configModule = moduleWithDependency).srcOutputDir - - ModuleRootModificationUtil.addDependency(moduleWithDependency, module) - - val kotlinRunConfiguration = createConfigurationFromMain("some.test.main") - kotlinRunConfiguration.setModule(moduleWithDependency) - - val javaParameters = getJavaRunParameters(kotlinRunConfiguration) - - Assert.assertTrue(javaParameters.classPath.rootDirs.contains(dependencyModuleSrcDir)) - Assert.assertTrue(javaParameters.classPath.rootDirs.contains(moduleWithDependencySrcDir)) - } - - fun testLongCommandLine() { - val myModule = configureModule(moduleDirPath("module"), getTestProject().baseDir).module - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(module, addJdk(testRootDisposable, ::mockJdk)) - - ModuleRootModificationUtil.addDependency(myModule, createLibraryWithLongPaths(project)) - - val kotlinRunConfiguration = createConfigurationFromMain("some.test.main") - kotlinRunConfiguration.setModule(myModule) - - val javaParameters = getJavaRunParameters(kotlinRunConfiguration) - val commandLine = javaParameters.toCommandLine().commandLineString - Assert.assertTrue(commandLine.length < javaParameters.classPath.pathList.joinToString().length) - } - - fun testClassesAndObjects() { - doTest(ConfigLibraryUtil::configureKotlinRuntimeAndSdk) - } - - fun testInJsModule() { - doTest(ConfigLibraryUtil::configureKotlinJsRuntimeAndSdk) - } - - fun testUpdateOnClassRename() { - val createModuleResult = configureModule(moduleDirPath("module"), getTestProject().baseDir!!) - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(createModuleResult.module, addJdk(testRootDisposable, ::mockJdk)) - - val runConfiguration = createConfigurationFromObject("renameTest.Foo", save = true) - - val obj = KotlinFullClassNameIndex.getInstance().get("renameTest.Foo", getTestProject(), getTestProject().allScope()).single() - val rename = RefactoringFactory.getInstance(getTestProject()).createRename(obj, "Bar") - rename.run() - - Assert.assertEquals("renameTest.Bar", runConfiguration.MAIN_CLASS_NAME) - } - - fun testUpdateOnPackageRename() { - val createModuleResult = configureModule(moduleDirPath("module"), getTestProject().baseDir!!) - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(createModuleResult.module, addJdk(testRootDisposable, ::mockJdk)) - - val runConfiguration = createConfigurationFromObject("renameTest.Foo", save = true) - - val pkg = JavaPsiFacade.getInstance(getTestProject()).findPackage("renameTest")!! - val rename = RefactoringFactory.getInstance(getTestProject()).createRename(pkg, "afterRenameTest") - rename.run() - - Assert.assertEquals("afterRenameTest.Foo", runConfiguration.MAIN_CLASS_NAME) - } - - fun testWithModuleForJdk6() { - checkModuleInfoName(null, addJdk(testRootDisposable, ::mockJdk)) - } - - fun testWithModuleForJdk9() { - checkModuleInfoName("MAIN", addJdk(testRootDisposable, ::mockJdk9)) - } - - fun testWithModuleForJdk9WithoutModuleInfo() { - checkModuleInfoName(null, addJdk(testRootDisposable, ::mockJdk9)) - } - - private fun checkModuleInfoName(moduleName: String?, sdk: Sdk) { - val module = configureModule(moduleDirPath("module"), getTestProject().baseDir!!).module - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(module, sdk) - - val javaParameters = getJavaRunParameters(createConfigurationFromMain("some.main")) - - Assert.assertEquals(moduleName, javaParameters.moduleName) - } - - private fun doTest(configureRuntime: (Module, Sdk) -> Unit) { - val baseDir = getTestProject().baseDir!! - val createModuleResult = configureModule(moduleDirPath("module"), baseDir) - val srcDir = createModuleResult.srcDir - - configureRuntime(createModuleResult.module, addJdk(testRootDisposable, ::mockJdk)) - - try { - val expectedClasses = ArrayList() - val actualClasses = ArrayList() - - val testFile = PsiManager.getInstance(getTestProject()).findFile(srcDir.findFileByRelativePath("test.kt")!!)!! - testFile.accept( - object : KtTreeVisitorVoid() { - override fun visitComment(comment: PsiComment) { - val declaration = comment.getStrictParentOfType()!! - val text = comment.text ?: return - if (!text.startsWith(RUN_PREFIX)) return - - val expectedClass = text.substring(RUN_PREFIX.length).trim() - if (expectedClass.isNotEmpty()) expectedClasses.add(expectedClass) - - val dataContext = MapDataContext() - dataContext.put(Location.DATA_KEY, PsiLocation(getTestProject(), declaration)) - val context = ConfigurationContext.getFromContext(dataContext) - val actualClass = (context.configuration?.configuration as? KotlinRunConfiguration)?.runClass - if (actualClass != null) { - actualClasses.add(actualClass) - } - } - } - ) - Assert.assertEquals(expectedClasses, actualClasses) - } - finally { - ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(createModuleResult.module, mockJdk()) - } - } - - private fun createConfigurationFromMain(mainFqn: String): KotlinRunConfiguration { - val mainFunction = KotlinTopLevelFunctionFqnNameIndex.getInstance().get(mainFqn, getTestProject(), getTestProject().allScope()).first() - - return createConfigurationFromElement(mainFunction) as KotlinRunConfiguration - } - - private fun createConfigurationFromObject(objectFqn: String, save: Boolean = false): KotlinRunConfiguration { - val obj = KotlinFullClassNameIndex.getInstance().get(objectFqn, getTestProject(), getTestProject().allScope()).single() - val mainFunction = obj.declarations.single { it is KtFunction && it.getName() == "main" } - return createConfigurationFromElement(mainFunction, save) as KotlinRunConfiguration - } - - private fun configureModule(moduleDir: String, outputParentDir: VirtualFile, configModule: Module = module): CreateModuleResult { - val srcPath = moduleDir + "/src" - val srcDir = PsiTestUtil.createTestProjectStructure(project, configModule, srcPath, PlatformTestCase.myFilesToDelete, true) - - val testPath = moduleDir + "/test" - if (File(testPath).exists()) { - val testDir = PsiTestUtil.createTestProjectStructure(project, configModule, testPath, PlatformTestCase.myFilesToDelete, false) - PsiTestUtil.addSourceRoot(module, testDir, true) - } - - val (srcOutDir, testOutDir) = runWriteAction { - val outDir = outputParentDir.createChildDirectory(this, "out") - val srcOutDir = outDir.createChildDirectory(this, "production") - val testOutDir = outDir.createChildDirectory(this, "test") - - PsiTestUtil.setCompilerOutputPath(configModule, srcOutDir.url, false) - PsiTestUtil.setCompilerOutputPath(configModule, testOutDir.url, true) - - Pair(srcOutDir, testOutDir) - } - - PsiDocumentManager.getInstance(getTestProject()).commitAllDocuments() - - return CreateModuleResult(configModule, srcDir, srcOutDir, testOutDir) - } - - private fun moduleDirPath(moduleName: String) = "${testDataPath}${getTestName(false)}/$moduleName" - - override fun getTestDataPath() = getTestDataPathBase() + "/run/" - override fun getTestProjectJdk() = mockJdk() - - private class CreateModuleResult( - val module: Module, - val srcDir: VirtualFile, - val srcOutputDir: VirtualFile, - val testOutputDir: VirtualFile - ) -} diff --git a/idea/tests/org/jetbrains/kotlin/test/HierarchyViewTestFixture.kt.181 b/idea/tests/org/jetbrains/kotlin/test/HierarchyViewTestFixture.kt.181 deleted file mode 100644 index e55e258d2ef..00000000000 --- a/idea/tests/org/jetbrains/kotlin/test/HierarchyViewTestFixture.kt.181 +++ /dev/null @@ -1,10 +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.test - -// BUNCH: 181 -@Suppress("IncompatibleAPI") -class HierarchyViewTestFixture : HierarchyViewTestFixtureCompat() \ No newline at end of file diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.181 b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.181 deleted file mode 100644 index 57df3205bd7..00000000000 --- a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.181 +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.j2k - -import com.intellij.codeInsight.ContainerProvider -import com.intellij.codeInsight.NullableNotNullManager -import com.intellij.codeInsight.runner.JavaMainMethodProvider -import com.intellij.core.CoreApplicationEnvironment -import com.intellij.core.JavaCoreApplicationEnvironment -import com.intellij.core.JavaCoreProjectEnvironment -import com.intellij.lang.MetaLanguage -import com.intellij.lang.jvm.facade.JvmElementProvider -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.extensions.ExtensionsArea -import com.intellij.openapi.fileTypes.FileTypeExtensionPoint -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.* -import com.intellij.psi.augment.PsiAugmentProvider -import com.intellij.psi.augment.TypeAnnotationModifier -import com.intellij.psi.compiled.ClassFileDecompilers -import com.intellij.psi.impl.JavaClassSupersImpl -import com.intellij.psi.impl.PsiTreeChangePreprocessor -import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy -import com.intellij.psi.meta.MetaDataContributor -import com.intellij.psi.stubs.BinaryFileStubBuilders -import com.intellij.psi.util.JavaClassSupers -import junit.framework.TestCase -import org.jetbrains.kotlin.utils.PathUtil -import java.io.File -import java.net.URLClassLoader - -abstract class AbstractJavaToKotlinConverterForWebDemoTest : TestCase() { - val DISPOSABLE = Disposer.newDisposable() - - fun doTest(javaPath: String) { - try { - val fileContents = FileUtil.loadFile(File(javaPath), true) - val javaCoreEnvironment: JavaCoreProjectEnvironment = setUpJavaCoreEnvironment() - translateToKotlin(fileContents, javaCoreEnvironment.project) - } - finally { - Disposer.dispose(DISPOSABLE) - } - } - - fun setUpJavaCoreEnvironment(): JavaCoreProjectEnvironment { - Extensions.cleanRootArea(DISPOSABLE) - val area = Extensions.getRootArea() - - registerExtensionPoints(area) - - val applicationEnvironment = JavaCoreApplicationEnvironment(DISPOSABLE) - val javaCoreEnvironment = object : JavaCoreProjectEnvironment(DISPOSABLE, applicationEnvironment) { - override fun preregisterServices() { - val projectArea = Extensions.getArea(project) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiElementFinder.EP_NAME, PsiElementFinder::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, JvmElementProvider.EP_NAME, JvmElementProvider::class.java) - } - } - - javaCoreEnvironment.project.registerService(NullableNotNullManager::class.java, object : NullableNotNullManager(javaCoreEnvironment.project) { - override fun isNullable(owner: PsiModifierListOwner, checkBases: Boolean) = !isNotNull(owner, checkBases) - override fun isNotNull(owner: PsiModifierListOwner, checkBases: Boolean) = true - override fun hasHardcodedContracts(element: PsiElement): Boolean = false - override fun getPredefinedNotNulls() = emptyList() - }) - - applicationEnvironment.application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java) - - for (root in PathUtil.getJdkClassesRootsFromCurrentJre()) { - javaCoreEnvironment.addJarToClassPath(root) - } - val annotations: File? = findAnnotations() - if (annotations != null && annotations.exists()) { - javaCoreEnvironment.addJarToClassPath(annotations) - } - return javaCoreEnvironment - } - - private fun registerExtensionPoints(area: ExtensionsArea) { - CoreApplicationEnvironment.registerExtensionPoint(area, BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, ClsCustomNavigationPolicy.EP_NAME, ClsCustomNavigationPolicy::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, JavaModuleSystem.EP_NAME, JavaModuleSystem::class.java) - } - - fun findAnnotations(): File? { - var classLoader = JavaToKotlinTranslator::class.java.classLoader - while (classLoader != null) { - val loader = classLoader - if (loader is URLClassLoader) { - for (url in loader.urLs) { - if ("file" == url.protocol && url.file!!.endsWith("/annotations.jar")) { - return File(url.file!!) - } - } - } - classLoader = classLoader.parent - } - return null - } -} diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.181 b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.181 deleted file mode 100644 index c014f4b30fa..00000000000 --- a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.181 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2018 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.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/uast-kotlin/src/org/jetbrains/uast/kotlin/specificJavaPsiPlaceholders.kt.181 b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/specificJavaPsiPlaceholders.kt.181 deleted file mode 100644 index 8553a68a40f..00000000000 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/specificJavaPsiPlaceholders.kt.181 +++ /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.uast.kotlin - -import org.jetbrains.uast.* - -typealias UFieldExPlaceHolder = UField -typealias UParameterExPlaceHolder = UParameter -typealias UVariableExPlaceHolder = UVariable -typealias ULocalVariableExPlaceHolder = ULocalVariable -typealias UEnumConstantExPlaceHolder = UEnumConstant -typealias UClassInitializerExPlaceHolder = UClassInitializer diff --git a/ultimate/resources/META-INF/kotlin-spring.xml.181 b/ultimate/resources/META-INF/kotlin-spring.xml.181 deleted file mode 100644 index 10afa36b601..00000000000 --- a/ultimate/resources/META-INF/kotlin-spring.xml.181 +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ultimate/resources/META-INF/ultimate-plugin.xml.181 b/ultimate/resources/META-INF/ultimate-plugin.xml.181 deleted file mode 100644 index dfd991b050e..00000000000 --- a/ultimate/resources/META-INF/ultimate-plugin.xml.181 +++ /dev/null @@ -1,10 +0,0 @@ - - com.intellij.spring - com.intellij.javaee - com.intellij.persistence - com.intellij.database - com.intellij.css - com.intellij.jsp - com.intellij.diagram - NodeJS - \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/KotlinSpringLocalModelDependenciesDiagramProvider.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/KotlinSpringLocalModelDependenciesDiagramProvider.kt.181 deleted file mode 100644 index c7c877b0ae0..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/KotlinSpringLocalModelDependenciesDiagramProvider.kt.181 +++ /dev/null @@ -1,156 +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.spring.diagram - -import com.intellij.diagram.DiagramPresentationModel -import com.intellij.diagram.presentation.DiagramState -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager -import com.intellij.openapi.util.component1 -import com.intellij.openapi.util.component2 -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.spring.SpringManager -import com.intellij.spring.contexts.model.AbstractSimpleLocalModel -import com.intellij.spring.contexts.model.LocalModel -import com.intellij.spring.contexts.model.diagram.SpringLocalModelDependenciesDiagramProvider -import com.intellij.spring.contexts.model.diagram.SpringLocalModelDiagramNodeContentManager -import com.intellij.spring.contexts.model.diagram.SpringLocalModelsDataModel -import com.intellij.spring.contexts.model.diagram.beans.* -import com.intellij.spring.contexts.model.graph.LazyModelDependenciesGraph -import com.intellij.spring.contexts.model.graph.LocalModelDependency -import com.intellij.spring.facet.SpringFacet -import com.intellij.spring.facet.SpringFileSet -import com.intellij.spring.facet.SpringFileSetService -import org.jetbrains.kotlin.idea.refactoring.toPsiFile -import org.jetbrains.kotlin.psi.KtFile -import java.util.* - -// TODO: Drop when SpringLocalModelsDataModel gets support for non-Java/non-XML files -class KotlinSpringLocalModelDependenciesDiagramProvider : SpringLocalModelDependenciesDiagramProvider() { - inner class KotlinSpringLocalModelsDataModel( - project: Project, - private val model: LocalModelGraphElementWrapper<*>, - private val showModuleFilesetNodes: Boolean - ) : SpringLocalModelsDataModel(project, this@KotlinSpringLocalModelDependenciesDiagramProvider, model, showModuleFilesetNodes) { - private val extraNodes = LinkedHashSet() - private val extraEdges = LinkedHashSet() - - @Suppress("UNCHECKED_CAST") - private val nodesSequence: Sequence - get() = (super.getNodes() as Collection).asSequence() + extraNodes.asSequence() - - private fun getDiagramNode(model: LocalModelGraphElementWrapper<*>): SpringLocalModelDiagramNode { - return nodesSequence.firstOrNull { it.identifyingElement == model } ?: SpringLocalModelDiagramNode(model, this.provider) - } - - private fun showLibraryConfigs() = DiagramState(builder).isCategoryEnabled(SpringLocalModelDiagramNodeContentManager.SHOW_LIBRARY_CONFIGS) - - private fun isLibraryConfig(element: LocalModelGraphElementWrapper): Boolean { - if (element !is LocalModelWrapper<*>) return false - return ProjectRootManager.getInstance(project).fileIndex.isInLibraryClasses(element.element.config.containingFile.virtualFile) - } - - private fun visitRelated(fromNode: SpringLocalModelDiagramNode, graph: LazyModelDependenciesGraph) { - val localModel = (fromNode.identifyingElement as? LocalModelWrapper<*>)?.element ?: return - for ((model, dependency) in graph.getOrCreateOutDependencies(localModel)) { - createEdgeToLocalModelAndVisitIt(fromNode, graph, LocalModelWrapper.create(model), dependency) - } - } - - private fun createEdgeToLocalModelAndVisitIt( - fromNode: SpringLocalModelDiagramNode?, - graph: LazyModelDependenciesGraph, - toNodeLocalModelWrapper: LocalModelWrapper>, - dependency: LocalModelDependency - ) { - val toNode = getDiagramNode(toNodeLocalModelWrapper) - if (toNode === fromNode) return - - val toNodeExists = toNode in extraNodes - if (!toNodeExists) { - extraNodes += toNode - if (showLibraryConfigs() || !isLibraryConfig(toNode.identifyingElement)) { - this.visitRelated(toNode, graph) - } - } - - if (fromNode != null) { - val edge = SpringLocalModelDependencyEdge(fromNode, toNode, dependency) - if (toNodeExists) { - edge.isError = true - } - else { - fromNode.addChild(toNode) - } - extraEdges += edge - } - } - - private fun visitFileSet(node: SpringLocalModelDiagramNode?, fileSet: SpringFileSet) { - val springManager = SpringManager.getInstance(project) - val module = fileSet.facet.module - val profiles = fileSet.activeProfiles - val graph = AbstractSimpleLocalModel.getOrCreateLocalModelDependenciesGraph(module, profiles) - - for (filePointer in fileSet.files) { - val virtualFile = filePointer.file ?: continue - val ktFile = virtualFile.toPsiFile(project) as? KtFile ?: continue - for (psiClass in ktFile.classes) { - val model = springManager.getLocalSpringModel(psiClass, module) ?: continue - createEdgeToLocalModelAndVisitIt(node, graph, LocalModelWrapper.create(model), LocalModelDependency.create()) - } - } - } - - private fun visitFileSet(fileSet: SpringFileSet) { - visitFileSet(if (showModuleFilesetNodes) getDiagramNode(FilesetLocalModelWrapper.create(fileSet)!!) else null, fileSet) - } - - private fun visitModule(module: Module) { - if (module.isDisposed) return - val springFacet = SpringFacet.getInstance(module) ?: return - - for (fileSet in SpringFileSetService.getInstance().getAllSets(springFacet)) { - visitFileSet(fileSet) - } - } - - override fun updateDataModel() { - super.updateDataModel() - when (model) { - is ModuleLocalModelWrapper -> visitModule(model.element) - is FilesetLocalModelWrapper -> visitFileSet(model.element) - } - } - - override fun getNodes() = nodesSequence.toCollection(LinkedHashSet()) - override fun getEdges() = super.getEdges() + extraEdges - } - - override fun getID() = "KotlinSpringLocalModels" - - override fun createDataModel( - project: Project, - element: LocalModelGraphElementWrapper<*>?, - file: VirtualFile?, - presentationModel: DiagramPresentationModel? - ): SpringLocalModelsDataModel? { - if (element == null) return null - return KotlinSpringLocalModelsDataModel(project, element, true) - } -} diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesAction.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesAction.kt.181 deleted file mode 100644 index 929fc4aeabc..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesAction.kt.181 +++ /dev/null @@ -1,36 +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.spring.diagram - -import com.intellij.diagram.DiagramProvider -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.spring.contexts.model.diagram.actions.OpenSpringModelDependenciesAction -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer - -class OpenKotlinSpringModelDependenciesAction(klass: KtClass) : OpenSpringModelDependenciesAction() { - private val klassPointer = klass.createSmartPointer() - - override fun findInDataContext(provider: DiagramProvider<*>, context: DataContext): Any? { - val wrappingContext = DataContext { id -> - if (CommonDataKeys.PSI_ELEMENT.`is`(id)) klassPointer.element?.toLightClass() else context.getData(id) - } - return super.findInDataContext(provider, wrappingContext) - } -} diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesModuleDiagramAction.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesModuleDiagramAction.kt.181 deleted file mode 100644 index 4b726c7fe80..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/diagram/OpenKotlinSpringModelDependenciesModuleDiagramAction.kt.181 +++ /dev/null @@ -1,25 +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.spring.diagram - -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.spring.contexts.model.diagram.actions.OpenSpringModelDependenciesModuleDiagramAction - -// TODO: Drop when SpringLocalModelsDataModel gets support for non-Java/non-XML files -class OpenKotlinSpringModelDependenciesModuleDiagramAction : OpenSpringModelDependenciesModuleDiagramAction() { - override fun getProvider(e: AnActionEvent) = KotlinSpringLocalModelDependenciesDiagramProvider() -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/el/KotlinSpringELInjector.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/el/KotlinSpringELInjector.kt.181 deleted file mode 100644 index 4280bd9fa41..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/el/KotlinSpringELInjector.kt.181 +++ /dev/null @@ -1,79 +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.spring.el - -import com.intellij.ide.plugins.PluginManager -import com.intellij.lang.injection.MultiHostInjector -import com.intellij.lang.injection.MultiHostRegistrar -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiLanguageInjectionHost -import com.intellij.psi.impl.source.jsp.el.ELContextProvider -import com.intellij.spring.constants.SpringAnnotationsConstants -import com.intellij.spring.el.SpringELLanguage -import com.intellij.spring.el.SpringElTemplateParser -import com.intellij.spring.el.contextProviders.SpringElContextProvider -import org.jetbrains.kotlin.descriptors.ConstructorDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.analyze -import org.jetbrains.kotlin.idea.imports.importableFqName -import org.jetbrains.kotlin.psi.KtAnnotationEntry -import org.jetbrains.kotlin.psi.KtStringTemplateExpression -import org.jetbrains.kotlin.psi.KtValueArgument -import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType -import org.jetbrains.kotlin.psi.psiUtil.isPlainWithEscapes -import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall -import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode -import org.jetbrains.kotlin.utils.ifEmpty - -class KotlinSpringELInjector : MultiHostInjector { - companion object { - private val RELEVANT_ANNOTATIONS = setOf(SpringAnnotationsConstants.VALUE, SpringAnnotationsConstants.SCHEDULED) - - // SpEL support requires both Spring and J2EE plugins - // This code works around the inability to specify multiple dependencies for a given plugin config file - private val contextRecorder by lazy { - if ("com.intellij.javaee" in PluginManager.getDisabledPlugins()) return@lazy null - { host: PsiElement -> host.putUserData(ELContextProvider.ourContextProviderKey, SpringElContextProvider(host)) } - } - } - - override fun getLanguagesToInject(registrar: MultiHostRegistrar, host: PsiElement) { - if (host is KtStringTemplateExpression) { - if (!host.isPlainWithEscapes()) return - - val argument = host.parent as? KtValueArgument ?: return - val entry = argument.getStrictParentOfType() ?: return - val context = entry.analyze(BodyResolveMode.PARTIAL) - val resolvedCall = entry.getResolvedCall(context) ?: return - val annotation = (resolvedCall.resultingDescriptor as? ConstructorDescriptor)?.containingDeclaration ?: return - if (annotation.importableFqName?.asString() !in RELEVANT_ANNOTATIONS) return - - val text = host.getText() - val ranges = SpringElTemplateParser.parse(text).ifEmpty { return } - for (range in ranges) { - registrar - .startInjecting(SpringELLanguage.INSTANCE) - .addPlace(null, null, host as PsiLanguageInjectionHost, range) - .doneInjecting() - } - - contextRecorder!!(host) - } - } - - override fun elementsToInjectIn() = contextRecorder?.let { listOf(KtStringTemplateExpression::class.java) } ?: emptyList() -} - diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinAutowiredDependencyAction.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinAutowiredDependencyAction.kt.181 deleted file mode 100644 index ab5f022172b..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinAutowiredDependencyAction.kt.181 +++ /dev/null @@ -1,37 +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.spring.generate - -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiFile -import com.intellij.spring.SpringBundle -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.psi.KtClass - -class GenerateKotlinAutowiredDependencyAction : GenerateKotlinSpringBeanDependencyAction( - SpringBundle.message("action.generate.autowired.dependencies.action.text") -) { - override fun checkContext(module: Module) = true - - override fun invoke(project: Project, editor: Editor, file: PsiFile) { - val klass = getTargetClass(editor, file) as? KtClass ?: return - val lightClass = klass.toLightClass() ?: return - generateAutowiredDependenciesFor(lightClass).forEach { it.runTemplates() } - } -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanDependencyAction.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanDependencyAction.kt.181 deleted file mode 100644 index b280c592f99..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanDependencyAction.kt.181 +++ /dev/null @@ -1,41 +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.spring.generate - -import com.intellij.openapi.module.Module -import com.intellij.spring.model.actions.generate.GenerateSpringBeanDependenciesUtil -import icons.SpringApiIcons -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateActionBase -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.KtClassOrObject - -abstract class GenerateKotlinSpringBeanDependencyAction(text: String) : KotlinGenerateActionBase() { - init { - templatePresentation.text = text - templatePresentation.icon = SpringApiIcons.Spring - } - - override fun isValidForClass(targetClass: KtClassOrObject): Boolean { - if (targetClass !is KtClass || targetClass.isInterface() || targetClass.isEnum() || targetClass.fqName == null) return false - val lightClass = targetClass.toLightClass() ?: return false - val module = GenerateSpringBeanDependenciesUtil.getSpringModule(lightClass) ?: return false - return checkContext(module) - } - - abstract fun checkContext(module: Module): Boolean -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanXmlDependencyAction.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanXmlDependencyAction.kt.181 deleted file mode 100644 index 6c7ae3c8139..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/GenerateKotlinSpringBeanXmlDependencyAction.kt.181 +++ /dev/null @@ -1,60 +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.spring.generate - -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiFile -import com.intellij.psi.xml.XmlFile -import com.intellij.spring.SpringBundle -import com.intellij.spring.SpringManager -import com.intellij.spring.model.utils.SpringModelUtils -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.psi.KtClass - -abstract class GenerateKotlinSpringBeanXmlDependencyAction( - text: String, - private val injectionKind: SpringDependencyInjectionKind -) : GenerateKotlinSpringBeanDependencyAction(text) { - class Constructor: GenerateKotlinSpringBeanXmlDependencyAction( - SpringBundle.message("action.Spring.Beans.Generate.Constructor.Dependency.Action.text"), - SpringDependencyInjectionKind.CONSTRUCTOR - ) - - class Setter: GenerateKotlinSpringBeanXmlDependencyAction( - SpringBundle.message("action.Spring.Beans.Generate.Setter.Dependency.Action.text"), - SpringDependencyInjectionKind.SETTER - ) - - class LateinitProperty: GenerateKotlinSpringBeanXmlDependencyAction( - "Spring 'lateinit' Dependency...", - SpringDependencyInjectionKind.LATEINIT_PROPERTY - ) - - override fun checkContext(module: Module): Boolean { - return SpringManager.getInstance(module.project).getCombinedModel(module).configFiles.any { it is XmlFile } - } - - override fun invoke(project: Project, editor: Editor, file: PsiFile) { - val klass = getTargetClass(editor, file) as? KtClass ?: return - val lightClass = klass.toLightClass() ?: return - val springModel = SpringModelUtils.getInstance().getPsiClassSpringModel(lightClass) - val templates = generateDependenciesFor(springModel, lightClass, injectionKind) - templates.forEach { it.runTemplates() } - } -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateAutowiredDependenciesUtils.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateAutowiredDependenciesUtils.kt.181 deleted file mode 100644 index 40ceaaa4265..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateAutowiredDependenciesUtils.kt.181 +++ /dev/null @@ -1,126 +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.spring.generate - -import com.intellij.codeInsight.template.TemplateBuilderImpl -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.runWriteAction -import com.intellij.openapi.util.text.StringUtil -import com.intellij.psi.PsiClass -import com.intellij.spring.CommonSpringModel -import com.intellij.spring.constants.SpringAnnotationsConstants -import com.intellij.spring.model.CommonSpringBean -import com.intellij.spring.model.SpringBeanPointer -import com.intellij.spring.model.SpringModelSearchParameters -import com.intellij.spring.model.actions.generate.GenerateSpringBeanDependenciesUtil -import com.intellij.spring.model.utils.SpringModelSearchers -import com.intellij.spring.model.utils.SpringModelUtils -import com.intellij.util.IncorrectOperationException -import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.idea.core.ShortenReferences -import org.jetbrains.kotlin.idea.editor.BatchTemplateRunner -import org.jetbrains.kotlin.idea.spring.effectiveBeanClasses -import org.jetbrains.kotlin.psi.KtProperty -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject -import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer -import org.jetbrains.kotlin.psi.psiUtil.isIdentifier -import org.jetbrains.kotlin.utils.ifEmpty - -// TODO: GenerateAutowiredDependenciesUtil.getQualifierName() is not accessible here -private fun SpringBeanPointer.getQualifierName(): String? { - val value = springBean.springQualifier?.qualifierValue - return if (value.isNullOrBlank()) name else value -} - -private fun createAutowiredProperty( - currentBeanClass: KtLightClass, - candidateBean: SpringBeanPointer, - candidateBeanClasses: Array, - model: CommonSpringModel -): KtProperty? { - try { - val ktBeanClass = currentBeanClass.kotlinOrigin ?: return null - - val qualifierName = candidateBean.getQualifierName() - val candidateBeanClass = candidateBeanClasses.first() - val beanName = candidateBean.name - val name = if (beanName != null && beanName.isIdentifier()) beanName else candidateBeanClass.name!! - - val psiFactory = KtPsiFactory(currentBeanClass.project) - // TODO: Use KtPsiFactory.CallableBuilder - val prototype = psiFactory.createProperty("lateinit var ${name.decapitalize()}: ${candidateBeanClass.defaultTypeText}").apply { - addAnnotationEntry(psiFactory.createAnnotationEntry("@${SpringAnnotationsConstants.AUTOWIRED}")) - - val searchParameters = SpringModelSearchParameters.byClass(candidateBeanClass).withInheritors().effectiveBeanTypes() - if (SpringModelSearchers.findBeans(model, searchParameters).size > 1 && !qualifierName.isNullOrBlank()) { - val annotationText = "@${SpringAnnotationsConstants.QUALIFIER}(\"${StringUtil.escapeStringCharacters(qualifierName!!)}\")" - addAnnotationEntry(psiFactory.createAnnotationEntry(annotationText)) - } - } - return ktBeanClass.addDeclaration(prototype).apply { ShortenReferences.DEFAULT.process(this) } - } - catch (e: IncorrectOperationException) { - throw RuntimeException(e) - } -} - -private fun addCreatePropertyTemplate( - property: KtProperty, - candidateBean: SpringBeanPointer, - candidateBeanClasses: Array -): BatchTemplateRunner { - return BatchTemplateRunner(property.project).apply { - val propertyPointer = property.createSmartPointer() - addTemplateFactory(property) { - val currentProperty = propertyPointer.element ?: return@addTemplateFactory null - val builder = TemplateBuilderImpl(currentProperty) - builder.appendVariableTemplate(currentProperty, candidateBeanClasses) { - val existingNames = currentProperty.containingClassOrObject!!.declarations - .mapNotNull { if (it != currentProperty) (it as? KtProperty)?.name else null } - getSuggestedNames(candidateBean, currentProperty, existingNames = existingNames) { returnType } - } - builder.buildInlineTemplate() - } - } -} - -private fun createAutowiredDependency( - klass: KtLightClass, - candidateBean: SpringBeanPointer, - model: CommonSpringModel -): BatchTemplateRunner? { - val candidateBeanClasses = candidateBean.effectiveBeanClasses().ifEmpty { return null } - if (!GenerateSpringBeanDependenciesUtil.ensureFileWritable(klass)) return null - return runWriteAction { - createAutowiredProperty(klass, candidateBean, candidateBeanClasses, model)?.let { property -> - addCreatePropertyTemplate(property, candidateBean, candidateBeanClasses) - } - } -} - -fun generateAutowiredDependenciesFor(klass: KtLightClass): List { - val model = SpringModelUtils.getInstance().getPsiClassSpringModel(klass) - val candidates = GenerateSpringBeanDependenciesUtil.getAutowiredBeanCandidates(model) { true } - val dependencies = if (ApplicationManager.getApplication().isUnitTestMode) { - candidates.map { it.springBean }.filter(klass.project.beanFilter).sortedBy { it.name } - } - else { - GenerateSpringBeanDependenciesUtil.chooseDependentBeans(candidates, klass.project, true) - } - return dependencies.mapNotNull { createAutowiredDependency(klass, it, model) } -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateDependenciesUtils.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateDependenciesUtils.kt.181 deleted file mode 100644 index fbd41e51ae3..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/generate/generateDependenciesUtils.kt.181 +++ /dev/null @@ -1,513 +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.spring.generate - -import com.intellij.codeInsight.lookup.LookupElement -import com.intellij.codeInsight.lookup.LookupElementBuilder -import com.intellij.codeInsight.template.Expression -import com.intellij.codeInsight.template.ExpressionContext -import com.intellij.codeInsight.template.TemplateBuilderImpl -import com.intellij.codeInsight.template.TextResult -import com.intellij.codeInspection.SmartHashMap -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.runWriteAction -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.psi.* -import com.intellij.psi.util.PropertyUtil -import com.intellij.psi.util.PsiTypesUtil -import com.intellij.spring.CommonSpringModel -import com.intellij.spring.model.CommonSpringBean -import com.intellij.spring.model.SpringBeanPointer -import com.intellij.spring.model.SpringModelSearchParameters -import com.intellij.spring.model.actions.generate.GenerateSpringBeanDependenciesUtil -import com.intellij.spring.model.actions.generate.GenerateSpringBeanDependenciesUtil.* -import com.intellij.spring.model.actions.generate.SpringBeanClassMember -import com.intellij.spring.model.highlighting.xml.SpringConstructorArgResolveUtil - -import com.intellij.spring.model.utils.SpringBeanCoreUtils -import com.intellij.spring.model.utils.SpringBeanUtils -import com.intellij.spring.model.utils.SpringModelSearchers -import com.intellij.spring.model.utils.SpringModelUtils -import com.intellij.spring.model.xml.DomSpringBean -import com.intellij.spring.model.xml.beans.Beans -import com.intellij.spring.model.xml.beans.SpringBean -import com.intellij.util.IncorrectOperationException -import com.intellij.util.xml.DomElement -import com.intellij.util.xml.DomUtil -import org.jetbrains.annotations.NotNull -import org.jetbrains.annotations.TestOnly -import org.jetbrains.kotlin.asJava.classes.KtLightClass -import org.jetbrains.kotlin.asJava.elements.KtLightMethod -import org.jetbrains.kotlin.descriptors.CallableDescriptor -import org.jetbrains.kotlin.descriptors.ClassDescriptor -import org.jetbrains.kotlin.idea.caches.project.getModuleInfo -import org.jetbrains.kotlin.idea.caches.project.forcedModuleInfo -import org.jetbrains.kotlin.idea.caches.resolve.* -import org.jetbrains.kotlin.idea.caches.resolve.util.getJavaOrKotlinMemberDescriptor -import org.jetbrains.kotlin.idea.caches.resolve.util.getParameterDescriptor -import org.jetbrains.kotlin.idea.completion.BasicLookupElementFactory -import org.jetbrains.kotlin.idea.completion.InsertHandlerProvider -import org.jetbrains.kotlin.idea.core.KotlinNameSuggester -import org.jetbrains.kotlin.idea.core.NewDeclarationNameValidator -import org.jetbrains.kotlin.idea.core.ShortenReferences -import org.jetbrains.kotlin.idea.core.getOrCreateCompanionObject -import org.jetbrains.kotlin.idea.editor.BatchTemplateRunner -import org.jetbrains.kotlin.idea.spring.beanClass -import org.jetbrains.kotlin.idea.spring.effectiveBeanClasses -import org.jetbrains.kotlin.idea.util.CallType -import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers -import org.jetbrains.kotlin.load.java.propertyNameBySetMethodName -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.isIdentifier -import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.expressions.TypeReconstructionUtil -import org.jetbrains.kotlin.utils.SmartList -import org.jetbrains.kotlin.utils.ifEmpty -import java.util.* - -// TODO: GenerateSpringBeanDependenciesUtil.ensureFileWritable() is not accessible here -private fun DomElement.ensureFileWritable() = ensureFileWritable(DomUtil.getFile(this).virtualFile, manager.project) - -// TODO: GenerateSpringBeanDependenciesUtil.getReferenceName() is not accessible here -private fun getReferencedName(currentBean: SpringBean, bean: SpringBeanPointer): String? { - val model = SpringModelUtils.getInstance().getSpringModel(currentBean) - return SpringBeanCoreUtils.getReferencedName(bean, model.allCommonBeans) -} - -// TODO: GenerateSpringBeanDependenciesUtil.getExistedSetter() is not accessible here -private fun getExistedSetter(currentBeanClass: PsiClass, setterPsiClass: PsiClass): PsiMethod? { - val psiClassType = JavaPsiFacade.getInstance(setterPsiClass.project).elementFactory.createType(setterPsiClass) - return currentBeanClass.allMethods.firstOrNull { - PropertyUtil.isSimplePropertySetter(it) && it.parameterList.parameters.first().type.isAssignableFrom(psiClassType) - } -} - -// TODO: GenerateSpringBeanDependenciesUtil.findConstructor() is not accessible here -private fun findConstructor(constructors: Array, psiParameterTypes: List): PsiMethod? { - return constructors.firstOrNull { - val parameters = it.parameterList.parameters - if (it.parameterList.parametersCount != psiParameterTypes.size) return@firstOrNull false - (psiParameterTypes zip parameters).all { it.first.isAssignableFrom(it.second.type) } - } -} - -// TODO: GenerateSpringBeanDependenciesUtil.findExistedConstructor() is not accessible here -private fun findExistedConstructor( - currentBean: SpringBean, - currentBeanClass: PsiClass, - candidateParameterClasses: Array -): PsiMethod? { - val constructors = SpringConstructorArgResolveUtil.findMatchingMethods(currentBean) - for (candidateBeanClass in candidateParameterClasses) { - for (constructor in constructors) { - val psiParameterTypes = SmartList().apply { - constructor.parameterList.parameters.mapTo(this) { it.type } - add(PsiTypesUtil.getClassType(candidateBeanClass)) - } - findConstructor(currentBeanClass.constructors, psiParameterTypes)?.let { return it } - } - } - - return null -} - -// TODO: GenerateSpringBeanDependenciesUtil.createSpringBean() is not accessible here -private fun createSpringBean(parentBeans: Beans, psiClass: PsiClass): SpringBean? { - if (!((parentBeans as DomElement)).ensureFileWritable()) return null - - return parentBeans.addBean().apply { - clazz.stringValue = psiClass.qualifiedName - id.stringValue = SpringBeanCoreUtils.suggestBeanNames(this).firstOrNull() ?: "" - } -} - -private fun SpringBean.getFactoryFunctionName(factoryBeanClass: KtClass): String { - factoryMethod.stringValue?.let { if (!it.isBlank()) return it } - - val existingNames = factoryBeanClass.declarations.mapNotNull { if (it is KtFunction || it is KtClassOrObject) it.name else null } - return KotlinNameSuggester.suggestNameByName("create${beanClass()!!.name}") { it !in existingNames } -} - -internal val PsiClass.defaultTypeText: String - get() { - val qName = qualifiedName ?: return "Any" - val typeParameters = typeParameters - if (typeParameters.isEmpty()) return qName - return TypeReconstructionUtil.getTypeNameAndStarProjectionsString(qName, typeParameters.size) - } - -private fun createSettable( - candidateBean: SpringBeanPointer, - currentBeanClass: KtLightClass, - candidateBeanClasses: Array, - injectionKind: SpringDependencyInjectionKind -): KtNamedDeclaration { - val project = currentBeanClass.project - val psiFactory = KtPsiFactory(project) - val beanName = candidateBean.name - try { - val candidateClass = candidateBeanClasses.first() - val propertyName = if (beanName != null && beanName.isIdentifier()) beanName else candidateClass.name!! - - val prototype: KtNamedDeclaration = when (injectionKind) { - SpringDependencyInjectionKind.SETTER -> { - psiFactory.createFunction("fun set${propertyName.capitalize()}(${propertyName.decapitalize()}: ${candidateClass.defaultTypeText}) { }") - } - - SpringDependencyInjectionKind.LATEINIT_PROPERTY -> { - psiFactory.createProperty("lateinit var ${propertyName.decapitalize()}: ${candidateClass.defaultTypeText}") - } - - else -> error("Unexpected injection kind: $injectionKind") - } - return currentBeanClass.kotlinOrigin!!.addDeclaration(prototype).apply { ShortenReferences.DEFAULT.process(this) } - } - catch (e: IncorrectOperationException) { - throw RuntimeException(e) - } -} - -internal fun getSuggestedNames( - beanPointer: SpringBeanPointer, - declaration: KtCallableDeclaration, - excludedInValidator: List = listOf(declaration), - existingNames: Collection = emptyList(), - getType: CallableDescriptor.() -> KotlinType? -): Collection { - val names = LinkedHashSet() - - val newDeclarationNameValidator = - NewDeclarationNameValidator(declaration.parent, null, NewDeclarationNameValidator.Target.VARIABLES, excludedInValidator) - fun validate(name: String) = name !in existingNames && newDeclarationNameValidator(name) - - SpringBeanUtils.getInstance() - .findBeanNames(beanPointer.springBean) - .asSequence() - .filter { it.isIdentifier() } - .mapTo(names) { KotlinNameSuggester.suggestNameByName(it, ::validate) } - - (declaration.resolveToDescriptor() as CallableDescriptor).getType()?.let { - names += KotlinNameSuggester.suggestNamesByType(it, ::validate) - } - - return names -} - -internal fun TemplateBuilderImpl.appendVariableTemplate( - variable: KtCallableDeclaration, - candidateBeanClasses: Array, - computeSuggestions: (() -> Collection)? -) { - if (computeSuggestions != null) { - val suggestedNames = computeSuggestions() - val defaultName = variable.name ?: "" - val nameExpression = object : Expression() { - override fun calculateResult(context: ExpressionContext) = TextResult(defaultName) - - override fun calculateQuickResult(context: ExpressionContext) = calculateResult(context) - - override fun calculateLookupItems(context: ExpressionContext): Array? { - PsiDocumentManager.getInstance(context.project).commitAllDocuments() - return suggestedNames.map { LookupElementBuilder.create(it) }.toTypedArray() - - } - } - replaceElement(variable.nameIdentifier, "names", nameExpression, true) - } - - val superTypeVariants = getSuperTypeVariants(candidateBeanClasses) - if (superTypeVariants.size > 1) { - val lookupFactory = BasicLookupElementFactory(variable.project, InsertHandlerProvider(CallType.TYPE) { emptyList() }) - val typeReferenceExpression = object : Expression() { - override fun calculateResult(context: ExpressionContext) = TextResult(candidateBeanClasses.first().qualifiedName ?: "") - - override fun calculateQuickResult(context: ExpressionContext) = calculateResult(context) - - override fun calculateLookupItems(context: ExpressionContext): Array? { - return superTypeVariants - .mapTo(LinkedHashSet()) { lookupFactory.createLookupElementForJavaClass(it, qualifyNestedClasses = true) } - .toTypedArray() - } - } - replaceElement(variable.typeReference, "type", typeReferenceExpression, true) - } -} - -private fun BatchTemplateRunner.addCreateFunctionTemplate( - function: KtFunction, - candidateBeanClasses: Map>, - dependency: SpringBeanPointer -) { - val parameterList = function.valueParameterList!! - val builder = TemplateBuilderImpl(parameterList) - addTemplateFactory(parameterList) { - for ((paramIndex, candidateBeanClassesForParam) in candidateBeanClasses) { - builder.appendVariableTemplate(function.valueParameters[paramIndex], candidateBeanClassesForParam) { - getSuggestedNames(dependency, function, listOf(function.valueParameters[paramIndex], function)) { - valueParameters[paramIndex].type - } - } - } - - builder.buildInlineTemplate() - } -} - -private fun BatchTemplateRunner.addCreatePropertyTemplate(property: KtProperty, candidateBeanClasses: Array) { - val builder = TemplateBuilderImpl(property) - addTemplateFactory(property) { - builder.appendVariableTemplate(property, candidateBeanClasses, null) - builder.buildInlineTemplate() - } -} - -private fun BatchTemplateRunner.addCreateFunctionTemplate( - function: KtFunction, - paramIndex: Int, - candidateBeanClasses: Array, - dependency: SpringBeanPointer -) { - addCreateFunctionTemplate(function, mapOf(paramIndex to candidateBeanClasses), dependency) -} - -private fun getOrCreateSetter( - candidateBean: SpringBeanPointer, - currentBeanClass: KtLightClass, - candidateBeanClasses: Array, - templatesHolder: BatchTemplateRunner, - injectionKind: SpringDependencyInjectionKind -): PsiNamedElement? { - for (candidateBeanClass in candidateBeanClasses) { - getExistedSetter(currentBeanClass, candidateBeanClass)?.let { return it } - } - - if (!ensureFileWritable(currentBeanClass)) return null - val settable = createSettable(candidateBean, currentBeanClass, candidateBeanClasses, injectionKind) - when (settable) { - is KtNamedFunction -> templatesHolder.addCreateFunctionTemplate(settable, 0, candidateBeanClasses, candidateBean) - is KtProperty -> templatesHolder.addCreatePropertyTemplate(settable, candidateBeanClasses) - } - - return settable -} - -private fun createSetterDependency( - currentBean: SpringBean, - dependency: SpringBeanPointer, - injectionKind: SpringDependencyInjectionKind -): BatchTemplateRunner? { - val templatesHolder = BatchTemplateRunner(currentBean.manager.project) - val currentBeanClass = currentBean.beanClass() as? KtLightClass ?: return null - val candidateBeanClasses = dependency.effectiveBeanClasses().ifEmpty { return null } - val setter = getOrCreateSetter(dependency, currentBeanClass, candidateBeanClasses, templatesHolder, injectionKind) ?: return null - currentBean.addProperty().apply { - name.ensureXmlElementExists() - name.stringValue = when (setter) { - is PsiMethod, is KtFunction -> propertyNameBySetMethodName(Name.identifier(setter.name!!), false)!!.asString() - else -> setter.name - } - refAttr.setStringValue(getReferencedName(currentBean, dependency)) - } - return templatesHolder -} - -private fun addConstructorParameter( - currentBeanClass: KtLightClass, - candidateBeanClass: PsiClass, - constructor: KtFunction -) { - val psiFactory = KtPsiFactory(currentBeanClass) - - val validator = NewDeclarationNameValidator(constructor, null, NewDeclarationNameValidator.Target.VARIABLES) - val resolutionFacade = currentBeanClass.kotlinOrigin!!.getResolutionFacade() - val defaultType = (candidateBeanClass.getJavaOrKotlinMemberDescriptor(resolutionFacade) as ClassDescriptor).defaultType - val name = KotlinNameSuggester.suggestNamesByType(defaultType, validator).first() - - val parameter = psiFactory.createParameter("$name: ${candidateBeanClass.defaultTypeText}") - constructor.getValueParameterList()!!.addParameter(parameter).apply { ShortenReferences.DEFAULT.process(this) } -} - -private fun findProperConstructorAndAddParameter( - currentBean: SpringBean, - dependency: SpringBeanPointer, - currentBeanClass: KtLightClass, - candidateBeanClass: PsiClass, - holder: BatchTemplateRunner -): PsiMethod? { - val lightConstructor = currentBean.resolvedConstructorArgs.resolvedMethod as? KtLightMethod ?: return null - val constructorOrigin = lightConstructor.kotlinOrigin - val properConstructor = when (constructorOrigin) { - is KtFunction -> constructorOrigin - is KtClass -> constructorOrigin.createPrimaryConstructorIfAbsent() - else -> return null - } - addConstructorParameter(currentBeanClass, candidateBeanClass, properConstructor) - holder.addCreateFunctionTemplate(properConstructor, properConstructor.getValueParameters().lastIndex, arrayOf(candidateBeanClass), dependency) - return lightConstructor -} - -private fun createConstructorWithTemplate( - currentBean: SpringBean, - dependency: SpringBeanPointer, - templatesHolder: BatchTemplateRunner -) { - val beanClass = currentBean.beanClass() as? KtLightClass ?: return - val ktBeanClass = beanClass.kotlinOrigin as? KtClass ?: return - - try { - val psiFactory = KtPsiFactory(beanClass) - val factoryFunction = when { - currentBean.factoryBean.exists() -> { - // TODO: Support non-Kotlin factory beans - val factoryClass = currentBean.factoryBean.value?.beanClass as? KtLightClass ?: return - val ktFactoryClass = factoryClass.kotlinOrigin as? KtClass ?: return - val funName = currentBean.getFactoryFunctionName(ktFactoryClass) - val funText = "fun $funName(): ${beanClass.defaultTypeText} {\n return null \n}" - ktFactoryClass.addDeclaration(psiFactory.createFunction(funText)) - } - currentBean.factoryMethod.exists() -> { - val funName = currentBean.getFactoryFunctionName(ktBeanClass) - val funText = "@JvmStatic fun $funName(): ${beanClass.defaultTypeText} {\n return null \n}" - ktBeanClass.getOrCreateCompanionObject().addDeclaration(psiFactory.createFunction(funText)) - } - else -> { - if (ktBeanClass.hasPrimaryConstructor() || ktBeanClass.getSecondaryConstructors().isNotEmpty()) { - ktBeanClass.addDeclaration(psiFactory.createSecondaryConstructor("constructor()")) - } - else { - ktBeanClass.createPrimaryConstructorIfAbsent() - } - } - } as KtFunction - - ShortenReferences.DEFAULT.process(factoryFunction) - - val dummyMethod = JavaPsiFacade.getElementFactory(beanClass.project).createMethod("foo", PsiType.VOID) - dummyMethod.containingFile.forcedModuleInfo = ktBeanClass.getModuleInfo() - SpringConstructorArgResolveUtil.suggestParamsForConstructorArgs(currentBean).forEach { dummyMethod.parameterList.add(it) } - - val parameterList = factoryFunction.valueParameterList!! - val indexOffset = parameterList.parameters.size - val candidateClassMap = SmartHashMap>() - val resolutionFacade = ktBeanClass.getResolutionFacade() - for ((i, psiParam) in dummyMethod.parameterList.parameters.withIndex()) { - val descriptor = psiParam.getParameterDescriptor(resolutionFacade)!! - val ktParameter = psiFactory.createParameter( - "${psiParam.name}: ${IdeDescriptorRenderers.SOURCE_CODE_NOT_NULL_TYPE_APPROXIMATION.renderType(descriptor.type)}" - ) - parameterList.addParameter(ktParameter) - (psiParam.type as? PsiClassType)?.resolve()?.let { candidateClassMap[i + indexOffset] = arrayOf(it) } - } - - templatesHolder.addCreateFunctionTemplate(factoryFunction, candidateClassMap, dependency) - } - catch (e: IncorrectOperationException) { - throw RuntimeException(e) - } -} - -private fun createConstructorDependency( - currentBean: SpringBean, - dependency: SpringBeanPointer -): BatchTemplateRunner? { - val templatesHolder = BatchTemplateRunner(currentBean.manager.project) - val currentBeanClass = currentBean.beanClass() as? KtLightClass ?: return null - val candidateBeanClasses = dependency.effectiveBeanClasses().ifEmpty { return null } - var existedConstructor = findExistedConstructor(currentBean, currentBeanClass, candidateBeanClasses) - if (existedConstructor == null) { - if (!ensureFileWritable(currentBeanClass)) return null - existedConstructor = findProperConstructorAndAddParameter(currentBean, dependency, currentBeanClass, candidateBeanClasses.first(), templatesHolder) - } - - val newConstructorArg = currentBean.addConstructorArg() - newConstructorArg.refAttr.stringValue = getReferencedName(currentBean, dependency) - if (existedConstructor == null && SpringConstructorArgResolveUtil.findMatchingMethods(currentBean).isEmpty()) { - createConstructorWithTemplate(currentBean, dependency, templatesHolder) - } - - return templatesHolder -} - -private fun generateDependency( - springBean: SpringBean, - dependency: SpringBeanPointer, - injectionKind: SpringDependencyInjectionKind -): BatchTemplateRunner? { - return runWriteAction { - if (injectionKind.isSetter) { - createSetterDependency(springBean, dependency, injectionKind) - } - else { - createConstructorDependency(springBean, dependency) - } - } -} - -enum class SpringDependencyInjectionKind(val isSetter: Boolean) { - CONSTRUCTOR(false), - SETTER(true), - LATEINIT_PROPERTY(true) -} - -@set:TestOnly -var Project.beanFilter: (SpringBeanPointer) -> Boolean - by NotNullableUserDataProperty(Key.create("BEAN_CHOOSER")) { true } - -@NotNull -private fun chooseDependentBeans( - candidates: Set, - project: Project, - isSetterDependency: Boolean -): List> { - return if (ApplicationManager.getApplication().isUnitTestMode) { - candidates.map { it.springBean }.filter(project.beanFilter) - } - else { - GenerateSpringBeanDependenciesUtil.chooseDependentBeans(candidates, project, isSetterDependency) - } -} - -fun generateDependenciesFor( - springModel: CommonSpringModel, - klass: KtLightClass, - injectionKind: SpringDependencyInjectionKind -): List { - val project = klass.project - val isSetter = injectionKind.isSetter - - SpringModelSearchers - .findBeans(springModel, SpringModelSearchParameters.byClass(klass)) - .asSequence() - .map { it.springBean } - .filterIsInstance() - .firstOrNull { acceptBean(it, false) } - ?.let { springBean -> - if (!springBean.ensureFileWritable()) return emptyList() - if (springBean.beanClass() == null) return emptyList() - val dependencies = chooseDependentBeans(getCandidates(springBean, isSetter), project, isSetter) - return dependencies.mapNotNull { generateDependency(springBean, it, injectionKind) } - } - - val dependencies = chooseDependentBeans(getCandidates(springModel, klass, isSetter), project, isSetter) - val beanXml = dependencies.singleOrNull()?.springBean as? DomSpringBean ?: return emptyList() - val beansXml = beanXml.getParentOfType(Beans::class.java, false) ?: return emptyList() - val newBean = createSpringBean(beansXml, klass) ?: return emptyList() - - return dependencies.mapNotNull { generateDependency(newBean, it, injectionKind) } -} diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringComponentScanInspection.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringComponentScanInspection.kt.181 deleted file mode 100644 index 8c63dd9ff1f..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringComponentScanInspection.kt.181 +++ /dev/null @@ -1,57 +0,0 @@ -package org.jetbrains.kotlin.idea.spring.inspections - -import com.intellij.codeInspection.ProblemHighlightType -import com.intellij.codeInspection.ProblemsHolder -import com.intellij.jam.NonPhysicalReferenceWrapper -import com.intellij.psi.PsiElementVisitor -import com.intellij.psi.PsiReference -import com.intellij.psi.impl.source.resolve.reference.impl.providers.PsiPackageReference -import com.intellij.spring.model.jam.stereotype.SpringComponentScan -import com.intellij.spring.model.jam.utils.SpringJamUtils -import org.jetbrains.kotlin.asJava.elements.KtLightAnnotationForSourceEntry -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtStringTemplateEntry -import org.jetbrains.kotlin.psi.KtTreeVisitorVoid -import org.jetbrains.kotlin.psi.KtVisitorVoid - -class KotlinSpringComponentScanInspection : AbstractKotlinInspection() { - - override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { - return object: KtVisitorVoid() { - override fun visitClassOrObject(classOrObject: KtClassOrObject) { - val lightClass = classOrObject.toLightClass() ?: return - val beansPackagesScan = SpringJamUtils.getInstance().getBeansPackagesScan(lightClass) - .filterIsInstance() - val kotlinAnnotations = beansPackagesScan - .mapNotNull { (it.annotation as? KtLightAnnotationForSourceEntry)?.kotlinOrigin } - if (kotlinAnnotations.isEmpty()) return - val literalVisitor = PsiPackageReferenceChecker(holder) - for (kotlinAnnotation in kotlinAnnotations) { - kotlinAnnotation.accept(literalVisitor) - } - } - } - } - - private class PsiPackageReferenceChecker(private val holder: ProblemsHolder) : KtTreeVisitorVoid() { - override fun visitStringTemplateEntry(entry: KtStringTemplateEntry) { - for (reference in entry.references) { - val packageReference = psiPackageReference(reference) ?: continue - if (packageReference.multiResolve(false).isEmpty()) { - holder.registerProblem(reference, //registering on physical reference - ProblemsHolder.unresolvedReferenceMessage(packageReference), //but getting message from logical reference - ProblemHighlightType.LIKE_UNKNOWN_SYMBOL) - } - } - } - - private fun psiPackageReference(reference: PsiReference): PsiPackageReference? = when (reference) { - is PsiPackageReference -> reference - is NonPhysicalReferenceWrapper -> psiPackageReference(reference.wrappedReference) - else -> null - } - } - -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringFacetCodeInspection.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringFacetCodeInspection.kt.181 deleted file mode 100644 index 2bb59eb840d..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/KotlinSpringFacetCodeInspection.kt.181 +++ /dev/null @@ -1,43 +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.spring.inspections - -import com.intellij.codeInspection.ProblemsHolder -import com.intellij.psi.PsiElementVisitor -import com.intellij.spring.model.highlighting.config.SpringFacetCodeInspection -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection -import org.jetbrains.kotlin.idea.inspections.registerWithElementsUnwrapped -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtVisitorVoid - -class KotlinSpringFacetCodeInspection : AbstractKotlinInspection() { - private val javaInspection by lazy { SpringFacetCodeInspection() } - - override fun getDisplayName() = "Spring Facet Code Configuration (Kotlin)" - - override fun getGroupDisplayName() = "Code" - - override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { - return object: KtVisitorVoid() { - override fun visitClassOrObject(classOrObject: KtClassOrObject) { - val lightClass = classOrObject.toLightClass() ?: return - javaInspection.checkClass(lightClass, holder.manager, isOnTheFly)?.registerWithElementsUnwrapped(holder, isOnTheFly) - } - } - } -} diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/SpringKotlinAutowiredMembersInspection.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/SpringKotlinAutowiredMembersInspection.kt.181 deleted file mode 100644 index 7b0215dc8c2..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/inspections/SpringKotlinAutowiredMembersInspection.kt.181 +++ /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.kotlin.idea.spring.inspections - -import com.intellij.codeInspection.ProblemsHolder -import com.intellij.psi.PsiElementVisitor -import com.intellij.spring.model.highlighting.autowire.SpringJavaAutowiredMembersInspection - -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection -import org.jetbrains.kotlin.idea.inspections.registerWithElementsUnwrapped -import org.jetbrains.kotlin.psi.KtClassOrObject -import org.jetbrains.kotlin.psi.KtVisitorVoid - -class SpringKotlinAutowiredMembersInspection : AbstractKotlinInspection() { - private val javaInspection by lazy { SpringJavaAutowiredMembersInspection() } - - override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor { - return object: KtVisitorVoid() { - override fun visitClassOrObject(classOrObject: KtClassOrObject) { - val lightClass = classOrObject.toLightClass() ?: return - javaInspection.checkClass(lightClass, holder.manager, isOnTheFly)?.registerWithElementsUnwrapped(holder, isOnTheFly) - } - } - } -} diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/lineMarking/KotlinSpringModelDependenciesLineMarkerProvider.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/lineMarking/KotlinSpringModelDependenciesLineMarkerProvider.kt.181 deleted file mode 100644 index ee5838e0ddb..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/lineMarking/KotlinSpringModelDependenciesLineMarkerProvider.kt.181 +++ /dev/null @@ -1,83 +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.spring.lineMarking - -import com.intellij.codeHighlighting.Pass -import com.intellij.codeInsight.daemon.GutterIconNavigationHandler -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.openapi.actionSystem.DefaultActionGroup -import com.intellij.openapi.actionSystem.impl.SimpleDataContext -import com.intellij.openapi.editor.markup.GutterIconRenderer -import com.intellij.openapi.ui.popup.JBPopupFactory -import com.intellij.psi.PsiElement -import com.intellij.spring.SpringBundle -import com.intellij.spring.SpringManager -import com.intellij.spring.contexts.model.diagram.gutter.ModelDependenciesLineMarkerProviderJava -import com.intellij.spring.model.jam.stereotype.SpringConfiguration -import com.intellij.spring.model.utils.SpringCommonUtils -import com.intellij.ui.awt.RelativePoint -import com.intellij.util.Function -import icons.SpringCoreIcons -import org.jetbrains.kotlin.asJava.toLightClass -import org.jetbrains.kotlin.idea.spring.diagram.OpenKotlinSpringModelDependenciesAction -import org.jetbrains.kotlin.idea.spring.diagram.OpenKotlinSpringModelDependenciesModuleDiagramAction -import org.jetbrains.kotlin.psi.KtClass -import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch - -class KotlinSpringModelDependenciesLineMarkerProvider : ModelDependenciesLineMarkerProviderJava() { - override fun getId() = javaClass.name - - override fun getName() = "Model Dependencies Graph (Kotlin)" - - override fun isRelevantPsiElement(psiElement: PsiElement): Boolean { - val lightClass = psiElement.getParentOfTypeAndBranch { nameIdentifier }?.toLightClass() ?: return false - return SpringConfiguration.PSI_CLASS_PATTERN.accepts(lightClass) && SpringCommonUtils.isConfigurationOrMeta(lightClass) - } - - override fun doAnnotate(element: PsiElement): LineMarkerInfo<*>? { - val klass = element.getParentOfTypeAndBranch { nameIdentifier } ?: return null - val lightClass = klass.toLightClass() ?: return null - if (SpringManager.getInstance(element.project).getLocalSpringModel(lightClass) == null) return null - return createLineMarkerInfo(klass) - } - - private fun createLineMarkerInfo(klass: KtClass): LineMarkerInfo? { - val nameIdentifier = klass.nameIdentifier ?: return null - return LineMarkerInfo( - nameIdentifier, - nameIdentifier.textRange, - SpringCoreIcons.SpringModelsDependencyGraph, - Pass.UPDATE_ALL, - Function { SpringBundle.message("local.model.dependencies.diagram.title") }, - createNavigationHandler(klass), - GutterIconRenderer.Alignment.RIGHT - ) - } - - private fun createNavigationHandler(klass: KtClass): GutterIconNavigationHandler { - return GutterIconNavigationHandler { event, element -> - val group = DefaultActionGroup().apply { - add(OpenKotlinSpringModelDependenciesModuleDiagramAction()) - add(OpenKotlinSpringModelDependenciesAction(klass)) - } - val context = SimpleDataContext.getProjectContext(null) - JBPopupFactory.getInstance() - .createActionGroupPopup(null, group, context, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true) - .show(RelativePoint(event)) - } - } -} \ No newline at end of file diff --git a/ultimate/src/org/jetbrains/kotlin/idea/spring/springUtils.kt.181 b/ultimate/src/org/jetbrains/kotlin/idea/spring/springUtils.kt.181 deleted file mode 100644 index 3c0c69433b7..00000000000 --- a/ultimate/src/org/jetbrains/kotlin/idea/spring/springUtils.kt.181 +++ /dev/null @@ -1,43 +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.spring - -import com.intellij.codeInsight.AnnotationUtil -import com.intellij.openapi.module.ModuleUtilCore -import com.intellij.psi.PsiClassType -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiModifierListOwner -import com.intellij.spring.CommonSpringModel -import com.intellij.spring.model.CommonSpringBean -import com.intellij.spring.model.SpringBeanPointer -import com.intellij.spring.model.jam.utils.JamAnnotationTypeUtil -import com.intellij.spring.model.utils.SpringModelUtils - -internal fun PsiModifierListOwner.isAnnotatedWith(annotationFqName: String): Boolean { - val module = ModuleUtilCore.findModuleForPsiElement(this) ?: return false - return JamAnnotationTypeUtil.getInstance(module) - .getAnnotationTypesWithChildren(annotationFqName) - .mapNotNull { it.qualifiedName } - .any { AnnotationUtil.isAnnotated(this, it, true) } -} - -internal val PsiElement.springModel: CommonSpringModel? - get() = SpringModelUtils.getInstance().getSpringModel(this) - -internal fun CommonSpringBean.beanClass() = (beanType as? PsiClassType)?.resolve() - -internal fun SpringBeanPointer<*>.effectiveBeanClasses() = effectiveBeanTypes.mapNotNull { (it as? PsiClassType)?.resolve() }.toTypedArray() \ No newline at end of file diff --git a/ultimate/testData/inspections/spring/autowiredMembersInInvalidClass/inspectionData/inspections.test.181 b/ultimate/testData/inspections/spring/autowiredMembersInInvalidClass/inspectionData/inspections.test.181 deleted file mode 100644 index 34b475331cb..00000000000 --- a/ultimate/testData/inspections/spring/autowiredMembersInInvalidClass/inspectionData/inspections.test.181 +++ /dev/null @@ -1,2 +0,0 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.spring.inspections.SpringKotlinAutowiredMembersInspection -// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension \ No newline at end of file diff --git a/ultimate/testData/inspections/spring/autowiring/ambiguousConstructors.kt.181 b/ultimate/testData/inspections/spring/autowiring/ambiguousConstructors.kt.181 deleted file mode 100644 index 859056336d7..00000000000 --- a/ultimate/testData/inspections/spring/autowiring/ambiguousConstructors.kt.181 +++ /dev/null @@ -1,60 +0,0 @@ -// WITH_RUNTIME - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.stereotype.Component -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan -open class AmbiguousConstructors - -// Not reported if there is only one constructor - -@Component -open class SingleConstructor1(n: Int) - -@Component -open class SingleConstructor2 { - constructor(n: Int) -} - -// Not reported if no-arg constructor is present - -@Component -open class NoArgConstructor1() { - constructor(n: Int): this() - constructor(s: String): this() -} - -@Component -open class NoArgConstructor2 { - constructor() - constructor(n: Int) - constructor(s: String) -} - -// Not reported if @Autowired constructor is present -@Component -open class AutowiredConstructor1 { - @Autowired constructor(n: Int) - constructor(s: String) -} - -@Component -open class AutowiredConstructor2 @Autowired constructor(n: Int) { - constructor(s: String): this(0) -} - -// Reported - -@Component -open class AmbigiousConstructor1 { - constructor(n: Int) - constructor(s: String) -} - -@Component -open class AmbigiousConstructor2(n: Int) { - constructor(s: String): this(0) -} \ No newline at end of file diff --git a/ultimate/testData/inspections/spring/autowiring/inspectionData/expected.xml.181 b/ultimate/testData/inspections/spring/autowiring/inspectionData/expected.xml.181 deleted file mode 100644 index 968b0f33f60..00000000000 --- a/ultimate/testData/inspections/spring/autowiring/inspectionData/expected.xml.181 +++ /dev/null @@ -1,97 +0,0 @@ - - - ambiguousConstructors.kt - 52 - - Autowiring for Bean Class (Kotlin) - Class doesn't contain matching constructor for autowiring - - - ambiguousConstructors.kt - 58 - - Autowiring for Bean Class (Kotlin) - Class doesn't contain matching constructor for autowiring - - - - multipleAutowiredConstructors.kt - 30 - - Autowiring for Bean Class (Kotlin) - Only one constructor can have @Autowired annotation - - - multipleAutowiredConstructors.kt - 31 - - Autowiring for Bean Class (Kotlin) - Only one constructor can have @Autowired annotation - - - multipleAutowiredConstructors.kt - 35 - - Autowiring for Bean Class (Kotlin) - Only one constructor can have @Autowired annotation - - - multipleAutowiredConstructors.kt - 36 - - Autowiring for Bean Class (Kotlin) - Only one constructor can have @Autowired annotation - - - - invalidAutowiredResource.kt - 24 - - Autowiring for Bean Class (Kotlin) - Could not autowire. Bean should be of 'invalidAutowiredResource.BarBean' type - - - invalidAutowiredResource.kt - 31 - - Autowiring for Bean Class (Kotlin) - Cannot resolve bean 'fooBeannn' - - - - invalidAutowiredQualifier.kt - 23 - - Autowiring for Bean Class (Kotlin) - Could not autowire. Qualified bean must be of 'BarBean' type. - - - invalidAutowiredQualifier.kt - 30 - - Autowiring for Bean Class (Kotlin) - Cannot find bean with qualifier 'fooBeannn' - - - invalidAutowiredQualifier.kt - 37 - - Autowiring for Bean Class (Kotlin) - Cannot find bean qualified with @Qualifier - - - - invalidAutowiredByType.kt - 23 - - Autowiring for Bean Class (Kotlin) - Could not autowire. No beans of 'String' type found. - - - invalidAutowiredByType.kt - 29 - - Autowiring for Bean Class (Kotlin) - <html><table><tr><td>Could not autowire. There is more than one bean of 'AbstractBarBean' type.</td></tr><tr><td><table><tr><td valign='top'>Beans:</td><td>abstractBarBean&nbsp;&nbsp; (invalidAutowiredByType.kt)<br>barBean1&nbsp;&nbsp; (invalidAutowiredByType.kt)<br>barBean2&nbsp;&nbsp; (invalidAutowiredByType.kt)<br></td></tr></table></td></tr></table></html> - - diff --git a/ultimate/testData/inspections/spring/autowiring/multipleAutowiredConstructors.kt.181 b/ultimate/testData/inspections/spring/autowiring/multipleAutowiredConstructors.kt.181 deleted file mode 100644 index ad2e2ec2970..00000000000 --- a/ultimate/testData/inspections/spring/autowiring/multipleAutowiredConstructors.kt.181 +++ /dev/null @@ -1,37 +0,0 @@ - -// WITH_RUNTIME - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.stereotype.Component -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@Configuration -@ComponentScan -open class MultipleAutowiredConstructors - -// Not reported if required == false - -@Component -open class NonRequiredAutowired1 { - @Autowired(required = false) constructor(n: Int) - @Autowired constructor(s: String) -} - -@Component -open class NonRequiredAutowired2 @Autowired(required = false) constructor(n: Int) { - @Autowired constructor(s: String): this(0) -} - -// Reported - -@Component -open class BothAutowired1 { - @Autowired constructor(n: Int) - @Autowired constructor(s: String) -} - -@Component -open class BothAutowired2 @Autowired constructor(n: Int) { - @Autowired constructor(s: String): this(0) -} \ No newline at end of file diff --git a/ultimate/testData/inspections/spring/componentScan/inspectionData/expected.xml.181 b/ultimate/testData/inspections/spring/componentScan/inspectionData/expected.xml.181 deleted file mode 100644 index 5fb321c5795..00000000000 --- a/ultimate/testData/inspections/spring/componentScan/inspectionData/expected.xml.181 +++ /dev/null @@ -1,18 +0,0 @@ - - - test.kt - 14 - light_idea_test_case - - @ComponentScan setup (Kotlin) - Cannot resolve package bar - - - test.kt - 18 - light_idea_test_case - - @ComponentScan setup (Kotlin) - Cannot resolve package bar - - diff --git a/ultimate/testData/inspections/spring/componentScan/inspectionData/inspections.test.181 b/ultimate/testData/inspections/spring/componentScan/inspectionData/inspections.test.181 deleted file mode 100644 index bfa89cff534..00000000000 --- a/ultimate/testData/inspections/spring/componentScan/inspectionData/inspections.test.181 +++ /dev/null @@ -1,3 +0,0 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.spring.inspections.KotlinSpringComponentScanInspection -// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension -// CONFIGURE_SPRING_FILE_SET \ No newline at end of file diff --git a/ultimate/testData/inspections/spring/unconfiguredFacet/inspectionData/inspections.test.181 b/ultimate/testData/inspections/spring/unconfiguredFacet/inspectionData/inspections.test.181 deleted file mode 100644 index fb5dcfc78a1..00000000000 --- a/ultimate/testData/inspections/spring/unconfiguredFacet/inspectionData/inspections.test.181 +++ /dev/null @@ -1,3 +0,0 @@ -// INSPECTION_CLASS: org.jetbrains.kotlin.idea.spring.inspections.KotlinSpringFacetCodeInspection -// FIXTURE_CLASS: org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension -// FORBID_SPRING_FILE_SET_AUTOCONFIGURE \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.181 deleted file mode 100644 index 93f087290e8..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.181 +++ /dev/null @@ -1,20 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - @Autowired lateinit var bean: BarBean -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.after.181 deleted file mode 100644 index fe8afb61da7..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt.after.181 +++ /dev/null @@ -1,22 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - @Autowired lateinit var bean: BarBean - @Autowired - lateinit var barBean: BarBean -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.181 deleted file mode 100644 index 32f4afb1c4a..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.181 +++ /dev/null @@ -1,12 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired - -open class FooBean { - @Autowired lateinit var bean: BarBean -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.after.181 deleted file mode 100644 index 3f100a79312..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt.after.181 +++ /dev/null @@ -1,14 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired - -open class FooBean { - @Autowired lateinit var bean: BarBean - @Autowired - lateinit var barBean: BarBean -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.181 deleted file mode 100644 index 1c7283b72a1..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.181 +++ /dev/null @@ -1,19 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean, application -package a - -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.after.181 deleted file mode 100644 index 22e151b619d..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt.after.181 +++ /dev/null @@ -1,24 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean, application -package a - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - @Autowired - lateinit var application: Application - @Autowired - lateinit var barBean: BarBean - -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.181 deleted file mode 100644 index 118d34cb644..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.181 +++ /dev/null @@ -1,10 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean, fooBean -package a - -open class FooBean { - -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.after.181 deleted file mode 100644 index d1cd8b3093f..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt.after.181 +++ /dev/null @@ -1,16 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean, fooBean -package a - -import org.springframework.beans.factory.annotation.Autowired - -open class FooBean { - @Autowired - lateinit var barBean: BarBean - @Autowired - lateinit var fooBean: FooBean - -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.181 deleted file mode 100644 index b125aafd29e..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.181 +++ /dev/null @@ -1,22 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - -} - -@Component -open class BarBean - -@Component -open class BarBeanChild : BarBean() - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.after.181 deleted file mode 100644 index b5e5a1e1cca..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt.after.181 +++ /dev/null @@ -1,27 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.beans.factory.annotation.Qualifier -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - @Qualifier("barBean") - @Autowired - lateinit var barBean: BarBean - -} - -@Component -open class BarBean - -@Component -open class BarBeanChild : BarBean() - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.181 deleted file mode 100644 index 019b66ffe47..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.181 +++ /dev/null @@ -1,12 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { - -} - -open class BarBean - -open class BarBeanChild : BarBean() \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.after.181 deleted file mode 100644 index 1d012fac10e..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.after.181 +++ /dev/null @@ -1,18 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.beans.factory.annotation.Qualifier - -open class FooBean { - @Qualifier("barBean") - @Autowired - lateinit var barBean: BarBean - -} - -open class BarBean - -open class BarBeanChild : BarBean() \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.181 deleted file mode 100644 index bb9f29f7ab7..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.181 +++ /dev/null @@ -1,19 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.after.181 deleted file mode 100644 index 813a72ef6aa..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.after.181 +++ /dev/null @@ -1,22 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.stereotype.Component -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.ComponentScan - -@Component -open class FooBean { - @Autowired - lateinit var barBean: BarBean - -} - -@Component -open class BarBean - -@Configuration -@ComponentScan -open class Application \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.181 deleted file mode 100644 index 9c5cffa3409..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.181 +++ /dev/null @@ -1,10 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { - -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.after.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.after.181 deleted file mode 100644 index e6220fd02aa..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt.after.181 +++ /dev/null @@ -1,14 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction -// CONFIG_FILE: spring-config.xml -// CHOOSE_BEAN: barBean -package a - -import org.springframework.beans.factory.annotation.Autowired - -open class FooBean { - @Autowired - lateinit var barBean: BarBean - -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/autowiredDependencies/spring-config.xml.181 b/ultimate/testData/spring/core/generate/autowiredDependencies/spring-config.xml.181 deleted file mode 100644 index 6db75fdfa41..00000000000 --- a/ultimate/testData/spring/core/generate/autowiredDependencies/spring-config.xml.181 +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.181 deleted file mode 100644 index 41d844ac510..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.181 +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.after.181 deleted file mode 100644 index a9588081399..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean-config.xml.after.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt.after.181 deleted file mode 100644 index 6e64bc62e45..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt.after.181 +++ /dev/null @@ -1,13 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: factoryMethod-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class FooFactoryBean { - open fun create(barBean: BarBean) = FooBean() -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt_disabled.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt_disabled.181 deleted file mode 100644 index d4de14b8507..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryBean.kt_disabled.181 +++ /dev/null @@ -1,13 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: factoryMethod-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class FooFactoryBean { - open fun create() = FooBean() -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.181 deleted file mode 100644 index 653e6d0790f..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.after.181 deleted file mode 100644 index f78da8da8dc..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod-config.xml.after.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt.after.181 deleted file mode 100644 index 424ccd0757c..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt.after.181 +++ /dev/null @@ -1,14 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: factoryMethod-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { - companion object { - @JvmStatic fun create(barBean: BarBean): FooBean { - return null - } - } -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt_disabled.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt_disabled.181 deleted file mode 100644 index d512fff0724..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/factoryMethod.kt_disabled.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: factoryMethod-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.181 deleted file mode 100644 index e5ee5310463..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.after.181 deleted file mode 100644 index 81dc2809199..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor-config.xml.after.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.181 deleted file mode 100644 index fa4d9589960..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: firstConstructor-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.after.181 deleted file mode 100644 index 196006c3d69..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt.after.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: firstConstructor-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean(barBean: BarBean) { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.181 deleted file mode 100644 index 0724386c606..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.after.181 deleted file mode 100644 index 113837a2c84..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam-config.xml.after.181 +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.181 deleted file mode 100644 index 9fb12bd6f6d..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.181 +++ /dev/null @@ -1,11 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: primaryConstructorAddParam-config.xml -// CHOOSE_BEAN: bazBean -package a - -open class FooBean(barBean: BarBean) { -} - -open class BarBean - -open class BazBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.after.181 deleted file mode 100644 index f9aaddf3cf9..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt.after.181 +++ /dev/null @@ -1,11 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: primaryConstructorAddParam-config.xml -// CHOOSE_BEAN: bazBean -package a - -open class FooBean(barBean: BarBean, bazBean: BazBean) { -} - -open class BarBean - -open class BazBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.181 deleted file mode 100644 index e5ee5310463..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.after.181 deleted file mode 100644 index 947f453b6ab..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property-config.xml.after.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.181 deleted file mode 100644 index 7e114b10eae..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$LateinitProperty -// CONFIG_FILE: property-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.after.181 deleted file mode 100644 index 8e09487f54a..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt.after.181 +++ /dev/null @@ -1,10 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$LateinitProperty -// CONFIG_FILE: property-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { - lateinit var barBean: BarBean -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.181 deleted file mode 100644 index e5ee5310463..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.after.181 deleted file mode 100644 index e5ee5310463..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor-config.xml.after.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt.after.181 deleted file mode 100644 index 6be454dac43..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt.after.181 +++ /dev/null @@ -1,10 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: secondaryConstructor-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean(n: Int) { - -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt_disabled.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt_disabled.181 deleted file mode 100644 index a3cffb2bb2f..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructor.kt_disabled.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: secondaryConstructor-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean(n: Int) { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.181 deleted file mode 100644 index 0724386c606..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.after.181 deleted file mode 100644 index 113837a2c84..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam-config.xml.after.181 +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.181 deleted file mode 100644 index a8458799c2e..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.181 +++ /dev/null @@ -1,12 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: secondaryConstructorAddParam-config.xml -// CHOOSE_BEAN: bazBean -package a - -open class FooBean(n: Int) { - constructor(barBean: BarBean): this(1) -} - -open class BarBean - -open class BazBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.after.181 deleted file mode 100644 index 855d816f3a8..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt.after.181 +++ /dev/null @@ -1,12 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Constructor -// CONFIG_FILE: secondaryConstructorAddParam-config.xml -// CHOOSE_BEAN: bazBean -package a - -open class FooBean(n: Int) { - constructor(barBean: BarBean, bazBean: BazBean): this(1) -} - -open class BarBean - -open class BazBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.181 deleted file mode 100644 index e5ee5310463..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.after.181 deleted file mode 100644 index 947f453b6ab..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter-config.xml.after.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.181 deleted file mode 100644 index 0ad550ed207..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.181 +++ /dev/null @@ -1,9 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Setter -// CONFIG_FILE: setter-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.after.181 b/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.after.181 deleted file mode 100644 index c92d93dad20..00000000000 --- a/ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt.after.181 +++ /dev/null @@ -1,10 +0,0 @@ -// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinSpringBeanXmlDependencyAction$Setter -// CONFIG_FILE: setter-config.xml -// CHOOSE_BEAN: barBean -package a - -open class FooBean { - fun setBarBean(barBean: BarBean) {} -} - -open class BarBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/Bean.kt.181 b/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/Bean.kt.181 deleted file mode 100644 index 5c592abd2e1..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/Bean.kt.181 +++ /dev/null @@ -1,17 +0,0 @@ -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.context.annotation.Bean - -class Bean { - @Autowired - fun setProp1(autowiredProp: String) { - } - - @Autowired - lateinit var prop2: String - - @Bean(name = "myBean") - @Autowired - fun myBean(collab: String): String { - return "aaa" + collab - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test.181 b/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test.181 deleted file mode 100644 index 852652c55db..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test.181 +++ /dev/null @@ -1,9 +0,0 @@ -{ - withRuntime: "true", - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to autowired candidates", - naming: "generic", - targets: ["autowiredProp", "collab", "prop2"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/config.xml.181 b/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/config.xml.181 deleted file mode 100644 index 6b1adf258e2..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredBeanCandidates/config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredConstructor/Bean.kt.181 b/ultimate/testData/spring/core/gutter/autowiredConstructor/Bean.kt.181 deleted file mode 100644 index dca9968282c..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredConstructor/Bean.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -import org.springframework.beans.factory.annotation.Autowired - -class Bean(val prop: String) \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredConstructor/autowiredConstructor.test.181 b/ultimate/testData/spring/core/gutter/autowiredConstructor/autowiredConstructor.test.181 deleted file mode 100644 index 3bc9da70884..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredConstructor/autowiredConstructor.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "SpringBeanMethod", - tooltip: "Navigate to the spring bean", - naming: "bean", - targets: ["bean"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredConstructor/config.xml.181 b/ultimate/testData/spring/core/gutter/autowiredConstructor/config.xml.181 deleted file mode 100644 index e46abbb5d0f..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredConstructor/config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredProperty/Bean.kt.181 b/ultimate/testData/spring/core/gutter/autowiredProperty/Bean.kt.181 deleted file mode 100644 index 24c26cf48f0..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredProperty/Bean.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -import org.springframework.beans.factory.annotation.Autowired - -class Bean { - @Autowired - lateinit var prop: String -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredProperty/autowiredProperty.test.181 b/ultimate/testData/spring/core/gutter/autowiredProperty/autowiredProperty.test.181 deleted file mode 100644 index 2eb4925bc67..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredProperty/autowiredProperty.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to the autowired dependencies", - naming: "bean", - targets: ["stringBean1", "stringBean2"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredProperty/config.xml.181 b/ultimate/testData/spring/core/gutter/autowiredProperty/config.xml.181 deleted file mode 100644 index 6b1adf258e2..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredProperty/config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredSetter/Bean.kt.181 b/ultimate/testData/spring/core/gutter/autowiredSetter/Bean.kt.181 deleted file mode 100644 index 91f56438829..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredSetter/Bean.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -import org.springframework.beans.factory.annotation.Autowired - -class Bean { - @Autowired - fun setProp(autowiredProp: String) { } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredSetter/autowiredSetter.test.181 b/ultimate/testData/spring/core/gutter/autowiredSetter/autowiredSetter.test.181 deleted file mode 100644 index 5b238c5a6f5..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredSetter/autowiredSetter.test.181 +++ /dev/null @@ -1,9 +0,0 @@ -{ - withRuntime: "true", - "springConfig": ["config.xml"], - file: "Bean.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to the autowired dependencies", - naming: "bean", - targets: ["stringBean1", "stringBean2"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/autowiredSetter/config.xml.181 b/ultimate/testData/spring/core/gutter/autowiredSetter/config.xml.181 deleted file mode 100644 index 6b1adf258e2..00000000000 --- a/ultimate/testData/spring/core/gutter/autowiredSetter/config.xml.181 +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutter/Bean.kt.181 b/ultimate/testData/spring/core/gutter/classGutter/Bean.kt.181 deleted file mode 100644 index f6742c966ac..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutter/Bean.kt.181 +++ /dev/null @@ -1,7 +0,0 @@ -class Bean { - var prop1: String - - fun setProp2(value: String) { - - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutter/classGutter.test.181 b/ultimate/testData/spring/core/gutter/classGutter/classGutter.test.181 deleted file mode 100644 index c2dc8796def..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutter/classGutter.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "SpringBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "bean", - targets: ["bean"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutter/config.xml.181 b/ultimate/testData/spring/core/gutter/classGutter/config.xml.181 deleted file mode 100644 index 1d2f57bb2f7..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutter/config.xml.181 +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBean.kt.181 b/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBean.kt.181 deleted file mode 100644 index d83435d3da0..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBean.kt.181 +++ /dev/null @@ -1 +0,0 @@ -abstract class AbstractBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor.kt.181 b/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor.kt.181 deleted file mode 100644 index 9d548c208cb..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor.kt.181 +++ /dev/null @@ -1 +0,0 @@ -class AbstractBeanInheritor : AbstractBean() \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor2.kt.181 b/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor2.kt.181 deleted file mode 100644 index 651d247ebb4..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/AbstractBeanInheritor2.kt.181 +++ /dev/null @@ -1 +0,0 @@ -class AbstractBeanInheritor2 : AbstractBean() \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test.181 b/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test.181 deleted file mode 100644 index cfb23608280..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["inheritors.xml"], - file: "AbstractBean.kt", - icon: "SpringBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "bean", - targets: ["inheritor", "inheritor2"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/inheritors.xml.181 b/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/inheritors.xml.181 deleted file mode 100644 index 5524c5871b2..00000000000 --- a/ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/inheritors.xml.181 +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScan/Bean.kt.181 b/ultimate/testData/spring/core/gutter/componentScan/Bean.kt.181 deleted file mode 100644 index 1ea35e9420f..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScan/Bean.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -package test - -class Bean(val n: Int) \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScan/ComponentScan.kt.181 b/ultimate/testData/spring/core/gutter/componentScan/ComponentScan.kt.181 deleted file mode 100644 index 771f40ca1a3..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScan/ComponentScan.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@ComponentScan("beans") -@Configuration -open class ComponentScan \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScan/beans/MyController.kt.181 b/ultimate/testData/spring/core/gutter/componentScan/beans/MyController.kt.181 deleted file mode 100644 index 72f3aca40d1..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScan/beans/MyController.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -package beans - -import org.springframework.stereotype.Controller - -@Controller(value = "customControllerName") -class MyController \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScan/beans/ResourceGutter.kt.181 b/ultimate/testData/spring/core/gutter/componentScan/beans/ResourceGutter.kt.181 deleted file mode 100644 index 41d53870600..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScan/beans/ResourceGutter.kt.181 +++ /dev/null @@ -1,18 +0,0 @@ -package beans - -import org.springframework.stereotype.Component -import javax.annotation.Resource -import test.Bean - -@Component -class ResourceGutter { - @Resource(name = "bean1") - fun setResource(bean: Bean) { - - } - - @Resource - fun setUnknown(booo: Boolean) { - - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScan/componentScan.test.181 b/ultimate/testData/spring/core/gutter/componentScan/componentScan.test.181 deleted file mode 100644 index 5d7320357d1..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScan/componentScan.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["ComponentScan.kt"], - file: "ComponentScan.kt", - icon: "SpringScan", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "bean", - targets: ["resourceGutter", "customControllerName"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/Config.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/Config.kt.181 deleted file mode 100644 index 457624b9d12..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/Config.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import foo.FooBean -import bar.BarBean - -@ComponentScan(basePackageClasses = arrayOf(FooBean::class, BarBean::class)) -@Configuration -open class Config \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/bar/beans.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/bar/beans.kt.181 deleted file mode 100644 index ad7370789e4..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/bar/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package bar - -import org.springframework.stereotype.Component - -@Component -class BarBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test.181 deleted file mode 100644 index 8e869e56636..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["Config.kt"], - file: "foo/beans.kt", - icon: "SpringJavaBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "generic", - targets: ["Config"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/foo/beans.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/foo/beans.kt.181 deleted file mode 100644 index 6c382177861..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/foo/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package foo - -import org.springframework.stereotype.Component - -@Component -class FooBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/Config.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/Config.kt.181 deleted file mode 100644 index 4c978113e94..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/Config.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration - -@ComponentScan(basePackages = arrayOf("foo", "bar")) -@Configuration -open class Config \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/bar/beans.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/bar/beans.kt.181 deleted file mode 100644 index ad7370789e4..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/bar/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package bar - -import org.springframework.stereotype.Component - -@Component -class BarBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/componentScanWithBasePackages.test.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/componentScanWithBasePackages.test.181 deleted file mode 100644 index 8e869e56636..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/componentScanWithBasePackages.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["Config.kt"], - file: "foo/beans.kt", - icon: "SpringJavaBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "generic", - targets: ["Config"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/foo/beans.kt.181 b/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/foo/beans.kt.181 deleted file mode 100644 index 6c382177861..00000000000 --- a/ultimate/testData/spring/core/gutter/componentScanWithBasePackages/foo/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package foo - -import org.springframework.stereotype.Component - -@Component -class FooBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/ContextBeanInjectionPoints.kt.181 b/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/ContextBeanInjectionPoints.kt.181 deleted file mode 100644 index 8c5cd45343a..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/ContextBeanInjectionPoints.kt.181 +++ /dev/null @@ -1,21 +0,0 @@ -import pkg.* -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Bean - -@Configuration -class ContextBeanInjectionPoints { - @Bean - fun foo(): Foo { - return Foo() - } - - @Bean - fun foo2(): Foo { - return Foo() - } - - @Bean - fun bar(f: Foo): Bar { - return Bar(f) - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/FooBar.kt.181 b/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/FooBar.kt.181 deleted file mode 100644 index ad3efc70282..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/FooBar.kt.181 +++ /dev/null @@ -1,5 +0,0 @@ -package pkg - -class Foo - -class Bar(foo: Foo) \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/contextBeanInjectionPoints.test.181 b/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/contextBeanInjectionPoints.test.181 deleted file mode 100644 index bfe9b32911e..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/contextBeanInjectionPoints.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: [], - file: "ContextBeanInjectionPoints.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to the autowired dependencies", - naming: "generic", - targets: ["foo()", "foo2()"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/ContextBeanWithQualifierInjectionPoints.kt.181 b/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/ContextBeanWithQualifierInjectionPoints.kt.181 deleted file mode 100644 index 63c8c0accd8..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/ContextBeanWithQualifierInjectionPoints.kt.181 +++ /dev/null @@ -1,22 +0,0 @@ -import pkg.* -import org.springframework.context.annotation.Configuration -import org.springframework.context.annotation.Bean -import org.springframework.beans.factory.annotation.Qualifier - -@Configuration -class ContextBeanWithQualifierInjectionPoints { - @Bean - fun foo(): Foo { - return Foo() - } - - @Bean - fun foo2(): Foo { - return Foo() - } - - @Bean - fun bar(@Qualifier("foo2") f: Foo): Bar { - return Bar(f) - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test.181 b/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test.181 deleted file mode 100644 index d69b4123e07..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test.181 +++ /dev/null @@ -1,9 +0,0 @@ -{ - withRuntime: "true", - springConfig: ["ContextBeanWithQualifierInjectionPoints.kt"], - file: "ContextBeanWithQualifierInjectionPoints.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to the autowired dependencies", - naming: "generic", - targets: ["foo2()"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/pkg/FooBar.kt.181 b/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/pkg/FooBar.kt.181 deleted file mode 100644 index ad3efc70282..00000000000 --- a/ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/pkg/FooBar.kt.181 +++ /dev/null @@ -1,5 +0,0 @@ -package pkg - -class Foo - -class Bar(foo: Foo) \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/importConfigClasses/Config.kt.181 b/ultimate/testData/spring/core/gutter/importConfigClasses/Config.kt.181 deleted file mode 100644 index 52d9d188234..00000000000 --- a/ultimate/testData/spring/core/gutter/importConfigClasses/Config.kt.181 +++ /dev/null @@ -1,7 +0,0 @@ -import org.springframework.context.annotation.Import -import org.springframework.context.annotation.Configuration -import baz.Config2 - -@Configuration -@Import(Config2::class) -open class Config \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/importConfigClasses/bar/beans.kt.181 b/ultimate/testData/spring/core/gutter/importConfigClasses/bar/beans.kt.181 deleted file mode 100644 index ad7370789e4..00000000000 --- a/ultimate/testData/spring/core/gutter/importConfigClasses/bar/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package bar - -import org.springframework.stereotype.Component - -@Component -class BarBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/importConfigClasses/baz/Config2.kt.181 b/ultimate/testData/spring/core/gutter/importConfigClasses/baz/Config2.kt.181 deleted file mode 100644 index c54448f131f..00000000000 --- a/ultimate/testData/spring/core/gutter/importConfigClasses/baz/Config2.kt.181 +++ /dev/null @@ -1,10 +0,0 @@ -package baz - -import org.springframework.context.annotation.ComponentScan -import org.springframework.context.annotation.Configuration -import foo.FooBean -import bar.BarBean - -@ComponentScan(basePackageClasses = arrayOf(FooBean::class, BarBean::class)) -@Configuration -open class Config2 \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/importConfigClasses/foo/beans.kt.181 b/ultimate/testData/spring/core/gutter/importConfigClasses/foo/beans.kt.181 deleted file mode 100644 index 6c382177861..00000000000 --- a/ultimate/testData/spring/core/gutter/importConfigClasses/foo/beans.kt.181 +++ /dev/null @@ -1,8 +0,0 @@ -package foo - -import org.springframework.stereotype.Component - -@Component -class FooBean { - -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/importConfigClasses/importConfigClasses.test.181 b/ultimate/testData/spring/core/gutter/importConfigClasses/importConfigClasses.test.181 deleted file mode 100644 index 20aa584c26a..00000000000 --- a/ultimate/testData/spring/core/gutter/importConfigClasses/importConfigClasses.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["Config.kt"], - file: "foo/beans.kt", - icon: "SpringJavaBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "generic", - targets: [] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/innerBean/InnerBean.kt.181 b/ultimate/testData/spring/core/gutter/innerBean/InnerBean.kt.181 deleted file mode 100644 index bcec3542de6..00000000000 --- a/ultimate/testData/spring/core/gutter/innerBean/InnerBean.kt.181 +++ /dev/null @@ -1 +0,0 @@ -class InnerBean \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/innerBean/innerBean.test.181 b/ultimate/testData/spring/core/gutter/innerBean/innerBean.test.181 deleted file mode 100644 index c122f30c4e0..00000000000 --- a/ultimate/testData/spring/core/gutter/innerBean/innerBean.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["innerBeanGutter.xml"], - file: "InnerBean.kt", - icon: "SpringBean", - tooltip: "Navigate to the spring bean declaration(s)", - naming: "bean", - targets: ["InnerBean"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/innerBean/innerBeanGutter.xml.181 b/ultimate/testData/spring/core/gutter/innerBean/innerBeanGutter.xml.181 deleted file mode 100644 index bd72ca12a9a..00000000000 --- a/ultimate/testData/spring/core/gutter/innerBean/innerBeanGutter.xml.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/Bean.kt.181 b/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/Bean.kt.181 deleted file mode 100644 index a84e58bc83e..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/Bean.kt.181 +++ /dev/null @@ -1,4 +0,0 @@ -class Bean { - fun myInit() { - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/config.xml.181 b/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/config.xml.181 deleted file mode 100644 index 920414fc636..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/config.xml.181 +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test.181 b/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test.181 deleted file mode 100644 index beeaa2a869e..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "SpringBeanMethod", - tooltip: "Navigate to the spring bean init method declaration", - naming: "generic", - targets: ["default-init-method"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeFactory/Bean.kt.181 b/ultimate/testData/spring/core/gutter/methodTypeFactory/Bean.kt.181 deleted file mode 100644 index d09e49801c1..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeFactory/Bean.kt.181 +++ /dev/null @@ -1,6 +0,0 @@ -class Bean { - companion object { - @JvmStatic - fun myFactory() = "TEST" - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeFactory/config.xml.181 b/ultimate/testData/spring/core/gutter/methodTypeFactory/config.xml.181 deleted file mode 100644 index 878e876f483..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeFactory/config.xml.181 +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeFactory/methodTypeFactory.test.181 b/ultimate/testData/spring/core/gutter/methodTypeFactory/methodTypeFactory.test.181 deleted file mode 100644 index 9f9a6ec3aef..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeFactory/methodTypeFactory.test.181 +++ /dev/null @@ -1,9 +0,0 @@ -{ - withRuntime: "true", - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "FactoryMethodBean", - tooltip: "Navigate to the spring bean factory method declaration", - naming: "generic", - targets: ["factory-method"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/Bean.kt.181 b/ultimate/testData/spring/core/gutter/methodTypeInitMethod/Bean.kt.181 deleted file mode 100644 index a84e58bc83e..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/Bean.kt.181 +++ /dev/null @@ -1,4 +0,0 @@ -class Bean { - fun myInit() { - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/config.xml.181 b/ultimate/testData/spring/core/gutter/methodTypeInitMethod/config.xml.181 deleted file mode 100644 index 1026aca4992..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/config.xml.181 +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/methodTypeInitMethod.test.181 b/ultimate/testData/spring/core/gutter/methodTypeInitMethod/methodTypeInitMethod.test.181 deleted file mode 100644 index 85648d80949..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeInitMethod/methodTypeInitMethod.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "SpringBeanMethod", - tooltip: "Navigate to the spring bean init method declaration", - naming: "generic", - targets: ["init-method"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeMultiple/Bean.kt.181 b/ultimate/testData/spring/core/gutter/methodTypeMultiple/Bean.kt.181 deleted file mode 100644 index 5035fc33b01..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeMultiple/Bean.kt.181 +++ /dev/null @@ -1,4 +0,0 @@ -class Bean { - fun myFun() { - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeMultiple/config.xml.181 b/ultimate/testData/spring/core/gutter/methodTypeMultiple/config.xml.181 deleted file mode 100644 index 0b5fb6860a9..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeMultiple/config.xml.181 +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/methodTypeMultiple/methodTypeMultiple.test.181 b/ultimate/testData/spring/core/gutter/methodTypeMultiple/methodTypeMultiple.test.181 deleted file mode 100644 index 0f5d8de9478..00000000000 --- a/ultimate/testData/spring/core/gutter/methodTypeMultiple/methodTypeMultiple.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["config.xml"], - file: "Bean.kt", - icon: "SpringBeanMethod", - tooltip: "Navigate to the spring bean method declarations", - naming: "generic", - targets: ["destroy-method", "init-method"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/BeanWithProperties.kt.181 b/ultimate/testData/spring/core/gutter/propertyGutterForProperty/BeanWithProperties.kt.181 deleted file mode 100644 index 5c731ed7735..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/BeanWithProperties.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -class BeanWithProperties { - lateinit var prop: String -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutter.xml.181 b/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutter.xml.181 deleted file mode 100644 index 4e30857e85d..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutter.xml.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutterForProperty.test.181 b/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutterForProperty.test.181 deleted file mode 100644 index e37e457a80b..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutterForProperty.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["propertyGutter.xml"], - file: "BeanWithProperties.kt", - icon: "SpringProperty", - tooltip: "Navigate to the spring bean property", - naming: "property", - targets: ["prop", "prop"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/BeanWithProperties.kt.181 b/ultimate/testData/spring/core/gutter/propertyGutterForSetter/BeanWithProperties.kt.181 deleted file mode 100644 index 405344a7410..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/BeanWithProperties.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -class BeanWithProperties { - fun setProp(prop: String) { } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutter.xml.181 b/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutter.xml.181 deleted file mode 100644 index 4e30857e85d..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutter.xml.181 +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutterForSetter.test.181 b/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutterForSetter.test.181 deleted file mode 100644 index e37e457a80b..00000000000 --- a/ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutterForSetter.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["propertyGutter.xml"], - file: "BeanWithProperties.kt", - icon: "SpringProperty", - tooltip: "Navigate to the spring bean property", - naming: "property", - targets: ["prop", "prop"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/resourceGutter/Bean.kt.181 b/ultimate/testData/spring/core/gutter/resourceGutter/Bean.kt.181 deleted file mode 100644 index 1ea35e9420f..00000000000 --- a/ultimate/testData/spring/core/gutter/resourceGutter/Bean.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -package test - -class Bean(val n: Int) \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/resourceGutter/Resource.kt.181 b/ultimate/testData/spring/core/gutter/resourceGutter/Resource.kt.181 deleted file mode 100644 index 95d9607c807..00000000000 --- a/ultimate/testData/spring/core/gutter/resourceGutter/Resource.kt.181 +++ /dev/null @@ -1,3 +0,0 @@ -package javax.annotation - -annotation class Resource(val name: String = "") \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/resourceGutter/beans/ResourceGutter.kt.181 b/ultimate/testData/spring/core/gutter/resourceGutter/beans/ResourceGutter.kt.181 deleted file mode 100644 index ca9d4e04e61..00000000000 --- a/ultimate/testData/spring/core/gutter/resourceGutter/beans/ResourceGutter.kt.181 +++ /dev/null @@ -1,13 +0,0 @@ -package beans - -import org.springframework.stereotype.Component -import javax.annotation.Resource -import test.Bean - -@Component -class ResourceGutter { - @Resource(name = "bean1") - fun setResource(bean: Bean) { - - } -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.test.181 b/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.test.181 deleted file mode 100644 index c08073d1102..00000000000 --- a/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.test.181 +++ /dev/null @@ -1,8 +0,0 @@ -{ - springConfig: ["resourceGutter.xml"], - file: "beans/ResourceGutter.kt", - icon: "ShowAutowiredDependencies", - tooltip: "Navigate to the autowired dependencies", - naming: "bean", - targets: ["bean1"] -} \ No newline at end of file diff --git a/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.xml.181 b/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.xml.181 deleted file mode 100644 index 097174ed0a3..00000000000 --- a/ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.xml.181 +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/AbstractGenerateSpringDependencyActionTest.kt.181 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/AbstractGenerateSpringDependencyActionTest.kt.181 deleted file mode 100644 index f8132ed8685..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/AbstractGenerateSpringDependencyActionTest.kt.181 +++ /dev/null @@ -1,77 +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.spring.tests.generate - -import com.intellij.openapi.util.io.FileUtil -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.util.PathUtil -import junit.framework.TestCase -import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest -import org.jetbrains.kotlin.idea.spring.generate.beanFilter -import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension -import org.jetbrains.kotlin.idea.test.TestFixtureExtension -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File - -abstract class AbstractGenerateSpringDependencyActionTest : AbstractCodeInsightActionTest() { - private var configFile: VirtualFile? = null - private var configFilePath: String? = null - - override fun setUp() { - super.setUp() - TestFixtureExtension.loadFixture(myModule) - } - - override fun configure(mainFilePath: String, mainFileText: String) { - val packagePath = mainFileText.lines().let { it.find { it.trim().startsWith("package") } } - ?.removePrefix("package") - ?.trim()?.replace(".", "/") ?: "" - val mainFilePathInProject = packagePath + "/" + File(mainFilePath).name - val mainFileVirtualFile = myFixture.copyFileToProject(mainFilePath, mainFilePathInProject) - - configFilePath = InTextDirectivesUtils.findStringWithPrefixes(mainFileText, "// CONFIG_FILE: ")?.let { - "${PathUtil.getParentPath(mainFilePath)}/$it" - } ?: mainFilePathInProject - - val springFileSet = TestFixtureExtension - .getFixture()!! - .configureFileSet(myFixture, listOf(configFilePath!!)) - if (configFilePath != mainFilePathInProject && PathUtil.getFileName(configFilePath!!) != "spring-config.xml") { - configFile = springFileSet.files.single().file!! - } - - val beansToChoose = InTextDirectivesUtils.findListWithPrefixes(mainFileText, "// CHOOSE_BEAN: ") - project.beanFilter = { it.name in beansToChoose } - - myFixture.configureFromExistingVirtualFile(mainFileVirtualFile) - } - - override fun checkExtra() { - configFile?.let { - myFixture.openFileInEditor(it) - val afterFile = File("$configFilePath.after") - TestCase.assertTrue(afterFile.exists()) - myFixture.checkResult(FileUtil.loadFile(afterFile, true)) - } - } - - override fun tearDown() { - configFile = null - TestFixtureExtension.unloadFixture() - super.tearDown() - } -} \ No newline at end of file diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/GenerateSpringDependencyActionTestGenerated.java.181 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/GenerateSpringDependencyActionTestGenerated.java.181 deleted file mode 100644 index 3627fb85ef3..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/generate/GenerateSpringDependencyActionTestGenerated.java.181 +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2000-2018 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.spring.tests.generate; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("ultimate/testData/spring/core/generate") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class GenerateSpringDependencyActionTestGenerated extends AbstractGenerateSpringDependencyActionTest { - public void testAllFilesPresentInGenerate() throws Exception { - KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("ultimate/testData/spring/core/generate"), Pattern.compile("^([\\w]+)\\.kt$"), TargetBackend.ANY); - } - - @TestMetadata("autowiredDependencies/duplicatingPropertyAnnotationConfig.kt") - public void testAutowiredDependencies_DuplicatingPropertyAnnotationConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyAnnotationConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/duplicatingPropertyXmlConfig.kt") - public void testAutowiredDependencies_DuplicatingPropertyXmlConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/duplicatingPropertyXmlConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/multiplePropertiesAnnotationConfig.kt") - public void testAutowiredDependencies_MultiplePropertiesAnnotationConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/multiplePropertiesXmlConfig.kt") - public void testAutowiredDependencies_MultiplePropertiesXmlConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesXmlConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/propertyWithQualifierAnnotationConfig.kt") - public void testAutowiredDependencies_PropertyWithQualifierAnnotationConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierAnnotationConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/propertyWithQualifierXmlConfig.kt") - public void testAutowiredDependencies_PropertyWithQualifierXmlConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/singlePropertyAnnotationConfig.kt") - public void testAutowiredDependencies_SinglePropertyAnnotationConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt"); - doTest(fileName); - } - - @TestMetadata("autowiredDependencies/singlePropertyXmlConfig.kt") - public void testAutowiredDependencies_SinglePropertyXmlConfig() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyXmlConfig.kt"); - doTest(fileName); - } - - @TestMetadata("beanDependenciesByXml/firstConstructor.kt") - public void testBeanDependenciesByXml_FirstConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/beanDependenciesByXml/firstConstructor.kt"); - doTest(fileName); - } - - @TestMetadata("beanDependenciesByXml/primaryConstructorAddParam.kt") - public void testBeanDependenciesByXml_PrimaryConstructorAddParam() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/beanDependenciesByXml/primaryConstructorAddParam.kt"); - doTest(fileName); - } - - @TestMetadata("beanDependenciesByXml/property.kt") - public void testBeanDependenciesByXml_Property() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/beanDependenciesByXml/property.kt"); - doTest(fileName); - } - - @TestMetadata("beanDependenciesByXml/secondaryConstructorAddParam.kt") - public void testBeanDependenciesByXml_SecondaryConstructorAddParam() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/beanDependenciesByXml/secondaryConstructorAddParam.kt"); - doTest(fileName); - } - - @TestMetadata("beanDependenciesByXml/setter.kt") - public void testBeanDependenciesByXml_Setter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/beanDependenciesByXml/setter.kt"); - doTest(fileName); - } -} diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/AbstractSpringClassAnnotatorTest.kt.181 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/AbstractSpringClassAnnotatorTest.kt.181 deleted file mode 100644 index 049e41e2a9f..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/AbstractSpringClassAnnotatorTest.kt.181 +++ /dev/null @@ -1,105 +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.spring.tests.gutter - -import com.google.gson.JsonArray -import com.google.gson.JsonObject -import com.google.gson.JsonParser -import com.intellij.codeInsight.daemon.LineMarkerProviders -import com.intellij.openapi.util.io.FileUtil -import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase -import icons.SpringApiIcons -import junit.framework.Assert -import junit.framework.AssertionFailedError -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.jsonUtils.getString -import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension -import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.PluginTestCaseBase -import org.jetbrains.kotlin.idea.test.TestFixtureExtension -import org.jetbrains.kotlin.test.KotlinTestUtils -import java.io.File - -abstract class AbstractSpringClassAnnotatorTest : KotlinLightCodeInsightFixtureTestCase() { - override fun getProjectDescriptor() = LightCodeInsightFixtureTestCase.JAVA_LATEST - - override fun setUp() { - super.setUp() - TestFixtureExtension.loadFixture(myModule) - } - - protected fun doTest(path: String) { - val configFilePath = "${KotlinTestUtils.getHomeDirectory()}/$path" - val configFile = File(configFilePath) - val testRoot = configFile.parentFile - - val config = JsonParser().parse(FileUtil.loadFile(configFile, true)) as JsonObject - - PluginTestCaseBase.addJdk(myFixture.projectDisposable, PluginTestCaseBase::mockJdk) - - val withRuntime = config["withRuntime"]?.asBoolean ?: false - if (withRuntime) { - ConfigLibraryUtil.configureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk()) - } - - try { - val springConfigFiles = (config["springConfig"] as JsonArray).map { it.asString } - myFixture.testDataPath = testRoot.absolutePath - for (file in testRoot.listFiles()) { - val name = file.name - if (file.isDirectory) myFixture.copyDirectoryToProject(name, name) else myFixture.configureByFile(name) - } - TestFixtureExtension.getFixture()!!.configureFileSet(myFixture, springConfigFiles) - - val fileName = config.getString("file") - val iconName = config.getString("icon") - val icon = SpringApiIcons.Gutter::class.java.getField(iconName)[null] - - val gutter = myFixture.findGutter(fileName) ?: throw AssertionError("no gutter for '$fileName'") - val gutterMark = gutter.let { - if (it.icon == icon) it - else myFixture.findGuttersAtCaret().let { gutters -> - gutters.firstOrNull() { it.icon == icon } - ?: throw AssertionFailedError("no $icon in gutters: ${gutters.map { it.icon }}") - } - } - - val tooltip = config.getString("tooltip") - Assert.assertEquals(tooltip, gutterMark.tooltipText) - - val naming = config.getString("naming") - val targets = (config["targets"] as JsonArray).map { it.asString } - when (naming) { - "bean" -> checkBeanGutterTargets(gutterMark, targets) - "property" -> checkBeanPropertyTargets(gutterMark, targets) - "generic" -> checkPsiElementGutterTargets(gutterMark, targets) - else -> error("Unexpected naming: $naming") - } - } - finally { - if (withRuntime) { - ConfigLibraryUtil.unConfigureKotlinRuntimeAndSdk(myModule, PluginTestCaseBase.mockJdk()) - } - } - } - - override fun tearDown() { - TestFixtureExtension.unloadFixture() - super.tearDown() - } -} diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/SpringClassAnnotatorTestGenerated.java.181 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/SpringClassAnnotatorTestGenerated.java.181 deleted file mode 100644 index 6c22ae6017c..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/SpringClassAnnotatorTestGenerated.java.181 +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2000-2018 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.spring.tests.gutter; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.TargetBackend; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("ultimate/testData/spring/core/gutter") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class SpringClassAnnotatorTestGenerated extends AbstractSpringClassAnnotatorTest { - public void testAllFilesPresentInGutter() throws Exception { - KotlinTestUtils.assertAllTestsPresentInSingleGeneratedClass(this.getClass(), new File("ultimate/testData/spring/core/gutter"), Pattern.compile("^(.+)\\.test$"), TargetBackend.ANY); - } - - @TestMetadata("autowiredBeanCandidates/autowiredBeanCandidates.test") - public void testAutowiredBeanCandidates_AutowiredBeanCandidates() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test"); - doTest(fileName); - } - - @TestMetadata("autowiredConstructor/autowiredConstructor.test") - public void testAutowiredConstructor_AutowiredConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredConstructor/autowiredConstructor.test"); - doTest(fileName); - } - - @TestMetadata("autowiredProperty/autowiredProperty.test") - public void testAutowiredProperty_AutowiredProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredProperty/autowiredProperty.test"); - doTest(fileName); - } - - @TestMetadata("autowiredSetter/autowiredSetter.test") - public void testAutowiredSetter_AutowiredSetter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredSetter/autowiredSetter.test"); - doTest(fileName); - } - - @TestMetadata("classGutter/classGutter.test") - public void testClassGutter_ClassGutter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/classGutter/classGutter.test"); - doTest(fileName); - } - - @TestMetadata("classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test") - public void testClassGutterAbstractShowMappedInheritors_ClassGutterAbstractShowMappedInheritors() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/classGutterAbstractShowMappedInheritors/classGutterAbstractShowMappedInheritors.test"); - doTest(fileName); - } - - @TestMetadata("componentScan/componentScan.test") - public void testComponentScan_ComponentScan() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/componentScan/componentScan.test"); - doTest(fileName); - } - - @TestMetadata("componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test") - public void testComponentScanWithBasePackageClasses_ComponentScanWithBasePackageClasses() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/componentScanWithBasePackageClasses/componentScanWithBasePackageClasses.test"); - doTest(fileName); - } - - @TestMetadata("componentScanWithBasePackages/componentScanWithBasePackages.test") - public void testComponentScanWithBasePackages_ComponentScanWithBasePackages() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/componentScanWithBasePackages/componentScanWithBasePackages.test"); - doTest(fileName); - } - - @TestMetadata("contextBeanInjectionPoints/contextBeanInjectionPoints.test") - public void testContextBeanInjectionPoints_ContextBeanInjectionPoints() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/contextBeanInjectionPoints/contextBeanInjectionPoints.test"); - doTest(fileName); - } - - @TestMetadata("contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test") - public void testContextBeanWithQualifierInjectionPoints_ContextBeanWithQualifierInjectionPoints() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/contextBeanWithQualifierInjectionPoints/contextBeanWithQualifierInjectionPoints.test"); - doTest(fileName); - } - - @TestMetadata("importConfigClasses/importConfigClasses.test") - public void testImportConfigClasses_ImportConfigClasses() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/importConfigClasses/importConfigClasses.test"); - doTest(fileName); - } - - @TestMetadata("innerBean/innerBean.test") - public void testInnerBean_InnerBean() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/innerBean/innerBean.test"); - doTest(fileName); - } - - @TestMetadata("methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test") - public void testMethodTypeDefaultInitMethod_MethodTypeDefaultInitMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/methodTypeDefaultInitMethod/methodTypeDefaultInitMethod.test"); - doTest(fileName); - } - - @TestMetadata("methodTypeFactory/methodTypeFactory.test") - public void testMethodTypeFactory_MethodTypeFactory() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/methodTypeFactory/methodTypeFactory.test"); - doTest(fileName); - } - - @TestMetadata("methodTypeInitMethod/methodTypeInitMethod.test") - public void testMethodTypeInitMethod_MethodTypeInitMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/methodTypeInitMethod/methodTypeInitMethod.test"); - doTest(fileName); - } - - @TestMetadata("methodTypeMultiple/methodTypeMultiple.test") - public void testMethodTypeMultiple_MethodTypeMultiple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/methodTypeMultiple/methodTypeMultiple.test"); - doTest(fileName); - } - - @TestMetadata("propertyGutterForProperty/propertyGutterForProperty.test") - public void testPropertyGutterForProperty_PropertyGutterForProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/propertyGutterForProperty/propertyGutterForProperty.test"); - doTest(fileName); - } - - @TestMetadata("propertyGutterForSetter/propertyGutterForSetter.test") - public void testPropertyGutterForSetter_PropertyGutterForSetter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/propertyGutterForSetter/propertyGutterForSetter.test"); - doTest(fileName); - } - - @TestMetadata("resourceGutter/resourceGutter.test") - public void testResourceGutter_ResourceGutter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/resourceGutter/resourceGutter.test"); - doTest(fileName); - } -} diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/springGutterTestUtils.kt.181 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/springGutterTestUtils.kt.181 deleted file mode 100644 index daf49b2b319..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/gutter/springGutterTestUtils.kt.181 +++ /dev/null @@ -1,80 +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.spring.tests.gutter - -import com.intellij.codeInsight.daemon.GutterMark -import com.intellij.codeInsight.daemon.LineMarkerInfo -import com.intellij.codeInsight.navigation.NavigationGutterIconRenderer -import com.intellij.pom.PomTargetPsiElement -import com.intellij.psi.PsiElement -import com.intellij.psi.presentation.java.SymbolPresentationUtil -import com.intellij.psi.xml.XmlTag -import com.intellij.spring.SpringPresentationProvider -import com.intellij.spring.model.pom.SpringBeanPomTargetUtils -import com.intellij.spring.model.xml.DomSpringBean -import com.intellij.spring.model.xml.beans.SpringPropertyDefinition -import com.intellij.testFramework.UsefulTestCase.assertSameElements -import com.intellij.util.containers.ContainerUtil -import com.intellij.util.xml.DomUtil -import org.jetbrains.kotlin.asJava.elements.KtLightAnnotationForSourceEntry -import org.jetbrains.kotlin.idea.completion.test.assertInstanceOf -import org.jetbrains.kotlin.psi.KtModifierListOwner -import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType - -private fun nameBean(element: PsiElement): String { - return when (element) { - is XmlTag -> DomUtil.getDomElement(element).assertInstanceOf().beanName!! - is PomTargetPsiElement -> SpringBeanPomTargetUtils.getSpringBean(element)?.let { SpringPresentationProvider.getSpringBeanName(it) } - ?: namePsi(element) - else -> throw IllegalArgumentException("Cannot convert " + element.javaClass + " (" + element.text + ")") - } -} - -private fun nameProperty(element: PsiElement) = DomUtil.getDomElement(element).assertInstanceOf().propertyName!! - -private fun namePsi(element: PsiElement): String { - if (element is KtLightAnnotationForSourceEntry) return namePsi(element.kotlinOrigin.getStrictParentOfType()!!) - return SymbolPresentationUtil.getSymbolPresentableText(element) -} - -fun checkBeanGutterTargets(gutterMark: GutterMark, expectedBeanNames: Collection) { - checkGutterTargets(gutterMark, expectedBeanNames, ::nameBean) -} - -fun checkBeanPropertyTargets(gutterMark: GutterMark, expectedPropertyNames: Collection) { - checkGutterTargets(gutterMark, expectedPropertyNames, ::nameProperty) -} - -fun checkPsiElementGutterTargets(gutterMark: GutterMark, expectedSymbolNames: Collection) { - checkGutterTargets(gutterMark, expectedSymbolNames, ::namePsi) -} - -fun checkGutterTargets( - gutterMark: GutterMark, - expectedValues: Collection, - targetNamer: (PsiElement) -> String -) { - val targetElements = when (gutterMark) { - is LineMarkerInfo.LineMarkerGutterIconRenderer<*> -> - gutterMark.lineMarkerInfo.navigationHandler.assertInstanceOf().targetElements - is NavigationGutterIconRenderer -> - gutterMark.targetElements - else -> throw IllegalArgumentException("${gutterMark.javaClass.name} not supported") - } - - assertSameElements(ContainerUtil.map(targetElements, targetNamer), expectedValues) -} \ No newline at end of file diff --git a/ultimate/tests/org/jetbrains/kotlin/tests/GenerateUltimateTests.kt.181 b/ultimate/tests/org/jetbrains/kotlin/tests/GenerateUltimateTests.kt.181 deleted file mode 100644 index 7bf4c35d5bc..00000000000 --- a/ultimate/tests/org/jetbrains/kotlin/tests/GenerateUltimateTests.kt.181 +++ /dev/null @@ -1,70 +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.tests - -import org.jetbrains.kotlin.generators.tests.generator.* -import org.jetbrains.kotlin.idea.spring.tests.findUsages.AbstractSpringFindUsagesTest -import org.jetbrains.kotlin.idea.spring.tests.generate.AbstractGenerateSpringDependencyActionTest -import org.jetbrains.kotlin.idea.spring.tests.gutter.AbstractSpringClassAnnotatorTest -import org.jetbrains.kotlin.idea.spring.tests.inspections.AbstractSpringInspectionTest -import org.jetbrains.kotlin.idea.spring.tests.quickfixes.AbstractSpringQuickFixTest -import org.jetbrains.kotlin.idea.spring.tests.references.AbstractSpringReferenceCompletionHandlerTest -import org.jetbrains.kotlin.idea.spring.tests.references.AbstractSpringReferenceCompletionTest -import org.jetbrains.kotlin.idea.spring.tests.references.AbstractSpringReferenceNavigationTest -import org.jetbrains.kotlin.idea.spring.tests.rename.AbstractSpringRenameTest - -fun main(args: Array) { - System.setProperty("java.awt.headless", "true") - - testGroup("ultimate/tests", "ultimate/testData") { - testClass { - model("inspections/spring", pattern = "^(inspections\\.test)$", singleClass = true) - } - - testClass { - model("quickFixes/spring", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) - } - - testClass() { - model("spring/core/gutter", extension = "test", singleClass = true) - } - - testClass() { - model("spring/core/references/completion/handler") - } - - testClass() { - model("spring/core/references/completion/variants") - } - - testClass() { - model("spring/core/references/navigation") - } - - testClass() { - model("spring/core/generate", pattern = "^([\\w]+)\\.kt$", singleClass = true) - } - - testClass() { - model("spring/core/rename", extension = "test", singleClass = true) - } - - testClass() { - model("spring/core/findUsages", pattern = """^(.+)\.kt$""") - } - } -}