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
k2-early-adopters
  • m

    mcpiroman

    07/12/2022, 7:39 PM
    K2 gives error when used with kotlinx-serialization. But AFAIK, for the frontend, it only adds some minor diagnostics that I'm fine without. So could it work otherwise?
    a
    m
    4 replies · 3 participants
  • n

    natario1

    07/13/2022, 1:46 PM
    I’d like to ask why plugins are not supported. Is it because K2 changes the plugins API so all plugins must be adapted, or is it because it keeps the API but the underlying implementation is not there yet? I am starting to work on my first plugin this week and I wonder if I should consider/know about K2 when designing the plugin.
    m
    d
    4 replies · 3 participants
  • c

    christophsturm

    07/14/2022, 3:52 PM
    is the k2 compiler expected to compile any valid kotlin file? in one of my open source projects that compiles fine with kotlin 1.7.10 i get compile errors with k2
    d
    7 replies · 2 participants
  • o

    Oleg Yukhnevich

    07/15/2022, 11:26 AM
    Tried to use k2 on internal project (kotlin 1.7.10) 1. error: 'init' hides member of supertype 'UIComponent' and needs 'override' modifier - I have a view class with
    public init
    method, and supertype is from library where it
    internal init
    - I would expect no error here (if not known, will create an issue) 2.
    New inference error [NewConstraintError at Incorporate TypeVariable(T) == ft<kotlin/Any, kotlin/Any?> from Fix variable TypeVariable(T) from position Fix variable TypeVariable(T): ft<kotlin/Any, kotlin/Any?> <!: CapturedType(*)?]
    - have no idea what does it mean 🙂 3.
    val closeModalWindow = fun() { progressModalStage?.close() }
    with K2 produces error: Return type mismatch: expected kotlin/Unit, actual kotlin/Unit? (not critical, as we can just specify type
    () -> Unit
    explicitly for variable) 4. several issue with generics variances and java interop, but I have no idea how to create a small reproducer without internal codebase: Assignment type mismatch: actual type is ft<javafx/collections/ObservableList<out ft<OURTYPE, OURTYPE?>>, javafx/collections/ObservableList<out ft<OURTYPE, OURTYPE?>>?> but ft<javafx/collections/ObservableList<ft<CapturedType(out OURTYPE), CapturedType(out OURTYPE)?>>, javafx/collections/ObservableList<ft<CapturedType(out OURTYPE), CapturedType(out OURTYPE)?>>?> was expected If something isn't known, I will create issues, but I will not be able to provide access to internal codebase. FYI: project using java/javafx 17 and outdated tornadofx (which latest version was published with kotlin 1.3) - so issues can be from this weird stack also
    m
    6 replies · 2 participants
  • o

    Oleg Yukhnevich

    07/15/2022, 11:27 AM
    BTW: Is it possible to enable K2 in multiplatform project - only for JVM target of course?
    d
    a
    8 replies · 3 participants
  • h

    Hamza GATTAL

    07/15/2022, 5:06 PM
    to switch to the new k2 compiler, you need to flow a migration guide or just enable it in gradle file
    m
    1 reply · 2 participants
  • a

    Akram Bensalem

    07/16/2022, 8:32 AM
    I want to start adopting k2 compiler on my Android Project Where do I have to put this line ?
    -Xuse-k2
    m
    p
    3 replies · 3 participants
  • r

    rkeazor

    07/27/2022, 9:37 PM
    Is the new Compiler Plugin extenstion API ready to be tested. if so where can we see documentation for it
    d
    2 replies · 2 participants
  • g

    Grigory Panko

    08/02/2022, 9:38 PM
    Hey, I'm trying out K2 Compiler in my project which also uses kotlin-lombok plugin. As i can see in changelog, K2 supports kotlin-lombok plugin since 1.7.20-Beta version. I updated Kotlin version for both Kotlin and kotlin-lombok plugins, but K2 still shows error if i try to build my project:
    There are some plugins incompatible with K2 compiler:
      org.jetbrains.kotlin.lombok.LombokComponentRegistrar
    Please remove -Xuse-k2
    Note that this error is different from error in 1.7.10:
    e: Compiler plugins are enabled with K2 compiler.
     K2 does not support plugins yet, so please remove -Xuse-k2 flag
    Did I forget to update anything?
    d
    c
    3 replies · 3 participants
  • a

    Ayfri

    08/07/2022, 8:39 AM
    Does K2 affects the generated code ?
    d
    1 reply · 2 participants
  • z

    Zac Sweers

    08/07/2022, 9:02 PM
    Testing FIR in 1.7.20-Beta and finding the API for reporting diagnostics to be a bit limited. Few things came up • Are there plans to expose these errors in the IDE? Currently I’m not able to find any report of them in the IDE, only build-time • Are there plans to expose a way to add custom error messages to the user? Right now they are opaque reports (see first screenshot) • Currently, if both errors and warnings are reported, only the errors are shown (second screenshot) • Failure to recompile appears to break incremental compilation, or at least reports something about it (also second screenshot) • Are there plans to expose a “quickfix” or similar API to provide fixes to issues being reported? All of this is is from this branch: https://github.com/ZacSweers/redacted-compiler-plugin/compare/z/firTesting?expand=1 Happy to file bug reports or feature requests for the above issues as necessary too!
    d
    2 replies · 2 participants
  • z

    Zac Sweers

    08/07/2022, 9:03 PM
    Related followup: Are there plans to support FIR-contributed changes in decompiled kotlin bytecode? • For instance - in the all-open plugin, if the FIR extension is enabled will the IDE properly render the stripped
    final
    modifier in decompiled bytecode? • If so, should plugin authors implement this functionality in their plugins? When would they choose to implement it in FIR vs IR in those cases?
    d
    3 replies · 2 participants
  • g

    Gavin Ray

    08/17/2022, 8:22 PM
    Hiya, wanted to share a regression using K2 with Kotlin 1.7.20-Beta It's related to Curiously-Recurring Template Pattern/"_F_-bounded quantification" in TestContainers classes:
    New inference error [NewConstraintError at Incorporate TypeVariable(SELF) == CapturedType(*) from Fix variable TypeVariable(SELF) from position Fix variable TypeVariable(SELF): CapturedType(*) <!: ft<org/testcontainers/containers/MySQLContainer<ft<CapturedType(*) & Any, CapturedType(*)?>>, org/testcontainers/containers/MySQLContainer<ft<CapturedType(*) & Any, CapturedType(*)?>>?>]
    Where that line is:
    private val container = MySQLContainer(imageName).withInitScript(initScript)
    And MySQL class definition is:
    public class MySQLContainer<SELF extends MySQLContainer<SELF>> extends JdbcDatabaseContainer<SELF>
    m
    2 replies · 2 participants
  • g

    Gavin Ray

    08/17/2022, 8:23 PM
    These are the compiler flags I have enabled:
  • o

    Oleg Yukhnevich

    08/23/2022, 8:19 PM
    Hey, while we waiting for multiplatform K2, I was able to hack
    rsocket-kotlin
    to be jvm project instead of multiplatform: https://github.com/rsocket/rsocket-kotlin/tree/k2 And configured CI to run with and without K2 with different kotlin versions (CI run example here: https://github.com/rsocket/rsocket-kotlin/actions/runs/2914307633) And found 2 issues already: • https://youtrack.jetbrains.com/issue/KT-53698/K2-fails-to-resolve-suppressed-internal-symbol • https://youtrack.jetbrains.com/issue/KT-53699/K2-Exception-during-IR-lowering-in-code-with-coroutines Will continue creating issues if something new will happen Also will try to setup similar setup for JS and Native, when K2 for them will be ready, until K2 multiplatform support P.S. if K2 for JS/Native is already available with some highly experimental flag, please point on it, so I will setup such CI runs for them 🙂
    d
    3 replies · 2 participants
  • v

    vineethraj49

    08/24/2022, 4:36 AM
    hey folks; maven shop here,
    Did K2 compilation went well?
    yep. few minor fixes for type inference (+-10 lines), and having to bump up to 1.7.20-Beta due to this bug but was fine otherwise.
    Have you noticed a difference in the build speed?
    yep! our biggest module went from 44s to 20s on average so that’s great! overall, we see a ~25% improvement
    Or what errors you encountered with, if they happened?
    1. aforementioned bug 2.
    value?.property
    on a definitely non-null
    value
    was complaining, but am assuming it’s by design, so just fixed it 3. if both
    kotlin-stdlib-jdk8
    and
    kotlin-stdlib-jre8
    are somehow on path, the compiler complains about “confusing overloads”. excluding
    -jre8
    worked.
    d
    s
    5 replies · 3 participants
  • m

    Marc Reichelt

    08/24/2022, 1:03 PM
    Hey there! I tried to use K2 with Kotlin 1.7.10, and our project uses both KSP and Compose. Both don't work, because K2 only starts supporting compiler plugins on 1.7.20. Is the Compose compiler on the agenda for 1.7.20, or do we have to wait a bit longer?
    d
    t
    +1
    14 replies · 4 participants
  • z

    Zac Sweers

    08/24/2022, 6:48 PM
    can code compiled with k2 be consumed in projects not using k2? i.e. if we wanted to enable it in subprojects that can enable it but not necessarily app
    m
    d
    2 replies · 3 participants
  • r

    rrva

    09/04/2022, 7:54 AM
    can I use @JvmRecord with k2?
  • r

    rrva

    09/04/2022, 7:54 AM
    seems not to work
    d
    2 replies · 2 participants
  • r

    rrva

    09/04/2022, 9:37 AM
    I mitigated it by stopping to use k2 compiler for just that module which contained @JvmRecord annotated classes (a special case for faster deserialization of huge amounts of objects)
    g
    4 replies · 2 participants
  • d

    dmitriy.novozhilov

    09/26/2022, 1:56 PM
    https://kotlinlang.slack.com/archives/C2R77UD35/p1664200597713319
  • p

    PHondogo

    09/29/2022, 7:29 PM
    Hello! Where can I read about k2 compiler from compiler plugin development point of view?
    d
    3 replies · 2 participants
  • e

    Eric Ou

    10/02/2022, 5:00 AM
    java.lang.IllegalArgumentException: class org.jetbrains.kotlin.psi.KtParameter is not a subtype of class org.jetbrains.kotlin.psi.KtAnnotationEntry for factory REPEATED_ANNOTATION
    Hey! I got this error when compiling with k2, which isn't thrown when I compile with the old compiler, lmk if you guys need more info to look into this! P.S. This is the first time I've had problem with k2 since initial release, it is surprising stable.
    i
    4 replies · 2 participants
  • r

    rrva

    10/03/2022, 11:22 AM
    k2 gives different warnings for using deprecated code, can I for a specific file suppress deprecation warnings with @File (specifically, an enum class annotated with @Deprecated)
    d
    9 replies · 2 participants
  • m

    mitch

    10/15/2022, 11:52 AM
    Hi there I saw the blog that says allopen is now supported in k2. Today I’ve upgraded the kotlin version to 1.7.20 and trying to switch our current spring project to use k2 compiler, and somehow the kotlin-spring plugin didn’t seem to open the classes anymore? when i switch that back to the old compiler the kotlin-spring plugin works again. I wonder if there’s anything I miss there to make kotlin-spring plugin play nicely with k2 compiler?
    d
    j
    4 replies · 3 participants
  • a

    atsushieno

    11/03/2022, 10:19 AM
    Hi. I'm trying to use K2 compiler in my projects. My base project builds without problem, but my derived project (building w/o K2) that uses it fails, due to "(xxx) is compiled by the new Kotlin compiler frontend and cannot be loaded by the old compiler". The error makes sense if things are essentially binary incompatible, but what feels odd to me is that I also have some modules in my base project without `useK2`in my
    kotlinOptions
    because they depend on Jetpack Compose (compiler plugin) but they still build (while they depend on other modules that are compiled with
    useK2 = true
    ). Any ideas why that happens? Those builds reproduced as https://github.com/atsushieno/android-audio-plugin-framework/commit/2737fd77e176e866306329703b793e10bf8d76e7 (base) and https://github.com/atsushieno/aap-lv2/actions/runs/3384694415/jobs/5621953393#step:10:1347 (derived)
    a
    4 replies · 2 participants
  • e

    Eric Ou

    11/04/2022, 3:10 PM
    Class 'class' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
    The this error is shown by the IDE despite the project using K2, and and project compiles and runs fine.
    a
    4 replies · 2 participants
  • g

    Gavin Ray

    11/10/2022, 6:03 PM
    Is it valid to enable all of these flags, or do some conflict?
    "-Xuse-k2",
    "-Xuse-fir-extended-checkers",
    "-Xuse-fir-ic",
    "-Xuse-fir-lt",
    d
    a
    9 replies · 3 participants
  • e

    efemoney

    11/18/2022, 2:34 PM
    Where is the list of current compiler plugins that are supported by K2? (Looking for kapt & ksp in particular) seen 😅
Powered by Linen
Title
e

efemoney

11/18/2022, 2:34 PM
Where is the list of current compiler plugins that are supported by K2? (Looking for kapt & ksp in particular) seen 😅
View count: 5