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

dkhusainov

02/06/2018, 10:09 PM
Hello. Did anyone encounter the following bugs while writing custom your own kapt modules? 1. kapt can't find a class marked with annotation if it's package called import(foo.bar.anotherpackage.import.MyClass) 2. Can't debug it, can't even print debug messages to gradle console. 3. If your
kapt
module is part of your project(not a separate dependency somewhere in maven) and is referenced as
kapt project(":processor")
, you can't rebuild your project, because you get this message
Unable to delete file processor\build\libs\lua-deserealizator.jar
. I have to manually kill gradle deamons to release this file, so it could delete it...
y

yan

02/07/2018, 3:51 PM
1. I didn’t actually understand the problem. Can you attach some code example? 2. kapt uses the Kotlin compiler daemon, and its stdout is not mapped to Gradle. So you need to use
Messager
class to log events. Also, here is some info about how you can debug your annotation processors: https://stackoverflow.com/questions/44118592/cant-debug-an-annotation-processor-when-using-kapt-and-gradle. 3. Sounds like a bug, can you reproduce it?
d

dkhusainov

02/07/2018, 11:45 PM
Ok here's sample project where you can reproduce both 1 and 3 bugs. http://rgho.st/download/6jG6WTZ9W/b3a9005ccf461a34072512ade591f966f59dd87e/kaptbug2.rar First Rebuild will fail because it can't find annotated calss under .import, after that it wouldn't be able to clean generator module becase of some file lock.