Partial code cleanup: can be private and some others applied
This commit is contained in:
@@ -106,7 +106,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
|
||||
return getMethodSequenceByName(name, scope).toList().toTypedArray()
|
||||
}
|
||||
|
||||
fun getMethodSequenceByName(name: String, scope: GlobalSearchScope): Sequence<PsiMethod> {
|
||||
private fun getMethodSequenceByName(name: String, scope: GlobalSearchScope): Sequence<PsiMethod> {
|
||||
val propertiesIndex = KotlinPropertyShortNameIndex.getInstance()
|
||||
val functionIndex = KotlinFunctionShortNameIndex.getInstance()
|
||||
|
||||
@@ -160,7 +160,7 @@ class KotlinShortNamesCache(private val project: Project) : PsiShortNamesCache()
|
||||
set.addAll(allMethodNames)
|
||||
}
|
||||
|
||||
fun getFieldSequenceByName(name: String, scope: GlobalSearchScope): Sequence<PsiField> {
|
||||
private fun getFieldSequenceByName(name: String, scope: GlobalSearchScope): Sequence<PsiField> {
|
||||
return KotlinPropertyShortNameIndex.getInstance().get(name, project, scope).asSequence()
|
||||
.map { LightClassUtil.getLightClassBackingField(it) }
|
||||
.filterNotNull()
|
||||
|
||||
+1
-1
@@ -276,7 +276,7 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
|
||||
return getClassRelativeName(parent).child(name)
|
||||
}
|
||||
|
||||
fun createLightClassForDecompiledKotlinFile(file: KtClsFile): KtLightClassForDecompiledDeclaration? {
|
||||
private fun createLightClassForDecompiledKotlinFile(file: KtClsFile): KtLightClassForDecompiledDeclaration? {
|
||||
val virtualFile = file.virtualFile ?: return null
|
||||
|
||||
val classOrObject = file.declarations.filterIsInstance<KtClassOrObject>().singleOrNull()
|
||||
|
||||
+5
-2
@@ -37,8 +37,11 @@ class ScriptModuleSearchScope(val scriptFile: VirtualFile, baseScope: GlobalSear
|
||||
override fun hashCode() = scriptFile.hashCode() * 73 * super.hashCode()
|
||||
}
|
||||
|
||||
data class ScriptModuleInfo(val project: Project, val scriptFile: VirtualFile,
|
||||
val scriptDefinition: KotlinScriptDefinition) : IdeaModuleInfo {
|
||||
data class ScriptModuleInfo(
|
||||
val project: Project,
|
||||
val scriptFile: VirtualFile,
|
||||
val scriptDefinition: KotlinScriptDefinition
|
||||
) : IdeaModuleInfo {
|
||||
override val moduleOrigin: ModuleOrigin
|
||||
get() = ModuleOrigin.OTHER
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ open class KotlinClsStubBuilder : ClsStubBuilder() {
|
||||
return doBuildFileStub(file, content.content)
|
||||
}
|
||||
|
||||
fun doBuildFileStub(file: VirtualFile, fileContent: ByteArray): PsiFileStub<KtFile>? {
|
||||
private fun doBuildFileStub(file: VirtualFile, fileContent: ByteArray): PsiFileStub<KtFile>? {
|
||||
val kotlinClass = IDEKotlinBinaryClassCache.getKotlinBinaryClass(file, fileContent) ?: error("Can't find binary class for Kotlin file: $file")
|
||||
val header = kotlinClass.classHeader
|
||||
val classId = kotlinClass.classId
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ import kotlin.reflect.KClass
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Please do not use for new inspections. Use AbstractKotlinInspection as base class for them")
|
||||
abstract class IntentionBasedInspection<TElement : PsiElement>(
|
||||
val intentionInfos: List<IntentionBasedInspection.IntentionData<TElement>>,
|
||||
private val intentionInfos: List<IntentionBasedInspection.IntentionData<TElement>>,
|
||||
protected open val problemText: String?
|
||||
) : AbstractKotlinInspection() {
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ sealed class SyntheticPropertyAccessorReference(expression: KtNameReferenceExpre
|
||||
|
||||
override fun canRename() = true
|
||||
|
||||
fun renameByPropertyName(newName: String): PsiElement? {
|
||||
private fun renameByPropertyName(newName: String): PsiElement? {
|
||||
val nameIdentifier = KtPsiFactory(expression).createNameIdentifier(newName)
|
||||
expression.getReferencedNameElement().replace(nameIdentifier)
|
||||
return expression
|
||||
|
||||
@@ -225,7 +225,7 @@ class PsiBasedClassResolver @TestOnly constructor(private val targetClassFqName:
|
||||
Ambiguity(UNSURE)
|
||||
}
|
||||
|
||||
fun Result.changeTo(newResult: Result): Result {
|
||||
private fun Result.changeTo(newResult: Result): Result {
|
||||
if (this == Result.NothingFound || this.returnValue == newResult.returnValue) {
|
||||
return newResult
|
||||
}
|
||||
|
||||
+2
-2
@@ -52,12 +52,12 @@ class IllegalIdentifierInspection : AbstractKotlinInspection() {
|
||||
}
|
||||
}
|
||||
|
||||
fun checkAndroidFacet(element: PsiElement): Boolean {
|
||||
private fun checkAndroidFacet(element: PsiElement): Boolean {
|
||||
return element.getAndroidFacetForFile() != null || ApplicationManager.getApplication().isUnitTestMode
|
||||
}
|
||||
|
||||
// https://source.android.com/devices/tech/dalvik/dex-format.html#string-syntax
|
||||
fun isValidDalvikCharacter(c: Char) = when (c) {
|
||||
private fun isValidDalvikCharacter(c: Char) = when (c) {
|
||||
in 'A'..'Z' -> true
|
||||
in 'a'..'z' -> true
|
||||
in '0'..'9' -> true
|
||||
|
||||
@@ -290,15 +290,13 @@ object KeywordCompletion {
|
||||
return buildFilterWithReducedContext("", null, position)
|
||||
}
|
||||
|
||||
fun computeKeywordApplications(prefixText: String, keyword: KtKeywordToken): Sequence<String> {
|
||||
return when (keyword) {
|
||||
SUSPEND_KEYWORD -> sequenceOf("suspend () -> Unit>", "suspend X")
|
||||
else -> {
|
||||
if (prefixText.endsWith("@"))
|
||||
sequenceOf(keyword.value + ":X Y.Z")
|
||||
else
|
||||
sequenceOf(keyword.value + " X")
|
||||
}
|
||||
private fun computeKeywordApplications(prefixText: String, keyword: KtKeywordToken): Sequence<String> = when (keyword) {
|
||||
SUSPEND_KEYWORD -> sequenceOf("suspend () -> Unit>", "suspend X")
|
||||
else -> {
|
||||
if (prefixText.endsWith("@"))
|
||||
sequenceOf(keyword.value + ":X Y.Z")
|
||||
else
|
||||
sequenceOf(keyword.value + " X")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.util.OperatorNameConventions.SET
|
||||
|
||||
object OperatorNameCompletion {
|
||||
|
||||
val additionalOperatorPresentation = mapOf(
|
||||
private val additionalOperatorPresentation = mapOf(
|
||||
SET to "[...] = ...",
|
||||
GET to "[...]",
|
||||
CONTAINS to "in !in",
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ class ReferenceVariantsCollector(
|
||||
return ReferenceVariants(filterConfiguration.filterVariants(basicVariants).toHashSet(), emptyList())
|
||||
}
|
||||
|
||||
fun doCollectExtensionVariants(filterConfiguration: FilterConfiguration, basicVariants: ReferenceVariants): ReferenceVariants {
|
||||
private fun doCollectExtensionVariants(filterConfiguration: FilterConfiguration, basicVariants: ReferenceVariants): ReferenceVariants {
|
||||
val (_, additionalPropertyNameFilter, shadowedDeclarationsFilter, completeExtensionsFromIndices) = filterConfiguration
|
||||
|
||||
if (completeExtensionsFromIndices) {
|
||||
@@ -184,7 +184,7 @@ class ReferenceVariantsCollector(
|
||||
return ReferenceVariants(emptyList(), emptyList())
|
||||
}
|
||||
|
||||
fun <TDescriptor : DeclarationDescriptor> FilterConfiguration.filterVariants(_variants: Collection<TDescriptor>): Collection<TDescriptor> {
|
||||
private fun <TDescriptor : DeclarationDescriptor> FilterConfiguration.filterVariants(_variants: Collection<TDescriptor>): Collection<TDescriptor> {
|
||||
var variants = _variants
|
||||
|
||||
if (shadowedDeclarationsFilter != null)
|
||||
|
||||
+8
-12
@@ -56,20 +56,16 @@ class ToFromOriginalFileMapper private constructor(
|
||||
shift = syntheticLength - originalLength
|
||||
}
|
||||
|
||||
fun toOriginalFile(offset: Int): Int? {
|
||||
return when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= syntheticLength - tailLength -> offset - shift
|
||||
else -> null
|
||||
}
|
||||
private fun toOriginalFile(offset: Int): Int? = when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= syntheticLength - tailLength -> offset - shift
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun toSyntheticFile(offset: Int): Int? {
|
||||
return when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= originalLength - tailLength -> offset + shift
|
||||
else -> null
|
||||
}
|
||||
private fun toSyntheticFile(offset: Int): Int? = when {
|
||||
offset <= completionOffset -> offset
|
||||
offset >= originalLength - tailLength -> offset + shift
|
||||
else -> null
|
||||
}
|
||||
|
||||
fun <TElement : PsiElement> toOriginalFile(element: TElement): TElement? {
|
||||
|
||||
@@ -45,7 +45,10 @@ import org.jetbrains.kotlin.util.descriptorsEqualWithSubstitution
|
||||
import java.util.*
|
||||
|
||||
class ArtificialElementInsertHandler(
|
||||
val textBeforeCaret: String, val textAfterCaret: String, val shortenRefs: Boolean) : InsertHandler<LookupElement>{
|
||||
private val textBeforeCaret: String,
|
||||
private val textAfterCaret: String,
|
||||
private val shortenRefs: Boolean
|
||||
) : InsertHandler<LookupElement>{
|
||||
override fun handleInsert(context: InsertionContext, item: LookupElement) {
|
||||
val offset = context.editor.caretModel.offset
|
||||
val startOffset = offset - item.lookupString.length
|
||||
|
||||
@@ -73,7 +73,7 @@ class KotlinJsr223JvmScriptEngine4Idea(
|
||||
override fun overrideScriptArgs(context: ScriptContext): ScriptArgsWithTypes? =
|
||||
getScriptArgs(getContext(), scriptArgsTypes)
|
||||
|
||||
val localEvaluator: ReplFullEvaluator by lazy { GenericReplCompilingEvaluator(replCompiler, templateClasspath, Thread.currentThread().contextClassLoader) }
|
||||
private val localEvaluator: ReplFullEvaluator by lazy { GenericReplCompilingEvaluator(replCompiler, templateClasspath, Thread.currentThread().contextClassLoader) }
|
||||
|
||||
override val replEvaluator: ReplFullEvaluator get() = localEvaluator
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ class KotlinQuickDocumentationProvider : AbstractDocumentationProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
fun String.htmlEscape(): String = HtmlEscapers.htmlEscaper().escape(this)
|
||||
private fun String.htmlEscape(): String = HtmlEscapers.htmlEscaper().escape(this)
|
||||
|
||||
private inline fun StringBuilder.wrap(prefix: String, postfix: String, crossinline body: () -> Unit) {
|
||||
this.append(prefix)
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class SearchNotPropertyCandidatesAction : AnAction() {
|
||||
}
|
||||
|
||||
|
||||
fun processAllDescriptors(desc: DeclarationDescriptor, project: Project) {
|
||||
private fun processAllDescriptors(desc: DeclarationDescriptor, project: Project) {
|
||||
val processed = mutableSetOf<DeclarationDescriptor>()
|
||||
var pFunctions = 0
|
||||
val matchedDescriptors = mutableSetOf<FunctionDescriptor>()
|
||||
|
||||
@@ -50,9 +50,9 @@ class PlainTextPasteImportResolver(val dataForConversion: DataForConversion, val
|
||||
private val shortNameCache = PsiShortNamesCache.getInstance(project)
|
||||
private val scope = file.resolveScope
|
||||
|
||||
val failedToResolveReferenceNames = HashSet<String>()
|
||||
var ambiguityInResolution = false
|
||||
var couldNotResolve = false
|
||||
private val failedToResolveReferenceNames = HashSet<String>()
|
||||
private var ambiguityInResolution = false
|
||||
private var couldNotResolve = false
|
||||
|
||||
val addedImports = ArrayList<PsiImportStatementBase>()
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class DebuggerClassNameProvider(
|
||||
}
|
||||
}
|
||||
|
||||
val inlineUsagesSearcher = InlineCallableUsagesSearcher(debugProcess, scopes)
|
||||
private val inlineUsagesSearcher = InlineCallableUsagesSearcher(debugProcess, scopes)
|
||||
|
||||
/**
|
||||
* Returns classes in which the given line number *is* present.
|
||||
|
||||
@@ -37,7 +37,10 @@ import org.jetbrains.kotlin.idea.debugger.DebuggerClassNameProvider.Companion.ge
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches.ComputedClassNames
|
||||
|
||||
class InlineCallableUsagesSearcher(val myDebugProcess: DebugProcess, val scopes: List<GlobalSearchScope>) {
|
||||
class InlineCallableUsagesSearcher(
|
||||
private val myDebugProcess: DebugProcess,
|
||||
val scopes: List<GlobalSearchScope>
|
||||
) {
|
||||
fun findInlinedCalls(
|
||||
declaration: KtDeclaration,
|
||||
bindingContext: BindingContext = KotlinDebuggerCaches.getOrCreateTypeMapper(declaration).bindingContext,
|
||||
|
||||
@@ -230,7 +230,7 @@ class KotlinFieldBreakpoint(
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : EventRequest> findRequest(debugProcess: DebugProcessImpl, requestClass: Class<T>, requestor: Requestor): T? {
|
||||
inline private fun <reified T : EventRequest> findRequest(debugProcess: DebugProcessImpl, requestClass: Class<T>, requestor: Requestor): T? {
|
||||
val requests = debugProcess.requestsManager.findRequests(requestor)
|
||||
for (eventRequest in requests) {
|
||||
if (eventRequest::class.java == requestClass) {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class DelegatedPropertyFieldDescriptor(
|
||||
project: Project,
|
||||
objectRef: ObjectReference,
|
||||
val delegate: Field,
|
||||
val renderDelegatedProperty: Boolean
|
||||
private val renderDelegatedProperty: Boolean
|
||||
) : FieldDescriptorImpl(project, objectRef, delegate) {
|
||||
|
||||
override fun calcValue(evaluationContext: EvaluationContextImpl?): Value? {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ private val LOG = Logger.getInstance(KotlinClassWithDelegatedPropertyRenderer::c
|
||||
private fun notPreparedClassMessage(referenceType: ReferenceType) =
|
||||
"$referenceType ${referenceType.isPrepared} ${referenceType.sourceName()}"
|
||||
|
||||
class KotlinClassWithDelegatedPropertyRenderer(val rendererSettings: NodeRendererSettings) : ClassRenderer() {
|
||||
class KotlinClassWithDelegatedPropertyRenderer(private val rendererSettings: NodeRendererSettings) : ClassRenderer() {
|
||||
override fun isApplicable(jdiType: Type?): Boolean {
|
||||
if (!super.isApplicable(jdiType)) return false
|
||||
|
||||
|
||||
@@ -247,9 +247,9 @@ class KotlinMultilineStringEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
private val kotlinIndentOptions =
|
||||
CodeStyleSettingsManager.getInstance(project).currentSettings.getIndentOptions(KotlinFileType.INSTANCE)
|
||||
|
||||
val useTabs = kotlinIndentOptions.USE_TAB_CHARACTER
|
||||
val tabSize = kotlinIndentOptions.TAB_SIZE
|
||||
val regularIndent = kotlinIndentOptions.INDENT_SIZE
|
||||
private val useTabs = kotlinIndentOptions.USE_TAB_CHARACTER
|
||||
private val tabSize = kotlinIndentOptions.TAB_SIZE
|
||||
private val regularIndent = kotlinIndentOptions.INDENT_SIZE
|
||||
val marginIndent = regularIndent
|
||||
|
||||
fun getSmartSpaces(count: Int): String = when {
|
||||
@@ -301,7 +301,7 @@ class KotlinMultilineStringEnterHandler : EnterHandlerDelegateAdapter() {
|
||||
}
|
||||
|
||||
|
||||
fun getLiteralCalls(str: KtStringTemplateExpression): Sequence<KtCallExpression> {
|
||||
private fun getLiteralCalls(str: KtStringTemplateExpression): Sequence<KtCallExpression> {
|
||||
var previous: PsiElement = str
|
||||
return str.parents
|
||||
.takeWhile { parent ->
|
||||
|
||||
+1
-1
@@ -44,6 +44,6 @@ class KotlinMissingForOrWhileBodyFixer : SmartEnterProcessorWithFixers.Fixer<Kot
|
||||
doc.insertString(rParen.range.end, "{}")
|
||||
}
|
||||
|
||||
fun KtLoopExpression.isValidLoopCondition() = leftParenthesis != null && rightParenthesis != null
|
||||
private fun KtLoopExpression.isValidLoopCondition() = leftParenthesis != null && rightParenthesis != null
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class KotlinMissingWhenBodyFixer : SmartEnterProcessorWithFixers.Fixer<KotlinSma
|
||||
}
|
||||
}
|
||||
|
||||
fun KtWhenExpression.insertOpenBraceAfter(): PsiElement? = when {
|
||||
private fun KtWhenExpression.insertOpenBraceAfter(): PsiElement? = when {
|
||||
rightParenthesis != null -> rightParenthesis
|
||||
subjectExpression != null -> null
|
||||
leftParenthesis != null -> null
|
||||
|
||||
@@ -48,10 +48,10 @@ class KotlinFacetEditorGeneralTab(
|
||||
) : JPanel(BorderLayout()) {
|
||||
private val isMultiEditor = configuration == null
|
||||
|
||||
var editableCommonArguments: CommonCompilerArguments
|
||||
var editableJvmArguments: K2JVMCompilerArguments
|
||||
var editableJsArguments: K2JSCompilerArguments
|
||||
var editableCompilerSettings: CompilerSettings
|
||||
private var editableCommonArguments: CommonCompilerArguments
|
||||
private var editableJvmArguments: K2JVMCompilerArguments
|
||||
private var editableJsArguments: K2JSCompilerArguments
|
||||
private var editableCompilerSettings: CompilerSettings
|
||||
|
||||
val compilerConfigurable: KotlinCompilerConfigurableTab
|
||||
|
||||
@@ -146,7 +146,7 @@ class KotlinFacetEditorGeneralTab(
|
||||
compilerConfigurable.reset()
|
||||
}
|
||||
|
||||
val chosenPlatform: TargetPlatformKind<*>?
|
||||
private val chosenPlatform: TargetPlatformKind<*>?
|
||||
get() = targetPlatformComboBox.selectedItem as TargetPlatformKind<*>?
|
||||
}
|
||||
|
||||
|
||||
@@ -24,57 +24,52 @@ import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.*
|
||||
|
||||
object KotlinUsageTypeProvider : UsageTypeProviderEx {
|
||||
override fun getUsageType(element: PsiElement?): UsageType? {
|
||||
return getUsageType(element, UsageTarget.EMPTY_ARRAY)
|
||||
}
|
||||
override fun getUsageType(element: PsiElement?): UsageType? = getUsageType(element, UsageTarget.EMPTY_ARRAY)
|
||||
|
||||
override fun getUsageType(element: PsiElement?, targets: Array<out UsageTarget>): UsageType? {
|
||||
val usageType = UsageTypeUtils.getUsageType(element)
|
||||
if (usageType == null) return null
|
||||
val usageType = UsageTypeUtils.getUsageType(element) ?: return null
|
||||
return convertEnumToUsageType(usageType)
|
||||
}
|
||||
|
||||
fun convertEnumToUsageType(usageType: UsageTypeEnum): UsageType {
|
||||
return when (usageType) {
|
||||
TYPE_CONSTRAINT -> KotlinUsageTypes.TYPE_CONSTRAINT
|
||||
VALUE_PARAMETER_TYPE -> KotlinUsageTypes.VALUE_PARAMETER_TYPE
|
||||
NON_LOCAL_PROPERTY_TYPE -> KotlinUsageTypes.NON_LOCAL_PROPERTY_TYPE
|
||||
FUNCTION_RETURN_TYPE -> KotlinUsageTypes.FUNCTION_RETURN_TYPE
|
||||
SUPER_TYPE -> KotlinUsageTypes.SUPER_TYPE
|
||||
IS -> KotlinUsageTypes.IS
|
||||
CLASS_OBJECT_ACCESS -> KotlinUsageTypes.CLASS_OBJECT_ACCESS
|
||||
COMPANION_OBJECT_ACCESS -> KotlinUsageTypes.COMPANION_OBJECT_ACCESS
|
||||
EXTENSION_RECEIVER_TYPE -> KotlinUsageTypes.EXTENSION_RECEIVER_TYPE
|
||||
SUPER_TYPE_QUALIFIER -> KotlinUsageTypes.SUPER_TYPE_QUALIFIER
|
||||
TYPE_ALIAS -> KotlinUsageTypes.TYPE_ALIAS
|
||||
fun convertEnumToUsageType(usageType: UsageTypeEnum): UsageType = when (usageType) {
|
||||
TYPE_CONSTRAINT -> KotlinUsageTypes.TYPE_CONSTRAINT
|
||||
VALUE_PARAMETER_TYPE -> KotlinUsageTypes.VALUE_PARAMETER_TYPE
|
||||
NON_LOCAL_PROPERTY_TYPE -> KotlinUsageTypes.NON_LOCAL_PROPERTY_TYPE
|
||||
FUNCTION_RETURN_TYPE -> KotlinUsageTypes.FUNCTION_RETURN_TYPE
|
||||
SUPER_TYPE -> KotlinUsageTypes.SUPER_TYPE
|
||||
IS -> KotlinUsageTypes.IS
|
||||
CLASS_OBJECT_ACCESS -> KotlinUsageTypes.CLASS_OBJECT_ACCESS
|
||||
COMPANION_OBJECT_ACCESS -> KotlinUsageTypes.COMPANION_OBJECT_ACCESS
|
||||
EXTENSION_RECEIVER_TYPE -> KotlinUsageTypes.EXTENSION_RECEIVER_TYPE
|
||||
SUPER_TYPE_QUALIFIER -> KotlinUsageTypes.SUPER_TYPE_QUALIFIER
|
||||
TYPE_ALIAS -> KotlinUsageTypes.TYPE_ALIAS
|
||||
|
||||
FUNCTION_CALL -> KotlinUsageTypes.FUNCTION_CALL
|
||||
IMPLICIT_GET -> KotlinUsageTypes.IMPLICIT_GET
|
||||
IMPLICIT_SET -> KotlinUsageTypes.IMPLICIT_SET
|
||||
IMPLICIT_INVOKE -> KotlinUsageTypes.IMPLICIT_INVOKE
|
||||
IMPLICIT_ITERATION -> KotlinUsageTypes.IMPLICIT_ITERATION
|
||||
PROPERTY_DELEGATION -> KotlinUsageTypes.PROPERTY_DELEGATION
|
||||
FUNCTION_CALL -> KotlinUsageTypes.FUNCTION_CALL
|
||||
IMPLICIT_GET -> KotlinUsageTypes.IMPLICIT_GET
|
||||
IMPLICIT_SET -> KotlinUsageTypes.IMPLICIT_SET
|
||||
IMPLICIT_INVOKE -> KotlinUsageTypes.IMPLICIT_INVOKE
|
||||
IMPLICIT_ITERATION -> KotlinUsageTypes.IMPLICIT_ITERATION
|
||||
PROPERTY_DELEGATION -> KotlinUsageTypes.PROPERTY_DELEGATION
|
||||
|
||||
RECEIVER -> KotlinUsageTypes.RECEIVER
|
||||
DELEGATE -> KotlinUsageTypes.DELEGATE
|
||||
RECEIVER -> KotlinUsageTypes.RECEIVER
|
||||
DELEGATE -> KotlinUsageTypes.DELEGATE
|
||||
|
||||
PACKAGE_DIRECTIVE -> KotlinUsageTypes.PACKAGE_DIRECTIVE
|
||||
PACKAGE_MEMBER_ACCESS -> KotlinUsageTypes.PACKAGE_MEMBER_ACCESS
|
||||
PACKAGE_DIRECTIVE -> KotlinUsageTypes.PACKAGE_DIRECTIVE
|
||||
PACKAGE_MEMBER_ACCESS -> KotlinUsageTypes.PACKAGE_MEMBER_ACCESS
|
||||
|
||||
CALLABLE_REFERENCE -> KotlinUsageTypes.CALLABLE_REFERENCE
|
||||
CALLABLE_REFERENCE -> KotlinUsageTypes.CALLABLE_REFERENCE
|
||||
|
||||
READ -> UsageType.READ
|
||||
WRITE -> UsageType.WRITE
|
||||
CLASS_IMPORT -> UsageType.CLASS_IMPORT
|
||||
CLASS_LOCAL_VAR_DECLARATION -> UsageType.CLASS_LOCAL_VAR_DECLARATION
|
||||
TYPE_PARAMETER -> UsageType.TYPE_PARAMETER
|
||||
CLASS_CAST_TO -> UsageType.CLASS_CAST_TO
|
||||
ANNOTATION -> UsageType.ANNOTATION
|
||||
CLASS_NEW_OPERATOR -> UsageType.CLASS_NEW_OPERATOR
|
||||
NAMED_ARGUMENT -> KotlinUsageTypes.NAMED_ARGUMENT
|
||||
READ -> UsageType.READ
|
||||
WRITE -> UsageType.WRITE
|
||||
CLASS_IMPORT -> UsageType.CLASS_IMPORT
|
||||
CLASS_LOCAL_VAR_DECLARATION -> UsageType.CLASS_LOCAL_VAR_DECLARATION
|
||||
TYPE_PARAMETER -> UsageType.TYPE_PARAMETER
|
||||
CLASS_CAST_TO -> UsageType.CLASS_CAST_TO
|
||||
ANNOTATION -> UsageType.ANNOTATION
|
||||
CLASS_NEW_OPERATOR -> UsageType.CLASS_NEW_OPERATOR
|
||||
NAMED_ARGUMENT -> KotlinUsageTypes.NAMED_ARGUMENT
|
||||
|
||||
USAGE_IN_STRING_LITERAL -> UsageType.LITERAL_USAGE
|
||||
}
|
||||
USAGE_IN_STRING_LITERAL -> UsageType.LITERAL_USAGE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ import kotlin.collections.ArrayList
|
||||
class KotlinLanguageInjector(
|
||||
val configuration: Configuration,
|
||||
val project: Project,
|
||||
val temporaryPlacesRegistry: TemporaryPlacesRegistry) : MultiHostInjector {
|
||||
val temporaryPlacesRegistry: TemporaryPlacesRegistry
|
||||
) : MultiHostInjector {
|
||||
companion object {
|
||||
private val STRING_LITERALS_REGEXP = "\"([^\"]*)\"".toRegex()
|
||||
private val ABSENT_KOTLIN_INJECTION = BaseInjection("ABSENT_KOTLIN_BASE_INJECTION")
|
||||
|
||||
@@ -50,7 +50,7 @@ open class ConvertLambdaToReferenceIntention(text: String) :
|
||||
|
||||
open fun buildReferenceText(element: KtLambdaExpression) = buildReferenceText(lambdaExpression = element, shortTypes = false)
|
||||
|
||||
protected fun KtLambdaArgument.outerCalleeDescriptor(): FunctionDescriptor? {
|
||||
private fun KtLambdaArgument.outerCalleeDescriptor(): FunctionDescriptor? {
|
||||
val outerCallExpression = parent as? KtCallExpression ?: return null
|
||||
val context = outerCallExpression.analyze()
|
||||
val outerCallee = outerCallExpression.calleeExpression as? KtReferenceExpression ?: return null
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention<KtP
|
||||
element.delete()
|
||||
}
|
||||
|
||||
fun convertValueParametersToProperties(
|
||||
private fun convertValueParametersToProperties(
|
||||
element: KtPrimaryConstructor, klass: KtClass, factory: KtPsiFactory, anchorBefore: PsiElement?
|
||||
) {
|
||||
for (valueParameter in element.valueParameters.reversed()) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class ConvertReferenceToLambdaInspection : IntentionBasedInspection<KtCallableRe
|
||||
class ConvertReferenceToLambdaIntention : SelfTargetingOffsetIndependentIntention<KtCallableReferenceExpression>(
|
||||
KtCallableReferenceExpression::class.java, "Convert reference to lambda"
|
||||
) {
|
||||
val SOURCE_RENDERER = IdeDescriptorRenderers.SOURCE_CODE
|
||||
private val SOURCE_RENDERER = IdeDescriptorRenderers.SOURCE_CODE
|
||||
|
||||
override fun applyTo(element: KtCallableReferenceExpression, editor: Editor?) {
|
||||
val context = element.analyze(BodyResolveMode.PARTIAL)
|
||||
|
||||
@@ -71,7 +71,7 @@ class MovePropertyToClassBodyIntention : SelfTargetingIntention<KtParameter>(KtP
|
||||
if (hasVararg) element.addModifier(KtTokens.VARARG_KEYWORD)
|
||||
}
|
||||
|
||||
fun KtAnnotationEntry.isAppliedToProperty(): Boolean {
|
||||
private fun KtAnnotationEntry.isAppliedToProperty(): Boolean {
|
||||
useSiteTarget?.getAnnotationUseSiteTarget()?.let {
|
||||
return it == AnnotationUseSiteTarget.FIELD
|
||||
|| it == AnnotationUseSiteTarget.PROPERTY
|
||||
@@ -83,7 +83,7 @@ class MovePropertyToClassBodyIntention : SelfTargetingIntention<KtParameter>(KtP
|
||||
return !isApplicableToConstructorParameter()
|
||||
}
|
||||
|
||||
fun KtAnnotationEntry.isAppliedToConstructorParameter(): Boolean {
|
||||
private fun KtAnnotationEntry.isAppliedToConstructorParameter(): Boolean {
|
||||
useSiteTarget?.getAnnotationUseSiteTarget()?.let {
|
||||
return it == AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER
|
||||
}
|
||||
@@ -91,19 +91,19 @@ class MovePropertyToClassBodyIntention : SelfTargetingIntention<KtParameter>(KtP
|
||||
return isApplicableToConstructorParameter()
|
||||
}
|
||||
|
||||
fun KtAnnotationEntry.isApplicableToConstructorParameter(): Boolean {
|
||||
private fun KtAnnotationEntry.isApplicableToConstructorParameter(): Boolean {
|
||||
val context = analyze(BodyResolveMode.PARTIAL)
|
||||
val descriptor = context[BindingContext.ANNOTATION, this] ?: return false
|
||||
val applicableTargets = AnnotationChecker.applicableTargetSet(descriptor)
|
||||
return applicableTargets.contains(KotlinTarget.VALUE_PARAMETER)
|
||||
}
|
||||
|
||||
fun KtAnnotationEntry.textWithoutUseSite() = "@" + typeReference?.text.orEmpty() + valueArgumentList?.text.orEmpty()
|
||||
private fun KtAnnotationEntry.textWithoutUseSite() = "@" + typeReference?.text.orEmpty() + valueArgumentList?.text.orEmpty()
|
||||
|
||||
fun KtAnnotationUseSiteTarget.removeWithColon() {
|
||||
private fun KtAnnotationUseSiteTarget.removeWithColon() {
|
||||
nextSibling?.delete() // ':' symbol after use site
|
||||
delete()
|
||||
}
|
||||
|
||||
fun KtPrimaryConstructor.isNotContainedInAnnotation() = !getContainingClassOrObject().isAnnotation()
|
||||
private fun KtPrimaryConstructor.isNotContainedInAnnotation() = !getContainingClassOrObject().isAnnotation()
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class MovePropertyToConstructorIntention :
|
||||
return parameterDescriptor.source.getPsi() as? KtParameter
|
||||
}
|
||||
|
||||
fun KtAnnotationEntry.isApplicableToConstructorParameter(): Boolean {
|
||||
private fun KtAnnotationEntry.isApplicableToConstructorParameter(): Boolean {
|
||||
val context = analyze(BodyResolveMode.PARTIAL)
|
||||
val descriptor = context[BindingContext.ANNOTATION, this] ?: return false
|
||||
val applicableTargets = AnnotationChecker.applicableTargetSet(descriptor)
|
||||
|
||||
@@ -69,7 +69,7 @@ class UsePropertyAccessSyntaxInspection : IntentionBasedInspection<KtCallExpress
|
||||
|
||||
val fqNameList = mutableListOf<FqNameUnsafe>()
|
||||
|
||||
var fqNameStrings: List<String>
|
||||
private var fqNameStrings: List<String>
|
||||
get() = fqNameList.map { it.asString() }
|
||||
set(value) {
|
||||
fqNameList.clear()
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.psi.psiUtil.lastBlockStatementOrThis
|
||||
import org.jetbrains.kotlin.types.typeUtil.isNothing
|
||||
|
||||
object BranchedFoldingUtils {
|
||||
fun getFoldableBranchedAssignment(branch: KtExpression?): KtBinaryExpression? {
|
||||
private fun getFoldableBranchedAssignment(branch: KtExpression?): KtBinaryExpression? {
|
||||
fun checkAssignment(expression: KtBinaryExpression): Boolean {
|
||||
if (expression.operationToken !in KtTokens.ALL_ASSIGNMENTS) return false
|
||||
|
||||
@@ -52,7 +52,7 @@ object BranchedFoldingUtils {
|
||||
it.getTargetLabel() == null
|
||||
}
|
||||
|
||||
fun checkAssignmentsMatch(a1: KtBinaryExpression, a2: KtBinaryExpression): Boolean =
|
||||
private fun checkAssignmentsMatch(a1: KtBinaryExpression, a2: KtBinaryExpression): Boolean =
|
||||
a1.left?.text == a2.left?.text && a1.operationToken == a2.operationToken
|
||||
|
||||
internal fun getFoldableAssignmentNumber(expression: KtExpression?): Int {
|
||||
|
||||
@@ -57,7 +57,7 @@ interface Condition {
|
||||
}
|
||||
}
|
||||
|
||||
class AtomicCondition(val expression: KtExpression, val isNegated: Boolean = false) : Condition {
|
||||
class AtomicCondition(val expression: KtExpression, private val isNegated: Boolean = false) : Condition {
|
||||
init {
|
||||
assert(expression.isPhysical)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class KotlinDecompilerServiceImpl : KotlinDecompilerService {
|
||||
return resultSaver.resultText
|
||||
}
|
||||
|
||||
fun bytecodeMapForExistingClassfile(file: VirtualFile): Map<File, () -> ByteArray> {
|
||||
private fun bytecodeMapForExistingClassfile(file: VirtualFile): Map<File, () -> ByteArray> {
|
||||
val mask = "${file.nameWithoutExtension}$"
|
||||
val files =
|
||||
mapOf(file.path to file) +
|
||||
@@ -73,7 +73,7 @@ class KotlinDecompilerServiceImpl : KotlinDecompilerService {
|
||||
}
|
||||
}
|
||||
|
||||
fun bytecodeMapForSourceFile(file: KtFile): Map<File, () -> ByteArray> {
|
||||
private fun bytecodeMapForSourceFile(file: KtFile): Map<File, () -> ByteArray> {
|
||||
val configuration = CompilerConfiguration().apply {
|
||||
languageVersionSettings = file.languageVersionSettings
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ object KDocRenderer {
|
||||
fun child(type: IElementType): MarkdownNode? = children.firstOrNull { it.type == type }
|
||||
}
|
||||
|
||||
fun MarkdownNode.visit(action: (MarkdownNode, () -> Unit) -> Unit) {
|
||||
private fun MarkdownNode.visit(action: (MarkdownNode, () -> Unit) -> Unit) {
|
||||
action(this) {
|
||||
for (child in children) {
|
||||
child.visit(action)
|
||||
@@ -187,7 +187,7 @@ object KDocRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
fun MarkdownNode.toHtml(): String {
|
||||
private fun MarkdownNode.toHtml(): String {
|
||||
if (node.type == MarkdownTokenTypes.WHITE_SPACE) {
|
||||
return text // do not trim trailing whitespace
|
||||
}
|
||||
@@ -311,11 +311,11 @@ object KDocRenderer {
|
||||
return sb.toString().trimEnd()
|
||||
}
|
||||
|
||||
fun StringBuilder.trimEnd() {
|
||||
private fun StringBuilder.trimEnd() {
|
||||
while (length > 0 && this[length - 1] == ' ') {
|
||||
deleteCharAt(length - 1)
|
||||
}
|
||||
}
|
||||
|
||||
fun String.htmlEscape(): String = replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
private fun String.htmlEscape(): String = replace("&", "&").replace("<", "<").replace(">", ">")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.parents
|
||||
|
||||
class AddLoopLabelFix(loop: KtLoopExpression, val jumpExpression: KtExpressionWithLabel): KotlinQuickFixAction<KtLoopExpression>(loop) {
|
||||
class AddLoopLabelFix(
|
||||
loop: KtLoopExpression,
|
||||
private val jumpExpression: KtExpressionWithLabel
|
||||
): KotlinQuickFixAction<KtLoopExpression>(loop) {
|
||||
|
||||
private val existingLabelName = (loop.parent as? KtLabeledExpression)?.getLabelName()
|
||||
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ class AddReifiedToTypeParameterOfFunctionFix(
|
||||
val function: KtNamedFunction
|
||||
) : AddModifierFix(typeParameter, KtTokens.REIFIED_KEYWORD) {
|
||||
|
||||
val inlineFix = AddInlineToFunctionWithReifiedFix(function)
|
||||
private val inlineFix = AddInlineToFunctionWithReifiedFix(function)
|
||||
|
||||
override fun getText() = element?.let { "Make ${getElementName(it)} reified and ${getElementName(function)} inline" } ?: ""
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getType
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
|
||||
class AddTypeAnnotationToValueParameterFix(element: KtParameter) : KotlinQuickFixAction<KtParameter>(element) {
|
||||
val typeNameShort : String?
|
||||
private val typeNameShort : String?
|
||||
val typeName: String?
|
||||
|
||||
init {
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.jetbrains.kotlin.resolve.ExposedVisibilityChecker
|
||||
|
||||
open class ChangeVisibilityFix(
|
||||
element: KtModifierListOwner,
|
||||
protected val elementName: String,
|
||||
protected val visibilityModifier: KtModifierKeywordToken
|
||||
private val elementName: String,
|
||||
private val visibilityModifier: KtModifierKeywordToken
|
||||
) : KotlinQuickFixAction<KtModifierListOwner>(element) {
|
||||
|
||||
override fun getText() = "Make '$elementName' $visibilityModifier"
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ class CreateExtensionCallableFromUsageFix<E : KtElement>(
|
||||
|
||||
abstract class CreateCallableFromUsageFixBase<E : KtElement>(
|
||||
originalExpression: E,
|
||||
val callableInfos: List<CallableInfo>,
|
||||
private val callableInfos: List<CallableInfo>,
|
||||
val isExtension: Boolean
|
||||
) : CreateFromUsageFixBase<E>(originalExpression) {
|
||||
init {
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.psi.KtElement
|
||||
import java.util.*
|
||||
|
||||
abstract class CreateCallableMemberFromUsageFactory<E : KtElement>(
|
||||
val extensionsSupported: Boolean = true
|
||||
private val extensionsSupported: Boolean = true
|
||||
) : KotlinIntentionActionFactoryWithDelegate<E, List<CallableInfo>>() {
|
||||
private fun newCallableQuickFix(
|
||||
originalElementPointer: SmartPsiElementPointer<E>,
|
||||
|
||||
+4
-1
@@ -64,7 +64,10 @@ data class ClassInfo(
|
||||
val parameterInfos: List<ParameterInfo> = Collections.emptyList()
|
||||
)
|
||||
|
||||
open class CreateClassFromUsageFix<E : KtElement> protected constructor (element: E, val classInfo: ClassInfo): CreateFromUsageFixBase<E>(element) {
|
||||
open class CreateClassFromUsageFix<E : KtElement> protected constructor (
|
||||
element: E,
|
||||
private val classInfo: ClassInfo
|
||||
): CreateFromUsageFixBase<E>(element) {
|
||||
override fun getText() = "Create ${classInfo.kind.description} '${classInfo.name}'"
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile): Boolean {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class TypeAliasInfo(
|
||||
|
||||
class CreateTypeAliasFromUsageFix<E : KtElement>(
|
||||
element: E,
|
||||
val aliasInfo: TypeAliasInfo
|
||||
private val aliasInfo: TypeAliasInfo
|
||||
) : CreateFromUsageFixBase<E>(element), LowPriorityAction {
|
||||
override fun getText() = "Create type alias '${aliasInfo.name}'"
|
||||
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class ReplaceProtectedToPublishedApiCallFix(
|
||||
}
|
||||
|
||||
companion object : KotlinSingleIntentionActionFactory() {
|
||||
val signatureRenderer = IdeDescriptorRenderers.SOURCE_CODE.withOptions {
|
||||
private val signatureRenderer = IdeDescriptorRenderers.SOURCE_CODE.withOptions {
|
||||
defaultParameterValueRenderer = null
|
||||
startFromDeclarationKeyword = true
|
||||
withoutReturnType = true
|
||||
|
||||
+7
-7
@@ -66,13 +66,13 @@ fun runChangeSignature(project: Project,
|
||||
return KotlinChangeSignature(project, callableDescriptor, configuration, defaultValueContext, commandName).run()
|
||||
}
|
||||
|
||||
class KotlinChangeSignature(project: Project,
|
||||
callableDescriptor: CallableDescriptor,
|
||||
val configuration: KotlinChangeSignatureConfiguration,
|
||||
val defaultValueContext: PsiElement,
|
||||
commandName: String?): CallableRefactoring<CallableDescriptor>(project,
|
||||
callableDescriptor,
|
||||
commandName ?: ChangeSignatureHandler.REFACTORING_NAME) {
|
||||
class KotlinChangeSignature(
|
||||
project: Project,
|
||||
callableDescriptor: CallableDescriptor,
|
||||
val configuration: KotlinChangeSignatureConfiguration,
|
||||
val defaultValueContext: PsiElement,
|
||||
commandName: String?
|
||||
): CallableRefactoring<CallableDescriptor>(project, callableDescriptor, commandName ?: ChangeSignatureHandler.REFACTORING_NAME) {
|
||||
|
||||
private val LOG = Logger.getInstance(KotlinChangeSignature::class.java)
|
||||
|
||||
|
||||
+2
-2
@@ -47,9 +47,9 @@ class KotlinChangePropertySignatureDialog(
|
||||
private val nameField = EditorTextField(methodDescriptor.name)
|
||||
private var returnTypeField: EditorTextField by Delegates.notNull()
|
||||
private var receiverTypeCheckBox: JCheckBox? = null
|
||||
var receiverTypeLabel: JLabel by Delegates.notNull()
|
||||
private var receiverTypeLabel: JLabel by Delegates.notNull()
|
||||
private var receiverTypeField: EditorTextField by Delegates.notNull()
|
||||
var receiverDefaultValueLabel: JLabel? = null
|
||||
private var receiverDefaultValueLabel: JLabel? = null
|
||||
private var receiverDefaultValueField: EditorTextField? = null
|
||||
|
||||
init {
|
||||
|
||||
+1
-1
@@ -393,7 +393,7 @@ class KotlinChangeSignatureDialog(
|
||||
return KotlinChangeSignatureProcessor(myProject, changeInfo, commandName ?: title)
|
||||
}
|
||||
|
||||
fun getMethodDescriptor(): KotlinMethodDescriptor = myMethod
|
||||
private fun getMethodDescriptor(): KotlinMethodDescriptor = myMethod
|
||||
|
||||
override fun getSelectedIdx(): Int {
|
||||
return myMethod.parameters.withIndex().firstOrNull { it.value.isNewParameter }?.index
|
||||
|
||||
+1
-1
@@ -252,7 +252,7 @@ class KotlinFunctionCallUsage(
|
||||
val resolvedArgument: ResolvedValueArgument?,
|
||||
val receiverValue: ReceiverValue?
|
||||
) {
|
||||
val mainValueArgument: ValueArgument?
|
||||
private val mainValueArgument: ValueArgument?
|
||||
get() = resolvedArgument?.arguments?.firstOrNull()
|
||||
|
||||
val wasNamed: Boolean
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ abstract class KotlinExtractSuperHandlerBase(private val isExtractInterface: Boo
|
||||
return true
|
||||
}
|
||||
|
||||
fun selectElements(klass: KtClassOrObject, project: Project, editor: Editor?) {
|
||||
private fun selectElements(klass: KtClassOrObject, project: Project, editor: Editor?) {
|
||||
val containers = klass.getExtractionContainers(strict = true, includeAll = true) + SeparateFileWrapper(klass.manager)
|
||||
|
||||
if (editor == null) return doInvoke(klass, containers.first(), project, editor)
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.psi.KtBlockExpression
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
class ExtractKotlinFunctionHandler(
|
||||
val allContainersEnabled: Boolean = false,
|
||||
private val allContainersEnabled: Boolean = false,
|
||||
private val helper: ExtractionEngineHelper = ExtractKotlinFunctionHandler.InteractiveExtractionHelper) : RefactoringActionHandler {
|
||||
|
||||
object InteractiveExtractionHelper : ExtractionEngineHelper(EXTRACT_FUNCTION) {
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ interface KotlinIntroduceLambdaParameterHelper: KotlinIntroduceParameterHelper {
|
||||
open class KotlinIntroduceLambdaParameterHandler(
|
||||
helper: KotlinIntroduceLambdaParameterHelper = KotlinIntroduceLambdaParameterHelper.Default
|
||||
): KotlinIntroduceParameterHandler(helper) {
|
||||
val extractLambdaHelper = object: ExtractionEngineHelper(INTRODUCE_LAMBDA_PARAMETER) {
|
||||
private val extractLambdaHelper = object: ExtractionEngineHelper(INTRODUCE_LAMBDA_PARAMETER) {
|
||||
private fun createDialog(
|
||||
project: Project,
|
||||
editor: Editor,
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ open class KotlinIntroduceTypeAliasHandler : RefactoringActionHandler {
|
||||
val INSTANCE = KotlinIntroduceTypeAliasHandler()
|
||||
}
|
||||
|
||||
fun selectElements(editor: Editor, file: KtFile, continuation: (elements: List<PsiElement>, targetSibling: PsiElement) -> Unit) {
|
||||
private fun selectElements(editor: Editor, file: KtFile, continuation: (elements: List<PsiElement>, targetSibling: PsiElement) -> Unit) {
|
||||
selectElementsWithTargetSibling(
|
||||
REFACTORING_NAME,
|
||||
editor,
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ object KotlinIntroduceVariableHandler : RefactoringActionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
fun doRefactoring(
|
||||
private fun doRefactoring(
|
||||
project: Project,
|
||||
editor: Editor?,
|
||||
expression: KtExpression,
|
||||
|
||||
+2
-2
@@ -21,12 +21,12 @@ import com.intellij.refactoring.MoveDestination
|
||||
import org.jetbrains.kotlin.idea.core.getPackage
|
||||
|
||||
sealed class AutocreatingPsiDirectoryWrapper {
|
||||
class ByPsiDirectory(val psiDirectory: PsiDirectory) : AutocreatingPsiDirectoryWrapper() {
|
||||
class ByPsiDirectory(private val psiDirectory: PsiDirectory) : AutocreatingPsiDirectoryWrapper() {
|
||||
override fun getPackageName(): String = psiDirectory.getPackage()?.qualifiedName ?: ""
|
||||
override fun getOrCreateDirectory(source: PsiDirectory) = psiDirectory
|
||||
}
|
||||
|
||||
class ByMoveDestination(val moveDestination: MoveDestination) : AutocreatingPsiDirectoryWrapper() {
|
||||
class ByMoveDestination(private val moveDestination: MoveDestination) : AutocreatingPsiDirectoryWrapper() {
|
||||
override fun getPackageName() = moveDestination.targetPackage.qualifiedName
|
||||
override fun getOrCreateDirectory(source: PsiDirectory) = moveDestination.getTargetDirectory(source)
|
||||
}
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ class KotlinAwareMoveFilesOrDirectoriesDialog(
|
||||
|
||||
override fun doHelpAction() = HelpManager.getInstance().invokeHelp(helpID)
|
||||
|
||||
fun isOpenInEditor(): Boolean {
|
||||
private fun isOpenInEditor(): Boolean {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) return false
|
||||
return PropertiesComponent.getInstance().getBoolean(MOVE_FILES_OPEN_IN_EDITOR, false)
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ fun postProcessMoveUsages(
|
||||
|
||||
var KtFile.updatePackageDirective: Boolean? by UserDataProperty(Key.create("UPDATE_PACKAGE_DIRECTIVE"))
|
||||
|
||||
sealed class OuterInstanceReferenceUsageInfo(element: PsiElement, val isIndirectOuter: Boolean) : UsageInfo(element) {
|
||||
sealed class OuterInstanceReferenceUsageInfo(element: PsiElement, private val isIndirectOuter: Boolean) : UsageInfo(element) {
|
||||
open fun reportConflictIfAny(conflicts: MultiMap<PsiElement, String>): Boolean {
|
||||
val element = element ?: return false
|
||||
|
||||
@@ -453,7 +453,7 @@ sealed class OuterInstanceReferenceUsageInfo(element: PsiElement, val isIndirect
|
||||
class ImplicitReceiver(
|
||||
callElement: KtElement,
|
||||
isIndirectOuter: Boolean,
|
||||
val isDoubleReceiver: Boolean
|
||||
private val isDoubleReceiver: Boolean
|
||||
) : OuterInstanceReferenceUsageInfo(callElement, isIndirectOuter) {
|
||||
val callElement: KtElement?
|
||||
get() = element as? KtElement
|
||||
|
||||
@@ -60,7 +60,7 @@ class KotlinPullUpData(val sourceClass: KtClassOrObject,
|
||||
|
||||
val targetClassSuperResolvedCall = superEntryForTargetClass.getResolvedCall(sourceClassContext)
|
||||
|
||||
val typeParametersInSourceClassContext by lazy {
|
||||
private val typeParametersInSourceClassContext by lazy {
|
||||
sourceClassDescriptor.declaredTypeParameters +
|
||||
sourceClass.getResolutionScope(sourceClassContext, resolutionFacade)
|
||||
.collectDescriptorsFiltered(DescriptorKindFilter.NON_SINGLETON_CLASSIFIERS)
|
||||
|
||||
@@ -51,7 +51,7 @@ class KotlinPushDownDialog(
|
||||
|
||||
private var memberInfoModel: MemberInfoModel<KtNamedDeclaration, KotlinMemberInfo>? = null
|
||||
|
||||
val selectedMemberInfos: List<KotlinMemberInfo>
|
||||
private val selectedMemberInfos: List<KotlinMemberInfo>
|
||||
get() = memberInfos.filter { it.isChecked && memberInfoModel?.isMemberEnabled(it) ?: false }
|
||||
|
||||
override fun getDimensionServiceKey() = "#" + this::class.java.name
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ class RenameKotlinPropertyProcessor : RenameKotlinPsiProcessor() {
|
||||
}
|
||||
}
|
||||
|
||||
class PropertyMethodWrapper(val propertyMethod: PsiMethod) : PsiNamedElement by propertyMethod, NavigationItem by propertyMethod {
|
||||
class PropertyMethodWrapper(private val propertyMethod: PsiMethod) : PsiNamedElement by propertyMethod, NavigationItem by propertyMethod {
|
||||
override fun getName() = propertyMethod.name
|
||||
override fun setName(name: String) = this
|
||||
override fun copy() = this
|
||||
|
||||
Reference in New Issue
Block a user