Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Traitement des annotations en Kotlin
Search
Yves Kalume
February 24, 2023
Programming
1
26
Traitement des annotations en Kotlin
Yves Kalume
February 24, 2023
Tweet
Share
More Decks by Yves Kalume
See All by Yves Kalume
Designing scalable Compose APIs
yveskalume
1
120
Demystifying Memory Leaks in Android
yveskalume
2
110
L’essentiel de Git et Github en max 20 minutes
yveskalume
1
43
Modern Android Architecture
yveskalume
1
89
GDSC Alumni retour d’experience
yveskalume
0
23
Premier pas avec Jetpack compose
yveskalume
0
14
Flutter et Firebase
yveskalume
0
16
La modularisation dans le développement Android
yveskalume
0
15
Other Decks in Programming
See All in Programming
A Gopher's Guide to Vibe Coding
danicat
0
190
Improving my own Ruby thereafter
sisshiki1969
1
130
tool ディレクティブを導入してみた感想
sgash708
1
160
【第4回】関東Kaggler会「Kaggleは執筆に役立つ」
mipypf
0
950
パッケージ設計の黒魔術/Kyoto.go#63
lufia
2
360
Trem on Rails - Prompt Engineering com Ruby
elainenaomi
1
100
ワープロって実は計算機で
pepepper
2
1.4k
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
1
170
オープンセミナー2025@広島LT技術ブログを続けるには
satoshi256kbyte
0
150
自作OSでDOOMを動かしてみた
zakki0925224
1
1.4k
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
990
RDoc meets YARD
okuramasafumi
4
160
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
How GitHub (no longer) Works
holman
315
140k
The World Runs on Bad Software
bkeepers
PRO
70
11k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Fireside Chat
paigeccino
39
3.6k
Being A Developer After 40
akosma
90
590k
Writing Fast Ruby
sferik
628
62k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Done Done
chrislema
185
16k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Transcript
Traitement des annotations en Kotlin Yves Kalume (@kalumeyves) Développeur Mobile
@Composable fun HomeScreen() @OptIn(ExperimentalPagerApi.:class) @Devscat @SuppressWarnings("deprecation") @Deprecated @Configuration @Autowired Annotation
Processing
Une annotation permet au programmeur d'intégrer des informations supplémentaires dans
un code source.
Déclaration d’une annotation annotation class Devscast @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.SOURCE)
Utilisation d’une annotation @Devscast class Foo(val id: Int, val name:
String) fun main() { val annotations = Foo.:class.annotations print(annotations) ./ [] une liste vide... pourquoi ? }
Kotlin Symbol Processing (KSP)
KSP en action dependencies { implementation("com.google.devtools.ksp:symbol-processing-api:1.8.10-1.0.9") }
src/main/resources/META-INF/services/
Fournisseur de processeur class DevscastProcessorProvider : SymbolProcessorProvider { override fun
create( environment: SymbolProcessorEnvironment ): SymbolProcessor { return DevscastProcessor(environment) } }
Processeur class ListedProcessor( private val environment: SymbolProcessorEnvironment ) : SymbolProcessor
{ override fun process(resolver: Resolver): List<KSAnnotated>{ ./ traitement } }
val result = resolver.getSymbolsWithAnnotation( Devscast.:class.qualifiedName.toString() ) ./ ... return result.filterNot
{ it.validate() }.toList()
Prêt à être utilisée
dependencies { implementation(project(":lib") ) ksp(project(":lib")) } android { kotlin {
sourceSets.debug { kotlin.srcDirs += 'build/generated/ksp/debug/kotlin' } sourceSets.release { kotlin.srcDirs += 'build/generated/ksp/release/kotlin' } } }
Merci ! Yves Kalume - @kalumeyves Développeur Mobile