dagger-reflect icon indicating copy to clipboard operation
dagger-reflect copied to clipboard

reflect-lint: Support Kotlin annotations with default retention

Open PhilGlass opened this issue 4 years ago • 2 comments

The default retention for annotations written in Kotlin is RUNTIME, but dagger-reflect-lint currently flags any Kotlin annotation without an explicit @Retention(AnnotationRetention.RUNTIME) as an error.

PhilGlass avatar Apr 02 '20 23:04 PhilGlass

Based on the kdoc you linked to me it looks like you still must put @Retention() so only annotation class X doesn't seem to have RUNTIME retention. However your claim is correct in the end, but the relevant doc here is AnnotationRetention.RUNTIME and the annotation design doc

TWiStErRob avatar Apr 03 '20 00:04 TWiStErRob

@TWiStErRob You're right, that's the wrong documentation link. It was late!

I found another issue with AnnotationRetention.BINARY support after running this check over our codebase - I've pushed another commit that fixes it.

PhilGlass avatar Apr 03 '20 09:04 PhilGlass