From 7a0e2480963e1dc4a0e84afb999690f0db891de5 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 16 Nov 2022 14:46:01 +0100 Subject: [PATCH] Exclude .kt files from serializable inner class query --- .../src/Likely Bugs/Serialization/NonSerializableInnerClass.ql | 2 +- .../NonSerializableInnerClass.expected | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/java/ql/src/Likely Bugs/Serialization/NonSerializableInnerClass.ql b/java/ql/src/Likely Bugs/Serialization/NonSerializableInnerClass.ql index 1bf54abb89f0..8081c551eed3 100644 --- a/java/ql/src/Likely Bugs/Serialization/NonSerializableInnerClass.ql +++ b/java/ql/src/Likely Bugs/Serialization/NonSerializableInnerClass.ql @@ -77,7 +77,7 @@ predicate exceptions(NestedClass inner) { from NestedClass inner, Class outer, string advice where - inner.fromSource() and + inner.getFile().isJavaSourceFile() and isSerializable(inner) and outer = enclosingInstanceType+(inner) and not isSerializable(outer) and diff --git a/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected index a8db2188711a..e69de29bb2d1 100644 --- a/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected +++ b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected @@ -1,2 +0,0 @@ -| NonSerializableInnerClassTest.kt:4:3:5:3 | X | Serializable inner class of non-serializable class $@. Consider making the class static or implementing readObject() and writeObject(). | NonSerializableInnerClassTest.kt:3:1:6:1 | A | A | -| NonSerializableInnerClassTest.kt:9:3:10:3 | X | Serializable inner class of non-serializable class $@. Consider making the class static or implementing readObject() and writeObject(). | NonSerializableInnerClassTest.kt:8:1:11:1 | B | B |