mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
20 lines
830 B
HTML
20 lines
830 B
HTML
<html>
|
|
<body>
|
|
Reports overloaded methods that take functional interfaces with conflicting abstract method signatures.
|
|
<p>Such overloads introduce ambiguity and require callers to cast lambdas to a specific type or specify lambda parameter types explicitly.
|
|
It is preferable to give the overloaded methods different names to eliminate ambiguity.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
interface MyExecutor {
|
|
void execute(Supplier<?> supplier);
|
|
void execute(Callable<?> callable);
|
|
}
|
|
</code></pre>
|
|
<p>
|
|
Here, <code>Supplier</code> and <code>Callable</code> are functional interfaces
|
|
whose single abstract methods do not take any parameters and return a non-void value.
|
|
As a result, the type of the lambda cannot be inferred at the call site unless an explicit cast is used.
|
|
</p>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |