From ec5ac17f87b2ff30a497d82bc910d260fe64c072 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Mon, 31 Oct 2022 10:01:46 +0100 Subject: [PATCH] Kotlin: Excluded compiler generated methods from `java/confusing-method-signature` --- .../Naming Conventions/ConfusingOverloading.ql | 2 ++ .../ConfusingMethodSignature/ConfusingMethodSignature.expected | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/java/ql/src/Violations of Best Practice/Naming Conventions/ConfusingOverloading.ql b/java/ql/src/Violations of Best Practice/Naming Conventions/ConfusingOverloading.ql index e3ac1384243..6034d35bff3 100644 --- a/java/ql/src/Violations of Best Practice/Naming Conventions/ConfusingOverloading.ql +++ b/java/ql/src/Violations of Best Practice/Naming Conventions/ConfusingOverloading.ql @@ -137,6 +137,8 @@ private predicate delegate(Method caller, Method callee) { from Method m, Method n, string messageQualifier where + // Exclude compiler generated methods, such as Kotlin `$default` methods: + not m.isCompilerGenerated() and confusinglyOverloaded(m, n) and ( if m.getDeclaringType() = n.getDeclaringType() diff --git a/java/ql/test/kotlin/query-tests/ConfusingMethodSignature/ConfusingMethodSignature.expected b/java/ql/test/kotlin/query-tests/ConfusingMethodSignature/ConfusingMethodSignature.expected index 59956f2674d..e69de29bb2d 100644 --- a/java/ql/test/kotlin/query-tests/ConfusingMethodSignature/ConfusingMethodSignature.expected +++ b/java/ql/test/kotlin/query-tests/ConfusingMethodSignature/ConfusingMethodSignature.expected @@ -1 +0,0 @@ -| Test.kt:12:5:12:45 | fn$default | Method A.fn$default(..) could be confused with overloaded method $@, since dispatch depends on static types. | Test.kt:13:5:13:40 | fn$default | fn$default |