ConvertToLocalInspection: CR fixes (IDEA-CR-42222)

1. localVariableIsCopy -> isLocalVariableCopy
2. added more precise convert to local quick fix message (with info about to where field will be inlined)
3. fixed tests for new convert to local quick fix messages
4. removed inlineVariable(PsiVariable, PsiExpression)
This commit is contained in:
Artemiy Sartakov
2019-01-28 18:32:01 +07:00
parent c3e26671bf
commit 6fbd5cc914
23 changed files with 147 additions and 111 deletions
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'getFoo1'" "true"
class Test {
int getFoo1(boolean f) {
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'IntelliJBugConvertToLocal'" "true"
import java.util.ArrayList;
class ITest {
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'Test'" "true"
class Test {
public Test(String param) {
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'someMethod'" "true"
class TestFieldConversion
{
@@ -0,0 +1,9 @@
// "Convert to local" "true"
class TestInitializer {
{
boolean field = true;
System.out.println(field);
}
}
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variables in 2 methods" "true"
class Test {
int getFoo1() {
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'setEditable1'" "true"
class MyClassTest {
private boolean editable = false;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'FieldCanBeLocalTest'" "true"
import javax.swing.*;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'getFoo1'" "true"
class Test {
private int my<caret>Foo;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'IntelliJBugConvertToLocal'" "true"
import java.util.ArrayList;
class ITest {
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'Test'" "true"
class Test {
private final String f<caret>ield;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'someMethod'" "true"
class TestFieldConversion
{
/**
@@ -0,0 +1,11 @@
// "Convert to local" "true"
class TestInitializer {
private boolean fie<caret>ld;
{
field = true;
System.out.println(field);
}
}
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variables in 2 methods" "true"
class Test {
private int my<caret>Foo;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'setEditable1'" "true"
class MyClassTest {
private boolean editable = false;
@@ -1,4 +1,4 @@
// "Convert to local" "true"
// "Convert field to local variable in method 'FieldCanBeLocalTest'" "true"
import javax.swing.*;