Add "Make private and overrides member" quick fix for ACCIDENTAL_OVERRIDE

#KT-18536 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-10-01 18:22:49 +09:00
committed by Dmitry Gridin
parent 30b98aaeb7
commit d72e55d1b7
30 changed files with 282 additions and 0 deletions
@@ -0,0 +1,4 @@
public interface JavaInterface {
String getName(String name);
String getName();
}
@@ -0,0 +1,7 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(private val name: String) : JavaInterface {
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,4 @@
public interface JavaInterface {
String getName(String name);
String getName();
}
@@ -0,0 +1,4 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(<caret>val name: String) : JavaInterface {
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,10 @@
// "Implements 'getName'" "false"
// DISABLE-ERRORS
// ACTION: Convert to secondary constructor
// ACTION: Create test
// ACTION: Make private
// ACTION: Make protected
// ACTION: Make public
// ACTION: Move to class body
class A(<caret>internal val name: String) : JavaInterface {
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,7 @@
// "Implements 'getName'" "true"
// DISABLE-ERRORS
class A(private val name: String) : JavaInterface {
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,4 @@
// "Implements 'getName'" "true"
// DISABLE-ERRORS
class A(<caret>private val name: String) : JavaInterface {
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,7 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(private val name: String) : JavaInterface {
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,4 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(<caret>protected val name: String) : JavaInterface {
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,7 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(private val name: String) : JavaInterface {
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,3 @@
public interface JavaInterface {
String getName();
}
@@ -0,0 +1,4 @@
// "Make private and implements 'getName'" "true"
// DISABLE-ERRORS
class A(<caret>public val name: String) : JavaInterface {
}
@@ -0,0 +1,3 @@
public abstract class JavaClass {
abstract String getName();
}
@@ -0,0 +1,8 @@
// "Make private and overrides 'getName'" "true"
// DISABLE-ERRORS
class B : JavaClass() {
private val name: String = ""
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,3 @@
public abstract class JavaClass {
abstract String getName();
}
@@ -0,0 +1,5 @@
// "Make private and overrides 'getName'" "true"
// DISABLE-ERRORS
class B : JavaClass() {
<caret>val name: String = ""
}
@@ -0,0 +1,7 @@
public interface JavaInterface {
String getName();
void setName();
void setName(String name);
}
@@ -0,0 +1,11 @@
// "Make private and implements 'setName'" "true"
// DISABLE-ERRORS
class A(private var name: String) : JavaInterface {
override fun setName(name: String?) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
@@ -0,0 +1,7 @@
public interface JavaInterface {
String getName();
void setName();
void setName(String name);
}
@@ -0,0 +1,7 @@
// "Make private and implements 'setName'" "true"
// DISABLE-ERRORS
class A(<caret>var name: String) : JavaInterface {
override fun getName(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}