New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
β¨ New ClassIdentity
type
#643
Comments
We need more time to think about how can we get the package of a class in a Kotlin Multiplatform project. |
We need more time to think and design this type. Gradle projects: types. References: #643
A solution is to provide different implementations of this type for each platform. On the JVM and Native platforms, calling the val identity = ClassIdentity.of<Int>()
println(identity) // kotlin.Int On the JS platform, calling the same function should return the simple name of the corresponding type. val identity = ClassIdentity.of<Int>()
println(identity) // Int EDIT on 2024-04-19: This solution is valuable only for serialization, but not for identifying the class in a Java class system. The problem is that, on Kotlin/JS platform, a A better solution would be to provide the package name to the val zeroIdentity: ClassIdentity<Zero> = ClassIdentity.of<Zero>(within = "org.kotools.types")
val actual: String = zeroIdentity.toString()
val expected: String? = Zero::class.qualifiedName
println(actual == expected) // true |
The |
π Description
We want to introduce a
ClassIdentity
experimental type, in theorg.kotools.types
package of thetypes
Gradle subproject, for representing the identity of a class.This type should have the following Application Programming Interface (API)
The
of
factory function being inlined, these declarations should be inaccessible for Java sources.β Checklist
of()
function with documentation, tests, samples and dump the ABI.name
property with documentation, tests, samples, and dump the ABI.packageName
property with documentation, tests, samples, and dump the ABI.toString()
function with documentation, tests, samples, and dump the ABI.The text was updated successfully, but these errors were encountered: