Skip to content

Commit 95fdea8

Browse files
authored
Merge pull request github#11308 from tamasvajk/kotlin-non-serializable-field
Kotlin: Exclude .kt files from non serializable field query
2 parents 1118830 + 7d9ce53 commit 95fdea8

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

java/ql/src/Likely Bugs/Serialization/NonSerializableField.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ predicate exceptions(Class c, Field f) {
9090

9191
from Class c, Field f, string reason
9292
where
93-
c.fromSource() and
93+
c.getFile().isJavaSourceFile() and
9494
c.getAStrictAncestor() instanceof TypeSerializable and
9595
f.getDeclaringType() = c and
9696
not exceptions(c, f) and

java/ql/test/kotlin/query-tests/NonSerializableField/NonSerializableField.expected

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Likely Bugs/Serialization/NonSerializableField.ql
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Foo {
2+
fun f(i: Int) {}
3+
fun g(i: Int) { (this::f)(i) }
4+
}

0 commit comments

Comments
 (0)