mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Add more annotation tests, add KClass to Class substitution
This commit is contained in:
committed by
Chris Smowton
parent
f465dd5362
commit
3e1d4a7400
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||
import org.jetbrains.kotlin.ir.util.parentClassOrNull
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
// Adapted from Kotlin's interpreter/Utils.kt function 'internalName'
|
||||
// Translates class names into their JLS section 13.1 binary name,
|
||||
@@ -119,4 +120,10 @@ fun getContainingClassOrSelf(decl: IrDeclaration): IrClass? {
|
||||
}
|
||||
|
||||
fun getJavaEquivalentClassId(c: IrClass) =
|
||||
c.fqNameWhenAvailable?.toUnsafe()?.let { JavaToKotlinClassMap.mapKotlinToJava(it) }
|
||||
c.fqNameWhenAvailable?.toUnsafe()?.let {
|
||||
if (it.asString() == "kotlin.reflect.KClass") {
|
||||
ClassId.fromString("java.lang.Class")
|
||||
} else {
|
||||
JavaToKotlinClassMap.mapKotlinToJava(it)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user