anonym -> lambda: decode context correctly

This commit is contained in:
Anna Kozlova
2012-09-10 14:57:44 +04:00
parent 0292d5471f
commit b665d21263
8 changed files with 118 additions and 34 deletions

View File

@@ -2,13 +2,13 @@
class Test {
{
Comparable<String> c = o -> {
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println(o);
}
};
return 0;
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println(o);
}
};
return 0;
};
}
}

View File

@@ -2,8 +2,8 @@
class Test {
{
Comparable<String> c = o -> {
System.out.println();
return 0;
System.out.println();
return 0;
};
}
}

View File

@@ -0,0 +1,16 @@
// "Replace with lambda" "true"
class Test {
interface I {
}
interface Bar extends I {
int smth = 0;
int compare(String o1, String o2);
}
{
I bar2 = (Bar) (o1, o2) -> {
System.out.println(Bar.smth);
return 0;
};
}
}

View File

@@ -2,7 +2,7 @@
class Test {
{
Runnable r = () -> {
System.out.println("");
System.out.println("");
};
}
}

View File

@@ -2,7 +2,7 @@
class Test {
{
Runnable[] r = new Runnable[] {() -> {
System.out.println("");
System.out.println("");
}};
}
}

View File

@@ -0,0 +1,18 @@
// "Replace with lambda" "false"
class Test {
interface I {
}
interface Bar extends I {
int compare(String o1, String o2);
}
{
I bar2 = new Ba<caret>r() {
int k;
@Override
public int compare(String o1, String o2) {
return 0;
}
};
}
}

View File

@@ -0,0 +1,19 @@
// "Replace with lambda" "true"
class Test {
interface I {
}
interface Bar extends I {
int smth = 0;
int compare(String o1, String o2);
}
{
I bar2 = new Ba<caret>r() {
@Override
public int compare(String o1, String o2) {
System.out.println(smth);
return 0;
}
};
}
}