Skip to content

Commit 15aab71

Browse files
committed
Kotlin: Add test showing missing java modifier
1 parent fd57153 commit 15aab71

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package extlib;
2+
3+
public class A {
4+
protected void m() {}
5+
}
6+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| extlib.jar/extlib/A.class:0:0:0:0 | m | |
2+
| test.kt:4:12:4:22 | m | override, protected |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import extlib.A;
2+
3+
class B : A() {
4+
override fun m() { }
5+
}
6+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from create_database_utils import *
2+
import glob
3+
4+
# Compile Java untraced. Note the Java source is hidden under `javasrc` so the Kotlin compiler
5+
# will certainly reference the jar, not the source or class file for extlib.Lib
6+
7+
os.mkdir('build')
8+
runSuccessfully(["javac"] + glob.glob("libsrc/extlib/*.java") + ["-d", "build"])
9+
runSuccessfully(["jar", "cf", "extlib.jar", "-C", "build", "extlib"])
10+
run_codeql_database_create(["kotlinc test.kt -cp extlib.jar"], lang="java")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import java
2+
3+
query predicate mods(Method m, string modifiers) {
4+
m.getName() = "m" and
5+
modifiers = concat(string s | m.hasModifier(s) | s, ", ")
6+
}

0 commit comments

Comments
 (0)