Suppress("PRE_RELEASE_CLASS")

This commit is contained in:
Karlatemp 2020-06-23 18:28:15 +08:00
parent a26b607f35
commit 5551d2f048
No known key found for this signature in database
GPG Key ID: 21FBDDF664FF06F8
7 changed files with 27 additions and 23 deletions

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * 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 package net.mamoe.mirai.console.codegen

View File

@ -1,3 +1,5 @@
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen 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" override val funName = item.primitiveName.toLowerCase() + "List"
} }
class JArrayClazz(item:JClazz):JClazz(item.primitiveName + "[]",item.primitiveName + "[]") 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 JMapClazz(key: JClazz, value: JClazz) :
JClazz("Map<${key.packageName},${value.packageName}>", "Map<${key.packageName},${value.packageName}>")
internal val J_NUMBERS = listOf( internal val J_NUMBERS = listOf(
JClazz("int","Integer"), JClazz("int", "Integer"),
JClazz("short","Short"), JClazz("short", "Short"),
JClazz("byte","Byte"), JClazz("byte", "Byte"),
JClazz("long","Long"), JClazz("long", "Long"),
JClazz("float","Float"), JClazz("float", "Float"),
JClazz("double","Double") JClazz("double", "Double")
) )
internal val J_EXTRA = listOf( internal val J_EXTRA = listOf(
JClazz("String","String"), JClazz("String", "String"),
JClazz("boolean","Boolean"), JClazz("boolean", "Boolean"),
JClazz("char","Char") JClazz("char", "Char")
) )
fun JClazz.getTemplate():String = """ fun JClazz.getTemplate(): String = """
@NotNull default Value<${this.packageName}> $funName(${this.primitiveName} defaultValue){ @NotNull default Value<${this.packageName}> $funName(${this.primitiveName} defaultValue){
return _SettingKt.value(this,defaultValue); return _SettingKt.value(this,defaultValue);
} }
""" """
fun main(){ fun main() {
println(buildString { println(buildString {
appendLine(COPYRIGHT) appendLine(COPYRIGHT)
appendLine() appendLine()
@ -74,7 +74,7 @@ fun main(){
appendLine(JArrayClazz(it).getTemplate()) appendLine(JArrayClazz(it).getTemplate())
} }
(J_EXTRA + J_NUMBERS).forEach {key -> (J_EXTRA + J_NUMBERS).forEach { key ->
(J_EXTRA + J_NUMBERS).forEach { value -> (J_EXTRA + J_NUMBERS).forEach { value ->
appendLine(JMapClazz(key, value).getTemplate()) appendLine(JMapClazz(key, value).getTemplate())
} }

View File

@ -6,6 +6,7 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen package net.mamoe.mirai.console.codegen

View File

@ -6,6 +6,7 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen package net.mamoe.mirai.console.codegen

View File

@ -7,6 +7,8 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("PRE_RELEASE_CLASS")
package net.mamoe.mirai.console.codegen package net.mamoe.mirai.console.codegen

View File

@ -6,7 +6,7 @@
* *
* https://github.com/mamoe/mirai/blob/master/LICENSE * 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 package net.mamoe.mirai.console.codegen

View File

@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * 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 package net.mamoe.mirai.console.codegen