Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
28
Traitement des annotations en Kotlin
Yves Kalume
February 24, 2023
Tweet
Share
More Decks by Yves Kalume
See All by Yves Kalume
Bringing AI to Android With Gemini
yveskalume
0
1
Dompting the Elephant: Making Sense of Gradle for Android Developers
yveskalume
0
9
Practical AI for Android Developers with Android Studio’s AI Agent
yveskalume
0
1
Designing scalable Compose APIs
yveskalume
1
130
Demystifying Memory Leaks in Android
yveskalume
2
120
L’essentiel de Git et Github en max 20 minutes
yveskalume
1
49
Modern Android Architecture
yveskalume
1
93
GDSC Alumni retour d’experience
yveskalume
0
26
Premier pas avec Jetpack compose
yveskalume
0
16
Other Decks in Programming
See All in Programming
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
130
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
120
AIエージェントでのJava開発がはかどるMCPをAIを使って開発してみた / java mcp for jjug
kishida
5
850
認証・認可の基本を学ぼう前編
kouyuume
0
140
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
220
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
870
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
200
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
510
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
310
Level up your Gemini CLI - D&D Style!
palladius
1
160
dotfiles 式年遷宮 令和最新版
masawada
1
570
データファイルをAWSのDWHサービスに格納する / 20251115jawsug-tochigi
kasacchiful
2
110
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
How to train your dragon (web standard)
notwaldorf
97
6.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Why Our Code Smells
bkeepers
PRO
340
57k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Building an army of robots
kneath
306
46k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
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