https://github.com/shikasd/kotlin-object-serialization-fix
Java serialization fix for Kotlin object
https://github.com/shikasd/kotlin-object-serialization-fix
compiler-plugin java-serialization kotlin object serializable
Last synced: 3 months ago
JSON representation
Java serialization fix for Kotlin object
- Host: GitHub
- URL: https://github.com/shikasd/kotlin-object-serialization-fix
- Owner: ShikaSD
- License: mit
- Created: 2019-12-18T23:35:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-11T13:52:24.000Z (9 months ago)
- Last Synced: 2025-05-31T20:12:10.672Z (4 months ago)
- Topics: compiler-plugin, java-serialization, kotlin, object, serializable
- Language: Kotlin
- Size: 133 KB
- Stars: 22
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Java serialization fix for Kotlin object
Solves the problem of Kotlin object being having different instance after deserialization using built-in Java serialization.
The issue is described quite well [here](https://blog.stylingandroid.com/kotlin-serializable-objects/).The plugin adds `readResolve` method for every object which either:
- implements `java.io.Serializable`;
- extends a class implementing `java.io.Serializable`.## Getting it:
```groovy
// build.gradle// plugins dsl
plugins {
id "me.shika.kotlin-object-java-serialization" version "1.5.1"
}// or else
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "me.shika:kotlin-object-java-serialization:1.5.1"
}
}apply plugin: 'me.shika.kotlin-object-java-serialization'
```