[KxSerialization] Added inspections on custom serializer parameters

Added inspections to check:
- custom serializer on class has as many parameters in primary constructor as the serializable class of type arguments
- all parameters in custom serializer has `KSerializer` type
- property in serializable class not parametrized by type parameter
- custom serializer on property of serializable class have no parameters in primary constructor
This commit is contained in:
Sergey.Shanshin
2023-07-28 22:03:31 +02:00
committed by Space Team
parent 9532172a22
commit 84ad12be57
15 changed files with 507 additions and 32 deletions
@@ -225,6 +225,12 @@ public class SerializationFirLightTreeBlackBoxTestGenerated extends AbstractSeri
runTest("plugins/kotlinx-serialization/testData/boxIr/namedCompanions.kt");
}
@Test
@TestMetadata("polymorphic.kt")
public void testPolymorphic() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/polymorphic.kt");
}
@Test
@TestMetadata("privateCustomSerializer.kt")
public void testPrivateCustomSerializer() throws Exception {
@@ -38,6 +38,12 @@ public class SerializationFirPsiDiagnosticTestGenerated extends AbstractSerializ
runTest("plugins/kotlinx-serialization/testData/diagnostics/companionObjectSerializers.kt");
}
@Test
@TestMetadata("customSerializers.kt")
public void testCustomSerializers() throws Exception {
runTest("plugins/kotlinx-serialization/testData/diagnostics/customSerializers.kt");
}
@Test
@TestMetadata("DuplicateSerialName.kt")
public void testDuplicateSerialName() throws Exception {
@@ -128,6 +134,12 @@ public class SerializationFirPsiDiagnosticTestGenerated extends AbstractSerializ
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParamIsNotProperty.kt");
}
@Test
@TestMetadata("ParametrizedExternalSerializers.kt")
public void testParametrizedExternalSerializers() throws Exception {
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParametrizedExternalSerializers.kt");
}
@Test
@TestMetadata("repeatableSerialInfo.kt")
public void testRepeatableSerialInfo() throws Exception {
@@ -223,6 +223,12 @@ public class SerializationIrBoxTestGenerated extends AbstractSerializationIrBoxT
runTest("plugins/kotlinx-serialization/testData/boxIr/namedCompanions.kt");
}
@Test
@TestMetadata("polymorphic.kt")
public void testPolymorphic() throws Exception {
runTest("plugins/kotlinx-serialization/testData/boxIr/polymorphic.kt");
}
@Test
@TestMetadata("privateCustomSerializer.kt")
public void testPrivateCustomSerializer() throws Exception {
@@ -36,6 +36,12 @@ public class SerializationPluginDiagnosticTestGenerated extends AbstractSerializ
runTest("plugins/kotlinx-serialization/testData/diagnostics/companionObjectSerializers.kt");
}
@Test
@TestMetadata("customSerializers.kt")
public void testCustomSerializers() throws Exception {
runTest("plugins/kotlinx-serialization/testData/diagnostics/customSerializers.kt");
}
@Test
@TestMetadata("DuplicateSerialName.kt")
public void testDuplicateSerialName() throws Exception {
@@ -126,6 +132,12 @@ public class SerializationPluginDiagnosticTestGenerated extends AbstractSerializ
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParamIsNotProperty.kt");
}
@Test
@TestMetadata("ParametrizedExternalSerializers.kt")
public void testParametrizedExternalSerializers() throws Exception {
runTest("plugins/kotlinx-serialization/testData/diagnostics/ParametrizedExternalSerializers.kt");
}
@Test
@TestMetadata("repeatableSerialInfo.kt")
public void testRepeatableSerialInfo() throws Exception {