Implement "Safe Delete" refactoring for value parameters

This commit is contained in:
Alexey Sedunov
2013-07-31 15:03:57 +04:00
parent 6ef8f04a01
commit 2704328160
117 changed files with 2731 additions and 8 deletions
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(1, 2)
}
void bar(C c) {
c.foo(1, 2)
}
void bar(D d) {
d.foo(1, 2)
}
void bar(Z z) {
z.foo(1, 2)
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(2)
}
void bar(C c) {
c.foo(2)
}
void bar(D d) {
d.foo(2)
}
void bar(Z z) {
z.foo(2)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(b: Int)
}
open class A {
open fun foo(b: Int) {
}
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
class D: B(), Z {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,29 @@
trait Z {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
class D: B(), Z {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,21 @@
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,27 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class A {
open fun foo(a: Int, b: Int) {
}
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
class D: B(), Z {
override fun foo(<caret>a: Int, b: Int) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo("1", "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
println(b)
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(b: String, c: Any) {
println(b)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int b) {
}
}
class D extends B implements Z {
public void foo(int b) {
}
}
class U {
void bar(A a) {
a.foo(2)
}
void bar(B b) {
b.foo(4)
}
void bar(C c) {
c.foo(6)
}
void bar(D d) {
d.foo(8)
}
void bar(Z z) {
z.foo(10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(b: Int)
}
open class B: A(), Z {
override fun foo(b: Int) {
}
}
class C: A() {
override fun foo(b: Int) {
}
}
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
System.out.println(a);
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(<caret>a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(<caret>a: Int, b: Int) {
}
}
class C: A() {
override fun foo(a: Int, b: Int) {
println(a)
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,33 @@
class A {
public void foo(int a, int b) {
}
}
class D extends B implements Z {
public void foo(int a, int b) {
System.out.println(a);
}
}
class U {
void bar(A a) {
a.foo(1, 2)
}
void bar(B b) {
b.foo(3, 4)
}
void bar(C c) {
c.foo(5, 6)
}
void bar(D d) {
d.foo(7, 8)
}
void bar(Z z) {
z.foo(9, 10)
}
}
@@ -0,0 +1,15 @@
trait Z {
open fun foo(a: Int, b: Int)
}
open class B: A(), Z {
override fun foo(a: Int, b: Int) {
}
}
class C: A() {
override fun foo(<caret>a: Int, b: Int) {
}
}
@@ -0,0 +1,2 @@
parameter a has 1 usage that is not safe to delete.
Of those 0 usages are in strings, comments, or non-code files.
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo("1", "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(<caret>a: Int, b: String, c: Any) {
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(b: String, c: Any) {
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "!")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(a: Int, <caret>b: String, c: Any) {
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(a: Int, c: Any) {
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1", "!")
}
}
@@ -0,0 +1,5 @@
class B {
void bar(A a) {
a.foo(1, "1")
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(a: Int, b: String, <caret>c: Any) {
}
}
@@ -0,0 +1,5 @@
class A {
fun foo(a: Int, b: String) {
}
}