mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
anonymous can be method reference inspection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user