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 {
10
10
implementation " org.jetbrains.kotlin:kotlin-gradle-plugin-api"
11
11
compileOnly " org.jetbrains.kotlin:kotlin-compiler-embeddable"
12
12
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'
15
14
testImplementation ' junit:junit:4.13.2'
16
15
testImplementation ' org.jetbrains.kotlin:kotlin-compiler-embeddable'
17
16
}
Original file line number Diff line number Diff line change @@ -2,9 +2,7 @@ package me.shika
2
2
3
3
import me.shika.ObjectSerializationCommandLineProcessor.Companion.KEY_ENABLED
4
4
import me.shika.generation.ObjectSerializationIrGeneration
5
- import me.shika.generation.ObjectSerializationJvmGeneration
6
5
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
7
- import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
8
6
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
9
7
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
10
8
import org.jetbrains.kotlin.config.CompilerConfiguration
@@ -19,10 +17,6 @@ class ObjectSerializationCompilerPluginRegistrar : CompilerPluginRegistrar() {
19
17
return
20
18
}
21
19
22
- ExpressionCodegenExtension .registerExtension(
23
- ObjectSerializationJvmGeneration ()
24
- )
25
-
26
20
IrGenerationExtension .registerExtension(
27
21
ObjectSerializationIrGeneration ()
28
22
)
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
20
20
import org.jetbrains.kotlin.resolve.descriptorUtil.module
21
21
import java.io.Serializable
22
22
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
-
37
23
fun IrClass.needSerializableFix (): Boolean {
38
24
return isObject && isSerializable() && ! hasReadMethod()
39
25
}
Original file line number Diff line number Diff line change @@ -5,13 +5,24 @@ import com.tschuchort.compiletesting.SourceFile
5
5
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
6
6
import org.junit.Assert.assertTrue
7
7
import org.junit.Test
8
+ import org.junit.runner.RunWith
9
+ import org.junit.runners.Parameterized
10
+ import org.junit.runners.Parameterized.Parameters
8
11
import java.lang.reflect.Method
9
12
10
13
@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
+
12
22
private val compiler = KotlinCompilation ().apply {
13
23
compilerPluginRegistrars = listOf (ObjectSerializationCompilerPluginRegistrar ())
14
24
supportsK2 = true
25
+ languageVersion = if (enableFir) " 1.9" else " 2.0"
15
26
}
16
27
17
28
private val SERIALIZABLE_OBJECT = """
You can’t perform that action at this time.
0 commit comments