Skip to content

Commit d511d46

Browse files
committed
Kotlin: Use packageFqName rather than fqName
Upstream master says: error: using 'fqName: FqName' is an error. Please use `packageFqName` instead
1 parent 261ba8e commit d511d46

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ open class KotlinFileExtractor(
107107
fun extractFileContents(file: IrFile, id: Label<DbFile>) {
108108
with("file", file) {
109109
val locId = tw.getWholeFileLocation()
110-
val pkg = file.fqName.asString()
110+
val pkg = file.packageFqName.asString()
111111
val pkgId = extractPackage(pkg)
112112
tw.writeHasLocation(id, locId)
113113
tw.writeCupackage(id, pkgId)
@@ -1901,8 +1901,9 @@ open class KotlinFileExtractor(
19011901
verboseln("No match as didn't find target package")
19021902
return false
19031903
}
1904-
if (targetPkg.fqName.asString() != pName) {
1905-
verboseln("No match as package name is ${targetPkg.fqName.asString()}")
1904+
val targetName = targetPkg.packageFqName.asString()
1905+
if (targetName != pName) {
1906+
verboseln("No match as package name is $targetName")
19061907
return false
19071908
}
19081909
verboseln("Match")
@@ -2556,8 +2557,9 @@ open class KotlinFileExtractor(
25562557
verboseln("No match as didn't find target package")
25572558
return false
25582559
}
2559-
if (targetPkg.fqName.asString() != pkgName) {
2560-
verboseln("No match as package name is ${targetPkg.fqName.asString()} not $pkgName")
2560+
val targetName = targetPkg.packageFqName.asString()
2561+
if (targetName != pkgName) {
2562+
verboseln("No match as package name is $targetName not $pkgName")
25612563
return false
25622564
}
25632565
verboseln("Match")

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ open class KotlinUsesExtractor(
8383
)
8484

8585
fun extractFileClass(f: IrFile): Label<out DbClassorinterface> {
86-
val pkg = f.fqName.asString()
86+
val pkg = f.packageFqName.asString()
8787
val jvmName = getFileClassName(f)
8888
val id = extractFileClass(pkg, jvmName)
8989
if (tw.lm.fileClassLocationsExtracted.add(f)) {
@@ -848,7 +848,7 @@ open class KotlinUsesExtractor(
848848
when(dp) {
849849
is IrFile ->
850850
if(canBeTopLevel) {
851-
usePackage(dp.fqName.asString())
851+
usePackage(dp.packageFqName.asString())
852852
} else {
853853
extractFileClass(dp)
854854
}

java/kotlin-extractor/src/main/kotlin/PrimitiveTypeInfo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import com.github.codeql.utils.*
1212
class PrimitiveTypeMapping(val logger: Logger, val pluginContext: IrPluginContext) {
1313
fun getPrimitiveInfo(s: IrSimpleType) =
1414
s.classOrNull?.let {
15-
if ((it.owner.parent as? IrPackageFragment)?.fqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
15+
if ((it.owner.parent as? IrPackageFragment)?.packageFqName == StandardNames.BUILT_INS_PACKAGE_FQ_NAME)
1616
mapping[it.owner.name]
1717
else
1818
null

java/kotlin-extractor/src/main/kotlin/utils/ClassNames.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fun getFileClassName(f: IrFile) =
3333
fun getIrElementBinaryName(that: IrElement): String {
3434
if (that is IrFile) {
3535
val shortName = getFileClassName(that)
36-
val pkg = that.fqName.asString()
36+
val pkg = that.packageFqName.asString()
3737
return if (pkg.isEmpty()) shortName else "$pkg.$shortName"
3838
}
3939

@@ -59,7 +59,7 @@ fun getIrElementBinaryName(that: IrElement): String {
5959
.forEach {
6060
when (it) {
6161
is IrClass -> internalName.insert(0, getName(it) + "$")
62-
is IrPackageFragment -> it.fqName.asString().takeIf { fqName -> fqName.isNotEmpty() }?.let { fqName -> internalName.insert(0, "$fqName.") }
62+
is IrPackageFragment -> it.packageFqName.asString().takeIf { fqName -> fqName.isNotEmpty() }?.let { fqName -> internalName.insert(0, "$fqName.") }
6363
}
6464
}
6565
return internalName.toString()

0 commit comments

Comments
 (0)