Minor, make SerializedResourcePaths an interface
This commit is contained in:
+5
-5
@@ -22,8 +22,8 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.serialization.SerializedResourcePaths
|
||||
import org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf
|
||||
|
||||
public object BuiltInsSerializedResourcePaths : SerializedResourcePaths() {
|
||||
public override val extensionRegistry: ExtensionRegistryLite
|
||||
object BuiltInsSerializedResourcePaths : SerializedResourcePaths {
|
||||
override val extensionRegistry: ExtensionRegistryLite
|
||||
|
||||
init {
|
||||
extensionRegistry = ExtensionRegistryLite.newInstance()
|
||||
@@ -34,15 +34,15 @@ public object BuiltInsSerializedResourcePaths : SerializedResourcePaths() {
|
||||
val PACKAGE_FILE_EXTENSION = "kotlin_package"
|
||||
val STRING_TABLE_FILE_EXTENSION = "kotlin_string_table"
|
||||
|
||||
public override fun getClassMetadataPath(classId: ClassId): String {
|
||||
override fun getClassMetadataPath(classId: ClassId): String {
|
||||
return packageFqNameToPath(classId.getPackageFqName()) + "/" + classId.getRelativeClassName().asString() +
|
||||
"." + CLASS_METADATA_FILE_EXTENSION
|
||||
}
|
||||
|
||||
public override fun getPackageFilePath(fqName: FqName): String =
|
||||
override fun getPackageFilePath(fqName: FqName): String =
|
||||
packageFqNameToPath(fqName) + "/" + shortName(fqName) + "." + PACKAGE_FILE_EXTENSION
|
||||
|
||||
public override fun getStringTableFilePath(fqName: FqName): String =
|
||||
override fun getStringTableFilePath(fqName: FqName): String =
|
||||
packageFqNameToPath(fqName) + "/" + shortName(fqName) + "." + STRING_TABLE_FILE_EXTENSION
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -20,12 +20,12 @@ import com.google.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
abstract class SerializedResourcePaths {
|
||||
abstract val extensionRegistry: ExtensionRegistryLite
|
||||
interface SerializedResourcePaths {
|
||||
val extensionRegistry: ExtensionRegistryLite
|
||||
|
||||
abstract fun getClassMetadataPath(classId: ClassId): String
|
||||
fun getClassMetadataPath(classId: ClassId): String
|
||||
|
||||
abstract fun getPackageFilePath(fqName: FqName): String
|
||||
fun getPackageFilePath(fqName: FqName): String
|
||||
|
||||
abstract fun getStringTableFilePath(fqName: FqName): String
|
||||
fun getStringTableFilePath(fqName: FqName): String
|
||||
}
|
||||
|
||||
+3
-3
@@ -22,8 +22,8 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.SerializedResourcePaths
|
||||
|
||||
public object KotlinJavascriptSerializedResourcePaths : SerializedResourcePaths() {
|
||||
public override val extensionRegistry: ExtensionRegistryLite = ExtensionRegistryLite.newInstance()
|
||||
object KotlinJavascriptSerializedResourcePaths : SerializedResourcePaths {
|
||||
override val extensionRegistry: ExtensionRegistryLite = ExtensionRegistryLite.newInstance()
|
||||
|
||||
init {
|
||||
JsProtoBuf.registerAllExtensions(extensionRegistry)
|
||||
@@ -32,7 +32,7 @@ public object KotlinJavascriptSerializedResourcePaths : SerializedResourcePaths(
|
||||
private val CLASSES_FILE_EXTENSION = "kotlin_classes"
|
||||
private val STRING_TABLE_FILE_EXTENSION = "kotlin_string_table"
|
||||
|
||||
public fun getClassesInPackageFilePath(fqName: FqName): String =
|
||||
fun getClassesInPackageFilePath(fqName: FqName): String =
|
||||
fqName.toPath().withSepIfNotEmpty() + shortName(fqName) + "." + CLASSES_FILE_EXTENSION
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user