From 782c82a2d3921def4d2e7ecf0958e5adb35ebe71 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 16 Nov 2022 14:30:54 +0100 Subject: [PATCH] Kotlin: Add test case for non serializable inner class query --- .../NonSerializableInnerClass.expected | 2 ++ .../NonSerializableInnerClass.qlref | 1 + .../NonSerializableInnerClassTest.kt | 11 +++++++++++ 3 files changed, 14 insertions(+) create mode 100644 java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected create mode 100644 java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.qlref create mode 100644 java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClassTest.kt diff --git a/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected new file mode 100644 index 000000000000..a8db2188711a --- /dev/null +++ b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.expected @@ -0,0 +1,2 @@ +| 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 | diff --git a/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.qlref b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.qlref new file mode 100644 index 000000000000..4cbb0995764d --- /dev/null +++ b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.qlref @@ -0,0 +1 @@ +Likely Bugs/Serialization/NonSerializableInnerClass.ql diff --git a/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClassTest.kt b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClassTest.kt new file mode 100644 index 000000000000..3c3d72d0291b --- /dev/null +++ b/java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClassTest.kt @@ -0,0 +1,11 @@ +import java.io.Serializable + +class A { + class X : Serializable { + } +} + +class B { + inner class X : Serializable { + } +}