This repository was archived by the owner on Sep 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +13
-66
lines changed Expand file tree Collapse file tree 5 files changed +13
-66
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,7 @@ dependencies {
1010 implementation " org.jetbrains.kotlin:kotlin-gradle-plugin-api"
1111 compileOnly " org.jetbrains.kotlin:kotlin-compiler-embeddable"
1212
13- // testImplementation 'com.github.tschuchortdev:kotlin-compile-testing:1.5.0' does not support Kotlin 2
14- testImplementation ' dev.zacsweers.kctfork:core:0.6.0' // Fork of kotlin-compile-testing that supports Kotlin 2
13+ testImplementation ' dev.zacsweers.kctfork:core:0.6.0'
1514 testImplementation ' junit:junit:4.13.2'
1615 testImplementation ' org.jetbrains.kotlin:kotlin-compiler-embeddable'
1716}
Original file line number Diff line number Diff line change @@ -2,9 +2,7 @@ package me.shika
22
33import me.shika.ObjectSerializationCommandLineProcessor.Companion.KEY_ENABLED
44import me.shika.generation.ObjectSerializationIrGeneration
5- import me.shika.generation.ObjectSerializationJvmGeneration
65import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
7- import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
86import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
97import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
108import org.jetbrains.kotlin.config.CompilerConfiguration
@@ -19,10 +17,6 @@ class ObjectSerializationCompilerPluginRegistrar : CompilerPluginRegistrar() {
1917 return
2018 }
2119
22- ExpressionCodegenExtension .registerExtension(
23- ObjectSerializationJvmGeneration ()
24- )
25-
2620 IrGenerationExtension .registerExtension(
2721 ObjectSerializationIrGeneration ()
2822 )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -20,20 +20,6 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperInterfaces
2020import org.jetbrains.kotlin.resolve.descriptorUtil.module
2121import java.io.Serializable
2222
23- fun ClassDescriptor.needSerializableFix () =
24- module.platform.has<JvmPlatform >()
25- && DescriptorUtils .isObject(this )
26- && isSerializable()
27- && ! hasReadMethod()
28-
29- fun ClassDescriptor.hasReadMethod () =
30- unsubstitutedMemberScope.getContributedFunctions(SERIALIZABLE_READ , NoLookupLocation .FROM_BACKEND )
31- .any { it.name == SERIALIZABLE_READ && it.valueParameters.isEmpty() }
32-
33- fun ClassDescriptor.isSerializable (): Boolean =
34- getSuperInterfaces().any { it.fqNameSafe == SERIALIZABLE_FQ_NAME || it.isSerializable() }
35- || getSuperClassNotAny()?.isSerializable() == true
36-
3723fun IrClass.needSerializableFix (): Boolean {
3824 return isObject && isSerializable() && ! hasReadMethod()
3925}
Original file line number Diff line number Diff line change @@ -5,13 +5,24 @@ import com.tschuchort.compiletesting.SourceFile
55import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
66import org.junit.Assert.assertTrue
77import org.junit.Test
8+ import org.junit.runner.RunWith
9+ import org.junit.runners.Parameterized
10+ import org.junit.runners.Parameterized.Parameters
811import java.lang.reflect.Method
912
1013@OptIn(ExperimentalCompilerApi ::class )
11- class ObjectSerializationFixTest {
14+ @RunWith(Parameterized ::class )
15+ class ObjectSerializationFixTest (enableFir : Boolean ) {
16+ companion object {
17+ @Parameters(name = " FIR: {1}" )
18+ @JvmStatic
19+ fun data () = arrayOf(false , true )
20+ }
21+
1222 private val compiler = KotlinCompilation ().apply {
1323 compilerPluginRegistrars = listOf (ObjectSerializationCompilerPluginRegistrar ())
1424 supportsK2 = true
25+ languageVersion = if (enableFir) " 1.9" else " 2.0"
1526 }
1627
1728 private val SERIALIZABLE_OBJECT = """
You can’t perform that action at this time.
0 commit comments