From d0cc1635dbb04dd2c9e92fe3279c9e864355aee5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 17 Feb 2017 15:39:05 +0300 Subject: [PATCH] Cleanup: apply "Use synthetic property access syntax" --- .../common/DataClassMethodGenerator.kt | 2 +- .../DefaultParameterValueSubstitutor.kt | 6 +-- .../codegen/DelegatingClassBuilderFactory.kt | 4 +- .../jetbrains/kotlin/codegen/SourceInfo.kt | 2 +- .../codegen/intrinsics/JavaClassProperty.kt | 2 +- .../kotlin/codegen/intrinsics/NewArray.kt | 2 +- .../codegen/optimization/common/Util.kt | 4 +- .../codegen/serialization/JvmStringTable.kt | 6 +-- .../kotlin/cli/common/moduleVisibilityImpl.kt | 2 +- .../kotlin/fileClasses/JvmFileClassUtil.kt | 4 +- .../jvm/checkers/declarationCheckers.kt | 2 +- .../PartialAnalysisHandlerExtension.kt | 2 +- .../kotlin/cfg/ControlFlowProcessor.kt | 6 +-- .../kotlin/cfg/pseudocode/pseudocodeUtils.kt | 46 ++++++++--------- .../diagnostics/PositioningStrategies.kt | 50 +++++++++---------- .../kotlin/diagnostics/rendering/Renderers.kt | 2 +- .../incremental/KotlinLookupLocation.kt | 2 +- .../kotlin/kdoc/psi/impl/KDocImpl.kt | 4 +- .../kotlin/kdoc/psi/impl/KDocSection.kt | 2 +- .../org/jetbrains/kotlin/psi/DebugTextUtil.kt | 2 +- .../jetbrains/kotlin/psi/KtClassOrObject.kt | 2 +- .../jetbrains/kotlin/psi/KtCodeFragment.kt | 4 +- .../jetbrains/kotlin/psi/createByPattern.kt | 2 +- .../jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt | 6 +-- .../kotlin/resolve/DeclarationsChecker.kt | 12 ++--- .../kotlin/resolve/DelegationResolver.kt | 2 +- .../resolve/ExposedVisibilityChecker.kt | 4 +- .../resolve/FunctionDescriptorResolver.kt | 20 ++++---- .../kotlin/resolve/LazyTopDownAnalyzer.kt | 6 +-- .../resolve/QualifiedExpressionResolver.kt | 4 +- .../jetbrains/kotlin/resolve/TypeResolver.kt | 12 ++--- .../kotlin/resolve/VarianceChecker.kt | 4 +- .../kotlin/resolve/calls/util/callUtil.kt | 2 +- .../checkers/DataClassDeclarationChecker.kt | 2 +- .../ReifiedTypeParameterAnnotationChecker.kt | 2 +- .../kotlin/resolve/lazy/LazyImportScope.kt | 12 ++--- .../kotlin/resolve/lazy/data/KtScriptInfo.kt | 2 +- .../lazy/descriptors/LazyClassMemberScope.kt | 4 +- .../lazy/descriptors/LazyScriptDescriptor.kt | 2 +- .../expressions/FunctionsTypingVisitor.kt | 14 +++--- .../expressions/LocalClassifierAnalyzer.kt | 2 +- .../expressions/ValueParameterResolver.kt | 2 +- .../backend/jvm/codegen/ExpressionCodegen.kt | 2 +- .../backend/jvm/codegen/FunctionCodegen.kt | 2 +- .../psi2ir/generators/ClassGenerator.kt | 4 +- .../jetbrains/kotlin/asJava/LightClassUtil.kt | 2 +- .../asJava/builder/LightClassDataProvider.kt | 8 +-- .../asJava/classes/KtLightClassForFacade.kt | 8 +-- .../KtLightClassForSourceDeclaration.kt | 6 +-- .../asJava/duplicateJvmSignatureUtil.kt | 4 +- .../kotlin/asJava/lightClassUtils.kt | 6 +-- .../LazyJavaAnnotationDescriptor.kt | 4 +- .../descriptors/LazyJavaClassDescriptor.kt | 2 +- .../java/lazy/descriptors/LazyJavaScope.kt | 4 +- .../deserialization/AnnotationDeserializer.kt | 20 ++++---- .../infrastructure/build-protobuf-lite.kts | 2 +- .../check-library-abi-version.kts | 2 +- .../strip-kotlin-annotations.kts | 6 +-- .../org/jetbrains/kotlin/idea/util/Utils.kt | 2 +- .../psi/patternMatching/KotlinPsiUnifier.kt | 2 +- .../resolve/lazy/PartialBodyResolveFilter.kt | 4 +- .../resolve/IDELightClassGenerationSupport.kt | 6 +-- .../caches/resolve/KotlinCacheServiceImpl.kt | 4 +- .../idea/caches/resolve/KotlinResolveCache.kt | 8 +-- .../caches/resolve/ProjectResolutionFacade.kt | 2 +- .../navigation/findDecompiledDeclaration.kt | 2 +- .../idea/highlighter/KotlinPsiChecker.kt | 2 +- .../idea/project/ResolveElementCache.kt | 12 ++--- .../kotlin/idea/references/referenceUtil.kt | 2 +- .../ExpressionsOfTypeProcessor.kt | 2 +- .../kotlin/idea/search/usagesSearch/utils.kt | 4 +- .../KotlinInheritedMembersNodeProvider.kt | 4 +- .../KotlinStructureViewElement.kt | 2 +- .../kotlin/idea/completion/CompletionUtils.kt | 2 +- .../WithExpressionPrefixInsertHandler.kt | 2 +- .../idea/completion/smart/SmartCompletion.kt | 2 +- .../kotlin/idea/core/KotlinIndicesHelper.kt | 2 +- .../org/jetbrains/kotlin/idea/core/Utils.kt | 2 +- .../kotlin/idea/core/psiModificationUtils.kt | 2 +- .../KotlinMavenPluginPhaseInspection.kt | 2 +- ...avenUnresolvedReferenceQuickFixProvider.kt | 2 +- .../idea/actions/KotlinAddImportAction.kt | 6 +-- .../KotlinGenerateTestSupportActionBase.kt | 2 +- .../kotlin/idea/actions/generate/utils.kt | 2 +- .../CheckComponentsUsageSearchAction.kt | 2 +- .../internal/CheckPartialBodyResolveAction.kt | 2 +- .../kotlin/idea/codeInliner/CodeInliner.kt | 2 +- .../KotlinBreadcrumbsInfoProvider.kt | 2 +- .../kotlin/idea/debugger/DebuggerUtils.kt | 2 +- .../idea/debugger/KotlinPositionManager.kt | 4 +- .../breakpoints/KotlinFieldBreakpointType.kt | 2 +- .../evaluate/KotlinEvaluationBuilder.kt | 2 +- .../extractFunctionForDebuggerUtil.kt | 2 +- .../KotlinRecursiveCallLineMarkerProvider.kt | 2 +- .../inspections/ArrayInDataClassInspection.kt | 2 +- .../inspections/EqualsOrHashCodeInspection.kt | 2 +- .../intentions/AddJvmOverloadsIntention.kt | 2 +- ...tPrimaryConstructorToSecondaryIntention.kt | 2 +- .../ConvertSealedClassToEnumIntention.kt | 6 +-- ...tSecondaryConstructorToPrimaryIntention.kt | 4 +- .../CreateKotlinSubClassIntention.kt | 4 +- ...precatedCallableAddReplaceWithIntention.kt | 2 +- .../MoveMemberToCompanionObjectIntention.kt | 4 +- .../ObjectLiteralToLambdaIntention.kt | 4 +- .../RemoveEmptyPrimaryConstructorIntention.kt | 2 +- ...rrayEqualityOpWithArraysEqualsIntention.kt | 2 +- .../ReplaceWithOperatorAssignmentIntention.kt | 2 +- .../SimplifyAssertNotNullIntention.kt | 2 +- .../SpecifyTypeExplicitlyIntention.kt | 2 +- .../ConvertMemberToExtensionIntention.kt | 4 +- .../JoinDeclarationAndAssignmentHandler.kt | 2 +- .../kotlin/idea/patterns/KotlinPatterns.kt | 2 +- .../projectView/KtClassOrObjectTreeNode.kt | 2 +- .../ChangeFunctionLiteralReturnTypeFix.kt | 2 +- .../kotlin/idea/quickfix/ImportFix.kt | 4 +- .../InitializePropertyQuickFixFactory.kt | 8 +-- .../MakeConstructorParameterPropertyFix.kt | 2 +- .../idea/quickfix/MakeVisibleFactory.kt | 2 +- .../idea/quickfix/SuperClassNotInitialized.kt | 2 +- .../callableBuilder/CallableBuilder.kt | 12 ++--- .../callableBuilder/CallableInfo.kt | 2 +- ...assFromReferenceExpressionActionFactory.kt | 4 +- .../migration/MigrateExternalExtensionFix.kt | 2 +- .../KotlinChangeSignatureData.kt | 2 +- .../KotlinChangeSignatureUsageProcessor.kt | 2 +- .../changeSignature/changeSignatureUtils.kt | 2 +- .../ui/KotlinChangeSignatureDialog.kt | 10 ++-- .../usages/KotlinCallableDefinitionUsage.kt | 4 +- .../inline/KotlinInlineTypeAliasHandler.kt | 2 +- .../inline/KotlinInlineValHandler.kt | 4 +- .../idea/refactoring/inline/inlineUtils.kt | 6 +-- .../extractClass/ExtractSuperRefactoring.kt | 6 +-- .../extractionEngine/extractorUtil.kt | 2 +- .../KotlinInplaceParameterIntroducer.kt | 2 +- .../KotlinIntroduceParameterHandler.kt | 2 +- .../KotlinIntroduceVariableHandler.kt | 2 +- .../KotlinVariableInplaceIntroducer.kt | 4 +- .../KotlinClassMembersRefactoringSupport.kt | 2 +- .../memberInfo/KotlinMemberInfoStorage.kt | 6 +-- .../memberInfo/KotlinMemberSelectionTable.kt | 4 +- .../changePackage/ChangePackageIntention.kt | 2 +- .../ChangePackageToMatchDirectoryIntention.kt | 4 +- ...FileToPackageMatchingDirectoryIntention.kt | 4 +- .../move/moveDeclarations/KotlinMoveTarget.kt | 10 ++-- .../MoveDeclarationToSeparateFileIntention.kt | 4 +- .../MoveDeclarationsDelegate.kt | 2 +- .../MoveKotlinDeclarationsHandler.kt | 2 +- .../MoveKotlinDeclarationsProcessor.kt | 4 +- .../refactoring/pullUp/KotlinPullUpHelper.kt | 8 +-- .../pullUp/KotlinPullUpHelperFactory.kt | 2 +- .../pullUp/pullUpConflictsUtils.kt | 2 +- .../idea/refactoring/pullUp/pullUpUtils.kt | 2 +- .../rename/RenameKotlinClassProcessor.kt | 2 +- .../refactoring/rename/renameConflictUtils.kt | 2 +- .../refactoring/ui/KotlinFileChooserDialog.kt | 2 +- .../run/KotlinRunConfigurationProducer.kt | 2 +- ...tandaloneScriptRunConfigurationProducer.kt | 2 +- .../KotlinCreateTestIntention.kt | 4 +- .../idea/testIntegration/KotlinTestFinder.kt | 2 +- .../jetbrains/kotlin/js/parser/parserUtils.kt | 2 +- .../uast/kotlin/declarations/KotlinUClass.kt | 2 +- .../KotlinUFunctionCallExpression.kt | 4 +- .../KotlinUObjectLiteralExpression.kt | 2 +- 163 files changed, 344 insertions(+), 344 deletions(-) diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/DataClassMethodGenerator.kt b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/DataClassMethodGenerator.kt index 94e0ab24497..d5a5b2bb5ea 100644 --- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/DataClassMethodGenerator.kt +++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/DataClassMethodGenerator.kt @@ -103,5 +103,5 @@ abstract class DataClassMethodGenerator(private val declaration: KtClassOrObject .map { bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, it)!! } private val primaryConstructorParameters: List - get() = (declaration as? KtClass)?.getPrimaryConstructorParameters().orEmpty() + get() = (declaration as? KtClass)?.primaryConstructorParameters.orEmpty() } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt index bb3ad980850..33dc672e6a6 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DefaultParameterValueSubstitutor.kt @@ -54,7 +54,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) { contextKind: OwnerKind, classOrObject: KtPureClassOrObject ) { - val methodElement = classOrObject.getPrimaryConstructor() ?: classOrObject + val methodElement = classOrObject.primaryConstructor ?: classOrObject if (generateOverloadsIfNeeded(methodElement, constructorDescriptor, constructorDescriptor, contextKind, classBuilder, memberCodegen)) { return @@ -251,7 +251,7 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) { val classDescriptor = constructorDescriptor.constructedClass if (classDescriptor.kind != ClassKind.CLASS) return false - if (classOrObject.isLocal()) return false + if (classOrObject.isLocal) return false if (CodegenBinding.canHaveOuter(state.bindingContext, classDescriptor)) return false @@ -265,6 +265,6 @@ class DefaultParameterValueSubstitutor(val state: GenerationState) { } private fun hasSecondaryConstructorsWithNoParameters(klass: KtClass) = - klass.getSecondaryConstructors().any { it.valueParameters.isEmpty() } + klass.secondaryConstructors.any { it.valueParameters.isEmpty() } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilderFactory.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilderFactory.kt index 5efd5d2daa6..650f1a1dc1b 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilderFactory.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/DelegatingClassBuilderFactory.kt @@ -33,10 +33,10 @@ abstract class DelegatingClassBuilderFactory( abstract override fun newClassBuilder(origin: JvmDeclarationOrigin): DelegatingClassBuilder override fun asBytes(builder: ClassBuilder?): ByteArray? { - return delegate.asBytes((builder as DelegatingClassBuilder).getDelegate()) + return delegate.asBytes((builder as DelegatingClassBuilder).delegate) } override fun asText(builder: ClassBuilder?): String? { - return delegate.asText((builder as DelegatingClassBuilder).getDelegate()) + return delegate.asText((builder as DelegatingClassBuilder).delegate) } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/SourceInfo.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/SourceInfo.kt index 0f28b8d51c2..421faccdb68 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/SourceInfo.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/SourceInfo.kt @@ -34,7 +34,7 @@ data class SourceInfo(val source: String, val pathOrCleanFQN: String, val linesI val isTopLevel = element is KtFile || (element is KtNamedFunction && element.getParent() is KtFile) val cleanedClassFqName = if (!isTopLevel) internalClassName else internalClassName.substringBefore('$') - return SourceInfo(element.getContainingKtFile().name, cleanedClassFqName, lineNumbers!!) + return SourceInfo(element.containingKtFile.name, cleanedClassFqName, lineNumbers!!) } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/JavaClassProperty.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/JavaClassProperty.kt index cf30a271553..5c58f307690 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/JavaClassProperty.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/JavaClassProperty.kt @@ -58,7 +58,7 @@ object JavaClassProperty : IntrinsicPropertyGetter() { } override fun toCallable(fd: FunctionDescriptor, isSuper: Boolean, resolvedCall: ResolvedCall<*>, codegen: ExpressionCodegen): Callable { - val classType = codegen.getState().typeMapper.mapType(resolvedCall.call.dispatchReceiver!!.type) + val classType = codegen.state.typeMapper.mapType(resolvedCall.call.dispatchReceiver!!.type) return object : IntrinsicCallable(getType(Class::class.java), listOf(), classType, null) { override fun invokeIntrinsic(v: InstructionAdapter) { if (isPrimitive(classType)) { diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/NewArray.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/NewArray.kt index 8002ac6b1df..ddcb52fdc2f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/NewArray.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/intrinsics/NewArray.kt @@ -26,7 +26,7 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter class NewArray : IntrinsicMethod() { override fun toCallable(fd: FunctionDescriptor, isSuper: Boolean, resolvedCall: ResolvedCall<*>, codegen: ExpressionCodegen): Callable { val jetType = resolvedCall.resultingDescriptor.returnType!! - val type = codegen.getState().typeMapper.mapType(jetType) + val type = codegen.state.typeMapper.mapType(jetType) return object : IntrinsicCallable(type, listOf(Type.INT_TYPE), null, null) { override fun invokeIntrinsic(v: InstructionAdapter) { codegen.newArrayInstruction(jetType) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/Util.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/Util.kt index 4832c387d39..22b683c03cb 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/Util.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/optimization/common/Util.kt @@ -177,8 +177,8 @@ val AbstractInsnNode.intConstant: Int? get() = fun insnListOf(vararg insns: AbstractInsnNode) = InsnList().apply { insns.forEach { add(it) } } -fun AbstractInsnNode.isStoreOperation(): Boolean = getOpcode() in Opcodes.ISTORE..Opcodes.ASTORE -fun AbstractInsnNode.isLoadOperation(): Boolean = getOpcode() in Opcodes.ILOAD..Opcodes.ALOAD +fun AbstractInsnNode.isStoreOperation(): Boolean = opcode in Opcodes.ISTORE..Opcodes.ASTORE +fun AbstractInsnNode.isLoadOperation(): Boolean = opcode in Opcodes.ILOAD..Opcodes.ALOAD val AbstractInsnNode?.insnText get() = InlineCodegenUtil.getInsnText(this) val AbstractInsnNode?.debugText get() = diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/serialization/JvmStringTable.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/serialization/JvmStringTable.kt index 411f1a00ed1..acf7cf3f09d 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/serialization/JvmStringTable.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/serialization/JvmStringTable.kt @@ -44,7 +44,7 @@ class JvmStringTable(private val typeMapper: KotlinTypeMapper) : StringTable { val lastRecord = records.lastOrNull() if (lastRecord != null && lastRecord.isTrivial()) { - lastRecord.setRange(lastRecord.range + 1) + lastRecord.range = lastRecord.range + 1 } else records.add(Record.newBuilder()) } @@ -93,12 +93,12 @@ class JvmStringTable(private val typeMapper: KotlinTypeMapper) : StringTable { else { val predefinedIndex = JvmNameResolver.getPredefinedStringIndex(string) if (predefinedIndex != null) { - record.setPredefinedIndex(predefinedIndex) + record.predefinedIndex = predefinedIndex // TODO: move all records with predefined names to the end and do not write associated strings for them (since they are ignored) strings.add("") } else { - record.setOperation(Record.Operation.DESC_TO_CLASS_ID) + record.operation = Record.Operation.DESC_TO_CLASS_ID strings.add("L${string.replace('.', '$')};") } } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt index 39daaa32a5b..d911f66ec32 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/moduleVisibilityImpl.kt @@ -67,7 +67,7 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper { private fun findModule(descriptor: DeclarationDescriptor, modules: Collection): Module? { val sourceElement = getSourceElement(descriptor) if (sourceElement is KotlinSourceElement) { - return modules.singleOrNull() ?: modules.firstOrNull { sourceElement.psi.getContainingKtFile().virtualFile.path in it.getSourceFiles() } + return modules.singleOrNull() ?: modules.firstOrNull { sourceElement.psi.containingKtFile.virtualFile.path in it.getSourceFiles() } } else { return modules.firstOrNull { module -> diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt index f89b9f9368c..f293fecaf4e 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt @@ -98,7 +98,7 @@ object JvmFileClassUtil { @JvmStatic fun isFromMultifileClass(declarationElement: KtElement, descriptor: DeclarationDescriptor): Boolean { if (DescriptorUtils.isTopLevelDeclaration(descriptor)) { - val fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(declarationElement.getContainingKtFile()) + val fileClassInfo = JvmFileClassUtil.getFileClassInfoNoResolve(declarationElement.containingKtFile) return fileClassInfo.withJvmMultifileClass } return false @@ -118,6 +118,6 @@ val KtFile.javaFileFacadeFqName: FqName } fun KtDeclaration.isInsideJvmMultifileClassFile() = JvmFileClassUtil.findAnnotationEntryOnFileNoResolve( - getContainingKtFile(), + containingKtFile, JvmFileClassUtil.JVM_MULTIFILE_CLASS_SHORT ) != null diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt index dff8b7dfc79..d9744c56b74 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/declarationCheckers.kt @@ -88,7 +88,7 @@ class PlatformStaticAnnotationChecker : SimpleDeclarationChecker { else -> declaration } - if (insideObject && checkDeclaration.getModifierList()?.hasModifier(KtTokens.OVERRIDE_KEYWORD) == true) { + if (insideObject && checkDeclaration.modifierList?.hasModifier(KtTokens.OVERRIDE_KEYWORD) == true) { diagnosticHolder.report(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC.on(declaration)) } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/extensions/PartialAnalysisHandlerExtension.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/extensions/PartialAnalysisHandlerExtension.kt index 15b52399246..69de5009ef5 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/extensions/PartialAnalysisHandlerExtension.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/extensions/PartialAnalysisHandlerExtension.kt @@ -124,7 +124,7 @@ open class PartialAnalysisHandlerExtension : AnalysisHandlerExtension { } if (declaration is KtClass && declaration.isAnnotation()) { - declaration.getPrimaryConstructorParameters().forEach { doForEachDeclaration(it, f) } + declaration.primaryConstructorParameters.forEach { doForEachDeclaration(it, f) } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt index 05f21b038e1..663caeec4c5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/ControlFlowProcessor.kt @@ -1326,7 +1326,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) { } private fun generateHeaderDelegationSpecifiers(classOrObject: KtClassOrObject) { - for (specifier in classOrObject.getSuperTypeListEntries()) { + for (specifier in classOrObject.superTypeListEntries) { generateInstructions(specifier) } } @@ -1351,7 +1351,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) { override fun visitClass(klass: KtClass) { if (klass.hasPrimaryConstructor()) { - processParameters(klass.getPrimaryConstructorParameters()) + processParameters(klass.primaryConstructorParameters) // delegation specifiers of primary constructor, anonymous class and property initializers generateHeaderDelegationSpecifiers(klass) @@ -1379,7 +1379,7 @@ class ControlFlowProcessor(private val trace: BindingTrace) { } private fun generateDeclarationForLocalClassOrObjectIfNeeded(classOrObject: KtClassOrObject) { - if (classOrObject.isLocal()) { + if (classOrObject.isLocal) { for (declaration in classOrObject.declarations) { if (declaration is KtSecondaryConstructor || declaration is KtProperty || diff --git a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt index db890805a9b..c32ab547fb3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/cfg/pseudocode/pseudocodeUtils.kt @@ -54,17 +54,17 @@ import org.jetbrains.kotlin.types.TypeUtils import java.util.* fun getReceiverTypePredicate(resolvedCall: ResolvedCall<*>, receiverValue: ReceiverValue): TypePredicate? { - val callableDescriptor = resolvedCall.getResultingDescriptor() ?: return null + val callableDescriptor = resolvedCall.resultingDescriptor ?: return null when (receiverValue) { - resolvedCall.getExtensionReceiver() -> { - val receiverParameter = callableDescriptor.getExtensionReceiverParameter() - if (receiverParameter != null) return receiverParameter.getType().getSubtypesPredicate() + resolvedCall.extensionReceiver -> { + val receiverParameter = callableDescriptor.extensionReceiverParameter + if (receiverParameter != null) return receiverParameter.type.getSubtypesPredicate() } - resolvedCall.getDispatchReceiver() -> { + resolvedCall.dispatchReceiver -> { val rootCallableDescriptors = callableDescriptor.findTopMostOverriddenDescriptors() return or(rootCallableDescriptors.mapNotNull { - it.getDispatchReceiverParameter()?.getType()?.let { TypeUtils.makeNullableIfNeeded(it, resolvedCall.call.isSafeCall()) }?.getSubtypesPredicate() + it.dispatchReceiverParameter?.type?.let { TypeUtils.makeNullableIfNeeded(it, resolvedCall.call.isSafeCall()) }?.getSubtypesPredicate() }) } } @@ -90,14 +90,14 @@ fun getExpectedTypePredicate( fun getTypePredicateForUnresolvedCallArgument(to: KtElement, inputValueIndex: Int): TypePredicate? { if (inputValueIndex < 0) return null val call = to.getCall(bindingContext) ?: return null - val callee = call.getCalleeExpression() ?: return null + val callee = call.calleeExpression ?: return null val candidates = callee.getReferenceTargets(bindingContext) .filterIsInstance() .sortedBy { DescriptorRenderer.FQ_NAMES_IN_TYPES.render(it) } if (candidates.isEmpty()) return null - val explicitReceiver = call.getExplicitReceiver() + val explicitReceiver = call.explicitReceiver val argValueOffset = if (explicitReceiver != null) 1 else 0 val predicates = ArrayList() @@ -120,10 +120,10 @@ fun getExpectedTypePredicate( TracingStrategy.EMPTY, candidateCall, LinkedHashSet()) - if (!status.isSuccess()) continue + if (!status.isSuccess) continue - val candidateArgumentMap = candidateCall.getValueArguments() - val callArguments = call.getValueArguments() + val candidateArgumentMap = candidateCall.valueArguments + val callArguments = call.valueArguments val i = inputValueIndex - argValueOffset if (i < 0 || i >= callArguments.size) continue @@ -135,7 +135,7 @@ fun getExpectedTypePredicate( val expectedType = if (resolvedArgument is VarargValueArgument) candidateParameter.varargElementType else - candidateParameter.getType() + candidateParameter.type predicates.add(if (expectedType != null) AllSubtypes(expectedType) else AllTypes) } @@ -152,14 +152,14 @@ fun getExpectedTypePredicate( is KtReturnExpression -> returnElement.getTargetFunctionDescriptor(bindingContext) else -> bindingContext[DECLARATION_TO_DESCRIPTOR, pseudocode.correspondingElement] } - addSubtypesOf((functionDescriptor as? CallableDescriptor)?.getReturnType()) + addSubtypesOf((functionDescriptor as? CallableDescriptor)?.returnType) } is ConditionalJumpInstruction -> - addSubtypesOf(builtIns.getBooleanType()) + addSubtypesOf(builtIns.booleanType) is ThrowExceptionInstruction -> - addSubtypesOf(builtIns.getThrowable().getDefaultType()) + addSubtypesOf(builtIns.throwable.defaultType) is MergeInstruction -> addTypePredicates(it.outputValue) @@ -190,11 +190,11 @@ fun getExpectedTypePredicate( } else { it.arguments[value]?.let { parameter -> - val expectedType = when (it.resolvedCall.getValueArguments()[parameter]) { + val expectedType = when (it.resolvedCall.valueArguments[parameter]) { is VarargValueArgument -> parameter.varargElementType else -> - parameter.getType() + parameter.type } addSubtypesOf(expectedType) } @@ -203,7 +203,7 @@ fun getExpectedTypePredicate( is MagicInstruction -> @Suppress("NON_EXHAUSTIVE_WHEN") when (it.kind) { AND, OR -> - addSubtypesOf(builtIns.getBooleanType()) + addSubtypesOf(builtIns.booleanType) LOOP_RANGE_ITERATION -> addByExplicitReceiver(bindingContext[LOOP_RANGE_ITERATOR_RESOLVED_CALL, value.element as? KtExpression]) @@ -211,18 +211,18 @@ fun getExpectedTypePredicate( VALUE_CONSUMER -> { val element = it.element when { - element.getStrictParentOfType()?.getCondition() == element -> - addSubtypesOf(builtIns.getBooleanType()) + element.getStrictParentOfType()?.condition == element -> + addSubtypesOf(builtIns.booleanType) element is KtProperty -> { val propertyDescriptor = bindingContext[DECLARATION_TO_DESCRIPTOR, element] as? PropertyDescriptor - propertyDescriptor?.getAccessors()?.map { + propertyDescriptor?.accessors?.map { addByExplicitReceiver(bindingContext[DELEGATED_PROPERTY_RESOLVED_CALL, it]) } } element is KtDelegatedSuperTypeEntry -> - addSubtypesOf(bindingContext[TYPE, element.getTypeReference()]) + addSubtypesOf(bindingContext[TYPE, element.typeReference]) } } @@ -256,7 +256,7 @@ fun Instruction.calcSideEffectFree(): Boolean { return when (this) { is ReadValueInstruction -> target.let { when (it) { - is AccessTarget.Call -> when (it.resolvedCall.getResultingDescriptor()) { + is AccessTarget.Call -> when (it.resolvedCall.resultingDescriptor) { is LocalVariableDescriptor, is ValueParameterDescriptor, is ReceiverParameterDescriptor -> true else -> false } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 6da707ad8b0..47948b588fb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -61,7 +61,7 @@ object PositioningStrategies { is KtObjectDeclaration -> { return markRange( element.getObjectKeyword()!!, - element.getNameIdentifier() ?: element.getObjectKeyword()!! + element.nameIdentifier ?: element.getObjectKeyword()!! ) } is KtConstructorDelegationCall -> { @@ -86,7 +86,7 @@ object PositioningStrategies { private fun getElementToMark(declaration: KtDeclaration): PsiElement { val (returnTypeRef, nameIdentifierOrPlaceholder) = when (declaration) { is KtCallableDeclaration -> Pair(declaration.typeReference, declaration.nameIdentifier) - is KtPropertyAccessor -> Pair(declaration.getReturnTypeReference(), declaration.getNamePlaceholder()) + is KtPropertyAccessor -> Pair(declaration.returnTypeReference, declaration.namePlaceholder) else -> Pair(null, null) } @@ -127,9 +127,9 @@ object PositioningStrategies { } is KtFunction -> { val endOfSignatureElement = - element.getTypeReference() - ?: element.getValueParameterList() - ?: element.getNameIdentifier() + element.typeReference + ?: element.valueParameterList + ?: element.nameIdentifier ?: element val startElement = if (element is KtFunctionLiteral) { @@ -141,19 +141,19 @@ object PositioningStrategies { return markRange(startElement, endOfSignatureElement) } is KtProperty -> { - val endOfSignatureElement = element.getTypeReference() ?: element.getNameIdentifier() ?: element + val endOfSignatureElement = element.typeReference ?: element.nameIdentifier ?: element return markRange(element, endOfSignatureElement) } is KtPropertyAccessor -> { val endOfSignatureElement = - element.getReturnTypeReference() - ?: element.getRightParenthesis()?.getPsi() - ?: element.getNamePlaceholder() + element.returnTypeReference + ?: element.rightParenthesis?.psi + ?: element.namePlaceholder return markRange(element, endOfSignatureElement) } is KtClass -> { - val nameAsDeclaration = element.getNameIdentifier() ?: return markElement(element) + val nameAsDeclaration = element.nameIdentifier ?: return markElement(element) val primaryConstructorParameterList = element.getPrimaryConstructorParameterList() ?: return markElement(nameAsDeclaration) return markRange(nameAsDeclaration, primaryConstructorParameterList) } @@ -212,7 +212,7 @@ object PositioningStrategies { override fun mark(element: PsiElement): List { val nameIdentifier = when (element) { is KtNamedDeclaration -> element.nameIdentifier - is KtFile -> element.packageDirective!!.getNameIdentifier() + is KtFile -> element.packageDirective!!.nameIdentifier else -> null } @@ -260,7 +260,7 @@ object PositioningStrategies { val visibilityTokens = listOf(KtTokens.PRIVATE_KEYWORD, KtTokens.PROTECTED_KEYWORD, KtTokens.PUBLIC_KEYWORD, KtTokens.INTERNAL_KEYWORD) val modifierList = element.modifierList - val result = visibilityTokens.mapNotNull { modifierList?.getModifier(it)?.getTextRange() } + val result = visibilityTokens.mapNotNull { modifierList?.getModifier(it)?.textRange } if (!result.isEmpty()) return result // Try to resolve situation when there's no visibility modifiers written before element @@ -273,10 +273,10 @@ object PositioningStrategies { val elementToMark = when (element) { is KtObjectDeclaration -> element.getObjectKeyword()!! - is KtPropertyAccessor -> element.getNamePlaceholder() + is KtPropertyAccessor -> element.namePlaceholder is KtAnonymousInitializer -> element else -> throw IllegalArgumentException( - "Can't find text range for element '${element.javaClass.getCanonicalName()}' with the text '${element.getText()}'") + "Can't find text range for element '${element.javaClass.canonicalName}' with the text '${element.text}'") } return markElement(elementToMark) } @@ -284,13 +284,13 @@ object PositioningStrategies { @JvmField val VARIANCE_IN_PROJECTION: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtTypeProjection): List { - return markElement(element.getProjectionToken()!!) + return markElement(element.projectionToken!!) } } @JvmField val PARAMETER_DEFAULT_VALUE: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtParameter): List { - return markNode(element.getDefaultValue()!!.node) + return markNode(element.defaultValue!!.node) } } @@ -309,7 +309,7 @@ object PositioningStrategies { @JvmField val DECLARATION_WITH_BODY: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtDeclarationWithBody): List { - val lastBracketRange = (element.bodyExpression as? KtBlockExpression)?.getLastBracketRange() + val lastBracketRange = (element.bodyExpression as? KtBlockExpression)?.lastBracketRange return if (lastBracketRange != null) markRange(lastBracketRange) else @@ -317,7 +317,7 @@ object PositioningStrategies { } override fun isValid(element: KtDeclarationWithBody): Boolean { - return super.isValid(element) && (element.bodyExpression as? KtBlockExpression)?.getLastBracketRange() != null + return super.isValid(element) && (element.bodyExpression as? KtBlockExpression)?.lastBracketRange != null } } @@ -361,14 +361,14 @@ object PositioningStrategies { @JvmField val NULLABLE_TYPE: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: KtNullableType): List { - return markNode(element.getQuestionMarkNode()) + return markNode(element.questionMarkNode) } } @JvmField val CALL_EXPRESSION: PositioningStrategy = object : PositioningStrategy() { override fun mark(element: PsiElement): List { if (element is KtCallExpression) { - return markRange(element, element.getTypeArgumentList() ?: element.getCalleeExpression() ?: element) + return markRange(element, element.typeArgumentList ?: element.calleeExpression ?: element) } return markElement(element) } @@ -387,7 +387,7 @@ object PositioningStrategies { return markElement(valueParameterList) } if (element is KtFunctionLiteral) { - return markNode(element.getLBrace().node) + return markNode(element.lBrace.node) } return DECLARATION_SIGNATURE_OR_DEFAULT.mark(element) } @@ -419,7 +419,7 @@ object PositioningStrategies { @JvmField val UNREACHABLE_CODE: PositioningStrategy = object : PositioningStrategy() { override fun markDiagnostic(diagnostic: ParametrizedDiagnostic): List { - return Errors.UNREACHABLE_CODE.cast(diagnostic).getA() + return Errors.UNREACHABLE_CODE.cast(diagnostic).a } } @@ -443,8 +443,8 @@ object PositioningStrategies { override fun mark(element: KtConstructorDelegationCall): List { if (element.isImplicit) { val constructor = element.getStrictParentOfType()!! - val valueParameterList = constructor.getValueParameterList() ?: return markElement(constructor) - return markRange(constructor.getConstructorKeyword(), valueParameterList.getLastChild()) + val valueParameterList = constructor.valueParameterList ?: return markElement(constructor) + return markRange(constructor.getConstructorKeyword(), valueParameterList.lastChild) } return markElement(element.calleeExpression ?: element) } @@ -452,7 +452,7 @@ object PositioningStrategies { @JvmField val DELEGATOR_SUPER_CALL: PositioningStrategy = object: PositioningStrategy() { override fun mark(element: KtEnumEntry): List { - val specifiers = element.getSuperTypeListEntries() + val specifiers = element.superTypeListEntries return markElement(if (specifiers.isEmpty()) element else specifiers[0]) } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt index 3f93e236a0d..997e39d636e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/Renderers.kt @@ -120,7 +120,7 @@ object Renderers { @JvmField val RENDER_CLASS_OR_OBJECT = Renderer { classOrObject: KtClassOrObject -> - val name = if (classOrObject.getName() != null) " '" + classOrObject.getName() + "'" else "" + val name = if (classOrObject.name != null) " '" + classOrObject.name + "'" else "" if (classOrObject is KtClass) "Class" + name else "Object" + name } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/incremental/KotlinLookupLocation.kt b/compiler/frontend/src/org/jetbrains/kotlin/incremental/KotlinLookupLocation.kt index cf029a1fdbe..1729e06e712 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/incremental/KotlinLookupLocation.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/incremental/KotlinLookupLocation.kt @@ -27,7 +27,7 @@ class KotlinLookupLocation(val element: KtElement) : LookupLocation { override val location: LocationInfo? get() { - val containingJetFile = element.getContainingKtFile() + val containingJetFile = element.containingKtFile if (containingJetFile.doNotAnalyze != null) return null diff --git a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocImpl.kt index ac9cb2ba359..dec8cf0d53a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocImpl.kt @@ -42,13 +42,13 @@ class KDocImpl(buffer: CharSequence?) : LazyParseablePsiElement(KDocTokens.KDOC, override fun getDefaultSection(): KDocSection = getChildOfType()!! override fun findSectionByName(name: String): KDocSection? = - getChildrenOfType().firstOrNull { it.getName() == name } + getChildrenOfType().firstOrNull { it.name == name } override fun findSectionByTag(tag: KDocKnownTag): KDocSection? = findSectionByName(tag.name.toLowerCase()) override fun findSectionByTag(tag: KDocKnownTag, subjectName: String): KDocSection? = getChildrenOfType().firstOrNull { - it.getName() == tag.name.toLowerCase() && it.getSubjectName() == subjectName + it.name == tag.name.toLowerCase() && it.getSubjectName() == subjectName } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocSection.kt b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocSection.kt index a433c5f1a53..e4cb67e159e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocSection.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/kdoc/psi/impl/KDocSection.kt @@ -41,7 +41,7 @@ class KDocSection(node: ASTNode) : KDocTag(node) { (firstChild as? KDocTag)?.getContent() ?: super.getContent() fun findTagsByName(name: String): List { - return getChildrenOfType().filter { it.getName() == name } + return getChildrenOfType().filter { it.name == name } } fun findTagByName(name: String): KDocTag? diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/DebugTextUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/DebugTextUtil.kt index 760d9a1af4e..aec3519bb5c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/DebugTextUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/DebugTextUtil.kt @@ -203,7 +203,7 @@ private object DebugTextBuildingVisitor : KtVisitor() { append("class ") appendInn(klass.nameAsName) appendInn(klass.typeParameterList) - appendInn(klass.getPrimaryConstructorModifierList(), prefix = " ", suffix = " ") + appendInn(klass.primaryConstructorModifierList, prefix = " ", suffix = " ") appendInn(klass.getPrimaryConstructorParameterList()) appendInn(klass.getSuperTypeList(), prefix = " : ") } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt index aa5103d7c45..210183409f7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtClassOrObject.kt @@ -104,7 +104,7 @@ abstract class KtClassOrObject : override fun hasPrimaryConstructor(): Boolean = hasExplicitPrimaryConstructor() || !hasSecondaryConstructors() - private fun hasSecondaryConstructors(): Boolean = !getSecondaryConstructors().isEmpty() + private fun hasSecondaryConstructors(): Boolean = !secondaryConstructors.isEmpty() override fun getSecondaryConstructors(): List = getBody()?.secondaryConstructors.orEmpty() diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt index 01fb2814aaa..bd5fba41b4a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/KtCodeFragment.kt @@ -160,12 +160,12 @@ abstract class KtCodeFragment( } fun getContextContainingFile(): KtFile? { - return (getOriginalContext() as? KtElement)?.getContainingKtFile() + return (getOriginalContext() as? KtElement)?.containingKtFile } fun getOriginalContext(): KtElement? { val contextElement = getContext() as? KtElement - val contextFile = contextElement?.getContainingKtFile() + val contextFile = contextElement?.containingKtFile if (contextFile is KtCodeFragment) { return contextFile.getOriginalContext() } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/createByPattern.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/createByPattern.kt index aa947b35a2e..34debb8093c 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/createByPattern.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/createByPattern.kt @@ -173,7 +173,7 @@ fun createByPattern(pattern: String, vararg args: Any, fa for ((pointer, n) in pointers) { var element = pointer.element!! if (element is KtFunctionLiteral) { - element = element.getParent() as KtLambdaExpression + element = element.parent as KtLambdaExpression } @Suppress("UNCHECKED_CAST") val argumentType = argumentTypes[n] as PsiElementPlaceholderArgumentType diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt index 49d7838e05d..5ab29357877 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/ktPsiUtil.kt @@ -102,7 +102,7 @@ fun KtSimpleNameExpression.getReceiverExpression(): KtExpression? { parent is KtCallExpression -> { //This is in case `a().b()` val callExpression = parent - val grandParent = callExpression.getParent() + val grandParent = callExpression.parent if (grandParent is KtQualifiedExpression) { val parentsReceiver = grandParent.receiverExpression if (parentsReceiver != callExpression) { @@ -226,7 +226,7 @@ fun StubBasedPsiElementBase>.ge return stub.getSuperNames() } - val specifiers = (this as KtClassOrObject).getSuperTypeListEntries() + val specifiers = (this as KtClassOrObject).superTypeListEntries if (specifiers.isEmpty()) return Collections.emptyList() val result = ArrayList() @@ -488,7 +488,7 @@ fun KtElement.containingClass(): KtClass? = getStrictParentOfType() fun KtClassOrObject.findPropertyByName(name: String): KtNamedDeclaration? { return declarations.firstOrNull { it is KtProperty && it.name == name } as KtNamedDeclaration? - ?: getPrimaryConstructorParameters().firstOrNull { it.hasValOrVar() && it.name == name } + ?: primaryConstructorParameters.firstOrNull { it.hasValOrVar() && it.name == name } } fun isTypeConstructorReference(e: PsiElement): Boolean { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt index 2304926f828..9bdac74dc69 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt @@ -296,7 +296,7 @@ class DeclarationsChecker( private fun checkTypesInClassHeader(classOrObject: KtClassOrObject) { fun KtTypeReference.type(): KotlinType? = trace.bindingContext.get(TYPE, this) - for (delegationSpecifier in classOrObject.getSuperTypeListEntries()) { + for (delegationSpecifier in classOrObject.superTypeListEntries) { val typeReference = delegationSpecifier.typeReference ?: continue typeReference.type()?.let { DescriptorResolver.checkBounds(typeReference, it, trace) } } @@ -397,7 +397,7 @@ class DeclarationsChecker( private fun checkObject(declaration: KtObjectDeclaration, classDescriptor: ClassDescriptorWithResolutionScopes) { checkOpenMembers(classDescriptor) - if (declaration.isLocal() && !declaration.isCompanion() && !declaration.isObjectLiteral()) { + if (declaration.isLocal && !declaration.isCompanion() && !declaration.isObjectLiteral()) { trace.report(LOCAL_OBJECT_NOT_ALLOWED.on(declaration, classDescriptor)) } } @@ -412,7 +412,7 @@ class DeclarationsChecker( if (aClass.isInterface()) { checkConstructorInInterface(aClass) checkMethodsOfAnyInInterface(classDescriptor) - if (aClass.isLocal() && classDescriptor.containingDeclaration !is ClassDescriptor) { + if (aClass.isLocal && classDescriptor.containingDeclaration !is ClassDescriptor) { trace.report(LOCAL_INTERFACE_NOT_ALLOWED.on(aClass, classDescriptor)) } } @@ -427,7 +427,7 @@ class DeclarationsChecker( private fun checkPrimaryConstructor(classOrObject: KtClassOrObject, classDescriptor: ClassDescriptor) { val primaryConstructor = classDescriptor.unsubstitutedPrimaryConstructor ?: return - val declaration = classOrObject.getPrimaryConstructor() ?: return + val declaration = classOrObject.primaryConstructor ?: return for (parameter in declaration.valueParameters) { trace.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter)?.let { @@ -471,7 +471,7 @@ class DeclarationsChecker( } private fun checkConstructorInInterface(klass: KtClass) { - klass.getPrimaryConstructor()?.let { trace.report(CONSTRUCTOR_IN_INTERFACE.on(it)) } + klass.primaryConstructor?.let { trace.report(CONSTRUCTOR_IN_INTERFACE.on(it)) } } private fun checkMethodsOfAnyInInterface(classDescriptor: ClassDescriptorWithResolutionScopes) { @@ -494,7 +494,7 @@ class DeclarationsChecker( } private fun checkValOnAnnotationParameter(aClass: KtClass) { - for (parameter in aClass.getPrimaryConstructorParameters()) { + for (parameter in aClass.primaryConstructorParameters) { if (!parameter.hasValOrVar()) { trace.report(MISSING_VAL_ON_ANNOTATION_PARAMETER.on(parameter)) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegationResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegationResolver.kt index 018f3542a7d..412c219f805 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegationResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegationResolver.kt @@ -44,7 +44,7 @@ class DelegationResolver private constructor( private fun generateDelegatedMembers(): Collection { val delegatedMembers = hashSetOf() - for (delegationSpecifier in classOrObject.getSuperTypeListEntries()) { + for (delegationSpecifier in classOrObject.superTypeListEntries) { if (delegationSpecifier !is KtDelegatedSuperTypeEntry) { continue } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ExposedVisibilityChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ExposedVisibilityChecker.kt index 75c0a955e74..5d7fbd413b0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/ExposedVisibilityChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/ExposedVisibilityChecker.kt @@ -32,7 +32,7 @@ class ExposedVisibilityChecker(private val trace: DiagnosticSink = DO_NOTHING) { var result = checkSupertypes(klass, classDescriptor) result = result and checkParameterBounds(klass, classDescriptor) - val constructor = klass.getPrimaryConstructor() ?: return result + val constructor = klass.primaryConstructor ?: return result val constructorDescriptor = classDescriptor.unsubstitutedPrimaryConstructor ?: return result return result and checkFunction(constructor, constructorDescriptor) } @@ -122,7 +122,7 @@ class ExposedVisibilityChecker(private val trace: DiagnosticSink = DO_NOTHING) { private fun checkSupertypes(klass: KtClassOrObject, classDescriptor: ClassDescriptor): Boolean { val classVisibility = classDescriptor.effectiveVisibility() val isInterface = classDescriptor.kind == ClassKind.INTERFACE - val delegationList = klass.getSuperTypeListEntries() + val delegationList = klass.superTypeListEntries var result = true classDescriptor.typeConstructor.supertypes.forEachIndexed { i, superType -> if (i >= delegationList.size) return result diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt index 1477adccfbb..f37b664aa1e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/FunctionDescriptorResolver.kt @@ -100,8 +100,8 @@ class FunctionDescriptorResolver( ): SimpleFunctionDescriptor { val functionDescriptor = functionConstructor( containingDescriptor, - annotationResolver.resolveAnnotationsWithoutArguments(scope, function.getModifierList(), trace), - function.getNameAsSafeName(), + annotationResolver.resolveAnnotationsWithoutArguments(scope, function.modifierList, trace), + function.nameAsSafeName, CallableMemberDescriptor.Kind.DECLARATION, function.toSourceElement() ) @@ -119,8 +119,8 @@ class FunctionDescriptorResolver( dataFlowInfo: DataFlowInfo ) { if (functionDescriptor.returnType != null) return - assert(function.getTypeReference() == null) { - "Return type must be initialized early for function: " + function.getText() + ", at: " + DiagnosticUtils.atLocation(function) } + assert(function.typeReference == null) { + "Return type must be initialized early for function: " + function.text + ", at: " + DiagnosticUtils.atLocation(function) } val returnType = if (function.hasBlockBody()) { builtIns.unitType @@ -251,14 +251,14 @@ class FunctionDescriptorResolver( classElement: KtPureClassOrObject, trace: BindingTrace ): ClassConstructorDescriptorImpl? { - if (classDescriptor.getKind() == ClassKind.ENUM_ENTRY || !classElement.hasPrimaryConstructor()) return null + if (classDescriptor.kind == ClassKind.ENUM_ENTRY || !classElement.hasPrimaryConstructor()) return null return createConstructorDescriptor( scope, classDescriptor, true, - classElement.getPrimaryConstructorModifierList(), - classElement.getPrimaryConstructor() ?: classElement, - classElement.getPrimaryConstructorParameters(), + classElement.primaryConstructorModifierList, + classElement.primaryConstructor ?: classElement, + classElement.primaryConstructorParameters, trace ) } @@ -273,9 +273,9 @@ class FunctionDescriptorResolver( scope, classDescriptor, false, - constructor.getModifierList(), + constructor.modifierList, constructor, - constructor.getValueParameters(), + constructor.valueParameters, trace ) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt index 5dc4f3d03c8..34e08581a02 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/LazyTopDownAnalyzer.kt @@ -102,7 +102,7 @@ class LazyTopDownAnalyzer( } override fun visitImportDirective(importDirective: KtImportDirective) { - val importResolver = fileScopeProvider.getImportResolver(importDirective.getContainingKtFile()) + val importResolver = fileScopeProvider.getImportResolver(importDirective.containingKtFile) importResolver.forceResolveImport(importDirective) } @@ -143,7 +143,7 @@ class LazyTopDownAnalyzer( } private fun registerPrimaryConstructorParameters(klass: KtClass) { - for (jetParameter in klass.getPrimaryConstructorParameters()) { + for (jetParameter in klass.primaryConstructorParameters) { if (jetParameter.hasValOrVar()) { c.primaryConstructorParameterProperties.put(jetParameter, lazyDeclarationResolver.resolveToDescriptor(jetParameter) as PropertyDescriptor) } @@ -222,7 +222,7 @@ class LazyTopDownAnalyzer( } private fun resolveImportsInAllFiles(c: TopDownAnalysisContext) { - for (file in c.files + c.scripts.keys.map { it.getContainingKtFile() }) { + for (file in c.files + c.scripts.keys.map { it.containingKtFile }) { fileScopeProvider.getImportResolver(file).forceResolveAllImports() } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt index 5207a277bf4..671badeaec4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt @@ -182,7 +182,7 @@ class QualifiedExpressionResolver { when { importDirective.suppressDiagnosticsInDebugMode() -> null packageFragmentForVisibilityCheck is DeclarationDescriptorWithSource && packageFragmentForVisibilityCheck.source == SourceElement.NO_SOURCE -> { - PackageFragmentWithCustomSource(packageFragmentForVisibilityCheck, KotlinSourceElement(importDirective.getContainingKtFile())) + PackageFragmentWithCustomSource(packageFragmentForVisibilityCheck, KotlinSourceElement(importDirective.containingKtFile)) } else -> packageFragmentForVisibilityCheck } @@ -601,7 +601,7 @@ class QualifiedExpressionResolver { if (descriptor is DeclarationDescriptorWithVisibility) { val fromToCheck = if (shouldBeVisibleFrom is PackageFragmentDescriptor && shouldBeVisibleFrom.source == SourceElement.NO_SOURCE && referenceExpression.containingFile !is DummyHolder) { - PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.getContainingKtFile())) + PackageFragmentWithCustomSource(shouldBeVisibleFrom, KotlinSourceElement(referenceExpression.containingKtFile)) } else { shouldBeVisibleFrom diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt index afcd86ac399..fc2971bcdc4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/TypeResolver.kt @@ -101,11 +101,11 @@ class TypeResolver( private fun resolveType(c: TypeResolutionContext, typeReference: KtTypeReference): KotlinType { assert(!c.allowBareTypes) { "Use resolvePossiblyBareType() when bare types are allowed" } - return resolvePossiblyBareType(c, typeReference).getActualType() + return resolvePossiblyBareType(c, typeReference).actualType } fun resolvePossiblyBareType(c: TypeResolutionContext, typeReference: KtTypeReference): PossiblyBareType { - val cachedType = c.trace.getBindingContext().get(BindingContext.TYPE, typeReference) + val cachedType = c.trace.bindingContext.get(BindingContext.TYPE, typeReference) if (cachedType != null) return type(cachedType) val resolvedTypeSlice = if (c.abbreviated) BindingContext.ABBREVIATED_TYPE else BindingContext.TYPE @@ -120,15 +120,15 @@ class TypeResolver( // Bare types can be allowed only inside expressions; lazy type resolution is only relevant for declarations val lazyKotlinType = LazyWrappedType(storageManager) { - doResolvePossiblyBareType(c, typeReference).getActualType() + doResolvePossiblyBareType(c, typeReference).actualType } c.trace.record(resolvedTypeSlice, typeReference, lazyKotlinType) return type(lazyKotlinType) } val type = doResolvePossiblyBareType(c, typeReference) - if (!type.isBare()) { - c.trace.record(resolvedTypeSlice, typeReference, type.getActualType()) + if (!type.isBare) { + c.trace.record(resolvedTypeSlice, typeReference, type.actualType) } return type } @@ -820,7 +820,7 @@ class TypeResolver( } } else { - val type = resolveType(c.noBareTypes(), argumentElement.getTypeReference()!!) + val type = resolveType(c.noBareTypes(), argumentElement.typeReference!!) val kind = resolveProjectionKind(projectionKind) if (constructor.parameters.size > i) { val parameterDescriptor = constructor.parameters[i] diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/VarianceChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/VarianceChecker.kt index 215496fe1ea..020d3506d29 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/VarianceChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/VarianceChecker.kt @@ -65,7 +65,7 @@ class VarianceCheckerCore( if (klass is KtClass) { if (!checkClassHeader(klass)) return false } - for (member in klass.declarations + klass.getPrimaryConstructorParameters()) { + for (member in klass.declarations + klass.primaryConstructorParameters) { val descriptor = when (member) { is KtParameter -> context.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, member) is KtDeclaration -> context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, member) @@ -93,7 +93,7 @@ class VarianceCheckerCore( private fun checkClassHeader(klass: KtClass): Boolean { var noError = true - for (specifier in klass.getSuperTypeListEntries()) { + for (specifier in klass.superTypeListEntries) { noError = noError and specifier.typeReference?.checkTypePosition(context, OUT_VARIANCE) } return noError and klass.checkTypeParameters(context, OUT_VARIANCE) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt index e0f8534f36b..c5f829d76cf 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/util/callUtil.kt @@ -146,7 +146,7 @@ fun KtElement.getCall(context: BindingContext): Call? { val parent = element.parent val reference: KtExpression? = when { parent is KtInstanceExpressionWithLabel -> parent - parent is KtUserType -> parent.getParent()?.getParent() as? KtConstructorCalleeExpression + parent is KtUserType -> parent.parent?.parent as? KtConstructorCalleeExpression else -> element.getCalleeExpressionIfAny() } if (reference != null) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/DataClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/DataClassDeclarationChecker.kt index c355d1747f3..cc7f324ce64 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/DataClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/DataClassDeclarationChecker.kt @@ -38,7 +38,7 @@ class DataClassDeclarationChecker : SimpleDeclarationChecker { if (descriptor.unsubstitutedPrimaryConstructor == null && descriptor.constructors.isNotEmpty()) { declaration.nameIdentifier?.let { diagnosticHolder.report(Errors.PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS.on(it)) } } - val primaryConstructor = declaration.getPrimaryConstructor() + val primaryConstructor = declaration.primaryConstructor val parameters = primaryConstructor?.valueParameters ?: emptyList() if (parameters.isEmpty()) { (primaryConstructor?.valueParameterList ?: declaration.nameIdentifier)?.let { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ReifiedTypeParameterAnnotationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ReifiedTypeParameterAnnotationChecker.kt index 20e810cc644..cc67bbcd336 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ReifiedTypeParameterAnnotationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ReifiedTypeParameterAnnotationChecker.kt @@ -58,7 +58,7 @@ class ReifiedTypeParameterAnnotationChecker : SimpleDeclarationChecker { diagnosticHolder.report( Errors.REIFIED_TYPE_PARAMETER_NO_INLINE.on( - typeParameterDeclaration.getModifierList()!!.getModifier(KtTokens.REIFIED_KEYWORD)!! + typeParameterDeclaration.modifierList!!.getModifier(KtTokens.REIFIED_KEYWORD)!! ) ) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt index cd3ef187f99..699577e6395 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/LazyImportScope.kt @@ -45,19 +45,19 @@ interface IndexedImports { } class AllUnderImportsIndexed(allImports: Collection) : IndexedImports { - override val imports = allImports.filter { it.isAllUnder() } + override val imports = allImports.filter { it.isAllUnder } override fun importsForName(name: Name) = imports } class ExplicitImportsIndexed(allImports: Collection) : IndexedImports { - override val imports = allImports.filter { !it.isAllUnder() } + override val imports = allImports.filter { !it.isAllUnder } private val nameToDirectives: ListMultimap by lazy { val builder = ImmutableListMultimap.builder() for (directive in imports) { - val path = directive.getImportPath() ?: continue // parse error - val importedName = path.getImportedName() ?: continue // parse error + val path = directive.importPath ?: continue // parse error + val importedName = path.importedName ?: continue // parse error builder.put(importedName, directive) } @@ -241,8 +241,8 @@ class LazyImportScope( return importResolver.storageManager.compute { val descriptors = LinkedHashSet() for (directive in importResolver.indexedImports.imports) { - val importPath = directive.getImportPath() ?: continue - val importedName = importPath.getImportedName() + val importPath = directive.importPath ?: continue + val importedName = importPath.importedName if (importedName == null || nameFilter(importedName)) { descriptors.addAll(importResolver.getImportScope(directive).getContributedDescriptors(kindFilter, nameFilter)) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/data/KtScriptInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/data/KtScriptInfo.kt index b33f5ae2bba..84bf614b9ab 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/data/KtScriptInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/data/KtScriptInfo.kt @@ -33,6 +33,6 @@ class KtScriptInfo( override fun getTypeParameterList() = null override fun getPrimaryConstructorParameters() = listOf() override fun getClassKind() = ClassKind.CLASS - override fun getDeclarations() = script.getDeclarations() + override fun getDeclarations() = script.declarations override fun getDanglingAnnotations() = listOf() } \ No newline at end of file diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt index 37a560bb6ae..41c6c3310f9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyClassMemberScope.kt @@ -358,7 +358,7 @@ open class LazyClassMemberScope( private fun resolveSecondaryConstructors(): Collection { val classOrObject = declarationProvider.correspondingClassOrObject ?: return emptyList() - return classOrObject.getSecondaryConstructors().map { constructor -> + return classOrObject.secondaryConstructors.map { constructor -> val descriptor = c.functionDescriptorResolver.resolveSecondaryConstructorDescriptor( thisDescriptor.scopeForConstructorHeaderResolution, thisDescriptor, constructor, trace ) @@ -368,7 +368,7 @@ open class LazyClassMemberScope( } protected fun setDeferredReturnType(descriptor: ClassConstructorDescriptorImpl) { - descriptor.returnType = DeferredType.create(c.storageManager, trace, { thisDescriptor.getDefaultType() }) + descriptor.returnType = DeferredType.create(c.storageManager, trace, { thisDescriptor.defaultType }) } override fun recordLookup(name: Name, from: LookupLocation) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt index 70c3bd80b86..59e526c6fa7 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/lazy/descriptors/LazyScriptDescriptor.kt @@ -60,7 +60,7 @@ class LazyScriptDescriptor( val scriptDefinition: KotlinScriptDefinition by lazy { - val file = scriptInfo.script.getContainingKtFile() + val file = scriptInfo.script.containingKtFile getScriptDefinition(file) ?: throw RuntimeException("file ${file.name} is not a script") } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt index f0138795280..f1d0216c2bc 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/FunctionsTypingVisitor.kt @@ -65,19 +65,19 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre ): KotlinTypeInfo { if (!isDeclaration) { // function expression - if (!function.getTypeParameters().isEmpty()) { + if (!function.typeParameters.isEmpty()) { context.trace.report(TYPE_PARAMETERS_NOT_ALLOWED.on(function)) } - if (function.getName() != null) { + if (function.name != null) { context.trace.report(ANONYMOUS_FUNCTION_WITH_NAME.on(function.nameIdentifier!!)) } - for (parameter in function.getValueParameters()) { + for (parameter in function.valueParameters) { if (parameter.hasDefaultValue()) { context.trace.report(ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE.on(parameter)) } - if (parameter.isVarArg()) { + if (parameter.isVarArg) { context.trace.report(USELESS_VARARG_ON_PARAMETER.on(parameter)) } } @@ -88,7 +88,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre functionDescriptor = components.functionDescriptorResolver.resolveFunctionDescriptor( context.scope.ownerDescriptor, context.scope, function, context.trace, context.dataFlowInfo) assert(statementScope != null) { - "statementScope must be not null for function: " + function.getName() + " at location " + DiagnosticUtils.atLocation(function) + "statementScope must be not null for function: " + function.name + " at location " + DiagnosticUtils.atLocation(function) } statementScope!!.addFunctionDescriptor(functionDescriptor) } @@ -112,7 +112,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre } components.valueParameterResolver.resolveValueParameters( - function.getValueParameters(), functionDescriptor.valueParameters, context.scope, context.dataFlowInfo, context.trace + function.valueParameters, functionDescriptor.valueParameters, context.scope, context.dataFlowInfo, context.trace ) components.modifiersChecker.withTrace(context.trace).checkModifiersForLocalDeclaration(function, functionDescriptor) @@ -252,7 +252,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre if (returnedExpression != null) { val type = context.trace.getType(returnedExpression) if (type == null || !KotlinBuiltIns.isUnit(type)) { - context.trace.report(RETURN_TYPE_MISMATCH.on(returnedExpression, components.builtIns.getUnitType())) + context.trace.report(RETURN_TYPE_MISMATCH.on(returnedExpression, components.builtIns.unitType)) } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt index ced512f72ce..1760c563b5e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/LocalClassifierAnalyzer.kt @@ -74,7 +74,7 @@ class LocalClassifierAnalyzer( classOrObject: KtClassOrObject ) { val module = DescriptorUtils.getContainingModule(containingDeclaration) - val project = classOrObject.getProject() + val project = classOrObject.project val moduleContext = globalContext.withProject(project).withModule(module) val container = createContainerForLazyLocalClassifierAnalyzer( moduleContext, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt index 6324e870d91..3f505ca6e6a 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ValueParameterResolver.kt @@ -58,7 +58,7 @@ class ValueParameterResolver( context: ExpressionTypingContext ) { if (!valueParameterDescriptor.declaresDefaultValue()) return - val defaultValue = jetParameter.getDefaultValue() ?: return + val defaultValue = jetParameter.defaultValue ?: return expressionTypingServices.getTypeInfo(defaultValue, context.replaceExpectedType(valueParameterDescriptor.type)) if (DescriptorUtils.isAnnotationClass(DescriptorResolver.getContainingClass(context.scope))) { val constant = constantExpressionEvaluator.evaluateExpression(defaultValue, context.trace, valueParameterDescriptor.type) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index 8b68ff019f2..a46cefadb6b 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -403,7 +403,7 @@ class ExpressionCodegen( val spreadBuilderClassName = AsmUtil.asmPrimitiveTypeToLangPrimitiveType(elementType)!!.typeName.identifier + "SpreadBuilder" owner = "kotlin/jvm/internal/" + spreadBuilderClassName addDescriptor = "(" + elementType.descriptor + ")V" - toArrayDescriptor = "()" + type.getDescriptor() + toArrayDescriptor = "()" + type.descriptor } mv.anew(Type.getObjectType(owner)) mv.dup() diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt index fbf71e6afb0..9c3a8aaf02e 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/FunctionCodegen.kt @@ -91,7 +91,7 @@ class FunctionCodegen(val irFunction: IrFunction, val classCodegen: ClassCodegen val defaultValue = this val constant = org.jetbrains.kotlin.codegen.ExpressionCodegen.getCompileTimeConstant( defaultValue, state.bindingContext, true, state.shouldInlineConstVals) - assert(!state.classBuilderMode.generateBodies || constant != null) { "Default value for annotation parameter should be compile time value: " + defaultValue.getText() } + assert(!state.classBuilderMode.generateBodies || constant != null) { "Default value for annotation parameter should be compile time value: " + defaultValue.text } if (constant != null) { val annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(methodVisitor, classCodegen, state.typeMapper) annotationCodegen.generateAnnotationDefaultValue(constant, descriptor.returnType!!) diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt index 223c7f8d629..5e005035038 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/ClassGenerator.kt @@ -212,7 +212,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator primaryConstructorDescriptor) val bodyGenerator = BodyGenerator(primaryConstructorDescriptor, context) - ktClassOrObject.getPrimaryConstructor()?.valueParameterList?.let { ktValueParameterList -> + ktClassOrObject.primaryConstructor?.valueParameterList?.let { ktValueParameterList -> bodyGenerator.generateDefaultParameters(ktValueParameterList, irPrimaryConstructor) } irPrimaryConstructor.body = bodyGenerator.generatePrimaryConstructorBody(ktClassOrObject) @@ -221,7 +221,7 @@ class ClassGenerator(val declarationGenerator: DeclarationGenerator) : Generator } private fun generatePropertiesDeclaredInPrimaryConstructor(irClass: IrClassImpl, ktClassOrObject: KtClassOrObject) { - ktClassOrObject.getPrimaryConstructor()?.let { ktPrimaryConstructor -> + ktClassOrObject.primaryConstructor?.let { ktPrimaryConstructor -> for (ktParameter in ktPrimaryConstructor.valueParameters) { if (ktParameter.hasValOrVar()) { val irProperty = PropertyGenerator(declarationGenerator).generatePropertyForPrimaryConstructorParameter(ktParameter) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/LightClassUtil.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/LightClassUtil.kt index a5829e4561d..ee54d73afbe 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/LightClassUtil.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/LightClassUtil.kt @@ -34,7 +34,7 @@ object LightClassUtil { fun findClass(stub: StubElement<*>, predicate: (PsiClassStub<*>) -> Boolean): PsiClass? { if (stub is PsiClassStub<*> && predicate(stub)) { - return stub.getPsi() + return stub.psi } if (stub is PsiClassStub<*> || stub is PsiFileStub<*>) { diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassDataProvider.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassDataProvider.kt index dd9bd54ba17..0dbab553864 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassDataProvider.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/builder/LightClassDataProvider.kt @@ -165,9 +165,9 @@ class LightClassDataProviderForClassOrObject(private val classOrObject: KtClassO LightClassDataProvider(classOrObject.project) { private val file: KtFile - get() = classOrObject.getContainingKtFile() + get() = classOrObject.containingKtFile - override val isLocal: Boolean get() = classOrObject.isLocal() + override val isLocal: Boolean get() = classOrObject.isLocal override fun getContext(files: Collection): LightClassConstructionContext { return LightClassGenerationSupport.getInstance(classOrObject.project).getContextForClassOrObject(classOrObject) @@ -237,7 +237,7 @@ class LightClassDataProviderForClassOrObject(private val classOrObject: KtClassO // TODO: current method will process local classes in irrelevant declarations, it should be fixed. // We generate all enclosing classes - if (classOrObject.isLocal() && processingClassOrObject.isLocal()) { + if (classOrObject.isLocal && processingClassOrObject.isLocal) { val commonParent = PsiTreeUtil.findCommonParent(classOrObject, processingClassOrObject) return commonParent != null && commonParent !is PsiFile } @@ -252,7 +252,7 @@ class LightClassDataProviderForClassOrObject(private val classOrObject: KtClassO override fun generate(state: GenerationState, files: Collection) { val packageCodegen = state.factory.forPackage(packageFqName, files) - val file = classOrObject.getContainingKtFile() + val file = classOrObject.containingKtFile val packagePartType = state.fileClassesProvider.getFileClassType(file) val context = state.rootContext.intoPackagePart(packageCodegen.packageFragment, packagePartType, file) packageCodegen.generateClassOrObject(classOrObject, context) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForFacade.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForFacade.kt index 64264a8c316..81a1595261e 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForFacade.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForFacade.kt @@ -194,7 +194,7 @@ class KtLightClassForFacade private constructor( override fun isValid() = files.all { it.isValid && fileHasTopLevelCallables(it) && facadeClassFqName == it.javaFileFacadeFqName } - override fun copy() = KtLightClassForFacade(getManager(), facadeClassFqName, lightClassDataCache, files) + override fun copy() = KtLightClassForFacade(manager, facadeClassFqName, lightClassDataCache, files) override val clsDelegate: PsiClass get() { @@ -216,7 +216,7 @@ class KtLightClassForFacade private constructor( override fun getNavigationElement() = files.iterator().next() override fun isEquivalentTo(another: PsiElement?): Boolean { - return another is PsiClass && Comparing.equal(another.qualifiedName, getQualifiedName()) + return another is PsiClass && Comparing.equal(another.qualifiedName, qualifiedName) } override fun getElementIcon(flags: Int): Icon? = throw UnsupportedOperationException("This should be done by JetIconProvider") @@ -240,7 +240,7 @@ class KtLightClassForFacade private constructor( override fun hashCode() = hashCode private fun computeHashCode(): Int { - var result = getManager().hashCode() + var result = manager.hashCode() result = 31 * result + files.hashCode() result = 31 * result + facadeClassFqName.hashCode() return result @@ -255,7 +255,7 @@ class KtLightClassForFacade private constructor( if (this === other) return true if (this.hashCode != lightClass.hashCode) return false - if (getManager() != lightClass.getManager()) return false + if (manager != lightClass.manager) return false if (files != lightClass.files) return false if (facadeClassFqName != lightClass.facadeClassFqName) return false diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt index a6b4428e7b0..9cfab066326 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/KtLightClassForSourceDeclaration.kt @@ -121,7 +121,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC classOrObject.containingFile.virtualFile ?: error("No virtual file for " + classOrObject.text) object : FakeFileForLightClass( - classOrObject.getContainingKtFile(), + classOrObject.containingKtFile, { if (classOrObject.isTopLevel()) this else create(getOutermostClassOrObject(classOrObject))!! }, { getJavaFileStub() } ) { @@ -352,7 +352,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC fun create(classOrObject: KtClassOrObject): KtLightClassForSourceDeclaration? { - if (classOrObject.getContainingKtFile().isScript || classOrObject.hasModifier(KtTokens.HEADER_KEYWORD)) { + if (classOrObject.containingKtFile.isScript || classOrObject.hasModifier(KtTokens.HEADER_KEYWORD)) { return null } @@ -366,7 +366,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC return null } - if (classOrObject.isLocal()) { + if (classOrObject.isLocal) { if (classOrObject.containingFile.virtualFile == null) return null return KtLightClassForLocalDeclaration(classOrObject) diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt index 4e8f728703c..58979f746ce 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/duplicateJvmSignatureUtil.kt @@ -91,12 +91,12 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti val higherPriority = setOf>( CONFLICTING_OVERLOADS, REDECLARATION, NOTHING_TO_OVERRIDE, MANY_IMPL_MEMBER_NOT_IMPLEMENTED) return otherDiagnostics.forElement(psiElement).any { it.factory in higherPriority } - || psiElement is KtPropertyAccessor && alreadyReported(psiElement.getParent()!!) + || psiElement is KtPropertyAccessor && alreadyReported(psiElement.parent!!) } override fun forElement(psiElement: PsiElement): Collection { val jvmDiagnosticFactories = setOf(CONFLICTING_JVM_DECLARATIONS, ACCIDENTAL_OVERRIDE, CONFLICTING_INHERITED_JVM_DECLARATIONS) - fun Diagnostic.data() = cast(this, jvmDiagnosticFactories).getA() + fun Diagnostic.data() = cast(this, jvmDiagnosticFactories).a val (conflicting, other) = jvmDiagnostics.forElement(psiElement).partition { it.factory in jvmDiagnosticFactories } if (alreadyReported(psiElement)) { // CONFLICTING_OVERLOADS already reported, no need to duplicate it diff --git a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt index 1876d0900a7..445deddff8b 100644 --- a/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt +++ b/compiler/light-classes/src/org/jetbrains/kotlin/asJava/lightClassUtils.kt @@ -70,7 +70,7 @@ fun PsiElement.toLightMethods(): List = is KtProperty -> LightClassUtil.getLightClassPropertyMethods(this).toList() is KtParameter -> LightClassUtil.getLightClassPropertyMethods(this).toList() is KtPropertyAccessor -> LightClassUtil.getLightClassAccessorMethods(this) - is KtClass -> toLightClass()?.getConstructors()?.firstOrNull().singletonOrEmptyList() + is KtClass -> toLightClass()?.constructors?.firstOrNull().singletonOrEmptyList() is PsiMethod -> this.singletonList() else -> listOf() } @@ -88,8 +88,8 @@ fun PsiElement.getRepresentativeLightMethod(): PsiMethod? = fun KtParameter.toPsiParameters(): Collection { val paramList = getNonStrictParentOfType() ?: return emptyList() - val paramIndex = paramList.getParameters().indexOf(this) - val owner = paramList.getParent() + val paramIndex = paramList.parameters.indexOf(this) + val owner = paramList.parent val lightParamIndex = if (owner is KtDeclaration && owner.isExtensionDeclaration()) paramIndex + 1 else paramIndex val methods: Collection = diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt index 9f1b8b913ee..6b3e1c547fb 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt @@ -77,8 +77,8 @@ class LazyJavaAnnotationDescriptor( val nameToArg = javaAnnotation.arguments.associateBy { it.name } return constructors.first().valueParameters.keysToMapExceptNulls { valueParameter -> - var javaAnnotationArgument = nameToArg[valueParameter.getName()] - if (javaAnnotationArgument == null && valueParameter.getName() == DEFAULT_ANNOTATION_MEMBER_NAME) { + var javaAnnotationArgument = nameToArg[valueParameter.name] + if (javaAnnotationArgument == null && valueParameter.name == DEFAULT_ANNOTATION_MEMBER_NAME) { javaAnnotationArgument = nameToArg[null] } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt index 3df535afafb..fc8dc1e6f02 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaClassDescriptor.kt @@ -240,7 +240,7 @@ class LazyJavaClassDescriptor( override fun getDeclarationDescriptor() = this@LazyJavaClassDescriptor - override fun toString(): String = getName().asString() + override fun toString(): String = name.asString() } // Only needed when calculating built-ins member scope diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt index 0458deb2703..e11fd6efa90 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaScope.kt @@ -183,7 +183,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS val name = if (function.name.asString() == "equals" && jValueParameters.size == 1 && - c.module.builtIns.getNullableAnyType() == outType) { + c.module.builtIns.nullableAnyType == outType) { // This is a hack to prevent numerous warnings on Kotlin classes that inherit Java classes: if you override "equals" in such // class without this hack, you'll be warned that in the superclass the name is "p0" (regardless of the fact that it's // "other" in Any) @@ -258,7 +258,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS propertyDescriptor.setType(propertyType, listOf(), getDispatchReceiverParameter(), null as KotlinType?) - if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.getType())) { + if (DescriptorUtils.shouldRecordInitializerForProperty(propertyDescriptor, propertyDescriptor.type)) { propertyDescriptor.setCompileTimeInitializer( c.storageManager.createNullableLazyValue { c.components.javaPropertyInitializerEvaluator.getInitializerConstant(field, propertyDescriptor) diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/AnnotationDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/AnnotationDeserializer.kt index 67a9f17a28a..0b923040031 100644 --- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/AnnotationDeserializer.kt +++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/AnnotationDeserializer.kt @@ -108,7 +108,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n // In the case of empty array, no element has the element type, so we fall back to the expected type, if any. // This is not very accurate when annotation class has been changed without recompiling clients, // but should not in fact matter because the value is empty anyway - if (expectedIsArray) expectedType else builtIns.getArrayType(Variance.INVARIANT, builtIns.getAnyType()) + if (expectedIsArray) expectedType else builtIns.getArrayType(Variance.INVARIANT, builtIns.anyType) } val expectedElementType = builtIns.getArrayElementType(if (expectedIsArray) expectedType else actualArrayType) @@ -147,15 +147,15 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n private fun resolveArrayElementType(value: Value, nameResolver: NameResolver): SimpleType = with(builtIns) { when (value.type) { - Type.BYTE -> getByteType() - Type.CHAR -> getCharType() - Type.SHORT -> getShortType() - Type.INT -> getIntType() - Type.LONG -> getLongType() - Type.FLOAT -> getFloatType() - Type.DOUBLE -> getDoubleType() - Type.BOOLEAN -> getBooleanType() - Type.STRING -> getStringType() + Type.BYTE -> byteType + Type.CHAR -> charType + Type.SHORT -> shortType + Type.INT -> intType + Type.LONG -> longType + Type.FLOAT -> floatType + Type.DOUBLE -> doubleType + Type.BOOLEAN -> booleanType + Type.STRING -> stringType Type.CLASS -> error("Arrays of class literals are not supported yet") // TODO: support arrays of class literals Type.ENUM -> resolveClass(nameResolver.getClassId(value.classId)).defaultType Type.ANNOTATION -> resolveClass(nameResolver.getClassId(value.annotation.id)).defaultType diff --git a/generators/infrastructure/build-protobuf-lite.kts b/generators/infrastructure/build-protobuf-lite.kts index 15e753884e0..851412536ab 100644 --- a/generators/infrastructure/build-protobuf-lite.kts +++ b/generators/infrastructure/build-protobuf-lite.kts @@ -35,7 +35,7 @@ fun main(args: Array) { val jar = JarFile(file) try { for (jarEntry in jar.entries()) { - result[jarEntry.getName()] = Pair(jarEntry, jar.getInputStream(jarEntry).readBytes()) + result[jarEntry.name] = Pair(jarEntry, jar.getInputStream(jarEntry).readBytes()) } } finally { diff --git a/generators/infrastructure/check-library-abi-version.kts b/generators/infrastructure/check-library-abi-version.kts index 209a9f8d191..c3f0815c004 100644 --- a/generators/infrastructure/check-library-abi-version.kts +++ b/generators/infrastructure/check-library-abi-version.kts @@ -50,7 +50,7 @@ fun loadVersions(library: File): String { val jarFile = JarFile(library) try { for (entry in jarFile.entries()) { - if (entry.getName().endsWith(".class")) { + if (entry.name.endsWith(".class")) { val classBytes = jarFile.getInputStream(entry).readBytes() loadClassVersions(classBytes)?.let { val (metadata, bytecode) = it diff --git a/generators/infrastructure/strip-kotlin-annotations.kts b/generators/infrastructure/strip-kotlin-annotations.kts index 5c8f614f8fb..0be155b87e8 100644 --- a/generators/infrastructure/strip-kotlin-annotations.kts +++ b/generators/infrastructure/strip-kotlin-annotations.kts @@ -68,13 +68,13 @@ fun main(args: Array) { try { for (entry in inJar.entries()) { val inBytes = inJar.getInputStream(entry).readBytes() - val outBytes = transform(entry.getName(), inBytes) + val outBytes = transform(entry.name, inBytes) if (inBytes.size < outBytes.size) { - error("Size increased for ${entry.getName()}: was ${inBytes.size} bytes, became ${outBytes.size} bytes") + error("Size increased for ${entry.name}: was ${inBytes.size} bytes, became ${outBytes.size} bytes") } - entry.setCompressedSize(-1L) + entry.compressedSize = -1L outJar.putNextEntry(entry) outJar.write(outBytes) outJar.closeEntry() diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/Utils.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/Utils.kt index db2ed864a3a..e430040c13b 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/Utils.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/Utils.kt @@ -37,7 +37,7 @@ fun KtFunctionLiteral.findLabelAndCall(): Pair { when (literalParent) { is KtLabeledExpression -> { - val callExpression = (literalParent.getParent() as? KtValueArgument)?.callExpression() + val callExpression = (literalParent.parent as? KtValueArgument)?.callExpression() return Pair(literalParent.getLabelNameAsName(), callExpression) } diff --git a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt index cb11edfac1a..60dfdfa6c15 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/idea/util/psi/patternMatching/KotlinPsiUnifier.kt @@ -598,7 +598,7 @@ class KotlinPsiUnifier( } fun getDelegationOrderInfo(cls: KtClassOrObject): OrderInfo { - val (orderInsensitive, orderSensitive) = cls.getSuperTypeListEntries().partition { it is KtSuperTypeEntry } + val (orderInsensitive, orderSensitive) = cls.superTypeListEntries.partition { it is KtSuperTypeEntry } return OrderInfo(orderSensitive, orderInsensitive) } diff --git a/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt b/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt index f56af420c6e..09c8bae8be1 100644 --- a/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt +++ b/idea/ide-common/src/org/jetbrains/kotlin/resolve/lazy/PartialBodyResolveFilter.kt @@ -539,7 +539,7 @@ class PartialBodyResolveFilter( is KtBlockExpression -> expression == parent.lastStatement() && isValueNeeded(parent) is KtContainerNode -> { //TODO - not quite correct - val pparent = parent.getParent() as? KtExpression + val pparent = parent.parent as? KtExpression pparent != null && isValueNeeded(pparent) } @@ -559,7 +559,7 @@ class PartialBodyResolveFilter( private fun KtBlockExpression.lastStatement(): KtExpression? = lastChild?.siblings(forward = false)?.firstIsInstanceOrNull() - private fun PsiElement.isStatement() = this is KtExpression && getParent() is KtBlockExpression + private fun PsiElement.isStatement() = this is KtExpression && parent is KtBlockExpression private fun KtTypeReference?.containsProbablyNothing() = this?.typeElement?.anyDescendantOfType { it.isProbablyNothing() } ?: false diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.kt index f8b1f7487e8..db1f37a8194 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.kt @@ -64,7 +64,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG private val psiManager: PsiManager = PsiManager.getInstance(project) override fun getContextForClassOrObject(classOrObject: KtClassOrObject): LightClassConstructionContext { - if (classOrObject.isLocal()) { + if (classOrObject.isLocal) { return getContextForLocalClassOrObject(classOrObject) } else { @@ -312,12 +312,12 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG val relativeFqName = getClassRelativeName(decompiledClassOrObject) val iterator = relativeFqName.pathSegments().iterator() val base = iterator.next() - assert(rootLightClassForDecompiledFile.name == base.asString()) { "Light class for file:\n" + decompiledClassOrObject.getContainingKtFile().virtualFile.canonicalPath + "\nwas expected to have name: " + base.asString() + "\n Actual: " + rootLightClassForDecompiledFile.name } + assert(rootLightClassForDecompiledFile.name == base.asString()) { "Light class for file:\n" + decompiledClassOrObject.containingKtFile.virtualFile.canonicalPath + "\nwas expected to have name: " + base.asString() + "\n Actual: " + rootLightClassForDecompiledFile.name } var current: KtLightClassForDecompiledDeclaration = rootLightClassForDecompiledFile while (iterator.hasNext()) { val name = iterator.next() val innerClass = current.findInnerClassByName(name.asString(), false).sure { - "Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.fqName + "\n" + "File: " + decompiledClassOrObject.getContainingKtFile().virtualFile.name + "Could not find corresponding inner/nested class " + relativeFqName + " in class " + decompiledClassOrObject.fqName + "\n" + "File: " + decompiledClassOrObject.containingKtFile.virtualFile.name } current = innerClass as KtLightClassForDecompiledDeclaration } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt index 68226bdc316..0a279f1ff90 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinCacheServiceImpl.kt @@ -55,7 +55,7 @@ internal val LOG = Logger.getInstance(KotlinCacheService::class.java) class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService { override fun getResolutionFacade(elements: List): ResolutionFacade { - return getFacadeToAnalyzeFiles(elements.map { it.getContainingKtFile() }) + return getFacadeToAnalyzeFiles(elements.map { it.containingKtFile }) } override fun getSuppressionCache(): KotlinSuppressCache = kotlinSuppressCache.value @@ -350,7 +350,7 @@ class KotlinCacheServiceImpl(val project: Project) : KotlinCacheService { private fun KtCodeFragment.getContextFile(): KtFile? { val contextElement = context ?: return null - val contextFile = (contextElement as? KtElement)?.getContainingKtFile() + val contextFile = (contextElement as? KtElement)?.containingKtFile ?: throw AssertionError("Analyzing kotlin code fragment of type $javaClass with java context of type ${contextElement.javaClass}") return if (contextFile is KtCodeFragment) contextFile.getContextFile() else contextFile } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinResolveCache.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinResolveCache.kt index b25ad0abcd4..4a8fd289058 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinResolveCache.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/KotlinResolveCache.kt @@ -68,7 +68,7 @@ internal class PerFileAnalysisCache(val file: KtFile, val componentProvider: Com } fun getAnalysisResults(element: KtElement): AnalysisResult { - assert (element.getContainingKtFile() == file) { "Wrong file. Expected $file, but was ${element.getContainingKtFile()}" } + assert (element.containingKtFile == file) { "Wrong file. Expected $file, but was ${element.containingKtFile}" } val analyzableParent = KotlinResolveDataProvider.findAnalyzableParent(element) @@ -146,7 +146,7 @@ private object KotlinResolveDataProvider { // if none of the above worked, take the outermost declaration ?: PsiTreeUtil.getTopmostParentOfType(element, KtDeclaration::class.java) // if even that didn't work, take the whole file - ?: element.getContainingKtFile() + ?: element.containingKtFile } fun analyze(project: Project, componentProvider: ComponentProvider, analyzableElement: KtElement): AnalysisResult { @@ -156,7 +156,7 @@ private object KotlinResolveDataProvider { return AnalysisResult.success(analyzeExpressionCodeFragment(componentProvider, analyzableElement), module) } - val file = analyzableElement.getContainingKtFile() + val file = analyzableElement.containingKtFile if (file.getModuleInfo() is LibrarySourceInfo) { // Library sources: mark file to skip file.putUserData(LibrarySourceHacks.SKIP_TOP_LEVEL_MEMBERS, true) @@ -165,7 +165,7 @@ private object KotlinResolveDataProvider { val resolveSession = componentProvider.get() val trace = DelegatingBindingTrace(resolveSession.bindingContext, "Trace for resolution of " + analyzableElement) - val targetPlatform = TargetPlatformDetector.getPlatform(analyzableElement.getContainingKtFile()) + val targetPlatform = TargetPlatformDetector.getPlatform(analyzableElement.containingKtFile) val lazyTopDownAnalyzer = createContainerForLazyBodyResolve( //TODO: should get ModuleContext diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt index 68fc799a26e..5e2fbe97a2b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/ProjectResolutionFacade.kt @@ -73,7 +73,7 @@ internal class ProjectResolutionFacade( } val results = elements.map { val perFileCache = synchronized(slruCache) { - slruCache[it.getContainingKtFile()] + slruCache[it.containingKtFile] } perFileCache.getAnalysisResults(it) } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/findDecompiledDeclaration.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/findDecompiledDeclaration.kt index e9cf452320a..29064734d7a 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/findDecompiledDeclaration.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/navigation/findDecompiledDeclaration.kt @@ -145,7 +145,7 @@ object ByDescriptorIndexer : DecompiledTextIndexer { if (original is ConstructorDescriptor && original.isPrimary) { val classOrObject = getDeclarationForDescriptor(original.containingDeclaration, file) as? KtClassOrObject - return classOrObject?.getPrimaryConstructor() ?: classOrObject + return classOrObject?.primaryConstructor ?: classOrObject } val descriptorKey = original.toStringKey() diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinPsiChecker.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinPsiChecker.kt index 2389f52840d..f94c77965b9 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinPsiChecker.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/KotlinPsiChecker.kt @@ -69,7 +69,7 @@ open class KotlinPsiChecker : Annotator, HighlightRangeExtension { getAfterAnalysisVisitor(holder, bindingContext).forEach { visitor -> element.accept(visitor) } - annotateElement(element, holder, bindingContext.getDiagnostics()) + annotateElement(element, holder, bindingContext.diagnostics) } override fun isForceHighlightParents(file: PsiFile): Boolean { 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 ae253d0b20f..21617e47635 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 @@ -117,7 +117,7 @@ class ResolveElementCache( = getElementsAdditionalResolve(function, null, BodyResolveMode.FULL) fun resolvePrimaryConstructorParametersDefaultValues(ktClass: KtClass): BindingContext { - return constructorAdditionalResolve(resolveSession, ktClass, ktClass.getContainingKtFile(), BindingTraceFilter.NO_DIAGNOSTICS).bindingContext + return constructorAdditionalResolve(resolveSession, ktClass, ktClass.containingKtFile, BindingTraceFilter.NO_DIAGNOSTICS).bindingContext } @Deprecated("Use getElementsAdditionalResolve") @@ -278,7 +278,7 @@ class ResolveElementCache( assert(bodyResolveMode == BodyResolveMode.FULL) } - val file = resolveElement.getContainingKtFile() + val file = resolveElement.containingKtFile var statementFilterUsed = StatementFilter.NONE @@ -403,10 +403,10 @@ class ResolveElementCache( else { val fileAnnotationList = ktAnnotationEntry.getParentOfType(true) if (fileAnnotationList != null) { - doResolveAnnotations(resolveSession.getFileAnnotations(fileAnnotationList.getContainingKtFile())) + doResolveAnnotations(resolveSession.getFileAnnotations(fileAnnotationList.containingKtFile)) } if (modifierList != null && modifierList.parent is KtFile) { - doResolveAnnotations(resolveSession.getDanglingAnnotations(modifierList.getContainingKtFile())) + doResolveAnnotations(resolveSession.getDanglingAnnotations(modifierList.containingKtFile)) } } @@ -420,7 +420,7 @@ class ResolveElementCache( private fun getAnnotationsByDeclaration(resolveSession: ResolveSession, modifierList: KtModifierList, declaration: KtDeclaration): Annotations { var descriptor = resolveSession.resolveToDescriptor(declaration) if (declaration is KtClass) { - if (modifierList == declaration.getPrimaryConstructorModifierList()) { + if (modifierList == declaration.primaryConstructorModifierList) { descriptor = (descriptor as ClassDescriptor).unsubstitutedPrimaryConstructor ?: error("No constructor found: ${declaration.getText()}") } @@ -532,7 +532,7 @@ class ResolveElementCache( "in from class '${klass.getElementTextWithContext()}'") ForceResolveUtil.forceResolveAllContents(constructorDescriptor) - val primaryConstructor = klass.getPrimaryConstructor() + val primaryConstructor = klass.primaryConstructor if (primaryConstructor != null) { val bodyResolver = createBodyResolver(resolveSession, trace, file, StatementFilter.NONE) bodyResolver.resolveConstructorParameterDefaultValues(DataFlowInfo.EMPTY, trace, primaryConstructor, constructorDescriptor, scope) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt index 460e68de458..64e9eb91c44 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/references/referenceUtil.kt @@ -103,7 +103,7 @@ fun PsiReference.matchesTarget(candidateTarget: PsiElement): Boolean { } if (this is PsiJavaCodeReferenceElement && candidateTarget is KtObjectDeclaration && unwrappedTargets.size == 1) { val referredClass = unwrappedTargets.first() - if (referredClass is KtClass && candidateTarget in referredClass.getCompanionObjects()) { + if (referredClass is KtClass && candidateTarget in referredClass.companionObjects) { if (parent is PsiImportStaticStatement) return true return parent.reference?.unwrappedTargets?.any { 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 97727ff4235..0bf275b9900 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 @@ -603,7 +603,7 @@ class ExpressionsOfTypeProcessor( runReadAction { if (!scope.isValid) return@runReadAction - val file = scope.getContainingKtFile() + val file = scope.containingKtFile val restricted = LocalSearchScope(scope).intersectWith(searchScope) if (restricted is LocalSearchScope) { ScopeLoop@ diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt index 91f02fe35f0..686bec219b0 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/search/usagesSearch/utils.kt @@ -175,7 +175,7 @@ private fun processInheritorsDelegatingCallToSpecifiedConstructor( private fun processClassDelegationCallsToSpecifiedConstructor( klass: KtClass, constructor: DeclarationDescriptor, process: (KtCallElement) -> Boolean ): Boolean { - for (secondaryConstructor in klass.getSecondaryConstructors()) { + for (secondaryConstructor in klass.secondaryConstructors) { val delegationCallDescriptor = secondaryConstructor.getDelegationCall().getConstructorCallDescriptor() if (constructor == delegationCallDescriptor) { if (!process(secondaryConstructor.getDelegationCall())) return false @@ -184,7 +184,7 @@ private fun processClassDelegationCallsToSpecifiedConstructor( if (!klass.isEnum()) return true for (declaration in klass.declarations) { if (declaration is KtEnumEntry) { - val delegationCall = declaration.getSuperTypeListEntries().firstOrNull() + val delegationCall = declaration.superTypeListEntries.firstOrNull() if (delegationCall is KtSuperTypeCallEntry && constructor == delegationCall.calleeExpression.getConstructorCallDescriptor()) { if (!process(delegationCall)) return false } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinInheritedMembersNodeProvider.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinInheritedMembersNodeProvider.kt index 110b0c12285..ca23b179c3b 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinInheritedMembersNodeProvider.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinInheritedMembersNodeProvider.kt @@ -43,11 +43,11 @@ class KotlinInheritedMembersNodeProvider: InheritedMembersNodeProvider() - val defaultType = descriptor.getDefaultType() + val defaultType = descriptor.defaultType for (memberDescriptor in defaultType.memberScope.getContributedDescriptors()) { if (memberDescriptor !is CallableMemberDescriptor) continue - when (memberDescriptor.getKind()) { + when (memberDescriptor.kind) { CallableMemberDescriptor.Kind.FAKE_OVERRIDE, CallableMemberDescriptor.Kind.DELEGATION -> { val superTypeMember = DescriptorToSourceUtilsIde.getAnyDeclaration(project, memberDescriptor) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinStructureViewElement.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinStructureViewElement.kt index 3fb5dd2662d..b9c6cfb8d35 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinStructureViewElement.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/structureView/KotlinStructureViewElement.kt @@ -116,5 +116,5 @@ class KotlinStructureViewElement(val element: NavigatablePsiElement, get() = (descriptor as? DeclarationDescriptorWithVisibility)?.visibility == Visibilities.PUBLIC } -fun KtClassOrObject.getStructureDeclarations() = getPrimaryConstructorParameters().filter { it.hasValOrVar() } + declarations +fun KtClassOrObject.getStructureDeclarations() = primaryConstructorParameters.filter { it.hasValOrVar() } + declarations diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionUtils.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionUtils.kt index ea72d9a6c69..bab90fee2cf 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionUtils.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionUtils.kt @@ -283,7 +283,7 @@ fun breakOrContinueExpressionItems(position: KtElement, breakOrContinue: String) result.add(createKeywordElement(breakOrContinue)) } - val label = (parent.getParent() as? KtLabeledExpression)?.getLabelNameAsName() + val label = (parent.parent as? KtLabeledExpression)?.getLabelNameAsName() if (label != null) { result.add(createKeywordElement(breakOrContinue, tail = label.labelNameToTail())) } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/WithExpressionPrefixInsertHandler.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/WithExpressionPrefixInsertHandler.kt index d6205c6f67b..99a02614329 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/WithExpressionPrefixInsertHandler.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/handlers/WithExpressionPrefixInsertHandler.kt @@ -45,7 +45,7 @@ class WithExpressionPrefixInsertHandler(val prefix: String) : InsertHandler { - val entry = parent.getParent() as KtWhenEntry + val entry = parent.parent as KtWhenEntry val whenExpression = entry.parent as KtWhenExpression val subject = whenExpression.subjectExpression ?: return@lazy emptySet() diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt index 4cd2e804af9..8abafbc14fc 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt @@ -472,7 +472,7 @@ class KotlinIndicesHelper( private fun KtNamedDeclaration.resolveToDescriptorsWithHack( psiFilter: (KtDeclaration) -> Boolean): Collection { - if (getContainingKtFile().isCompiled) { //TODO: it's temporary while resolveToDescriptor does not work for compiled declarations + if (containingKtFile.isCompiled) { //TODO: it's temporary while resolveToDescriptor does not work for compiled declarations return resolutionFacade.resolveImportReference(moduleDescriptor, fqName!!).filterIsInstance() } else { diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/Utils.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/Utils.kt index 2dc97bf7086..62ad37bd14a 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/Utils.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/Utils.kt @@ -102,7 +102,7 @@ fun ImplicitReceiver.asExpression(resolutionScope: LexicalScope, psiFactory: KtP fun KtImportDirective.targetDescriptors(resolutionFacade: ResolutionFacade = this.getResolutionFacade()): Collection { // For codeFragments imports are created in dummy file - if (this.getContainingKtFile().doNotAnalyze != null) return emptyList() + if (this.containingKtFile.doNotAnalyze != null) return emptyList() val nameExpression = importedReference?.getQualifiedElementSelector() as? KtSimpleNameExpression ?: return emptyList() return nameExpression.mainReference.resolveToDescriptors(resolutionFacade.analyze(nameExpression)) } diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt index 9cbd0281dba..0961205d85d 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt @@ -170,7 +170,7 @@ fun PsiElement.deleteSingle() { } fun KtClass.getOrCreateCompanionObject() : KtObjectDeclaration { - getCompanionObjects().firstOrNull()?.let { return it } + companionObjects.firstOrNull()?.let { return it } return addDeclaration(KtPsiFactory(this).createCompanionObject()) } diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt index 3e9fff11ec1..a34f6fd0bd5 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt @@ -183,7 +183,7 @@ class KotlinMavenPluginPhaseInspection : DomElementsInspection(true) val referenced = typeReference?.text ?: expression.getReferencedName() - expression.getContainingKtFile() + expression.containingKtFile .importDirectives .firstOrNull { !it.isAllUnder && it.aliasName == referenced || it.importedFqName?.shortName()?.asString() == referenced } ?.let { it.importedFqName?.asString() } diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/KotlinAddImportAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/KotlinAddImportAction.kt index 643ef19eba3..b735fd92a29 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/KotlinAddImportAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/KotlinAddImportAction.kt @@ -104,9 +104,9 @@ internal fun createGroupedImportsAction( autoImportDescription: String, fqNames: Collection ): KotlinAddImportAction { - val prioritizer = DescriptorGroupPrioritizer(element.getContainingKtFile()) + val prioritizer = DescriptorGroupPrioritizer(element.containingKtFile) - val file = element.getContainingKtFile() + val file = element.containingKtFile val variants = fqNames .groupBy { it.parentOrNull() ?: FqName.ROOT } .map { @@ -204,7 +204,7 @@ class KotlinAddImportAction internal constructor( project.executeWriteCommand(QuickFixBundle.message("add.import")) { if (!element.isValid) return@executeWriteCommand - val file = element.getContainingKtFile() + val file = element.containingKtFile variant.declarationToImport(project)?.let { val location = ProximityLocation(element, ModuleUtilCore.findModuleForPsiElement(element)) diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateTestSupportActionBase.kt b/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateTestSupportActionBase.kt index 3a4db0930e0..1708d395975 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateTestSupportActionBase.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/generate/KotlinGenerateTestSupportActionBase.kt @@ -62,7 +62,7 @@ abstract class KotlinGenerateTestSupportActionBase( companion object { private fun findTargetClass(editor: Editor, file: PsiFile): KtClassOrObject? { val elementAtCaret = file.findElementAt(editor.caretModel.offset) ?: return null - return elementAtCaret.parentsWithSelf.filterIsInstance().firstOrNull { !it.isLocal() } + return elementAtCaret.parentsWithSelf.filterIsInstance().firstOrNull { !it.isLocal } } private fun chooseAndPerform(editor: Editor, frameworks: List, consumer: (TestFramework) -> Unit) { diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/generate/utils.kt b/idea/src/org/jetbrains/kotlin/idea/actions/generate/utils.kt index 9bdc7717dc9..05206c99eb4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/generate/utils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/generate/utils.kt @@ -49,7 +49,7 @@ tailrec fun ClassDescriptor.findDeclaredFunction( fun getPropertiesToUseInGeneratedMember(classOrObject: KtClassOrObject): List { return ArrayList().apply { - classOrObject.getPrimaryConstructorParameters().filterTo(this) { it.hasValOrVar() } + classOrObject.primaryConstructorParameters.filterTo(this) { it.hasValOrVar() } classOrObject.declarations.filterIsInstance().filterTo(this) { val descriptor = it.resolveToDescriptor() when (descriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckComponentsUsageSearchAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckComponentsUsageSearchAction.kt index b1f27036a42..eef546273bc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckComponentsUsageSearchAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckComponentsUsageSearchAction.kt @@ -61,7 +61,7 @@ class CheckComponentsUsageSearchAction : AnAction() { progressIndicator?.text = "Checking data class ${i + 1} of ${dataClasses.size}..." progressIndicator?.text2 = dataClass.fqName?.asString() ?: "" - val parameter = dataClass.getPrimaryConstructor()?.valueParameters?.firstOrNull() + val parameter = dataClass.primaryConstructor?.valueParameters?.firstOrNull() if (parameter != null) { try { var smartRefsCount = 0 diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckPartialBodyResolveAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckPartialBodyResolveAction.kt index 055ad7d66f8..65bd53d8b2c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckPartialBodyResolveAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/CheckPartialBodyResolveAction.kt @@ -193,7 +193,7 @@ class CheckPartialBodyResolveAction : AnAction() { is KtBlockExpression -> expression == parent.lastStatement() && isValueNeeded(parent) is KtContainerNode -> { //TODO - not quite correct - val pparent = parent.getParent() as? KtExpression + val pparent = parent.parent as? KtExpression pparent != null && isValueNeeded(pparent) } diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt b/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt index 9fc1c92a6a6..50487edb9ab 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInliner/CodeInliner.kt @@ -58,7 +58,7 @@ class CodeInliner( fun doInline(): KtElement? { val descriptor = resolvedCall.resultingDescriptor - val file = nameExpression.getContainingKtFile() + val file = nameExpression.containingKtFile val elementToBeReplaced = when (callElement) { is KtExpression -> callElement.getQualifiedExpressionForSelectorOrThis() diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt index 50c2944dbb7..5aed936b171 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinBreadcrumbsInfoProvider.kt @@ -136,7 +136,7 @@ class KotlinBreadcrumbsInfoProvider : BreadcrumbsInfoProvider() { return buildString { append("object") - val superTypeEntries = getSuperTypeListEntries() + val superTypeEntries = superTypeListEntries if (superTypeEntries.isNotEmpty()) { append(" : ") diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerUtils.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerUtils.kt index eebf8fcb9b9..4fd76b75424 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/DebuggerUtils.kt @@ -120,7 +120,7 @@ object DebuggerUtils { toProcess.add(file) for (collectedElement in analyzedElements) { - val containingFile = collectedElement.getContainingKtFile() + val containingFile = collectedElement.containingKtFile toProcess.add(containingFile) } diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt index d5926712cd3..1edc39c9d7e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/KotlinPositionManager.kt @@ -140,12 +140,12 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq val methodName = location.method().name() return when { JvmAbi.isGetterName(methodName) -> { - val parameterForGetter = contextElement.getPrimaryConstructor()?.valueParameters?.firstOrNull() { + val parameterForGetter = contextElement.primaryConstructor?.valueParameters?.firstOrNull() { it.hasValOrVar() && it.name != null && JvmAbi.getterName(it.name!!) == methodName } ?: return null parameterForGetter } - methodName == "" -> contextElement.getPrimaryConstructor() + methodName == "" -> contextElement.primaryConstructor else -> null } } diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt index 31bb2f9682c..6dc66090583 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt @@ -90,7 +90,7 @@ class KotlinFieldBreakpointType : JavaBreakpointType { val jetClass = psiClass.kotlinOrigin - createBreakpointIfPropertyExists(jetClass, jetClass.getContainingKtFile(), className, fieldName) + createBreakpointIfPropertyExists(jetClass, jetClass.containingKtFile, className, fieldName) } else -> null } diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt index 0ece2a6c2d3..8006550080b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/KotlinEvaluationBuilder.kt @@ -386,7 +386,7 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour val generateClassFilter = object : GenerationState.GenerateClassFilter() { override fun shouldGeneratePackagePart(jetFile: KtFile) = jetFile == fileForDebugger override fun shouldAnnotateClass(processingClassOrObject: KtClassOrObject) = true - override fun shouldGenerateClass(processingClassOrObject: KtClassOrObject) = processingClassOrObject.getContainingKtFile() == fileForDebugger + override fun shouldGenerateClass(processingClassOrObject: KtClassOrObject) = processingClassOrObject.containingKtFile == fileForDebugger override fun shouldGenerateScript(script: KtScript) = false } diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/extractFunctionForDebuggerUtil.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/extractFunctionForDebuggerUtil.kt index 86e29bf8307..e2b3ba85e5d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/extractFunctionForDebuggerUtil.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/evaluate/extractFunctionForDebuggerUtil.kt @@ -84,7 +84,7 @@ fun getFunctionForExtractedFragment( val newDebugExpressions = addDebugExpressionIntoTmpFileForExtractFunction(originalFile, codeFragment, breakpointLine) if (newDebugExpressions.isEmpty()) return null - val tmpFile = newDebugExpressions.first().getContainingKtFile() + val tmpFile = newDebugExpressions.first().containingKtFile if (LOG.isDebugEnabled) { LOG.debug("TMP_FILE:\n${runReadAction { tmpFile.text }}") diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt index ecd7b2e014a..38afd8915ed 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt @@ -63,7 +63,7 @@ class KotlinRecursiveCallLineMarkerProvider : LineMarkerProvider { when (parent) { is KtFunctionLiteral -> if (stopOnNonInlinedLambdas && !InlineUtil.isInlinedArgument(parent, parent.analyze(), false)) return null is KtNamedFunction -> { - when (parent.getParent()) { + when (parent.parent) { is KtBlockExpression, is KtClassBody, is KtFile, is KtScript -> return parent else -> if (stopOnNonInlinedLambdas && !InlineUtil.isInlinedArgument(parent, parent.analyze(), false)) return null } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt index d5cbe41afb2..a1e1804a6f0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt @@ -35,7 +35,7 @@ class ArrayInDataClassInspection : AbstractKotlinInspection() { return object : KtVisitorVoid() { override fun visitClass(klass: KtClass) { if (!klass.isData()) return - val constructor = klass.getPrimaryConstructor() ?: return + val constructor = klass.primaryConstructor ?: return if (hasOverriddenEqualsAndHashCode(klass)) return val context = constructor.analyze(BodyResolveMode.PARTIAL) for (parameter in constructor.valueParameters) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt index 3a503a77e76..48144e83d18 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt @@ -81,7 +81,7 @@ class EqualsOrHashCodeInspection : AbstractKotlinInspection() { when (classDescriptor.kind) { ClassKind.OBJECT -> { - if (classOrObject.getSuperTypeListEntries().isNotEmpty()) return + if (classOrObject.superTypeListEntries.isNotEmpty()) return holder.registerProblem(nameIdentifier, "equals()/hashCode() in object declaration", DeleteEqualsAndHashCodeFix) } ClassKind.CLASS -> { diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/AddJvmOverloadsIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/AddJvmOverloadsIntention.kt index 08100b4a67a..1a25f2fd384 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/AddJvmOverloadsIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/AddJvmOverloadsIntention.kt @@ -69,7 +69,7 @@ class AddJvmOverloadsIntention : SelfTargetingIntention( text = "Add '@JvmOverloads' annotation to $targetName" - return TargetPlatformDetector.getPlatform(element.getContainingKtFile()) == JvmPlatform + return TargetPlatformDetector.getPlatform(element.containingKtFile) == JvmPlatform && parameters.any { it.hasDefaultValue() } && element.findAnnotation(annotationFqName) == null } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt index 0db57ed9e06..4b6c548a253 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt @@ -87,7 +87,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention(K } ?: return val inconvertibleSubclasses = subclasses.filter { - it !is KtObjectDeclaration || it.containingClassOrObject != element || it.getSuperTypeListEntries().size != 1 + it !is KtObjectDeclaration || it.containingClassOrObject != element || it.superTypeListEntries.size != 1 } if (inconvertibleSubclasses.isNotEmpty()) { val message = buildString { @@ -75,14 +75,14 @@ class ConvertSealedClassToEnumIntention : SelfTargetingRangeIntention(K val comma = psiFactory.createComma() val semicolon = psiFactory.createSemicolon() - val constructorCallNeeded = element.hasExplicitPrimaryConstructor() || element.getSecondaryConstructors().isNotEmpty() + val constructorCallNeeded = element.hasExplicitPrimaryConstructor() || element.secondaryConstructors.isNotEmpty() val entriesToAdd = subclasses.mapIndexed { i, subclass -> subclass as KtObjectDeclaration val entryText = buildString { append(subclass.name) if (constructorCallNeeded) { - append((subclass.getSuperTypeListEntries().firstOrNull() as? KtSuperTypeCallEntry)?.valueArgumentList?.text ?: "()") + append((subclass.superTypeListEntries.firstOrNull() as? KtSuperTypeCallEntry)?.valueArgumentList?.text ?: "()") } } val entry = psiFactory.createEnumEntry(entryText) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSecondaryConstructorToPrimaryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSecondaryConstructorToPrimaryIntention.kt index 62d7d9ab708..0580a8f0522 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSecondaryConstructorToPrimaryIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertSecondaryConstructorToPrimaryIntention.kt @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils class ConvertSecondaryConstructorToPrimaryInspection : IntentionBasedInspection( ConvertSecondaryConstructorToPrimaryIntention::class, - { constructor -> constructor.containingClass()?.getSecondaryConstructors()?.size == 1 } + { constructor -> constructor.containingClass()?.secondaryConstructors?.size == 1 } ) { override fun inspectionTarget(element: KtSecondaryConstructor) = element.getConstructorKeyword() } @@ -165,7 +165,7 @@ class ConvertSecondaryConstructorToPrimaryIntention : SelfTargetingRangeIntentio val delegationCall = element.getDelegationCall() val argumentList = delegationCall.valueArgumentList if (!delegationCall.isImplicit && argumentList != null) { - for (superTypeListEntry in klass.getSuperTypeListEntries()) { + for (superTypeListEntry in klass.superTypeListEntries) { val typeReference = superTypeListEntry.typeReference ?: continue val type = context[BindingContext.TYPE, typeReference] if ((type?.constructor?.declarationDescriptor as? ClassDescriptor)?.kind == ClassKind.CLASS) { diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt index adba51909f6..21165661de3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt @@ -55,9 +55,9 @@ class CreateKotlinSubClassIntention : SelfTargetingRangeIntention(KtCla if (!baseClass.isInterface() && !baseClass.isSealed() && !baseClass.isAbstract() && !baseClass.hasModifier(KtTokens.OPEN_KEYWORD)) { return null } - val primaryConstructor = baseClass.getPrimaryConstructor() + val primaryConstructor = baseClass.primaryConstructor if (!baseClass.isInterface() && primaryConstructor != null) { - val constructors = baseClass.getSecondaryConstructors() + primaryConstructor + val constructors = baseClass.secondaryConstructors + primaryConstructor if (constructors.none() { !it.isPrivate() && it.getValueParameters().all { it.hasDefaultValue() } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt index fea2633481e..b52446b3a12 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/DeprecatedCallableAddReplaceWithIntention.kt @@ -195,7 +195,7 @@ class DeprecatedCallableAddReplaceWithIntention : SelfTargetingRangeIntention { - val file = expression.getContainingKtFile() + val file = expression.containingKtFile val currentPackageFqName = file.packageFqName val importHelper = ImportInsertHelper.getInstance(expression.project) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt index aaf28f2f109..f640b40bd04 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/MoveMemberToCompanionObjectIntention.kt @@ -78,7 +78,7 @@ class MoveMemberToCompanionObjectIntention : SelfTargetingRangeIntention() val conflicts = MultiMap() - containingClass.getCompanionObjects().firstOrNull()?.let { companion -> + containingClass.companionObjects.firstOrNull()?.let { companion -> val companionDescriptor = companion.resolveToDescriptor() as ClassDescriptor val callableDescriptor = element.resolveToDescriptor() as CallableMemberDescriptor companionDescriptor.findCallableMemberBySignature(callableDescriptor)?.let { diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ObjectLiteralToLambdaIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ObjectLiteralToLambdaIntention.kt index 6c7c4b2bd58..d00d0a8270d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ObjectLiteralToLambdaIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ObjectLiteralToLambdaIntention.kt @@ -146,7 +146,7 @@ class ObjectLiteralToLambdaIntention : SelfTargetingRangeIntention false element.annotations.isNotEmpty() -> false element.modifierList?.text?.isBlank() == false -> false - element.containingClass()?.getSecondaryConstructors()?.isNotEmpty() == true -> false + element.containingClass()?.secondaryConstructors?.isNotEmpty() == true -> false else -> true } } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceArrayEqualityOpWithArraysEqualsIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceArrayEqualityOpWithArraysEqualsIntention.kt index b43241fb931..38c95ff7a42 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceArrayEqualityOpWithArraysEqualsIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceArrayEqualityOpWithArraysEqualsIntention.kt @@ -40,7 +40,7 @@ class ReplaceArrayEqualityOpWithArraysEqualsIntention : SelfTargetingOffsetIndep val right = element.right ?: return val left = element.left ?: return val factory = KtPsiFactory(project) - val ktFile = element.getContainingKtFile() + val ktFile = element.containingKtFile ktFile.resolveImportReference(FqName("java.util.Arrays")).firstOrNull()?.let { ImportInsertHelper.getInstance(project).importDescriptor(ktFile, it) } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceWithOperatorAssignmentIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceWithOperatorAssignmentIntention.kt index 4f2c63dc4f7..90f53804b43 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceWithOperatorAssignmentIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceWithOperatorAssignmentIntention.kt @@ -46,7 +46,7 @@ class ReplaceWithOperatorAssignmentIntention : SelfTargetingOffsetIndependentInt // now check that the resulting operator assignment will be resolved val opAssign = buildOperatorAssignment(element) - opAssign.getContainingKtFile().doNotAnalyze = null //TODO: strange hack + opAssign.containingKtFile.doNotAnalyze = null //TODO: strange hack val newBindingContext = opAssign.analyzeAsReplacement(element, bindingContext) return newBindingContext.diagnostics.forElement(opAssign.operationReference).isEmpty() } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/SimplifyAssertNotNullIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/SimplifyAssertNotNullIntention.kt index 19e15fbdb41..2c05e782657 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/SimplifyAssertNotNullIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/SimplifyAssertNotNullIntention.kt @@ -88,7 +88,7 @@ class SimplifyAssertNotNullIntention : SelfTargetingOffsetIndependentIntention return null } - if (declaration.containingClassOrObject?.isLocal() ?: false) return null + if (declaration.containingClassOrObject?.isLocal ?: false) return null val callable = declaration.resolveToDescriptorIfAny() as? CallableDescriptor ?: return null if (publicAPIOnly && !callable.visibility.isPublicAPI) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/declarations/ConvertMemberToExtensionIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/declarations/ConvertMemberToExtensionIntention.kt index dbbdbc315b4..71543503874 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/declarations/ConvertMemberToExtensionIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/declarations/ConvertMemberToExtensionIntention.kt @@ -57,7 +57,7 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention { - val refFile = ref.element.getContainingKtFile() + val refFile = ref.element.containingKtFile if (refFile != file) { ktFilesToAddImports.add(refFile) } diff --git a/idea/src/org/jetbrains/kotlin/idea/joinLines/JoinDeclarationAndAssignmentHandler.kt b/idea/src/org/jetbrains/kotlin/idea/joinLines/JoinDeclarationAndAssignmentHandler.kt index 68778998363..42e5b77c532 100644 --- a/idea/src/org/jetbrains/kotlin/idea/joinLines/JoinDeclarationAndAssignmentHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/joinLines/JoinDeclarationAndAssignmentHandler.kt @@ -68,7 +68,7 @@ class JoinDeclarationAndAssignmentHandler : JoinRawLinesHandlerDelegate { } private fun doJoin(property: KtProperty, assignment: KtBinaryExpression) { - property.setInitializer(assignment.right) + property.initializer = assignment.right property.parent!!.deleteChildRange(property.nextSibling, assignment) //TODO: should we delete range? } diff --git a/idea/src/org/jetbrains/kotlin/idea/patterns/KotlinPatterns.kt b/idea/src/org/jetbrains/kotlin/idea/patterns/KotlinPatterns.kt index e5208d99896..785dd6b37e1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/patterns/KotlinPatterns.kt +++ b/idea/src/org/jetbrains/kotlin/idea/patterns/KotlinPatterns.kt @@ -86,7 +86,7 @@ open class KotlinFunctionPattern : PsiElementPattern if (function.parent !is KtFile) return@withPatternCondition false - function.getContainingKtFile().packageFqName.asString() == packageFqName + function.containingKtFile.packageFqName.asString() == packageFqName } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/projectView/KtClassOrObjectTreeNode.kt b/idea/src/org/jetbrains/kotlin/idea/projectView/KtClassOrObjectTreeNode.kt index afce0829e01..c8c9c5225c5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/projectView/KtClassOrObjectTreeNode.kt +++ b/idea/src/org/jetbrains/kotlin/idea/projectView/KtClassOrObjectTreeNode.kt @@ -60,7 +60,7 @@ class KtClassOrObjectTreeNode(project: Project?, ktClassOrObject: KtClassOrObjec data.presentableText = classOrObject.name val parent = parent - if (KotlinIconProvider.getMainClass(classOrObject.getContainingKtFile()) != null) { + if (KotlinIconProvider.getMainClass(classOrObject.containingKtFile) != null) { if (parent is KtFileTreeNode) { update(parent.getParent()) } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.kt index 4f39072902b..b0b320838b9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ChangeFunctionLiteralReturnTypeFix.kt @@ -49,7 +49,7 @@ class ChangeFunctionLiteralReturnTypeFix( private val appropriateQuickFix = createAppropriateQuickFix(functionLiteralExpression, type) private fun createAppropriateQuickFix(functionLiteralExpression: KtLambdaExpression, type: KotlinType): IntentionAction? { - val analysisResult = functionLiteralExpression.getContainingKtFile().analyzeFullyAndGetResult() + val analysisResult = functionLiteralExpression.containingKtFile.analyzeFullyAndGetResult() val context = analysisResult.bindingContext val functionLiteralType = context.getType(functionLiteralExpression) ?: error("Type of function literal not available in binding context") diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt index 7f57ddc4c34..0e2a9ac87ec 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/ImportFix.kt @@ -158,7 +158,7 @@ internal abstract class ImportFixBase protected constructor( val nameStr = name.asString() if (nameStr.isEmpty()) return emptyList() - val file = element.getContainingKtFile() + val file = element.containingKtFile val bindingContext = element.analyze(BodyResolveMode.PARTIAL_WITH_DIAGNOSTICS) if (!checkErrorStillPresent(bindingContext)) return emptyList() @@ -510,7 +510,7 @@ internal class ImportForMismatchingArgumentsFix( if (callElement.anyDescendantOfType()) return emptyList() // incomplete call val elementToAnalyze = callElement.getQualifiedExpressionForSelectorOrThis() - val file = element.getContainingKtFile() + val file = element.containingKtFile val resolutionFacade = file.getResolutionFacade() val resolutionScope = elementToAnalyze.getResolutionScope(bindingContext, resolutionFacade) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt index 6b7347c4512..3ff1d1721a9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt @@ -115,7 +115,7 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() { val changeSignature = { runChangeSignature(project, constructorDescriptor, config, contextElement, text) } changeSignature.runRefactoringWithPostprocessing(project, "refactoring.changeSignature") { val constructorOrClass = constructorPointer.element - val constructor = constructorOrClass as? KtConstructor<*> ?: (constructorOrClass as? KtClass)?.getPrimaryConstructor() + val constructor = constructorOrClass as? KtConstructor<*> ?: (constructorOrClass as? KtClass)?.primaryConstructor constructor?.getValueParameters()?.lastOrNull()?.replace(parameterToInsert) } } @@ -174,7 +174,7 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() { changeSignature.runRefactoringWithPostprocessing(project, "refactoring.changeSignature") { val constructorOrClass = constructorPointer?.element - val constructor = constructorOrClass as? KtConstructor<*> ?: (constructorOrClass as? KtClass)?.getPrimaryConstructor() + val constructor = constructorOrClass as? KtConstructor<*> ?: (constructorOrClass as? KtClass)?.primaryConstructor if (constructor == null || !visitedElements.add(constructor)) return@runRefactoringWithPostprocessing constructor.getValueParameters().lastOrNull()?.let { newParam -> val psiFactory = KtPsiFactory(project) @@ -191,7 +191,7 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() { val propertyDescriptor = element.resolveToDescriptorIfAny() as? PropertyDescriptor ?: return val classDescriptor = propertyDescriptor.containingDeclaration as? ClassDescriptorWithResolutionScopes ?: return val klass = element.containingClassOrObject ?: return - val constructorDescriptors = if (klass.hasExplicitPrimaryConstructor() || klass.getSecondaryConstructors().isEmpty()) { + val constructorDescriptors = if (klass.hasExplicitPrimaryConstructor() || klass.secondaryConstructors.isEmpty()) { listOf(classDescriptor.unsubstitutedPrimaryConstructor!!) } else { @@ -222,7 +222,7 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() { (property.containingClassOrObject as? KtClass)?.let { klass -> if (klass.isAnnotation() || klass.isInterface()) return@let - if (property.accessors.isNotEmpty() || klass.getSecondaryConstructors().any { !it.getDelegationCall().isCallToThis }) { + if (property.accessors.isNotEmpty() || klass.secondaryConstructors.any { !it.getDelegationCall().isCallToThis }) { actions.add(InitializeWithConstructorParameter(property)) } else { diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeConstructorParameterPropertyFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeConstructorParameterPropertyFix.kt index d7a0e6d2068..66581fad4cb 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeConstructorParameterPropertyFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeConstructorParameterPropertyFix.kt @@ -75,6 +75,6 @@ class MakeConstructorParameterPropertyFix( fun KtNameReferenceExpression.getPrimaryConstructorParameterWithSameName(): KtParameter? { return nonStaticOuterClasses() - .mapNotNull { it.getPrimaryConstructor()?.valueParameters?.firstOrNull { it.name == getReferencedName() } } + .mapNotNull { it.primaryConstructor?.valueParameters?.firstOrNull { it.name == getReferencedName() } } .firstOrNull() } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeVisibleFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeVisibleFactory.kt index 8a128c0f2b7..bbab3e04af1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeVisibleFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/MakeVisibleFactory.kt @@ -35,7 +35,7 @@ object MakeVisibleFactory : KotlinIntentionActionsFactory() { override fun doCreateActions(diagnostic: Diagnostic): List { val element = diagnostic.psiElement as? KtElement ?: return emptyList() val context = element.analyze(BodyResolveMode.PARTIAL) - val usageModule = context.get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, element.getContainingKtFile())?.module + val usageModule = context.get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, element.containingKtFile)?.module @Suppress("UNCHECKED_CAST") val factory = diagnostic.factory as DiagnosticFactory3<*, DeclarationDescriptor, *, DeclarationDescriptor> diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/SuperClassNotInitialized.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/SuperClassNotInitialized.kt index a4bfc0660f5..4ac002cbb70 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/SuperClassNotInitialized.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/SuperClassNotInitialized.kt @@ -152,7 +152,7 @@ object SuperClassNotInitialized : KotlinIntentionActionsFactory() { if (superParameters.any { it.type.isError }) return null val argumentText = StringBuilder() - val oldParameters = classDeclaration.getPrimaryConstructorParameters() + val oldParameters = classDeclaration.primaryConstructorParameters val parametersToAdd = ArrayList() for (parameter in superParameters) { val nameRendered = parameter.name.render() diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt index 1767cd76d4c..9aa9da1f579 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableBuilder.kt @@ -121,7 +121,7 @@ fun List.getTypeByRenderedType(renderedType: String): KotlinType? class CallableBuilderConfiguration( val callableInfos: List, val originalElement: KtElement, - val currentFile: KtFile = originalElement.getContainingKtFile(), + val currentFile: KtFile = originalElement.containingKtFile, val currentEditor: Editor? = null, val isExtension: Boolean = false, val enableSubstitutions: Boolean = true @@ -256,7 +256,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { } if (containingElement is KtElement) { - jetFileToEdit = containingElement.getContainingKtFile() + jetFileToEdit = containingElement.containingKtFile if (jetFileToEdit != config.currentFile) { containingFileEditor = FileEditorManager.getInstance(project).selectedTextEditor!! } @@ -482,7 +482,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { when (kind) { ClassKind.ENUM_ENTRY -> { if (!(targetParent is KtClass && targetParent.isEnum())) throw AssertionError("Enum class expected: ${targetParent.text}") - val hasParameters = targetParent.getPrimaryConstructorParameters().isNotEmpty() + val hasParameters = targetParent.primaryConstructorParameters.isNotEmpty() psiFactory.createEnumEntry("$safeName${if (hasParameters) "()" else " "}") } else -> { @@ -524,7 +524,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { if (declarationInPlace is KtSecondaryConstructor) { val containingClass = declarationInPlace.containingClassOrObject!! - if (containingClass.getPrimaryConstructorParameters().isNotEmpty()) { + if (containingClass.primaryConstructorParameters.isNotEmpty()) { declarationInPlace.replaceImplicitDelegationCallWithExplicit(true) } else if ((receiverClassDescriptor as ClassDescriptor).getSuperClassOrAny().constructors.all { it.valueParameters.isNotEmpty() }) { @@ -647,7 +647,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) { expression = TypeExpression.ForTypeReference(candidates) } is KtClassOrObject -> { - elementToReplace = declaration.getSuperTypeListEntries().firstOrNull() + elementToReplace = declaration.superTypeListEntries.firstOrNull() expression = TypeExpression.ForDelegationSpecifier(candidates) } else -> throw AssertionError("Unexpected declaration kind: ${declaration.text}") @@ -1066,7 +1066,7 @@ internal fun placeDeclarationInContainer( internal fun KtNamedDeclaration.getReturnTypeReference(): KtTypeReference? { return when (this) { is KtCallableDeclaration -> typeReference - is KtClassOrObject -> getSuperTypeListEntries().firstOrNull()?.typeReference + is KtClassOrObject -> superTypeListEntries.firstOrNull()?.typeReference else -> throw AssertionError("Unexpected declaration kind: $text") } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableInfo.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableInfo.kt index 74092bc16a3..2a161f0e624 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableInfo.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/callableBuilder/CallableInfo.kt @@ -107,7 +107,7 @@ abstract class TypeInfo(val variance: Variance) { return when (containingElement) { is KtClassOrObject -> (containingElement.resolveToDescriptor() as? ClassDescriptorWithResolutionScopes)?.scopeForMemberDeclarationResolution is KtBlockExpression -> (containingElement.statements.firstOrNull() ?: containingElement).getResolutionScope() - is KtElement -> containingElement.getContainingKtFile().getResolutionScope() + is KtElement -> containingElement.containingKtFile.getResolutionScope() else -> null } } diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromReferenceExpressionActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromReferenceExpressionActionFactory.kt index 091cc8758d7..45b3ad5f3fd 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromReferenceExpressionActionFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createClass/CreateClassFromReferenceExpressionActionFactory.kt @@ -70,7 +70,7 @@ object CreateClassFromReferenceExpressionActionFactory : CreateClassFromUsageFac val qualifierDescriptor = receiverSelector?.let { context[BindingContext.REFERENCE_TARGET, it] } val targetParent = - getTargetParentByQualifier(element.getContainingKtFile(), receiverSelector != null, qualifierDescriptor) + getTargetParentByQualifier(element.containingKtFile, receiverSelector != null, qualifierDescriptor) ?: return Collections.emptyList() element.getCreatePackageFixIfApplicable(targetParent)?.let { return emptyList() } @@ -120,7 +120,7 @@ object CreateClassFromReferenceExpressionActionFactory : CreateClassFromUsageFac val qualifierDescriptor = receiverSelector?.let { context[BindingContext.REFERENCE_TARGET, it] } val targetParent = - getTargetParentByQualifier(element.getContainingKtFile(), receiverSelector != null, qualifierDescriptor) + getTargetParentByQualifier(element.containingKtFile, receiverSelector != null, qualifierDescriptor) ?: return null return ClassInfo( diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/migration/MigrateExternalExtensionFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/migration/MigrateExternalExtensionFix.kt index 89782b4752f..845d1490959 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/migration/MigrateExternalExtensionFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/migration/MigrateExternalExtensionFix.kt @@ -40,7 +40,7 @@ class MigrateExternalExtensionFix(declaration: KtNamedDeclaration) : KotlinQuickFixAction(declaration), CleanupFix { override fun getText() = "Fix with 'asDynamic'" - override fun getFamilyName() = getText() + override fun getFamilyName() = text override fun invoke(project: Project, editor: Editor?, file: KtFile) { val declaration = element ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureData.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureData.kt index d176a642d4d..fad4f9432dc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureData.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureData.kt @@ -50,7 +50,7 @@ class KotlinChangeSignatureData( val valueParameters = when (baseDeclaration) { is KtFunction -> baseDeclaration.valueParameters - is KtClass -> baseDeclaration.getPrimaryConstructorParameters() + is KtClass -> baseDeclaration.primaryConstructorParameters else -> null } parameters = baseDescriptor.valueParameters diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt index 59547030eb9..f886ee639be 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/KotlinChangeSignatureUsageProcessor.kt @@ -306,7 +306,7 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor { if (functionPsi is KtClass && functionPsi.isEnum()) { for (declaration in functionPsi.declarations) { - if (declaration is KtEnumEntry && declaration.getSuperTypeListEntries().isEmpty()) { + if (declaration is KtEnumEntry && declaration.superTypeListEntries.isEmpty()) { result.add(KotlinEnumEntryWithoutSuperCallUsage(declaration)) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/changeSignatureUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/changeSignatureUtils.kt index b66174716ad..4455feb9bc3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/changeSignatureUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/changeSignatureUtils.kt @@ -55,7 +55,7 @@ fun KtNamedDeclaration.getDeclarationBody(): KtElement? { } fun PsiElement.isCaller(allUsages: Array): Boolean { - val primaryConstructor = (this as? KtClass)?.getPrimaryConstructor() + val primaryConstructor = (this as? KtClass)?.primaryConstructor val elementsToSearch = if (primaryConstructor != null) listOf(primaryConstructor, this) else listOf(this) return allUsages .asSequence() diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureDialog.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureDialog.kt index 9594d5c93fe..f37b12baf7a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureDialog.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/ui/KotlinChangeSignatureDialog.kt @@ -163,7 +163,7 @@ class KotlinChangeSignatureDialog( override fun getTableEditor(table: JTable, item: ParameterTableModelItemBase): JBTableRowEditor? { return object : JBTableRowEditor() { private val components = ArrayList() - private val nameEditor = EditorTextField(item.parameter.name, getProject(), getFileType()) + private val nameEditor = EditorTextField(item.parameter.name, project, fileType) private fun updateNameEditor() { nameEditor.isEnabled = item.parameter != parametersTableModel.receiver @@ -183,8 +183,8 @@ class KotlinChangeSignatureDialog( val columnFinal = column if (KotlinCallableParameterTableModel.isTypeColumn(columnInfo)) { - val document = PsiDocumentManager.getInstance(getProject()).getDocument(item.typeCodeFragment) - editor = EditorTextField(document, getProject(), getFileType()) + val document = PsiDocumentManager.getInstance(project).getDocument(item.typeCodeFragment) + editor = EditorTextField(document, project, fileType) component = editor } else if (KotlinCallableParameterTableModel.isNameColumn(columnInfo)) { @@ -193,8 +193,8 @@ class KotlinChangeSignatureDialog( updateNameEditor() } else if (KotlinCallableParameterTableModel.isDefaultValueColumn(columnInfo) && isDefaultColumnEnabled()) { - val document = PsiDocumentManager.getInstance(getProject()).getDocument(item.defaultValueCodeFragment) - editor = EditorTextField(document, getProject(), getFileType()) + val document = PsiDocumentManager.getInstance(project).getDocument(item.defaultValueCodeFragment) + editor = EditorTextField(document, project, fileType) component = editor } else if (KotlinPrimaryConstructorParameterTableModel.isValVarColumn(columnInfo)) { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/KotlinCallableDefinitionUsage.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/KotlinCallableDefinitionUsage.kt index 392eb207f79..14078809c6e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/KotlinCallableDefinitionUsage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/changeSignature/usages/KotlinCallableDefinitionUsage.kt @@ -159,7 +159,7 @@ class KotlinCallableDefinitionUsage( } if (changeInfo.isReturnTypeChanged && returnTypeIsNeeded) { - element.setTypeReference(null) + element.typeReference = null val returnTypeText = changeInfo.renderReturnType(this) val returnType = changeInfo.newReturnTypeInfo.type if (returnType == null || !returnType.isUnit()) { @@ -258,7 +258,7 @@ class KotlinCallableDefinitionUsage( if (parameterInfo.isTypeChanged && parameter.typeReference != null) { val renderedType = parameterInfo.renderType(parameterIndex, this) - parameter.setTypeReference(psiFactory.createType(renderedType)) + parameter.typeReference = psiFactory.createType(renderedType) } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineTypeAliasHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineTypeAliasHandler.kt index cd74271c71b..fa0a608292d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineTypeAliasHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineTypeAliasHandler.kt @@ -65,7 +65,7 @@ class KotlinInlineTypeAliasHandler : InlineActionHandler() { val typeAlias = element as? KtTypeAlias ?: return val name = typeAlias.name ?: return val aliasBody = typeAlias.getTypeReference() ?: return - val file = typeAlias.getContainingKtFile() + val file = typeAlias.containingKtFile val typeAliasDescriptor = typeAlias.resolveToDescriptor() as TypeAliasDescriptor val typeToInline = typeAliasDescriptor.expandedType diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineValHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineValHandler.kt index 48691e74345..68b343ac0d4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineValHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/KotlinInlineValHandler.kt @@ -104,7 +104,7 @@ class KotlinInlineValHandler : InlineActionHandler() { override fun inlineElement(project: Project, editor: Editor?, element: PsiElement) { val declaration = element as KtProperty - val file = declaration.getContainingKtFile() + val file = declaration.containingKtFile val name = declaration.name ?: return val references = ReferencesSearch.search(declaration) @@ -259,7 +259,7 @@ class KotlinInlineValHandler : InlineActionHandler() { } private fun addFunctionLiteralParameterTypes(parameters: String, inlinedExpressions: List) { - val containingFile = inlinedExpressions.first().getContainingKtFile() + val containingFile = inlinedExpressions.first().containingKtFile val resolutionFacade = containingFile.getResolutionFacade() val functionsToAddParameters = inlinedExpressions.mapNotNull { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/inlineUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/inlineUtils.kt index f1548a6f9af..f9b754b1308 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/inlineUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/inline/inlineUtils.kt @@ -77,8 +77,8 @@ internal var KtSimpleNameExpression.internalUsageInfos: MutableMap) { - val mainFile = element.getContainingKtFile() - val targetPackages = usages.mapNotNullTo(LinkedHashSet()) { it.getContainingKtFile().packageFqName } + val mainFile = element.containingKtFile + val targetPackages = usages.mapNotNullTo(LinkedHashSet()) { it.containingKtFile.packageFqName } for (targetPackage in targetPackages) { if (targetPackage == mainFile.packageFqName) continue val packageNameInfo = ContainerChangeInfo(ContainerInfo.Package(mainFile.packageFqName), ContainerInfo.Package(targetPackage)) @@ -93,7 +93,7 @@ internal fun preProcessInternalUsages(element: KtElement, usages: List postProcessInternalReferences(inlinedElement: E): E? { val pointer = inlinedElement.createSmartPointer() - val targetPackage = inlinedElement.getContainingKtFile().packageFqName + val targetPackage = inlinedElement.containingKtFile.packageFqName val expressionsToProcess = inlinedElement.collectDescendantsOfType { it.internalUsageInfos != null } val internalUsages = expressionsToProcess.mapNotNull { it.internalUsageInfos!![targetPackage]?.invoke(it) } expressionsToProcess.forEach { it.internalUsageInfos = null } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractClass/ExtractSuperRefactoring.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractClass/ExtractSuperRefactoring.kt index 62bfbdbf8d3..7c7ace45548 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractClass/ExtractSuperRefactoring.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractClass/ExtractSuperRefactoring.kt @@ -103,7 +103,7 @@ class ExtractSuperRefactoring( val superTypeList = originalClass.getSuperTypeList() if (superTypeList != null) { - for (superTypeListEntry in originalClass.getSuperTypeListEntries()) { + for (superTypeListEntry in originalClass.superTypeListEntries) { val superType = superTypeListEntry.analyze(BodyResolveMode.PARTIAL)[BindingContext.TYPE, superTypeListEntry.typeReference] ?: continue val superClassDescriptor = superType.constructor.declarationDescriptor ?: continue @@ -261,7 +261,7 @@ class ExtractSuperRefactoring( val needSuperCall = !extractInfo.isInterface && (superClassEntry is KtSuperTypeCallEntry || originalClass.hasPrimaryConstructor() - || originalClass.getSecondaryConstructors().isEmpty()) + || originalClass.secondaryConstructors.isEmpty()) val newSuperTypeListEntry = if (needSuperCall) { psiFactory.createSuperTypeCallEntry("$superTypeText()") } @@ -297,7 +297,7 @@ class ExtractSuperRefactoring( val superClassEntry = if (!extractInfo.isInterface) { val originalClassDescriptor = originalClass.resolveToDescriptor() as ClassDescriptor val superClassDescriptor = originalClassDescriptor.getSuperClassNotAny() - originalClass.getSuperTypeListEntries().firstOrNull { + originalClass.superTypeListEntries.firstOrNull { bindingContext[BindingContext.TYPE, it.typeReference]?.constructor?.declarationDescriptor == superClassDescriptor } } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt index 36bebd76d32..e2a7d9f695e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/extractionEngine/extractorUtil.kt @@ -372,7 +372,7 @@ private fun makeCall( is Initializer -> { val newProperty = copiedDeclarations[outputValue.initializedDeclaration] as KtProperty - newProperty.setInitializer(psiFactory.createExpression(callText)) + newProperty.initializer = psiFactory.createExpression(callText) Collections.emptyList() } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinInplaceParameterIntroducer.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinInplaceParameterIntroducer.kt index 6a6d8801c7e..1b45220b522 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinInplaceParameterIntroducer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinInplaceParameterIntroducer.kt @@ -175,7 +175,7 @@ class KotlinInplaceParameterIntroducer( init { initFormComponents { - addComponent(getPreviewComponent()) + addComponent(previewComponent) val defaultValueCheckBox = NonFocusableCheckBox("Introduce default value") defaultValueCheckBox.isSelected = descriptor.withDefaultValue diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterHandler.kt index f69f798e71c..4babcdec432 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceParameter/KotlinIntroduceParameterHandler.kt @@ -507,7 +507,7 @@ open class KotlinIntroduceLambdaParameterHandler( is KtClass -> targetParent.getBody() else -> null } ?: throw AssertionError("Body element is not found: ${targetParent.getElementTextWithContext()}") - val extractionData = ExtractionData(targetParent.getContainingKtFile(), + val extractionData = ExtractionData(targetParent.containingKtFile, expression.toRange(), targetParent, duplicateContainer, diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt index da09474fdd1..0831f23b370 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinIntroduceVariableHandler.kt @@ -648,7 +648,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler { val physicalExpression = substringContextOrThis val contentRange = extractableSubstringInfo?.contentRange - val file = physicalExpression.getContainingKtFile() + val file = physicalExpression.containingKtFile val references = physicalExpression .collectDescendantsOfType { contentRange == null || contentRange.contains(it.textRange) } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinVariableInplaceIntroducer.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinVariableInplaceIntroducer.kt index ff2ce9c9720..7764b00e207 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinVariableInplaceIntroducer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/introduceVariable/KotlinVariableInplaceIntroducer.kt @@ -94,10 +94,10 @@ class KotlinVariableInplaceIntroducer( updateVariableName() if (isSelected) { val renderedType = IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_IN_TYPES.renderType(expressionType) - addedVariable.setTypeReference(KtPsiFactory(myProject).createType(renderedType)) + addedVariable.typeReference = KtPsiFactory(myProject).createType(renderedType) } else { - addedVariable.setTypeReference(null) + addedVariable.typeReference = null } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinClassMembersRefactoringSupport.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinClassMembersRefactoringSupport.kt index c9569af1368..cb39b4dff8b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinClassMembersRefactoringSupport.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinClassMembersRefactoringSupport.kt @@ -49,7 +49,7 @@ class KotlinClassMembersRefactoringSupport : ClassMembersRefactoringSupport { private val pullUpData = superClass?.let { KotlinPullUpData(clazz as KtClassOrObject, it as PsiNamedElement, emptyList()) } private val possibleContainingClasses = - listOf(clazz) + ((clazz as? KtClass)?.getCompanionObjects() ?: emptyList()) + listOf(clazz) + ((clazz as? KtClass)?.companionObjects ?: emptyList()) override fun visitSimpleNameExpression(expression: KtSimpleNameExpression) { val referencedMember = expression.mainReference.resolve() as? KtNamedDeclaration ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberInfoStorage.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberInfoStorage.kt index 221a55603aa..66e16a5ee63 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberInfoStorage.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberInfoStorage.kt @@ -105,7 +105,7 @@ fun extractClassMembers( val result = ArrayList() if (collectSuperTypeEntries) { - aClass.getSuperTypeListEntries() + aClass.superTypeListEntries .filterIsInstance() .mapNotNull { val typeReference = it.typeReference ?: return@mapNotNull null @@ -122,13 +122,13 @@ fun extractClassMembers( .mapTo(result) { KotlinMemberInfo(it, true) } } - aClass.getPrimaryConstructor() + aClass.primaryConstructor ?.valueParameters ?.filter { it.hasValOrVar() } ?.mapTo(result) { KotlinMemberInfo(it) } aClass.extractFromClassBody(filter, false, result) - (aClass as? KtClass)?.getCompanionObjects()?.firstOrNull()?.extractFromClassBody(filter, true, result) + (aClass as? KtClass)?.companionObjects?.firstOrNull()?.extractFromClassBody(filter, true, result) return result } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberSelectionTable.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberSelectionTable.kt index 89685af836e..88fedaf83e4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberSelectionTable.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/memberInfo/KotlinMemberSelectionTable.kt @@ -49,7 +49,7 @@ class KotlinMemberSelectionTable( override fun isAbstractColumnEditable(rowIndex: Int): Boolean { val memberInfo = myMemberInfos[rowIndex] - if (memberInfo.isStatic()) return false + if (memberInfo.isStatic) return false val member = memberInfo.member if (member !is KtNamedFunction && member !is KtProperty && member !is KtParameter) return false @@ -71,7 +71,7 @@ class KotlinMemberSelectionTable( val member = memberInfo.member if (member !is KtNamedFunction && member !is KtProperty && member !is KtParameter) return defaultIcon - return when (memberInfo.getOverrides()) { + return when (memberInfo.overrides) { true -> AllIcons.General.OverridingMethod false -> AllIcons.General.ImplementingMethod else -> defaultIcon diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageIntention.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageIntention.kt index aeb12c2907f..40ede6c10da 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/changePackage/ChangePackageIntention.kt @@ -46,7 +46,7 @@ class ChangePackageIntention: SelfTargetingOffsetIndependentIntention element.getClassOrInterfaceKeyword() @@ -64,7 +64,7 @@ class MoveDeclarationToSeparateFileIntention : override fun applyTo(element: KtClassOrObject, editor: Editor?) { if (editor == null) throw IllegalArgumentException("This intention requires an editor") - val file = element.getContainingKtFile() + val file = element.containingKtFile val project = file.project val originalOffset = editor.caretModel.offset - element.startOffset val directory = file.containingDirectory ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveDeclarationsDelegate.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveDeclarationsDelegate.kt index ed76ea3251c..81575769fea 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveDeclarationsDelegate.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveDeclarationsDelegate.kt @@ -45,7 +45,7 @@ sealed class MoveDeclarationsDelegate { object TopLevel : MoveDeclarationsDelegate() { override fun getContainerChangeInfo(originalDeclaration: KtNamedDeclaration, moveTarget: KotlinMoveTarget): ContainerChangeInfo { - return ContainerChangeInfo(ContainerInfo.Package(originalDeclaration.getContainingKtFile().packageFqName), + return ContainerChangeInfo(ContainerInfo.Package(originalDeclaration.containingKtFile.packageFqName), ContainerInfo.Package(moveTarget.targetContainerFqName!!)) } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt index e241bc5af7f..0d912e5cf93 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsHandler.kt @@ -54,7 +54,7 @@ class MoveKotlinDeclarationsHandler : MoveHandlerDelegate() { return elements.mapNotNullTo(LinkedHashSet(), getContainer).singleOrNull() } - private fun KtNamedDeclaration.canMove() = if (this is KtClassOrObject) !isLocal() else parent is KtFile + private fun KtNamedDeclaration.canMove() = if (this is KtClassOrObject) !isLocal else parent is KtFile private fun doMoveWithCheck( project: Project, elements: Array, targetContainer: PsiElement?, callback: MoveCallback?, editor: Editor? diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt index 1bf076a017c..564b62bdb9d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/MoveKotlinDeclarationsProcessor.kt @@ -112,7 +112,7 @@ class MoveKotlinDeclarationsProcessor( private var nonCodeUsages: Array? = null private val elementsToMove = descriptor.elementsToMove.filter { e -> e.parent != descriptor.moveTarget.getTargetPsiIfExists(e) } private val kotlinToLightElementsBySourceFile = elementsToMove - .groupBy { it.getContainingKtFile() } + .groupBy { it.containingKtFile } .mapValues { it.value.keysToMap { it.toLightElements() } } private val conflicts = MultiMap() @@ -251,7 +251,7 @@ class MoveKotlinDeclarationsProcessor( continue } - oldToNewElementsMapping[sourceFile] = newDeclaration.getContainingKtFile() + oldToNewElementsMapping[sourceFile] = newDeclaration.containingKtFile transaction!!.getElementListener(oldDeclaration).elementMoved(newDeclaration) for ((oldElement, newElement) in oldLightElements.asSequence().zip(newDeclaration.toLightElements().asSequence())) { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelper.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelper.kt index d30c4a18930..88ab55779d6 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelper.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelper.kt @@ -175,7 +175,7 @@ class KotlinPullUpHelper( } } commonInitializer?.accept(visitor) - if (targetConstructor == (data.targetClass as? KtClass)?.getPrimaryConstructor() ?: data.targetClass) { + if (targetConstructor == (data.targetClass as? KtClass)?.primaryConstructor ?: data.targetClass) { property.initializer?.accept(visitor) } @@ -193,7 +193,7 @@ class KotlinPullUpHelper( private val targetToSourceConstructors = LinkedHashMap>().let { result -> if (!data.isInterfaceTarget && data.targetClass is KtClass) { - result[data.targetClass.getPrimaryConstructor() ?: data.targetClass] = ArrayList() + result[data.targetClass.primaryConstructor ?: data.targetClass] = ArrayList() data.sourceClass.accept( object : KtTreeVisitorVoid() { private fun processConstructorReference(expression: KtReferenceExpression, callingConstructorElement: KtElement) { @@ -208,7 +208,7 @@ class KotlinPullUpHelper( override fun visitSuperTypeCallEntry(specifier: KtSuperTypeCallEntry) { val constructorRef = specifier.calleeExpression.constructorReferenceExpression ?: return val containingClass = specifier.getStrictParentOfType() ?: return - val callingConstructorElement = containingClass.getPrimaryConstructor() ?: containingClass + val callingConstructorElement = containingClass.primaryConstructor ?: containingClass processConstructorReference(constructorRef, callingConstructorElement) } @@ -570,7 +570,7 @@ class KotlinPullUpHelper( } fun KtClassOrObject.getDelegatorToSuperCall(): KtSuperTypeCallEntry? { - return getSuperTypeListEntries().singleOrNull { it is KtSuperTypeCallEntry } as? KtSuperTypeCallEntry + return superTypeListEntries.singleOrNull { it is KtSuperTypeCallEntry } as? KtSuperTypeCallEntry } fun addUsedParameters(constructorElement: KtElement, info: InitializerInfo) { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelperFactory.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelperFactory.kt index fe8c327cf92..db3eab542ec 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelperFactory.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/KotlinPullUpHelperFactory.kt @@ -69,7 +69,7 @@ class JavaToKotlinPullUpHelperFactory : PullUpHelperFactory { val targetClass = data.targetClass.unwrapped as? KtClass ?: return null val project = targetClass.project - val targetPackage = targetClass.getContainingKtFile().packageFqName.asString() + val targetPackage = targetClass.containingKtFile.packageFqName.asString() val dummyFile = PsiFileFactory.getInstance(project).createFileFromText( "dummy.java", JavaFileType.INSTANCE, diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpConflictsUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpConflictsUtils.kt index e96bfcefee7..80b3b364466 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpConflictsUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpConflictsUtils.kt @@ -114,7 +114,7 @@ private fun KotlinPullUpData.checkClashWithSuperDeclaration( val message = "${targetClassDescriptor.renderForConflicts()} already contains ${memberDescriptor.renderForConflicts()}" if (member is KtParameter) { - if (((targetClass as? KtClass)?.getPrimaryConstructorParameters() ?: emptyList()).any { it.name == member.name }) { + if (((targetClass as? KtClass)?.primaryConstructorParameters ?: emptyList()).any { it.name == member.name }) { conflicts.putValue(member, message.capitalize()) } return diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpUtils.kt index d55656c4a25..151b06d82f0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/pullUp/pullUpUtils.kt @@ -113,7 +113,7 @@ fun KtClassOrObject.getSuperTypeEntryByDescriptor( descriptor: ClassDescriptor, context: BindingContext ): KtSuperTypeListEntry? { - return getSuperTypeListEntries().firstOrNull { + return superTypeListEntries.firstOrNull { val referencedType = context[BindingContext.TYPE, it.typeReference] referencedType?.constructor?.declarationDescriptor == descriptor } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassProcessor.kt index 9bd5479ed00..682f2b28781 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinClassProcessor.kt @@ -66,7 +66,7 @@ class RenameKotlinClassProcessor : RenameKotlinPsiProcessor() { val classOrObject = getClassOrObject(element) as? KtClassOrObject ?: return - val file = classOrObject.getContainingKtFile() + val file = classOrObject.containingKtFile val virtualFile = file.virtualFile if (virtualFile != null) { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/renameConflictUtils.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/renameConflictUtils.kt index 6764139d03b..80992ac93ff 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/renameConflictUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/renameConflictUtils.kt @@ -74,7 +74,7 @@ internal fun PsiElement.representativeContainer(): PsiNamedElement? = when (this) { is KtDeclaration -> containingClassOrObject ?: getStrictParentOfType() - ?: JavaPsiFacade.getInstance(project).findPackage(getContainingKtFile().packageFqName.asString()) + ?: JavaPsiFacade.getInstance(project).findPackage(containingKtFile.packageFqName.asString()) is PsiMember -> containingClass else -> null } diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/ui/KotlinFileChooserDialog.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/ui/KotlinFileChooserDialog.kt index 97d4ef15ae4..5d7d71413f1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/ui/KotlinFileChooserDialog.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/ui/KotlinFileChooserDialog.kt @@ -47,7 +47,7 @@ class KotlinFileChooserDialog( return when (userObject) { is KtFileTreeNode -> userObject.ktFile is KtClassOrObjectTreeNode -> { - val containingFile = userObject.value.getContainingKtFile() + val containingFile = userObject.value.containingKtFile if (containingFile.declarations.size == 1) containingFile else null } else -> null diff --git a/idea/src/org/jetbrains/kotlin/idea/run/KotlinRunConfigurationProducer.kt b/idea/src/org/jetbrains/kotlin/idea/run/KotlinRunConfigurationProducer.kt index bafb0007e6f..6e4d5dea667 100644 --- a/idea/src/org/jetbrains/kotlin/idea/run/KotlinRunConfigurationProducer.kt +++ b/idea/src/org/jetbrains/kotlin/idea/run/KotlinRunConfigurationProducer.kt @@ -84,7 +84,7 @@ class KotlinRunConfigurationProducer : RunConfigurationProducer(false) ?: return null val script = file.script ?: return null - return script.getContainingKtFile().virtualFile.canonicalPath + return script.containingKtFile.virtualFile.canonicalPath } } } diff --git a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt index c25a210106a..bb51dc4847b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt @@ -57,7 +57,7 @@ class KotlinCreateTestIntention : SelfTargetingRangeIntention element.toLightClass() - else -> element.getContainingKtFile().findFacadeClass() + else -> element.containingKtFile.findFacadeClass() } ?: return object : CreateTestAction() { diff --git a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinTestFinder.kt b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinTestFinder.kt index c1b04de3f07..f738020bf21 100644 --- a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinTestFinder.kt +++ b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinTestFinder.kt @@ -44,7 +44,7 @@ class KotlinTestFinder : JavaTestFinder() { override fun findSourceElement(from: PsiElement): PsiClass? { super.findSourceElement(from)?.let { return it } - from.parentsWithSelf.filterIsInstance().firstOrNull { !it.isLocal() }?.let { + from.parentsWithSelf.filterIsInstance().firstOrNull { !it.isLocal }?.let { return if (it.resolveToDescriptorIfAny() == null) null else it.toLightClass() } diff --git a/js/js.parser/src/org/jetbrains/kotlin/js/parser/parserUtils.kt b/js/js.parser/src/org/jetbrains/kotlin/js/parser/parserUtils.kt index 6ceaa3f4d5e..aa28ee802ab 100644 --- a/js/js.parser/src/org/jetbrains/kotlin/js/parser/parserUtils.kt +++ b/js/js.parser/src/org/jetbrains/kotlin/js/parser/parserUtils.kt @@ -68,7 +68,7 @@ private fun parse( insideFunction: Boolean, parseAction: Parser.(TokenStream)->Any ): Node { - Context.enter().setErrorReporter(reporter) + Context.enter().errorReporter = reporter try { val ts = TokenStream(StringReader(code, offset), "", FAKE_SOURCE_INFO.line) diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt index e05169ca628..4ff85dfacfe 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/declarations/KotlinUClass.kt @@ -64,7 +64,7 @@ class KotlinUClass private constructor( override fun getInitializers(): Array = super.getInitializers() override fun getMethods(): Array { - val primaryConstructor = ktClass?.getPrimaryConstructor()?.toLightMethods()?.firstOrNull() + val primaryConstructor = ktClass?.primaryConstructor?.toLightMethods()?.firstOrNull() val initBlocks = ktClass?.getAnonymousInitializers() ?: emptyList() fun createUMethod(psiMethod: PsiMethod): UMethod { diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUFunctionCallExpression.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUFunctionCallExpression.kt index 323c58b4132..f9190e5a682 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUFunctionCallExpression.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUFunctionCallExpression.kt @@ -40,8 +40,8 @@ class KotlinUFunctionCallExpression( companion object { fun resolveSource(descriptor: DeclarationDescriptor, source: PsiElement?): PsiMethod? { if (descriptor is ConstructorDescriptor && descriptor.isPrimary - && source is KtClassOrObject && source.getPrimaryConstructor() == null - && source.getSecondaryConstructors().isEmpty()) { + && source is KtClassOrObject && source.primaryConstructor == null + && source.secondaryConstructors.isEmpty()) { return source.toLightClass()?.constructors?.firstOrNull() } diff --git a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt index b1b16c93dcc..3abad52b38e 100644 --- a/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt +++ b/plugins/uast-kotlin/src/org/jetbrains/uast/kotlin/expressions/KotlinUObjectLiteralExpression.kt @@ -32,7 +32,7 @@ class KotlinUObjectLiteralExpression( override fun getExpressionType() = psi.objectDeclaration.toPsiType() private val superClassConstructorCall by lz { - psi.objectDeclaration.getSuperTypeListEntries().firstOrNull { it is KtSuperTypeCallEntry } as? KtSuperTypeCallEntry + psi.objectDeclaration.superTypeListEntries.firstOrNull { it is KtSuperTypeCallEntry } as? KtSuperTypeCallEntry } override val classReference: UReferenceExpression? by lz { superClassConstructorCall?.let { ObjectLiteralClassReference(it, this) } }