mirror of
https://github.com/github/codeql.git
synced 2026-02-28 21:03:50 +01:00
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:
@@ -292,6 +292,10 @@ class RootdefCallable extends Callable {
|
||||
// a body that also doesn't.
|
||||
not hasUsefulBody(this) and
|
||||
not exists(Method m | hasUsefulBody(m) | m.overridesOrInstantiates+(this))
|
||||
or
|
||||
// Methods that are the target of a member reference need to implement
|
||||
// the exact signature of the resulting functional interface.
|
||||
exists(MemberRefExpr mre | mre.getReferencedCallable() = this)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user