IDEA-85758 intention to replace casted var with a var of the right type and having the same value implemented

This commit is contained in:
Danila Ponomarenko
2012-06-20 16:03:32 +04:00
parent 7f0f06e428
commit 3ab777e366
23 changed files with 410 additions and 5 deletions

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
import java.lang.Object;
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
Object o = foobar.baz;
foo = null;
}
}

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
import java.lang.Object;
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
Object o = foobar.baz;
foobar = null;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
foo = null;
FooBar foobar = (FooBar)foo;
return foobar.baz;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
foobar = null;
FooBar foobar = (FooBar)foo;
return foobar.baz;
}
}

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foobar = null;
foo = null;
foobar = (FooBar)foo;
return foobar.baz;
}
}

View File

@@ -0,0 +1,10 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
return foobar.baz;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace '(FooBar)foo' with 'foobar2'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foobar = null;
FooBar foobar2 = (FooBar)foo;
return foobar2.baz;
}
}

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
import java.lang.Object;
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
Object o = ((FooBar<caret>)foo).baz;
foo = null;
}
}

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
import java.lang.Object;
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
Object o = ((FooBar<caret>)foo).baz;
foobar = null;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
foo = null;
FooBar foobar = (FooBar)foo;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
foobar = null;
FooBar foobar = (FooBar)foo;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "false"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foo = null;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,13 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foobar = null;
foo = null;
foobar = (FooBar)foo;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,11 @@
// "Replace '(FooBar)foo' with 'foobar'" "false"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foobar = null;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,10 @@
// "Replace '(FooBar)foo' with 'foobar'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
return ((FooBar<caret>)foo).baz;
}
}

View File

@@ -0,0 +1,12 @@
// "Replace '(FooBar)foo' with 'foobar2'" "true"
class FooBar {
public int baz;
int method(Object foo) {
FooBar foobar = (FooBar)foo;
foobar = null;
FooBar foobar2 = (FooBar)foo;
return ((FooBar<caret>)foo).baz;
}
}