From 8c84f885ac3a5ec6d7d9efb268e6fc7e01c89dda Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Thu, 20 Jun 2019 19:31:23 +0700 Subject: [PATCH] Cleanup: apply RemoveRedundantQualifierNameInspection to idea --- idea/fir-view/src/FirExplorerToolWindow.kt | 4 +- .../idea/formatter/KotlinCommonBlock.kt | 196 +++++++++--------- .../formatter/ProjectCodeStyleImporter.kt | 4 +- .../idea/formatter/kotlinSpacingRules.kt | 7 +- .../resolve/IdePlatformKindResolution.kt | 2 +- .../idea/caches/project/multiplatformUtil.kt | 2 +- .../builtIns/KotlinBuiltInDecompiler.kt | 2 +- .../VariablesHighlightingVisitor.kt | 2 +- .../inspections/IntentionBasedInspection.kt | 2 +- .../idea/project/ResolveElementCache.kt | 6 +- .../KotlinReadWriteAccessDetector.kt | 20 +- .../ExpressionsOfTypeProcessor.kt | 8 +- .../completion/KotlinCompletionCharFilter.kt | 6 +- ...cludeFromCompletionLookupActionProvider.kt | 9 +- .../completion/ReferenceVariantsCollector.kt | 3 +- .../test/ExpectedCompletionUtils.kt | 4 +- .../kotlin/idea/core/ExpectedInfos.kt | 6 +- .../kotlin/idea/core/NameValidators.kt | 4 +- .../core/script/ScriptDefinitionsManager.kt | 2 +- .../git/KotlinExplicitMovementProvider.kt | 6 +- .../KotlinWithGradleConfigurator.kt | 2 +- .../NewMultiplatformProjectImportingTest.kt | 15 +- .../kotlin/config/KotlinFacetSettings.kt | 6 +- .../KotlinWithLibraryConfigurator.kt | 10 +- .../idea/framework/JavaFrameworkType.kt | 2 +- .../idea/injection/KotlinLanguageInjector.kt | 2 +- .../platform/CommonIdePlatformKindTooling.kt | 2 +- .../quickfix/ChangeCoroutineSupportFix.kt | 5 +- .../KotlinJUnitRunConfigurationProducer.kt | 2 +- .../scratch/ScratchFileLanguageProvider.kt | 2 +- .../kotlin/idea/vcs/BunchCheckinHandler.kt | 14 +- .../jetbrains/kotlin/idea/maven/PomFile.kt | 4 +- .../KotlinJavaMavenConfigurator.kt | 6 +- .../KotlinJavascriptMavenConfigurator.kt | 2 +- .../configuration/KotlinMavenConfigurator.kt | 6 +- .../kotlin/console/CommandHistory.kt | 2 +- .../test/org/jetbrains/eval4j/test/main.kt | 4 +- .../breakpoints/KotlinFieldBreakpoint.kt | 3 +- .../kotlin/idea/debugger/debuggerUtil.kt | 6 +- .../sequence/FilterIsInstanceHandler.kt | 4 +- .../idea/debugger/FileRankingCalculator.kt | 3 +- .../debugger/evaluate/KotlinDebuggerCaches.kt | 4 +- .../idea/perf/WholeProjectLightClassTest.kt | 2 +- .../perf/WholeProjectUltraLightClassTest.kt | 2 +- .../DeprecatedSymbolUsageFixBase.kt | 2 +- .../rename/RenameKotlinClassifierProcessor.kt | 3 +- ...AbstractLineMarkersTestInLibrarySources.kt | 2 +- .../AbstractConfigureKotlinTest.kt | 6 +- .../idea/debugger/LowLevelDebuggerTestBase.kt | 2 +- .../CodeFragmentCompletionInLibraryTest.kt | 4 +- .../AbstractNavigateToLibraryTest.kt | 2 +- .../jvm/KotlinJvmDeclarationSearcherTest.kt | 2 +- .../idea/refactoring/InplaceRenameTest.kt | 6 +- .../idea/run/runConfigurationTestUtil.kt | 2 +- .../kotlin/psi/AbstractInjectionTest.kt | 3 +- .../kotlin/psi/KotlinStdlibInjectionTest.kt | 30 +-- .../search/AnnotatedMembersSearchTest.kt | 2 +- 57 files changed, 227 insertions(+), 244 deletions(-) diff --git a/idea/fir-view/src/FirExplorerToolWindow.kt b/idea/fir-view/src/FirExplorerToolWindow.kt index d6c101b0469..7a080c54df6 100644 --- a/idea/fir-view/src/FirExplorerToolWindow.kt +++ b/idea/fir-view/src/FirExplorerToolWindow.kt @@ -188,7 +188,7 @@ class FirExplorerToolWindow(private val project: Project, private val toolWindow override fun getChildren(): Array { if (data == null) { - return SimpleNode.NO_CHILDREN + return NO_CHILDREN } else { val classOfData = data::class @@ -246,7 +246,7 @@ class FirExplorerToolWindow(private val project: Project, private val toolWindow } override fun getChildren(): Array { - if (data == null) return SimpleNode.NO_CHILDREN + if (data == null) return NO_CHILDREN return data.mapIndexed { index, any -> diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt index ea8d2c9c387..1c7d12e44fa 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt @@ -16,31 +16,29 @@ import com.intellij.psi.codeStyle.CommonCodeStyleSettings import com.intellij.psi.impl.source.tree.TreeUtil import com.intellij.psi.tree.IElementType import com.intellij.psi.tree.TokenSet -import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.KtNodeTypes.* import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings import org.jetbrains.kotlin.idea.formatter.NodeIndentStrategy.Companion.strategy import org.jetbrains.kotlin.idea.util.requireNode import org.jetbrains.kotlin.kdoc.lexer.KDocTokens import org.jetbrains.kotlin.kdoc.parser.KDocElementTypes -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.* import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.* private val QUALIFIED_OPERATION = TokenSet.create(DOT, SAFE_ACCESS) -private val QUALIFIED_EXPRESSIONS = TokenSet.create(KtNodeTypes.DOT_QUALIFIED_EXPRESSION, KtNodeTypes.SAFE_ACCESS_EXPRESSION) -private val ELVIS_SET = TokenSet.create(KtTokens.ELVIS) +private val QUALIFIED_EXPRESSIONS = TokenSet.create(DOT_QUALIFIED_EXPRESSION, SAFE_ACCESS_EXPRESSION) +private val ELVIS_SET = TokenSet.create(ELVIS) private const val KDOC_COMMENT_INDENT = 1 -private val BINARY_EXPRESSIONS = TokenSet.create(KtNodeTypes.BINARY_EXPRESSION, KtNodeTypes.BINARY_WITH_TYPE, KtNodeTypes.IS_EXPRESSION) +private val BINARY_EXPRESSIONS = TokenSet.create(BINARY_EXPRESSION, BINARY_WITH_TYPE, IS_EXPRESSION) private val KDOC_CONTENT = TokenSet.create(KDocTokens.KDOC, KDocElementTypes.KDOC_SECTION, KDocElementTypes.KDOC_TAG) -private val CODE_BLOCKS = TokenSet.create(KtNodeTypes.BLOCK, KtNodeTypes.CLASS_BODY, KtNodeTypes.FUNCTION_LITERAL) +private val CODE_BLOCKS = TokenSet.create(BLOCK, CLASS_BODY, FUNCTION_LITERAL) private val ALIGN_FOR_BINARY_OPERATIONS = TokenSet.create(MUL, DIV, PERC, PLUS, MINUS, ELVIS, LT, GT, LTEQ, GTEQ, ANDAND, OROR) -private val ANNOTATIONS = TokenSet.create(KtNodeTypes.ANNOTATION_ENTRY, KtNodeTypes.ANNOTATION) +private val ANNOTATIONS = TokenSet.create(ANNOTATION_ENTRY, ANNOTATION) typealias WrappingStrategy = (childElement: ASTNode) -> Wrap? @@ -112,7 +110,7 @@ abstract class KotlinCommonBlock( nodeSubBlocks = splitSubBlocksOnDot(nodeSubBlocks) } else { val psi = node.psi - if (psi is KtBinaryExpression && psi.operationToken == KtTokens.ELVIS) { + if (psi is KtBinaryExpression && psi.operationToken == ELVIS) { nodeSubBlocks = splitSubBlocksOnElvis(nodeSubBlocks) } } @@ -162,7 +160,7 @@ abstract class KotlinCommonBlock( null, indent, wrap, spacingBuilder ) { val parent = it.treeParent ?: node - val skipOperationNodeParent = if (parent.elementType === KtNodeTypes.OPERATION_REFERENCE) { + val skipOperationNodeParent = if (parent.elementType === OPERATION_REFERENCE) { parent.treeParent ?: parent } else { parent @@ -187,16 +185,16 @@ abstract class KotlinCommonBlock( private fun isCallBlock(astBlock: ASTBlock): Boolean { val node = astBlock.requireNode() - return node.elementType in QUALIFIED_EXPRESSIONS && node.lastChildNode?.elementType == KtNodeTypes.CALL_EXPRESSION + return node.elementType in QUALIFIED_EXPRESSIONS && node.lastChildNode?.elementType == CALL_EXPRESSION } private fun canWrapCallChain(node: ASTNode): Boolean { val callChainParent = node.parents().firstOrNull { it.elementType !in QUALIFIED_EXPRESSIONS } ?: return true return callChainParent.elementType in CODE_BLOCKS || - callChainParent.elementType == KtNodeTypes.PROPERTY || - (callChainParent.elementType == KtNodeTypes.BINARY_EXPRESSION && - (callChainParent.psi as KtBinaryExpression).operationToken in KtTokens.ALL_ASSIGNMENTS) || - callChainParent.elementType == KtNodeTypes.RETURN + callChainParent.elementType == PROPERTY || + (callChainParent.elementType == BINARY_EXPRESSION && + (callChainParent.psi as KtBinaryExpression).operationToken in ALL_ASSIGNMENTS) || + callChainParent.elementType == RETURN } private fun splitSubBlocksOnElvis(nodeSubBlocks: List): List { @@ -244,7 +242,7 @@ abstract class KotlinCommonBlock( if (childParent != null) { val parentType = childParent.elementType - if (parentType === VALUE_PARAMETER_LIST || parentType === KtNodeTypes.VALUE_ARGUMENT_LIST) { + if (parentType === VALUE_PARAMETER_LIST || parentType === VALUE_ARGUMENT_LIST) { val prev = getPrevWithoutWhitespace(child) if (childType === RPAR && (prev == null || prev.elementType !== TokenType.ERROR_ELEMENT)) { return Indent.getNoneIndent() @@ -256,7 +254,7 @@ abstract class KotlinCommonBlock( Indent.getNormalIndent() } - if (parentType === KtNodeTypes.TYPE_PARAMETER_LIST || parentType === KtNodeTypes.TYPE_ARGUMENT_LIST) { + if (parentType === TYPE_PARAMETER_LIST || parentType === TYPE_ARGUMENT_LIST) { return Indent.getContinuationWithoutFirstIndent() } } @@ -267,15 +265,15 @@ abstract class KotlinCommonBlock( private fun isInCodeChunk(node: ASTNode): Boolean { val parent = node.treeParent ?: return false - if (node.elementType != KtNodeTypes.BLOCK) { + if (node.elementType != BLOCK) { return false } val parentType = parent.elementType - return parentType == KtNodeTypes.SCRIPT - || parentType == KtNodeTypes.BLOCK_CODE_FRAGMENT - || parentType == KtNodeTypes.EXPRESSION_CODE_FRAGMENT - || parentType == KtNodeTypes.TYPE_CODE_FRAGMENT + return parentType == SCRIPT + || parentType == BLOCK_CODE_FRAGMENT + || parentType == EXPRESSION_CODE_FRAGMENT + || parentType == TYPE_CODE_FRAGMENT } fun getChildAttributes(newChildIndex: Int): ChildAttributes { @@ -287,14 +285,14 @@ abstract class KotlinCommonBlock( if (type == IF) { val elseBlock = mySubBlocks?.getOrNull(newChildIndex) - if (elseBlock != null && elseBlock.requireNode().elementType == KtTokens.ELSE_KEYWORD) { + if (elseBlock != null && elseBlock.requireNode().elementType == ELSE_KEYWORD) { return ChildAttributes.DELEGATE_TO_NEXT_CHILD } } if (newChildIndex > 0) { val prevBlock = mySubBlocks?.get(newChildIndex - 1) - if (prevBlock?.node?.elementType == KtNodeTypes.MODIFIER_LIST) { + if (prevBlock?.node?.elementType == MODIFIER_LIST) { return ChildAttributes(Indent.getNoneIndent(), null) } } @@ -309,7 +307,7 @@ abstract class KotlinCommonBlock( in QUALIFIED_EXPRESSIONS -> ChildAttributes(Indent.getContinuationWithoutFirstIndent(), null) - VALUE_PARAMETER_LIST, KtNodeTypes.VALUE_ARGUMENT_LIST -> { + VALUE_PARAMETER_LIST, VALUE_ARGUMENT_LIST -> { val subBlocks = getSubBlocks() if (newChildIndex != 1 && newChildIndex != 0 && newChildIndex < subBlocks.size) { val block = subBlocks[newChildIndex] @@ -317,7 +315,7 @@ abstract class KotlinCommonBlock( } else { val indent = if ((type == VALUE_PARAMETER_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_PARAMETER_LISTS) || - (type == KtNodeTypes.VALUE_ARGUMENT_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_ARGUMENT_LISTS) + (type == VALUE_ARGUMENT_LIST && !settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_ARGUMENT_LISTS) ) { Indent.getNormalIndent() } else { @@ -364,26 +362,26 @@ abstract class KotlinCommonBlock( return when { parentType === VALUE_PARAMETER_LIST -> getAlignmentForChildInParenthesis( - kotlinCommonSettings.ALIGN_MULTILINE_PARAMETERS, KtNodeTypes.VALUE_PARAMETER, COMMA, + kotlinCommonSettings.ALIGN_MULTILINE_PARAMETERS, VALUE_PARAMETER, COMMA, kotlinCommonSettings.ALIGN_MULTILINE_METHOD_BRACKETS, LPAR, RPAR ) - parentType === KtNodeTypes.VALUE_ARGUMENT_LIST -> + parentType === VALUE_ARGUMENT_LIST -> getAlignmentForChildInParenthesis( - kotlinCommonSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS, KtNodeTypes.VALUE_ARGUMENT, COMMA, + kotlinCommonSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS, VALUE_ARGUMENT, COMMA, kotlinCommonSettings.ALIGN_MULTILINE_METHOD_BRACKETS, LPAR, RPAR ) parentType === WHEN -> getAlignmentForCaseBranch(kotlinCustomSettings.ALIGN_IN_COLUMNS_CASE_BRANCH) - parentType === KtNodeTypes.WHEN_ENTRY -> + parentType === WHEN_ENTRY -> alignmentStrategy parentType in BINARY_EXPRESSIONS && getOperationType(node) in ALIGN_FOR_BINARY_OPERATIONS -> createAlignmentStrategy(kotlinCommonSettings.ALIGN_MULTILINE_BINARY_OPERATION, getAlignment()) - parentType === KtNodeTypes.SUPER_TYPE_LIST -> + parentType === SUPER_TYPE_LIST -> createAlignmentStrategy(kotlinCommonSettings.ALIGN_MULTILINE_EXTENDS_LIST, getAlignment()) parentType === PARENTHESIZED -> @@ -407,7 +405,7 @@ abstract class KotlinCommonBlock( } } - parentType == KtNodeTypes.TYPE_CONSTRAINT_LIST -> + parentType == TYPE_CONSTRAINT_LIST -> createAlignmentStrategy(true, getAlignment()) else -> @@ -425,7 +423,7 @@ abstract class KotlinCommonBlock( val childWrap = wrappingStrategy(child) // Skip one sub-level for operators, so type of block node is an element type of operator - if (child.elementType === KtNodeTypes.OPERATION_REFERENCE) { + if (child.elementType === OPERATION_REFERENCE) { val operationNode = child.firstChildNode if (operationNode != null) { return createBlock( @@ -449,7 +447,7 @@ abstract class KotlinCommonBlock( val childNodes = when { overrideChildren != null -> overrideChildren.asSequence() - node.elementType == KtNodeTypes.BINARY_EXPRESSION -> { + node.elementType == BINARY_EXPRESSION -> { val binaryExpression = node.psi as? KtBinaryExpression if (binaryExpression != null && ALL_ASSIGNMENTS.contains(binaryExpression.operationToken)) { node.children() @@ -473,14 +471,14 @@ abstract class KotlinCommonBlock( childrenAlignmentStrategy: CommonAlignmentStrategy, wrappingStrategy: WrappingStrategy ): Sequence { - if (node.elementType == KtNodeTypes.FUN && false /* TODO fix tests and restore */) { + if (node.elementType == FUN && false /* TODO fix tests and restore */) { val filteredChildren = node.children().filter { it.textRange.length > 0 && it.elementType != TokenType.WHITE_SPACE } - val significantChildren = filteredChildren.dropWhile { it.elementType == KtTokens.EOL_COMMENT } + val significantChildren = filteredChildren.dropWhile { it.elementType == EOL_COMMENT } val funIndent = extractIndent(significantChildren.first()) val eolComments = filteredChildren.takeWhile { - it.elementType == KtTokens.EOL_COMMENT && extractIndent(it) != funIndent + it.elementType == EOL_COMMENT && extractIndent(it) != funIndent }.toList() val remainingChildren = filteredChildren.drop(eolComments.size) @@ -495,7 +493,7 @@ abstract class KotlinCommonBlock( private fun collectBinaryExpressionChildren(node: ASTNode, result: MutableList) { for (child in node.children()) { - if (child.elementType == KtNodeTypes.BINARY_EXPRESSION) { + if (child.elementType == BINARY_EXPRESSION) { collectBinaryExpressionChildren(child, result) } else { result.add(child) @@ -510,23 +508,23 @@ abstract class KotlinCommonBlock( val nodePsi = node.psi when { - elementType === KtNodeTypes.VALUE_ARGUMENT_LIST -> { + elementType === VALUE_ARGUMENT_LIST -> { val wrapSetting = commonSettings.CALL_PARAMETERS_WRAP if ((wrapSetting == CommonCodeStyleSettings.WRAP_AS_NEEDED || wrapSetting == CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM) && !needWrapArgumentList(nodePsi) ) { return ::noWrapping } - return getWrappingStrategyForItemList(wrapSetting, KtNodeTypes.VALUE_ARGUMENT) + return getWrappingStrategyForItemList(wrapSetting, VALUE_ARGUMENT) } elementType === VALUE_PARAMETER_LIST -> { - if (parentElementType === KtNodeTypes.FUN || - parentElementType === KtNodeTypes.PRIMARY_CONSTRUCTOR || - parentElementType === KtNodeTypes.SECONDARY_CONSTRUCTOR) { + if (parentElementType === FUN || + parentElementType === PRIMARY_CONSTRUCTOR || + parentElementType === SECONDARY_CONSTRUCTOR) { val wrap = Wrap.createWrap(commonSettings.METHOD_PARAMETERS_WRAP, false) return { childElement -> - if (childElement.elementType === KtNodeTypes.VALUE_PARAMETER && !childElement.startsWithAnnotation()) + if (childElement.elementType === VALUE_PARAMETER && !childElement.startsWithAnnotation()) wrap else null @@ -534,15 +532,15 @@ abstract class KotlinCommonBlock( } } - elementType === KtNodeTypes.SUPER_TYPE_LIST -> { + elementType === SUPER_TYPE_LIST -> { val wrap = Wrap.createWrap(commonSettings.EXTENDS_LIST_WRAP, false) return { childElement -> if (childElement.psi is KtSuperTypeListEntry) wrap else null } } - elementType === KtNodeTypes.CLASS_BODY -> - return getWrappingStrategyForItemList(commonSettings.ENUM_CONSTANTS_WRAP, KtNodeTypes.ENUM_ENTRY) + elementType === CLASS_BODY -> + return getWrappingStrategyForItemList(commonSettings.ENUM_CONSTANTS_WRAP, ENUM_ENTRY) - elementType === KtNodeTypes.MODIFIER_LIST -> { + elementType === MODIFIER_LIST -> { val parent = node.treeParent.psi when (parent) { is KtParameter -> @@ -574,7 +572,7 @@ abstract class KotlinCommonBlock( } } - elementType === KtNodeTypes.VALUE_PARAMETER -> + elementType === VALUE_PARAMETER -> return wrapAfterAnnotation(commonSettings.PARAMETER_ANNOTATION_WRAP) nodePsi is KtClassOrObject || nodePsi is KtTypeAlias -> @@ -585,7 +583,7 @@ abstract class KotlinCommonBlock( getWrapAfterAnnotation(childElement, commonSettings.METHOD_ANNOTATION_WRAP)?.let { return@wrap it } - if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == KtTokens.EQ) { + if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == EQ) { return@wrap Wrap.createWrap(settings.kotlinCustomSettings.WRAP_EXPRESSION_BODY_FUNCTIONS, true) } null @@ -598,25 +596,25 @@ abstract class KotlinCommonBlock( getWrapAfterAnnotation(childElement, wrapSetting)?.let { return@wrap it } - if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == KtTokens.EQ) { + if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == EQ) { return@wrap Wrap.createWrap(settings.kotlinCommonSettings.ASSIGNMENT_WRAP, true) } null } nodePsi is KtBinaryExpression -> { - if (nodePsi.operationToken == KtTokens.EQ) { + if (nodePsi.operationToken == EQ) { return { childElement -> - if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == KtNodeTypes.OPERATION_REFERENCE) { + if (getPrevWithoutWhitespaceAndComments(childElement)?.elementType == OPERATION_REFERENCE) { Wrap.createWrap(settings.kotlinCommonSettings.ASSIGNMENT_WRAP, true) } else { null } } } - if (nodePsi.operationToken == KtTokens.ELVIS) { + if (nodePsi.operationToken == ELVIS) { return { childElement -> - if (childElement.elementType == KtNodeTypes.OPERATION_REFERENCE) { + if (childElement.elementType == OPERATION_REFERENCE) { Wrap.createWrap(settings.kotlinCustomSettings.WRAP_ELVIS_EXPRESSIONS, true) } else { null @@ -631,9 +629,9 @@ abstract class KotlinCommonBlock( } } -private fun ASTNode.startsWithAnnotation() = firstChildNode?.firstChildNode?.elementType == KtNodeTypes.ANNOTATION_ENTRY +private fun ASTNode.startsWithAnnotation() = firstChildNode?.firstChildNode?.elementType == ANNOTATION_ENTRY -private fun ASTNode.isFirstParameter(): Boolean = treePrev?.elementType == KtTokens.LPAR +private fun ASTNode.isFirstParameter(): Boolean = treePrev?.elementType == LPAR private fun wrapAfterAnnotation(wrapType: Int): WrappingStrategy { return { childElement -> getWrapAfterAnnotation(childElement, wrapType) } @@ -645,7 +643,7 @@ private fun getWrapAfterAnnotation(childElement: ASTNode, wrapType: Int): Wrap? while (prevLeaf?.elementType == TokenType.WHITE_SPACE) { prevLeaf = prevLeaf.treePrev } - if (prevLeaf?.elementType == KtNodeTypes.MODIFIER_LIST) { + if (prevLeaf?.elementType == MODIFIER_LIST) { if (prevLeaf?.lastChildNode?.elementType in ANNOTATIONS) { return Wrap.createWrap(wrapType, true) } @@ -682,34 +680,34 @@ fun NodeIndentStrategy.PositionStrategy.continuationIf( private val INDENT_RULES = arrayOf( strategy("No indent for braces in blocks") - .within(KtNodeTypes.BLOCK, KtNodeTypes.CLASS_BODY, KtNodeTypes.FUNCTION_LITERAL) + .within(BLOCK, CLASS_BODY, FUNCTION_LITERAL) .forType(RBRACE, LBRACE) .set(Indent.getNoneIndent()), strategy("Indent for block content") - .within(KtNodeTypes.BLOCK, KtNodeTypes.CLASS_BODY, KtNodeTypes.FUNCTION_LITERAL) - .notForType(RBRACE, LBRACE, KtNodeTypes.BLOCK) + .within(BLOCK, CLASS_BODY, FUNCTION_LITERAL) + .notForType(RBRACE, LBRACE, BLOCK) .set(Indent.getNormalIndent(false)), strategy("Indent for property accessors") - .within(KtNodeTypes.PROPERTY).forType(KtNodeTypes.PROPERTY_ACCESSOR) + .within(PROPERTY).forType(PROPERTY_ACCESSOR) .set(Indent.getNormalIndent()), strategy("For a single statement in 'for'") - .within(KtNodeTypes.BODY).notForType(KtNodeTypes.BLOCK) + .within(BODY).notForType(BLOCK) .set(Indent.getNormalIndent()), strategy("For WHEN content") - .within(KtNodeTypes.WHEN) + .within(WHEN) .notForType(RBRACE, LBRACE, WHEN_KEYWORD) .set(Indent.getNormalIndent()), strategy("For single statement in THEN and ELSE") - .within(KtNodeTypes.THEN, KtNodeTypes.ELSE).notForType(KtNodeTypes.BLOCK) + .within(THEN, ELSE).notForType(BLOCK) .set(Indent.getNormalIndent()), strategy("Expression body") - .within(KtNodeTypes.FUN) + .within(FUN) .forElement { (it.psi is KtExpression && it.psi !is KtBlockExpression) } @@ -728,7 +726,7 @@ private val INDENT_RULES = arrayOf( .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_EXPRESSION_BODIES, indentFirst = true), strategy("If condition") - .within(KtNodeTypes.CONDITION) + .within(CONDITION) .set { settings -> val indentType = if (settings.kotlinCustomSettings.CONTINUATION_INDENT_IN_IF_CONDITIONS) Indent.Type.CONTINUATION @@ -738,33 +736,33 @@ private val INDENT_RULES = arrayOf( }, strategy("Property accessor expression body") - .within(KtNodeTypes.PROPERTY_ACCESSOR) + .within(PROPERTY_ACCESSOR) .forElement { it.psi is KtExpression && it.psi !is KtBlockExpression } .set(Indent.getNormalIndent()), strategy("Property initializer") - .within(KtNodeTypes.PROPERTY) + .within(PROPERTY) .forElement { it.psi is KtExpression } .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_EXPRESSION_BODIES), strategy("Destructuring declaration") - .within(KtNodeTypes.DESTRUCTURING_DECLARATION) + .within(DESTRUCTURING_DECLARATION) .forElement { it.psi is KtExpression } .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_EXPRESSION_BODIES), strategy("Assignment expressions") - .within(KtNodeTypes.BINARY_EXPRESSION) + .within(BINARY_EXPRESSION) .within { val binaryExpression = it.psi as? KtBinaryExpression ?: return@within false - return@within KtTokens.ALL_ASSIGNMENTS.contains(binaryExpression.operationToken) + return@within ALL_ASSIGNMENTS.contains(binaryExpression.operationToken) } .forElement { val psi = it.psi @@ -774,31 +772,31 @@ private val INDENT_RULES = arrayOf( .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_EXPRESSION_BODIES), strategy("Indent for parts") - .within(KtNodeTypes.PROPERTY, KtNodeTypes.FUN, KtNodeTypes.DESTRUCTURING_DECLARATION, KtNodeTypes.SECONDARY_CONSTRUCTOR) + .within(PROPERTY, FUN, DESTRUCTURING_DECLARATION, SECONDARY_CONSTRUCTOR) .notForType( - KtNodeTypes.BLOCK, FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, CONSTRUCTOR_KEYWORD, KtTokens.RPAR, - KtTokens.EOL_COMMENT + BLOCK, FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, CONSTRUCTOR_KEYWORD, RPAR, + EOL_COMMENT ) .set(Indent.getContinuationWithoutFirstIndent()), strategy("Chained calls") .within(QUALIFIED_EXPRESSIONS) - .notForType(KtTokens.DOT, KtTokens.SAFE_ACCESS) + .notForType(DOT, SAFE_ACCESS) .forElement { it.treeParent.firstChildNode != it } .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_CHAINED_CALLS), strategy("Colon of delegation list") - .within(KtNodeTypes.CLASS, KtNodeTypes.OBJECT_DECLARATION) - .forType(KtTokens.COLON) + .within(CLASS, OBJECT_DECLARATION) + .forType(COLON) .set(Indent.getNormalIndent(false)), strategy("Delegation list") - .within(KtNodeTypes.SUPER_TYPE_LIST) + .within(SUPER_TYPE_LIST) .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_SUPERTYPE_LISTS, indentFirst = true), strategy("Indices") - .within(KtNodeTypes.INDICES) - .notForType(KtTokens.RBRACKET) + .within(INDICES) + .notForType(RBRACKET) .set(Indent.getContinuationIndent(false)), strategy("Binary expressions") @@ -814,19 +812,19 @@ private val INDENT_RULES = arrayOf( strategy("Opening parenthesis for conditions") .forType(LPAR) - .within(IF, KtNodeTypes.WHEN_ENTRY, WHILE, DO_WHILE) + .within(IF, WHEN_ENTRY, WHILE, DO_WHILE) .set(Indent.getContinuationWithoutFirstIndent(true)), strategy("Closing parenthesis for conditions") .forType(RPAR) .forElement { node -> !hasErrorElementBefore(node) } - .within(IF, KtNodeTypes.WHEN_ENTRY, WHILE, DO_WHILE) + .within(IF, WHEN_ENTRY, WHILE, DO_WHILE) .set(Indent.getNoneIndent()), strategy("Closing parenthesis for incomplete conditions") .forType(RPAR) .forElement { node -> hasErrorElementBefore(node) } - .within(IF, KtNodeTypes.WHEN_ENTRY, WHILE, DO_WHILE) + .within(IF, WHEN_ENTRY, WHILE, DO_WHILE) .set(Indent.getContinuationWithoutFirstIndent()), strategy("KDoc comment indent") @@ -835,12 +833,12 @@ private val INDENT_RULES = arrayOf( .set(Indent.getSpaceIndent(KDOC_COMMENT_INDENT)), strategy("Block in when entry") - .within(KtNodeTypes.WHEN_ENTRY) + .within(WHEN_ENTRY) .notForType( - KtNodeTypes.BLOCK, - KtNodeTypes.WHEN_CONDITION_EXPRESSION, - KtNodeTypes.WHEN_CONDITION_IN_RANGE, - KtNodeTypes.WHEN_CONDITION_IS_PATTERN, + BLOCK, + WHEN_CONDITION_EXPRESSION, + WHEN_CONDITION_IN_RANGE, + WHEN_CONDITION_IS_PATTERN, ELSE_KEYWORD, ARROW ) @@ -848,36 +846,36 @@ private val INDENT_RULES = arrayOf( strategy("Parameter list") .within(VALUE_PARAMETER_LIST) - .forElement { it.elementType == KtNodeTypes.VALUE_PARAMETER && it.psi.prevSibling != null } + .forElement { it.elementType == VALUE_PARAMETER && it.psi.prevSibling != null } .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_PARAMETER_LISTS, indentFirst = true), strategy("Where clause") - .within(KtNodeTypes.CLASS, KtNodeTypes.FUN, KtNodeTypes.PROPERTY) - .forType(KtTokens.WHERE_KEYWORD) + .within(CLASS, FUN, PROPERTY) + .forType(WHERE_KEYWORD) .set(Indent.getContinuationIndent()), strategy("Array literals") - .within(KtNodeTypes.COLLECTION_LITERAL_EXPRESSION) + .within(COLLECTION_LITERAL_EXPRESSION) .notForType(LBRACKET, RBRACKET) .set(Indent.getNormalIndent()), strategy("Type aliases") - .within(KtNodeTypes.TYPEALIAS) + .within(TYPEALIAS) .notForType( - KtTokens.TYPE_ALIAS_KEYWORD, KtTokens.EOL_COMMENT, KtNodeTypes.MODIFIER_LIST, KtTokens.BLOCK_COMMENT, - KtTokens.DOC_COMMENT + TYPE_ALIAS_KEYWORD, EOL_COMMENT, MODIFIER_LIST, BLOCK_COMMENT, + DOC_COMMENT ) .set(Indent.getContinuationIndent()), strategy("Default parameter values") - .within(KtNodeTypes.VALUE_PARAMETER) + .within(VALUE_PARAMETER) .forElement { node -> node.psi != null && node.psi == (node.psi.parent as? KtParameter)?.defaultValue } .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_FOR_EXPRESSION_BODIES, indentFirst = true) ) private fun getOperationType(node: ASTNode): IElementType? = - node.findChildByType(KtNodeTypes.OPERATION_REFERENCE)?.firstChildNode?.elementType + node.findChildByType(OPERATION_REFERENCE)?.firstChildNode?.elementType fun hasErrorElementBefore(node: ASTNode): Boolean { val prevSibling = getPrevWithoutWhitespace(node) ?: return false @@ -895,7 +893,7 @@ private fun ASTNode.suppressBinaryExpressionIndent(): Boolean { while (psi.parent is KtBinaryExpression) { psi = psi.parent as KtBinaryExpression } - return psi.parent?.node?.elementType == KtNodeTypes.CONDITION || psi.operationToken == KtTokens.ELVIS + return psi.parent?.node?.elementType == CONDITION || psi.operationToken == ELVIS } private fun getAlignmentForChildInParenthesis( @@ -949,7 +947,7 @@ private fun getWrappingStrategyForItemList(wrapType: Int, itemTypes: TokenSet, w val thisType = childElement.elementType val prevType = getPrevWithoutWhitespace(childElement)?.elementType if (thisType in itemTypes || prevType in itemTypes && - thisType != KtTokens.EOL_COMMENT && prevType != KtTokens.EOL_COMMENT) + thisType != EOL_COMMENT && prevType != EOL_COMMENT) itemWrap else null diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt index 0fc4b72bb19..a4c15a69538 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt @@ -13,11 +13,11 @@ object ProjectCodeStyleImporter { fun apply(project: Project, codeStyleStr: String?): Boolean { return when (codeStyleStr) { KotlinObsoleteCodeStyle.CODE_STYLE_SETTING -> { - ProjectCodeStyleImporter.apply(project, KotlinObsoleteCodeStyle.INSTANCE) + apply(project, KotlinObsoleteCodeStyle.INSTANCE) true } KotlinStyleGuideCodeStyle.CODE_STYLE_SETTING -> { - ProjectCodeStyleImporter.apply(project, KotlinStyleGuideCodeStyle.INSTANCE) + apply(project, KotlinStyleGuideCodeStyle.INSTANCE) true } else -> false diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt index 88efb16f497..c4fd5940b2e 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/kotlinSpacingRules.kt @@ -21,7 +21,6 @@ import com.intellij.util.text.TextRangeUtil import org.jetbrains.kotlin.KtNodeTypes.* import org.jetbrains.kotlin.idea.formatter.KotlinSpacingBuilder.CustomSpacingBuilder import org.jetbrains.kotlin.idea.util.requireNode -import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.lexer.KtTokens.* import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.isObjectLiteral @@ -41,7 +40,7 @@ fun SpacingBuilder.afterInside(element: IElementType, tokenSet: TokenSet, spacin tokenSet.types.forEach { inType -> afterInside(element, inType).spacingFun() } } -fun SpacingBuilder.RuleBuilder.spacesNoLineBreak(spaces: Int): SpacingBuilder? = +fun RuleBuilder.spacesNoLineBreak(spaces: Int): SpacingBuilder? = spacing(spaces, spaces, 0, false, 0) fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacingBuilderUtil): KotlinSpacingBuilder { @@ -143,7 +142,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing } val parameterWithDocCommentRule = { _: ASTBlock, _: ASTBlock, right: ASTBlock -> - if (right.requireNode().firstChildNode.elementType == KtTokens.DOC_COMMENT) { + if (right.requireNode().firstChildNode.elementType == DOC_COMMENT) { createSpacing(0, minLineFeeds = 1, keepLineBreaks = true, keepBlankLines = settings.KEEP_BLANK_LINES_IN_DECLARATIONS) } else { null @@ -184,7 +183,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing commonCodeStyleSettings.KEEP_LINE_BREAKS, commonCodeStyleSettings.KEEP_BLANK_LINES_IN_CODE ) - left.requireNode().elementType == KtTokens.COMMA -> // incomplete call being edited + left.requireNode().elementType == COMMA -> // incomplete call being edited createSpacing(1) else -> createSpacing(0) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformKindResolution.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformKindResolution.kt index 8afabf38535..5420ae1b2fd 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformKindResolution.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/caches/resolve/IdePlatformKindResolution.kt @@ -48,7 +48,7 @@ interface IdePlatformKindResolution { ) { private val CACHED_RESOLUTION_SUPPORT by lazy { val allPlatformKinds = IdePlatformKind.ALL_KINDS - val groupedResolution = IdePlatformKindResolution.getInstances().groupBy { it.kind }.mapValues { it.value.single() } + val groupedResolution = getInstances().groupBy { it.kind }.mapValues { it.value.single() } for (kind in allPlatformKinds) { if (kind !in groupedResolution) { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt index 4f6bbfb738e..da5391d9fbe 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/project/multiplatformUtil.kt @@ -34,7 +34,7 @@ val Module.externalProjectId: String get() = facetSettings?.externalProjectId ?: "" val Module.sourceType: SourceType? - get() = facetSettings?.isTestModule?.let { isTest -> if (isTest) SourceType.TEST else PRODUCTION } + get() = facetSettings?.isTestModule?.let { isTest -> if (isTest) TEST else PRODUCTION } val Module.isMPPModule: Boolean get() = facetSettings?.isMPPModule ?: false diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt index 9d20f69a943..ef56991f2d6 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinBuiltInDecompiler.kt @@ -69,7 +69,7 @@ class BuiltInDefinitionFile( val version = BuiltInsBinaryVersion.readFrom(stream) if (!version.isCompatible()) { - return FileWithMetadata.Incompatible(version) + return Incompatible(version) } val proto = ProtoBuf.PackageFragment.parseFrom(stream, BuiltInSerializerProtocol.extensionRegistry) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.kt index 9949ee713b5..58c1c0b4dbd 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/VariablesHighlightingVisitor.kt @@ -60,7 +60,7 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon } override fun visitParameter(parameter: KtParameter) { - val propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter) + val propertyDescriptor = bindingContext.get(PRIMARY_CONSTRUCTOR_PARAMETER, parameter) if (propertyDescriptor == null) { visitVariableDeclaration(parameter) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt index e26fbba5cc4..30374ab3d91 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt @@ -43,7 +43,7 @@ import kotlin.reflect.KClass // thus making the original purpose useless. // The class still can be used, if you want to create a pair for existing intention with additional checker abstract class IntentionBasedInspection private constructor( - private val intentionInfo: IntentionBasedInspection.IntentionData, + private val intentionInfo: IntentionData, protected open val problemText: String? ) : AbstractKotlinInspection() { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt index fa37f73e404..fe74c8545da 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/project/ResolveElementCache.kt @@ -22,7 +22,6 @@ import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker import com.intellij.util.containers.ContainerUtil -import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.cfg.ControlFlowInformationProvider import org.jetbrains.kotlin.container.get import org.jetbrains.kotlin.context.SimpleGlobalContext @@ -34,6 +33,7 @@ import org.jetbrains.kotlin.frontend.di.createContainerForBodyResolve import org.jetbrains.kotlin.idea.caches.resolve.CodeFragmentAnalyzer import org.jetbrains.kotlin.idea.caches.resolve.util.analyzeControlFlow import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext @@ -74,7 +74,7 @@ class ResolveElementCache( // drop whole cache after change "out of code block", each entry is checked with own modification stamp private val fullResolveCache: CachedValue> = CachedValuesManager.getManager(project).createCachedValue( - CachedValueProvider> { + CachedValueProvider> { CachedValueProvider.Result.create( ContainerUtil.createConcurrentWeakKeySoftValueMap(), PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, @@ -100,7 +100,7 @@ class ResolveElementCache( private val partialBodyResolveCache: CachedValue> = CachedValuesManager.getManager(project).createCachedValue( - CachedValueProvider> { + CachedValueProvider> { CachedValueProvider.Result.create( ContainerUtil.createConcurrentWeakKeySoftValueMap(), PsiModificationTracker.MODIFICATION_COUNT, diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReadWriteAccessDetector.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReadWriteAccessDetector.kt index d8d83adfe70..5c45e435d3e 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReadWriteAccessDetector.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/ideaExtensions/KotlinReadWriteAccessDetector.kt @@ -36,9 +36,9 @@ class KotlinReadWriteAccessDetector : ReadWriteAccessDetector() { override fun isDeclarationWriteAccess(element: PsiElement) = isReadWriteAccessible(element) - override fun getReferenceAccess(referencedElement: PsiElement, reference: PsiReference): ReadWriteAccessDetector.Access { + override fun getReferenceAccess(referencedElement: PsiElement, reference: PsiReference): Access { if (!isReadWriteAccessible(referencedElement)) { - return ReadWriteAccessDetector.Access.Read + return Access.Read } val refTarget = reference.resolve() @@ -48,27 +48,27 @@ class KotlinReadWriteAccessDetector : ReadWriteAccessDetector() { is KtPropertyAccessor -> origin.getNonStrictParentOfType() is KtProperty, is KtParameter -> origin as KtNamedDeclaration else -> null - } ?: return ReadWriteAccessDetector.Access.ReadWrite + } ?: return Access.ReadWrite return when (refTarget.name) { - JvmAbi.getterName(declaration.name!!) -> return ReadWriteAccessDetector.Access.Read - JvmAbi.setterName(declaration.name!!) -> return ReadWriteAccessDetector.Access.Write - else -> ReadWriteAccessDetector.Access.ReadWrite + JvmAbi.getterName(declaration.name!!) -> return Access.Read + JvmAbi.setterName(declaration.name!!) -> return Access.Write + else -> Access.ReadWrite } } return getExpressionAccess(reference.element) } - override fun getExpressionAccess(expression: PsiElement): ReadWriteAccessDetector.Access { + override fun getExpressionAccess(expression: PsiElement): Access { if (expression !is KtExpression) { //TODO: there should be a more correct scheme of access type detection for cross-language references return JavaReadWriteAccessDetector().getExpressionAccess(expression) } return when (expression.readWriteAccess(useResolveForReadWrite = true)) { - ReferenceAccess.READ -> ReadWriteAccessDetector.Access.Read - ReferenceAccess.WRITE -> ReadWriteAccessDetector.Access.Write - ReferenceAccess.READ_WRITE -> ReadWriteAccessDetector.Access.ReadWrite + ReferenceAccess.READ -> Access.Read + ReferenceAccess.WRITE -> Access.Write + ReferenceAccess.READ_WRITE -> Access.ReadWrite } } } \ No newline at end of file diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt index 5049f6e705b..4bc7974c732 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/ExpressionsOfTypeProcessor.kt @@ -124,10 +124,10 @@ class ExpressionsOfTypeProcessor( private val scopesToUsePlainSearch = LinkedHashMap>() fun run() { - val usePlainSearch = when (ExpressionsOfTypeProcessor.mode) { - ExpressionsOfTypeProcessor.Mode.ALWAYS_SMART -> false - ExpressionsOfTypeProcessor.Mode.ALWAYS_PLAIN -> true - ExpressionsOfTypeProcessor.Mode.PLAIN_WHEN_NEEDED -> searchScope is LocalSearchScope // for local scope it's faster to use plain search + val usePlainSearch = when (mode) { + Mode.ALWAYS_SMART -> false + Mode.ALWAYS_PLAIN -> true + Mode.PLAIN_WHEN_NEEDED -> searchScope is LocalSearchScope // for local scope it's faster to use plain search } if (usePlainSearch || classToSearch == null) { possibleMatchesInScopeHandler(searchScope) diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionCharFilter.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionCharFilter.kt index 4830e0a9e44..82347695a25 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionCharFilter.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinCompletionCharFilter.kt @@ -38,7 +38,7 @@ class KotlinCompletionCharFilter() : CharFilter() { val isAutopopup = CompletionService.getCompletionService().currentCompletion?.isAutopopupCompletion ?: return null if (Character.isJavaIdentifierPart(c) || c == '@') { - return CharFilter.Result.ADD_TO_PREFIX + return Result.ADD_TO_PREFIX } val currentItem = lookup.currentItem @@ -51,7 +51,7 @@ class KotlinCompletionCharFilter() : CharFilter() { if (c == ':') { return when { currentItem?.getUserData(HIDE_LOOKUP_ON_COLON) != null -> Result.HIDE_LOOKUP - else -> CharFilter.Result.ADD_TO_PREFIX /* used in '::xxx'*/ + else -> Result.ADD_TO_PREFIX /* used in '::xxx'*/ } } @@ -79,7 +79,7 @@ class KotlinCompletionCharFilter() : CharFilter() { ',', ' ', '(', '=', '!' -> Result.SELECT_ITEM_AND_FINISH_LOOKUP - else -> CharFilter.Result.HIDE_LOOKUP + else -> Result.HIDE_LOOKUP } } } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinExcludeFromCompletionLookupActionProvider.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinExcludeFromCompletionLookupActionProvider.kt index 0a7ac405ddd..094d8c6b3da 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinExcludeFromCompletionLookupActionProvider.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/KotlinExcludeFromCompletionLookupActionProvider.kt @@ -15,19 +15,14 @@ */ package org.jetbrains.kotlin.idea.completion -import com.intellij.codeInsight.completion.ExcludeFromCompletionLookupActionProvider import com.intellij.codeInsight.daemon.impl.actions.AddImportAction import com.intellij.codeInsight.lookup.Lookup import com.intellij.codeInsight.lookup.LookupActionProvider import com.intellij.codeInsight.lookup.LookupElement import com.intellij.codeInsight.lookup.LookupElementAction import com.intellij.openapi.project.Project -import com.intellij.psi.* -import com.intellij.psi.util.PsiUtil import com.intellij.util.Consumer import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject -import org.jetbrains.kotlin.idea.imports.importableFqName -import org.jetbrains.kotlin.name.FqName class KotlinExcludeFromCompletionLookupActionProvider : LookupActionProvider { override fun fillActions(element: LookupElement, lookup: Lookup, consumer: Consumer) { @@ -51,9 +46,9 @@ class KotlinExcludeFromCompletionLookupActionProvider : LookupActionProvider { private val project: Project, private val exclude: String ) : LookupElementAction(null, "Exclude '$exclude' from completion") { - override fun performLookupAction(): LookupElementAction.Result { + override fun performLookupAction(): Result { AddImportAction.excludeFromImport(project, exclude) - return LookupElementAction.Result.HIDE_LOOKUP + return Result.HIDE_LOOKUP } } } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ReferenceVariantsCollector.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ReferenceVariantsCollector.kt index 56c90f7a0d3..eb533925157 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ReferenceVariantsCollector.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/ReferenceVariantsCollector.kt @@ -33,7 +33,6 @@ import org.jetbrains.kotlin.resolve.DataClassDescriptorResolver import org.jetbrains.kotlin.resolve.scopes.DescriptorKindExclude import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver -import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeSmart import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeSmartForCompiler import java.util.* @@ -129,7 +128,7 @@ class ReferenceVariantsCollector( else ShadowedDeclarationsFilter.create(bindingContext, resolutionFacade, nameExpression, callTypeAndReceiver) - return ReferenceVariantsCollector.FilterConfiguration(descriptorKindFilter, additionalPropertyNameFilter, shadowedDeclarationsFilter, completeExtensionsFromIndices) + return FilterConfiguration(descriptorKindFilter, additionalPropertyNameFilter, shadowedDeclarationsFilter, completeExtensionsFromIndices) } private fun doCollectBasicVariants(filterConfiguration: FilterConfiguration): ReferenceVariants { diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.kt b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.kt index 9112c56614e..c45a1844437 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.kt +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/ExpectedCompletionUtils.kt @@ -19,10 +19,10 @@ import org.jetbrains.kotlin.idea.completion.LookupElementFactory import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject import org.jetbrains.kotlin.idea.test.AstAccessControl import org.jetbrains.kotlin.idea.util.module -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.platform.js.JsPlatforms import org.jetbrains.kotlin.platform.js.isJs +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.junit.Assert @@ -316,7 +316,7 @@ object ExpectedCompletionUtils { map.put(CompletionProposal.MODULE_NAME, it) } - result.add(ExpectedCompletionUtils.CompletionProposal(map)) + result.add(CompletionProposal(map)) } return result } diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt index 3cafd26abfb..fff0f17c795 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/ExpectedInfos.kt @@ -87,15 +87,15 @@ class ExpectedInfo( val expectedName: String?, val tail: Tail?, val itemOptions: ItemOptions = ItemOptions.DEFAULT, - val additionalData: ExpectedInfo.AdditionalData? = null + val additionalData: AdditionalData? = null ) { // just a marker interface interface AdditionalData {} - constructor(fuzzyType: FuzzyType, expectedName: String?, tail: Tail?, itemOptions: ItemOptions = ItemOptions.DEFAULT, additionalData: ExpectedInfo.AdditionalData? = null) + constructor(fuzzyType: FuzzyType, expectedName: String?, tail: Tail?, itemOptions: ItemOptions = ItemOptions.DEFAULT, additionalData: AdditionalData? = null) : this(ByExpectedTypeFilter(fuzzyType), expectedName, tail, itemOptions, additionalData) - constructor(type: KotlinType, expectedName: String?, tail: Tail?, itemOptions: ItemOptions = ItemOptions.DEFAULT, additionalData: ExpectedInfo.AdditionalData? = null) + constructor(type: KotlinType, expectedName: String?, tail: Tail?, itemOptions: ItemOptions = ItemOptions.DEFAULT, additionalData: AdditionalData? = null) : this(type.toFuzzyType(emptyList()), expectedName, tail, itemOptions, additionalData) fun matchingSubstitutor(descriptorType: FuzzyType): TypeSubstitutor? = filter.matchingSubstitutor(descriptorType) diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/NameValidators.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/NameValidators.kt index 39855a55826..ef65a482b46 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/NameValidators.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/NameValidators.kt @@ -63,12 +63,12 @@ class CollectingNameValidator @JvmOverloads constructor( class NewDeclarationNameValidator( private val visibleDeclarationsContext: KtElement?, private val checkDeclarationsIn: Sequence, - private val target: NewDeclarationNameValidator.Target, + private val target: Target, private val excludedDeclarations: List = emptyList() ) : (String) -> Boolean { constructor(container: PsiElement, anchor: PsiElement?, - target: NewDeclarationNameValidator.Target, + target: Target, excludedDeclarations: List = emptyList()) : this( (anchor ?: container).parentsWithSelf.firstIsInstanceOrNull(), diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptDefinitionsManager.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptDefinitionsManager.kt index 215b513ac98..eab3860b3ea 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptDefinitionsManager.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptDefinitionsManager.kt @@ -282,7 +282,7 @@ interface ScriptDefinitionContributor { ExtensionPointName.create("org.jetbrains.kotlin.scriptDefinitionContributor") inline fun find(project: Project) = - Extensions.getArea(project).getExtensionPoint(ScriptDefinitionContributor.EP_NAME).extensions.filterIsInstance().firstOrNull() + Extensions.getArea(project).getExtensionPoint(EP_NAME).extensions.filterIsInstance().firstOrNull() } } diff --git a/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt b/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt index 4f2e6617ea5..c9628aceb6e 100644 --- a/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt +++ b/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt @@ -34,14 +34,14 @@ class KotlinExplicitMovementProvider : GitCheckinExplicitMovementProvider() { project: Project, beforePaths: List, afterPaths: List - ): Collection { - val movedChanges = ArrayList() + ): Collection { + val movedChanges = ArrayList() for (after in afterPaths) { val pathBeforeJ2K = after.virtualFile?.pathBeforeJ2K if (pathBeforeJ2K != null) { val before = beforePaths.firstOrNull { it.path == pathBeforeJ2K } if (before != null) { - movedChanges.add(GitCheckinExplicitMovementProvider.Movement(before, after)) + movedChanges.add(Movement(before, after)) } } } diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinWithGradleConfigurator.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinWithGradleConfigurator.kt index 2ce12b7dd1f..40e8f7cf07e 100644 --- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinWithGradleConfigurator.kt +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/configuration/KotlinWithGradleConfigurator.kt @@ -288,7 +288,7 @@ abstract class KotlinWithGradleConfigurator : KotlinProjectConfigurator { libraryJarDescriptors: List ) { val scope = OrderEntryFix.suggestScopeByLocation(module, element) - KotlinWithGradleConfigurator.addKotlinLibraryToModule(module, scope, library) + addKotlinLibraryToModule(module, scope, library) } companion object { diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt index b09bc7411e5..d5bee48dccc 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt @@ -5,19 +5,18 @@ package org.jetbrains.kotlin.gradle -import com.intellij.openapi.roots.* -import com.intellij.openapi.vfs.VirtualFile -import junit.framework.TestCase +import com.intellij.openapi.roots.DependencyScope import org.jetbrains.jps.model.java.JavaResourceRootType import org.jetbrains.jps.model.java.JavaSourceRootType -import org.jetbrains.kotlin.config.* -import org.jetbrains.kotlin.idea.codeInsight.gradle.ExternalSystemImportingTestCase +import org.jetbrains.kotlin.config.ResourceKotlinRootType +import org.jetbrains.kotlin.config.SourceKotlinRootType +import org.jetbrains.kotlin.config.TestResourceKotlinRootType +import org.jetbrains.kotlin.config.TestSourceKotlinRootType import org.jetbrains.kotlin.idea.codeInsight.gradle.MultiplePluginVersionGradleImportingTestCase import org.jetbrains.kotlin.platform.CommonPlatforms import org.jetbrains.kotlin.platform.js.JsPlatforms import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.plugins.gradle.execution.test.runner.GradleTestRunConfigurationProducer import org.junit.After import org.junit.Before import org.junit.Test @@ -29,14 +28,14 @@ class NewMultiplatformProjectImportingTest : MultiplePluginVersionGradleImportin fun saveSdksBeforeTest() { val kotlinSdks = sdkCreationChecker?.getKotlinSdks() ?: emptyList() if (kotlinSdks.isNotEmpty()) { - ExternalSystemImportingTestCase.fail("Found Kotlin SDK before importing test. Sdk list: $kotlinSdks") + fail("Found Kotlin SDK before importing test. Sdk list: $kotlinSdks") } } @After fun checkSdkCreated() { if (sdkCreationChecker?.isKotlinSdkCreated() == false) { - ExternalSystemImportingTestCase.fail("Kotlin SDK was not created during import of MPP Project.") + fail("Kotlin SDK was not created during import of MPP Project.") } } diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt index 4e10f25b199..678b3eb075b 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinFacetSettings.kt @@ -23,8 +23,8 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.copyBean import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments import org.jetbrains.kotlin.platform.IdePlatformKind -import org.jetbrains.kotlin.platform.TargetPlatformVersion import org.jetbrains.kotlin.platform.TargetPlatform +import org.jetbrains.kotlin.platform.TargetPlatformVersion import org.jetbrains.kotlin.platform.compat.toIdePlatform import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.utils.DescriptionAware @@ -107,9 +107,9 @@ sealed class VersionView : DescriptionAware { } fun deserialize(value: String?, isAutoAdvance: Boolean): VersionView { - if (isAutoAdvance) return VersionView.LatestStable + if (isAutoAdvance) return LatestStable val languageVersion = LanguageVersion.fromVersionString(value) - return if (languageVersion != null) VersionView.Specific(languageVersion) else VersionView.LatestStable + return if (languageVersion != null) Specific(languageVersion) else LatestStable } } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinWithLibraryConfigurator.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinWithLibraryConfigurator.kt index 49de308ed48..f898dae827e 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinWithLibraryConfigurator.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinWithLibraryConfigurator.kt @@ -19,7 +19,10 @@ import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.psi.PsiElement import org.jetbrains.annotations.Contract import org.jetbrains.kotlin.cli.common.arguments.CliArgumentStringBuilder.replaceLanguageFeature -import org.jetbrains.kotlin.config.* +import org.jetbrains.kotlin.config.ApiVersion +import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion import org.jetbrains.kotlin.idea.facet.toApiVersion import org.jetbrains.kotlin.idea.framework.ui.CreateLibraryDialogWithModules @@ -31,7 +34,6 @@ import org.jetbrains.kotlin.idea.versions.LibraryJarDescriptor import org.jetbrains.kotlin.idea.versions.findAllUsedLibraries import org.jetbrains.kotlin.idea.versions.findKotlinRuntimeLibrary import java.io.File -import java.util.* abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinProjectConfigurator { protected abstract val libraryName: String @@ -176,12 +178,12 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro libraryJarDescriptor: LibraryJarDescriptor, collector: NotificationMessageCollector ) { - val jarFile = if (jarState == KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY) + val jarFile = if (jarState == FileState.DO_NOT_COPY) libraryJarDescriptor.getPathInPlugin() else File(dirToCopyJarTo, libraryJarDescriptor.jarName) - if (jarState == KotlinWithLibraryConfigurator.FileState.COPY) { + if (jarState == FileState.COPY) { copyFileToDir(libraryJarDescriptor.getPathInPlugin(), dirToCopyJarTo, collector) } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaFrameworkType.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaFrameworkType.kt index fa0b0ab5004..f504c03b4c0 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaFrameworkType.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/framework/JavaFrameworkType.kt @@ -31,7 +31,7 @@ class JavaFrameworkType : FrameworkTypeEx("kotlin-java-framework-id") { companion object { val instance: JavaFrameworkType - get() = FrameworkTypeEx.EP_NAME.findExtension(JavaFrameworkType::class.java) + get() = EP_NAME.findExtension(JavaFrameworkType::class.java) ?: error("can't find extension 'JavaFrameworkType'") } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/injection/KotlinLanguageInjector.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/injection/KotlinLanguageInjector.kt index e0069fa20ae..b22d69d9da4 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/injection/KotlinLanguageInjector.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/injection/KotlinLanguageInjector.kt @@ -410,7 +410,7 @@ class KotlinLanguageInjector( } } } - for (injection in configuration.getInjections(org.jetbrains.kotlin.idea.injection.KOTLIN_SUPPORT_ID)) { + for (injection in configuration.getInjections(KOTLIN_SUPPORT_ID)) { for (injectionPlace in injection.injectionPlaces) { for (targetClassFQN in retrieveKotlinPlaceTargetClassesFQNs(injectionPlace)) { add(StringUtilRt.getShortName(targetClassFQN)) diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/CommonIdePlatformKindTooling.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/CommonIdePlatformKindTooling.kt index abc446db8d8..6f6eaafb31f 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/CommonIdePlatformKindTooling.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/platform/CommonIdePlatformKindTooling.kt @@ -49,7 +49,7 @@ object CommonIdePlatformKindTooling : IdePlatformKindTooling() { } override fun getTestIcon(declaration: KtNamedDeclaration, descriptor: DeclarationDescriptor): Icon? { - val icons = IdePlatformKindTooling.getInstances() + val icons = getInstances() .filter { it != this } .mapNotNull { it.getTestIcon(declaration, descriptor) } .distinct() diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/quickfix/ChangeCoroutineSupportFix.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/quickfix/ChangeCoroutineSupportFix.kt index 47488230c2c..b5d60e3c55d 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/quickfix/ChangeCoroutineSupportFix.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/quickfix/ChangeCoroutineSupportFix.kt @@ -14,10 +14,7 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder -import org.jetbrains.kotlin.idea.configuration.BuildSystemType import org.jetbrains.kotlin.idea.configuration.findApplicableConfigurator -import org.jetbrains.kotlin.idea.configuration.getBuildSystemType -import org.jetbrains.kotlin.idea.facet.KotlinFacet import org.jetbrains.kotlin.idea.roots.invalidateProjectRoots import org.jetbrains.kotlin.psi.KtFile @@ -59,7 +56,7 @@ sealed class ChangeCoroutineSupportFix( companion object : FeatureSupportIntentionActionsFactory() { private const val shortFeatureName = "coroutine" - fun getFixText(state: LanguageFeature.State) = AbstractChangeFeatureSupportLevelFix.getFixText(state, shortFeatureName) + fun getFixText(state: LanguageFeature.State) = getFixText(state, shortFeatureName) override fun doCreateActions(diagnostic: Diagnostic): List { val module = ModuleUtilCore.findModuleForPsiElement(diagnostic.psiElement) ?: return emptyList() diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/KotlinJUnitRunConfigurationProducer.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/KotlinJUnitRunConfigurationProducer.kt index 78be2f16110..487918bfac8 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/KotlinJUnitRunConfigurationProducer.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/run/KotlinJUnitRunConfigurationProducer.kt @@ -38,7 +38,7 @@ class KotlinJUnitRunConfigurationProducer : RunConfigurationProducer("org.jetbrains.kotlin.scratchFileLanguageProvider") fun get(language: Language): ScratchFileLanguageProvider? { - return ScratchFileLanguageProvider.EXTENSION.forLanguage(language) + return EXTENSION.forLanguage(language) } fun get(fileType: FileType): ScratchFileLanguageProvider? { diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/vcs/BunchCheckinHandler.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/vcs/BunchCheckinHandler.kt index 710c5fc3247..deedf28d76e 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/vcs/BunchCheckinHandler.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/vcs/BunchCheckinHandler.kt @@ -62,10 +62,10 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() { override fun beforeCheckin( executor: CommitExecutor?, additionalDataConsumer: PairConsumer? - ): CheckinHandler.ReturnResult { - if (!project.bunchFileCheckEnabled) return CheckinHandler.ReturnResult.COMMIT + ): ReturnResult { + if (!project.bunchFileCheckEnabled) return ReturnResult.COMMIT - val extensions = BunchFileUtils.bunchExtension(project)?.toSet() ?: return CheckinHandler.ReturnResult.COMMIT + val extensions = BunchFileUtils.bunchExtension(project)?.toSet() ?: return ReturnResult.COMMIT val forgottenFiles = HashSet() val commitFiles = checkInProjectPanel.files.filter { it.isFile }.toSet() @@ -82,7 +82,7 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() { } } - if (forgottenFiles.isEmpty()) return CheckinHandler.ReturnResult.COMMIT + if (forgottenFiles.isEmpty()) return ReturnResult.COMMIT val projectBaseFile = File(project.basePath) var filePaths = forgottenFiles.map { it.relativeTo(projectBaseFile).path }.sorted() @@ -96,12 +96,12 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() { "Forgotten Bunch Files", "Review", "Commit", CommonBundle.getCancelButtonText(), Messages.getWarningIcon() )) { YES -> { - return CheckinHandler.ReturnResult.CLOSE_WINDOW + return ReturnResult.CLOSE_WINDOW } - NO -> return CheckinHandler.ReturnResult.COMMIT + NO -> return ReturnResult.COMMIT } - return CheckinHandler.ReturnResult.CANCEL + return ReturnResult.CANCEL } } } diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt index bed8a53e2c9..0e612462584 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt @@ -257,11 +257,11 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma } if (isPluginExecutionMissing(plugin, "default-compile", "compile")) { - addExecution(javacPlugin, "compile", PomFile.DefaultPhases.Compile, listOf("compile")) + addExecution(javacPlugin, "compile", DefaultPhases.Compile, listOf("compile")) } if (isPluginExecutionMissing(plugin, "default-testCompile", "testCompile")) { - addExecution(javacPlugin, "testCompile", PomFile.DefaultPhases.TestCompile, listOf("testCompile")) + addExecution(javacPlugin, "testCompile", DefaultPhases.TestCompile, listOf("testCompile")) } } diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt index 67f3b5d1683..c342c8c3908 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt @@ -30,10 +30,10 @@ import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.platform.jvm.JvmPlatforms class KotlinJavaMavenConfigurator : KotlinMavenConfigurator( - KotlinJavaMavenConfigurator.TEST_LIB_ID, + TEST_LIB_ID, false, - KotlinJavaMavenConfigurator.NAME, - KotlinJavaMavenConfigurator.PRESENTABLE_TEXT + NAME, + PRESENTABLE_TEXT ) { override fun isKotlinModule(module: Module) = diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt index 81e112865f3..aff931717aa 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt @@ -25,7 +25,7 @@ import org.jetbrains.kotlin.platform.TargetPlatform import org.jetbrains.kotlin.platform.js.JsPlatforms class KotlinJavascriptMavenConfigurator : - KotlinMavenConfigurator(null, false, KotlinJavascriptMavenConfigurator.NAME, KotlinJavascriptMavenConfigurator.PRESENTABLE_TEXT) { + KotlinMavenConfigurator(null, false, NAME, PRESENTABLE_TEXT) { override fun getStdlibArtifactId(module: Module, version: String) = MAVEN_JS_STDLIB_ID diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt index 79c029329f4..1cb029f002c 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt @@ -205,7 +205,7 @@ protected constructor( forTests: Boolean ) { fun doUpdateMavenLanguageVersion(): PsiElement? { - val psi = KotlinMavenConfigurator.findModulePomFile(module) as? XmlFile ?: return null + val psi = findModulePomFile(module) as? XmlFile ?: return null val pom = PomFile.forFileOrNull(psi) ?: return null return pom.changeLanguageVersion( languageVersion, @@ -307,7 +307,7 @@ protected constructor( messageTitle: String ): PsiElement? { fun doChangeMavenCoroutineConfiguration(): PsiElement? { - val psi = KotlinMavenConfigurator.findModulePomFile(module) as? XmlFile ?: return null + val psi = findModulePomFile(module) as? XmlFile ?: return null val pom = PomFile.forFileOrNull(psi) ?: return null return pom.changeCoroutineConfiguration(value) } @@ -329,7 +329,7 @@ protected constructor( state: LanguageFeature.State, messageTitle: String ): PsiElement? { - val psi = KotlinMavenConfigurator.findModulePomFile(module) as? XmlFile ?: return null + val psi = findModulePomFile(module) as? XmlFile ?: return null val pom = PomFile.forFileOrNull(psi) ?: return null val element = pom.changeFeatureConfiguration(feature, state) if (element == null) { diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/CommandHistory.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/CommandHistory.kt index a7f0f11001f..dda6674600a 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/CommandHistory.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/CommandHistory.kt @@ -37,7 +37,7 @@ class CommandHistory { listeners.forEach { it.onNewEntry(entry) } } - fun lastUnprocessedEntry(): CommandHistory.Entry? { + fun lastUnprocessedEntry(): Entry? { return if (processedEntriesCount < size) { get(processedEntriesCount) } diff --git a/idea/jvm-debugger/eval4j/test/org/jetbrains/eval4j/test/main.kt b/idea/jvm-debugger/eval4j/test/org/jetbrains/eval4j/test/main.kt index 581811cfe0e..ce395031bfc 100644 --- a/idea/jvm-debugger/eval4j/test/org/jetbrains/eval4j/test/main.kt +++ b/idea/jvm-debugger/eval4j/test/org/jetbrains/eval4j/test/main.kt @@ -309,8 +309,8 @@ class ReflectionLookup(val classLoader: ClassLoader) { Type.BOOLEAN -> java.lang.Boolean.TYPE Type.BYTE -> java.lang.Byte.TYPE Type.SHORT -> java.lang.Short.TYPE - Type.CHAR -> java.lang.Character.TYPE - Type.INT -> java.lang.Integer.TYPE + Type.CHAR -> Character.TYPE + Type.INT -> Integer.TYPE Type.LONG -> java.lang.Long.TYPE Type.FLOAT -> java.lang.Float.TYPE Type.DOUBLE -> java.lang.Double.TYPE diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt index 416989d8ec6..6732d8c8a15 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt @@ -31,7 +31,6 @@ import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project import com.intellij.openapi.util.Key import com.intellij.psi.PsiElement -import com.intellij.psi.PsiFile import com.intellij.psi.util.PsiTreeUtil import com.intellij.xdebugger.breakpoints.XBreakpoint import com.sun.jdi.AbsentInformationException @@ -72,7 +71,7 @@ class KotlinFieldBreakpoint( private var breakpointType: BreakpointType = BreakpointType.FIELD override fun isValid(): Boolean { - if (!BreakpointWithHighlighter.isPositionValid(xBreakpoint.sourcePosition)) return false + if (!isPositionValid(xBreakpoint.sourcePosition)) return false return runReadAction { val field = getField() diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt index 7e5462d05df..debd09bd7eb 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt @@ -12,7 +12,6 @@ import com.intellij.debugger.impl.DebuggerContextImpl import com.intellij.psi.PsiElement import com.sun.jdi.* import com.sun.tools.jdi.LocalVariableImpl -import org.jetbrains.kotlin.codegen.binding.CodegenBinding import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousClass import org.jetbrains.kotlin.codegen.coroutines.DO_RESUME_METHOD_NAME import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME @@ -20,16 +19,15 @@ import org.jetbrains.kotlin.codegen.coroutines.continuationAsmTypes import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME import org.jetbrains.kotlin.idea.core.KotlinFileTypeFactory import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils -import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches import org.jetbrains.kotlin.idea.core.util.getLineEndOffset import org.jetbrains.kotlin.idea.core.util.getLineStartOffset +import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.inline.InlineUtil -import org.jetbrains.org.objectweb.asm.Type as AsmType import java.util.* fun Location.isInKotlinSources(): Boolean { @@ -88,7 +86,7 @@ fun DebugProcessImpl.invokeInManagerThread(f: (DebuggerContextImpl) -> } private fun lambdaOrdinalByArgument(elementAt: KtFunction, context: BindingContext): Int { - val type = CodegenBinding.asmTypeForAnonymousClass(context, elementAt) + val type = asmTypeForAnonymousClass(context, elementAt) return type.className.substringAfterLast("$").toInt() } diff --git a/idea/jvm-debugger/jvm-debugger-sequence/src/org/jetbrains/kotlin/idea/debugger/sequence/trace/impl/handler/sequence/FilterIsInstanceHandler.kt b/idea/jvm-debugger/jvm-debugger-sequence/src/org/jetbrains/kotlin/idea/debugger/sequence/trace/impl/handler/sequence/FilterIsInstanceHandler.kt index 88a3315d94e..0596773b6cb 100644 --- a/idea/jvm-debugger/jvm-debugger-sequence/src/org/jetbrains/kotlin/idea/debugger/sequence/trace/impl/handler/sequence/FilterIsInstanceHandler.kt +++ b/idea/jvm-debugger/jvm-debugger-sequence/src/org/jetbrains/kotlin/idea/debugger/sequence/trace/impl/handler/sequence/FilterIsInstanceHandler.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.idea.debugger.sequence.trace.dsl.KotlinSequenceTypes class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) { private companion object { - fun createHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl): HandlerBase.Intermediate = + fun createHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl): Intermediate = if (call.arguments.isEmpty()) MyWithGenericsHandler(num, call, dsl) else PeekTraceHandler(num, call.name, call.typeBefore, call.typeAfter, dsl) } @@ -39,7 +39,7 @@ class FilterIsInstanceHandler(num: Int, call: IntermediateStreamCall, dsl: Dsl) /* * Transforms filterIsInstance -> filter { it is ClassName }.map { it as ClassName } */ - private class MyWithGenericsHandler(num: Int, private val call: IntermediateStreamCall, dsl: Dsl) : HandlerBase.Intermediate(dsl) { + private class MyWithGenericsHandler(num: Int, private val call: IntermediateStreamCall, dsl: Dsl) : Intermediate(dsl) { private val peekHandler = PeekTraceHandler(num, "filterIsInstance", call.typeBefore, call.typeAfter, dsl) override fun additionalCallsAfter(): List { val mapperType = functionalType(call.typeBefore.genericTypeName, call.typeAfter.genericTypeName) diff --git a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/FileRankingCalculator.kt b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/FileRankingCalculator.kt index b5846d9e269..15317bb675c 100644 --- a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/FileRankingCalculator.kt +++ b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/FileRankingCalculator.kt @@ -31,7 +31,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.varargParameterPosition import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.utils.keysToMap import kotlin.jvm.internal.FunctionBase -import org.jetbrains.org.objectweb.asm.Type as AsmType object FileRankingCalculatorForIde : FileRankingCalculator() { override fun analyze(element: KtElement) = element.analyze(BodyResolveMode.PARTIAL) @@ -106,7 +105,7 @@ abstract class FileRankingCalculator(private val checkClassFqName: Boolean = tru } private fun rankingForClassName(fqName: String, descriptor: ClassDescriptor, bindingContext: BindingContext): Ranking { - if (DescriptorUtils.isLocal(descriptor)) return Ranking.ZERO + if (DescriptorUtils.isLocal(descriptor)) return ZERO val expectedFqName = makeTypeMapper(bindingContext).mapType(descriptor).className return when { diff --git a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinDebuggerCaches.kt b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinDebuggerCaches.kt index 28a35819134..a08241da9c2 100644 --- a/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinDebuggerCaches.kt +++ b/idea/jvm-debugger/jvm-debugger-util/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinDebuggerCaches.kt @@ -28,8 +28,8 @@ import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker import com.intellij.psi.util.PsiTreeUtil import com.intellij.util.containers.MultiMap -import org.jetbrains.annotations.TestOnly import org.apache.log4j.Logger +import org.jetbrains.annotations.TestOnly import org.jetbrains.eval4j.Value import org.jetbrains.kotlin.analyzer.AnalysisResult import org.jetbrains.kotlin.codegen.ClassBuilderFactories @@ -221,7 +221,7 @@ class KotlinDebuggerCaches(project: Project) { class ComputedClassNames(val classNames: List, val shouldBeCached: Boolean) { @Suppress("FunctionName") companion object { - val EMPTY = ComputedClassNames.Cached(emptyList()) + val EMPTY = Cached(emptyList()) fun Cached(classNames: List) = ComputedClassNames(classNames, true) fun Cached(className: String) = ComputedClassNames(Collections.singletonList(className), true) diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectLightClassTest.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectLightClassTest.kt index 1ea9cbfc750..914b5601d93 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectLightClassTest.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectLightClassTest.kt @@ -25,7 +25,7 @@ class WholeProjectLightClassTest : WholeProjectPerformanceTest(), WholeProjectKo var totalNs = 0L val psiFile = file.toPsiFile(project) ?: run { - return WholeProjectPerformanceTest.PerFileTestResult(results, totalNs, listOf(AssertionError("PsiFile not found for $file"))) + return PerFileTestResult(results, totalNs, listOf(AssertionError("PsiFile not found for $file"))) } val errors = mutableListOf() diff --git a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectUltraLightClassTest.kt b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectUltraLightClassTest.kt index a031c398e36..26293775cbe 100644 --- a/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectUltraLightClassTest.kt +++ b/idea/performanceTests/org/jetbrains/kotlin/idea/perf/WholeProjectUltraLightClassTest.kt @@ -15,7 +15,7 @@ abstract class WholeProjectUltraLightClassTest : WholeProjectPerformanceTest(), override fun doTest(file: VirtualFile): PerFileTestResult { val psiFile = file.toPsiFile(project) as? KtFile ?: run { - return WholeProjectPerformanceTest.PerFileTestResult(mapOf(), 0, listOf(AssertionError("PsiFile not found for $file"))) + return PerFileTestResult(mapOf(), 0, listOf(AssertionError("PsiFile not found for $file"))) } val errors = mutableListOf() diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt index 8fd482bf3a7..e3e1390af4e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/replaceWith/DeprecatedSymbolUsageFixBase.kt @@ -90,7 +90,7 @@ abstract class DeprecatedSymbolUsageFixBase( ): ReplaceWith? { val annotation = descriptor.annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: return null val replaceWithValue = - annotation.argumentValue(kotlin.Deprecated::replaceWith.name)?.safeAs()?.value ?: return null + annotation.argumentValue(Deprecated::replaceWith.name)?.safeAs()?.value ?: return null val pattern = replaceWithValue.argumentValue(kotlin.ReplaceWith::expression.name)?.safeAs()?.value ?: return null if (pattern.isEmpty()) return null val importValues = replaceWithValue.argumentValue(kotlin.ReplaceWith::imports.name)?.safeAs()?.value ?: return null diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassifierProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassifierProcessor.kt index 8aa1552499d..056ee8ca675 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassifierProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassifierProcessor.kt @@ -21,7 +21,6 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiReference import com.intellij.refactoring.JavaRefactoringSettings import com.intellij.refactoring.listeners.RefactoringElementListener -import com.intellij.refactoring.rename.RenamePsiElementProcessor import com.intellij.usageView.UsageInfo import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade @@ -68,7 +67,7 @@ class RenameKotlinClassifierProcessor : RenameKotlinPsiProcessor() { if (nameWithoutExtensions == it.name) { val newFileName = newName + "." + virtualFile.extension allRenames.put(file, newFileName) - RenamePsiElementProcessor.forElement(file).prepareRenaming(file, newFileName, allRenames) + forElement(file).prepareRenaming(file, newFileName, allRenames) } } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt index 6e318b094b8..5015107dd48 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractLineMarkersTestInLibrarySources.kt @@ -49,7 +49,7 @@ abstract class AbstractLineMarkersTestInLibrarySources : AbstractLineMarkersTest override fun configureModule(module: Module, model: ModifiableRootModel) { super.configureModule(module, model) - val library = model.moduleLibraryTable.getLibraryByName(SdkAndMockLibraryProjectDescriptor.LIBRARY_NAME)!! + val library = model.moduleLibraryTable.getLibraryByName(LIBRARY_NAME)!! val modifiableModel = library.modifiableModel modifiableModel.addRoot(LocalFileSystem.getInstance().findFileByIoFile(libraryClean!!)!!, OrderRootType.SOURCES) diff --git a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt index 362bf5f84e6..7c0106e7fd5 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/configuration/AbstractConfigureKotlinTest.kt @@ -165,9 +165,9 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() { } private fun getPathToJar(runtimeState: FileState, jarFromDist: String, jarFromTemp: String) = when (runtimeState) { - KotlinWithLibraryConfigurator.FileState.EXISTS -> jarFromDist - KotlinWithLibraryConfigurator.FileState.COPY -> jarFromTemp - KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY -> jarFromDist + FileState.EXISTS -> jarFromDist + FileState.COPY -> jarFromTemp + FileState.DO_NOT_COPY -> jarFromDist } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/LowLevelDebuggerTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/LowLevelDebuggerTestBase.kt index 974bcda07ad..05f37164ba8 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/LowLevelDebuggerTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/LowLevelDebuggerTestBase.kt @@ -182,7 +182,7 @@ private object DebuggerMain { synchronized(lock) { // Wait until debugger is attached @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") - (lock as java.lang.Object).wait() + (lock as Object).wait() } } } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/CodeFragmentCompletionInLibraryTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/CodeFragmentCompletionInLibraryTest.kt index 1f27eda07dc..259fd137314 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/CodeFragmentCompletionInLibraryTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/evaluate/CodeFragmentCompletionInLibraryTest.kt @@ -16,10 +16,10 @@ import org.jetbrains.kotlin.idea.completion.test.AbstractJvmBasicCompletionTest import org.jetbrains.kotlin.idea.completion.test.testCompletion import org.jetbrains.kotlin.idea.debugger.getContextElement import org.jetbrains.kotlin.idea.test.SdkAndMockLibraryProjectDescriptor +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFunction import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner import org.jetbrains.kotlin.test.KotlinTestUtils import org.junit.runner.RunWith @@ -34,7 +34,7 @@ class CodeFragmentCompletionInLibraryTest : AbstractJvmBasicCompletionTest() { override fun configureModule(module: Module, model: ModifiableRootModel) { super.configureModule(module, model) - val library = model.moduleLibraryTable.getLibraryByName(SdkAndMockLibraryProjectDescriptor.LIBRARY_NAME)!! + val library = model.moduleLibraryTable.getLibraryByName(LIBRARY_NAME)!! val modifiableModel = library.modifiableModel modifiableModel.addRoot(findLibrarySourceDir(), OrderRootType.SOURCES) diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt index 5fc76d3544b..1960bfc8709 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/AbstractNavigateToLibraryTest.kt @@ -61,7 +61,7 @@ abstract class AbstractNavigateToLibrarySourceTest : AbstractNavigateToLibraryTe abstract class AbstractNavigateToLibrarySourceTestWithJS : AbstractNavigateToLibrarySourceTest() { override fun getProjectDescriptor(): KotlinLightProjectDescriptor = KotlinMultiModuleProjectDescriptor( "AbstractNavigateToLibrarySourceTestWithJS", - AbstractNavigateToLibrarySourceTest.PROJECT_DESCRIPTOR, + PROJECT_DESCRIPTOR, KotlinStdJSProjectDescriptor ) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt b/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt index aa9777c909e..30d45a8f46d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/jvm/KotlinJvmDeclarationSearcherTest.kt @@ -84,7 +84,7 @@ class KotlinJvmDeclarationSearcherTest : KotlinLightCodeInsightFixtureTestCase() fun testClassDeclaration() = assertElementsByIdentifier(""" class SomeClass(val field: String) - """, { it is JvmClass }, { it is com.intellij.lang.jvm.JvmMethod && it.isConstructor }) + """, { it is JvmClass }, { it is JvmMethod && it.isConstructor }) fun testLocalObjectDeclaration() = assertElementsByIdentifier(""" diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt index b435b0cd796..beda0e405d4 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt @@ -231,14 +231,14 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() { private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) { configureByFile(getTestName(false) + ".kt") val element = TargetElementUtil.findTargetElement( - LightPlatformCodeInsightTestCase.myEditor, + myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED ) assertNotNull(element) val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!, - LightPlatformCodeInsightTestCase.getCurrentEditorDataContext()) + getCurrentEditorDataContext()) if (newName == null) { assertFalse(handler.isRenaming(dataContext), "In-place rename is allowed for " + element) @@ -246,7 +246,7 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() { else { try { assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) - CodeInsightTestUtil.doInlineRename(handler, newName, LightPlatformCodeInsightTestCase.getEditor(), element) + CodeInsightTestUtil.doInlineRename(handler, newName, getEditor(), element) checkResultByFile(getTestName(false) + ".kt.after") } catch (e: BaseRefactoringProcessor.ConflictsInTestsException) { val expectedMessage = InTextDirectivesUtils.findStringWithPrefixes(myFile.text, "// SHOULD_FAIL_WITH: ") diff --git a/idea/tests/org/jetbrains/kotlin/idea/run/runConfigurationTestUtil.kt b/idea/tests/org/jetbrains/kotlin/idea/run/runConfigurationTestUtil.kt index 442c6ffb864..41a01d14f2f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/run/runConfigurationTestUtil.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/run/runConfigurationTestUtil.kt @@ -77,7 +77,7 @@ fun createLibraryWithLongPaths(project: Project): Library { private object MockExecutor : DefaultRunExecutor() { - override fun getId() = DefaultRunExecutor.EXECUTOR_ID + override fun getId() = EXECUTOR_ID } private object MockProfile : RunProfile { diff --git a/idea/tests/org/jetbrains/kotlin/psi/AbstractInjectionTest.kt b/idea/tests/org/jetbrains/kotlin/psi/AbstractInjectionTest.kt index 25ac1182b68..b657311e361 100644 --- a/idea/tests/org/jetbrains/kotlin/psi/AbstractInjectionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/psi/AbstractInjectionTest.kt @@ -17,7 +17,6 @@ import org.intellij.plugins.intelliLang.inject.InjectLanguageAction import org.intellij.plugins.intelliLang.inject.UnInjectLanguageAction import org.intellij.plugins.intelliLang.references.FileReferenceInjector import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCaseBase import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.utils.SmartList @@ -28,7 +27,7 @@ abstract class AbstractInjectionTest : KotlinLightCodeInsightFixtureTestCase() { return when { testName.endsWith("WithAnnotation") -> KotlinLightProjectDescriptor.INSTANCE testName.endsWith("WithRuntime") -> KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - else -> KotlinLightCodeInsightFixtureTestCaseBase.JAVA_LATEST + else -> JAVA_LATEST } } diff --git a/idea/tests/org/jetbrains/kotlin/psi/KotlinStdlibInjectionTest.kt b/idea/tests/org/jetbrains/kotlin/psi/KotlinStdlibInjectionTest.kt index 3e14feb67f4..9f32188bca2 100644 --- a/idea/tests/org/jetbrains/kotlin/psi/KotlinStdlibInjectionTest.kt +++ b/idea/tests/org/jetbrains/kotlin/psi/KotlinStdlibInjectionTest.kt @@ -14,45 +14,45 @@ import org.junit.runner.RunWith @RunWith(JUnit3WithIdeaConfigurationRunner::class) class KotlinStdlibInjectionTest : AbstractInjectionTest() { fun testOnRegex0() = assertInjectionPresent( - """ - val test1 = kotlin.text.Regex("some") + """ + val test1 = Regex("some") """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) fun testOnRegex1() = assertInjectionPresent( - """ - val test1 = kotlin.text.Regex("some", RegexOption.COMMENTS) + """ + val test1 = Regex("some", RegexOption.COMMENTS) """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) fun testOnRegex2() = assertInjectionPresent( - """ - val test1 = kotlin.text.Regex("some", setOf(RegexOption.COMMENTS)) + """ + val test1 = Regex("some", setOf(RegexOption.COMMENTS)) """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) fun testToRegex0() = assertInjectionPresent( - """ + """ val test = "hi".toRegex() """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) fun testToRegex1() = assertInjectionPresent( - """ + """ val test = "hi".toRegex(RegexOption.CANON_EQ) """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) fun testToRegex2() = assertInjectionPresent( - """ + """ val test = "hi".toRegex(setOf(RegexOption.LITERAL)) """, - RegExpLanguage.INSTANCE.id + RegExpLanguage.INSTANCE.id ) private fun assertInjectionPresent(@Language("kotlin") text: String, languageId: String) { diff --git a/idea/tests/org/jetbrains/kotlin/search/AnnotatedMembersSearchTest.kt b/idea/tests/org/jetbrains/kotlin/search/AnnotatedMembersSearchTest.kt index ebebecf99c0..02ad0ef4992 100644 --- a/idea/tests/org/jetbrains/kotlin/search/AnnotatedMembersSearchTest.kt +++ b/idea/tests/org/jetbrains/kotlin/search/AnnotatedMembersSearchTest.kt @@ -41,7 +41,7 @@ abstract class AbstractAnnotatedMembersSearchTest : AbstractSearcherTest() { PsiBasedClassResolver.trueHits.set(0) PsiBasedClassResolver.falseHits.set(0) - AbstractSearcherTest.checkResult( + checkResult( path, AnnotatedElementsSearch.searchElements( psiClass,