Fix false positives in java/unused parameter

Methods that are mentioned in a member reference expression should count
as rootdefs for the unused parameter query. Such methods have to match
the functional interface of the reference expression, so it is to be
expected that they will sometimes have to declare parameters that they
don't actually use.
This commit is contained in:
Henning Makholm
2019-02-07 21:12:17 +01:00
parent 87c5872bc5
commit b8a03464bf
2 changed files with 15 additions and 0 deletions

View File

@@ -40,6 +40,10 @@ abstract class C implements I {
}
}
interface F {
void doSomething(int arg2);
}
public class Test {
// OK: external interface
public static void main(String[] args) {}
@@ -54,6 +58,13 @@ public class Test {
public static void foo(Object bar) {
throw new UnsupportedOperationException();
}
public static F getF() {
return Test::myFImplementation;
}
// OK: mentioned in member reference
private static void myFImplementation(int foo) {}
// OK: native method
native int baz(int x);