1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 16:47:13 +00:00

add file annotations generation to the class casts

This commit is contained in:
InsanusMokrassar 2022-08-05 18:57:50 +06:00
parent bbdff0b31a
commit 6a06775bc4
2 changed files with 22 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import com.google.devtools.ksp.getAllSuperTypes
import com.google.devtools.ksp.processing.*
import com.google.devtools.ksp.symbol.KSAnnotated
import com.google.devtools.ksp.symbol.KSClassDeclaration
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.FileSpec
import com.squareup.kotlinpoet.ksp.writeTo
import dev.inmo.tgbotapi.ksp.lib.ClassCastsIncluded
@ -43,6 +44,17 @@ class TelegramBotAPISymbolProcessor(
targetPackage,
outputFile
).apply {
addAnnotation(
AnnotationSpec.builder(Suppress::class).apply {
addMember("\"unused\"")
addMember("\"RemoveRedundantQualifierName\"")
addMember("\"RedundantVisibilityModifier\"")
addMember("\"NOTHING_TO_INLINE\"")
addMember("\"UNCHECKED_CAST\"")
addMember("\"OPT_IN_USAGE\"")
useSiteTarget(AnnotationSpec.UseSiteTarget.FILE)
}.build()
)
classes.forEach {
fill(
it,

View File

@ -1,3 +1,12 @@
@file:Suppress(
"unused",
"RemoveRedundantQualifierName",
"RedundantVisibilityModifier",
"NOTHING_TO_INLINE",
"UNCHECKED_CAST",
"OPT_IN_USAGE",
)
package dev.inmo.tgbotapi.extensions.utils
import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData
@ -410,6 +419,7 @@ import dev.inmo.tgbotapi.types.update.media_group.EditMessageMediaGroupUpdate
import dev.inmo.tgbotapi.types.update.media_group.MediaGroupUpdate
import dev.inmo.tgbotapi.types.update.media_group.MessageMediaGroupUpdate
import dev.inmo.tgbotapi.types.update.media_group.SentMediaGroupUpdate
import kotlin.Suppress
public inline fun CommonSendInvoiceData.createInvoiceLinkOrNull(): CreateInvoiceLink? = this as?
dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink