mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[FIR] Replace Path with String in KotlinJvmBinaryClass.containingLibrary
This is needed because :core:deserialization.common.jvm uses JDK 6
This commit is contained in:
committed by
TeamCityServer
parent
2abed7161b
commit
28be3a0dbc
@@ -31,6 +31,8 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
@ThreadSafeMutableState
|
||||
class KotlinDeserializedJvmSymbolsProvider(
|
||||
@@ -56,7 +58,7 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
val facadeFqName = facadeName?.let { JvmClassName.byInternalName(it).fqNameForTopLevelClassMaybeWithDollars }
|
||||
val facadeBinaryClass = facadeFqName?.let { kotlinClassFinder.findKotlinClass(ClassId.topLevel(it)) }
|
||||
|
||||
val moduleData = moduleDataProvider.getModuleData(kotlinJvmBinaryClass.containingLibrary) ?: return@mapNotNull null
|
||||
val moduleData = moduleDataProvider.getModuleData(kotlinJvmBinaryClass.containingLibrary.toPath()) ?: return@mapNotNull null
|
||||
|
||||
val header = kotlinJvmBinaryClass.classHeader
|
||||
val data = header.data ?: header.incompatibleData ?: return@mapNotNull null
|
||||
@@ -115,7 +117,7 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
nameResolver,
|
||||
classProto,
|
||||
JvmBinaryAnnotationDeserializer(session, kotlinClass.kotlinJvmBinaryClass, kotlinClassFinder, kotlinClass.byteContent),
|
||||
kotlinClass.kotlinJvmBinaryClass.containingLibrary,
|
||||
kotlinClass.kotlinJvmBinaryClass.containingLibrary.toPath(),
|
||||
KotlinJvmBinarySourceElement(kotlinClass.kotlinJvmBinaryClass),
|
||||
classPostProcessor = { loadAnnotationsFromClassFile(kotlinClass, it) }
|
||||
)
|
||||
@@ -165,4 +167,8 @@ class KotlinDeserializedJvmSymbolsProvider(
|
||||
return classId.relativeClassName.topLevelName() !in knownNames
|
||||
}
|
||||
}
|
||||
|
||||
private fun String?.toPath(): Path? {
|
||||
return this?.let { Paths.get(it) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.util.PerformanceCounter
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
class VirtualFileKotlinClass private constructor(
|
||||
val file: VirtualFile,
|
||||
@@ -40,8 +38,8 @@ class VirtualFileKotlinClass private constructor(
|
||||
override val location: String
|
||||
get() = file.path
|
||||
|
||||
override val containingLibrary: Path?
|
||||
get() = file.path.split("!/").firstOrNull()?.let { Paths.get(it) }
|
||||
override val containingLibrary: String?
|
||||
get() = file.path.split("!/").firstOrNull()
|
||||
|
||||
override fun getFileContents(): ByteArray {
|
||||
try {
|
||||
|
||||
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue
|
||||
import java.nio.file.Path
|
||||
|
||||
interface KotlinJvmBinaryClass {
|
||||
val classId: ClassId
|
||||
@@ -20,7 +19,7 @@ interface KotlinJvmBinaryClass {
|
||||
*/
|
||||
val location: String
|
||||
|
||||
val containingLibrary: Path?
|
||||
val containingLibrary: String?
|
||||
get() = null
|
||||
|
||||
fun loadClassAnnotations(visitor: AnnotationVisitor, cachedContents: ByteArray?)
|
||||
|
||||
Reference in New Issue
Block a user