option to ignore fields used in multiple methods to be converted to local (IDEA-108517)

This commit is contained in:
Anna Kozlova
2013-06-14 18:21:29 +04:00
parent 7cd43429a7
commit 1f9e8cbc6d
6 changed files with 68 additions and 25 deletions
@@ -1,13 +1,10 @@
class Test {
private int f;
private int f;
void foo () {
f = 0;
int k = f;
}
public void bar() {
foo(() -> {f++;});
}
int bar () {
f = 5;
return f;
}
private void foo(Runnable r) {
}
}
@@ -1,10 +1,13 @@
class Test {
private int f;
private int f;
public void bar() {
foo(() -> {f++;});
}
void foo () {
f = 0;
int k = f;
}
private void foo(Runnable r) {
}
int bar () {
f = 5;
return f;
}
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>2</line>
<description>Field can be converted to a local variable</description>
</problem>
</problems>
@@ -0,0 +1,13 @@
class Test {
private int f;
void foo () {
f = 0;
int k = f;
}
int bar () {
f = 5;
return f;
}
}