Skip to content

Commit c7a6b1e

Browse files
authored
Merge pull request #9640 from igfoo/igfoo/vis
Kotlin/Java: Add the beginnings of a "visibility" consistency query
2 parents aea4910 + 52b2290 commit c7a6b1e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import java
2+
3+
string visibility(Method m) {
4+
result = "public" and m.isPublic()
5+
or
6+
result = "protected" and m.isProtected()
7+
or
8+
result = "private" and m.isPrivate()
9+
or
10+
result = "internal" and m.isInternal()
11+
}
12+
13+
// TODO: This ought to check more than just methods
14+
from Method m
15+
where
16+
// TODO: This ought to work for everything, but for now we
17+
// restrict to things in Kotlin source files
18+
m.getFile().isKotlinSourceFile() and
19+
// TODO: This ought to have visibility information
20+
not m.getName() = "<clinit>" and
21+
count(visibility(m)) != 1
22+
select m, concat(visibility(m), ", ")

0 commit comments

Comments
 (0)