Extract Interface/Superclass: Disable const-properties
#KT-15611 Fixed
This commit is contained in:
@@ -469,6 +469,7 @@ These artifacts include extensions for the types available in the latter JDKs, s
|
||||
### IDE
|
||||
|
||||
- Project View: Fix presentation of Kotlin files and their members when @JvmName having the same name as the file itself
|
||||
- [`KT-15611`](https://youtrack.jetbrains.com/issue/KT-15611) Extract Interface/Superclass: Disable const-properties
|
||||
|
||||
#### Intention actions, inspections and quickfixes
|
||||
|
||||
|
||||
+6
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.idea.refactoring.introduce.extractClass.ExtractSuper
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KotlinMemberInfo
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KotlinMemberSelectionPanel
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.KotlinUsesAndInterfacesDependencyMemberInfoModel
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import java.awt.BorderLayout
|
||||
@@ -65,6 +66,11 @@ abstract class KotlinExtractSuperDialogBase(
|
||||
val memberInfos: List<KotlinMemberInfo>,
|
||||
interfaceContainmentVerifier: (KtNamedDeclaration) -> Boolean
|
||||
) : KotlinUsesAndInterfacesDependencyMemberInfoModel<KtNamedDeclaration, KotlinMemberInfo>(originalClass, null, false, interfaceContainmentVerifier) {
|
||||
override fun isMemberEnabled(member: KotlinMemberInfo): Boolean {
|
||||
val declaration = member.member ?: return false
|
||||
return !declaration.hasModifier(KtTokens.CONST_KEYWORD)
|
||||
}
|
||||
|
||||
override fun isFixedAbstract(memberInfo: KotlinMemberInfo?) = true
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.asJava.toLightClass
|
||||
import org.jetbrains.kotlin.idea.refactoring.isCompanionMemberOf
|
||||
import org.jetbrains.kotlin.idea.refactoring.isInterfaceClass
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.*
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
class KotlinPullUpDialog(
|
||||
@@ -91,6 +92,8 @@ class KotlinPullUpDialog(
|
||||
val superClass = superClass ?: return false
|
||||
val member = memberInfo.member
|
||||
|
||||
if (member.hasModifier(KtTokens.CONST_KEYWORD)) return false
|
||||
|
||||
if (superClass is PsiClass) {
|
||||
if (!member.canMoveMemberToJavaClass(superClass)) return false
|
||||
if (member.isCompanionMemberOf(sourceClass)) return false
|
||||
|
||||
Reference in New Issue
Block a user