diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt index cc1486ef2..1a6003402 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/Codegen.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("FunctionName", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:Suppress("FunctionName", "INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "PRE_RELEASE_CLASS") package net.mamoe.mirai.console.codegen diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt index 885a7e898..f24754c7b 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/JSettingCodegen.kt @@ -1,3 +1,5 @@ +@file:Suppress("PRE_RELEASE_CLASS") + package net.mamoe.mirai.console.codegen /** @@ -5,46 +7,44 @@ package net.mamoe.mirai.console.codegen */ - - -open class JClazz(val primitiveName:String,val packageName:String){ - open val funName:String = "value" +open class JClazz(val primitiveName: String, val packageName: String) { + open val funName: String = "value" } -class JListClazz(val item:JClazz):JClazz("List<${item.packageName}>","List<${item.packageName}>"){ +class JListClazz(val item: JClazz) : JClazz("List<${item.packageName}>", "List<${item.packageName}>") { override val funName = item.primitiveName.toLowerCase() + "List" } -class JArrayClazz(item:JClazz):JClazz(item.primitiveName + "[]",item.primitiveName + "[]") - -class JMapClazz(key:JClazz,value:JClazz):JClazz("Map<${key.packageName},${value.packageName}>","Map<${key.packageName},${value.packageName}>") +class JArrayClazz(item: JClazz) : JClazz(item.primitiveName + "[]", item.primitiveName + "[]") +class JMapClazz(key: JClazz, value: JClazz) : + JClazz("Map<${key.packageName},${value.packageName}>", "Map<${key.packageName},${value.packageName}>") internal val J_NUMBERS = listOf( - JClazz("int","Integer"), - JClazz("short","Short"), - JClazz("byte","Byte"), - JClazz("long","Long"), - JClazz("float","Float"), - JClazz("double","Double") + JClazz("int", "Integer"), + JClazz("short", "Short"), + JClazz("byte", "Byte"), + JClazz("long", "Long"), + JClazz("float", "Float"), + JClazz("double", "Double") ) internal val J_EXTRA = listOf( - JClazz("String","String"), - JClazz("boolean","Boolean"), - JClazz("char","Char") + JClazz("String", "String"), + JClazz("boolean", "Boolean"), + JClazz("char", "Char") ) -fun JClazz.getTemplate():String = """ +fun JClazz.getTemplate(): String = """ @NotNull default Value<${this.packageName}> $funName(${this.primitiveName} defaultValue){ return _SettingKt.value(this,defaultValue); } """ -fun main(){ +fun main() { println(buildString { appendLine(COPYRIGHT) appendLine() @@ -74,7 +74,7 @@ fun main(){ appendLine(JArrayClazz(it).getTemplate()) } - (J_EXTRA + J_NUMBERS).forEach {key -> + (J_EXTRA + J_NUMBERS).forEach { key -> (J_EXTRA + J_NUMBERS).forEach { value -> appendLine(JMapClazz(key, value).getTemplate()) } diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt index 561bb40c9..63b8fbde6 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/SettingValueUseSiteCodegen.kt @@ -6,6 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ +@file:Suppress("PRE_RELEASE_CLASS") package net.mamoe.mirai.console.codegen diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt index f9e94702f..3e02acf48 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueImplCodegen.kt @@ -6,6 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ +@file:Suppress("PRE_RELEASE_CLASS") package net.mamoe.mirai.console.codegen diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt index 5f44ba567..314c9092d 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValueKtCodegen.kt @@ -7,6 +7,8 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ +@file:Suppress("PRE_RELEASE_CLASS") + package net.mamoe.mirai.console.codegen diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt index 4920d6754..13d349099 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/ValuesCodegen.kt @@ -6,7 +6,7 @@ * * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("ClassName", "unused") +@file:Suppress("ClassName", "unused", "PRE_RELEASE_CLASS") package net.mamoe.mirai.console.codegen diff --git a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt index 241f971cf..d5101dc7b 100644 --- a/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt +++ b/backend/codegen/src/main/kotlin/net/mamoe/mirai/console/codegen/util.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused") +@file:Suppress("NOTHING_TO_INLINE", "MemberVisibilityCanBePrivate", "unused","PRE_RELEASE_CLASS") package net.mamoe.mirai.console.codegen