Alex Vanyo
04/22/2021, 11:45 PMksp
and kapt
will definitely differ in behavior, due to the limitations of the latter that I thought would be interesting to share:
class Test {
companion object {
sealed class TestSealedClass {
@GenSealedEnum
companion object
}
}
}
That @GenSealedEnum
will be picked up by ksp
with getSymbolsWithAnnotation
, but it will be ignored in kapt
with getElementsAnnotatedWith
My understanding (via https://youtrack.jetbrains.com/issue/KT-16458 and https://github.com/JetBrains/kotlin/commit/bb0a46ac17e4e030f3ba9c08b322039f1afb29c7) is that this has to be the case in kapt
since the stubs wouldn’t be valid Java otherwise.