mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Add test of selective generic extraction
This commit is contained in:
committed by
Ian Lynagh
parent
b8af2e6e40
commit
4e36b2489c
@@ -0,0 +1,23 @@
|
||||
public class Test<T> {
|
||||
|
||||
public T field;
|
||||
public T method() { return field; }
|
||||
|
||||
}
|
||||
|
||||
class FieldUsed {}
|
||||
class MethodUsed {}
|
||||
class ConstructorUsed {}
|
||||
class NeitherUsed {}
|
||||
|
||||
class User {
|
||||
|
||||
public static void test(Test<NeitherUsed> neitherUsed, Test<MethodUsed> methodUsed, Test<FieldUsed> fieldUsed) {
|
||||
|
||||
fieldUsed.field = null;
|
||||
methodUsed.method();
|
||||
Test<ConstructorUsed> constructorUsed = new Test<ConstructorUsed>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
class TestKt<T> {
|
||||
|
||||
var field: T? = null
|
||||
@JvmField
|
||||
var rawField: T? = null
|
||||
fun method() = field
|
||||
|
||||
}
|
||||
|
||||
class FieldUsedKt {}
|
||||
class RawFieldUsedKt {}
|
||||
class MethodUsedKt {}
|
||||
class ConstructorUsedKt {}
|
||||
class NeitherUsedKt {}
|
||||
|
||||
class UserKt {
|
||||
|
||||
fun test(neitherUsed: TestKt<NeitherUsedKt>, methodUsed: TestKt<MethodUsedKt>, fieldUsed: TestKt<FieldUsedKt>, rawFieldUsed: TestKt<RawFieldUsedKt>) {
|
||||
|
||||
fieldUsed.field = null
|
||||
rawFieldUsed.rawField = null
|
||||
methodUsed.method()
|
||||
val constructorUsed = TestKt<ConstructorUsedKt>()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
| Test.class:0:0:0:0 | Test<ConstructorUsed> | Test.class:0:0:0:0 | Test<ConstructorUsed> |
|
||||
| Test.class:0:0:0:0 | Test<ConstructorUsed> | Test.class:0:0:0:0 | method |
|
||||
| Test.class:0:0:0:0 | Test<MethodUsed> | Test.class:0:0:0:0 | Test<MethodUsed> |
|
||||
| Test.class:0:0:0:0 | Test<MethodUsed> | Test.class:0:0:0:0 | method |
|
||||
| Test.java:1:14:1:17 | Test | Test.java:1:14:1:17 | Test |
|
||||
| Test.java:1:14:1:17 | Test | Test.java:3:12:3:16 | field |
|
||||
| Test.java:1:14:1:17 | Test | Test.java:4:12:4:17 | method |
|
||||
| Test.java:8:7:8:15 | FieldUsed | Test.java:8:7:8:15 | FieldUsed |
|
||||
| Test.java:9:7:9:16 | MethodUsed | Test.java:9:7:9:16 | MethodUsed |
|
||||
| Test.java:10:7:10:21 | ConstructorUsed | Test.java:10:7:10:21 | ConstructorUsed |
|
||||
| Test.java:11:7:11:17 | NeitherUsed | Test.java:11:7:11:17 | NeitherUsed |
|
||||
| Test.java:13:7:13:10 | User | Test.java:13:7:13:10 | User |
|
||||
| Test.java:13:7:13:10 | User | Test.java:15:22:15:25 | test |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:1:1:8:1 | <obinit> |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:1:1:8:1 | TestKt |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:1:1:8:1 | equals |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:1:1:8:1 | hashCode |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:1:1:8:1 | toString |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:3:3:3:22 | <get-field> |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:3:3:3:22 | <set-field> |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:3:3:3:22 | field |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:4:3:5:25 | rawField |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:5:3:5:25 | <get-rawField> |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:5:3:5:25 | <set-rawField> |
|
||||
| Test.kt:0:0:0:0 | TestKt | Test.kt:6:3:6:22 | method |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:1:1:8:1 | <obinit> |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:1:1:8:1 | TestKt |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:1:1:8:1 | equals |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:1:1:8:1 | hashCode |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:1:1:8:1 | toString |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:3:3:3:22 | <get-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:3:3:3:22 | <set-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:3:3:3:22 | field |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:4:3:5:25 | rawField |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:5:3:5:25 | <get-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:5:3:5:25 | <set-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt | Test.kt:6:3:6:22 | method |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:1:1:8:1 | TestKt<FieldUsedKt> |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:1:1:8:1 | equals |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:1:1:8:1 | hashCode |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:1:1:8:1 | toString |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:3:3:3:22 | <get-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:3:3:3:22 | <set-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:5:3:5:25 | <get-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:5:3:5:25 | <set-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<FieldUsedKt> | Test.kt:6:3:6:22 | method |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:1:1:8:1 | TestKt<MethodUsedKt> |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:1:1:8:1 | equals |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:1:1:8:1 | hashCode |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:1:1:8:1 | toString |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:3:3:3:22 | <get-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:3:3:3:22 | <set-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:5:3:5:25 | <get-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:5:3:5:25 | <set-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<MethodUsedKt> | Test.kt:6:3:6:22 | method |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:1:1:8:1 | equals |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:1:1:8:1 | hashCode |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:1:1:8:1 | toString |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:3:3:3:22 | <get-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:3:3:3:22 | <set-field> |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:5:3:5:25 | <get-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:5:3:5:25 | <set-rawField> |
|
||||
| Test.kt:1:1:8:1 | TestKt<RawFieldUsedKt> | Test.kt:6:3:6:22 | method |
|
||||
| Test.kt:10:1:10:20 | FieldUsedKt | Test.kt:10:1:10:20 | <obinit> |
|
||||
| Test.kt:10:1:10:20 | FieldUsedKt | Test.kt:10:1:10:20 | FieldUsedKt |
|
||||
| Test.kt:10:1:10:20 | FieldUsedKt | Test.kt:10:1:10:20 | equals |
|
||||
| Test.kt:10:1:10:20 | FieldUsedKt | Test.kt:10:1:10:20 | hashCode |
|
||||
| Test.kt:10:1:10:20 | FieldUsedKt | Test.kt:10:1:10:20 | toString |
|
||||
| Test.kt:11:1:11:23 | RawFieldUsedKt | Test.kt:11:1:11:23 | <obinit> |
|
||||
| Test.kt:11:1:11:23 | RawFieldUsedKt | Test.kt:11:1:11:23 | RawFieldUsedKt |
|
||||
| Test.kt:11:1:11:23 | RawFieldUsedKt | Test.kt:11:1:11:23 | equals |
|
||||
| Test.kt:11:1:11:23 | RawFieldUsedKt | Test.kt:11:1:11:23 | hashCode |
|
||||
| Test.kt:11:1:11:23 | RawFieldUsedKt | Test.kt:11:1:11:23 | toString |
|
||||
| Test.kt:12:1:12:21 | MethodUsedKt | Test.kt:12:1:12:21 | <obinit> |
|
||||
| Test.kt:12:1:12:21 | MethodUsedKt | Test.kt:12:1:12:21 | MethodUsedKt |
|
||||
| Test.kt:12:1:12:21 | MethodUsedKt | Test.kt:12:1:12:21 | equals |
|
||||
| Test.kt:12:1:12:21 | MethodUsedKt | Test.kt:12:1:12:21 | hashCode |
|
||||
| Test.kt:12:1:12:21 | MethodUsedKt | Test.kt:12:1:12:21 | toString |
|
||||
| Test.kt:13:1:13:26 | ConstructorUsedKt | Test.kt:13:1:13:26 | <obinit> |
|
||||
| Test.kt:13:1:13:26 | ConstructorUsedKt | Test.kt:13:1:13:26 | ConstructorUsedKt |
|
||||
| Test.kt:13:1:13:26 | ConstructorUsedKt | Test.kt:13:1:13:26 | equals |
|
||||
| Test.kt:13:1:13:26 | ConstructorUsedKt | Test.kt:13:1:13:26 | hashCode |
|
||||
| Test.kt:13:1:13:26 | ConstructorUsedKt | Test.kt:13:1:13:26 | toString |
|
||||
| Test.kt:14:1:14:22 | NeitherUsedKt | Test.kt:14:1:14:22 | <obinit> |
|
||||
| Test.kt:14:1:14:22 | NeitherUsedKt | Test.kt:14:1:14:22 | NeitherUsedKt |
|
||||
| Test.kt:14:1:14:22 | NeitherUsedKt | Test.kt:14:1:14:22 | equals |
|
||||
| Test.kt:14:1:14:22 | NeitherUsedKt | Test.kt:14:1:14:22 | hashCode |
|
||||
| Test.kt:14:1:14:22 | NeitherUsedKt | Test.kt:14:1:14:22 | toString |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:16:1:27:1 | <obinit> |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:16:1:27:1 | UserKt |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:16:1:27:1 | equals |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:16:1:27:1 | hashCode |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:16:1:27:1 | toString |
|
||||
| Test.kt:16:1:27:1 | UserKt | Test.kt:18:3:25:3 | test |
|
||||
@@ -0,0 +1,6 @@
|
||||
import java
|
||||
|
||||
from RefType rt, Member m
|
||||
where rt.getSourceDeclaration().fromSource()
|
||||
and m.getDeclaringType() = rt
|
||||
select rt, m
|
||||
Reference in New Issue
Block a user