-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for method references invoking extension methods #665
base: master
Are you sure you want to change the base?
Add support for method references invoking extension methods #665
Conversation
Looking good! Does it handle all types of method references? Foo foo = getFoo();
// where
(a, b) -> foo.bar(a, b)
// replaces
foo::bar |
Yes, there is already a test for that case. Map<String, Integer> map = new LinkedHashMap<>();
map.add( "Foo", 1 );
map.add( "Bar", 2 );
assertEquals( Arrays.asList( "Foo1", "Bar2"),
map.map( String::concatenate ).collect( Collectors.toList())); Is replaced by: Map<String, Integer> map = new LinkedHashMap();
MyMapExt.add(map, "Foo", 1);
MyMapExt.add(map, "Bar", 2);
assertEquals(Arrays.asList("Foo1", "Bar2"),
MyMapExt.map(map, (var0, var1) -> MyStringExt.concatenate(var0, var1)).collect(Collectors.toList())); I've already implemented support for extension methods and structural interfaces. |
5861010
to
1f237ce
Compare
1f237ce
to
ad22565
Compare
@rsmckinney I believe this PR is ready. I've tested it with a real project, and I didn't encounter any issues. IntelliJ is still complaining ("Extension method ... must be invoked as a lambda expression here"), but the code is compiling fine. So I guess an update of the IntelliJ plugin is also needed. |
#664