Kotlin: Run java-interface-redeclares-tostring on all platforms

This commit is contained in:
Ian Lynagh
2022-10-31 14:52:19 +00:00
parent 2796d60d79
commit d3934c97ed
5 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
public interface Test {
String toString();
int hashCode();
boolean equals(Object other);
}

View File

@@ -0,0 +1,4 @@
| equals | Test |
| hashCode | Test |
| toString | Test |
| toString | java.lang.CharSequence |

View File

@@ -0,0 +1,5 @@
from create_database_utils import *
os.mkdir('bin')
runSuccessfully(["javac", "Test.java", "-d", "bin"])
run_codeql_database_create(["kotlinc user.kt -cp bin"], lang="java")

View File

@@ -0,0 +1,7 @@
import java
from Method m
where
m.getDeclaringType().getName() = ["Test", "CharSequence"] and
m.getName() = ["toString", "equals", "hashCode"]
select m.getName(), m.getDeclaringType().getQualifiedName()

View File

@@ -0,0 +1 @@
fun f(t: Test, cs: CharSequence) = t.toString() + cs.toString() + t.equals(1) + t.hashCode()