mirror of
https://github.com/github/codeql.git
synced 2025-12-23 20:26:32 +01:00
Kotlin: make internal constructors' trap labels consistent with the Java extractor
Previously we accidentally named these something like <init>$main, which is a name-mangling the Kotlin compiler applies to internal methods but not to constructors, which look to Java just like regular public constructors.
This commit is contained in:
@@ -813,7 +813,7 @@ open class KotlinUsesExtractor(
|
||||
OperatorNameConventions.INVOKE.asString())
|
||||
|
||||
fun getSuffixIfInternal() =
|
||||
if (f.visibility == DescriptorVisibilities.INTERNAL) {
|
||||
if (f.visibility == DescriptorVisibilities.INTERNAL && f !is IrConstructor) {
|
||||
"\$" + getJvmModuleName(f)
|
||||
} else {
|
||||
""
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class User {
|
||||
|
||||
public static void test() { new Test(1, 2); }
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
| User.java:3:31:3:44 | new Test(...) | test.kt:3:3:3:51 | { ... } |
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Test() {
|
||||
|
||||
internal constructor(x: Int, y: Int) : this() { }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import java
|
||||
|
||||
from ClassInstanceExpr ce
|
||||
select ce, ce.getConstructor().getBody()
|
||||
Reference in New Issue
Block a user