Add serializer(vararg KSerializer<*>) override from SerializerFactory when necessary
SerializerFactory is an implementation detail for Kotlin/JS and Native: it should be added as a supertype to a companion object of certain serializable classes and `serializer(vararg KSerializer<*>)` function from it should be implemented. Existing implementation added the supertype, but did not add proper override to FirClass of a companion, which led to various warnings and errors like 'Abstract function 'serializer' is not implemented in non-abstract companion object'. Also implemented the addition of SerializerFactory supertype to user-defined companions within @Serializable and @MetaSerializable when necessary. Also set up proper box tests for FIR+Kotlin/JS combination. #KT-58501 Fixed #KT-59768 Fixed
This commit is contained in:
committed by
Space Team
parent
351e9c7592
commit
f3833fdcf8
+63
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlinx.serialization.runners;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlinx.serialization.TestGeneratorKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("plugins/kotlinx-serialization/testData/boxIr")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class SerializationFirJsBoxTestGenerated extends AbstractSerializationFirJsBoxTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBoxIr() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kotlinx-serialization/testData/boxIr"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("constValInSerialName.kt")
|
||||
public void testConstValInSerialName() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/constValInSerialName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("excludedFromExport.kt")
|
||||
public void testExcludedFromExport() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/excludedFromExport.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("excludedFromFileExport.kt")
|
||||
public void testExcludedFromFileExport() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/excludedFromFileExport.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactory.kt")
|
||||
public void testSerializerFactory() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactory.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactoryInUserDefined.kt")
|
||||
public void testSerializerFactoryInUserDefined() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactoryInUserDefined.kt");
|
||||
}
|
||||
}
|
||||
+12
@@ -231,6 +231,18 @@ public class SerializationFirLightTreeBlackBoxTestGenerated extends AbstractSeri
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializableOnPropertyType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactory.kt")
|
||||
public void testSerializerFactory() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactory.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactoryInUserDefined.kt")
|
||||
public void testSerializerFactoryInUserDefined() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactoryInUserDefined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("starProjections.kt")
|
||||
public void testStarProjections() throws Exception {
|
||||
|
||||
+12
@@ -229,6 +229,18 @@ public class SerializationIrBoxTestGenerated extends AbstractSerializationIrBoxT
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializableOnPropertyType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactory.kt")
|
||||
public void testSerializerFactory() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactory.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactoryInUserDefined.kt")
|
||||
public void testSerializerFactoryInUserDefined() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactoryInUserDefined.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("starProjections.kt")
|
||||
public void testStarProjections() throws Exception {
|
||||
|
||||
+12
@@ -48,4 +48,16 @@ public class SerializationIrJsBoxTestGenerated extends AbstractSerializationIrJs
|
||||
public void testExcludedFromFileExport() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/excludedFromFileExport.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactory.kt")
|
||||
public void testSerializerFactory() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactory.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("serializerFactoryInUserDefined.kt")
|
||||
public void testSerializerFactoryInUserDefined() throws Exception {
|
||||
runTest("plugins/kotlinx-serialization/testData/boxIr/serializerFactoryInUserDefined.kt");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user