Files
openide/java/java-impl/resources/inspectionDescriptions/LambdaUnfriendlyMethodOverload.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

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&lt;?&gt; supplier);
void execute(Callable&lt;?&gt; 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>