From 8620d26a8ab4158d9f1c7e5e2fc48e15ff0cf24f Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Tue, 3 Nov 2020 17:31:50 +0300 Subject: [PATCH] Delete 193 bunch files --- .../util/io/JpsPersistentHashMap.java.193 | 1013 ----------------- .../storage/NonCachingLazyStorage.kt.193 | 106 -- .../KotlinCoreApplicationEnvironment.java.193 | 150 --- .../MockExternalAnnotationsManager.kt.193 | 61 - .../kotlin/cli/jvm/compiler/compat.kt.193 | 9 - .../coreApplicationEnvironmentCompat.kt.193 | 16 - .../testFramework/KtUsefulTestCase.java.193 | 976 ---------------- gradle/versions.properties.193 | 18 - .../kotlin/util/AbstractKotlinBundle.kt.193 | 12 - .../kotlin/idea/caches/compat.kt.193 | 14 - .../AnnotationPresentationInfo.kt.193 | 62 - .../modules/ModuleHighlightUtil2.java.193 | 114 -- .../completion/test/handlers/compat.kt.193 | 13 - .../AbstractKotlinBundleIndependent.kt.193 | 12 - ...KotlinCodeBlockModificationListener.kt.193 | 53 - .../idea/findUsages/KotlinUsageTypes.kt.193 | 86 -- .../idea/findUsages/handlers/compat.kt.193 | 14 - .../KotlinReferenceScopeOptimizer.kt.193 | 49 - .../kotlin/idea/util/ApplicationUtils.kt.193 | 58 - .../model/kotlin/dsl/EditorPosition.java.193 | 33 - .../model/kotlin/dsl/EditorReport.java.193 | 34 - .../kotlin/dsl/EditorReportSeverity.java.193 | 31 - .../dsl/KotlinDslModelsParameters.java.193 | 43 - .../kotlin/dsl/KotlinDslScriptModel.java.193 | 42 - .../kotlin/dsl/KotlinDslScriptsModel.java.193 | 64 -- ...tractProjectResolverExtensionCompat.kt.193 | 28 - .../KotlinNonJvmGutterConfigurator.kt.193 | 57 - .../AsyncFileChangeListenerHelper.kt.193 | 39 - .../gradle/GradleImportHelper.kt.193 | 144 --- ...GradleKotlinScriptDefinitionWrapper.kt.193 | 31 - .../KotlinDslScriptModelResolver.kt.193 | 57 - .../gradle/AbstractModelBuilderTest.java.193 | 233 ---- .../gradle/GradleFacetImportTest.kt.193 | 987 ---------------- .../actions/ShowKotlinBytecodeAction.kt.193 | 53 - .../ToolWindowScratchOutputHandler.kt.193 | 284 ----- .../scratch/ui/TextEditorWithPreview.java.193 | 487 -------- .../kotlin/idea/liveTemplates/compat.kt.193 | 15 - .../service/IdeaGradleWizardService.kt.193 | 47 - .../console/ConsoleCompilerHelper.kt.193 | 52 - .../jetbrains/kotlin/idea/test/compat.kt.193 | 15 - .../data/coroutineStackFrameItems.kt.193 | 174 --- .../kotlin/idea/testFramework/compat.kt.193 | 18 - .../idea/testFramework/gradleRoutines.kt.193 | 84 -- .../META-INF/plugin.xml.193 | 189 --- idea/resources/META-INF/gradle-java.xml.193 | 67 -- idea/resources/META-INF/gradle.xml.193 | 58 - idea/resources/META-INF/jvm.xml.193 | 9 - .../KotlinDocumentationProviderCompat.kt.193 | 9 - .../kotlin/idea/KotlinPluginMacros.kt.193 | 0 .../idea/PluginStartupComponent.java.193 | 46 - .../BreadcrumbsProviderCompatBase.kt.193 | 11 - ...RefactoringHelperForDelayedRequests.kt.193 | 38 - .../kotlin/idea/hierarchy/calls/compat.kt.193 | 23 - ...tractNavBarModelExtensionCompatBase.kt.193 | 18 - .../kotlin/idea/projectView/compat.kt.193 | 11 - .../BunchedDeprecation.java.193 | 25 - .../ui/KotlinChangeSignatureCompat.kt.193 | 31 - .../move/MoveKotlinInnerHandler.kt.193 | 0 .../BunchedDeprecation.java.193 | 25 - .../KotlinSignaturePresentationBuilder.kt.193 | 0 ...linSuggestedRefactoringAvailability.kt.193 | 0 ...KotlinSuggestedRefactoringExecution.kt.193 | 0 ...linSuggestedRefactoringStateChanges.kt.193 | 0 .../KotlinSuggestedRefactoringSupport.kt.193 | 0 .../KotlinSuggestedRefactoringUI.kt.193 | 0 ...tlinScriptingSettingsConfigurable.java.193 | 146 --- ...KotlinUsageContextDataFlowPanelBase.kt.193 | 128 --- .../kotlin/idea/startupCompat.kt.193 | 13 - .../src/test/kotlin/MyKotlinTest.kt.193 | 11 - .../navigationToolbar/ClassProperty.kt.193 | 8 - .../navigationToolbar/MethodInClass.kt.193 | 5 - .../SeveralClassesInFile.kt.193 | 13 - .../fileNameDoesntMatchClassName.kt.193 | 5 - .../navigationToolbar/topLevelFunction.kt.193 | 9 - .../navigationToolbar/topLevelProperty.kt.193 | 6 - .../after/a/specificImport.kt.193 | 5 - .../after/b/specificImport.kt.193 | 5 - .../after/a/specificImport.kt.193 | 5 - .../after/a/specificImport.kt.193 | 5 - .../findUsages/customUsageSearcher.kt.193 | 11 - .../caches/resolve/PsiElementChecker.kt.193 | 119 -- .../AbstractRenderingKDocTest.kt.193 | 13 - .../AbstractKotlinNavBarTest.kt.193 | 34 - .../kotlin/idea/quickfix/compat.kt.193 | 16 - ...tlinSignatureChangePresentationTest.kt.193 | 0 ...uggestedRefactoringAvailabilityTest.kt.193 | 0 ...estedRefactoringChangeCollectorTest.kt.193 | 0 ...gestedRefactoringChangeListenerTest.kt.193 | 0 .../KotlinSuggestedRefactoringTest.kt.193 | 0 .../kotlin/idea/resolve/compat.kt.193 | 24 - ...JavaToKotlinConverterForWebDemoTest.kt.193 | 137 --- .../KotlinUastCodeGenerationPlugin.kt.193 | 0 .../tests/KotlinUastGenerationTest.kt.193 | 0 tests/mute-platform.csv.193 | 119 -- 94 files changed, 7285 deletions(-) delete mode 100644 build-common/src/com/intellij/util/io/JpsPersistentHashMap.java.193 delete mode 100644 build-common/src/org/jetbrains/kotlin/incremental/storage/NonCachingLazyStorage.kt.193 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.193 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.193 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.193 delete mode 100644 compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/coreApplicationEnvironmentCompat.kt.193 delete mode 100644 compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 delete mode 100644 gradle/versions.properties.193 delete mode 100644 idea/ide-common/src/org/jetbrains/kotlin/util/AbstractKotlinBundle.kt.193 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/compat.kt.193 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt.193 delete mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.193 delete mode 100644 idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/compat.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/AbstractKotlinBundleIndependent.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/KotlinCodeBlockModificationListener.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypes.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/handlers/compat.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReferenceScopeOptimizer.kt.193 delete mode 100644 idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorPosition.java.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReport.java.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReportSeverity.java.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslModelsParameters.java.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptModel.java.193 delete mode 100644 idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptsModel.java.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/AbstractProjectResolverExtensionCompat.kt.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinNonJvmGutterConfigurator.kt.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/AsyncFileChangeListenerHelper.kt.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleKotlinScriptDefinitionWrapper.kt.193 delete mode 100644 idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.193 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.193 delete mode 100644 idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.193 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/ShowKotlinBytecodeAction.kt.193 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/ToolWindowScratchOutputHandler.kt.193 delete mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/TextEditorWithPreview.java.193 delete mode 100644 idea/idea-live-templates/tests/org/jetbrains/kotlin/idea/liveTemplates/compat.kt.193 delete mode 100644 idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt.193 delete mode 100644 idea/idea-repl/src/org/jetbrains/kotlin/console/ConsoleCompilerHelper.kt.193 delete mode 100644 idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.193 delete mode 100644 idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrameItems.kt.193 delete mode 100644 idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/compat.kt.193 delete mode 100644 idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.193 delete mode 100644 idea/resources-descriptors/META-INF/plugin.xml.193 delete mode 100644 idea/resources/META-INF/gradle-java.xml.193 delete mode 100644 idea/resources/META-INF/gradle.xml.193 delete mode 100644 idea/resources/META-INF/jvm.xml.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinRefactoringHelperForDelayedRequests.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/hierarchy/calls/compat.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/navigationToolbar/AbstractNavBarModelExtensionCompatBase.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/projectView/compat.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureCompat.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinInnerHandler.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignaturePresentationBuilder.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailability.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringExecution.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringStateChanges.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringSupport.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringUI.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/startupCompat.kt.193 delete mode 100644 idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.193 delete mode 100644 idea/testData/navigationToolbar/ClassProperty.kt.193 delete mode 100644 idea/testData/navigationToolbar/MethodInClass.kt.193 delete mode 100644 idea/testData/navigationToolbar/SeveralClassesInFile.kt.193 delete mode 100644 idea/testData/navigationToolbar/fileNameDoesntMatchClassName.kt.193 delete mode 100644 idea/testData/navigationToolbar/topLevelFunction.kt.193 delete mode 100644 idea/testData/navigationToolbar/topLevelProperty.kt.193 delete mode 100644 idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/a/specificImport.kt.193 delete mode 100644 idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/b/specificImport.kt.193 delete mode 100644 idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackage/after/a/specificImport.kt.193 delete mode 100644 idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackageAndRename/after/a/specificImport.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/caches/resolve/PsiElementChecker.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/navigationToolbar/AbstractKotlinNavBarTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/quickfix/compat.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignatureChangePresentationTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailabilityTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeCollectorTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeListenerTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringTest.kt.193 delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/resolve/compat.kt.193 delete mode 100644 j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.193 delete mode 100644 plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.193 delete mode 100644 plugins/uast-kotlin/tests/KotlinUastGenerationTest.kt.193 delete mode 100644 tests/mute-platform.csv.193 diff --git a/build-common/src/com/intellij/util/io/JpsPersistentHashMap.java.193 b/build-common/src/com/intellij/util/io/JpsPersistentHashMap.java.193 deleted file mode 100644 index c38d1a0c418..00000000000 --- a/build-common/src/com/intellij/util/io/JpsPersistentHashMap.java.193 +++ /dev/null @@ -1,1013 +0,0 @@ -// Copyright 2000-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 file. -package com.intellij.util.io; - -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.LowMemoryWatcher; -import com.intellij.openapi.util.ThreadLocalCachedValue; -import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.*; -import com.intellij.util.containers.LimitedPool; -import com.intellij.util.containers.SLRUCache; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.TestOnly; - -import java.io.*; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * This class shouldn't be used. It's temporary solution for JSP only and should be removed - * after updating Intellij SDK version - */ -@Deprecated -public class JpsPersistentHashMap extends PersistentEnumeratorDelegate implements PersistentMap { - // PersistentHashMap (PHM) works in the following (generic) way: - // - Particular key is translated via myEnumerator into an int. - // - As part of enumeration process for the new key, additional space is reserved in - // myEnumerator.myStorage for offset in ".values" file (myValueStorage) where (serialized) value is stored. - // - Once new value is written the offset storage is updated. - // - When the key is removed from PHM, offset storage is set to zero. - // - // It is important to note that offset - // is non-negative and can be 4 or 8 bytes, depending on the size of the ".values" file. - // PHM can work in appendable mode: for particular key additional calculated chunk of value can be appended to ".values" file with the offset - // of previously calculated chunk. - // For performance reasons we try hard to minimize storage occupied by keys / offsets in ".values" file: this storage is allocated as (limited) - // direct byte buffers so 4 bytes offset is used until it is possible. Generic record produced by enumerator used with PHM as part of new - // key enumeration is ? [.values file offset 4 or 8 bytes], however for unique integral keys enumerate_id isn't produced. - // Also for certain Value types it is possible to avoid random reads at all: e.g. in case Value is non-negative integer the value can be stored - // directly in storage used for offset and in case of btree enumerator directly in btree leaf. - private static final Logger LOG = Logger.getInstance("#com.intellij.util.io.PersistentHashMap"); - private static final boolean myDoTrace = SystemProperties.getBooleanProperty("idea.trace.persistent.map", false); - private static final int DEAD_KEY_NUMBER_MASK = 0xFFFFFFFF; - - private final File myStorageFile; - private final boolean myIsReadOnly; - private final KeyDescriptor myKeyDescriptor; - private PersistentHashMapValueStorage myValueStorage; - protected final DataExternalizer myValueExternalizer; - private static final long NULL_ADDR = 0; - private static final int INITIAL_INDEX_SIZE; - - static { - String property = System.getProperty("idea.initialIndexSize"); - INITIAL_INDEX_SIZE = property == null ? 4 * 1024 : Integer.valueOf(property); - } - - @NonNls - static final String DATA_FILE_EXTENSION = ".values"; - private long myLiveAndGarbageKeysCounter; - // first four bytes contain live keys count (updated via LIVE_KEY_MASK), last four bytes - number of dead keys - private int myReadCompactionGarbageSize; - private static final long LIVE_KEY_MASK = 1L << 32; - private static final long USED_LONG_VALUE_MASK = 1L << 62; - private static final int POSITIVE_VALUE_SHIFT = 1; - private final int myParentValueRefOffset; - @NotNull private final byte[] myRecordBuffer; - @NotNull private final byte[] mySmallRecordBuffer; - private final boolean myIntMapping; - private final boolean myDirectlyStoreLongFileOffsetMode; - private final boolean myCanReEnumerate; - private int myLargeIndexWatermarkId; // starting with this id we store offset in adjacent file in long format - private boolean myIntAddressForNewRecord; - private static final boolean doHardConsistencyChecks = false; - private volatile boolean myBusyReading; - - private static class AppendStream extends DataOutputStream { - private AppendStream() { - super(null); - } - - private void setOut(BufferExposingByteArrayOutputStream stream) { - out = stream; - } - } - - private final LimitedPool myStreamPool = - new LimitedPool<>(10, new LimitedPool.ObjectFactory() { - @Override - @NotNull - public BufferExposingByteArrayOutputStream create() { - return new BufferExposingByteArrayOutputStream(); - } - - @Override - public void cleanup(@NotNull final BufferExposingByteArrayOutputStream appendStream) { - appendStream.reset(); - } - }); - - private final SLRUCache myAppendCache; - - private boolean canUseIntAddressForNewRecord(long size) { - return myCanReEnumerate && size + POSITIVE_VALUE_SHIFT < Integer.MAX_VALUE; - } - - private final LowMemoryWatcher myAppendCacheFlusher = LowMemoryWatcher.register(this::dropMemoryCaches); - - public JpsPersistentHashMap(@NotNull final File file, - @NotNull KeyDescriptor keyDescriptor, - @NotNull DataExternalizer valueExternalizer) throws IOException { - this(file, keyDescriptor, valueExternalizer, INITIAL_INDEX_SIZE); - } - - public JpsPersistentHashMap(@NotNull final File file, - @NotNull KeyDescriptor keyDescriptor, - @NotNull DataExternalizer valueExternalizer, - final int initialSize) throws IOException { - this(file, keyDescriptor, valueExternalizer, initialSize, 0); - } - - public JpsPersistentHashMap(@NotNull final File file, - @NotNull KeyDescriptor keyDescriptor, - @NotNull DataExternalizer valueExternalizer, - final int initialSize, - int version) throws IOException { - this(file, keyDescriptor, valueExternalizer, initialSize, version, null); - } - - public JpsPersistentHashMap(@NotNull final File file, - @NotNull KeyDescriptor keyDescriptor, - @NotNull DataExternalizer valueExternalizer, - final int initialSize, - int version, - @Nullable PagedFileStorage.StorageLockContext lockContext) throws IOException { - this(file, keyDescriptor, valueExternalizer, initialSize, version, lockContext, - PersistentHashMapValueStorage.CreationTimeOptions.threadLocalOptions()); - } - - private JpsPersistentHashMap(@NotNull final File file, - @NotNull KeyDescriptor keyDescriptor, - @NotNull DataExternalizer valueExternalizer, - final int initialSize, - int version, - @Nullable PagedFileStorage.StorageLockContext lockContext, - @NotNull PersistentHashMapValueStorage.CreationTimeOptions options) throws IOException { - super(checkDataFiles(file), keyDescriptor, initialSize, lockContext, modifyVersionDependingOnOptions(version, options)); - - myStorageFile = file; - myKeyDescriptor = keyDescriptor; - myIsReadOnly = isReadOnly(); - if (myIsReadOnly) options = options.setReadOnly(); - - myAppendCache = createAppendCache(keyDescriptor); - final PersistentEnumeratorBase.RecordBufferHandler recordHandler = myEnumerator.getRecordHandler(); - myParentValueRefOffset = recordHandler.getRecordBuffer(myEnumerator).length; - myIntMapping = valueExternalizer instanceof IntInlineKeyDescriptor && wantNonNegativeIntegralValues(); - myDirectlyStoreLongFileOffsetMode = keyDescriptor instanceof InlineKeyDescriptor && myEnumerator instanceof PersistentBTreeEnumerator; - - myRecordBuffer = myDirectlyStoreLongFileOffsetMode ? ArrayUtilRt.EMPTY_BYTE_ARRAY : new byte[myParentValueRefOffset + 8]; - mySmallRecordBuffer = myDirectlyStoreLongFileOffsetMode ? ArrayUtilRt.EMPTY_BYTE_ARRAY : new byte[myParentValueRefOffset + 4]; - - myEnumerator.setRecordHandler(new PersistentEnumeratorBase.RecordBufferHandler() { - @Override - int recordWriteOffset(PersistentEnumeratorBase enumerator, byte[] buf) { - return recordHandler.recordWriteOffset(enumerator, buf); - } - - @NotNull - @Override - byte[] getRecordBuffer(PersistentEnumeratorBase enumerator) { - return myIntAddressForNewRecord ? mySmallRecordBuffer : myRecordBuffer; - } - - @Override - void setupRecord(PersistentEnumeratorBase enumerator, int hashCode, int dataOffset, @NotNull byte[] buf) { - recordHandler.setupRecord(enumerator, hashCode, dataOffset, buf); - for (int i = myParentValueRefOffset; i < buf.length; i++) { - buf[i] = 0; - } - } - }); - - myEnumerator.setMarkCleanCallback( - new Flushable() { - @Override - public void flush() { - myEnumerator.putMetaData(myLiveAndGarbageKeysCounter); - myEnumerator.putMetaData2(myLargeIndexWatermarkId | ((long)myReadCompactionGarbageSize << 32)); - } - } - ); - - if (myDoTrace) LOG.info("Opened " + file); - try { - myValueExternalizer = valueExternalizer; - myValueStorage = PersistentHashMapValueStorage.create(getDataFile(file).getPath(), options); - myLiveAndGarbageKeysCounter = myEnumerator.getMetaData(); - long data2 = myEnumerator.getMetaData2(); - myLargeIndexWatermarkId = (int)(data2 & DEAD_KEY_NUMBER_MASK); - myReadCompactionGarbageSize = (int)(data2 >>> 32); - myCanReEnumerate = myEnumerator.canReEnumerate(); - - if (makesSenseToCompact()) { - compact(); - } - } - catch (IOException e) { - try { - // attempt to close already opened resources - close(); - } - catch (Throwable ignored) { - } - throw e; // rethrow - } - catch (Throwable t) { - LOG.error(t); - try { - // attempt to close already opened resources - close(); - } - catch (Throwable ignored) { - } - throw new PersistentEnumerator.CorruptedException(file); - } - } - - private static int modifyVersionDependingOnOptions(int version, @NotNull PersistentHashMapValueStorage.CreationTimeOptions options) { - return version + options.getVersion(); - } - - protected boolean wantNonNegativeIntegralValues() { - return false; - } - - protected boolean isReadOnly() { - return false; - } - - private static final int MAX_RECYCLED_BUFFER_SIZE = 4096; - - private SLRUCache createAppendCache(final KeyDescriptor keyDescriptor) { - return new SLRUCache(16 * 1024, 4 * 1024, keyDescriptor) { - @Override - @NotNull - public BufferExposingByteArrayOutputStream createValue(final Key key) { - return myStreamPool.alloc(); - } - - @Override - protected void onDropFromCache(final Key key, @NotNull final BufferExposingByteArrayOutputStream bytes) { - appendDataWithoutCache(key, bytes); - } - }; - } - - private static boolean doNewCompact() { - return System.getProperty("idea.persistent.hash.map.oldcompact") == null; - } - - private boolean forceNewCompact() { - return System.getProperty("idea.persistent.hash.map.newcompact") != null && - (int)(myLiveAndGarbageKeysCounter & DEAD_KEY_NUMBER_MASK) > 0; - } - - public final void dropMemoryCaches() { - if (myDoTrace) LOG.info("Drop memory caches " + myStorageFile); - synchronized (myEnumerator) { - doDropMemoryCaches(); - } - } - - protected void doDropMemoryCaches() { - myEnumerator.lockStorage(); - try { - clearAppenderCaches(); - } - finally { - myEnumerator.unlockStorage(); - } - } - - int getGarbageSize() { - return (int)myLiveAndGarbageKeysCounter; - } - - public File getBaseFile() { - return myEnumerator.myFile; - } - - @TestOnly // public for tests - @SuppressWarnings("WeakerAccess") // used in upsource for some reason - public boolean makesSenseToCompact() { - if (myIsReadOnly) return false; - - final long fileSize = myValueStorage.getSize(); - final int megabyte = 1024 * 1024; - - if (fileSize > 5 * megabyte) { // file is longer than 5MB and (more than 50% of keys is garbage or approximate benefit larger than 100M) - int liveKeys = (int)(myLiveAndGarbageKeysCounter / LIVE_KEY_MASK); - int deadKeys = (int)(myLiveAndGarbageKeysCounter & DEAD_KEY_NUMBER_MASK); - - if (fileSize > 50 * megabyte && forceNewCompact()) return true; - if (deadKeys < 50) return false; - - final long benefitSize = Math.max(100 * megabyte, fileSize / 4); - final long avgValueSize = fileSize / (liveKeys + deadKeys); - - return deadKeys > liveKeys || - avgValueSize * deadKeys > benefitSize || - myReadCompactionGarbageSize > fileSize / 2; - } - return false; - } - - @NotNull - private static File checkDataFiles(@NotNull final File file) { - if (!file.exists()) { - deleteFilesStartingWith(getDataFile(file)); - } - return file; - } - - public static void deleteFilesStartingWith(@NotNull File prefixFile) { - IOUtil.deleteAllFilesStartingWith(prefixFile); - } - - @NotNull - static File getDataFile(@NotNull final File file) { // made public for testing - return new File(file.getParentFile(), file.getName() + DATA_FILE_EXTENSION); - } - - @Override - public final void put(Key key, Value value) throws IOException { - if (myIsReadOnly) throw new IncorrectOperationException(); - synchronized (myEnumerator) { - try { - doPut(key, value); - } - catch (IOException ex) { - myEnumerator.markCorrupted(); - throw ex; - } - } - } - - protected void doPut(Key key, Value value) throws IOException { - long newValueOffset = -1; - - if (!myIntMapping) { - final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(); - AppendStream appenderStream = ourFlyweightAppenderStream.getValue(); - appenderStream.setOut(bytes); - myValueExternalizer.save(appenderStream, value); - appenderStream.setOut(null); - newValueOffset = myValueStorage.appendBytes(bytes.toByteArraySequence(), 0); - } - - myEnumerator.lockStorage(); - try { - myEnumerator.markDirty(true); - myAppendCache.remove(key); - - long oldValueOffset; - if (myDirectlyStoreLongFileOffsetMode) { - if (myIntMapping) { - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(key, (Integer)value); - return; - } - oldValueOffset = ((PersistentBTreeEnumerator)myEnumerator).getNonNegativeValue(key); - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(key, newValueOffset); - } - else { - final int id = enumerate(key); - if (myIntMapping) { - myEnumerator.myStorage.putInt(id + myParentValueRefOffset, (Integer)value); - return; - } - - oldValueOffset = readValueId(id); - updateValueId(id, newValueOffset, oldValueOffset, key, 0); - } - - if (oldValueOffset != NULL_ADDR) { - myLiveAndGarbageKeysCounter++; - } - else { - myLiveAndGarbageKeysCounter += LIVE_KEY_MASK; - } - } - finally { - myEnumerator.unlockStorage(); - } - } - - @Override - public final int enumerate(Key name) throws IOException { - if (myIsReadOnly) throw new IncorrectOperationException(); - synchronized (myEnumerator) { - myIntAddressForNewRecord = canUseIntAddressForNewRecord(myValueStorage.getSize()); - return super.enumerate(name); - } - } - - /** - * Appends value chunk from specified appender to key's value. - * Important use note: value externalizer used by this map should process all bytes from DataInput during deserialization and make sure - * that deserialized value is consistent with value chunks appended. - * E.g. Value can be Set of String and individual Strings can be appended with this method for particular key, when {@link #get(Object)} will - * be eventually called for the key, deserializer will read all bytes retrieving Strings and collecting them into Set - */ - public final void appendData(Key key, @NotNull PersistentHashMap.ValueDataAppender appender) throws IOException { - if (myIsReadOnly) throw new IncorrectOperationException(); - synchronized (myEnumerator) { - try { - doAppendData(key, appender); - } - catch (IOException ex) { - myEnumerator.markCorrupted(); - throw ex; - } - } - } - - public final void appendDataWithoutCache(Key key, Value value) throws IOException { - synchronized (myEnumerator) { - try { - final BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(); - AppendStream appenderStream = ourFlyweightAppenderStream.getValue(); - appenderStream.setOut(bytes); - myValueExternalizer.save(appenderStream, value); - appenderStream.setOut(null); - appendDataWithoutCache(key, bytes); - } - catch (IOException ex) { - markCorrupted(); - throw ex; - } - } - } - - private void appendDataWithoutCache(Key key, @NotNull final BufferExposingByteArrayOutputStream bytes) { - myEnumerator.lockStorage(); - try { - long previousRecord; - final int id; - if (myDirectlyStoreLongFileOffsetMode) { - previousRecord = ((PersistentBTreeEnumerator)myEnumerator).getNonNegativeValue(key); - id = -1; - } - else { - id = enumerate(key); - previousRecord = readValueId(id); - } - - long headerRecord = myValueStorage.appendBytes(bytes.toByteArraySequence(), previousRecord); - - if (myDirectlyStoreLongFileOffsetMode) { - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(key, headerRecord); - } - else { - updateValueId(id, headerRecord, previousRecord, key, 0); - } - - if (previousRecord == NULL_ADDR) { - myLiveAndGarbageKeysCounter += LIVE_KEY_MASK; - } - - if (bytes.getInternalBuffer().length <= MAX_RECYCLED_BUFFER_SIZE) { - // Avoid internal fragmentation by not retaining / reusing large append buffers (IDEA-208533) - myStreamPool.recycle(bytes); - } - } - catch (IOException e) { - markCorrupted(); - throw new RuntimeException(e); - } - finally { - myEnumerator.unlockStorage(); - } - } - - private static final ThreadLocalCachedValue ourFlyweightAppenderStream = new ThreadLocalCachedValue() { - @NotNull - @Override - protected AppendStream create() { - return new AppendStream(); - } - }; - - private void doAppendData(Key key, @NotNull PersistentHashMap.ValueDataAppender appender) throws IOException { - assert !myIntMapping; - myEnumerator.markDirty(true); - - AppendStream appenderStream = ourFlyweightAppenderStream.getValue(); - BufferExposingByteArrayOutputStream stream = myAppendCache.get(key); - appenderStream.setOut(stream); - myValueStorage.checkAppendsAllowed(stream.size()); - appender.append(appenderStream); - appenderStream.setOut(null); - } - - /** - * Process all keys registered in the map. Note that keys which were removed after {@link #compact()} call will be processed as well. Use - * {@link #processKeysWithExistingMapping(Processor)} to process only keys with existing mappings - */ - @Override - public final boolean processKeys(@NotNull Processor processor) throws IOException { - synchronized (myEnumerator) { - try { - myAppendCache.clear(); - return myEnumerator.iterateData(processor); - } - catch (IOException e) { - myEnumerator.markCorrupted(); - throw e; - } - } - } - - @NotNull - public Collection getAllKeysWithExistingMapping() throws IOException { - final List values = new ArrayList<>(); - processKeysWithExistingMapping(new CommonProcessors.CollectProcessor<>(values)); - return values; - } - - public final boolean processKeysWithExistingMapping(Processor processor) throws IOException { - synchronized (myEnumerator) { - try { - myAppendCache.clear(); - return myEnumerator.processAllDataObject(processor, new PersistentEnumerator.DataFilter() { - @Override - public boolean accept(final int id) { - return readValueId(id) != NULL_ADDR; - } - }); - } - catch (IOException e) { - myEnumerator.markCorrupted(); - throw e; - } - } - } - - @Override - public final Value get(Key key) throws IOException { - synchronized (myEnumerator) { - myBusyReading = true; - try { - return doGet(key); - } - catch (IOException ex) { - myEnumerator.markCorrupted(); - throw ex; - } - finally { - myBusyReading = false; - } - } - } - - public boolean isBusyReading() { - return myBusyReading; - } - - @Nullable - protected Value doGet(Key key) throws IOException { - myEnumerator.lockStorage(); - final long valueOffset; - final int id; - try { - myAppendCache.remove(key); - - if (myDirectlyStoreLongFileOffsetMode) { - valueOffset = ((PersistentBTreeEnumerator)myEnumerator).getNonNegativeValue(key); - if (myIntMapping) { - return (Value)(Integer)(int)valueOffset; - } - id = -1; - } - else { - id = tryEnumerate(key); - if (id == PersistentEnumeratorBase.NULL_ID) { - return null; - } - - if (myIntMapping) { - return (Value)(Integer)myEnumerator.myStorage.getInt(id + myParentValueRefOffset); - } - - valueOffset = readValueId(id); - } - - if (valueOffset == NULL_ADDR) { - return null; - } - } - finally { - myEnumerator.unlockStorage(); - } - - final PersistentHashMapValueStorage.ReadResult readResult = myValueStorage.readBytes(valueOffset); - - final Value valueRead; - try (DataInputStream input = new DataInputStream(new UnsyncByteArrayInputStream(readResult.buffer))) { - valueRead = myValueExternalizer.read(input); - } - - if (myValueStorage.performChunksCompaction(readResult.chunksCount, readResult.buffer.length)) { - - long newValueOffset = myValueStorage.compactChunks(new PersistentHashMap.ValueDataAppender() { - @Override - public void append(DataOutput out) throws IOException { - myValueExternalizer.save(out, valueRead); - } - }, readResult); - - myEnumerator.lockStorage(); - try { - myEnumerator.markDirty(true); - - if (myDirectlyStoreLongFileOffsetMode) { - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(key, newValueOffset); - } - else { - updateValueId(id, newValueOffset, valueOffset, key, 0); - } - myLiveAndGarbageKeysCounter++; - myReadCompactionGarbageSize += readResult.buffer.length; - } - finally { - myEnumerator.unlockStorage(); - } - } - return valueRead; - } - - public final boolean containsMapping(Key key) throws IOException { - synchronized (myEnumerator) { - return doContainsMapping(key); - } - } - - private boolean doContainsMapping(Key key) throws IOException { - myEnumerator.lockStorage(); - try { - myAppendCache.remove(key); - if (myDirectlyStoreLongFileOffsetMode) { - return ((PersistentBTreeEnumerator)myEnumerator).getNonNegativeValue(key) != NULL_ADDR; - } - else { - final int id = tryEnumerate(key); - if (id == PersistentEnumeratorBase.NULL_ID) { - return false; - } - if (myIntMapping) return true; - return readValueId(id) != NULL_ADDR; - } - } - finally { - myEnumerator.unlockStorage(); - } - } - - public final void remove(Key key) throws IOException { - if (myIsReadOnly) throw new IncorrectOperationException(); - synchronized (myEnumerator) { - doRemove(key); - } - } - - protected void doRemove(Key key) throws IOException { - myEnumerator.lockStorage(); - try { - - myAppendCache.remove(key); - final long record; - if (myDirectlyStoreLongFileOffsetMode) { - assert !myIntMapping; // removal isn't supported - record = ((PersistentBTreeEnumerator)myEnumerator).getNonNegativeValue(key); - if (record != NULL_ADDR) { - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(key, NULL_ADDR); - } - } - else { - final int id = tryEnumerate(key); - if (id == PersistentEnumeratorBase.NULL_ID) { - return; - } - assert !myIntMapping; // removal isn't supported - myEnumerator.markDirty(true); - - record = readValueId(id); - updateValueId(id, NULL_ADDR, record, key, 0); - } - if (record != NULL_ADDR) { - myLiveAndGarbageKeysCounter++; - myLiveAndGarbageKeysCounter -= LIVE_KEY_MASK; - } - } - finally { - myEnumerator.unlockStorage(); - } - } - - @Override - public final void force() { - if (myIsReadOnly) return; - if (myDoTrace) LOG.info("Forcing " + myStorageFile); - synchronized (myEnumerator) { - doForce(); - } - } - - protected void doForce() { - myEnumerator.lockStorage(); - try { - try { - clearAppenderCaches(); - } - finally { - super.force(); - } - } - finally { - myEnumerator.unlockStorage(); - } - } - - private void clearAppenderCaches() { - myAppendCache.clear(); - myValueStorage.force(); - } - - @Override - public final void close() throws IOException { - if (myDoTrace) LOG.info("Closed " + myStorageFile); - synchronized (myEnumerator) { - doClose(); - } - } - - private void doClose() throws IOException { - myEnumerator.lockStorage(); - try { - try { - myAppendCacheFlusher.stop(); - try { - myAppendCache.clear(); - } - catch (RuntimeException ex) { - Throwable cause = ex.getCause(); - if (cause instanceof IOException) throw (IOException)cause; - throw ex; - } - } - finally { - final PersistentHashMapValueStorage valueStorage = myValueStorage; - try { - if (valueStorage != null) { - valueStorage.dispose(); - } - } - finally { - super.close(); - } - } - } - finally { - myEnumerator.unlockStorage(); - } - } - - //static class CompactionRecordInfo { - // final int key; - // final int address; - // long valueAddress; - // long newValueAddress; - // byte[] value; - // - // CompactionRecordInfo(int _key, long _valueAddress, int _address) { - // key = _key; - // address = _address; - // valueAddress = _valueAddress; - // } - //} - - // made public for tests - public void compact() throws IOException { - if (myIsReadOnly) throw new IncorrectOperationException(); - synchronized (myEnumerator) { - force(); - LOG.info("Compacting " + myEnumerator.myFile.getPath()); - LOG.info("Live keys:" + (int)(myLiveAndGarbageKeysCounter / LIVE_KEY_MASK) + - ", dead keys:" + (int)(myLiveAndGarbageKeysCounter & DEAD_KEY_NUMBER_MASK) + - ", read compaction size:" + myReadCompactionGarbageSize); - - final long now = System.currentTimeMillis(); - - final File oldDataFile = getDataFile(myEnumerator.myFile); - final String oldDataFileBaseName = oldDataFile.getName(); - final File[] oldFiles = getFilesInDirectoryWithNameStartingWith(oldDataFile, oldDataFileBaseName); - - final String newPath = getDataFile(myEnumerator.myFile).getPath() + ".new"; - PersistentHashMapValueStorage.CreationTimeOptions options = myValueStorage.getOptions(); - final PersistentHashMapValueStorage newStorage = PersistentHashMapValueStorage.create(newPath, options); - myValueStorage.switchToCompactionMode(); - myEnumerator.markDirty(true); - long sizeBefore = myValueStorage.getSize(); - - myLiveAndGarbageKeysCounter = 0; - myReadCompactionGarbageSize = 0; - - try { - if (doNewCompact()) { - newCompact(newStorage); - } - else { - traverseAllRecords(new PersistentEnumerator.RecordsProcessor() { - @Override - public boolean process(final int keyId) throws IOException { - final long record = readValueId(keyId); - if (record != NULL_ADDR) { - PersistentHashMapValueStorage.ReadResult readResult = myValueStorage.readBytes(record); - long value = newStorage.appendBytes(readResult.buffer, 0, readResult.buffer.length, 0); - updateValueId(keyId, value, record, null, getCurrentKey()); - myLiveAndGarbageKeysCounter += LIVE_KEY_MASK; - } - return true; - } - }); - } - } - finally { - newStorage.dispose(); - } - - myValueStorage.dispose(); - - if (oldFiles != null) { - for (File f : oldFiles) { - assert FileUtil.deleteWithRenaming(f); - } - } - - final long newSize = newStorage.getSize(); - - File newDataFile = new File(newPath); - final String newBaseName = newDataFile.getName(); - final File[] newFiles = getFilesInDirectoryWithNameStartingWith(newDataFile, newBaseName); - - if (newFiles != null) { - File parentFile = newDataFile.getParentFile(); - - // newFiles should get the same names as oldDataFiles - for (File f : newFiles) { - String nameAfterRename = StringUtil.replace(f.getName(), newBaseName, oldDataFileBaseName); - FileUtil.rename(f, new File(parentFile, nameAfterRename)); - } - } - - myValueStorage = PersistentHashMapValueStorage.create(oldDataFile.getPath(), options); - LOG.info("Compacted " + myEnumerator.myFile.getPath() + ":" + sizeBefore + " bytes into " + - newSize + " bytes in " + (System.currentTimeMillis() - now) + "ms."); - myEnumerator.putMetaData(myLiveAndGarbageKeysCounter); - myEnumerator.putMetaData2(myLargeIndexWatermarkId); - if (myDoTrace) LOG.assertTrue(myEnumerator.isDirty()); - } - } - - private static File[] getFilesInDirectoryWithNameStartingWith(@NotNull File fileFromDirectory, @NotNull final String baseFileName) { - File parentFile = fileFromDirectory.getParentFile(); - return parentFile != null ? parentFile.listFiles(pathname -> pathname.getName().startsWith(baseFileName)) : null; - } - - private void newCompact(@NotNull PersistentHashMapValueStorage newStorage) throws IOException { - long started = System.currentTimeMillis(); - final List infos = new ArrayList<>(10000); - - traverseAllRecords(new PersistentEnumerator.RecordsProcessor() { - @Override - public boolean process(final int keyId) { - final long record = readValueId(keyId); - if (record != NULL_ADDR) { - infos.add(new PersistentHashMap.CompactionRecordInfo(getCurrentKey(), record, keyId)); - } - return true; - } - }); - - LOG.info("Loaded mappings:" + (System.currentTimeMillis() - started) + "ms, keys:" + infos.size()); - started = System.currentTimeMillis(); - long fragments = 0; - if (!infos.isEmpty()) { - try { - fragments = myValueStorage.compactValues(infos, newStorage); - } - catch (Throwable t) { - if (!(t instanceof IOException)) throw new IOException("Compaction failed", t); - throw (IOException)t; - } - } - - LOG.info("Compacted values for:" + (System.currentTimeMillis() - started) + "ms fragments:" + - (int)fragments + ", new fragments:" + (fragments >> 32)); - - started = System.currentTimeMillis(); - try { - myEnumerator.lockStorage(); - - for (PersistentHashMap.CompactionRecordInfo info : infos) { - updateValueId(info.address, info.newValueAddress, info.valueAddress, null, info.key); - myLiveAndGarbageKeysCounter += LIVE_KEY_MASK; - } - } - finally { - myEnumerator.unlockStorage(); - } - LOG.info("Updated mappings:" + (System.currentTimeMillis() - started) + " ms"); - } - - private long readValueId(final int keyId) { - if (myDirectlyStoreLongFileOffsetMode) { - return ((PersistentBTreeEnumerator)myEnumerator).keyIdToNonNegativeOffset(keyId); - } - long address = myEnumerator.myStorage.getInt(keyId + myParentValueRefOffset); - if (address == 0 || address == -POSITIVE_VALUE_SHIFT) { - return NULL_ADDR; - } - - if (address < 0) { - address = -address - POSITIVE_VALUE_SHIFT; - } - else { - long value = myEnumerator.myStorage.getInt(keyId + myParentValueRefOffset + 4) & 0xFFFFFFFFL; - address = ((address << 32) + value) & ~USED_LONG_VALUE_MASK; - } - - return address; - } - - private int smallKeys; - private int largeKeys; - private int transformedKeys; - private int requests; - - private int updateValueId(int keyId, long value, long oldValue, @Nullable Key key, int processingKey) throws IOException { - if (myDirectlyStoreLongFileOffsetMode) { - ((PersistentBTreeEnumerator)myEnumerator).putNonNegativeValue(((InlineKeyDescriptor)myKeyDescriptor).fromInt(processingKey), value); - return keyId; - } - final boolean newKey = oldValue == NULL_ADDR; - if (newKey) ++requests; - boolean defaultSizeInfo = true; - - if (myCanReEnumerate) { - if (canUseIntAddressForNewRecord(value)) { - defaultSizeInfo = false; - myEnumerator.myStorage.putInt(keyId + myParentValueRefOffset, -(int)(value + POSITIVE_VALUE_SHIFT)); - if (newKey) ++smallKeys; - } - else if ((keyId < myLargeIndexWatermarkId || myLargeIndexWatermarkId == 0) && (newKey || canUseIntAddressForNewRecord(oldValue))) { - // keyId is result of enumerate, if we do re-enumerate then it is no longer accessible unless somebody cached it - myIntAddressForNewRecord = false; - keyId = myEnumerator.reEnumerate(key == null ? myEnumerator.getValue(keyId, processingKey) : key); - ++transformedKeys; - if (myLargeIndexWatermarkId == 0) { - myLargeIndexWatermarkId = keyId; - } - } - } - - if (defaultSizeInfo) { - value |= USED_LONG_VALUE_MASK; - - myEnumerator.myStorage.putInt(keyId + myParentValueRefOffset, (int)(value >>> 32)); - myEnumerator.myStorage.putInt(keyId + myParentValueRefOffset + 4, (int)value); - - if (newKey) ++largeKeys; - } - - if (newKey && IOStatistics.DEBUG && (requests & IOStatistics.KEYS_FACTOR_MASK) == 0) { - IOStatistics.dump("small:" + smallKeys + ", large:" + largeKeys + ", transformed:" + transformedKeys + - ",@" + getBaseFile().getPath()); - } - if (doHardConsistencyChecks) { - long checkRecord = readValueId(keyId); - assert checkRecord == (value & ~USED_LONG_VALUE_MASK) : value; - } - return keyId; - } - - @Override - public String toString() { - return super.toString() + ": " + myStorageFile; - } - - @TestOnly - PersistentHashMapValueStorage getValueStorage() { - return myValueStorage; - } - - @TestOnly - public boolean getReadOnly() { - return myIsReadOnly; - } -} diff --git a/build-common/src/org/jetbrains/kotlin/incremental/storage/NonCachingLazyStorage.kt.193 b/build-common/src/org/jetbrains/kotlin/incremental/storage/NonCachingLazyStorage.kt.193 deleted file mode 100644 index 7cfcb00a89f..00000000000 --- a/build-common/src/org/jetbrains/kotlin/incremental/storage/NonCachingLazyStorage.kt.193 +++ /dev/null @@ -1,106 +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.incremental.storage - -import com.intellij.util.io.DataExternalizer -import com.intellij.util.io.KeyDescriptor -import com.intellij.util.io.JpsPersistentHashMap -import java.io.File - - -class NonCachingLazyStorage( - private val storageFile: File, - private val keyDescriptor: KeyDescriptor, - private val valueExternalizer: DataExternalizer -) : LazyStorage { - @Volatile - private var storage: JpsPersistentHashMap? = null - - @Synchronized - private fun getStorageIfExists(): JpsPersistentHashMap? { - if (storage != null) return storage - - if (storageFile.exists()) { - storage = createMap() - return storage - } - - return null - } - - @Synchronized - private fun getStorageOrCreateNew(): JpsPersistentHashMap { - if (storage == null) { - storage = createMap() - } - - return storage!! - } - - override val keys: Collection - get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf() - - override operator fun contains(key: K): Boolean = - getStorageIfExists()?.containsMapping(key) ?: false - - override operator fun get(key: K): V? = - getStorageIfExists()?.get(key) - - override operator fun set(key: K, value: V) { - getStorageOrCreateNew().put(key, value) - } - - override fun remove(key: K) { - getStorageIfExists()?.remove(key) - } - - override fun append(key: K, value: V) { - getStorageOrCreateNew().appendDataWithoutCache(key, value) - } - - @Synchronized - override fun clean() { - try { - storage?.close() - } catch (ignored: Throwable) { - } - - JpsPersistentHashMap.deleteFilesStartingWith(storageFile) - storage = null - } - - @Synchronized - override fun flush(memoryCachesOnly: Boolean) { - val existingStorage = storage ?: return - - if (memoryCachesOnly) { - if (existingStorage.isDirty) { - existingStorage.dropMemoryCaches() - } - } else { - existingStorage.force() - } - } - - @Synchronized - override fun close() { - storage?.close() - } - - private fun createMap(): JpsPersistentHashMap = - JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer) -} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.193 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.193 deleted file mode 100644 index f5a5525c63e..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreApplicationEnvironment.java.193 +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.cli.jvm.compiler; - -import com.intellij.codeInsight.ContainerProvider; -import com.intellij.codeInsight.JavaContainerProvider; -import com.intellij.codeInsight.folding.JavaCodeFoldingSettings; -import com.intellij.codeInsight.folding.impl.JavaCodeFoldingSettingsBase; -import com.intellij.codeInsight.folding.impl.JavaFoldingBuilderBase; -import com.intellij.codeInsight.runner.JavaMainMethodProvider; -import com.intellij.core.CoreApplicationEnvironment; -import com.intellij.core.CoreJavaDirectoryService; -import com.intellij.core.CorePsiPackageImplementationHelper; -import com.intellij.ide.highlighter.ArchiveFileType; -import com.intellij.ide.highlighter.JavaClassFileType; -import com.intellij.ide.highlighter.JavaFileType; -import com.intellij.lang.LanguageASTFactory; -import com.intellij.lang.MetaLanguage; -import com.intellij.lang.folding.LanguageFolding; -import com.intellij.lang.java.JavaLanguage; -import com.intellij.lang.java.JavaParserDefinition; -import com.intellij.navigation.ItemPresentationProviders; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.extensions.ExtensionsArea; -import com.intellij.openapi.fileTypes.FileTypeExtensionPoint; -import com.intellij.openapi.fileTypes.PlainTextFileType; -import com.intellij.openapi.fileTypes.PlainTextLanguage; -import com.intellij.openapi.fileTypes.PlainTextParserDefinition; -import com.intellij.openapi.projectRoots.JavaVersionService; -import com.intellij.openapi.vfs.VirtualFileSystem; -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.LanguageConstantExpressionEvaluator; -import com.intellij.psi.impl.PsiExpressionEvaluator; -import com.intellij.psi.impl.PsiSubstitutorFactoryImpl; -import com.intellij.psi.impl.compiled.ClassFileStubBuilder; -import com.intellij.psi.impl.file.PsiPackageImplementationHelper; -import com.intellij.psi.impl.search.MethodSuperSearcher; -import com.intellij.psi.impl.source.tree.JavaASTFactory; -import com.intellij.psi.impl.source.tree.PlainTextASTFactory; -import com.intellij.psi.meta.MetaDataContributor; -import com.intellij.psi.presentation.java.*; -import com.intellij.psi.search.searches.SuperMethodsSearch; -import com.intellij.psi.stubs.BinaryFileStubBuilders; -import com.intellij.util.QueryExecutor; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem; - -/** - * adapted from com.intellij.core.JavaCoreApplicationEnvironment - * TODO: initiate removal original from com.intellij.core since it seems that there are no usages left - */ -public class KotlinCoreApplicationEnvironment extends CoreApplicationEnvironment { - - public static KotlinCoreApplicationEnvironment create(@NotNull Disposable parentDisposable, boolean unitTestMode) { - return new KotlinCoreApplicationEnvironment(parentDisposable, unitTestMode); - } - - private KotlinCoreApplicationEnvironment(@NotNull Disposable parentDisposable, boolean unitTestMode) { - super(parentDisposable, unitTestMode); - - registerExtensionPoints(); - - registerExtensions(); - } - - private void registerExtensionPoints() { - ExtensionsArea area = Extensions.getRootArea(); - - CoreApplicationEnvironment.registerExtensionPoint(area, BinaryFileStubBuilders.EP_NAME, FileTypeExtensionPoint.class); - CoreApplicationEnvironment.registerExtensionPoint(area, FileContextProvider.EP_NAME, FileContextProvider.class); - - CoreApplicationEnvironment.registerExtensionPoint(area, MetaDataContributor.EP_NAME, MetaDataContributor.class); - CoreApplicationEnvironment.registerExtensionPoint(area, PsiAugmentProvider.EP_NAME, PsiAugmentProvider.class); - CoreApplicationEnvironment.registerExtensionPoint(area, JavaMainMethodProvider.EP_NAME, JavaMainMethodProvider.class); - - CoreApplicationEnvironment.registerExtensionPoint(area, ContainerProvider.EP_NAME, ContainerProvider.class); - CoreApplicationEnvironment.registerExtensionPoint(area, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler.class); - - CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier.class); - CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage.class); - - IdeaExtensionPoints.INSTANCE.registerVersionSpecificAppExtensionPoints(area); - } - - private void registerExtensions() { - registerFileType(JavaClassFileType.INSTANCE, "class"); - registerFileType(JavaFileType.INSTANCE, "java"); - registerFileType(ArchiveFileType.INSTANCE, "jar;zip"); - registerFileType(PlainTextFileType.INSTANCE, "txt;sh;bat;cmd;policy;log;cgi;MF;jad;jam;htaccess"); - - addExplicitExtension(LanguageASTFactory.INSTANCE, PlainTextLanguage.INSTANCE, new PlainTextASTFactory()); - registerParserDefinition(new PlainTextParserDefinition()); - - addExplicitExtension(FileTypeFileViewProviders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileViewProviderFactory()); - addExplicitExtension(BinaryFileStubBuilders.INSTANCE, JavaClassFileType.INSTANCE, new ClassFileStubBuilder()); - - addExplicitExtension(LanguageASTFactory.INSTANCE, JavaLanguage.INSTANCE, new JavaASTFactory()); - registerParserDefinition(new JavaParserDefinition()); - addExplicitExtension(LanguageConstantExpressionEvaluator.INSTANCE, JavaLanguage.INSTANCE, new PsiExpressionEvaluator()); - - addExtension(ContainerProvider.EP_NAME, new JavaContainerProvider()); - - myApplication.registerService(PsiPackageImplementationHelper.class, new CorePsiPackageImplementationHelper()); - myApplication.registerService(PsiSubstitutorFactory.class, new PsiSubstitutorFactoryImpl()); - - myApplication.registerService(JavaDirectoryService.class, createJavaDirectoryService()); - myApplication.registerService(JavaVersionService.class, new JavaVersionService()); - - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiPackage.class, new PackagePresentationProvider()); - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiClass.class, new ClassPresentationProvider()); - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiMethod.class, new MethodPresentationProvider()); - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiField.class, new FieldPresentationProvider()); - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiLocalVariable.class, new VariablePresentationProvider()); - addExplicitExtension(ItemPresentationProviders.INSTANCE, PsiParameter.class, new VariablePresentationProvider()); - - registerApplicationService(JavaCodeFoldingSettings.class, new JavaCodeFoldingSettingsBase()); - addExplicitExtension(LanguageFolding.INSTANCE, JavaLanguage.INSTANCE, new JavaFoldingBuilderBase() { - @Override - protected boolean shouldShowExplicitLambdaType(@NotNull PsiAnonymousClass anonymousClass, @NotNull PsiNewExpression expression) { - return false; - } - - @Override - protected boolean isBelowRightMargin(@NotNull PsiFile file, int lineLength) { - return false; - } - }); - - registerApplicationExtensionPoint(SuperMethodsSearch.EP_NAME, QueryExecutor.class); - addExtension(SuperMethodsSearch.EP_NAME, new MethodSuperSearcher()); - } - - // overridden in upsource - protected CoreJavaDirectoryService createJavaDirectoryService() { - return new CoreJavaDirectoryService(); - } - - @Nullable - @Override - protected VirtualFileSystem createJrtFileSystem() { - return new CoreJrtFileSystem(); - } -} \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.193 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.193 deleted file mode 100644 index 746e54decd7..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/MockExternalAnnotationsManager.kt.193 +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.cli.jvm.compiler - -import com.intellij.codeInsight.ExternalAnnotationsManager -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.psi.* - -class MockExternalAnnotationsManager : ExternalAnnotationsManager() { - override fun chooseAnnotationsPlace(element: PsiElement): AnnotationPlace = AnnotationPlace.NOWHERE - - override fun isExternalAnnotationWritable(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean = false - override fun isExternalAnnotation(annotation: PsiAnnotation): Boolean = false - - override fun findExternalAnnotationsFiles(listOwner: PsiModifierListOwner): List? = null - override fun findExternalAnnotation(listOwner: PsiModifierListOwner, annotationFQN: String): PsiAnnotation? = null - override fun findExternalAnnotations(listOwner: PsiModifierListOwner): Array? = null - - override fun annotateExternally( - listOwner: PsiModifierListOwner, - annotationFQName: String, - fromFile: PsiFile, - value: Array? - ) { - throw UnsupportedOperationException("not implemented") - } - - override fun deannotate(listOwner: PsiModifierListOwner, annotationFQN: String): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun editExternalAnnotation( - listOwner: PsiModifierListOwner, - annotationFQN: String, - value: Array? - ): Boolean { - throw UnsupportedOperationException("not implemented") - } - - override fun hasAnnotationRootsForFile(file: VirtualFile): Boolean = false - - override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass, annotationFQN: String): List = emptyList() - - override fun findDefaultConstructorExternalAnnotations(aClass: PsiClass): List = emptyList() - - override fun findExternalAnnotations(listOwner: PsiModifierListOwner, annotationFQN: String): List = emptyList() -} diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.193 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.193 deleted file mode 100644 index e7316778db5..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/compat.kt.193 +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.cli.jvm.compiler - -fun setupIdeaStandaloneExecution() { -} \ No newline at end of file diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/coreApplicationEnvironmentCompat.kt.193 b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/coreApplicationEnvironmentCompat.kt.193 deleted file mode 100644 index 8327a2b97a9..00000000000 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/coreApplicationEnvironmentCompat.kt.193 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.cli.jvm.compiler - -import com.intellij.core.CoreApplicationEnvironment -import com.intellij.openapi.extensions.ExtensionsArea -import java.io.File - -// FIX ME WHEN BUNCH 193 REMOVED -fun registerExtensionPointAndExtensionsEx(pluginFile: File, fileName: String, area: ExtensionsArea) { - @Suppress("MissingRecentApi") - CoreApplicationEnvironment.registerExtensionPointAndExtensions(pluginFile, fileName, area) -} \ No newline at end of file diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 b/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 deleted file mode 100644 index 29670c6a324..00000000000 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/testFramework/KtUsefulTestCase.java.193 +++ /dev/null @@ -1,976 +0,0 @@ -/* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.test.testFramework; - -import com.intellij.diagnostic.PerformanceWatcher; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.application.Application; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.application.impl.ApplicationInfoImpl; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.JDOMUtil; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.*; -import com.intellij.psi.codeStyle.CodeStyleSettings; -import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.testFramework.*; -import com.intellij.testFramework.exceptionCases.AbstractExceptionCase; -import com.intellij.util.Consumer; -import com.intellij.util.ReflectionUtil; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.hash.HashMap; -import com.intellij.util.lang.CompoundRuntimeException; -import com.intellij.util.ui.UIUtil; -import gnu.trove.Equality; -import gnu.trove.THashSet; -import junit.framework.AssertionFailedError; -import junit.framework.TestCase; -import org.jdom.Element; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.test.IdeaSystemPropertiesForParallelRunConfigurator; -import org.jetbrains.kotlin.testFramework.MockComponentManagerCreationTracer; -import org.jetbrains.kotlin.types.AbstractTypeChecker; -import org.jetbrains.kotlin.types.FlexibleTypeImpl; -import org.junit.Assert; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.*; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Supplier; - -@SuppressWarnings("UseOfSystemOutOrSystemErr") -public abstract class KtUsefulTestCase extends TestCase { - public static final boolean IS_UNDER_TEAMCITY = System.getenv("TEAMCITY_VERSION") != null; - private static final String TEMP_DIR_MARKER = "unitTest_"; - public static final boolean OVERWRITE_TESTDATA = Boolean.getBoolean("idea.tests.overwrite.data"); - - private static final String ORIGINAL_TEMP_DIR = FileUtil.getTempDirectory(); - - private static final Map TOTAL_SETUP_COST_MILLIS = new HashMap<>(); - private static final Map TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>(); - - private Application application; - - static { - IdeaSystemPropertiesForParallelRunConfigurator.setProperties(); - //TODO: investigate and enable - //IdeaForkJoinWorkerThreadFactory.setupPoisonFactory(); - Logger.setFactory(TestLoggerFactory.class); - } - - @NotNull - protected final Disposable myTestRootDisposable = new TestDisposable(); - - private static final String ourPathToKeep = null; - private final List myPathsToKeep = new ArrayList<>(); - - private File myTempDir; - - static { - // Radar #5755208: Command line Java applications need a way to launch without a Dock icon. - System.setProperty("apple.awt.UIElement", "true"); - - // -- KOTLIN ADDITIONAL START -- - - FlexibleTypeImpl.RUN_SLOW_ASSERTIONS = true; - AbstractTypeChecker.RUN_SLOW_ASSERTIONS = true; - - // -- KOTLIN ADDITIONAL END -- - } - - protected boolean shouldContainTempFiles() { - return true; - } - - @Override - protected void setUp() throws Exception { - // -- KOTLIN ADDITIONAL START -- - application = ApplicationManager.getApplication(); - - if (application != null && application.isDisposed()) { - MockComponentManagerCreationTracer.diagnoseDisposedButNotClearedApplication(application); - } - // -- KOTLIN ADDITIONAL END -- - - super.setUp(); - - if (shouldContainTempFiles()) { - String testName = FileUtil.sanitizeFileName(getTestName(true)); - if (StringUtil.isEmptyOrSpaces(testName)) testName = ""; - testName = new File(testName).getName(); // in case the test name contains file separators - myTempDir = FileUtil.createTempDirectory(TEMP_DIR_MARKER, testName, false); - FileUtil.resetCanonicalTempPathCache(myTempDir.getPath()); - } - - boolean isStressTest = isStressTest(); - ApplicationInfoImpl.setInStressTest(isStressTest); - if (isPerformanceTest()) { - Timings.getStatistics(); - } - - // turn off Disposer debugging for performance tests - Disposer.setDebugMode(!isStressTest); - } - - @Override - protected void tearDown() throws Exception { - try { - // don't use method references here to make stack trace reading easier - //noinspection Convert2MethodRef - new RunAll( - () -> disposeRootDisposable(), - () -> cleanupSwingDataStructures(), - () -> cleanupDeleteOnExitHookList(), - () -> Disposer.setDebugMode(true), - () -> { - if (shouldContainTempFiles()) { - FileUtil.resetCanonicalTempPathCache(ORIGINAL_TEMP_DIR); - if (hasTmpFilesToKeep()) { - File[] files = myTempDir.listFiles(); - if (files != null) { - for (File file : files) { - if (!shouldKeepTmpFile(file)) { - FileUtil.delete(file); - } - } - } - } - else { - FileUtil.delete(myTempDir); - } - } - }, - () -> UIUtil.removeLeakingAppleListeners() - ).run(); - } - finally { - super.tearDown(); - // -- KOTLIN ADDITIONAL START -- - TestApplicationUtilKt.resetApplicationToNull(application); - application = null; - // -- KOTLIN ADDITIONAL END -- - } - } - - protected final void disposeRootDisposable() { - Disposer.dispose(getTestRootDisposable()); - } - - protected void addTmpFileToKeep(@NotNull File file) { - myPathsToKeep.add(file.getPath()); - } - - private boolean hasTmpFilesToKeep() { - return ourPathToKeep != null && FileUtil.isAncestor(myTempDir.getPath(), ourPathToKeep, false) || !myPathsToKeep.isEmpty(); - } - - private boolean shouldKeepTmpFile(@NotNull File file) { - String path = file.getPath(); - if (FileUtil.pathsEqual(path, ourPathToKeep)) return true; - for (String pathToKeep : myPathsToKeep) { - if (FileUtil.pathsEqual(path, pathToKeep)) return true; - } - return false; - } - - private static final Set DELETE_ON_EXIT_HOOK_DOT_FILES; - private static final Class DELETE_ON_EXIT_HOOK_CLASS; - static { - Class aClass; - try { - aClass = Class.forName("java.io.DeleteOnExitHook"); - } - catch (Exception e) { - throw new RuntimeException(e); - } - @SuppressWarnings("unchecked") Set files = ReflectionUtil.getStaticFieldValue(aClass, Set.class, "files"); - DELETE_ON_EXIT_HOOK_CLASS = aClass; - DELETE_ON_EXIT_HOOK_DOT_FILES = files; - } - - @SuppressWarnings("SynchronizeOnThis") - private static void cleanupDeleteOnExitHookList() { - // try to reduce file set retained by java.io.DeleteOnExitHook - List list; - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - if (DELETE_ON_EXIT_HOOK_DOT_FILES.isEmpty()) return; - list = new ArrayList<>(DELETE_ON_EXIT_HOOK_DOT_FILES); - } - for (int i = list.size() - 1; i >= 0; i--) { - String path = list.get(i); - File file = new File(path); - if (file.delete() || !file.exists()) { - synchronized (DELETE_ON_EXIT_HOOK_CLASS) { - DELETE_ON_EXIT_HOOK_DOT_FILES.remove(path); - } - } - } - } - - @SuppressWarnings("ConstantConditions") - private static void cleanupSwingDataStructures() throws Exception { - Object manager = ReflectionUtil.getDeclaredMethod(Class.forName("javax.swing.KeyboardManager"), "getCurrentManager").invoke(null); - Map componentKeyStrokeMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "componentKeyStrokeMap"); - componentKeyStrokeMap.clear(); - Map containerMap = ReflectionUtil.getField(manager.getClass(), manager, Hashtable.class, "containerMap"); - containerMap.clear(); - } - - @NotNull - public Disposable getTestRootDisposable() { - return myTestRootDisposable; - } - - @Override - protected void runTest() throws Throwable { - final Throwable[] throwables = new Throwable[1]; - - AtomicBoolean completed = new AtomicBoolean(false); - Runnable runnable = () -> { - try { - //TestLoggerFactory.onTestStarted(); - super.runTest(); - TestLoggerFactory.onTestFinished(true); - completed.set(true); - } - catch (InvocationTargetException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e.getTargetException(); - } - catch (IllegalAccessException e) { - TestLoggerFactory.onTestFinished(false); - e.fillInStackTrace(); - throwables[0] = e; - } - catch (Throwable e) { - TestLoggerFactory.onTestFinished(false); - throwables[0] = e; - } - }; - - invokeTestRunnable(runnable); - - if (throwables[0] != null) { - throw throwables[0]; - } - if (!completed.get()) { - throw new IllegalStateException("test didn't start"); - } - } - - protected boolean shouldRunTest() { - return TestFrameworkUtil.canRunTest(getClass()); - } - - protected void invokeTestRunnable(@NotNull Runnable runnable) throws Exception { - //IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - //if (policy != null && !policy.runInDispatchThread()) { - // runnable.run(); - //} - //else { - EdtTestUtilKt.runInEdtAndWait(() -> { - runnable.run(); - return null; - }); - //} - } - - private void defaultRunBare() throws Throwable { - Throwable exception = null; - try { - long setupStart = System.nanoTime(); - setUp(); - long setupCost = (System.nanoTime() - setupStart) / 1000000; - logPerClassCost(setupCost, TOTAL_SETUP_COST_MILLIS); - - runTest(); - } - catch (Throwable running) { - exception = running; - } - finally { - try { - long teardownStart = System.nanoTime(); - tearDown(); - long teardownCost = (System.nanoTime() - teardownStart) / 1000000; - logPerClassCost(teardownCost, TOTAL_TEARDOWN_COST_MILLIS); - } - catch (Throwable tearingDown) { - if (exception == null) exception = tearingDown; - else exception = new CompoundRuntimeException(Arrays.asList(exception, tearingDown)); - } - } - if (exception != null) throw exception; - } - - /** - * Logs the setup cost grouped by test fixture class (superclass of the current test class). - * - * @param cost setup cost in milliseconds - */ - private void logPerClassCost(long cost, @NotNull Map costMap) { - Class superclass = getClass().getSuperclass(); - Long oldCost = costMap.get(superclass.getName()); - long newCost = oldCost == null ? cost : oldCost + cost; - costMap.put(superclass.getName(), newCost); - } - - @SuppressWarnings("UseOfSystemOutOrSystemErr") - static void logSetupTeardownCosts() { - System.out.println("Setup costs"); - long totalSetup = 0; - for (Map.Entry entry : TOTAL_SETUP_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalSetup += entry.getValue(); - } - System.out.println("Teardown costs"); - long totalTeardown = 0; - for (Map.Entry entry : TOTAL_TEARDOWN_COST_MILLIS.entrySet()) { - System.out.println(String.format(" %s: %d ms", entry.getKey(), entry.getValue())); - totalTeardown += entry.getValue(); - } - System.out.println(String.format("Total overhead: setup %d ms, teardown %d ms", totalSetup, totalTeardown)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalSetupMs' value='%d']", totalSetup)); - System.out.println(String.format("##teamcity[buildStatisticValue key='ideaTests.totalTeardownMs' value='%d']", totalTeardown)); - } - - @Override - public void runBare() throws Throwable { - if (!shouldRunTest()) return; - - if (runInDispatchThread()) { - TestRunnerUtil.replaceIdeEventQueueSafely(); - com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(this::defaultRunBare); - } - else { - defaultRunBare(); - } - } - - protected boolean runInDispatchThread() { - //IdeaTestExecutionPolicy policy = IdeaTestExecutionPolicy.current(); - //if (policy != null) { - // return policy.runInDispatchThread(); - //} - return true; - } - - @NotNull - public static String toString(@NotNull Iterable collection) { - if (!collection.iterator().hasNext()) { - return ""; - } - - final StringBuilder builder = new StringBuilder(); - for (final Object o : collection) { - if (o instanceof THashSet) { - builder.append(new TreeSet<>((THashSet)o)); - } - else { - builder.append(o); - } - builder.append('\n'); - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull T[] actual, @NotNull T... expected) { - assertOrderedEquals(Arrays.asList(actual), expected); - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals("", actual, expected); - } - - public static void assertOrderedEquals(@NotNull byte[] actual, @NotNull byte[] expected) { - assertEquals(expected.length, actual.length); - for (int i = 0; i < actual.length; i++) { - byte a = actual[i]; - byte e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - public static void assertOrderedEquals(@NotNull int[] actual, @NotNull int[] expected) { - if (actual.length != expected.length) { - fail("Expected size: "+expected.length+"; actual: "+actual.length+"\nexpected: "+Arrays.toString(expected)+"\nactual : "+Arrays.toString(actual)); - } - for (int i = 0; i < actual.length; i++) { - int a = actual[i]; - int e = expected[i]; - assertEquals("not equals at index: "+i, e, a); - } - } - - @SafeVarargs - public static void assertOrderedEquals(@NotNull String errorMsg, @NotNull Iterable actual, @NotNull T... expected) { - assertOrderedEquals(errorMsg, actual, Arrays.asList(expected)); - } - - public static void assertOrderedEquals(@NotNull Iterable actual, @NotNull Iterable expected) { - assertOrderedEquals("", actual, expected); - } - - @SuppressWarnings("unchecked") - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected) { - assertOrderedEquals(errorMsg, actual, expected, Equality.CANONICAL); - } - - public static void assertOrderedEquals(@NotNull String errorMsg, - @NotNull Iterable actual, - @NotNull Iterable expected, - @NotNull Equality comparator) { - if (!equals(actual, expected, comparator)) { - String expectedString = toString(expected); - String actualString = toString(actual); - Assert.assertEquals(errorMsg, expectedString, actualString); - Assert.fail("Warning! 'toString' does not reflect the difference.\nExpected: " + expectedString + "\nActual: " + actualString); - } - } - - private static boolean equals(@NotNull Iterable a1, - @NotNull Iterable a2, - @NotNull Equality comparator) { - Iterator it1 = a1.iterator(); - Iterator it2 = a2.iterator(); - while (it1.hasNext() || it2.hasNext()) { - if (!it1.hasNext() || !it2.hasNext()) return false; - if (!comparator.equals(it1.next(), it2.next())) return false; - } - return true; - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertOrderedCollection(Arrays.asList(collection), checkers); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull T[] actual, @NotNull T... expected) { - assertSameElements(Arrays.asList(actual), expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - @SafeVarargs - public static void assertSameElements(@NotNull Collection actual, @NotNull T... expected) { - assertSameElements(actual, Arrays.asList(expected)); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull Collection actual, @NotNull Collection expected) { - assertSameElements("", actual, expected); - } - - /** - * Checks {@code actual} contains same elements (in {@link #equals(Object)} meaning) as {@code expected} irrespective of their order - */ - public static void assertSameElements(@NotNull String message, @NotNull Collection actual, @NotNull Collection expected) { - if (actual.size() != expected.size() || !new HashSet<>(expected).equals(new HashSet(actual))) { - Assert.assertEquals(message, new HashSet<>(expected), new HashSet(actual)); - } - } - - @SafeVarargs - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull T... expected) { - assertContainsOrdered(collection, Arrays.asList(expected)); - } - - public static void assertContainsOrdered(@NotNull Collection collection, @NotNull Collection expected) { - ArrayList copy = new ArrayList<>(collection); - copy.retainAll(expected); - assertOrderedEquals(toString(collection), copy, expected); - } - - @SafeVarargs - public static void assertContainsElements(@NotNull Collection collection, @NotNull T... expected) { - assertContainsElements(collection, Arrays.asList(expected)); - } - - public static void assertContainsElements(@NotNull Collection collection, @NotNull Collection expected) { - ArrayList copy = new ArrayList<>(collection); - copy.retainAll(expected); - assertSameElements(toString(collection), copy, expected); - } - - @NotNull - public static String toString(@NotNull Object[] collection, @NotNull String separator) { - return toString(Arrays.asList(collection), separator); - } - - @SafeVarargs - public static void assertDoesntContain(@NotNull Collection collection, @NotNull T... notExpected) { - assertDoesntContain(collection, Arrays.asList(notExpected)); - } - - public static void assertDoesntContain(@NotNull Collection collection, @NotNull Collection notExpected) { - ArrayList expected = new ArrayList<>(collection); - expected.removeAll(notExpected); - assertSameElements(collection, expected); - } - - @NotNull - public static String toString(@NotNull Collection collection, @NotNull String separator) { - List list = ContainerUtil.map2List(collection, String::valueOf); - Collections.sort(list); - StringBuilder builder = new StringBuilder(); - boolean flag = false; - for (final String o : list) { - if (flag) { - builder.append(separator); - } - builder.append(o); - flag = true; - } - return builder.toString(); - } - - @SafeVarargs - public static void assertOrderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - int i = 0; - for (final T actual : collection) { - try { - checkers[i].consume(actual); - } - catch (AssertionFailedError e) { - //noinspection UseOfSystemOutOrSystemErr - System.out.println(i + ": " + actual); - throw e; - } - i++; - } - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull T[] collection, @NotNull Consumer... checkers) { - assertUnorderedCollection(Arrays.asList(collection), checkers); - } - - @SafeVarargs - public static void assertUnorderedCollection(@NotNull Collection collection, @NotNull Consumer... checkers) { - if (collection.size() != checkers.length) { - Assert.fail(toString(collection)); - } - Set> checkerSet = new HashSet<>(Arrays.asList(checkers)); - int i = 0; - Throwable lastError = null; - for (final T actual : collection) { - boolean flag = true; - for (final Consumer condition : checkerSet) { - Throwable error = accepts(condition, actual); - if (error == null) { - checkerSet.remove(condition); - flag = false; - break; - } - else { - lastError = error; - } - } - if (flag) { - //noinspection ConstantConditions,CallToPrintStackTrace - lastError.printStackTrace(); - Assert.fail("Incorrect element(" + i + "): " + actual); - } - i++; - } - } - - private static Throwable accepts(@NotNull Consumer condition, final T actual) { - try { - condition.consume(actual); - return null; - } - catch (Throwable e) { - return e; - } - } - - @Contract("null, _ -> fail") - @NotNull - public static T assertInstanceOf(Object o, @NotNull Class aClass) { - Assert.assertNotNull("Expected instance of: " + aClass.getName() + " actual: " + null, o); - Assert.assertTrue("Expected instance of: " + aClass.getName() + " actual: " + o.getClass().getName(), aClass.isInstance(o)); - @SuppressWarnings("unchecked") T t = (T)o; - return t; - } - - public static T assertOneElement(@NotNull Collection collection) { - Iterator iterator = collection.iterator(); - String toString = toString(collection); - Assert.assertTrue(toString, iterator.hasNext()); - T t = iterator.next(); - Assert.assertFalse(toString, iterator.hasNext()); - return t; - } - - public static T assertOneElement(@NotNull T[] ts) { - Assert.assertEquals(Arrays.asList(ts).toString(), 1, ts.length); - return ts[0]; - } - - @SafeVarargs - public static void assertOneOf(T value, @NotNull T... values) { - for (T v : values) { - if (Objects.equals(value, v)) { - return; - } - } - Assert.fail(value + " should be equal to one of " + Arrays.toString(values)); - } - - public static void printThreadDump() { - PerformanceWatcher.dumpThreadsToConsole("Thread dump:"); - } - - public static void assertEmpty(@NotNull Object[] array) { - assertOrderedEquals(array); - } - - public static void assertNotEmpty(final Collection collection) { - assertNotNull(collection); - assertFalse(collection.isEmpty()); - } - - public static void assertEmpty(@NotNull Collection collection) { - assertEmpty(collection.toString(), collection); - } - - public static void assertNullOrEmpty(@Nullable Collection collection) { - if (collection == null) return; - assertEmpty("", collection); - } - - public static void assertEmpty(final String s) { - assertTrue(s, StringUtil.isEmpty(s)); - } - - public static void assertEmpty(@NotNull String errorMsg, @NotNull Collection collection) { - assertOrderedEquals(errorMsg, collection, Collections.emptyList()); - } - - public static void assertSize(int expectedSize, @NotNull Object[] array) { - if (array.length != expectedSize) { - assertEquals(toString(Arrays.asList(array)), expectedSize, array.length); - } - } - - public static void assertSize(int expectedSize, @NotNull Collection c) { - if (c.size() != expectedSize) { - assertEquals(toString(c), expectedSize, c.size()); - } - } - - @NotNull - protected T disposeOnTearDown(@NotNull T disposable) { - Disposer.register(getTestRootDisposable(), disposable); - return disposable; - } - - public static void assertSameLines(@NotNull String expected, @NotNull String actual) { - assertSameLines(null, expected, actual); - } - - public static void assertSameLines(@Nullable String message, @NotNull String expected, @NotNull String actual) { - String expectedText = StringUtil.convertLineSeparators(expected.trim()); - String actualText = StringUtil.convertLineSeparators(actual.trim()); - Assert.assertEquals(message, expectedText, actualText); - } - - public static void assertExists(@NotNull File file){ - assertTrue("File should exist " + file, file.exists()); - } - - public static void assertDoesntExist(@NotNull File file){ - assertFalse("File should not exist " + file, file.exists()); - } - - @NotNull - protected String getTestName(boolean lowercaseFirstLetter) { - return getTestName(getName(), lowercaseFirstLetter); - } - - @NotNull - public static String getTestName(@Nullable String name, boolean lowercaseFirstLetter) { - return name == null ? "" : PlatformTestUtil.getTestName(name, lowercaseFirstLetter); - } - - @NotNull - protected String getTestDirectoryName() { - final String testName = getTestName(true); - return testName.replaceAll("_.*", ""); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText) { - assertSameLinesWithFile(filePath, actualText, true); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - @NotNull Supplier messageProducer) { - assertSameLinesWithFile(filePath, actualText, true, messageProducer); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, @NotNull String actualText, boolean trimBeforeComparing) { - assertSameLinesWithFile(filePath, actualText, trimBeforeComparing, null); - } - - public static void assertSameLinesWithFile(@NotNull String filePath, - @NotNull String actualText, - boolean trimBeforeComparing, - @Nullable Supplier messageProducer) { - String fileText; - try { - if (OVERWRITE_TESTDATA) { - VfsTestUtil.overwriteTestData(filePath, actualText); - //noinspection UseOfSystemOutOrSystemErr - System.out.println("File " + filePath + " created."); - } - fileText = FileUtil.loadFile(new File(filePath), CharsetToolkit.UTF8_CHARSET); - } - catch (FileNotFoundException e) { - VfsTestUtil.overwriteTestData(filePath, actualText); - throw new AssertionFailedError("No output text found. File " + filePath + " created."); - } - catch (IOException e) { - throw new RuntimeException(e); - } - String expected = StringUtil.convertLineSeparators(trimBeforeComparing ? fileText.trim() : fileText); - String actual = StringUtil.convertLineSeparators(trimBeforeComparing ? actualText.trim() : actualText); - if (!Comparing.equal(expected, actual)) { - throw new FileComparisonFailure(messageProducer == null ? null : messageProducer.get(), expected, actual, filePath); - } - } - - protected static void clearFields(@NotNull Object test) throws IllegalAccessException { - Class aClass = test.getClass(); - while (aClass != null) { - clearDeclaredFields(test, aClass); - aClass = aClass.getSuperclass(); - } - } - - public static void clearDeclaredFields(@NotNull Object test, @NotNull Class aClass) throws IllegalAccessException { - for (final Field field : aClass.getDeclaredFields()) { - final String name = field.getDeclaringClass().getName(); - if (!name.startsWith("junit.framework.") && !name.startsWith("com.intellij.testFramework.")) { - final int modifiers = field.getModifiers(); - if ((modifiers & Modifier.FINAL) == 0 && (modifiers & Modifier.STATIC) == 0 && !field.getType().isPrimitive()) { - field.setAccessible(true); - field.set(test, null); - } - } - } - } - - private static void checkCodeStyleSettingsEqual(@NotNull CodeStyleSettings expected, @NotNull CodeStyleSettings settings) { - if (!expected.equals(settings)) { - Element oldS = new Element("temp"); - expected.writeExternal(oldS); - Element newS = new Element("temp"); - settings.writeExternal(newS); - - String newString = JDOMUtil.writeElement(newS); - String oldString = JDOMUtil.writeElement(oldS); - Assert.assertEquals("Code style settings damaged", oldString, newString); - } - } - - public boolean isPerformanceTest() { - String testName = getName(); - String className = getClass().getSimpleName(); - return TestFrameworkUtil.isPerformanceTest(testName, className); - } - - /** - * @return true for a test which performs A LOT of computations. - * Such test should typically avoid performing expensive checks, e.g. data structure consistency complex validations. - * If you want your test to be treated as "Stress", please mention one of these words in its name: "Stress", "Slow". - * For example: {@code public void testStressPSIFromDifferentThreads()} - */ - public boolean isStressTest() { - return isStressTest(getName(), getClass().getName()); - } - - private static boolean isStressTest(String testName, String className) { - return TestFrameworkUtil.isPerformanceTest(testName, className) || - containsStressWords(testName) || - containsStressWords(className); - } - - private static boolean containsStressWords(@Nullable String name) { - return name != null && (name.contains("Stress") || name.contains("Slow")); - } - - - /** - * Checks that code block throw corresponding exception with expected error msg. - * If expected error message is null it will not be checked. - * - * @param exceptionCase Block annotated with some exception type - * @param expectedErrorMsg expected error message - */ - @SuppressWarnings("unchecked") - protected void assertException(@NotNull AbstractExceptionCase exceptionCase, @Nullable String expectedErrorMsg) { - assertExceptionOccurred(true, exceptionCase, expectedErrorMsg); - } - - /** - * Checks that code block doesn't throw corresponding exception. - * - * @param exceptionCase Block annotated with some exception type - */ - protected void assertNoException(@NotNull AbstractExceptionCase exceptionCase) throws T { - assertExceptionOccurred(false, exceptionCase, null); - } - - protected void assertNoThrowable(@NotNull Runnable closure) { - String throwableName = null; - try { - closure.run(); - } - catch (Throwable thr) { - throwableName = thr.getClass().getName(); - } - assertNull(throwableName); - } - - private static void assertExceptionOccurred(boolean shouldOccur, - @NotNull AbstractExceptionCase exceptionCase, - String expectedErrorMsg) throws T { - boolean wasThrown = false; - try { - exceptionCase.tryClosure(); - } - catch (Throwable e) { - if (shouldOccur) { - wasThrown = true; - final String errorMessage = exceptionCase.getAssertionErrorMessage(); - assertEquals(errorMessage, exceptionCase.getExpectedExceptionClass(), e.getClass()); - if (expectedErrorMsg != null) { - assertEquals("Compare error messages", expectedErrorMsg, e.getMessage()); - } - } - else if (exceptionCase.getExpectedExceptionClass().equals(e.getClass())) { - wasThrown = true; - - //noinspection UseOfSystemOutOrSystemErr - System.out.println(); - //noinspection UseOfSystemOutOrSystemErr - e.printStackTrace(System.out); - - fail("Exception isn't expected here. Exception message: " + e.getMessage()); - } - else { - throw e; - } - } - finally { - if (shouldOccur && !wasThrown) { - fail(exceptionCase.getAssertionErrorMessage()); - } - } - } - - protected boolean annotatedWith(@NotNull Class annotationClass) { - Class aClass = getClass(); - String methodName = "test" + getTestName(false); - boolean methodChecked = false; - while (aClass != null && aClass != Object.class) { - if (aClass.getAnnotation(annotationClass) != null) return true; - if (!methodChecked) { - Method method = ReflectionUtil.getDeclaredMethod(aClass, methodName); - if (method != null) { - if (method.getAnnotation(annotationClass) != null) return true; - methodChecked = true; - } - } - aClass = aClass.getSuperclass(); - } - return false; - } - - @NotNull - protected String getHomePath() { - return PathManager.getHomePath().replace(File.separatorChar, '/'); - } - - public static void refreshRecursively(@NotNull VirtualFile file) { - VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() { - @Override - public boolean visitFile(@NotNull VirtualFile file) { - file.getChildren(); - return true; - } - }); - file.refresh(false, true); - } - - @Nullable - public static VirtualFile refreshAndFindFile(@NotNull final File file) { - return UIUtil.invokeAndWaitIfNeeded(() -> LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)); - } - - protected class TestDisposable implements Disposable { - private volatile boolean myDisposed; - - public TestDisposable() { - } - - @Override - public void dispose() { - myDisposed = true; - } - - public boolean isDisposed() { - return myDisposed; - } - - @Override - public String toString() { - String testName = getTestName(false); - return KtUsefulTestCase.this.getClass() + (StringUtil.isEmpty(testName) ? "" : ".test" + testName); - } - }; -} diff --git a/gradle/versions.properties.193 b/gradle/versions.properties.193 deleted file mode 100644 index 0d985de36f1..00000000000 --- a/gradle/versions.properties.193 +++ /dev/null @@ -1,18 +0,0 @@ -versions.intellijSdk=193.6494.35 -versions.androidBuildTools=r23.0.1 -versions.idea.NodeJS=181.3494.12 -versions.jar.asm-all=7.0.1 -versions.jar.guava=27.1-jre -versions.jar.groovy-all=2.4.17 -versions.jar.lombok-ast=0.2.3 -versions.jar.swingx-core=1.6.2-2 -versions.jar.kxml2=2.3.0 -versions.jar.streamex=0.6.8 -versions.jar.gson=2.8.5 -versions.jar.oro=2.0.8 -versions.jar.picocontainer=1.2 -versions.jar.serviceMessages=2019.1.4 -versions.jar.lz4-java=1.6.0 -ignore.jar.snappy-in-java=true -versions.gradle-api=4.5.1 -versions.shadow=5.2.0 \ No newline at end of file diff --git a/idea/ide-common/src/org/jetbrains/kotlin/util/AbstractKotlinBundle.kt.193 b/idea/ide-common/src/org/jetbrains/kotlin/util/AbstractKotlinBundle.kt.193 deleted file mode 100644 index b7670d34e5d..00000000000 --- a/idea/ide-common/src/org/jetbrains/kotlin/util/AbstractKotlinBundle.kt.193 +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.util - -import com.intellij.AbstractBundle - -abstract class AbstractKotlinBundle protected constructor(pathToBundle: String) : AbstractBundle(pathToBundle) { - protected fun String.withHtml(): String = "$this" -} \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/compat.kt.193 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/compat.kt.193 deleted file mode 100644 index 1b2cf1f7396..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/compat.kt.193 +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.caches - -import com.intellij.psi.PsiMethod -import com.intellij.util.Processor - -// FIX ME WHEN BUNCH 193 REMOVED -typealias StringProcessor = Processor -typealias PsiMethodProcessor = Processor - diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt.193 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt.193 deleted file mode 100644 index 107e57169c9..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/AnnotationPresentationInfo.kt.193 +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.highlighter - -import com.intellij.codeInsight.intention.EmptyIntentionAction -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.codeInspection.ProblemHighlightType -import com.intellij.lang.annotation.Annotation -import com.intellij.lang.annotation.AnnotationHolder -import com.intellij.openapi.editor.colors.TextAttributesKey -import com.intellij.openapi.util.TextRange -import com.intellij.util.containers.MultiMap -import org.jetbrains.kotlin.diagnostics.Diagnostic -import org.jetbrains.kotlin.diagnostics.Severity -import org.jetbrains.kotlin.idea.inspections.KotlinUniversalQuickFix - -class AnnotationPresentationInfo( - val ranges: List, - val nonDefaultMessage: String? = null, - val highlightType: ProblemHighlightType? = null, - val textAttributes: TextAttributesKey? = null -) { - - fun processDiagnostics(holder: AnnotationHolder, diagnostics: List, fixesMap: MultiMap) { - for (range in ranges) { - for (diagnostic in diagnostics) { - val fixes = fixesMap[diagnostic] - val annotation = create(diagnostic, range, holder) - - fixes.forEach { - when (it) { - is KotlinUniversalQuickFix -> annotation.registerUniversalFix(it, null, null) - is IntentionAction -> annotation.registerFix(it) - } - } - - if (diagnostic.severity == Severity.WARNING) { - annotation.problemGroup = KotlinSuppressableWarningProblemGroup(diagnostic.factory) - - if (fixes.isEmpty()) { - // if there are no quick fixes we need to register an EmptyIntentionAction to enable 'suppress' actions - annotation.registerFix(EmptyIntentionAction(diagnostic.factory.name)) - } - } - } - } - } - - private fun create(diagnostic: Diagnostic, range: TextRange, holder: AnnotationHolder): Annotation = - Diagnostic2Annotation.createAnnotation( - diagnostic, - range, - holder, - nonDefaultMessage, - textAttributes, - highlightType, - IdeErrorMessages::render - ) -} diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.193 b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.193 deleted file mode 100644 index 053f070e51d..00000000000 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/modules/ModuleHighlightUtil2.java.193 +++ /dev/null @@ -1,114 +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.modules; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.ProjectFileIndex; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiFile; -import com.intellij.psi.PsiJavaFile; -import com.intellij.psi.PsiJavaModule; -import com.intellij.psi.PsiManager; -import com.intellij.psi.impl.light.LightJavaModule; -import kotlin.collections.ArraysKt; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.core.FileIndexUtilsKt; - -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import static com.intellij.psi.PsiJavaModule.MODULE_INFO_FILE; - -// Copied from com.intellij.codeInsight.daemon.impl.analysis.ModuleHighlightUtil -public class ModuleHighlightUtil2 { - private static final Attributes.Name MULTI_RELEASE = new Attributes.Name("Multi-Release"); - - @Nullable - static PsiJavaModule getModuleDescriptor(@NotNull VirtualFile file, @NotNull Project project) { - ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(project); - if (index.isInLibrary(file)) { - VirtualFile root; - if ((root = index.getClassRootForFile(file)) != null) { - VirtualFile descriptorFile = root.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE); - if (descriptorFile == null) { - VirtualFile alt = root.findFileByRelativePath("META-INF/versions/9/" + PsiJavaModule.MODULE_INFO_CLS_FILE); - if (alt != null && isMultiReleaseJar(root)) { - descriptorFile = alt; - } - } - if (descriptorFile != null) { - PsiFile psiFile = PsiManager.getInstance(project).findFile(descriptorFile); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - else if (root.getFileSystem() instanceof JarFileSystem && "jar".equalsIgnoreCase(root.getExtension())) { - return LightJavaModule.getModule(PsiManager.getInstance(project), root); - } - } - else if ((root = index.getSourceRootForFile(file)) != null) { - VirtualFile descriptorFile = root.findChild(MODULE_INFO_FILE); - if (descriptorFile != null) { - PsiFile psiFile = PsiManager.getInstance(project).findFile(descriptorFile); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - } - } - else { - Module module = index.getModuleForFile(file); - if (module != null) { - boolean isTest = FileIndexUtilsKt.isInTestSourceContentKotlinAware(index, file); - VirtualFile modularRoot = ArraysKt.singleOrNull(ModuleRootManager.getInstance(module).getSourceRoots(isTest), - root -> root.findChild(MODULE_INFO_FILE) != null); - if (modularRoot != null) { - VirtualFile moduleInfo = modularRoot.findChild(MODULE_INFO_FILE); - assert moduleInfo != null : modularRoot; - PsiFile psiFile = PsiManager.getInstance(project).findFile(moduleInfo); - if (psiFile instanceof PsiJavaFile) { - return ((PsiJavaFile) psiFile).getModuleDeclaration(); - } - } - } - } - - return null; - } - - private static boolean isMultiReleaseJar(VirtualFile root) { - if (root.getFileSystem() instanceof JarFileSystem) { - VirtualFile manifest = root.findFileByRelativePath(JarFile.MANIFEST_NAME); - if (manifest != null) { - try (InputStream stream = manifest.getInputStream()) { - return Boolean.valueOf(new Manifest(stream).getMainAttributes().getValue(MULTI_RELEASE)); - } - catch (IOException ignored) { - } - } - } - - return false; - } -} diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/compat.kt.193 b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/compat.kt.193 deleted file mode 100644 index fdd15cc431c..00000000000 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/handlers/compat.kt.193 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.completion.test.handlers - -import com.intellij.codeInsight.lookup.impl.LookupImpl - -// FIX ME WHEN BUNCH 193 REMOVED -fun LookupImpl.setFocusedFocusDegree() { - focusDegree = LookupImpl.FocusDegree.FOCUSED -} \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/AbstractKotlinBundleIndependent.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/AbstractKotlinBundleIndependent.kt.193 deleted file mode 100644 index 520bae7804c..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/AbstractKotlinBundleIndependent.kt.193 +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea - -import com.intellij.AbstractBundle - -abstract class AbstractKotlinBundleIndependent protected constructor(pathToBundle: String) : AbstractBundle(pathToBundle) { - protected fun String.withHtml(): String = "$this" -} \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/KotlinCodeBlockModificationListener.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/KotlinCodeBlockModificationListener.kt.193 deleted file mode 100644 index 49e33e28d1d..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/caches/trackers/KotlinCodeBlockModificationListener.kt.193 +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - - -package org.jetbrains.kotlin.idea.caches.trackers - -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.SimpleModificationTracker -import com.intellij.pom.tree.TreeAspect -import org.jetbrains.kotlin.idea.KotlinLanguage - -/** - * Tested in OutOfBlockModificationTestGenerated - */ -// FIX ME WHEN BUNCH 193 REMOVED -class KotlinCodeBlockModificationListener( - project: Project, - treeAspect: TreeAspect -) : KotlinCodeBlockModificationListenerCompat(project) { - - init { - init( - treeAspect, - incOCBCounter = { ktFile -> - kotlinOutOfCodeBlockTrackerImpl.incModificationCount() - perModuleOutOfCodeBlockTrackerUpdater.onKotlinPhysicalFileOutOfBlockChange(ktFile, true) - }, - kotlinOutOfCodeBlockTrackerProducer = { - SimpleModificationTracker() - }, - psiModificationTrackerListener = { - @Suppress("UnstableApiUsage") - val kotlinTrackerInternalIDECount = - modificationTrackerImpl.forLanguage(KotlinLanguage.INSTANCE).modificationCount - if (kotlinModificationTracker == kotlinTrackerInternalIDECount) { - // Some update that we are not sure is from Kotlin language, as Kotlin language tracker wasn't changed - kotlinOutOfCodeBlockTrackerImpl.incModificationCount() - } else { - kotlinModificationTracker = kotlinTrackerInternalIDECount - } - - perModuleOutOfCodeBlockTrackerUpdater.onPsiModificationTrackerUpdate() - } - ) - } - - companion object { - fun getInstance(project: Project): KotlinCodeBlockModificationListener = - project.getComponent(KotlinCodeBlockModificationListener::class.java) - } -} diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypes.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypes.kt.193 deleted file mode 100644 index 466ab209ae5..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypes.kt.193 +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.findUsages - -import com.intellij.usages.impl.rules.UsageType -import org.jetbrains.kotlin.idea.KotlinBundleIndependent - -object KotlinUsageTypes { - - internal fun UsageTypeEnum.toUsageType(): UsageType = when (this) { - UsageTypeEnum.TYPE_CONSTRAINT -> TYPE_CONSTRAINT - UsageTypeEnum.VALUE_PARAMETER_TYPE -> VALUE_PARAMETER_TYPE - UsageTypeEnum.NON_LOCAL_PROPERTY_TYPE -> NON_LOCAL_PROPERTY_TYPE - UsageTypeEnum.FUNCTION_RETURN_TYPE -> FUNCTION_RETURN_TYPE - UsageTypeEnum.SUPER_TYPE -> SUPER_TYPE - UsageTypeEnum.IS -> IS - UsageTypeEnum.CLASS_OBJECT_ACCESS -> CLASS_OBJECT_ACCESS - UsageTypeEnum.COMPANION_OBJECT_ACCESS -> COMPANION_OBJECT_ACCESS - UsageTypeEnum.EXTENSION_RECEIVER_TYPE -> EXTENSION_RECEIVER_TYPE - UsageTypeEnum.SUPER_TYPE_QUALIFIER -> SUPER_TYPE_QUALIFIER - UsageTypeEnum.TYPE_ALIAS -> TYPE_ALIAS - - UsageTypeEnum.FUNCTION_CALL -> FUNCTION_CALL - UsageTypeEnum.IMPLICIT_GET -> IMPLICIT_GET - UsageTypeEnum.IMPLICIT_SET -> IMPLICIT_SET - UsageTypeEnum.IMPLICIT_INVOKE -> IMPLICIT_INVOKE - UsageTypeEnum.IMPLICIT_ITERATION -> IMPLICIT_ITERATION - UsageTypeEnum.PROPERTY_DELEGATION -> PROPERTY_DELEGATION - - UsageTypeEnum.RECEIVER -> RECEIVER - UsageTypeEnum.DELEGATE -> DELEGATE - - UsageTypeEnum.PACKAGE_DIRECTIVE -> PACKAGE_DIRECTIVE - UsageTypeEnum.PACKAGE_MEMBER_ACCESS -> PACKAGE_MEMBER_ACCESS - - UsageTypeEnum.CALLABLE_REFERENCE -> CALLABLE_REFERENCE - - UsageTypeEnum.READ -> UsageType.READ - UsageTypeEnum.WRITE -> UsageType.WRITE - UsageTypeEnum.CLASS_IMPORT -> UsageType.CLASS_IMPORT - UsageTypeEnum.CLASS_LOCAL_VAR_DECLARATION -> UsageType.CLASS_LOCAL_VAR_DECLARATION - UsageTypeEnum.TYPE_PARAMETER -> UsageType.TYPE_PARAMETER - UsageTypeEnum.CLASS_CAST_TO -> UsageType.CLASS_CAST_TO - UsageTypeEnum.ANNOTATION -> UsageType.ANNOTATION - UsageTypeEnum.CLASS_NEW_OPERATOR -> UsageType.CLASS_NEW_OPERATOR - UsageTypeEnum.NAMED_ARGUMENT -> NAMED_ARGUMENT - - UsageTypeEnum.USAGE_IN_STRING_LITERAL -> UsageType.LITERAL_USAGE - } - - // types - val TYPE_CONSTRAINT = UsageType(KotlinBundleIndependent.message("find.usages.type.type.constraint")) - val VALUE_PARAMETER_TYPE = UsageType(KotlinBundleIndependent.message("find.usages.type.value.parameter.type")) - val NON_LOCAL_PROPERTY_TYPE = UsageType(KotlinBundleIndependent.message("find.usages.type.nonLocal.property.type")) - val FUNCTION_RETURN_TYPE = UsageType(KotlinBundleIndependent.message("find.usages.type.function.return.type")) - val SUPER_TYPE = UsageType(KotlinBundleIndependent.message("find.usages.type.superType")) - val IS = UsageType(KotlinBundleIndependent.message("find.usages.type.is")) - val CLASS_OBJECT_ACCESS = UsageType(KotlinBundleIndependent.message("find.usages.type.class.object")) - val COMPANION_OBJECT_ACCESS = UsageType(KotlinBundleIndependent.message("find.usages.type.companion.object")) - val EXTENSION_RECEIVER_TYPE = UsageType(KotlinBundleIndependent.message("find.usages.type.extension.receiver.type")) - val SUPER_TYPE_QUALIFIER = UsageType(KotlinBundleIndependent.message("find.usages.type.super.type.qualifier")) - val TYPE_ALIAS = UsageType(KotlinBundleIndependent.message("find.usages.type.type.alias")) - - // functions - val FUNCTION_CALL = UsageType(KotlinBundleIndependent.message("find.usages.type.function.call")) - val IMPLICIT_GET = UsageType(KotlinBundleIndependent.message("find.usages.type.implicit.get")) - val IMPLICIT_SET = UsageType(KotlinBundleIndependent.message("find.usages.type.implicit.set")) - val IMPLICIT_INVOKE = UsageType(KotlinBundleIndependent.message("find.usages.type.implicit.invoke")) - val IMPLICIT_ITERATION = UsageType(KotlinBundleIndependent.message("find.usages.type.implicit.iteration")) - val PROPERTY_DELEGATION = UsageType(KotlinBundleIndependent.message("find.usages.type.property.delegation")) - - // values - val RECEIVER = UsageType(KotlinBundleIndependent.message("find.usages.type.receiver")) - val DELEGATE = UsageType(KotlinBundleIndependent.message("find.usages.type.delegate")) - - // packages - val PACKAGE_DIRECTIVE = UsageType(KotlinBundleIndependent.message("find.usages.type.packageDirective")) - val PACKAGE_MEMBER_ACCESS = UsageType(KotlinBundleIndependent.message("find.usages.type.packageMemberAccess")) - - // common usage types - val CALLABLE_REFERENCE = UsageType(KotlinBundleIndependent.message("find.usages.type.callable.reference")) - val NAMED_ARGUMENT = UsageType(KotlinBundleIndependent.message("find.usages.type.named.argument")) -} \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/handlers/compat.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/handlers/compat.kt.193 deleted file mode 100644 index 7fbb5130f69..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/findUsages/handlers/compat.kt.193 +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.findUsages.handlers - -import com.intellij.slicer.SliceUsage -import com.intellij.usageView.UsageInfo -import com.intellij.util.Processor - -// FIX ME WHEN BUNCH 193 REMOVED -typealias UsageInfoProcessor = Processor -typealias SliceUsageProcessor = Processor \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReferenceScopeOptimizer.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReferenceScopeOptimizer.kt.193 deleted file mode 100644 index 4a72c824f0a..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReferenceScopeOptimizer.kt.193 +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.search.ideaExtensions - -import com.intellij.ide.highlighter.JavaFileType -import com.intellij.psi.PsiElement -import com.intellij.psi.impl.cache.CacheManager -import com.intellij.psi.search.GlobalSearchScope -import com.intellij.psi.search.ScopeOptimizer -import com.intellij.psi.search.SearchScope -import com.intellij.psi.search.UsageSearchContext -import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.search.excludeFileTypes -import org.jetbrains.kotlin.psi.KtCallableDeclaration -import org.jetbrains.kotlin.psi.KtFile - -class KotlinReferenceScopeOptimizer : ScopeOptimizer { - override fun getRestrictedUseScope(element: PsiElement): SearchScope? { - if (element is KtCallableDeclaration && element.parent is KtFile) { - return getRestrictedScopeForTopLevelCallable(element) - } - return null - } - - private fun getRestrictedScopeForTopLevelCallable(callable: KtCallableDeclaration): GlobalSearchScope? { - val useScope = callable.useScope as? GlobalSearchScope ?: return null - val file = callable.parent as KtFile - val packageName = file.packageFqName.takeUnless { it.isRoot } ?: return null - val project = file.project - val cacheManager = CacheManager.SERVICE.getInstance(project) - - val kotlinScope = GlobalSearchScope.getScopeRestrictedByFileTypes(useScope, KotlinFileType.INSTANCE) - val javaScope = GlobalSearchScope.getScopeRestrictedByFileTypes(useScope, JavaFileType.INSTANCE) - val restScope = useScope.excludeFileTypes(KotlinFileType.INSTANCE, JavaFileType.INSTANCE) as GlobalSearchScope - - //TODO: use all components of package name? - val shortPackageName = packageName.shortName().identifier - val kotlinFiles = cacheManager.getVirtualFilesWithWord(shortPackageName, UsageSearchContext.IN_CODE, kotlinScope, true) - - val javaFacadeName = file.javaFileFacadeFqName.shortName().identifier - val javaFiles = cacheManager.getVirtualFilesWithWord(javaFacadeName, UsageSearchContext.IN_CODE, javaScope, true) - - return GlobalSearchScope.filesScope(project, (kotlinFiles + javaFiles).asList()).uniteWith(restScope) - } -} \ No newline at end of file diff --git a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.193 b/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.193 deleted file mode 100644 index 01f484152d8..00000000000 --- a/idea/idea-frontend-independent/src/org/jetbrains/kotlin/idea/util/ApplicationUtils.kt.193 +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.util.application - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.command.CommandProcessor -import com.intellij.openapi.components.ComponentManager -import com.intellij.openapi.project.Project -import org.jetbrains.annotations.Nls -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.util.Condition - -fun runReadAction(action: () -> T): T { - return ApplicationManager.getApplication().runReadAction(action) -} - -fun runWriteAction(action: () -> T): T { - return ApplicationManager.getApplication().runWriteAction(action) -} - -fun Project.executeWriteCommand(@Nls name: String, command: () -> Unit) { - CommandProcessor.getInstance().executeCommand(this, { runWriteAction(command) }, name, null) -} - -fun Project.executeWriteCommand(@Nls name: String, groupId: Any? = null, command: () -> T): T { - return executeCommand(name, groupId) { runWriteAction(command) } -} - -fun Project.executeCommand(@Nls name: String, groupId: Any? = null, command: () -> T): T { - @Suppress("UNCHECKED_CAST") var result: T = null as T - CommandProcessor.getInstance().executeCommand(this, { result = command() }, name, groupId) - @Suppress("USELESS_CAST") - return result as T -} - -fun runWithCancellationCheck(block: () -> T): T = block() - -inline fun executeOnPooledThread(crossinline action: () -> Unit) = - ApplicationManager.getApplication().executeOnPooledThread { action() } - -inline fun invokeLater(crossinline action: () -> Unit) = - ApplicationManager.getApplication().invokeLater { action() } - -inline fun invokeLater(expired: Condition<*>, crossinline action: () -> Unit) = - ApplicationManager.getApplication().invokeLater({ action() }, expired) - -inline fun isUnitTestMode(): Boolean = ApplicationManager.getApplication().isUnitTestMode - -inline fun ComponentManager.getServiceSafe(): T = - this.getService(T::class.java) ?: error("Unable to locate service ${T::class.java.name}") - -fun Project.runReadActionInSmartMode(action: () -> T): T { - if (ApplicationManager.getApplication().isReadAccessAllowed) return action() - return DumbService.getInstance(this).runReadActionInSmartMode(action) -} \ No newline at end of file diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorPosition.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorPosition.java.193 deleted file mode 100644 index d94fed03bd7..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorPosition.java.193 +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - -import org.gradle.api.Incubating; - - -/** - * Position in the editor. - * - * @since 6.0 - */ -@Incubating -public interface EditorPosition { - - int getLine(); - - int getColumn(); -} diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReport.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReport.java.193 deleted file mode 100644 index b531d2a8646..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReport.java.193 +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - -import org.gradle.api.Incubating; - -/** - * Report to the editor. - * - * @since 6.0 - */ -@Incubating -public interface EditorReport { - - EditorReportSeverity getSeverity(); - - String getMessage(); - - EditorPosition getPosition(); -} diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReportSeverity.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReportSeverity.java.193 deleted file mode 100644 index 0e0997a14e6..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/EditorReportSeverity.java.193 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - - -import org.gradle.api.Incubating; - -/** - * Severity of an editor report. - * - * @since 6.0 - */ -@Incubating -public enum EditorReportSeverity { - WARNING, - ERROR -} diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslModelsParameters.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslModelsParameters.java.193 deleted file mode 100644 index 460f3b344ac..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslModelsParameters.java.193 +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - -import org.gradle.api.Incubating; - - -/** - * Parameters for Kotlin DSL models. - * - * @since 6.0 - */ -@Incubating -public final class KotlinDslModelsParameters { - - public static final String PREPARATION_TASK_NAME = "prepareKotlinBuildScriptModel"; - - public static final String CORRELATION_ID_GRADLE_PROPERTY_NAME = "org.gradle.kotlin.dsl.provider.cid"; - - public static final String PROVIDER_MODE_SYSTEM_PROPERTY_NAME = "org.gradle.kotlin.dsl.provider.mode"; - - public static final String CLASSPATH_MODE_SYSTEM_PROPERTY_VALUE = "classpath"; - - public static final String STRICT_CLASSPATH_MODE_SYSTEM_PROPERTY_VALUE = "strict-classpath"; - - public static final String CLASSPATH_MODE_SYSTEM_PROPERTY_DECLARATION = "-D" + PROVIDER_MODE_SYSTEM_PROPERTY_NAME + "=" + CLASSPATH_MODE_SYSTEM_PROPERTY_VALUE; - - public static final String STRICT_CLASSPATH_MODE_SYSTEM_PROPERTY_DECLARATION = "-D" + PROVIDER_MODE_SYSTEM_PROPERTY_NAME + "=" + STRICT_CLASSPATH_MODE_SYSTEM_PROPERTY_VALUE; -} diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptModel.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptModel.java.193 deleted file mode 100644 index 17e1abfee9b..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptModel.java.193 +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - -import org.gradle.api.Incubating; - -import java.io.File; -import java.util.List; - - -/** - * Model for a Kotlin DSL script. - * - * @since 6.0 - */ -@Incubating -public interface KotlinDslScriptModel { - - List getClassPath(); - - List getSourcePath(); - - List getImplicitImports(); - - List getEditorReports(); - - List getExceptions(); -} diff --git a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptsModel.java.193 b/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptsModel.java.193 deleted file mode 100644 index f444988ddb4..00000000000 --- a/idea/idea-gradle-tooling-api/src/org/gradle/tooling/model/kotlin/dsl/KotlinDslScriptsModel.java.193 +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2019 the original author or authors. - * - * 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.gradle.tooling.model.kotlin.dsl; - -import org.gradle.api.Incubating; - -import java.io.File; -import java.util.Map; - - -/** - * Editor model for a set of Kotlin DSL scripts. - * - * Can only be requested on the root project, the builder will throw otherwise. - * - * Requires the prepareKotlinBuildScriptModel task to be executed before building the model. - * See {@link KotlinDslModelsParameters#PREPARATION_TASK_NAME} - * - * The set of scripts can be provided as a Gradle property named org.gradle.kotlin.dsl.provider.scripts, - * as a list of absolute paths separated by |. - * If none are provided, then the model is built for all the Kotlin DSL scripts known to belong to this build. - * See {@link KotlinDslScriptsModel#SCRIPTS_GRADLE_PROPERTY_NAME}. - * - * The Gradle Kotlin DSL script provider must be running in "classpath" mode. - * This is done by providing the system property -Dorg.gradle.kotlin.dsl.provider.mode=classpath. - * See {@link KotlinDslModelsParameters#CLASSPATH_MODE_SYSTEM_PROPERTY_DECLARATION}. - * In this mode, Gradle Kotlin DSL scripts compilation or evaluation failures will be ignored, collected and - * exceptions will be returned in the built model. - * Optionally, it can also be set in a strict mode by providing the system property value -Dorg.gradle.kotlin.dsl.provider.mode=strict-classpath. - * See {@link KotlinDslModelsParameters#STRICT_CLASSPATH_MODE_SYSTEM_PROPERTY_DECLARATION}. - * - * Optionally, an identifier can be provided as a Gradle property named org.gradle.kotlin.dsl.provider.cid, - * it can then be used to correlate Gradle and TAPI client log statements. - * See {@link KotlinDslModelsParameters#CORRELATION_ID_GRADLE_PROPERTY_NAME}. - * - * @since 6.0 - */ -@Incubating -public interface KotlinDslScriptsModel { - - /** - * Gradle property name for the set of scripts to be queried for. - */ - String SCRIPTS_GRADLE_PROPERTY_NAME = "org.gradle.tooling.model.kotlin.dsl.scripts"; - - /** - * Script models by file. - */ - Map getScriptModels(); -} diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/AbstractProjectResolverExtensionCompat.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/AbstractProjectResolverExtensionCompat.kt.193 deleted file mode 100644 index ec55659d9e8..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/AbstractProjectResolverExtensionCompat.kt.193 +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.configuration - -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.project.ModuleData -import com.intellij.openapi.externalSystem.model.project.ProjectData -import org.gradle.tooling.model.idea.IdeaModule -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension - -// FIX ME WHEN BUNCH 193 REMOVED -abstract class AbstractProjectResolverExtensionCompat : AbstractProjectResolverExtension() { - override fun createModule(gradleModule: IdeaModule, projectDataNode: DataNode): DataNode { - return super.createModule(gradleModule, projectDataNode).also { - initializeModuleNode(gradleModule, it, projectDataNode) - } - } - - // Inline after class remove - abstract fun initializeModuleNode( - gradleModule: IdeaModule, - moduleDataNode: DataNode, - projectDataNode: DataNode, - ) -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinNonJvmGutterConfigurator.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinNonJvmGutterConfigurator.kt.193 deleted file mode 100644 index fb61030e3d4..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinNonJvmGutterConfigurator.kt.193 +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.configuration - -import com.intellij.util.Consumer -import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension - -// TODO: Now IDEA can provide filter from gutters only for Test task (JVM tests) -// Need to create fake Test task to copy filters from it to custom non-JVM test task -class KotlinNonJvmGutterConfigurator : AbstractProjectResolverExtension() { - override fun enhanceTaskProcessing(taskNames: MutableList, jvmParametersSetup: String?, initScriptConsumer: Consumer) { - initScriptConsumer.consume( - //language=Gradle - """ - ({ - if (org.gradle.util.GradleVersion.current() >= org.gradle.util.GradleVersion.version("4.0")) { - Class kotlinTestClass = null - try { - kotlinTestClass = Class.forName("org.jetbrains.kotlin.gradle.tasks.KotlinTest") - } catch (ClassNotFoundException ex) { - // ignore, class not available - } - - if (kotlinTestClass != null) { - gradle.afterProject { project -> - // Test task should have some parameters - // Create dummy task to consume outputs by Test task - project.tasks.create("nonJvmTestIdeSupportDummy") - - // IDEA now process filter parameters only for Test tasks - project.tasks.create('nonJvmTestIdeSupport', Test) { - testClassesDirs = project.tasks["nonJvmTestIdeSupportDummy"].outputs.files - classpath = project.tasks["nonJvmTestIdeSupportDummy"].outputs.files - } - - project.afterEvaluate { - project.tasks.withType(kotlinTestClass) { Task task -> - task.dependsOn('nonJvmTestIdeSupport') - } - } - } - - gradle.taskGraph.beforeTask { Task task -> - if (kotlinTestClass.isAssignableFrom(task.class)) { - task.filter.includePatterns = task.project.tasks['nonJvmTestIdeSupport'].filter.includePatterns - } - } - } - } - })() - """.trimIndent() - ) - } -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/AsyncFileChangeListenerHelper.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/AsyncFileChangeListenerHelper.kt.193 deleted file mode 100644 index 245705b0954..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/AsyncFileChangeListenerHelper.kt.193 +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.scripting.gradle - -import com.intellij.openapi.externalSystem.service.project.autoimport.AsyncFileChangeListenerBase -import com.intellij.openapi.vfs.VirtualFile -import com.intellij.openapi.vfs.VirtualFileManager -import com.intellij.openapi.vfs.newvfs.events.VFileEvent -import org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRootsManager - -fun addVfsListener( - watcher: GradleScriptListener, - buildRootsManager: GradleBuildRootsManager -) { - VirtualFileManager.getInstance().addAsyncFileListener( - object : AsyncFileChangeListenerBase() { - var fileChangesProcessor = watcher.fileChangesProcessor - - override fun isRelevant(path: String): Boolean { - return buildRootsManager.maybeAffectedGradleProjectFile(path) - } - - override fun updateFile(file: VirtualFile, event: VFileEvent) { - fileChangesProcessor(event.path, file.timeStamp) - } - - // do nothing - override fun prepareFileDeletion(file: VirtualFile) {} - override fun apply() {} - override fun reset() { - fileChangesProcessor = watcher.fileChangesProcessor - } - }, - watcher.project - ) -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt.193 deleted file mode 100644 index 3071a48483b..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt.193 +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("UnstableApiUsage") - -package org.jetbrains.kotlin.idea.scripting.gradle - -import com.intellij.notification.* -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.externalSystem.util.ExternalSystemUtil -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Key -import com.intellij.openapi.util.registry.Registry -import com.intellij.openapi.vfs.VirtualFile -import org.gradle.util.GradleVersion -import org.jetbrains.kotlin.idea.KotlinIcons -import org.jetbrains.kotlin.idea.KotlinIdeaGradleBundle -import org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRoot -import org.jetbrains.kotlin.idea.scripting.gradle.roots.GradleBuildRootsManager -import org.jetbrains.kotlin.idea.util.application.getServiceSafe -import org.jetbrains.kotlin.psi.UserDataProperty -import org.jetbrains.plugins.gradle.service.GradleInstallationManager -import org.jetbrains.plugins.gradle.settings.GradleProjectSettings -import org.jetbrains.plugins.gradle.util.GradleConstants - -val scriptConfigurationsNeedToBeUpdatedBalloon - get() = Registry.`is`("kotlin.gradle.scripts.scriptConfigurationsNeedToBeUpdatedBalloon", false) - -fun runPartialGradleImportForAllRoots(project: Project) { - GradleBuildRootsManager.getInstance(project).getAllRoots().forEach { root -> - runPartialGradleImport(project, root) - } -} - -fun runPartialGradleImport(project: Project, root: GradleBuildRoot) { - if (root.isImportingInProgress()) return - - ExternalSystemUtil.refreshProject( - root.pathPrefix, - ImportSpecBuilder(project, GradleConstants.SYSTEM_ID) - .build() - ) -} - -fun configurationsAreMissingRequestNeeded() = KotlinIdeaGradleBundle.message("notification.wasNotImportedAfterCreation.193.text") -fun getConfigurationsActionText() = KotlinIdeaGradleBundle.message("action.label.import.project") -fun configurationsAreMissingRequestNeededHelp(): String? = null -fun configurationsAreMissingAfterRequest(): String = KotlinIdeaGradleBundle.message("notification.notEvaluatedInLastImport.193.text") - -fun autoReloadScriptConfigurations(project: Project, root: GradleBuildRoot): Boolean { - return ExternalSystemApiUtil - .getSettings(project, GradleConstants.SYSTEM_ID) - .getLinkedProjectSettings(root.pathPrefix) - ?.isUseAutoImport ?: false -} - -private const val kotlinDslNotificationGroupId = "Gradle Kotlin DSL Scripts" -private var Project.notificationPanel: ScriptConfigurationChangedNotification? - by UserDataProperty(Key.create("load.script.configuration.panel")) - -fun scriptConfigurationsNeedToBeUpdated(project: Project, file: VirtualFile) { - if (!scriptConfigurationsNeedToBeUpdatedBalloon) return - - val root = GradleBuildRootsManager.getInstance(project).getScriptInfo(file)?.buildRoot ?: return - if (autoReloadScriptConfigurations(project, root)) { - // import should be run automatically by Gradle plugin - return - } - - val existingPanel = project.notificationPanel - if (existingPanel != null) { - return - } - - val notificationGroup = NotificationGroup.findRegisteredGroup(kotlinDslNotificationGroupId) - if (notificationGroup == null) { - NotificationsConfiguration.getNotificationsConfiguration().register( - kotlinDslNotificationGroupId, NotificationDisplayType.STICKY_BALLOON, false - ) - } - - val notification = ScriptConfigurationChangedNotification(project) - project.notificationPanel = notification - notification.notify(project) -} - -fun scriptConfigurationsAreUpToDate(project: Project): Boolean { - if (project.notificationPanel == null) return false - project.notificationPanel?.expire() - return true -} - -private class ScriptConfigurationChangedNotification(val project: Project) : - Notification( - kotlinDslNotificationGroupId, - KotlinIcons.LOAD_SCRIPT_CONFIGURATION, - KotlinIdeaGradleBundle.message("notification.title.script.configuration.has.been.changed"), - null, - KotlinIdeaGradleBundle.message("notification.text.script.configuration.has.been.changed"), - NotificationType.INFORMATION, - null - ) { - - init { - addAction(LoadConfigurationAction()) - addAction(NotificationAction.createSimple(KotlinIdeaGradleBundle.message("action.label.enable.auto.import")) { - GradleBuildRootsManager.getInstance(project).getAllRoots().forEach { root -> - val projectSettings = getGradleProjectSettings(project).find { it.externalProjectPath == root.pathPrefix } - if (projectSettings != null) { - projectSettings.isUseAutoImport = true - } - runPartialGradleImport(project, root) - } - }) - } - - override fun expire() { - super.expire() - - project.notificationPanel = null - } - - private class LoadConfigurationAction : AnAction(KotlinIdeaGradleBundle.message("action.label.import.project")) { - override fun actionPerformed(e: AnActionEvent) { - val project = e.project ?: return - runPartialGradleImportForAllRoots(project) - } - } -} - -fun getGradleVersion(project: Project, settings: GradleProjectSettings): String { - // workaround for bug in settings.resolveGradleVersion().version (fixed in 201) - return GradleInstallationManager.getGradleVersion( - ServiceManager.getService(GradleInstallationManager::class.java) - .getGradleHome(project, settings.externalProjectPath)?.path - ) ?: GradleVersion.current().version -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleKotlinScriptDefinitionWrapper.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleKotlinScriptDefinitionWrapper.kt.193 deleted file mode 100644 index c521e74cc0c..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleKotlinScriptDefinitionWrapper.kt.193 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.scripting.gradle - -import org.jetbrains.kotlin.scripting.definitions.ScriptCompilationConfigurationFromDefinition -import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition -import org.jetbrains.kotlin.scripting.resolve.KotlinScriptDefinitionFromAnnotatedTemplate -import kotlin.script.experimental.api.* -import kotlin.script.experimental.host.ScriptingHostConfiguration - -class GradleKotlinScriptDefinitionWrapper( - hostConfiguration: ScriptingHostConfiguration, - legacyDefinition: KotlinScriptDefinitionFromAnnotatedTemplate, - gradleVersion: String, - defaultCompilerOptions: Iterable -) : ScriptDefinition.FromLegacy(hostConfiguration, legacyDefinition, defaultCompilerOptions) { - override val compilationConfiguration by lazy { - ScriptCompilationConfigurationFromDefinition( - hostConfiguration, - legacyDefinition - ).with { - ScriptCompilationConfiguration.ide.acceptedLocations.put(listOf(ScriptAcceptedLocation.Project)) - } - } - - override val canAutoReloadScriptConfigurationsBeSwitchedOff = !kotlinDslScriptsModelImportSupported(gradleVersion) - override val canDefinitionBeSwitchedOff: Boolean = false -} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.193 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.193 deleted file mode 100644 index eb3bb6ecc78..00000000000 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.193 +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.scripting.gradle.importing - -import com.intellij.openapi.externalSystem.model.DataNode -import com.intellij.openapi.externalSystem.model.project.ProjectData -import org.gradle.tooling.model.idea.IdeaProject -import org.gradle.tooling.model.kotlin.dsl.KotlinDslScriptsModel -import org.jetbrains.kotlin.gradle.KotlinDslScriptAdditionalTask -import org.jetbrains.kotlin.gradle.KotlinDslScriptModelProvider -import org.jetbrains.kotlin.idea.scripting.gradle.kotlinDslScriptsModelImportSupported -import org.jetbrains.plugins.gradle.model.Build -import org.jetbrains.plugins.gradle.model.ClassSetImportModelProvider -import org.jetbrains.plugins.gradle.model.ProjectImportModelProvider - -class KotlinDslScriptModelResolver : KotlinDslScriptModelResolverCommon() { - override fun requiresTaskRunning() = true - - override fun getModelProvider() = KotlinDslScriptModelProvider() - - override fun getProjectsLoadedModelProvider(): ProjectImportModelProvider? { - return ClassSetImportModelProvider( - emptySet(), - setOf(KotlinDslScriptAdditionalTask::class.java) - ) - } - - override fun populateProjectExtraModels(gradleProject: IdeaProject, ideProject: DataNode) { - super.populateProjectExtraModels(gradleProject, ideProject) - - populateBuildModels(resolverCtx.models.mainBuild, ideProject) - - resolverCtx.models.includedBuilds.forEach { includedRoot -> - populateBuildModels(includedRoot, ideProject) - } - } - - private fun populateBuildModels( - root: Build, - ideProject: DataNode - ) { - root.projects.forEach { - if (it.projectIdentifier.projectPath == ":") { - if (kotlinDslScriptsModelImportSupported(resolverCtx.projectGradleVersion)) { - resolverCtx.models.getModel(it, KotlinDslScriptsModel::class.java)?.let { model -> - processScriptModel(resolverCtx, model, it.projectIdentifier.projectPath) - } - } - - saveGradleBuildEnvironment(resolverCtx) - } - } - } -} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.193 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.193 deleted file mode 100644 index 4907a01d921..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.193 +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.idea.codeInsight.gradle; - -import com.google.common.collect.Multimap; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.io.StreamUtil; -import com.intellij.testFramework.IdeaTestUtil; -import com.intellij.util.containers.ContainerUtil; -import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling; -import org.gradle.tooling.BuildActionExecuter; -import org.gradle.tooling.GradleConnector; -import org.gradle.tooling.ProjectConnection; -import org.gradle.tooling.internal.consumer.DefaultGradleConnector; -import org.gradle.util.GradleVersion; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.plugins.gradle.model.ClassSetProjectImportModelProvider; -import org.jetbrains.plugins.gradle.model.ExternalProject; -import org.jetbrains.plugins.gradle.model.ProjectImportAction; -import org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper; -import org.jetbrains.plugins.gradle.tooling.builder.ModelBuildScriptClasspathBuilderImpl; -import org.jetbrains.plugins.gradle.util.GradleConstants; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assume.assumeThat; - -// part of org.jetbrains.plugins.gradle.tooling.builder.AbstractModelBuilderTest -@RunWith(value = Parameterized.class) -public abstract class AbstractModelBuilderTest { - - public static final Object[][] SUPPORTED_GRADLE_VERSIONS = {{"4.9"}, {"5.6.4"}, {"6.5.1"}}; - - private static final Pattern TEST_METHOD_NAME_PATTERN = Pattern.compile("(.*)\\[(\\d*: with Gradle-.*)\\]"); - - private static File ourTempDir; - - @NotNull - private final String gradleVersion; - private File testDir; - private ProjectImportAction.AllModels allModels; - - @Rule public TestName name = new TestName(); - @Rule public VersionMatcherRule versionMatcherRule = new VersionMatcherRule(); - - public AbstractModelBuilderTest(@NotNull String gradleVersion) { - this.gradleVersion = gradleVersion; - } - - @Parameterized.Parameters(name = "{index}: with Gradle-{0}") - public static Collection data() { - return Arrays.asList(SUPPORTED_GRADLE_VERSIONS); - } - - - @Before - public void setUp() throws Exception { - assumeThat(gradleVersion, versionMatcherRule.getMatcher()); - - ensureTempDirCreated(); - - String methodName = name.getMethodName(); - Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName); - if (m.matches()) { - methodName = m.group(1); - } - - testDir = new File(ourTempDir, methodName); - FileUtil.ensureExists(testDir); - - InputStream buildScriptStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.DEFAULT_SCRIPT_NAME); - try { - FileUtil.writeToFile( - new File(testDir, GradleConstants.DEFAULT_SCRIPT_NAME), - FileUtil.loadTextAndClose(buildScriptStream) - ); - } - finally { - StreamUtil.closeStream(buildScriptStream); - } - - InputStream settingsStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.SETTINGS_FILE_NAME); - try { - if (settingsStream != null) { - FileUtil.writeToFile( - new File(testDir, GradleConstants.SETTINGS_FILE_NAME), - FileUtil.loadTextAndClose(settingsStream) - ); - } - } - finally { - StreamUtil.closeStream(settingsStream); - } - - GradleConnector connector = GradleConnector.newConnector(); - - URI distributionUri = new DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion)); - connector.useDistribution(distributionUri); - connector.forProjectDirectory(testDir); - int daemonMaxIdleTime = 10; - try { - daemonMaxIdleTime = Integer.parseInt(System.getProperty("gradleDaemonMaxIdleTime", "10")); - } - catch (NumberFormatException ignore) { - } - - ((DefaultGradleConnector) connector).daemonMaxIdleTime(daemonMaxIdleTime, TimeUnit.SECONDS); - ProjectConnection connection = connector.connect(); - - try { - ProjectImportAction projectImportAction = new ProjectImportAction(false); - projectImportAction.addProjectImportModelProvider(new ClassSetProjectImportModelProvider(getModels())); - BuildActionExecuter buildActionExecutor = connection.action(projectImportAction); - File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses()); - assertNotNull(initScript); - String jdkHome = IdeaTestUtil.requireRealJdkHome(); - buildActionExecutor.setJavaHome(new File(jdkHome)); - buildActionExecutor.setJvmArguments("-Xmx128m", "-XX:MaxPermSize=64m"); - buildActionExecutor - .withArguments("--info", "--recompile-scripts", GradleConstants.INIT_SCRIPT_CMD_OPTION, initScript.getAbsolutePath()); - allModels = buildActionExecutor.run(); - assertNotNull(allModels); - } - finally { - connection.close(); - } - } - - @NotNull - private static Set getToolingExtensionClasses() { - Set classes = ContainerUtil.set( - ExternalProject.class, - // gradle-tooling-extension-api jar - ProjectImportAction.class, - // gradle-tooling-extension-impl jar - ModelBuildScriptClasspathBuilderImpl.class, - Multimap.class, - ShortTypeHandling.class - ); - - ContainerUtil.addAllNotNull(classes, doGetToolingExtensionClasses()); - return classes; - } - - @NotNull - private static Set doGetToolingExtensionClasses() { - return Collections.emptySet(); - } - - @After - public void tearDown() throws Exception { - if (testDir != null) { - FileUtil.delete(testDir); - } - } - - protected abstract Set getModels(); - - - private static void ensureTempDirCreated() throws IOException { - if (ourTempDir != null) return; - - ourTempDir = new File(FileUtil.getTempDirectory(), "gradleTests"); - FileUtil.delete(ourTempDir); - FileUtil.ensureExists(ourTempDir); - } - - public static class DistributionLocator { - private static final String RELEASE_REPOSITORY_ENV = "GRADLE_RELEASE_REPOSITORY"; - private static final String SNAPSHOT_REPOSITORY_ENV = "GRADLE_SNAPSHOT_REPOSITORY"; - private static final String GRADLE_RELEASE_REPO = "https://services.gradle.org/distributions"; - private static final String GRADLE_SNAPSHOT_REPO = "https://services.gradle.org/distributions-snapshots"; - - @NotNull private final String myReleaseRepoUrl; - @NotNull private final String mySnapshotRepoUrl; - - public DistributionLocator() { - this(DistributionLocator.getRepoUrl(false), DistributionLocator.getRepoUrl(true)); - } - - public DistributionLocator(@NotNull String releaseRepoUrl, @NotNull String snapshotRepoUrl) { - myReleaseRepoUrl = releaseRepoUrl; - mySnapshotRepoUrl = snapshotRepoUrl; - } - - @NotNull - public URI getDistributionFor(@NotNull GradleVersion version) throws URISyntaxException { - return getDistribution(getDistributionRepository(version), version, "gradle", "bin"); - } - - @NotNull - private String getDistributionRepository(@NotNull GradleVersion version) { - return version.isSnapshot() ? mySnapshotRepoUrl : myReleaseRepoUrl; - } - - private static URI getDistribution( - @NotNull String repositoryUrl, - @NotNull GradleVersion version, - @NotNull String archiveName, - @NotNull String archiveClassifier - ) throws URISyntaxException { - return new URI(String.format("%s/%s-%s-%s.zip", repositoryUrl, archiveName, version.getVersion(), archiveClassifier)); - } - - @NotNull - public static String getRepoUrl(boolean isSnapshotUrl) { - String envRepoUrl = System.getenv(isSnapshotUrl ? SNAPSHOT_REPOSITORY_ENV : RELEASE_REPOSITORY_ENV); - if (envRepoUrl != null) return envRepoUrl; - - return isSnapshotUrl ? GRADLE_SNAPSHOT_REPO : GRADLE_RELEASE_REPO; - } - } -} diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.193 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.193 deleted file mode 100644 index 1657a32ac09..00000000000 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.193 +++ /dev/null @@ -1,987 +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.roots.LibraryOrderEntry -import com.intellij.openapi.roots.ModuleRootManager -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.ProjectRootManager -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.getProjectJdkTableSafe -import org.jetbrains.kotlin.idea.util.projectStructure.allModules -import org.jetbrains.kotlin.idea.util.projectStructure.sdk -import org.jetbrains.kotlin.platform.TargetPlatform -import org.jetbrains.kotlin.platform.js.JsPlatforms -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms -import org.jetbrains.kotlin.platform.js.isJs -import org.jetbrains.kotlin.platform.isCommon -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.plugins.gradle.tooling.annotation.TargetVersions -import org.junit.* -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 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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(testFacetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -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() { - configureByFiles() - importProject() - - assertAllModulesConfigured() - } - - @Test - fun testJvmImport_1_1_2() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(testFacetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -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() { - configureByFiles() - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -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() { - configureByFiles() - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm18, targetPlatform) - Assert.assertEquals("1.7", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -Xdump-declarations-to=tmp -Xsingle-module", - compilerSettings!!.additionalArguments - ) - } - with(facetSettings("project_myTest")) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - Assert.assertEquals("1.6", (compilerArguments as K2JVMCompilerArguments).jvmTarget) - Assert.assertEquals( - "-Xallow-no-source-files -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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testCoroutineImportByProperties() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals(LanguageFeature.State.ENABLED, coroutineSupport) - } - } - - @Test - fun testJsImport() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(targetPlatform.isJs()) - with(compilerArguments as K2JSCompilerArguments) { - Assert.assertEquals(true, sourceMap) - Assert.assertEquals("plain", moduleKind) - } - Assert.assertEquals( - "-main callMain", - compilerSettings!!.additionalArguments - ) - } - - with(testFacetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertFalse(compilerArguments!!.autoAdvanceLanguageVersion) - Assert.assertFalse(compilerArguments!!.autoAdvanceApiVersion) - Assert.assertTrue(targetPlatform.isJs()) - 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 { it.libraryName?.contains("js") ?: false }.library - assertEquals(JSLibraryKind, (stdlib as LibraryEx).kind) - assertTrue(stdlib.getFiles(OrderRootType.CLASSES).isNotEmpty()) - - 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") - ) - - assertAllModulesConfigured() - } - - @Test - fun testJsImportTransitive() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.isJs()) - } - - 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/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 testJsImportWithCustomSourceSets() { - configureByFiles() - importProject() - - with(facetSettings("project_myMain")) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.isJs()) - 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.3", languageLevel!!.versionString) - Assert.assertEquals("1.0", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.isJs()) - 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/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 testDetectOldJsStdlib() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertTrue(targetPlatform.isJs()) - } - } - - @Test - fun testJvmImportByPlatformPlugin() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - } - - 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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.isJs()) - } - - 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/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 - @TargetVersions("4.9") - fun testCommonImportByPlatformPlugin() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.1", languageLevel!!.versionString) - Assert.assertEquals("1.1", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.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 testJvmImportByKotlinPlugin() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertEquals(JvmPlatforms.jvm16, targetPlatform) - } - - 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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - Assert.assertTrue(targetPlatform.isJs()) - } - - 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 testArgumentEscaping() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals( - listOf("-Xallow-no-source-files", "-Xbuild-file=module with spaces"), - compilerSettings!!.additionalArgumentsAsList - ) - } - } - - @Test - fun testNoPluginsInAdditionalArgs() { - configureByFiles() - 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() { - configureByFiles() - 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() { - configureByFiles() - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - importProject() - - with(facetSettings("js-module")) { - Assert.assertTrue(targetPlatform.isJs()) - } - - 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() { - configureByFiles() - createProjectSubFile( - "local.properties", """ - sdk.dir=/${KotlinTestUtils.getAndroidSdkSystemIndependentPath()} - """ - ) - importProject() - - val kotlinFacet = KotlinFacet.get(getModule("project"))!! - } - - @Test - fun testNoFacetInModuleWithoutKotlinPlugin() { - configureByFiles() - - 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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("tmp.jar", (compilerArguments as K2JVMCompilerArguments).classpath) - } - } - - @Test - fun testDependenciesClasspathImport() { - configureByFiles() - 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") - getProjectJdkTableSafe().addJdk(jdk) - } - }.execute() - - try { - configureByFiles() - 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 = getProjectJdkTableSafe() - jdkTable.removeJdk(jdkTable.findJdk("myJDK")!!) - } - }.execute() - } - } - - @Test - fun testImplementsDependency() { - configureByFiles() - 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() { - configureByFiles() - - 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() { - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testIgnoreProjectLanguageAndAPIVersion() { - KotlinCommonCompilerArgumentsHolder.getInstance(myProject).update { - languageVersion = "1.0" - apiVersion = "1.0" - } - - configureByFiles() - importProject() - - with(facetSettings) { - Assert.assertEquals("1.3", languageLevel!!.versionString) - Assert.assertEquals("1.3", apiLevel!!.versionString) - } - - assertAllModulesConfigured() - } - - @Test - fun testCommonArgumentsImport() { - configureByFiles() - 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(targetPlatform.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(targetPlatform.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/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 testInternalArgumentsFacetImporting() { - configureByFiles() - importProject() - - // Version is indeed 1.3 - Assert.assertEquals(LanguageVersion.KOTLIN_1_3, facetSettings.languageLevel) - - // We haven't lost internal argument during importing to facet - Assert.assertEquals("-Xallow-no-source-files -XXLanguage:+InlineClasses", facetSettings.compilerSettings?.additionalArguments) - - // Inline classes are enabled even though LV = 1.3 - Assert.assertEquals( - LanguageFeature.State.ENABLED, - getModule("project_main").languageVersionSettings.getFeatureSupport(LanguageFeature.InlineClasses) - ) - - assertAllModulesConfigured() - } - - @Test - fun testStableModuleNameWhileUsingGradleJS() { - configureByFiles() - importProject() - - checkStableModuleName("project_main", "project", JsPlatforms.defaultJsPlatform, isProduction = true) - // Note "_test" suffix: this is current behavior of K2JS Compiler - checkStableModuleName("project_test", "project_test", JsPlatforms.defaultJsPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testStableModuleNameWhileUsingGradleJVM() { - configureByFiles() - importProject() - - checkStableModuleName("project_main", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = true) - checkStableModuleName("project_test", "project", JvmPlatforms.unspecifiedJvmPlatform, isProduction = false) - - assertAllModulesConfigured() - } - - @Test - fun testNoFriendPathsAreShown() { - configureByFiles() - importProject() - - Assert.assertEquals( - "-Xallow-no-source-files", - testFacetSettings.compilerSettings!!.additionalArguments - ) - - assertAllModulesConfigured() - } - - @Test - fun testSharedLanguageVersion() { - configureByFiles() - - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.3", holder.settings.languageVersion) - } - - @Test - fun testNonSharedLanguageVersion() { - configureByFiles() - val holder = KotlinCommonCompilerArgumentsHolder.getInstance(myProject) - - holder.update { languageVersion = "1.1" } - - importProject() - - TestCase.assertEquals("1.1", holder.settings.languageVersion) - } - - @Test - fun testImportCompilerArgumentsWithInvalidDependencies() { - configureByFiles() - importProject() - with(facetSettings("project_main")) { - Assert.assertEquals("1.8", (mergedCompilerArguments as K2JVMCompilerArguments).jvmTarget) - } - - } - - 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) - } - } - } - - override fun importProject() { - val isCreateEmptyContentRootDirectories = currentExternalProjectSettings.isCreateEmptyContentRootDirectories - try { - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = true - super.importProject() - } finally { - currentExternalProjectSettings.isCreateEmptyContentRootDirectories = isCreateEmptyContentRootDirectories - } - } - - override fun testDataDirName(): String { - return "gradleFacetImportTest" - } -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/ShowKotlinBytecodeAction.kt.193 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/ShowKotlinBytecodeAction.kt.193 deleted file mode 100644 index bf588f63d1b..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/ShowKotlinBytecodeAction.kt.193 +++ /dev/null @@ -1,53 +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.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.CommonDataKeys -import com.intellij.openapi.wm.ToolWindowAnchor -import com.intellij.openapi.wm.ToolWindowManager -import com.intellij.ui.content.ContentFactory -import org.jetbrains.kotlin.idea.KotlinFileType -import org.jetbrains.kotlin.idea.KotlinIcons -import org.jetbrains.kotlin.idea.internal.KotlinBytecodeToolWindow - -class ShowKotlinBytecodeAction : AnAction() { - override fun actionPerformed(e: AnActionEvent) { - val project = e.project ?: return - val toolWindowManager = ToolWindowManager.getInstance(project) - var toolWindow = toolWindowManager.getToolWindow(TOOLWINDOW_ID) - if (toolWindow == null) { - toolWindow = toolWindowManager.registerToolWindow(TOOLWINDOW_ID, false, ToolWindowAnchor.RIGHT) - toolWindow.icon = KotlinIcons.SMALL_LOGO_13 - - val contentManager = toolWindow.contentManager - val contentFactory = ContentFactory.SERVICE.getInstance() - contentManager.addContent(contentFactory.createContent(KotlinBytecodeToolWindow(project, toolWindow), "", false)) - } - toolWindow.activate(null) - } - - override fun update(e: AnActionEvent) { - val file = e.getData(CommonDataKeys.PSI_FILE) - e.presentation.isEnabled = e.project != null && file?.fileType == KotlinFileType.INSTANCE - } - - companion object { - const val TOOLWINDOW_ID = "Kotlin Bytecode" - } -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/ToolWindowScratchOutputHandler.kt.193 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/ToolWindowScratchOutputHandler.kt.193 deleted file mode 100644 index 5c0dd47c0cc..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/output/ToolWindowScratchOutputHandler.kt.193 +++ /dev/null @@ -1,284 +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.scratch.output - -import com.intellij.execution.filters.OpenFileHyperlinkInfo -import com.intellij.execution.impl.ConsoleViewImpl -import com.intellij.execution.runners.ExecutionUtil -import com.intellij.execution.ui.ConsoleViewContentType -import com.intellij.openapi.Disposable -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.TransactionGuard -import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.editor.ex.EditorEx -import com.intellij.openapi.fileTypes.PlainTextFileType -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Disposer -import com.intellij.openapi.wm.ToolWindow -import com.intellij.openapi.wm.ToolWindowAnchor -import com.intellij.openapi.wm.ToolWindowFactory -import com.intellij.openapi.wm.ToolWindowManager -import com.intellij.psi.PsiFile -import org.jetbrains.kotlin.idea.scratch.ScratchExpression -import org.jetbrains.kotlin.idea.scratch.ScratchFile -import org.jetbrains.kotlin.psi.KtPsiFactory - -/** - * Method to retrieve shared instance of scratches ToolWindow output handler. - * - * [releaseToolWindowHandler] must be called for every output handler received from this method. - * - * Can be called from EDT only. - * - * @return new toolWindow output handler if one does not exist, otherwise returns the existing one. When application in test mode, - * returns [TestOutputHandler]. - */ -fun requestToolWindowHandler(): ScratchOutputHandler { - return if (ApplicationManager.getApplication().isUnitTestMode) { - TestOutputHandler - } else { - ScratchToolWindowHandlerKeeper.requestOutputHandler() - } -} - -/** - * Should be called once with the output handler received from the [requestToolWindowHandler] call. - * - * When release is called for every request, the output handler is actually disposed. - * - * When application in test mode, does nothing. - * - * Can be called from EDT only. - */ -fun releaseToolWindowHandler(scratchOutputHandler: ScratchOutputHandler) { - if (!ApplicationManager.getApplication().isUnitTestMode) { - ScratchToolWindowHandlerKeeper.releaseOutputHandler(scratchOutputHandler) - } -} - -/** - * Implements logic of shared pointer for the toolWindow output handler. - * - * Not thread safe! Can be used only from the EDT. - */ -private object ScratchToolWindowHandlerKeeper { - private var toolWindowHandler: ScratchOutputHandler? = null - private var toolWindowDisposable = Disposer.newDisposable() - private var counter = 0 - - fun requestOutputHandler(): ScratchOutputHandler { - if (counter == 0) { - toolWindowHandler = ToolWindowScratchOutputHandler(toolWindowDisposable) - } - - counter += 1 - return toolWindowHandler!! - } - - fun releaseOutputHandler(scratchOutputHandler: ScratchOutputHandler) { - require(counter > 0) { "Counter is $counter, nothing to release!" } - require(toolWindowHandler === scratchOutputHandler) { "$scratchOutputHandler differs from stored $toolWindowHandler" } - - counter -= 1 - if (counter == 0) { - Disposer.dispose(toolWindowDisposable) - toolWindowDisposable = Disposer.newDisposable() - toolWindowHandler = null - } - } -} - -private class ToolWindowScratchOutputHandler(private val parentDisposable: Disposable) : ScratchOutputHandlerAdapter() { - - override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) { - printToConsole(file) { - val psiFile = file.getPsiFile() - if (psiFile != null) { - printHyperlink( - getLineInfo(psiFile, expression), - OpenFileHyperlinkInfo( - project, - psiFile.virtualFile, - expression.lineStart, - ), - ) - print(" ", ConsoleViewContentType.NORMAL_OUTPUT) - } - print(output.text, output.type.convert()) - } - } - - override fun error(file: ScratchFile, message: String) { - printToConsole(file) { - print(message, ConsoleViewContentType.ERROR_OUTPUT) - } - } - - private fun printToConsole(file: ScratchFile, print: ConsoleViewImpl.() -> Unit) { - ApplicationManager.getApplication().invokeLater { - val project = file.project.takeIf { !it.isDisposed } ?: return@invokeLater - - val toolWindow = getToolWindow(project) ?: createToolWindow(file) - - val contents = toolWindow.contentManager.contents - for (content in contents) { - val component = content.component - if (component is ConsoleViewImpl) { - component.print() - component.print("\n", ConsoleViewContentType.NORMAL_OUTPUT) - } - } - - toolWindow.setAvailable(true, null) - - if (!file.options.isInteractiveMode) { - toolWindow.show(null) - } - - toolWindow.icon = ExecutionUtil.getLiveIndicator(scratchIcon()) - } - } - - override fun clear(file: ScratchFile) { - ApplicationManager.getApplication().invokeLater { - val toolWindow = getToolWindow(file.project) ?: return@invokeLater - val contents = toolWindow.contentManager.contents - for (content in contents) { - val component = content.component - if (component is ConsoleViewImpl) { - component.clear() - } - } - - if (!file.options.isInteractiveMode) { - toolWindow.hide(null) - } - - toolWindow.icon = scratchIcon() - } - } - - private fun ScratchOutputType.convert() = when (this) { - ScratchOutputType.OUTPUT -> ConsoleViewContentType.SYSTEM_OUTPUT - ScratchOutputType.RESULT -> ConsoleViewContentType.NORMAL_OUTPUT - ScratchOutputType.ERROR -> ConsoleViewContentType.ERROR_OUTPUT - } - - private fun getToolWindow(project: Project): ToolWindow? { - val toolWindowManager = ToolWindowManager.getInstance(project) - return toolWindowManager.getToolWindow(ScratchToolWindowFactory.ID) - } - - private fun createToolWindow(file: ScratchFile): ToolWindow { - val project = file.project - val toolWindowManager = ToolWindowManager.getInstance(project) - toolWindowManager.registerToolWindow(ScratchToolWindowFactory.ID, true, ToolWindowAnchor.BOTTOM) - val window = toolWindowManager.getToolWindow(ScratchToolWindowFactory.ID) - ScratchToolWindowFactory().createToolWindowContent(project, window) - - Disposer.register( - parentDisposable, - Disposable { - toolWindowManager.unregisterToolWindow(ScratchToolWindowFactory.ID) - }, - ) - - return window - } -} - -private fun scratchIcon() = PlainTextFileType.INSTANCE.icon - -private fun getLineInfo(psiFile: PsiFile, expression: ScratchExpression) = - "${psiFile.name}:${expression.lineStart + 1}" - -private class ScratchToolWindowFactory : ToolWindowFactory { - companion object { - const val ID = "Scratch Output" - } - - override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { - val consoleView = ConsoleViewImpl(project, true) - toolWindow.isToHideOnEmptyContent = true - toolWindow.icon = scratchIcon() - toolWindow.hide(null) - - val contentManager = toolWindow.contentManager - val content = contentManager.factory.createContent(consoleView.component, null, false) - contentManager.addContent(content) - val editor = consoleView.editor - if (editor is EditorEx) { - editor.isRendererMode = true - } - - Disposer.register(project, consoleView) - } -} - -private object TestOutputHandler : ScratchOutputHandlerAdapter() { - private val errors = arrayListOf() - private val inlays = arrayListOf>() - - override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) { - inlays.add(expression to output.text) - } - - override fun error(file: ScratchFile, message: String) { - errors.add(message) - } - - override fun onFinish(file: ScratchFile) { - TransactionGuard.submitTransaction( - file.project, - Runnable { - val psiFile = file.getPsiFile() - ?: error( - "PsiFile cannot be found for scratch to render inlays in tests:\n" + - "project.isDisposed = ${file.project.isDisposed}\n" + - "inlays = ${inlays.joinToString { it.second }}\n" + - "errors = ${errors.joinToString()}", - ) - - if (inlays.isNotEmpty()) { - testPrint( - psiFile, - inlays.map { (expression, text) -> - "/** ${getLineInfo(psiFile, expression)} $text */" - }, - ) - inlays.clear() - } - - if (errors.isNotEmpty()) { - testPrint(psiFile, listOf(errors.joinToString(prefix = "/** ", postfix = " */"))) - errors.clear() - } - }, - ) - } - - private fun testPrint(file: PsiFile, comments: List) { - WriteCommandAction.runWriteCommandAction(file.project) { - for (comment in comments) { - file.addAfter( - KtPsiFactory(file.project).createComment(comment), - file.lastChild, - ) - } - } - } -} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/TextEditorWithPreview.java.193 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/TextEditorWithPreview.java.193 deleted file mode 100644 index 43aae0cf629..00000000000 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/scratch/ui/TextEditorWithPreview.java.193 +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.scratch.ui; - - -import com.intellij.codeHighlighting.BackgroundEditorHighlighter; -import com.intellij.icons.AllIcons; -import com.intellij.ide.structureView.StructureViewBuilder; -import com.intellij.ide.util.PropertiesComponent; -import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.editor.ex.EditorGutterComponentEx; -import com.intellij.openapi.fileEditor.*; -import com.intellij.openapi.project.DumbAware; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.UserDataHolderBase; -import com.intellij.openapi.wm.IdeFocusManager; -import com.intellij.ui.JBSplitter; -import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.KotlinJvmBundle; - -import javax.swing.*; -import java.awt.*; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.HashMap; -import java.util.Map; - -/** - * Two panel editor with three states: Editor, Preview and Editor with Preview. - * Based on SplitFileEditor by Valentin Fondaratov - *

- * NOTE: This class is a copy of {@link com.intellij.openapi.fileEditor.TextEditorWithPreview} from the most recent intellij-community - * repository. We cannot use bundled version of this class because it doesn't yet have customization methods - * (namely {@link TextEditorWithPreview#createLeftToolbarActionGroup()}). - *

- * {@link SplitEditorToolbar} is also copied from the platform. - *

- * This class also may have some minimal customizations to allow tracking when its layout have been changed. In the future we hope to - * remove this copied class entirely and to use the bundled version. - */ -public class TextEditorWithPreview extends UserDataHolderBase implements FileEditor { - protected final TextEditor myEditor; - protected final FileEditor myPreview; - @NotNull - private final MyListenersMultimap myListenersGenerator = new MyListenersMultimap(); - private Layout myLayout; - private JComponent myComponent; - private SplitEditorToolbar myToolbarWrapper; - private final String myName; - - public TextEditorWithPreview(@NotNull TextEditor editor, @NotNull FileEditor preview, @NotNull String editorName) { - myEditor = editor; - myPreview = preview; - myName = editorName; - } - - public TextEditorWithPreview(@NotNull TextEditor editor, @NotNull FileEditor preview) { - this(editor, preview, "TextEditorWithPreview"); - } - - @Nullable - @Override - public BackgroundEditorHighlighter getBackgroundHighlighter() { - return myEditor.getBackgroundHighlighter(); - } - - @Nullable - @Override - public FileEditorLocation getCurrentLocation() { - return myEditor.getCurrentLocation(); - } - - @Nullable - @Override - public StructureViewBuilder getStructureViewBuilder() { - return myEditor.getStructureViewBuilder(); - } - - @Override - public void dispose() { - Disposer.dispose(myEditor); - Disposer.dispose(myPreview); - } - - @Override - public void selectNotify() { - myEditor.selectNotify(); - myPreview.selectNotify(); - } - - @Override - public void deselectNotify() { - myEditor.deselectNotify(); - myPreview.deselectNotify(); - } - - @NotNull - @Override - public JComponent getComponent() { - if (myComponent == null) { - final JBSplitter splitter = new JBSplitter(false, 0.5f, 0.15f, 0.85f); - splitter.setSplitterProportionKey(getSplitterProportionKey()); - splitter.setFirstComponent(myEditor.getComponent()); - splitter.setSecondComponent(myPreview.getComponent()); - splitter.setDividerWidth(3); - - myToolbarWrapper = createMarkdownToolbarWrapper(splitter); - Disposer.register(this, myToolbarWrapper); - - if (myLayout == null) { - String lastUsed = PropertiesComponent.getInstance().getValue(getLayoutPropertyName()); - setLayout(Layout.fromName(lastUsed, Layout.SHOW_EDITOR_AND_PREVIEW)); - } - adjustEditorsVisibility(); - - myComponent = JBUI.Panels.simplePanel(splitter).addToTop(myToolbarWrapper); - } - return myComponent; - } - - @NotNull - private SplitEditorToolbar createMarkdownToolbarWrapper (@NotNull JComponent targetComponentForActions) { - final ActionToolbar leftToolbar = createToolbar(); - if (leftToolbar != null) { - leftToolbar.setTargetComponent(targetComponentForActions); - leftToolbar.setReservePlaceAutoPopupIcon(false); - } - - final ActionToolbar rightToolbar = createRightToolbar(); - rightToolbar.setTargetComponent(targetComponentForActions); - rightToolbar.setReservePlaceAutoPopupIcon(false); - - return new SplitEditorToolbar(leftToolbar, rightToolbar); - } - - @Override - public void setState(@NotNull FileEditorState state) { - if (state instanceof MyFileEditorState) { - final MyFileEditorState compositeState = (MyFileEditorState)state; - if (compositeState.getFirstState() != null) { - myEditor.setState(compositeState.getFirstState()); - } - if (compositeState.getSecondState() != null) { - myPreview.setState(compositeState.getSecondState()); - } - if (compositeState.getSplitLayout() != null) { - setLayout(compositeState.getSplitLayout()); - invalidateLayout(); - } - } - } - - private void adjustEditorsVisibility() { - myEditor.getComponent().setVisible(myLayout == Layout.SHOW_EDITOR || myLayout == Layout.SHOW_EDITOR_AND_PREVIEW); - myPreview.getComponent().setVisible(myLayout == Layout.SHOW_PREVIEW || myLayout == Layout.SHOW_EDITOR_AND_PREVIEW); - } - - private void invalidateLayout() { - adjustEditorsVisibility(); - myToolbarWrapper.refresh(); - myComponent.repaint(); - - final JComponent focusComponent = getPreferredFocusedComponent(); - if (focusComponent != null) { - IdeFocusManager.findInstanceByComponent(focusComponent).requestFocus(focusComponent, true); - } - } - - @NotNull - protected String getSplitterProportionKey() { - return "TextEditorWithPreview.SplitterProportionKey"; - } - - @Nullable - @Override - public JComponent getPreferredFocusedComponent() { - switch (myLayout) { - case SHOW_EDITOR_AND_PREVIEW: - case SHOW_EDITOR: - return myEditor.getPreferredFocusedComponent(); - case SHOW_PREVIEW: - return myPreview.getPreferredFocusedComponent(); - default: - throw new IllegalStateException(myLayout.myName); - } - } - - @NotNull - @Override - public String getName() { - return myName; - } - - @NotNull - @Override - public FileEditorState getState(@NotNull FileEditorStateLevel level) { - return new MyFileEditorState(myLayout, myEditor.getState(level), myPreview.getState(level)); - } - - @Override - public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) { - myEditor.addPropertyChangeListener(listener); - myPreview.addPropertyChangeListener(listener); - - final DoublingEventListenerDelegate delegate = myListenersGenerator.addListenerAndGetDelegate(listener); - myEditor.addPropertyChangeListener(delegate); - myPreview.addPropertyChangeListener(delegate); - } - - @Override - public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) { - myEditor.removePropertyChangeListener(listener); - myPreview.removePropertyChangeListener(listener); - - final DoublingEventListenerDelegate delegate = myListenersGenerator.removeListenerAndGetDelegate(listener); - if (delegate != null) { - myEditor.removePropertyChangeListener(delegate); - myPreview.removePropertyChangeListener(delegate); - } - } - - @NotNull - public TextEditor getTextEditor() { - return myEditor; - } - - public Layout getLayout() { - return myLayout; - } - - protected void setLayout(@NotNull Layout layout) { - myLayout = layout; - } - - static class MyFileEditorState implements FileEditorState { - private final Layout mySplitLayout; - private final FileEditorState myFirstState; - private final FileEditorState mySecondState; - - MyFileEditorState(Layout layout, FileEditorState firstState, FileEditorState secondState) { - mySplitLayout = layout; - myFirstState = firstState; - mySecondState = secondState; - } - - @Nullable - public Layout getSplitLayout() { - return mySplitLayout; - } - - @Nullable - public FileEditorState getFirstState() { - return myFirstState; - } - - @Nullable - public FileEditorState getSecondState() { - return mySecondState; - } - - @Override - public boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level) { - return otherState instanceof MyFileEditorState - && (myFirstState == null || myFirstState.canBeMergedWith(((MyFileEditorState)otherState).myFirstState, level)) - && (mySecondState == null || mySecondState.canBeMergedWith(((MyFileEditorState)otherState).mySecondState, level)); - } - } - - @Override - public boolean isModified() { - return myEditor.isModified() || myPreview.isModified(); - } - - @Override - public boolean isValid() { - return myEditor.isValid() && myPreview.isValid(); - } - - private class DoublingEventListenerDelegate implements PropertyChangeListener { - @NotNull - private final PropertyChangeListener myDelegate; - - private DoublingEventListenerDelegate(@NotNull PropertyChangeListener delegate) { - myDelegate = delegate; - } - - @Override - public void propertyChange(PropertyChangeEvent evt) { - myDelegate.propertyChange( - new PropertyChangeEvent(TextEditorWithPreview.this, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue())); - } - } - - private class MyListenersMultimap { - private final Map> myMap = new HashMap<>(); - - @NotNull - public DoublingEventListenerDelegate addListenerAndGetDelegate(@NotNull PropertyChangeListener listener) { - if (!myMap.containsKey(listener)) { - myMap.put(listener, Pair.create(1, new DoublingEventListenerDelegate(listener))); - } - else { - final Pair oldPair = myMap.get(listener); - myMap.put(listener, Pair.create(oldPair.getFirst() + 1, oldPair.getSecond())); - } - - return myMap.get(listener).getSecond(); - } - - @Nullable - public DoublingEventListenerDelegate removeListenerAndGetDelegate(@NotNull PropertyChangeListener listener) { - final Pair oldPair = myMap.get(listener); - if (oldPair == null) { - return null; - } - - if (oldPair.getFirst() == 1) { - myMap.remove(listener); - } - else { - myMap.put(listener, Pair.create(oldPair.getFirst() - 1, oldPair.getSecond())); - } - return oldPair.getSecond(); - } - } - - @Nullable - protected ActionToolbar createToolbar() { - ActionGroup actionGroup = createLeftToolbarActionGroup(); - if (actionGroup != null) { - return ActionManager.getInstance().createActionToolbar("TextEditorWithPreview", actionGroup, true); - } - else { - return null; - } - } - - @Nullable - protected ActionGroup createLeftToolbarActionGroup() { - return null; - } - - @NotNull - private ActionToolbar createRightToolbar() { - final ActionGroup viewActions = createViewActionGroup(); - final ActionGroup group = createRightToolbarActionGroup(); - final ActionGroup rightToolbarActions = group == null - ? viewActions - : new DefaultActionGroup(group, Separator.create(), viewActions); - return ActionManager.getInstance().createActionToolbar("TextEditorWithPreview", rightToolbarActions, true); - } - - @NotNull - protected ActionGroup createViewActionGroup() { - return new DefaultActionGroup( - getShowEditorAction(), - getShowEditorAndPreviewAction(), - getShowPreviewAction() - ); - } - - @Nullable - protected ActionGroup createRightToolbarActionGroup() { - return null; - } - - @NotNull - protected ToggleAction getShowEditorAction() { - return new ChangeViewModeAction(Layout.SHOW_EDITOR); - } - - @NotNull - protected ToggleAction getShowPreviewAction() { - return new ChangeViewModeAction(Layout.SHOW_PREVIEW); - } - - @NotNull - protected ToggleAction getShowEditorAndPreviewAction() { - return new ChangeViewModeAction(Layout.SHOW_EDITOR_AND_PREVIEW); - } - - public enum Layout { - SHOW_EDITOR(KotlinJvmBundle.message("editor.editor.only"), AllIcons.General.LayoutEditorOnly), - SHOW_PREVIEW(KotlinJvmBundle.message("editor.preview.only"), AllIcons.General.LayoutPreviewOnly), - SHOW_EDITOR_AND_PREVIEW(KotlinJvmBundle.message("editor.editor.and.preview"), AllIcons.General.LayoutEditorPreview); - - private final String myName; - private final Icon myIcon; - - Layout(String name, Icon icon) { - myName = name; - myIcon = icon; - } - - public static Layout fromName(String name, Layout defaultValue) { - for (Layout layout : Layout.values()) { - if (layout.myName.equals(name)) { - return layout; - } - } - return defaultValue; - } - - public String getName() { - return myName; - } - - public Icon getIcon() { - return myIcon; - } - } - - private class ChangeViewModeAction extends ToggleAction implements DumbAware { - private final Layout myActionLayout; - - ChangeViewModeAction(Layout layout) { - super(layout.getName(), layout.getName(), layout.getIcon()); - myActionLayout = layout; - } - - @Override - public boolean isSelected(@NotNull AnActionEvent e) { - return myLayout == myActionLayout; - } - - @Override - public void setSelected(@NotNull AnActionEvent e, boolean state) { - if (state) { - setLayout(myActionLayout); - PropertiesComponent.getInstance().setValue(getLayoutPropertyName(), myLayout.myName, Layout.SHOW_EDITOR_AND_PREVIEW.myName); - adjustEditorsVisibility(); - } - } - } - - @NotNull - private String getLayoutPropertyName() { - return myName + "Layout"; - } -} - -class SplitEditorToolbar extends JPanel implements Disposable { - - private final ActionToolbar myRightToolbar; - - public SplitEditorToolbar(@Nullable ActionToolbar leftToolbar, @NotNull ActionToolbar rightToolbar) { - super(new GridBagLayout()); - myRightToolbar = rightToolbar; - - if (leftToolbar != null) { - add(leftToolbar.getComponent()); - } - - final JPanel centerPanel = new JPanel(new BorderLayout()); - add(centerPanel, new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0)); - - add(myRightToolbar.getComponent()); - - setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIUtil.CONTRAST_BORDER_COLOR)); - - if (leftToolbar != null) leftToolbar.updateActionsImmediately(); - rightToolbar.updateActionsImmediately(); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - public void addGutterToTrack(@NotNull EditorGutterComponentEx gutterComponentEx) {} - - public void refresh() { - myRightToolbar.updateActionsImmediately(); - } - - @Deprecated - @ApiStatus.ScheduledForRemoval - @Override - public void dispose() {} -} \ No newline at end of file diff --git a/idea/idea-live-templates/tests/org/jetbrains/kotlin/idea/liveTemplates/compat.kt.193 b/idea/idea-live-templates/tests/org/jetbrains/kotlin/idea/liveTemplates/compat.kt.193 deleted file mode 100644 index 1f4d2a86180..00000000000 --- a/idea/idea-live-templates/tests/org/jetbrains/kotlin/idea/liveTemplates/compat.kt.193 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.liveTemplates - -import com.intellij.codeInsight.template.impl.TemplateManagerImpl -import com.intellij.openapi.Disposable -import com.intellij.openapi.project.Project - -// FIX ME WHEN BUNCH 193 REMOVED -fun setTemplateTestingCompat(project: Project, disposable: Disposable) { - TemplateManagerImpl.setTemplateTesting(project, disposable) -} \ No newline at end of file diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt.193 b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt.193 deleted file mode 100644 index 6d485c9908c..00000000000 --- a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/IdeaGradleWizardService.kt.193 +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.tools.projectWizard.wizard.service - -import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.tools.projectWizard.core.Reader -import org.jetbrains.kotlin.tools.projectWizard.core.TaskResult -import org.jetbrains.kotlin.tools.projectWizard.core.UNIT_SUCCESS -import org.jetbrains.kotlin.tools.projectWizard.core.service.ProjectImportingWizardService -import org.jetbrains.kotlin.tools.projectWizard.ir.buildsystem.ModuleIR -import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.BuildSystemType -import org.jetbrains.kotlin.tools.projectWizard.plugins.buildSystem.isGradle -import org.jetbrains.plugins.gradle.service.project.open.linkAndRefreshGradleProject -import java.nio.file.Path - -class IdeaGradleWizardService(private val project: Project) : ProjectImportingWizardService, - IdeaWizardService { - override fun isSuitableFor(buildSystemType: BuildSystemType): Boolean = - buildSystemType.isGradle - - override fun importProject( - reader: Reader, - path: Path, - modulesIrs: List, - buildSystem: BuildSystemType - ): TaskResult { - withGradleWrapperEnabled { - linkAndRefreshGradleProject(path.toString(), project) - } - return UNIT_SUCCESS - } - - private fun withGradleWrapperEnabled(action: () -> Unit) { - val oldGradleDistributionType = System.getProperty("idea.gradle.distributionType") - System.setProperty("idea.gradle.distributionType", "WRAPPED") - try { - action() - } finally { - if (oldGradleDistributionType != null) { - System.setProperty("idea.gradle.distributionType", oldGradleDistributionType) - } - } - } -} \ No newline at end of file diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/ConsoleCompilerHelper.kt.193 b/idea/idea-repl/src/org/jetbrains/kotlin/console/ConsoleCompilerHelper.kt.193 deleted file mode 100644 index 296417b6c85..00000000000 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/ConsoleCompilerHelper.kt.193 +++ /dev/null @@ -1,52 +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.console - -import com.intellij.execution.ExecutionManager -import com.intellij.execution.Executor -import com.intellij.execution.ui.RunContentDescriptor -import com.intellij.openapi.compiler.CompilerManager -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import com.intellij.task.ProjectTaskContext -import com.intellij.task.ProjectTaskManager -import com.intellij.task.ProjectTaskNotification -import com.intellij.task.ProjectTaskResult - -class ConsoleCompilerHelper( - private val project: Project, - private val module: Module, - private val executor: Executor, - private val contentDescriptor: RunContentDescriptor -) { - - fun moduleIsUpToDate(): Boolean { - val compilerManager = CompilerManager.getInstance(project) - val compilerScope = compilerManager.createModuleCompileScope(module, true) - return compilerManager.isUpToDate(compilerScope) - } - - fun compileModule() { - if (ExecutionManager.getInstance(project).contentManager.removeRunContent(executor, contentDescriptor)) { - ProjectTaskManager.getInstance(project).build(module).onSuccess { executionResult -> - if (!module.isDisposed) { - KotlinConsoleKeeper.getInstance(project).run(module, previousCompilationFailed = executionResult.hasErrors()) - } - } - } - } -} \ No newline at end of file diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.193 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.193 deleted file mode 100644 index b2f030b178d..00000000000 --- a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compat.kt.193 +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.test - -import com.intellij.ide.startup.impl.StartupManagerImpl -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager - -// FIX ME WHEN BUNCH 193 REMOVED -fun runPostStartupActivitiesOnce(project: Project) { - (StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities() -} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrameItems.kt.193 b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrameItems.kt.193 deleted file mode 100644 index e7796e3b3cf..00000000000 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrameItems.kt.193 +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.debugger.coroutine.data - -import com.intellij.debugger.engine.DebugProcessImpl -import com.intellij.debugger.engine.JVMStackFrameInfoProvider -import com.intellij.debugger.engine.evaluation.EvaluationContextImpl -import com.intellij.debugger.jdi.StackFrameProxyImpl -import com.intellij.debugger.memory.utils.StackFrameItem -import com.intellij.xdebugger.frame.XCompositeNode -import com.intellij.xdebugger.frame.XNamedValue -import com.intellij.xdebugger.frame.XStackFrame -import com.intellij.xdebugger.frame.XValueChildrenList -import com.sun.jdi.Location -import org.jetbrains.kotlin.idea.debugger.* -import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle -import org.jetbrains.kotlin.idea.debugger.coroutine.proxy.LocationStackFrameProxyImpl -import org.jetbrains.kotlin.idea.debugger.coroutine.util.findPosition -import org.jetbrains.kotlin.idea.debugger.coroutine.util.isFilteredInvokeSuspend -import org.jetbrains.kotlin.idea.debugger.coroutine.util.logger -import org.jetbrains.kotlin.idea.debugger.stackFrame.KotlinStackFrame - -/** - * Creation frame of coroutine either in RUNNING or SUSPENDED state. - */ -class CreationCoroutineStackFrameItem( - val stackTraceElement: StackTraceElement, - location: Location, - val first: Boolean -) : CoroutineStackFrameItem(location, emptyList()) { - - override fun createFrame(debugProcess: DebugProcessImpl): CoroutineGeneratedFrame? { - return debugProcess.invokeInManagerThread { - val frame = debugProcess.findFirstFrame() ?: return@invokeInManagerThread null - val locationFrame = LocationStackFrameProxyImpl(location, frame) - val position = location.findPosition(debugProcess.project) - CreationCoroutineStackFrame(debugProcess, this, first) - } - } -} - -/** - * Restored frame in SUSPENDED coroutine, not attached to any thread. - */ -class SuspendCoroutineStackFrameItem( - val stackTraceElement: StackTraceElement, - location: Location, - spilledVariables: List = emptyList() -) : CoroutineStackFrameItem(location, spilledVariables) - -/** - * Restored from memory dump - */ -class DefaultCoroutineStackFrameItem(location: Location, spilledVariables: List) : - CoroutineStackFrameItem(location, spilledVariables) { - - override fun createFrame(debugProcess: DebugProcessImpl): CoroutineGeneratedFrame? { - return debugProcess.invokeInManagerThread { - val frame = debugProcess.findFirstFrame() ?: return@invokeInManagerThread null - val locationStackFrameProxyImpl = LocationStackFrameProxyImpl(location, frame) - val position = location.findPosition(debugProcess.project) ?: return@invokeInManagerThread null - CoroutineStackFrame(debugProcess, this) - } - } -} - -/** - * Original frame appeared before resumeWith call. - * - * Sequence is the following - * - * - KotlinStackFrame - * - invokeSuspend(KotlinStackFrame) -| - * | replaced with CoroutinePreflightStackFrame - * - resumeWith(KotlinStackFrame) ----| - * - Kotlin/JavaStackFrame -> PreCoroutineStackFrameItem : CoroutinePreflightStackFrame.threadPreCoroutineFrames - * - */ -open class RunningCoroutineStackFrameItem( - val frame: StackFrameProxyImpl, - spilledVariables: List = emptyList() -) : CoroutineStackFrameItem(frame.location(), spilledVariables), FrameProvider { - override fun createFrame(debugProcess: DebugProcessImpl): CoroutineGeneratedFrame? { - return debugProcess.invokeInManagerThread { - CoroutineStackFrame(debugProcess, this) - } - } - - override fun provideFrame(debugProcess: DebugProcessImpl): XStackFrame? = - debugProcess.invokeInManagerThread { KotlinStackFrame(frame) } -} - -sealed class CoroutineStackFrameItem(val location: Location, val spilledVariables: List) : - StackFrameItem(location, spilledVariables) { - val log by logger - - override fun createFrame(debugProcess: DebugProcessImpl): CoroutineGeneratedFrame? { - return debugProcess.invokeInManagerThread { - CoroutineStackFrame(debugProcess, this) - } - } - - fun uniqueId() = - location.safeSourceName() + ":" + location.safeMethod().toString() + ":" + - location.safeLineNumber() + ":" + location.safeKotlinPreferredLineNumber() -} - -interface FrameProvider { - fun provideFrame(debugProcess: DebugProcessImpl): XStackFrame? -} - -fun DebugProcessImpl.findFirstFrame(): StackFrameProxyImpl? = - suspendManager.pausedContext.thread?.forceFrames()?.firstOrNull() - -/** - * Coroutine exit frame represented by a stack frames - * invokeSuspend():-1 - * resumeWith() - * - */ -class CoroutinePreflightFrame( - val coroutineInfoData: CoroutineInfoData, - private val frame: StackFrameProxyImpl, - val threadPreCoroutineFrames: List, - val mode: SuspendExitMode -) : KotlinStackFrame(frame), JVMStackFrameInfoProvider { - - override fun superBuildVariables(evaluationContext: EvaluationContextImpl, children: XValueChildrenList) { - super.superBuildVariables(evaluationContext, children) - val topRestoredFrame = coroutineInfoData.stackTrace.firstOrNull() - if (topRestoredFrame != null && topRestoredFrame.location.isFilteredInvokeSuspend()) { - val firstFrameVariables: List = topRestoredFrame.spilledVariables - children.let { - val varNames = (0 until children.size()).map { children.getName(it) }.toSet() - firstFrameVariables.forEach { - if (!varNames.contains(it.name)) - children.add(it) - } - } - } - } - - override fun isInLibraryContent() = false - - override fun isSynthetic() = false -} - -class CreationCoroutineStackFrame(debugProcess: DebugProcessImpl, item: CoroutineStackFrameItem, val first: Boolean) : CoroutineStackFrame(debugProcess, item) { - override fun getCaptionAboveOf() = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.creation.trace") - - override fun hasSeparatorAbove(): Boolean = - first -} - -open class CoroutineStackFrame(val debugProcess: DebugProcessImpl, val item: CoroutineStackFrameItem) : - StackFrameItem.CapturedStackFrame(debugProcess, item) { - - override fun computeChildren(node: XCompositeNode) { - if (item is FrameProvider) - item.provideFrame(debugProcess)?.computeChildren(node) - else - super.computeChildren(node) - } - - override fun getCaptionAboveOf() = "CoroutineExit" - - override fun hasSeparatorAbove(): Boolean = - false -} - -typealias CoroutineGeneratedFrame = StackFrameItem.CapturedStackFrame \ No newline at end of file diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/compat.kt.193 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/compat.kt.193 deleted file mode 100644 index e9542b8cb9d..00000000000 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/compat.kt.193 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.testFramework - -import com.intellij.openapi.project.Project -import com.intellij.openapi.project.ex.ProjectManagerEx - -// FIX ME WHEN BUNCH 193 REMOVED -fun ProjectManagerEx.forceCloseProjectEx(project: Project, dispose: Boolean): Boolean { - if (!dispose) error("dispose should be true") - return this.forceCloseProject(project, true) -} - -// FIX ME WHEN BUNCH 193 REMOVED -typealias TestApplicationManager = com.intellij.idea.IdeaTestApplication diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.193 b/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.193 deleted file mode 100644 index d1d47e8a7e4..00000000000 --- a/idea/performanceTests/test/org/jetbrains/kotlin/idea/testFramework/gradleRoutines.kt.193 +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.testFramework - -import com.intellij.openapi.externalSystem.importing.ImportSpecBuilder -import com.intellij.openapi.externalSystem.service.execution.ProgressExecutionMode -import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl -import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil -import com.intellij.openapi.externalSystem.util.ExternalSystemUtil -import com.intellij.openapi.project.DumbService -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.ProjectRootManager -import org.jetbrains.plugins.gradle.service.project.open.setupGradleSettings -import org.jetbrains.plugins.gradle.settings.GradleProjectSettings -import org.jetbrains.plugins.gradle.settings.GradleSettings -import org.jetbrains.plugins.gradle.util.GradleConstants -import org.jetbrains.plugins.gradle.util.GradleLog -import java.io.File -import kotlin.test.assertNotNull - -fun refreshGradleProject(projectPath: String, project: Project) { - _importProject(File(projectPath).absolutePath, project) - - dispatchAllInvocationEvents() -} - -const val GRADLE_JDK_NAME = "Gradle JDK" - -/** - * inspired by org.jetbrains.plugins.gradle.service.project.open.importProject(projectDirectory, project) - */ -private fun _importProject(projectPath: String, project: Project) { - GradleLog.LOG.info("Import project at $projectPath") - val projectSdk = ProjectRootManager.getInstance(project).projectSdk - assertNotNull(projectSdk, "project SDK not found for ${project.name} at $projectPath") - val gradleProjectSettings = GradleProjectSettings() - - GradleSettings.getInstance(project).gradleVmOptions = - "-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${System.getProperty("user.dir")}" - - setupGradleSettings(gradleProjectSettings, projectPath, project, projectSdk) - gradleProjectSettings.gradleJvm = GRADLE_JDK_NAME - - GradleSettings.getInstance(project).getLinkedProjectSettings(projectPath)?.let { linkedProjectSettings -> - linkedProjectSettings.gradleJvm = GRADLE_JDK_NAME - } - - _attachGradleProjectAndRefresh(gradleProjectSettings, project) -} - -/** - * inspired by org.jetbrains.plugins.gradle.service.project.open.attachGradleProjectAndRefresh(gradleProjectSettings, project) - * except everything is MODAL_SYNC - */ -private fun _attachGradleProjectAndRefresh( - gradleProjectSettings: GradleProjectSettings, - project: Project -) { - val externalProjectPath = gradleProjectSettings.externalProjectPath - ExternalProjectsManagerImpl.getInstance(project).runWhenInitialized { - DumbService.getInstance(project).runWhenSmart { - ExternalSystemUtil.ensureToolWindowInitialized(project, GradleConstants.SYSTEM_ID) - } - } - - ExternalProjectsManagerImpl.disableProjectWatcherAutoUpdate(project) - val settings = ExternalSystemApiUtil.getSettings(project, GradleConstants.SYSTEM_ID) - if (settings.getLinkedProjectSettings(externalProjectPath) == null) { - settings.linkProject(gradleProjectSettings) - } - - StatefulTestGradleProjectRefreshCallback(externalProjectPath, project).use { callback -> - ExternalSystemUtil.refreshProject( - externalProjectPath, - ImportSpecBuilder(project, GradleConstants.SYSTEM_ID) - .use(ProgressExecutionMode.MODAL_SYNC) - .callback(callback) - .build() - ) - } -} diff --git a/idea/resources-descriptors/META-INF/plugin.xml.193 b/idea/resources-descriptors/META-INF/plugin.xml.193 deleted file mode 100644 index bc87bd38f43..00000000000 --- a/idea/resources-descriptors/META-INF/plugin.xml.193 +++ /dev/null @@ -1,189 +0,0 @@ - - org.jetbrains.kotlin - - Kotlin - -Getting Started in IntelliJ IDEA
-Getting Started in Android Studio
-Public Slack
-Issue tracker
-]]>
- @snapshot@ - JetBrains - - - - 1.4.20 -

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

-

1.4.0

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

- To get the most out of the changes and improvements introduced in Kotlin 1.4, join our Online Event where you will be able to enjoy four days of Kotlin talks, Q&As with the Kotlin team, and more. - ]]> - - - com.intellij.modules.platform - - JUnit - com.intellij.gradle - org.jetbrains.plugins.gradle - org.jetbrains.plugins.gradle - org.intellij.groovy - org.jetbrains.idea.maven - TestNG-J - Coverage - com.intellij.java-i18n - org.jetbrains.java.decompiler - Git4Idea - org.jetbrains.debugger.streams - com.intellij.stats.completion - - - - - com.intellij.modules.idea - com.intellij.modules.java - JavaScriptDebugger - com.intellij.copyright - org.intellij.intelliLang - - - - - - - - - - - - - - - - - - - - - - - - org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener - - - - - - org.jetbrains.kotlin.idea.PluginStartupComponent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/gradle-java.xml.193 b/idea/resources/META-INF/gradle-java.xml.193 deleted file mode 100644 index e0fc7cb7db5..00000000000 --- a/idea/resources/META-INF/gradle-java.xml.193 +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/gradle.xml.193 b/idea/resources/META-INF/gradle.xml.193 deleted file mode 100644 index 61cae8560a0..00000000000 --- a/idea/resources/META-INF/gradle.xml.193 +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/jvm.xml.193 b/idea/resources/META-INF/jvm.xml.193 deleted file mode 100644 index c2f9fde42c4..00000000000 --- a/idea/resources/META-INF/jvm.xml.193 +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.193 b/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.193 deleted file mode 100644 index e1c7159a232..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/KotlinDocumentationProviderCompat.kt.193 +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea - -// FIX ME WHEN BUNCH 201 REMOVED -class KotlinDocumentationProvider : KotlinDocumentationProviderCompatBase() \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt.193 b/idea/src/org/jetbrains/kotlin/idea/KotlinPluginMacros.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 deleted file mode 100644 index 87ed061e3eb..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2010-2020 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; - -import com.intellij.openapi.application.PathMacros; -import com.intellij.openapi.components.BaseComponent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.utils.PathUtil; - -public class PluginStartupComponent implements BaseComponent { - - private static final String KOTLIN_BUNDLED = "KOTLIN_BUNDLED"; - - @Override - @NotNull - public String getComponentName() { - return PluginStartupComponent.class.getName(); - } - - @Override - public void initComponent() { - registerPathVariable(); - } - - private static void registerPathVariable() { - PathMacros macros = PathMacros.getInstance(); - macros.setMacro(KOTLIN_BUNDLED, PathUtil.getKotlinPathsForIdeaPlugin().getHomePath().getPath()); - } - - @Override - public void disposeComponent() {} -} diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt.193 b/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt.193 deleted file mode 100644 index ed8af9ec992..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/BreadcrumbsProviderCompatBase.kt.193 +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.codeInsight - -import com.intellij.xml.breadcrumbs.BreadcrumbsInfoProvider - -// FIX ME WHEN BUNCH 201 REMOVED -typealias BreadcrumbsProviderCompatBase = BreadcrumbsInfoProvider \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinRefactoringHelperForDelayedRequests.kt.193 b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinRefactoringHelperForDelayedRequests.kt.193 deleted file mode 100644 index fef84de6423..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinRefactoringHelperForDelayedRequests.kt.193 +++ /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.codeInsight - -import com.intellij.openapi.project.Project -import com.intellij.refactoring.RefactoringHelper -import com.intellij.usageView.UsageInfo -import org.jetbrains.kotlin.idea.codeInsight.shorten.performDelayedRefactoringRequests -import org.jetbrains.kotlin.idea.codeInsight.shorten.prepareDelayedRequests -import org.jetbrains.kotlin.idea.util.application.runWriteAction - -class KotlinRefactoringHelperForDelayedRequests : RefactoringHelper { - override fun prepareOperation(usages: Array?): Any? { - if (usages != null && usages.isNotEmpty()) { - val project = usages[0].project - prepareDelayedRequests(project) - } - return null - } - - override fun performOperation(project: Project, operationData: Any?) { - runWriteAction { performDelayedRefactoringRequests(project) } - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/hierarchy/calls/compat.kt.193 b/idea/src/org/jetbrains/kotlin/idea/hierarchy/calls/compat.kt.193 deleted file mode 100644 index 0b7f86715d6..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/hierarchy/calls/compat.kt.193 +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -@file:Suppress("TYPEALIAS_EXPANSION_DEPRECATION", "DEPRECATION", "UnstableApiUsage") - -package org.jetbrains.kotlin.idea.hierarchy.calls - -import com.intellij.ide.hierarchy.call.CalleeMethodsTreeStructure -import com.intellij.ide.hierarchy.call.CallerMethodsTreeStructure -import com.intellij.openapi.project.Project -import com.intellij.psi.PsiMethod - -// FIX ME WHEN BUNCH 193 REMOVED -fun createCallerMethodsTreeStructure(project: Project, method: PsiMethod, scopeType: String): CallerMethodsTreeStructure { - return CallerMethodsTreeStructure(project, method, scopeType) -} - -// FIX ME WHEN BUNCH 193 REMOVED -fun createCalleeMethodsTreeStructure(project: Project, method: PsiMethod, scopeType: String): CalleeMethodsTreeStructure { - return CalleeMethodsTreeStructure(project, method, scopeType) -} diff --git a/idea/src/org/jetbrains/kotlin/idea/navigationToolbar/AbstractNavBarModelExtensionCompatBase.kt.193 b/idea/src/org/jetbrains/kotlin/idea/navigationToolbar/AbstractNavBarModelExtensionCompatBase.kt.193 deleted file mode 100644 index 14c48d2e50d..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/navigationToolbar/AbstractNavBarModelExtensionCompatBase.kt.193 +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.navigationToolbar - -import com.intellij.ide.navigationToolbar.AbstractNavBarModelExtension -import com.intellij.psi.PsiElement - -// FIX ME WHEN BUNCH 193 REMOVED -abstract class AbstractNavBarModelExtensionCompatBase : AbstractNavBarModelExtension() { - - protected abstract fun adjustElementImpl(psiElement: PsiElement?): PsiElement? - - override fun adjustElement(psiElement: PsiElement): PsiElement? = - adjustElementImpl(psiElement) -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/projectView/compat.kt.193 b/idea/src/org/jetbrains/kotlin/idea/projectView/compat.kt.193 deleted file mode 100644 index e05f305edd5..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/projectView/compat.kt.193 +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.projectView - -import com.intellij.ide.util.treeView.AbstractTreeNode - -// FIX ME WHEN BUNCH 193 REMOVED -typealias AbstractTreeNodeAny = AbstractTreeNode \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java.193 deleted file mode 100644 index b62633af738..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/BunchedDeprecation.java.193 +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.refactoring.changeSignature; - -import com.intellij.psi.PsiElement; -import com.intellij.refactoring.util.TextOccurrencesUtil; -import com.intellij.usageView.UsageInfo; - -import java.util.Collection; - -// FIX ME WHEN BUNCH 201 REMOVED -final class BunchedDeprecation { - public static void findNonCodeUsages( - PsiElement element, - String stringToSearch, - boolean searchInStringsAndComments, - boolean searchInNonJavaFiles, - String newQName, - Collection results) { - TextOccurrencesUtil.findNonCodeUsages(element, stringToSearch, searchInStringsAndComments, searchInNonJavaFiles, newQName, results); - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureCompat.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureCompat.kt.193 deleted file mode 100644 index 726d23b3701..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureCompat.kt.193 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.refactoring.changeSignature.ui - -import com.intellij.openapi.project.Project -import com.intellij.openapi.ui.Messages -import com.intellij.openapi.ui.Messages.OkCancelResult -import org.jetbrains.kotlin.descriptors.DescriptorVisibility -import javax.swing.Icon - -// FIX ME WHEN BUNCH 193 REMOVED - -@OkCancelResult -fun showOkCancelDialog( - project: Project?, - message: String?, - title: String, - icon: Icon? -): Int { - return Messages.showOkCancelDialog( - project, - message, - title, - icon - ) -} - -typealias ComboBox = javax.swing.JComboBox diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinInnerHandler.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/MoveKotlinInnerHandler.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java.193 deleted file mode 100644 index a7542175dec..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/BunchedDeprecation.java.193 +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations; - -import com.intellij.psi.PsiElement; -import com.intellij.refactoring.util.TextOccurrencesUtil; -import com.intellij.usageView.UsageInfo; - -import java.util.Collection; - -// FIX ME WHEN BUNCH 201 REMOVED -final class BunchedDeprecation { - public static void findNonCodeUsages( - PsiElement element, - String stringToSearch, - boolean searchInStringsAndComments, - boolean searchInNonJavaFiles, - String newQName, - Collection results) { - TextOccurrencesUtil.findNonCodeUsages(element, stringToSearch, searchInStringsAndComments, searchInNonJavaFiles, newQName, results); - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignaturePresentationBuilder.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignaturePresentationBuilder.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailability.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailability.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringExecution.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringExecution.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringStateChanges.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringStateChanges.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringSupport.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringSupport.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringUI.kt.193 b/idea/src/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringUI.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java.193 b/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java.193 deleted file mode 100644 index 7b644fd8bae..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/script/configuration/KotlinScriptingSettingsConfigurable.java.193 +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.idea.script.configuration; - -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; -import com.intellij.openapi.options.UnnamedConfigurable; -import com.intellij.openapi.project.Project; -import com.intellij.ui.TitledSeparator; -import com.intellij.ui.ToolbarDecorator; -import com.intellij.ui.components.panels.VerticalLayout; -import com.intellij.ui.table.TableView; -import com.intellij.util.ui.UIUtil; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.kotlin.idea.KotlinBundle; -import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager; -import org.jetbrains.kotlin.idea.core.script.settings.KotlinScriptingSettings; -import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.List; - -public class KotlinScriptingSettingsConfigurable implements SearchableConfigurable { - public static final String ID = "preferences.language.Kotlin.scripting"; - - private JPanel root; - private JPanel panelScriptDefinitionsChooser; - private JPanel additionalSettingsPanel; - - private final List scriptingSuppportSettingsConfigurables = new ArrayList<>(); - - private final KotlinScriptDefinitionsModel model; - - private final Project project; - private final ScriptDefinitionsManager manager; - private final KotlinScriptingSettings settings; - - public KotlinScriptingSettingsConfigurable(Project project) { - this.project = project; - manager = ScriptDefinitionsManager.Companion.getInstance(project); - settings = KotlinScriptingSettings.Companion.getInstance(project); - model = KotlinScriptDefinitionsModel.Companion.createModel(manager.getAllDefinitions(), settings); - } - - @Nullable - @Override - public JComponent createComponent() { - panelScriptDefinitionsChooser.setLayout(new VerticalLayout(0)); - - panelScriptDefinitionsChooser.add(new TitledSeparator(KotlinBundle.message("kotlin.script.definitions.title"))); - - JLabel commentLabel = new JLabel(KotlinBundle.message("kotlin.script.definitions.model.name.autoReloadScriptDependencies.description")); - commentLabel.setForeground(UIUtil.getContextHelpForeground()); - panelScriptDefinitionsChooser.add(commentLabel); - - TableView table = new TableView<>(model); - panelScriptDefinitionsChooser.add( - ToolbarDecorator.createDecorator(table) - .disableAddAction() - .disableRemoveAction() - .createPanel() - ); - - additionalSettingsPanel.setLayout(new VerticalLayout(0)); - - List providers = - ScriptingSupportSpecificSettingsProvider.SETTINGS_PROVIDERS.getExtensionList(project); - for (ScriptingSupportSpecificSettingsProvider provider : providers) { - additionalSettingsPanel.add(new TitledSeparator(provider.getTitle())); - - UnnamedConfigurable configurable = provider.createConfigurable(); - scriptingSuppportSettingsConfigurables.add(configurable); - - additionalSettingsPanel.add(configurable.createComponent()); - } - return root; - } - - @Override - public boolean isModified() { - for (UnnamedConfigurable supportSpecificSetting : scriptingSuppportSettingsConfigurables) { - if (supportSpecificSetting.isModified()) { - return true; - } - } - - return isScriptDefinitionsChanged(); - } - - @Override - public void apply() throws ConfigurationException { - if (isScriptDefinitionsChanged()) { - for (ModelDescriptor item : model.getItems()) { - ScriptDefinition definition = item.getDefinition(); - int order = model.getItems().indexOf(item); - settings.setOrder(definition, order); - settings.setEnabled(definition, item.isEnabled()); - settings.setAutoReloadConfigurations(definition, item.getAutoReloadConfigurations()); - } - - manager.reorderScriptDefinitions(); - } - - for (UnnamedConfigurable supportSpecificSetting : scriptingSuppportSettingsConfigurables) { - supportSpecificSetting.apply(); - } - } - - @Override - public void reset() { - model.setDefinitions(manager.getAllDefinitions(), settings); - for (UnnamedConfigurable supportSpecificSetting : scriptingSuppportSettingsConfigurables) { - supportSpecificSetting.reset(); - } - } - - private boolean isScriptDefinitionsChanged() { - for (ModelDescriptor item : model.getItems()) { - if (settings.isScriptDefinitionEnabled(item.getDefinition()) != item.isEnabled()) { - return true; - } - if (settings.autoReloadConfigurations(item.getDefinition()) != item.getAutoReloadConfigurations()) { - return true; - } - } - return !model.getDefinitions().equals(manager.getAllDefinitions()); - } - - - @Override - @Nls - public String getDisplayName() { - return KotlinBundle.message("script.name.kotlin.scripting"); - } - - @Override - @NotNull - public String getId() { - return ID; - } -} diff --git a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.193 b/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.193 deleted file mode 100644 index 219bb5527a0..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/slicer/KotlinUsageContextDataFlowPanelBase.kt.193 +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.slicer - -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.idea.KotlinBundle -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 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() = KotlinBundle.message("slicer.title.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() = KotlinBundle.message("slicer.title.dataflow.from.here") - } -} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/startupCompat.kt.193 b/idea/src/org/jetbrains/kotlin/idea/startupCompat.kt.193 deleted file mode 100644 index ba5a504a5b8..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/startupCompat.kt.193 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea - -import com.intellij.openapi.project.Project - -// FIX ME WHEN BUNCH 193 REMOVED -fun runActivity(project: Project) { - // nothing for 193 -} \ No newline at end of file diff --git a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.193 b/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.193 deleted file mode 100644 index 62944811dec..00000000000 --- a/idea/testData/gradle/testRunConfigurations/preferredConfigurations/src/test/kotlin/MyKotlinTest.kt.193 +++ /dev/null @@ -1,11 +0,0 @@ -import org.junit.Test - -class MyKotlinTest { - @Test - fun testA() { - } - - @Test - fun testB() { - } -} \ No newline at end of file diff --git a/idea/testData/navigationToolbar/ClassProperty.kt.193 b/idea/testData/navigationToolbar/ClassProperty.kt.193 deleted file mode 100644 index 4a43c8154c8..00000000000 --- a/idea/testData/navigationToolbar/ClassProperty.kt.193 +++ /dev/null @@ -1,8 +0,0 @@ -// NAV_BAR_ITEMS: src, ClassProperty - -class ClassProperty { - val foo: Int - get() { - return 42 - } -} \ No newline at end of file diff --git a/idea/testData/navigationToolbar/MethodInClass.kt.193 b/idea/testData/navigationToolbar/MethodInClass.kt.193 deleted file mode 100644 index 48d174267b7..00000000000 --- a/idea/testData/navigationToolbar/MethodInClass.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -// NAV_BAR_ITEMS: src, MethodInClass - -class MethodInClass { - fun foo() { } -} \ No newline at end of file diff --git a/idea/testData/navigationToolbar/SeveralClassesInFile.kt.193 b/idea/testData/navigationToolbar/SeveralClassesInFile.kt.193 deleted file mode 100644 index 513cc5c22d8..00000000000 --- a/idea/testData/navigationToolbar/SeveralClassesInFile.kt.193 +++ /dev/null @@ -1,13 +0,0 @@ -// NAV_BAR_ITEMS: src, SeveralClassesInFile.kt - -class Foo { - -} - -class SeveralClassesInFile { - -} - -fun method() { - -} diff --git a/idea/testData/navigationToolbar/fileNameDoesntMatchClassName.kt.193 b/idea/testData/navigationToolbar/fileNameDoesntMatchClassName.kt.193 deleted file mode 100644 index 972955af0c3..00000000000 --- a/idea/testData/navigationToolbar/fileNameDoesntMatchClassName.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -// NAV_BAR_ITEMS: src, fileNameDoesntMatchClassName.kt - -class Foo { - fun bar() { } -} diff --git a/idea/testData/navigationToolbar/topLevelFunction.kt.193 b/idea/testData/navigationToolbar/topLevelFunction.kt.193 deleted file mode 100644 index 0694a9a3a68..00000000000 --- a/idea/testData/navigationToolbar/topLevelFunction.kt.193 +++ /dev/null @@ -1,9 +0,0 @@ -// NAV_BAR_ITEMS: src, topLevelFunction.kt - -fun foo() { - val bar = "string" -} - -class SomeClass { - -} diff --git a/idea/testData/navigationToolbar/topLevelProperty.kt.193 b/idea/testData/navigationToolbar/topLevelProperty.kt.193 deleted file mode 100644 index 055c49a1509..00000000000 --- a/idea/testData/navigationToolbar/topLevelProperty.kt.193 +++ /dev/null @@ -1,6 +0,0 @@ -// NAV_BAR_ITEMS: src, topLevelProperty.kt - -val foo: Int - get() { - return 1 - } \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/a/specificImport.kt.193 b/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/a/specificImport.kt.193 deleted file mode 100644 index d1a9d5d7720..00000000000 --- a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/a/specificImport.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -package a - -fun bar() { - val t: b.X = b.X() -} \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/b/specificImport.kt.193 b/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/b/specificImport.kt.193 deleted file mode 100644 index 20a79ef33ae..00000000000 --- a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInAnotherPackage/after/b/specificImport.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -package b - -fun bar() { - val t: b.X = b.X() -} \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackage/after/a/specificImport.kt.193 b/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackage/after/a/specificImport.kt.193 deleted file mode 100644 index c097f16a1e9..00000000000 --- a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackage/after/a/specificImport.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -package a - -fun bar(s: String) { - val t: a.X = a.X() -} \ No newline at end of file diff --git a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackageAndRename/after/a/specificImport.kt.193 b/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackageAndRename/after/a/specificImport.kt.193 deleted file mode 100644 index 6ed96e3c617..00000000000 --- a/idea/testData/refactoring/move/java/moveClass/moveInnerToTop/moveNestedClassToTopLevelInTheSamePackageAndRename/after/a/specificImport.kt.193 +++ /dev/null @@ -1,5 +0,0 @@ -package a - -fun bar(s: String) { - val t: a.Y = a.Y() -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt.193 b/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt.193 deleted file mode 100644 index 08d9f4b8f3c..00000000000 --- a/idea/tests/org/jetbrains/kotlin/findUsages/customUsageSearcher.kt.193 +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.findUsages - -import com.intellij.util.Processor - -// FIX ME WHEN BUNCH 193 REMOVED -typealias ProcessorInCompat = Processor \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/PsiElementChecker.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/PsiElementChecker.kt.193 deleted file mode 100644 index 26fe638f7ec..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/caches/resolve/PsiElementChecker.kt.193 +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.caches.resolve - -import com.intellij.openapi.util.Key -import com.intellij.psi.* -import org.jetbrains.kotlin.asJava.elements.KtLightElement -import org.jetbrains.kotlin.asJava.elements.KtLightModifierList -import org.jetbrains.kotlin.idea.KotlinLanguage -import org.junit.Assert - -object PsiElementChecker { - val TEST_DATA_KEY = Key.create("Test Key") - - fun checkPsiElementStructure(lightClass: PsiClass) { - checkPsiElement(lightClass) - - lightClass.methods.forEach { - it.parameterList.parameters.forEach { checkPsiElement(it) } - checkPsiElement(it) - } - - lightClass.fields.forEach { checkPsiElement(it) } - - lightClass.innerClasses.forEach { checkPsiElementStructure(it) } - } - - private fun checkPsiElement(element: PsiElement) { - if (element !is KtLightElement<*, *> && element !is KtLightModifierList<*>) return - - if (element is PsiModifierListOwner) { - val modifierList = element.modifierList - if (modifierList != null) { - checkPsiElement(modifierList) - } - } - - if (element is PsiTypeParameterListOwner) { - val typeParameterList = element.typeParameterList - if (typeParameterList != null) { - checkPsiElement(typeParameterList) - typeParameterList.typeParameters.forEach { checkPsiElement(it) } - } - } - - with(element) { - try { - Assert.assertEquals("Number of methods has changed. Please update test.", 55, PsiElement::class.java.methods.size) - - project - Assert.assertTrue(language == KotlinLanguage.INSTANCE) - manager - children - parent - firstChild - lastChild - nextSibling - prevSibling - containingFile - textRange - //textRangeInParent - throws an exception for non-physical elements, it is expected behaviour - startOffsetInParent - textLength - findElementAt(0) - findReferenceAt(0) - textOffset - text - textToCharArray() - navigationElement - originalElement - textMatches("") - Assert.assertTrue(textMatches(this)) - textContains('a') - accept(PsiElementVisitor.EMPTY_VISITOR) - acceptChildren(PsiElementVisitor.EMPTY_VISITOR) - - val copy = copy() - Assert.assertTrue(copy == null || copy::class.java == this::class.java) - - // Modify methods: - // add(this) - // addBefore(this, lastChild) - // addAfter(firstChild, this) - // checkAdd(this) - // addRange(firstChild, lastChild) - // addRangeBefore(firstChild, lastChild, lastChild) - // addRangeAfter(firstChild, lastChild, firstChild) - // delete() - // checkDelete() - // deleteChildRange(firstChild, lastChild) - // replace(this) - - Assert.assertTrue(isValid) - isWritable - reference - references - putCopyableUserData(TEST_DATA_KEY, 12) - - Assert.assertTrue(getCopyableUserData(TEST_DATA_KEY) == 12) - // Assert.assertTrue(copy().getCopyableUserData(TEST_DATA_KEY) == 12) { this } Doesn't work - - // processDeclarations(...) - - context - isPhysical - resolveScope - useScope - node - toString() - Assert.assertTrue(isEquivalentTo(this)) - } catch (t: Throwable) { - throw AssertionErrorWithCause("Failed for ${this::class.java} ${this}", t) - } - } - } -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt.193 deleted file mode 100644 index 865bde9426d..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractRenderingKDocTest.kt.193 +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.codeInsight - -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase - -//BUNCH 201 -abstract class AbstractRenderingKDocTest : KotlinLightCodeInsightFixtureTestCase() { - protected fun doTest(path: String) = Unit -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/navigationToolbar/AbstractKotlinNavBarTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/navigationToolbar/AbstractKotlinNavBarTest.kt.193 deleted file mode 100644 index 8c65f9b10fd..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/navigationToolbar/AbstractKotlinNavBarTest.kt.193 +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.navigationToolbar - -import com.intellij.ide.navigationToolbar.NavBarModel -import com.intellij.ide.navigationToolbar.NavBarModelExtension -import com.intellij.ide.navigationToolbar.NavBarPresentation -import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.editor.ex.EditorEx -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.test.InTextDirectivesUtils - - -abstract class AbstractKotlinNavBarTest : KotlinLightCodeInsightFixtureTestCase() { - - // inspired by: com.intellij.ide.navigationToolbar.JavaNavBarTest#assertNavBarModel - protected fun doTest(testPath: String) { - val psiFile = myFixture.configureByFile(testDataFile().name) - val model = NavBarModel(myFixture.project) - - model::class.java.getDeclaredMethod("updateModel", DataContext::class.java) - .apply { isAccessible = true } - .invoke(model, (myFixture.editor as EditorEx).dataContext) - - val actualItems = (0 until model.size()).map { - NavBarPresentation.calcPresentableText(model[it]) - } - val expectedItems = InTextDirectivesUtils.findListWithPrefixes(psiFile.text, "// NAV_BAR_ITEMS:") - assertOrderedEquals(actualItems, expectedItems) - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/compat.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/quickfix/compat.kt.193 deleted file mode 100644 index 4b0b9bdc2a4..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/compat.kt.193 +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.quickfix - -import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.openapi.editor.Editor -import com.intellij.psi.PsiFile -import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl - -// FIX ME WHEN BUNCH 193 REMOVED -fun invokeIntentionCompat(action: IntentionAction, file: PsiFile, editor: Editor) { - CodeInsightTestFixtureImpl.invokeIntention(action, file, editor, action.text) -} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignatureChangePresentationTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSignatureChangePresentationTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailabilityTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringAvailabilityTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeCollectorTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeCollectorTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeListenerTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringChangeListenerTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringTest.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/suggested/KotlinSuggestedRefactoringTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/tests/org/jetbrains/kotlin/idea/resolve/compat.kt.193 b/idea/tests/org/jetbrains/kotlin/idea/resolve/compat.kt.193 deleted file mode 100644 index 7b7285977c6..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/resolve/compat.kt.193 +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.idea.resolve - -import com.intellij.mock.MockProject -import com.intellij.pom.PomModel -import com.intellij.pom.tree.TreeAspect -import org.jetbrains.kotlin.idea.caches.trackers.KotlinCodeBlockModificationListener - -internal fun createAndRegisterKotlinCodeBlockModificationListener(project: MockProject, pomModel: PomModel, treeAspect: TreeAspect) { - project.registerService(PomModel::class.java, pomModel) - project.picoContainer.registerComponentInstance( - KotlinCodeBlockModificationListener(project, treeAspect) - ) -} - -internal fun unregisterKotlinCodeBlockModificationListener(project: MockProject) { - val picoContainer = project.picoContainer - picoContainer.unregisterComponent(KotlinCodeBlockModificationListener::class.java) - picoContainer.unregisterComponent(PomModel::class.java) -} \ No newline at end of file diff --git a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.193 b/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.193 deleted file mode 100644 index 44f97066eb6..00000000000 --- a/j2k/tests/org/jetbrains/kotlin/j2k/AbstractJavaToKotlinConverterForWebDemoTest.kt.193 +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.j2k - -import com.intellij.codeInsight.ContainerProvider -import com.intellij.codeInsight.NullableNotNullManager -import com.intellij.codeInsight.NullableNotNullManagerImpl -import com.intellij.codeInsight.runner.JavaMainMethodProvider -import com.intellij.core.CoreApplicationEnvironment -import com.intellij.core.JavaCoreApplicationEnvironment -import com.intellij.core.JavaCoreProjectEnvironment -import com.intellij.lang.MetaLanguage -import com.intellij.lang.jvm.facade.JvmElementProvider -import com.intellij.openapi.extensions.Extensions -import com.intellij.openapi.extensions.ExtensionsArea -import com.intellij.openapi.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.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 { - // FIXME: There is no `Extensions.cleanRootArea` in 193 platform - // Extensions.cleanRootArea(DISPOSABLE) - val area = Extensions.getRootArea() - - registerExtensionPoints(area) - - val applicationEnvironment = JavaCoreApplicationEnvironment(DISPOSABLE) - val javaCoreEnvironment = object : JavaCoreProjectEnvironment(DISPOSABLE, applicationEnvironment) { - override fun preregisterServices() { - val projectArea = Extensions.getArea(project) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, PsiElementFinder.EP_NAME, PsiElementFinder::class.java) - CoreApplicationEnvironment.registerExtensionPoint(projectArea, JvmElementProvider.EP_NAME, JvmElementProvider::class.java) - } - } - - javaCoreEnvironment.project.registerService(NullableNotNullManager::class.java, object : NullableNotNullManagerImpl(javaCoreEnvironment.project) { - override fun isNullable(owner: PsiModifierListOwner, checkBases: Boolean) = !isNotNull(owner, checkBases) - override fun isNotNull(owner: PsiModifierListOwner, checkBases: Boolean) = true - override fun hasHardcodedContracts(element: PsiElement): Boolean = false - override fun getNullables() = emptyList() - override fun setNullables(vararg p0: String) = Unit - override fun getNotNulls() = emptyList() - override fun setNotNulls(vararg p0: String) = Unit - override fun getDefaultNullable() = "" - override fun setDefaultNullable(defaultNullable: String) = Unit - override fun getDefaultNotNull() = "" - override fun setDefaultNotNull(p0: String) = Unit - override fun setInstrumentedNotNulls(p0: List) = Unit - override fun getInstrumentedNotNulls() = emptyList() - }) - - applicationEnvironment.application.registerService(JavaClassSupers::class.java, JavaClassSupersImpl::class.java) - - for (root in PathUtil.getJdkClassesRootsFromCurrentJre()) { - javaCoreEnvironment.addJarToClassPath(root) - } - val annotations: File? = findAnnotations() - if (annotations != null && annotations.exists()) { - javaCoreEnvironment.addJarToClassPath(annotations) - } - return javaCoreEnvironment - } - - private fun registerExtensionPoints(area: ExtensionsArea) { - CoreApplicationEnvironment.registerExtensionPoint(area, 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, ClassFileDecompilers.EP_NAME, ClassFileDecompilers.Decompiler::class.java) - - CoreApplicationEnvironment.registerExtensionPoint(area, TypeAnnotationModifier.EP_NAME, TypeAnnotationModifier::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, MetaLanguage.EP_NAME, MetaLanguage::class.java) - CoreApplicationEnvironment.registerExtensionPoint(area, JavaModuleSystem.EP_NAME, JavaModuleSystem::class.java) - } - - fun findAnnotations(): File? { - var classLoader = JavaToKotlinTranslator::class.java.classLoader - while (classLoader != null) { - val loader = classLoader - if (loader is URLClassLoader) { - for (url in loader.urLs) { - if ("file" == url.protocol && url.file!!.endsWith("/annotations.jar")) { - return File(url.file!!) - } - } - } - classLoader = classLoader.parent - } - return null - } -} diff --git a/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.193 b/plugins/uast-kotlin-idea/src/org/jetbrains/uast/kotlin/generate/KotlinUastCodeGenerationPlugin.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/plugins/uast-kotlin/tests/KotlinUastGenerationTest.kt.193 b/plugins/uast-kotlin/tests/KotlinUastGenerationTest.kt.193 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/mute-platform.csv.193 b/tests/mute-platform.csv.193 deleted file mode 100644 index 2b1f9d59f75..00000000000 --- a/tests/mute-platform.csv.193 +++ /dev/null @@ -1,119 +0,0 @@ -Test key, Issue, State (optional: MUTE or FAIL), Status (optional: FLAKY) -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.simpleAndroidAppWithCommonModule, KT-35225,, -org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testTransitiveImplementWithAndroid, KT-35225,, -org.jetbrains.kotlin.idea.caches.resolve.MultiModuleLineMarkerTestGenerated.testKotlinTestAnnotations, No line markers for test run,, -org.jetbrains.kotlin.idea.codeInsight.InspectionTestGenerated.Inspections.testAndroidIllegalIdentifiers_inspectionData_Inspections_test, Unprocessed,, -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testTwoClasses,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValAndClass,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Order.testValOrder,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Val.testValWithTypeWoInitializer,,, FLAKY -org.jetbrains.kotlin.idea.codeInsight.surroundWith.SurroundWithTestGenerated.If.MoveDeclarationsOut.Var.testVarWithTypeWoInitializer, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Common.StaticMembers.testJavaStaticMethodsFromImports, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testNonPredictableSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties1, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.BoldOrGrayed.testSyntheticJavaProperties2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testNullableReceiver, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSafeCall, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSmartCast2, KT-32919,, -org.jetbrains.kotlin.idea.completion.test.JvmBasicCompletionTestGenerated.Java.SyntheticExtensions.testSyntheticExtensions1, KT-32919,, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testClassObject, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testConstructor, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testEnum, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testExtensionFunction, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testExtensionProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testGenericFunctionWithExplicitlyDeclaredTypeArguments, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testGenericFunctionWithInferredTypeArguments, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testGlobalFunction, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testGlobalProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testNamedObject, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testOverloadedFunWithTypeParam, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testSameNameInDifferentSources, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testTypeAlias, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestGenerated.testTypeWithSameShortName, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testClassObject, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testConstructor, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testEnum, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testExtensionFunction, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testExtensionProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testGenericFunctionWithExplicitlyDeclaredTypeArguments, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testGenericFunctionWithInferredTypeArguments, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testGlobalFunction, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testGlobalProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testNamedObject, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testOverloadedFunWithTypeParam, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testProperty, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testSameNameInDifferentSources, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testTypeAlias, KT-34542, FAIL, -org.jetbrains.kotlin.idea.decompiler.navigation.NavigateToLibrarySourceTestWithJSGenerated.testTypeWithSameShortName, KT-34542, FAIL, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunCallInLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.filters.KotlinExceptionFilterTestGenerated.testInlineFunInnerClassFromLibrary, Unprocessed,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testCoroutineContextCheck, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testDispatchersTypeDetection, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testLambdaReceiverType, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testNestedFunctionsInsideSuspendLambda, KT-34659,, -org.jetbrains.kotlin.idea.inspections.CoroutineNonBlockingContextDetectionTest.testSimpleCoroutineScope, KT-34659,, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression2, KT-34672, FAIL, -org.jetbrains.kotlin.idea.inspections.LocalInspectionTestGenerated.RedundantRequireNotNullCall.testUsedAsExpression3, KT-34672, FAIL, -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterPrimaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertFunctionTypeParameterToReceiver.testNonFirstParameterSecondaryConstructor, on ConvertFunctionTypeParameterToReceiver rerun,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesAndMembers, Enum reorder,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testInstancesOnly, Generated entries reordered,, FLAKY -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testBlankLineBetween, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testLongInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testPropertyWithAnnotation, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInit2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithBackticks3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithComments2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithSemicolons3, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.DeclarationAndAssignment.testSimpleInitWithType2, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.NestedIfs.testBlockBody, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testFunctionWithOneLineReturn, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testIf, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testNotSingleLineStatement, KT-34408,, -org.jetbrains.kotlin.idea.intentions.declarations.JoinLinesTestGenerated.RemoveBraces.testWhenEntry, KT-34408,, -org.jetbrains.kotlin.idea.navigation.KotlinGotoImplementationMultiModuleTestGenerated.testExpectClassSuperclassFun,,, FLAKY -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib1.testUseJavaFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib2.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.parameterInfo.ParameterInfoTestGenerated.WithLib3.testUseJavaSAMFromLib, KT-34542, FAIL, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiFileTestGenerated.ChangeSignature.Jk.testJkKeepValOnParameterTypeChange, Unprocessed,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertActualSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.quickfix.QuickFixMultiModuleTestGenerated.Other.testConvertExpectSealedClassToEnum, Enum reorder,, -org.jetbrains.kotlin.idea.refactoring.inline.InlineTestGenerated.Function.ExpressionBody.testMultipleInExpression, Unstable order of usages,,FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstanceWithLambda, final modifier added,, -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testJava_moveClass_moveInnerToTop_moveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance_MoveNestedClassToTopLevelInTheSamePackageAndAddOuterInstance, final modifier added,, -org.jetbrains.kotlin.idea.resolve.ReferenceResolveInLibrarySourcesTestGenerated.testInLibrarySource, KT-34542, FAIL, -org.jetbrains.kotlin.idea.resolve.ReferenceResolveInLibrarySourcesTestGenerated.testToFunParameter, KT-34542, FAIL, -org.jetbrains.kotlin.idea.resolve.ReferenceResolveInLibrarySourcesTestGenerated.testToLocalFun, KT-34542, FAIL, -org.jetbrains.uast.test.kotlin.KotlinUastReferencesTest.`test original getter is visible when reference is under renaming`, Extensions API changed,, -org.jetbrains.kotlin.idea.refactoring.introduce.ExtractionTestGenerated.IntroduceJavaParameter.testJavaMethodOverridingKotlinFunctionWithUsages, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.move.MoveTestGenerated.testKotlin_moveTopLevelDeclarations_moveFunctionToPackage_MoveFunctionToPackage, fail on TeamCity but works well locally,, FLAKY -org.jetbrains.kotlin.idea.refactoring.pullUp.PullUpTestGenerated.K2K.testAccidentalOverrides, Unprocessed,, FLAKY -org.jetbrains.kotlin.idea.refactoring.rename.RenameTestGenerated.testOverloadsWithSameOrigin_OverloadsWithSameOrigin, Bad imports after rename,, FLAKY -org.jetbrains.kotlin.idea.intentions.IntentionTestGenerated.ConvertSealedClassToEnum.testWithNonObjectInheritors, Enum reorder,, FLAKY -org.jetbrains.kotlin.gradle.HierarchicalMultiplatformProjectImportingTest.testImportIntermediateModules, KMM-304,, -"org.jetbrains.kotlin.gradle.HierarchicalMultiplatformProjectImportingTest.testJvmWithJavaOnHMPP[8: Gradle-6.5.1, KotlinGradlePlugin-master]", KMM-304,, -org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testProjectDependency, KMM-304,, -org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testNestedDependencies, KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP[4: Gradle-5.6.4, KotlinGradlePlugin-latest stable]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP[7: Gradle-6.5.1, KotlinGradlePlugin-latest stable]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testAndroidDependencyOnMPP[8: Gradle-6.5.1, KotlinGradlePlugin-master]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot[7: Gradle-5.6.4, KotlinGradlePlugin-latest stable]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testDependencyOnRoot[8: Gradle-6.5.1, KotlinGradlePlugin-master]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testJavaTransitiveOnMPP[8: Gradle-6.5.1, KotlinGradlePlugin-master]", KMM-304,, -"org.jetbrains.kotlin.gradle.NewMultiplatformProjectImportingTest.testImportBeforeBuild[8: Gradle-6.5.1, KotlinGradlePlugin-master]", KMM-304,, -"org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFileInProjectWithAndroid[7: Gradle-6.5.1, KotlinGradlePlugin-latest stable]", NoSuchMethodError,, -"org.jetbrains.kotlin.gradle.MultiplatformProjectImportingTest.testJsTestOutputFileInProjectWithAndroid[8: Gradle-6.5.1, KotlinGradlePlugin-master]", NoSuchMethodError,, -org.jetbrains.kotlin.idea.codeInsight.gradle.GradleFacetImportTest.testJDKImport, Old story with Idea core,, -"org.jetbrains.kotlin.ide.konan.gradle.GradleNativeLibrariesInIDENamingTest.testLibrariesNaming[0: with Gradle-4.10.2]", Old IDE with new plugin problem,, \ No newline at end of file