Java: Fixed extracting method from duplicates containing reused variables (IDEA-188894)

This commit is contained in:
Pavel Dolgov
2018-03-28 12:33:31 +03:00
parent e4b477fc6e
commit b7f3c967e9
8 changed files with 205 additions and 3 deletions
@@ -0,0 +1,25 @@
import java.util.List;
class DeclaredOutputVariable {
void foo(List<String> a) {
<selection>
int n = 1;
String s = a.get(n);
if (s == null) return;
System.out.println(s.charAt(n));
</selection>
s = "";
n = 2;
System.out.println(s.length() + n);
}
void bar(List<String> a) {
int n = 1;
String s = a.get(n);
if (s == null) return;
System.out.println(s.charAt(n));
s = "";
n = 2;
System.out.println(s.length() + n);
}
}