SonarLint does not identify this ambiguous method call

  • Operating system: macOS Ventura 13.0.1
  • SonarLint plugin version:
  • Programming language you’re coding in: Java
  • Is connected mode used: No

Consider a class with two methods:

public void ambiguous(Consumer<String> arg) {}
public void ambiguous(Function<String, String> arg) {}

You can make simple calls like ambiguous(s -> ""), but anything else is too ambiguous for the lexer.
For example:

ambiguous(s -> System.out.println());

You would have to refactor your call to:

ambiguous(s -> {

SonarLint does not seem to understand this.
Rather it reports java:S1602 on the opening {.

My current workaround is to annotate methods with @SuppressWarnings("java:S1602").