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
  • e

    epool

    05/23/2018, 3:18 PM
    I just built an annotation processor that generates a builder class for my classes annotated with
    @DataBuilder
    , my classes annotated with this annotation are located in
    com.my.package.model
    and the generated builder class is also located in the same package
    com.my.package.model
    but in the generated directory of course
    build/generated/source/kapt/debug/com/my/package/model/MyModelBuilder.kt
    , I can use these generated classes fine inside of my model classes(written in Kotlin) BUT I cannot use the generated
    MyModelBuilder
    Kotlin class inside of a java class as a class member
    package com.my.package.home;
    import com.my.package.model.MyModelBuilder;
    public class Home {
        MyModelBuilder builder; // <=== AS recognizes the class, but I'm having an compilation issue
    }
    AndroidStudio recognizes the class, but I’m having this compilation issue
    com/my/package/home/Home.java:4: error: cannot find symbol
    MyModelBuilder builder;
               ^
      symbol:   class MyModelBuilder
      location: class Home
    it’s weird because I can use this generated builder class only inside of methods, this code works fine
    package com.my.package.home;
    import com.my.package.model.MyModelBuilder;
    public class Home {
        public void hello() {
            MyModelBuilder builder;
        }
    }
    could somebody here help me to understand this behavior? In advance, thanks!
    g
    • 2
    • 11
  • p

    pavel.shackih

    05/26/2018, 9:54 PM
    Is it possible to obtain parameter init value in kapt? For example for
    class User(var age: Int = 18)
    get
    18
    value.
    g
    e
    • 3
    • 3
  • g

    grandstaish

    06/12/2018, 12:57 PM
    Is there a quick hack I can do to get kapt to tell me how much time is spent for each annotation processor? I.e. I want to know which processors of the ones we use are the most expensive
    ➕ 1
    g
    y
    • 3
    • 3
  • s

    spierce7

    06/13/2018, 10:16 PM
    Found a bug in the new 1.2.50 release for kapt: https://youtrack.jetbrains.com/issue/KT-24919
    ➕ 1
    u
    • 2
    • 2
  • o

    okaymak

    07/04/2018, 2:14 PM
    Getting this error when creating a custom
    DataBindingComponent
    inside a library module which is being used from an app module (in an android project):
    e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
        class <redacted>.CustomComponent, unresolved supertypes: android.databinding.DataBindingComponent
    Is this a bug in kapt?
    g
    y
    • 3
    • 5
  • r

    ralf

    07/11/2018, 3:50 AM
    Kapt is failing with
    e: Unknown option: infoAsWarnings
    with
    1.2.60-eap-44
    . Anyone else seeing this?
    y
    • 2
    • 2
  • y

    yogurtearl

    08/01/2018, 11:48 PM
    @yan any specific reason for choosing
    IsolationMode.PROCESS
    ? Maybe could have a flag to use
    IsolationMode.NONE
    ?
    👍 1
    y
    • 2
    • 2
  • c

    cristiangm

    08/22/2018, 3:14 PM
    Is it going to become incremental soon?
    g
    • 2
    • 1
  • a

    agrosner

    08/22/2018, 3:49 PM
    Dagger works fine with multiple modules in fact you can use this example. My company is building a completely open source app for the art institute of Chicago: github.com/art-institute-of-chicago/aic-mobile-android I do most of the code reviews and we welcome all contributions once development slows down
    c
    j
    g
    • 4
    • 18
  • p

    poohbar

    08/27/2018, 1:26 PM
    🐛
    kapt
    used as an execution in
    kotlin-maven-plugin
    breaks IntelliJ's
    pom.xml
    parsing with Kotlin version
    1.2.61
    and IntelliJ version
    2018.2.2.
    Source folders are not marked correctly upon reimporting the maven project, it only marks kapt's generated source directory as source.
    a
    • 2
    • 5
  • s

    serj

    09/10/2018, 4:11 PM
    Looks like it works in 1.3-M2
    💪 1
    g
    • 2
    • 3
  • a

    agrosner

    09/13/2018, 3:02 PM
    You use JavaPoet or something of that nature?
    h
    b
    • 3
    • 9
  • s

    serj

    09/20/2018, 8:58 AM
    Is there a way to make IntelliJ see the generated files in
    build/generated/source/kaptKotlin
    ?
    j
    • 2
    • 2
  • k

    karelpeeters

    09/25/2018, 9:03 PM
    Is there something else for that then, or is it just impossible?
    g
    • 2
    • 1
  • k

    karelpeeters

    09/26/2018, 10:39 AM
    I need state for both parent classes.
    e
    • 2
    • 45
  • j

    jmccance

    09/26/2018, 3:43 PM
    Is there a trick to getting kapt working with Java 10+? I have a simple Gradle projects that works with 8 and 9, but not 10 or 11.
    • 1
    • 2
  • q

    quiro

    09/29/2018, 5:38 PM
    hey everyone, in the Kotlin 1.2.60 announcement post it was said that the plan was to make
    kapt.use.worker.api
    enabled by default from Kotlin 1.2.70. Did it happen? Is it now the default?
    o
    a
    • 3
    • 3
  • b

    bdawg.io

    10/10/2018, 12:42 AM
    Does anyone have recommendations on libraries/articles that covers annotation processing of properties and objects? Is there any way to utilize Kotlin Reflect from Element/TypeElement/etc?
    e
    r
    • 3
    • 7
  • r

    Riccardo Montagnin

    10/18/2018, 9:26 PM
    Hello guys. During the build I get the following error:
    > Task :app:kaptGenerateStubsDebugKotlin
    e: error: cannot access Retrofit
      class file for retrofit2.Retrofit not found
      Consult the following stack trace for details.
      com.sun.tools.javac.code.Symbol$CompletionFailure: class file for retrofit2.Retrofit not found
    The problem is that that class is present inside the following dependency:
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    When I switch from
    implementation
    to
    compile
    , the error disappears. What could it be?
    g
    • 2
    • 1
  • r

    Riccardo Montagnin

    10/18/2018, 9:30 PM
    build.gradle
    k
    • 2
    • 1
  • r

    raulraja

    11/03/2018, 1:40 AM
    Is there a way in kapt to get a hold of the structure of a function literal with receiver? When I try to extract info from
    TypeElement
    or the Kotlin Metadata library by @Eugenio for a function of the shape:
    A.() -> B
    it always shows up as
    Function1<A, B>
    but I have not found a place or API that denotes the declaration of such function as being the type of a receiver function.
    e
    • 2
    • 5
  • p

    poohbar

    11/05/2018, 5:15 PM
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7.935 s
    [INFO] Finished at: 2018-11-05T12:14:25-05:00
    [INFO] Final Memory: 46M/570M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.0:kapt (kapt) on project redacted: Execution kapt of goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.0:kapt failed: A required class was missing while executing org.jetbrains.kotlin:kotlin-maven-plugin:1.3.0:kapt: kotlin/reflect/full/KClasses
    a
    • 2
    • 4
  • d

    deviant

    11/06/2018, 1:41 PM
    I'm trying to set up QueryDsl lib in my project. It requires
    kapt
    so i enabled it in the gradle config and got this crash:
    ...
    Caused by: java.lang.UnsupportedOperationException: no descriptor for type constructor of TypeVariable(R)?
    	at org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt.mapType(typeSignatureMapping.kt:89)
    	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.java:502)
    	at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.java:456)
    	at org.jetbrains.kotlin.codegen.CodegenUtilKt.asmType(codegenUtil.kt:274)
    	at org.jetbrains.kotlin.codegen.CodegenUtilKt.asmType(codegenUtil.kt:277)
    	at org.jetbrains.kotlin.codegen.ExpressionCodegen.expressionType(ExpressionCodegen.java:459)
    	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitSafeQualifiedExpression(ExpressionCodegen.java:3159)
    	at org.jetbrains.kotlin.codegen.ExpressionCodegen.visitSafeQualifiedExpression(ExpressionCodegen.java:108)
    	at org.jetbrains.kotlin.psi.KtSafeQualifiedExpression.accept(KtSafeQualifiedExpression.kt:23)
    	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitKtElement(CodegenStatementVisitor.java:31)
    	at org.jetbrains.kotlin.codegen.CodegenStatementVisitor.visitKtElement(CodegenStatementVisitor.java:22)
    	at org.jetbrains.kotlin.psi.KtVisitor.visitExpression(KtVisitor.java:182)
    	at org.jetbrains.kotlin.psi.KtVisitor.visitQualifiedExpression(KtVisitor.java:286)
    	at org.jetbrains.kotlin.psi.KtVisitor.visitSafeQualifiedExpression(KtVisitor.java:306)
    	at org.jetbrains.kotlin.psi.KtSafeQualifiedExpression.accept(KtSafeQualifiedExpression.kt:23)
    	at org.jetbrains.kotlin.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:296)
    	... 103 more
    have anybody expected similar issues?
    a
    • 2
    • 1
  • k

    kschlesselmann

    11/30/2018, 8:24 AM
    Hi, currently I'm facing https://stackoverflow.com/questions/53289265/invalid-method-declaration-in-kotlin-enum-class-building-with-gradle-wrapper I think. We migrate our build chain to JDK11 though so a fallback to Java 8 is no real option. My error is
    > Task :kaptGenerateStubsKotlin
    e: …/Condition.java:16: error: invalid method declaration; return type required
            Condition() {
            ^
    with an enum class like
    enum class Condition {
    
        EXACT {
            override fun evaluate(actual: Set<String>, expected: Set<String>) = actual == expected
        },
    
    //....
    
        abstract fun evaluate(actual: Set<String>, expected: Set<String>): Boolean
    }
    My build setup is
    ➜ gradle -v                                                             
    executing gradlew instead of gradle
    
    ------------------------------------------------------------
    Gradle 5.0
    ------------------------------------------------------------
    
    Build time:   2018-11-26 11:48:43 UTC
    Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987
    
    Kotlin DSL:   1.0.4
    Kotlin:       1.3.10
    Groovy:       2.5.4
    Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
    JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
    OS:           Linux 4.19.4-arch1-1-ARCH amd64
    Any suggestions how to handle this error?
    a
    • 2
    • 3
  • r

    raulraja

    12/03/2018, 12:14 PM
    Hi, Is there a way in kapt or by other means through Kotlin reflection or @Eugenio metadata lib to access the
    KDoc
    of a class and its functions programmatically? I looked in both APIs and could not find any references to the content about kdoc.
    e
    • 2
    • 2
  • m

    mzgreen

    12/13/2018, 8:36 AM
    Tried clean and even clean build caches and restart android studio but it didn’t help. Is there any way to clean kapt cache?
    h
    • 2
    • 1
  • e

    Eugen Martynov

    01/12/2019, 11:50 PM
    I’m trying to update to gradle 5.x and with
    kapt.use.worker.api=true
    android build fails with OOM
    g
    • 2
    • 5
  • n

    Nikky

    01/13/2019, 2:16 AM
    i did.. now i am getting this:
    e: /home/nikky/dev/fabric/config/build/tmp/kapt3/stubs/main/config/CottonConfig.java:6: error: incompatible types: NonExistentClass cannot be converted to Annotation
    g
    y
    • 3
    • 48
  • n

    Nikky

    01/13/2019, 5:31 AM
    okay so kapt runs and generates files but no clue how i can get logging to work..
    processingEnv.messager
    seems to not do anythng
    g
    t
    • 3
    • 2
  • m

    mersan

    01/13/2019, 9:10 PM
    If I run the task manually from gradle kaptGradle it will generate the classes
    n
    • 2
    • 1
Powered by Linen
Title
m

mersan

01/13/2019, 9:10 PM
If I run the task manually from gradle kaptGradle it will generate the classes
n

Nikky

01/13/2019, 10:47 PM
if running the task fixes it.. how about making some task depend on
kaptKotlin
or however its called ?
View count: 9