Uli Bubenheimer
02/25/2023, 8:41 PM@MyIntThing(1) // correct
@MyIntThing(1,2) // no
@MyIntThing("nope")
@MyIntThing(1) @MyIntThing(2) //no, it's not repeatable
@MyIntThing(1L) // no, really
yigit
02/25/2023, 8:43 PMyigit
02/25/2023, 8:44 PMyigit
02/25/2023, 8:45 PMUli Bubenheimer
02/25/2023, 8:53 PMval myIntThingAnnotation = getAnnotationsByType(instanceLimitKClass).first()
myIntThingAnnotation.value // ClassCastException upon property access with '@MyIntThing("nope")'
// NoSuchElementException upon property access with '@MyIntThing` (no arguments)
Uli Bubenheimer
02/25/2023, 8:53 PMUli Bubenheimer
02/25/2023, 8:54 PMUli Bubenheimer
02/25/2023, 8:55 PMyigit
02/25/2023, 8:55 PMyigit
02/25/2023, 8:56 PMyigit
02/25/2023, 8:56 PMyigit
02/25/2023, 8:57 PMUli Bubenheimer
02/25/2023, 8:58 PMresolver.getSymbolsWithAnnotation(annotationQualifiedName)
.flatMap {
try {
sequenceOf(it).process()
} catch (t: Throwable) { // print unspecified errors with code reference
logger.error(t.toString(), it)
throw t
}
}
.forEach {}
Uli Bubenheimer
02/25/2023, 8:59 PMUli Bubenheimer
02/25/2023, 9:00 PMUli Bubenheimer
02/25/2023, 9:00 PMyigit
02/25/2023, 9:03 PMUli Bubenheimer
02/25/2023, 9:11 PMUli Bubenheimer
02/25/2023, 9:31 PMyigit
02/25/2023, 10:38 PMContext
which has utilities for error reporting. Each time we visit an element, we pass it a new context for that element and Context's error reporting defaults to it's element. Which makes it a bit easier to send errors with referenced elements.
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:room/room-compiler/src/main/kotlin/androidx/room/processor/Context.kt;l=36?q=Context&sq=&ss=androidx%2Fplatform%2Fframeworks%2Fsupport:room%2Froom-compiler%2F
I like that pattern quite a lotyigit
02/25/2023, 10:43 PMUli Bubenheimer
02/25/2023, 10:55 PMUli Bubenheimer
02/25/2023, 11:28 PMyigit
02/25/2023, 11:51 PM