The method is ambiguous for the type
@snjeza đang làm issue này rồi.
Từ ngày 4/3/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Type: Bug
VS Code is showing error for this code snippet that standard javac has no problem with. It's a combination of having overload methods accepting two different interfaces and a lambda expression that's using while loop.
public class Test {
public static void main(String[] args) throws Exception {
System.out.println("Hello, World!");
test(x -> {
while (x.length() > 0) {
System.out.println(x);
x = x.substring(1);
}
});
}
public static void test(Consumer<String> consumer) {
consumer.accept("Hello, World!");
}
public static void test(Function<String, Integer> function) {
System.out.println(function.apply("Hello, World!"));
}
public interface Consumer<T> {
void accept(T t);
}
public interface Function<T, R> {
R apply(T t);
}
}
Error: The method test(Test.Consumer) is ambiguous for the type Test
Extension version: 1.39.0
VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Linux x64 5.4.0-205-generic
Modes:
- Ngôn ngữ chính
- TypeScript
- Star
- 2.3k
- Fork
- 547
- Merge trung bình
- 20 giờ 1 phút
- Pull request đã merge (30 ngày)
- 11
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của redhat-developer/vscode-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
redhat-developer/vscode-java#4426 ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
redhat-developer/vscode-java#4506 · 3 bình luận · 4 reaction ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
redhat-developer/vscode-java#4505 · 1 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
redhat-developer/vscode-java#4504 · 3 bình luận · 1 reaction ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
redhat-developer/vscode-java#4502 ·
Tất cả issue của redhat-developer/vscode-java
Issue tương tự
-
comp/dashboard P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
NousResearch/hermes-agent#117722 ·
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
-
code-quality refactoring
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
langchain-ai/deepagents#6450 ·