зеркало из https://github.com/github/codeql.git
Avoid using count(...) = 0
This commit is contained in:
Родитель
0024e54e63
Коммит
1d8547d4c1
|
@ -10,6 +10,8 @@ string visibility(Method m) {
|
|||
result = "internal" and m.isInternal()
|
||||
}
|
||||
|
||||
predicate hasPackagePrivateVisibility(Method m) { not exists(visibility(m)) }
|
||||
|
||||
// TODO: This ought to check more than just methods
|
||||
from Method m
|
||||
where
|
||||
|
@ -20,5 +22,5 @@ where
|
|||
not m.getName() = "<clinit>" and
|
||||
count(visibility(m)) != 1 and
|
||||
not (count(visibility(m)) = 2 and visibility(m) = "public" and visibility(m) = "internal") and // This is a reasonable result, since the JVM symbol is declared public, but Kotlin metadata flags it as internal
|
||||
not (count(visibility(m)) = 0 and m.getName().matches("%$default")) // This is a reasonable result because the $default forwarder methods corresponding to private methods are package-private.
|
||||
not (hasPackagePrivateVisibility(m) and m.getName().matches("%$default")) // This is a reasonable result because the $default forwarder methods corresponding to private methods are package-private.
|
||||
select m, concat(visibility(m), ", ")
|
||||
|
|
Загрузка…
Ссылка в новой задаче