mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 18:15:55 +00:00
[java8] Support in delombok for method references.
This commit is contained in:
1 parent
81ba6ee5f5
commit
c7bfba873e
3 files changed
+117
-4
No files matched your search
@@ -0,0 +1,48 @@
|
||||
// version 8:
|
||||
class MethodReference {
|
||||
public MethodReference() {
|
||||
}
|
||||
|
||||
public <T> MethodReference(T in) {
|
||||
}
|
||||
|
||||
public void simpleInstanceReference() {
|
||||
Runnable r = this::foo;
|
||||
}
|
||||
|
||||
public void simpleConstructorReference() {
|
||||
Runnable r = MethodReference::new;
|
||||
}
|
||||
|
||||
public void simpleStaticReference() {
|
||||
Runnable r = MethodReference::staticFoo;
|
||||
}
|
||||
|
||||
public void generifiedStaticReference() {
|
||||
StringConverter sc = MethodReference::<String>generifiedStaticFoo;
|
||||
}
|
||||
|
||||
public void generifiedConstructorReference() {
|
||||
FooConverter<MethodReference> fc = MethodReference::<String>new;
|
||||
}
|
||||
|
||||
public void foo() {
|
||||
}
|
||||
|
||||
private static void staticFoo() {
|
||||
}
|
||||
|
||||
public static <T> T generifiedStaticFoo(T foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface StringConverter {
|
||||
public String hello(String x);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface FooConverter<K> {
|
||||
public K hello(String x);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user