mirror of
https://github.com/tiennm99/lombok.git
synced 2026-09-10 04:19:56 +00:00
[fixes #3402] Delay replacement of extension methods in arguments
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// version 8:
|
||||
import java.util.function.Function;
|
||||
import lombok.experimental.ExtensionMethod;
|
||||
|
||||
@ExtensionMethod(value = ExtensionMethodInLambda.Extensions.class)
|
||||
public class ExtensionMethodInLambda {
|
||||
public void testSimple() {
|
||||
String test = "test";
|
||||
test = test.map(s -> s.reverse());
|
||||
}
|
||||
|
||||
public void testSameName() {
|
||||
String test = "test";
|
||||
test = test.map(s -> s.trim());
|
||||
}
|
||||
|
||||
public void testArgumentOfInvalidMethod() {
|
||||
String test = "test";
|
||||
test.invalid(s -> s.reverse());
|
||||
}
|
||||
|
||||
static class Extensions {
|
||||
public static <T, R> R map(T value, Function<T, R> mapper) {
|
||||
return mapper.apply(value);
|
||||
}
|
||||
|
||||
public static String reverse(String string) {
|
||||
return new StringBuilder(string).reverse().toString();
|
||||
}
|
||||
|
||||
public static String trim(Integer integer) {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user