Skip to content

Commit b4b8649

Browse files
authored
Merge pull request github#11299 from tamasvajk/kotlin-nested-serializable
Kotlin: Exclude .kt files from serializable inner class query
2 parents 3894fad + 7a0e248 commit b4b8649

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ predicate exceptions(NestedClass inner) {
7777

7878
from NestedClass inner, Class outer, string advice
7979
where
80-
inner.fromSource() and
80+
inner.getFile().isJavaSourceFile() and
8181
isSerializable(inner) and
8282
outer = enclosingInstanceType+(inner) and
8383
not isSerializable(outer) and

java/ql/test/kotlin/query-tests/NonSerializableInnerClass/NonSerializableInnerClass.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/NonSerializableInnerClass.ql
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import java.io.Serializable
2+
3+
class A {
4+
class X : Serializable {
5+
}
6+
}
7+
8+
class B {
9+
inner class X : Serializable {
10+
}
11+
}

0 commit comments

Comments
 (0)