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
30
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
18
Practical AI for Android Developers with Android Studio’s AI Agent
yveskalume
0
7
Designing scalable Compose APIs
yveskalume
1
140
Demystifying Memory Leaks in Android
yveskalume
2
130
L’essentiel de Git et Github en max 20 minutes
yveskalume
1
50
Modern Android Architecture
yveskalume
1
95
GDSC Alumni retour d’experience
yveskalume
0
26
Premier pas avec Jetpack compose
yveskalume
0
17
Other Decks in Programming
See All in Programming
PC-6001でPSG曲を鳴らすまでを全部NetBSD上の Makefile に押し込んでみた / osc2025hiroshima
tsutsui
0
210
ゆくKotlin くるRust
exoego
1
210
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
250
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
200
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
380
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.7k
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
490
Architectural Extensions
denyspoltorak
0
210
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
420
Python札幌 LT資料
t3tra
7
1.1k
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
330
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
420
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
140
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
84
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
49
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
61
49k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
41
The Cult of Friendly URLs
andyhume
79
6.8k
Faster Mobile Websites
deanohume
310
31k
Believing is Seeing
oripsolob
1
34
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
420
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