https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kapt
  • d

    david.bilik

    02/02/2017, 10:17 AM
    i see, so there is no solution to use java + kotlin in same project when i want to use annotation processing in both languages?
    e
    11 replies · 2 participants
  • l

    loganj

    02/17/2017, 1:47 PM
    I have a dumb question, mostly historical. what are the high-level differences from kapt -> kapt2 -> kapt3?
    e
    2 replies · 2 participants
  • g

    gildor

    02/22/2017, 1:03 AM
    @alexey.tsvetkov Yes, of course, I understand that IC cannot improve time of AP, but can improve Java compilation time. But release notes also contains line
    Compile-avoidance is deactivated if annotation processors are found on the compile classpath
    and few lines below there is code example how to register AP configuration to exclude dependencies with AP from compile classpath. And my question is: should it work with kapt out of the box, or should I register kapt by the same way how in release notes example? Incremental compilation of Kotlin is significantly improved our build time. And, because we still have a lot of Java code, It’s just important thing for our project, to achieve incremental Java compilation too. actually what Kotlin IC is doing, even when AP is used in project. Because old Gradle Java IC is disabled if you project contains AP.
    a
    1 reply · 2 participants
  • y

    yan

    03/07/2017, 1:53 PM
    https://kotlinlang.slack.com/archives/kapt/p1488853942000442 Yes, it’s a compiler plugin, and it can be potentially used with any build system. The Gradle plugin just provides the task that sets the required compiler plugin options.
    k
    c
    5 replies · 3 participants
  • y

    yan

    03/15/2017, 12:44 PM
    @themarketka Can you please create the issue for this? Any reproducible example is appreciated as well.
    t
    2 replies · 2 participants
  • t

    themarketka

    03/23/2017, 4:56 PM
    kapt3, kotlin 1.0.6: builds, although shows errors such as
    error: cannot find symbol import com.packagename.SomeActivity_;
    kapt3, kotlin 1.0.7: fails build, shows the same error kapt3, kotlin 1.1.1: same (using androidannotations and otto)
    1 reply · 1 participant
  • p

    pavlospt

    03/27/2017, 11:45 AM
    Is there any way to tell kapt Compiler to compile with specific compiler args?
    e
    y
    34 replies · 3 participants
  • s

    snowe

    03/31/2017, 1:43 PM
    Dang alright. With kotlin is there any way to use annotation processing to insert code or would I have to generate separate classes?
    d
    2 replies · 2 participants
  • p

    pavlospt

    04/03/2017, 8:16 AM
    When Kapt fails it says something about a log that we should check for more details. Does anyone actually know where that log is?
    🤔 2
    k
    14 replies · 2 participants
  • j

    jw

    04/16/2017, 4:25 AM
    Build system plugin
    s
    1 reply · 2 participants
  • j

    jw

    04/19/2017, 1:10 PM
    It's not ready, but it's getting there
    y
    2 replies · 2 participants
  • s

    spierce7

    05/25/2017, 1:28 AM
    does kapt3 perform well? Last I heard annotation processing in kotlin had bad performance. Is that still true?
    d
    3 replies · 2 participants
  • y

    yigit

    05/29/2017, 2:40 AM
    Trying to debug an annotation processor (using kotlin) on an android app (using kapt) but breakpoints does not work. Any guidence? I'm running:
    gw --no-daemon :r:in:k:asDeb -Dkotlin.daemon.jvm.options="-Xdebug,-Xrunjdwp:transport=dt_socket\,address=5005\,server=y\,suspend=y"
    after killing both daemons. I can connect, get a thread dump etc but it does not stop in breakpoints. I tried,
    suspend=n
    , does not help. I've also tried
    -Dkotlin.compiler.execution.strategy="in-process"
    to debug in gradle process but in that case daemon crashes.
    y
    2 replies · 2 participants
  • g

    greenrobot

    06/01/2017, 7:46 PM
    org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':tests:xxx-kotlin-test'.
    caused by
    
    kotlin.TypeCastException: null cannot be cast to non-null type org.jetbrains.kotlin.gradle.internal.WrappedVariantData<*>
    	at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.createKaptKotlinTask(Kapt3KotlinGradleSubplugin.kt:260)
    	at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.apply(Kapt3KotlinGradleSubplugin.kt:150)
    	at org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin.apply(Kapt3KotlinGradleSubplugin.kt:54)
    	at org.jetbrains.kotlin.gradle.plugin.SubpluginEnvironment.addSubpluginOptions(KotlinPlugin.kt:679)
    	at org.jetbrains.kotlin.gradle.plugin.Kotlin2JvmSourceSetProcessor$doTargetSpecificProcessing$1.execute(KotlinPlugin.kt:121)
    	at org.jetbrains.kotlin.gradle.plugin.Kotlin2JvmSourceSetProcessor$doTargetSpecificProcessing$1.execute(KotlinPlugin.kt:93)
    	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:89)
    h
    4 replies · 2 participants
  • j

    jw

    06/10/2017, 4:29 AM
    logs are
    00:11:21.355 [DEBUG] [org.gradle.api.Project] [KOTLIN] kapt: Discovered annotation processors: com.google.auto.service.processor.AutoServiceProcessor
    00:11:21.355 [DEBUG] [org.gradle.api.Project] [KOTLIN] kapt: Stub annotation generated: /Users/jw/dev/square/cash/thing-processor/build/tmp/kapt/main/wrappers/__gen/KotlinAptAnnotation.class
    00:11:21.356 [DEBUG] [org.gradle.api.Project] [KOTLIN] kapt: Wrapper for com.google.auto.service.processor.AutoServiceProcessor generated: /Users/jw/dev/square/cash/thing-processor/build/tmp/kapt/main/wrappers/__gen/AnnotationProcessorWrapper_main_com_google_auto_service_processor_AutoServiceProcessor.class
    and then the compiler args
    -processor __gen.AnnotationProcessorWrapper_main_com_google_auto_service_processor_AutoServiceProcessor -s /Users/jw/dev/square/cash/thing-processor/build/generated/source/kapt/main -Akapt.annotations=/Users/jw/dev/square/cash/thing-processor/build/tmp/kapt/main/wrappers/annotations.main.txt -Akapt.kotlin.generated=/Users/jw/dev/square/cash/thing-processor/build/tmp/kapt/main/kotlinGenerated /Users/jw/dev/square/cash/thing-processor/build/tmp/kapt/main/java_src/__gen/annotation/Cl.java
    p
    1 reply · 2 participants
  • c

    codeprogression

    06/13/2017, 4:02 PM
    In the dependencies section of gradle, will
    kapt
    always be required? IOW, will it ever transition to using
    annotationProcessor
    ?
    kapt "com.google.dagger:dagger-compiler:$daggerVersion"
    //vs
    annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
    h
    2 replies · 2 participants
  • e

    Eugenio

    06/16/2017, 8:57 AM
    but in general you should be able to get it working with kapt1
    p
    2 replies · 2 participants
  • y

    yan

    06/21/2017, 3:30 PM
    @agrosner This is fixed in https://youtrack.jetbrains.com/issue/KT-17245 (Kotlin 1.1.3)
    a
    4 replies · 2 participants
  • y

    yan

    07/12/2017, 7:02 PM
    No, it is enabled by default.
    kapt.generateStubs = true
    just allows you to use generated references in Kotlin code.
    g
    1 reply · 2 participants
  • y

    yan

    07/31/2017, 7:47 PM
    Can you please file an issue for this?
    e
    1 reply · 2 participants
  • j

    jw

    08/04/2017, 3:59 PM
    Small modules and compilation avoidance are your best hope for fast builds with annotation processors.
    s
    2 replies · 2 participants
  • y

    yan

    08/22/2017, 2:42 PM
    @mzgreen https://youtrack.jetbrains.com/issue/KT-19700
    m
    2 replies · 2 participants
  • m

    mannodermaus

    08/25/2017, 8:39 AM
    I’m trying to make my annotation processor support both annotated Java & Kotlin classes, but using a different code generation path for the latter. Is there a way to know that the annotated class is written in Kotlin originally? Seems like
    @kotlin.Metadata
    isn’t detectable from the processor’s environment. This guy has had a similar issue: https://discuss.kotlinlang.org/t/kotlin-data-classes-inspection-from-annotation-processor/2163
    🙇 1
    1 reply · 1 participant
  • v

    vmironov

    08/29/2017, 2:11 PM
    I believe the problem has nothing to do with your codebase. We started to receive a lot of
    error.NonExistentClass
    during incremental builds after upgrading to
    1.1.4
    . Cleaning the project solves the problem, but it makes
    kapt
    completely unusable. We were forced to downgrade to
    1.1.3
    .
    a
    1 reply · 2 participants
  • m

    mzgreen

    08/31/2017, 7:33 AM
    @yan for me IC seems to be broken in 1.1.4-3. I have to manually clean the project and then build again.
    y
    a
    6 replies · 3 participants
  • s

    simon.vergauwen

    09/02/2017, 9:54 AM
    Any1 knows if there is a way of figuring out in kapt if my annotated class is sealed?
    e
    3 replies · 2 participants
  • m

    mannodermaus

    09/04/2017, 12:01 PM
    It’s more about the lack of knowledge about the Kotlin environment in that library, i.e. there is no
    assertThat(kotlinc().compile(...)).suceeded()
    y
    1 reply · 2 participants
  • l

    lasse

    09/27/2017, 7:12 AM
    I am using kapt in a multi-module project together with Toothpick, which is similar to Dagger. When compiling a clean build works fine. Incremental builds usually fail, but retrying sometimes work. It complains about missing symbols. It can’t find all the factories.
    y
    1 reply · 2 participants
  • u

    uhe

    09/27/2017, 7:39 AM
    @lasse I frequently run into similar issues, where only a clean build would help. Still on gradle 2.3.3, though.
    y
    2 replies · 2 participants
  • b

    bdawg.io

    10/24/2017, 9:24 PM
    Does anyone know how to add an annotation to a generated class and have it be recognized during the same annotation processing step? Use Case We have a central interface for a data type that we have a custom annotation for. One of the processing steps is to generate a Requery entity with requery’s annotation Expected Result Requery’s annotation processor receives our generated entity during the same build Actual Result A second build has to be ran back-to-back so the generated entity already exists before annotation processing starts
    1 reply · 1 participant
Powered by Linen
Title
b

bdawg.io

10/24/2017, 9:24 PM
Does anyone know how to add an annotation to a generated class and have it be recognized during the same annotation processing step? Use Case We have a central interface for a data type that we have a custom annotation for. One of the processing steps is to generate a Requery entity with requery’s annotation Expected Result Requery’s annotation processor receives our generated entity during the same build Actual Result A second build has to be ran back-to-back so the generated entity already exists before annotation processing starts
@trevjones ^^
View count: 3