Commit Graph

302 Commits

Author SHA1 Message Date
Sergey Shanshin bf6dda2d99 Lazy delegate for serializer in objects, sealed and abstract classes
Fixes Kotlin/kotlinx.serialization#585
2021-03-03 21:41:37 +03:00
Anton Bannykh b0e0e62c0b Propagate isExternal flag in Psi2Ir and deserializer 2021-03-02 14:30:16 +03:00
Alexander Udalov 0ebdf7c3c4 IR: add getPrimitiveType, optimize some usages of isInt/isByte/... 2021-02-25 21:00:09 +01:00
Alexander Udalov 7e149a3a44 IR: remove unneeded dependencies on psi2ir 2021-02-24 19:07:38 +01:00
Sergey Shanshin 8c20c655fe Updated bytecode of serialization for IR
`shouldEncodeElementDefault` now checked before evaluating default value
2021-02-18 15:03:35 +03:00
Sergey Shanshin 91f1cb88c1 Support serialization of java enum classes in IR
Fixes Kotlin/kotlinx.serialization#1334
2021-02-17 20:24:31 +03:00
Sergey Shanshin de06a69b12 Added external serializers in serialization plugin for IR backend
- added fallback support of external serializers in IR
- implemented calculations of properties default values in IR
- swapped check of shouldEncodeElementDefault and comparing the property with default value in IR. Now default value calculated only of shouldEncodeElementDefault returns false
2021-02-17 20:16:34 +03:00
Sergey Shanshin 122d04b9fa Returned support for generic serializers in @UseSerializers (#4055)
Fixes Kotlin/kotlinx.serialization#1305
2021-01-26 14:57:40 +03:00
Sergey Shanshin 10d9259df5 Returned support for nullable types by not null serializers
Fixes Kotlin/kotlinx.serialization#1265
2021-01-19 20:44:47 +03:00
Alexander Udalov d101f1b3a6 Minor, fix compiler warnings in kotlin-serialization-compiler 2021-01-13 19:17:21 +01:00
Dmitriy Novozhilov 1e67702128 [Test] Introduce opt in @ObsoleteTestInfrastructure for migrating tests to new infrastructure 2021-01-11 14:19:10 +03:00
Alexander Udalov ed9a0e514d Regenerate tests and fir-tree 2021-01-03 14:53:41 +01:00
Georgy Bronnikov d714adacae IR: removing WrappedDescriptors from symbols 2020-12-23 18:50:51 +03:00
Leonid Startsev a5ddb1fdf1 Update error about unsupported inline classes
Remove unused declarations
2020-12-19 20:34:45 +03:00
Leonid Startsev 272273baed Support serializable inline classes in IR plugin
as well as standard unsigned types.
2020-12-19 20:34:45 +03:00
Leonid Startsev 631a72d14a Support old serialization runtime versions
(where exception signatures weren't changed)

after f671c27f27
2020-12-19 20:34:11 +03:00
Leonid Startsev f671c27f27 Adapt serialization exceptions constructor calls in legacy JS
to signature change

(see https://github.com/Kotlin/kotlinx.serialization/pull/1054
and commit eea4ff33a0)
2020-12-19 19:18:15 +03:00
Leonid Startsev 18e7a1485c Additional fix for Compose:
directly search for fields in IR class w/o using the symbol table.
Because Compose copies whole IR, fields got referenced incorrectly.
In the end, bytecode generator thinks that this is a field from other
class and creates a synthetic setter, which is prohibited in Java 9+
(Update to non-static final field ... attempted from a different method than <init>)
2020-12-19 19:18:14 +03:00
Dmitriy Novozhilov bc7e18fb8a [TEST] Regenerate tests after previous commit 2020-12-16 19:52:28 +03:00
Mads Ager 5d9e86863a [IR] Make isHidden and isAssignable explicit on IrValueParameter.
There were a couple of places where they were confused and
isAssignable was passed as a positional parameter in the position
of isHidden.
2020-12-04 17:04:45 +01:00
Dmitriy Novozhilov 986ab9cb54 Build: remove useless .as40 files 2020-11-28 14:25:54 +03:00
Ilmir Usmanov 92f1681de0 Value classes: treat @JvmInline value classes as inline classes
Report error on value classes without @JvmInline annotation.
Do not check for @JvmInline annotation in value classes since
it breaks reflection.
2020-11-27 23:52:06 +01:00
Sergey Shanshin b5143ba2ab Optimize check for missing fields in deserialization (#3862)
Fixes Kotlin/kotlinx.serialization#662 Kotlin/kotlinx.serialization#657
2020-11-25 21:50:42 +03:00
Sergey Shanshin f6c7372089 Fix serializing properties with custom accessors (#3907)
Fixes Kotlin/kotlinx.serialization#956
2020-11-25 17:06:10 +03:00
Leonid Startsev b1c355e7eb Directly search in IrClass for declarations to fill bodies with plugin
because some other compiler plugins (Compose) copy/rewrite IR declarations
completely, and in the end, functions that are present in the final IR tree
do not have bodies.

Correctly create IrProperty and IrField when they were absent from the
descriptors (in case for private serializer properties)

Do not use symbol table because 'declare' API is not available in plugins.

Fixes https://github.com/JetBrains/compose-jb/issues/46
2020-11-24 18:40:10 +03:00
Sergey Shanshin 176071b7db Add support of nullable serializers to UseSerializers annotation (#3906)
Fixes Kotlin/kotlinx.serialization#984
2020-11-24 16:34:02 +03:00
Vyacheslav Gerasimov 3feff16a77 Cleanup 193 compatibility fixes 2020-11-11 14:28:54 +03:00
Sergey Shanshin 202459531d Add support of nullable serializers to UseSerializers annotation (#3898)
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/984
2020-11-10 19:42:02 +03:00
Alexander Udalov b3e79d36df Fix compiler warnings and some inspections 2020-11-03 14:00:53 +01:00
Alexander Udalov f87e46b599 Kx-serialization: generate wrapper type for reference array serializer 2020-10-30 17:47:29 +01:00
Alexander Udalov 42aef01d79 Kx-serialization: support SerialInfo annotations from dependencies in JVM IR
Also handle call sites correctly, by generating an instance of the Impl
class instead of trying to create the annotation.

 #KT-42976 Fixed
2020-10-30 17:47:29 +01:00
Alexander Udalov 51ded98c4b Kx-serialization: support SerialInfo for JVM IR
No tests added because this is going to be checked by the upcoming build
of kotlinx-serialization runtime with JVM IR.

 #KT-42976 In Progress
2020-10-30 17:45:25 +01:00
Igor Chevdar 1a9e516dc0 [ir-plugin] Referenced binary operators with the new API 2020-10-23 14:58:33 +05:00
Georgy Bronnikov b7a07fdf03 Review fix: unify irTemporary variants 2020-10-22 18:31:23 +03:00
Georgy Bronnikov e5cf7a1be7 Remove descriptor usage from Scope.kt 2020-10-22 18:26:46 +03:00
Leonid Startsev 8d999a2c13 Disable kx.ser plugin inside descriptors serialization in the IDE
Since IDE does not perform any serialization of descriptors, and
metadata written to the 'serializationDescriptorSerializer'
deleted only on call to DescriptorSerializer,
enabling this extension in the IDE effectively causes memory leaks.

 #KT-39624 Fixed

Pass SerializationDescriptorSerializerPlugin to other extensions directly

instead of using static val in companion.
2020-10-22 17:14:06 +03:00
Leonid Startsev 4ec90b18bc Rework DescriptorSerializerPlugin to be a part of Project's extensions
instead of statically registering it.

Static registering can cause subtle errors when plugin implementation
(e.g. SerializationDescriptorPluginForKotlinxSerialization) is registered
from multiple classloaders: in multi-module with daemon compilation scenario

 #KT-41857 Fixed
2020-10-22 17:04:35 +03:00
Georgy Bronnikov 14b3beefb3 IR: IrDelegatingConstructorCall.fromSymbolDescriptor 2020-10-19 12:21:12 +03:00
Leonid Startsev 0616f948c7 Use actual form of decodeSerializableElement function in 'decodeSequentially'
code path in deserialize.

Old 3-argument form is deprecated and should be removed.
2020-10-16 15:24:12 +03:00
Mads Ager 1f2ca606a5 [IR] Add isAssignable property to IrValueParameter.
Use it to check that only the value parameters that are explicitly
marked assignable are assigned.

Currently, the only parameters marked assignable are those for
default argument stubs.
2020-10-06 21:47:29 +02:00
Mads Ager 8d791ca98e [IR] Update naming, but not binary format for IrSetValue. 2020-10-06 21:47:29 +02:00
Mads Ager 9a93bb3f09 [IR] Add IR support for setting parameters.
Use it in the JVM_IR backend for default values code. The parameter
local has to be overwritten for the inliner to work.
2020-10-06 21:47:29 +02:00
Georgy Bronnikov 80b7194799 IR: remove KotlinType usage from Ir.kt 2020-10-05 11:02:12 +03:00
Leonid Startsev bdbf8d7980 Use correct class type when creating class references
(for e.g. PolymorphicSerializer)

Former class reference may had type arguments in it, which lead to bugs
in JS IR.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1072
2020-10-02 19:11:25 +03:00
Leonid Startsev d4bdb0eedc Remove requirement on 'Serializable class must have single primary constructor'
#KT-38868 Fixed
 #KT-41627 Fixed
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/396
 Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1049
2020-10-02 19:11:25 +03:00
Nikolay Krasko 2df030f583 as42: Apply 201 <-> AS41 diff 2020-09-29 15:32:32 +03:00
Mikhael Bogdanov 31ed5430ee Minor. Update test data 2020-09-25 15:45:56 +02:00
Dmitriy Novozhilov 7380abac13 Split AsmUtils to descriptors dependent and independent parts 2020-09-24 16:51:05 +03:00
Georgy Bronnikov df1d9a0113 IR: make IrTypeParameter.superTypes persistent mutable field 2020-09-22 23:53:39 +03:00
Leonid Startsev eea4ff33a0 Adapt serialization exceptions constructor calls to signature change
(see https://github.com/Kotlin/kotlinx.serialization/pull/1054)
2020-09-21 17:10:12 +03:00