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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yves Kalume
February 24, 2023
Programming
38
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Traitement des annotations en Kotlin
Yves Kalume
February 24, 2023
More Decks by Yves Kalume
See All by Yves Kalume
Bringing AI to Android With Gemini
yveskalume
0
9
Dompting the Elephant: Making Sense of Gradle for Android Developers
yveskalume
0
40
Practical AI for Android Developers with Android Studio’s AI Agent
yveskalume
0
28
Designing scalable Compose APIs
yveskalume
1
150
Demystifying Memory Leaks in Android
yveskalume
2
140
L’essentiel de Git et Github en max 20 minutes
yveskalume
1
58
Modern Android Architecture
yveskalume
1
110
GDSC Alumni retour d’experience
yveskalume
0
32
Premier pas avec Jetpack compose
yveskalume
0
26
Other Decks in Programming
See All in Programming
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.8k
Oxlintのカスタムルールの現況
syumai
6
1k
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
520
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
200
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
260
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
170
AI時代のUIはどこへ行く?その2!
yusukebe
19
6.9k
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
460
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
1.9k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
210
さぁV100、メモリをお食べ・・・
nilpe
0
130
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.3k
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
790
Testing 201, or: Great Expectations
jmmastey
46
8.2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
230
Ruling the World: When Life Gets Gamed
codingconduct
0
250
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
Being A Developer After 40
akosma
91
590k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
270
The Cult of Friendly URLs
andyhume
79
6.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
380
Measuring & Analyzing Core Web Vitals
bluesmoon
9
860
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
140
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