https://kotlinlang.org logo
#kapt
Title
# kapt
o

Odin

08/28/2022, 4:19 PM
Hi, I’m seeing a somewhat weird issue with KAPT. Might be meant to be like that, so I’m wondering if anyone could provide me with some guidance here. I’m trying to make this annotation processor support multiple
@Preview
annotation stacked on top of each other. So I’m using the function
Copy code
xroundEnvironment.getElementsAnnotatedWith(PREVIEW_CLASS_NAME)
to check the generated output of this test
Copy code
@Preview(
    name = "small font",
    group = "font scales",
    fontScale = 0.5f
)
@Preview(
    name = "large font",
    group = "font scales",
    fontScale = 1.5f
)
@Composable
public fun ComposablePreviewFont() {

}
So with KSP, this generates an output and I can see that the
getElementsAnnotatedWith
function actually has the element. However, with KAPT, the same function does not hold any elements. Is there a reason to this? 😄 And is there a workaround?
o

Odin

08/28/2022, 4:50 PM
Aha! Thanks!😊
I tried this with bumping to Kotlin 1.7.20 and using
Copy code
<http://kapt.use.jvm.ir|kapt.use.jvm.ir>=true
from my
gradel.properties
file, but I am still getting the same output. Do you know if there is something else I need to test this out 🙂
4 Views