From aeeb3a26e2e44c4301880b90e5dab856f85eda12 Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 25 Nov 2019 15:14:38 +0800 Subject: [PATCH] Use inline instead of enum to be in conformity with Android's requirement --- .../kotlin/net.mamoe.mirai/contact/data/Profile.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/data/Profile.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/data/Profile.kt index d8acb2e65..17c463f48 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/data/Profile.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/data/Profile.kt @@ -44,9 +44,11 @@ data class Profile( /** * 性别 - */ -enum class Gender { - SECRET, - MALE, - FEMALE; + */ // 在 Android 中 enum 的使用被严格控制. +inline class Gender(val value: Byte) { + companion object { + val SECRET = Gender(0) + val MALE = Gender(2) + val FEMALE = Gender(1) + } } \ No newline at end of file