[KxSerialization] Fix "IllegalAccessError: Update to static final field"
Fixes #KT-57647 For value classes, if you add code to companion anonymous init block in IR, it will be executed in the instance constructor. This causes an error when initializing static fields, because writing to them can only occur from the <clinit> method. The solution is to transfer the static field initialization code from an anonymous init block to the IR initializer of this field Merge-request: KT-MR-9633 Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
803a11003f
commit
d8d643b7d7
@@ -262,8 +262,6 @@ public final class ListOfUsers : java/lang/Object {
|
||||
AASTORE
|
||||
ALOAD (0)
|
||||
PUTSTATIC (ListOfUsers, $childSerializers, [Lkotlinx/serialization/KSerializer;)
|
||||
LABEL (L1)
|
||||
LINENUMBER (13)
|
||||
RETURN
|
||||
}
|
||||
|
||||
|
||||
@@ -223,8 +223,6 @@ public final class Container : java/lang/Object {
|
||||
AASTORE
|
||||
ALOAD (0)
|
||||
PUTSTATIC (Container, $childSerializers, [Lkotlinx/serialization/KSerializer;)
|
||||
LABEL (L1)
|
||||
LINENUMBER (19)
|
||||
RETURN
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user