mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
lambda: convert anonymous to lambda inspection & fix
This commit is contained in:
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> c = (o)->{
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> c = (final String o)->{
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(o);
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test2 {
|
||||
|
||||
interface I<X> {
|
||||
X foo(List<X> list);
|
||||
}
|
||||
|
||||
static <T> I<T> bar(I<T> i){return i;}
|
||||
|
||||
{
|
||||
bar((List<String> list)->{
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
});
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable r = ()->{
|
||||
System.out.println("");
|
||||
};
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable[] r = new Runnable[] {()->{
|
||||
System.out.println("");
|
||||
}};
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with lambda" "false"
|
||||
class Test {
|
||||
{
|
||||
A a = new A<caret>("str") {
|
||||
@Override
|
||||
public void foo() {
|
||||
}
|
||||
};
|
||||
}
|
||||
static class A {
|
||||
A(String s) {
|
||||
}
|
||||
|
||||
public void foo(){}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with lambda" "false"
|
||||
class Test {
|
||||
{
|
||||
new Ru<caret>nnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
}.getClass();;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> c = new Compa<caret>rable<String>() {
|
||||
@Override
|
||||
public int compareTo(String o) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Comparable<String> c = new Compa<caret>rable<String>() {
|
||||
@Override
|
||||
public int compareTo(final String o) {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println(o);
|
||||
}
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test2 {
|
||||
|
||||
interface I<X> {
|
||||
X foo(List<X> list);
|
||||
}
|
||||
|
||||
static <T> I<T> bar(I<T> i){return i;}
|
||||
|
||||
{
|
||||
bar(new I<Stri<caret>ng>() {
|
||||
@Override
|
||||
public String foo(List<String> list) {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with lambda" "false"
|
||||
class Test {
|
||||
{
|
||||
Runnable a = new Run<caret>nable() {
|
||||
@Override
|
||||
public void run()
|
||||
};
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable r = new Run<caret>nable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with lambda" "true"
|
||||
class Test {
|
||||
{
|
||||
Runnable[] r = new Runnable[] {new Run<caret>nable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("");
|
||||
}
|
||||
}};
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with lambda" "false"
|
||||
class Test {
|
||||
{
|
||||
Runnable r = new Ru<caret>nnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
helper();
|
||||
}
|
||||
private void helper(){}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user