add fix to create field in anonymous class for lambdas: IDEA-189928

This commit is contained in:
Roman.Ivanov
2018-04-16 12:47:03 +07:00
parent 571fbe9675
commit 3f6f9467c1
14 changed files with 388 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
var ref = new Object() {
int y = 23;
int x = 12;
};
Runnable r = () -> {
ref.x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,13 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
var ref = new Object() {
int x = 12;
int y = 23;
};
Runnable r = () -> {
ref.x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,16 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
var ref1 = new Object() {
int x = 12;
};
var ref = new Object() {
int y = 23;
}
ref.y++;
Runnable r = () -> {
ref1.x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,11 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
var ref = new Object() {
int x = 12;
};
Runnable r = () -> {
ref.x++;
};
}
}

View File

@@ -0,0 +1,13 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
var ref = new Object() {
int y = 23;
}
int x = 12;
Runnable r = () -> {
<caret>x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,13 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
int x = 12;
var ref = new Object() {
int y = 23;
}
Runnable r = () -> {
<caret>x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,14 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
int x = 12;
var ref = new Object() {
int y = 23;
}
ref.y++;
Runnable r = () -> {
<caret>x++;
ref.y++;
};
}
}

View File

@@ -0,0 +1,9 @@
// "Convert 'x' to field in anonymous class" "true"
class Test {
public void test() {
int x = 12;
Runnable r = () -> {
x<caret>++;
};
}
}

View File

@@ -0,0 +1,8 @@
// "Convert 'x' to field in anonymous class" "false"
class Test {
public void test(int x) {
Runnable r = () -> {
x<caret>++;
};
}
}

View File

@@ -0,0 +1,8 @@
// "Convert 'x' to field in anonymous class" "false"
class Test {
public void test() {
Runnable r = () -> {
x<caret>++;
};
}
}