Push Down: Do not specifiy visibility on generated overriding members
#KT-12971 Fixed
This commit is contained in:
@@ -268,6 +268,7 @@ Using 'this' as function argument in constructor of non-final class
|
||||
- [`KT-13175`](https://youtrack.jetbrains.com/issue/KT-13175) Move: Warn about accessibility conflicts when moving entire file
|
||||
- [`KT-13240`](https://youtrack.jetbrains.com/issue/KT-13240) Rename: Do not report shadowing conflict if redeclaration is detected
|
||||
- [`KT-13253`](https://youtrack.jetbrains.com/issue/KT-13253) Rename: Report conflicts for constructor parameters
|
||||
- [`KT-12971`](https://youtrack.jetbrains.com/issue/KT-12971) Push Down: Do not specifiy visibility on generated overriding members
|
||||
|
||||
##### New features
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.idea.refactoring.pullUp.*
|
||||
import org.jetbrains.kotlin.idea.search.declarationsSearch.HierarchySearchRequest
|
||||
import org.jetbrains.kotlin.idea.search.declarationsSearch.searchInheritors
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
@@ -154,9 +155,7 @@ class KotlinPushDownProcessor(
|
||||
}
|
||||
}
|
||||
if (memberDescriptor.modality != Modality.ABSTRACT && memberInfo.isToAbstract) {
|
||||
if (hasModifier(KtTokens.PRIVATE_KEYWORD)) {
|
||||
addModifier(KtTokens.PROTECTED_KEYWORD)
|
||||
}
|
||||
KtTokens.VISIBILITY_MODIFIERS.types.forEach { removeModifier(it as KtModifierKeywordToken) }
|
||||
addModifier(KtTokens.OVERRIDE_KEYWORD)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
open class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
protected open fun foo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
open class A {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
protected abstract fun foo()
|
||||
}
|
||||
|
||||
class B : A() {
|
||||
// INFO: {"checked": "true", "toAbstract": "true"}
|
||||
override fun foo() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,6 +59,12 @@ public class PushDownTestGenerated extends AbstractPushDownTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("dropVisibilityOnGeneratedOverride.kt")
|
||||
public void testDropVisibilityOnGeneratedOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pushDown/dropVisibilityOnGeneratedOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("finalClass.kt")
|
||||
public void testFinalClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/pushDown/finalClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user