anonymous can be method reference inspection

This commit is contained in:
anna
2012-10-09 20:22:06 +02:00
parent 2e599091fd
commit fced71498b
10 changed files with 401 additions and 110 deletions

View File

@@ -0,0 +1,13 @@
// "Replace with method reference" "true"
class Test {
interface Bar {
int compare(String o1, String o2);
}
static int c(String o1, String o2) {
return 0;
}
{
Bar bar2 = Test::c;
}
}

View File

@@ -0,0 +1,14 @@
// "Replace with method reference" "true"
class Test {
interface I {}
interface Bar extends I {
int compare(String o1, String o2);
}
static int c(String o1, String o2) {
return 0;
}
{
I bar2 = (Bar) Test::c;
}
}

View File

@@ -0,0 +1,18 @@
// "Replace with method reference" "true"
class Test {
interface Bar {
int compare(String o1, String o2);
}
static int c(String o1, String o2) {
return 0;
}
{
Bar bar2 = new B<caret>ar() {
@Override
public int compare(final String o1, final String o2) {
return c(o1, o2);
}
};
}
}

View File

@@ -0,0 +1,19 @@
// "Replace with method reference" "true"
class Test {
interface I {}
interface Bar extends I {
int compare(String o1, String o2);
}
static int c(String o1, String o2) {
return 0;
}
{
I bar2 = new B<caret>ar() {
@Override
public int compare(final String o1, final String o2) {
return c(o1, o2);
}
};
}
}

View File

@@ -0,0 +1,15 @@
// "Replace with method reference" "false"
class Test {
public interface I {
int m();
}
{
I i = new <caret>I() {
@Override
public int m() {
return m();
}
};
}
}