forked from projectlombok/lombok
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fixes projectlombok#3225] Handle ambiguous extension methods
- Loading branch information
Showing
6 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
test/transform/resource/after-delombok/ExtensionMethodAmbiguousFunctional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//skip-idempotent | ||
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
|
||
class ExtensionMethodAmbiguousFunctional { | ||
public void test() { | ||
ExtensionMethodAmbiguousFunctional.Extensions.ambiguous("", System.out::println); | ||
} | ||
|
||
static class Extensions { | ||
public static <T, R> void ambiguous(T t, Function<T, R> function) { | ||
} | ||
|
||
public static <T> void ambiguous(T t, Consumer<T> function) { | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
test/transform/resource/after-ecj/ExtensionMethodAmbiguousFunctional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
import lombok.experimental.ExtensionMethod; | ||
@ExtensionMethod({ExtensionMethodAmbiguousFunctional.Extensions.class}) class ExtensionMethodAmbiguousFunctional { | ||
static class Extensions { | ||
Extensions() { | ||
super(); | ||
} | ||
public static <T, R>void ambiguous(T t, Function<T, R> function) { | ||
} | ||
public static <T>void ambiguous(T t, Consumer<T> function) { | ||
} | ||
} | ||
ExtensionMethodAmbiguousFunctional() { | ||
super(); | ||
} | ||
public void test() { | ||
"".ambiguous(System.out::println); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
test/transform/resource/before/ExtensionMethodAmbiguousFunctional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//version 8: | ||
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
|
||
import lombok.experimental.ExtensionMethod; | ||
|
||
@ExtensionMethod({ExtensionMethodAmbiguousFunctional.Extensions.class}) | ||
class ExtensionMethodAmbiguousFunctional { | ||
public void test() { | ||
"".ambiguous(System.out::println); | ||
} | ||
|
||
static class Extensions { | ||
public static <T, R> void ambiguous(T t, Function<T, R> function) { | ||
} | ||
|
||
public static <T> void ambiguous(T t, Consumer<T> function) { | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-delombok/ExtensionMethodAmbiguousFunctional.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 reference to ambiguous is ambiguous both method <T,R>ambiguous(T,java.util.function.Function<T,R>) in ExtensionMethodAmbiguousFunctional.Extensions and method <T>ambiguous(T,java.util.function.Consumer<T>) in ExtensionMethodAmbiguousFunctional.Extensions match |
1 change: 1 addition & 0 deletions
1
test/transform/resource/messages-ecj/ExtensionMethodAmbiguousFunctional.java.messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10 The method ambiguous(String, Function<String,Object>) is ambiguous for the type ExtensionMethodAmbiguousFunctional.Extensions |