https://kotlinlang.org logo
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
arrow-meta
  • b

    Ben Woodworth

    09/30/2020, 7:00 AM
    Hi! I'm trying to install the IDEA plugin (idea-plugin-1.4.10-20200928.154707-13.jar), but after installing it from disk and restarting IntelliJ, I'm getting an error. Am I doing something wrong? (I'm using IntelliJ 2020.2.2 with Kotlin 1.4.10)
    error.txt
    r
    • 2
    • 8
  • b

    Ben Woodworth

    10/01/2020, 4:59 AM
    I've been playing around a ton with type proofs, and I'm super excited with all the possibilities! 🙂 I'm wondering, is it currently possible to do anything like KEEP-87, for something like extension interfaces? For example:
    interface NumberExtensions<T> {
        fun T.squared(): T
    }
    
    @Given
    object IntExtensions : NumberExtensions<Int> {
        override fun Int.squared(): Int = this * this
    }
    
    class MyClass(
        /*with*/ val intExtensions: NumberExtensions<Int> = given, // Something like KEEP-87's 'with'
    ) /*: NumberExtensions<Int> by intExtensions*/ {               // Without needing to delegate like this
        fun printTwoSquared(): Unit =
            println(2.squared()) // Unresolved reference: squared
    }
    r
    • 2
    • 6
  • p

    Petr Makagon

    10/01/2020, 8:43 PM
    here is build file
    import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
    
    
    buildscript {
        repositories {
            maven { url = uri("<https://oss.jfrog.org/artifactory/oss-snapshot-local/>") }
        }
        dependencies {
            classpath("io.arrow-kt:gradle-plugin:1.4.10-SNAPSHOT")
        }
    }
    
    plugins {
        kotlin("jvm") version "1.4.10"
    }
    
    apply(plugin = "io.arrow-kt.arrow")
    
    dependencies {
        compileOnly( "io.arrow-kt:arrow-meta-prelude:1.4.10-SNAPSHOT")
        testImplementation(kotlin("test-junit"))
    }
    
    tasks.withType<KotlinCompile>() {
        kotlinOptions.jvmTarget = "1.8"
        kotlinOptions.freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies")
    }
    
    repositories {
        mavenCentral()
        maven("<https://oss.jfrog.org/artifactory/oss-snapshot-local/>")
    }
    r
    • 2
    • 7
  • b

    Ben Woodworth

    10/04/2020, 7:12 PM
    So I converted a project from using dagger/javax.inject to using
    @Given
    . The code compiles fine without the arrow meta gradle plugin (with runtime exceptions because of the
    given
    default parameters), but with the plugin, I'm getting a compiler error:
    java.lang.IllegalArgumentException: Unbound type parameters are forbidden: [Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@9d89209]
    Project: Repo (3.2-arrow-meta branch, build with
    ./gradlew build
    ) Stack trace: Gradle build scan Is there a good way for me to go about debugging this? And if this is the same issue, then it might just be an issue in Kotlin that'll be fixed in 1.4.20.
    r
    • 2
    • 2
  • l

    Leandro Ocampo

    10/07/2020, 2:18 PM
    Hello people! hope you are having a great day. I have some questions related to using arrow meta in the IR phase. First of all I am the one who wrote this question in the github repo: https://github.com/arrow-kt/arrow-meta/issues/767. Sorry for that. I had no idea where I could ask for help 😅. At the moment I am having some issues when trying to transform code in the IR phase. I can see that the code is being changed when I use irDump but it fails when I test with quoteOutputMatches. I used this code:
    val Meta.irLogTest: CliPlugin
        get() =
            "IR log CLI" {
                meta(
                    enableIr(),
                    irBody { this.irLogBody(it) },
                    irDump()
                )
            }
    
    fun IrUtils.irLogBody(irBody: IrBody): IrBody? {...}
    So my questions are: 1- are those extension phases enough to transform the code? Assuming irLogBody is applying some transformation. In this case by using
    irBody.transformChildrenVoid
    2- is it okay to test this changes with quoteOutputMatches? As far I can see it should, but maybe I am missing something. I was able to achieve this result with Arrow meta in the parsing phase.
    r
    • 2
    • 6
  • m

    marios proto

    10/08/2020, 2:54 PM
    👋 Are there any issues with Arrow-Meta when using an obfuscation tool? As it is very common to do in Android
    r
    • 2
    • 2
  • d

    dalexander

    10/09/2020, 2:34 PM
    I have a few questions if someone could assist: I want to generate adapters between an internal representation of data and a data class so I can do something like
    DataClass.from(internalRepresentation)
    without requiring developers to hand write the
    from
    adapter. I would do this using annotation processing but there's data missing in the kapt Java stubs (default values). I want to eventually add some validation as well, but generating adapters is the first step. 1) How safe would Arrow Meta would be for doing this for production? ie. How likely are there to be breaking API changes (especially non-trivial ones). I know there's some compiler revision going on right now so there's potentially a lot of uncertainty. 2) Is it reasonable to want to use Arrow Meta/a compiler plugin to do this? 3) Is it possible to use Arrow Meta like an annotation processor to generate code/classes for this rather than interacting more directly with the compiler (the examples I see are focused on transformation rather than generation)? (Generated code would provide a better plan B in case the plugin breaks at some point). Nevermind this one, just found the answer (yes).
    r
    • 2
    • 12
  • j

    jimn

    10/09/2020, 7:14 PM
    I am curious if type-proofs and arrow-meta have proven to get around some of the expensive boxing that the jvm normally imposes
    r
    • 2
    • 6
  • m

    marios proto

    10/10/2020, 7:02 PM
    👋 I am trying to see more of arrow-meta in action, and trying to use the `
    Transform.newSources
    function with a simple example to generate some code, within Android Studio the code is taken from arrow-meta documentation, as
    val Meta.transformNewSource: CliPlugin
        get() = "Transform New Source" {
            meta(
                classDeclaration(this, { name == "TestClass" }) {
                    Transform.newSources(
                        """
         package com.example.arrowexplorer
         //metadebug
         class ${name}_Generated {
          fun sayHi() = println("Hi!")
         }
         """.file("${name}_Generated")
                    )
                }
            )
        }
    The problem is I cannot find the generated class file or reference it later. The file actually exists here on this path
    /Users/userA/Library/Application Support/kotlin/daemon/build/generated/source/kapt/main/TestClass_Generated.kt
    Also tried to use the
    file("${name}_Generated", filePath ="/path")
    without success. Any help how can I include the generated file in my project?
    d
    r
    +2
    • 5
    • 28
  • d

    dalexander

    10/17/2020, 10:50 AM
    I've been working on a compiler plugin using Arrow Meta and it's been smooth sailing so far, but I have a few additional questions: 1) Is it possible to tell what phase of compilation the plugin is hooking in to (mostly out of curiosity)? Information that might help is it's using quote syntax and hooking into class declarations, generating files. It looks like file generation is associated with analysis, is that correct? 2) How can I do some processing after all the classes that the plugin will activate on have been processed? I want to produce a couple of what would effectively be "summary" files based on the processed data classes. It seems like this might involve something like a "post-current-phase" hook but I can't find something like that in the documentation. 3) Are new generated files operated on by the compiler plugins / annotation processors? Would I need to do anything special to make that happen?
    r
    • 2
    • 3
  • d

    dalexander

    10/21/2020, 6:31 PM
    I'm trying to pass a path parameter to my plugin to work around the
    kotlin/daemon
    path issue, is this the right syntax? I can't find any references to doing this in the context of arrow meta. I'm getting a build error (the path matches what's found in
    META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
    ): e: Invalid argument: -P plugin:com.abcd.MetaPlugin:buildPath=qwerasdf Is there also something I need to do in the quote syntax to make this work? Also does anyone know where this will show up, just in the
    compilerContext.configuration
    object? Just to clarify the syntax I'm using is
    -P plugin:<path-to-plugin>:param=value
    r
    r
    • 3
    • 6
  • h

    heyitsmohit

    10/22/2020, 9:43 PM
    Sharing a presentation I gave at Droidcon EMEA on Arrow Meta https://www.droidcon.com/media-detail?video=470216591.
    👍 6
    c
    d
    • 3
    • 3
  • a

    Alex

    10/26/2020, 9:07 PM
    Hey guys, whats the status for kotlin multiplatform? Is arrow-core ready?
    r
    • 2
    • 2
  • d

    dalexander

    10/29/2020, 2:39 PM
    Is there anything special that needs to be done to get hooks into the IR phase to work? I've tried to create a CliPlugin that hooks into IRGeneration, and I can see the getter being called as it's added to the registry, but the
    generate()
    function is never called by the compiler (sample code in comment).
    k
    r
    • 3
    • 5
  • d

    dalexander

    11/04/2020, 8:53 PM
    So I think I'm missing something obvious but I've been stuck on this problem for a while, and can't find any examples solving a similar problem. What I'm doing is generating a type adapter that takes classes of As and turns them into classes of B. This has gone pretty well, but I'm running issues with the next step I want to take, which is generating a "B provider" using the adapters. It seems like this requires knowing what all the adapters I've already created are, so I need a second phase of file generation, and this is where I've been running into issues. Are there any examples of generating files in the analysisCompleted phase, or modifying files in that phase? I haven't been able to figure out how to create a
    Transformation.newSources
    from within that function, or how to create a new KtFile successfully (the KtFile I've created and added to the files list have led to a NPE with the message 'VirtualFile is null for KtFile'). Any insight into how to create the provider in a second phase of analysis would be helpful, or a way of incrementally building a file during analysis that would only be written out when analysis was completed.
    r
    • 2
    • 8
  • r

    radekm

    11/25/2020, 10:01 AM
    Hi, I have written a simple compiler plugin with Arrow Meta. My plugin replaces every data class with
    Bar
    data class. My program builds and runs successfully but IntelliJ thinks it is wrong:
    r
    v
    • 3
    • 8
  • k

    Karin-Aleksandra Monoid

    11/25/2020, 1:26 PM
    Hey. I am trying to add arrow-meta to my project, but the existing instruction is a bit unclear (I also use kotlin for gradle script). Looking at https://meta.arrow-kt.io/setup.html the link to gradle is dead for example and so on. Is there any up-to-date guide? 🙂
    r
    • 2
    • 4
  • d

    dalexander

    12/09/2020, 2:52 PM
    I have two questions when someone finds a moment to look: 1) What should I do to make sure the IDE uses my plugin during the analysis phase so everything is green even before the project has been built once? I've heard it's possible to avoid the "red until built once" issue at least? 2) I'm not sure if this is quite the right channel, but I've been running into an issue with Android Studio / IDEA not discovering compiler plugin generated classes that I'm importing from another gradle module (ie. A is the main module, and B is the secondary module, there are generated classes in B that IDEA doesn't find). The project builds perfectly fine but the IDE always complains about unresolved references for the generated classes that are imported from the other module (classes generated in the main module behave as expected-- red until the first build then everything is fine). If I should ask about this in the intellij channel that's fine.
    r
    • 2
    • 3
  • a

    Ahmed Mourad

    12/12/2020, 1:20 AM
    Hey! Can I generate code (do transformations) after the analysis phase completes? I have this snippet, in which,
    generateAllViolations
    returns some code (String) that needs to be generated and that is referenced and used by other parts of the user's codebase.
    internal fun Meta.violationsGenerator(): AnalysisHandler = analysis(
        doAnalysis = Noop.nullable7<AnalysisResult>(),
        analysisCompleted = { _, _, bindingTrace, _ ->
            // this returns the code to generate
            val (location, code) = generateAllViolations(bindingTrace)
            null
        }
    )
    r
    • 2
    • 9
  • j

    Jolan Rensen [JetBrains]

    12/16/2020, 4:37 PM
    Hi, say I wanted to transform a property (or function) using kotlin-meta. Can I also find and transform all the places in a project where said property is used? (Like refactoring would do)
    property(ctx, { ... }) { prop: KtProperty ->
    
        // now where is this property used?
    
        Transform.replace(
            replacing = prop,
            newDeclaration = ...
        )
    }
    r
    • 2
    • 1
  • k

    Krzysiek Zgondek

    12/17/2020, 2:47 PM
    Hi, i would like to know if I can obtain constructor declaration from KtUserType or is this even possible. Same question for obtaining type information for every object contained in 'typeParameter' provided by namedFunction scope?
    r
    • 2
    • 3
  • a

    Ahmed Mourad

    12/18/2020, 10:36 AM
    Hey! Is it possible to get the class that a
    KotlinType
    (type parameter) is pointing to, in the analysis phase?
    r
    • 2
    • 3
  • a

    Ahmed Mourad

    12/24/2020, 2:37 PM
    Hey everyone! So I'm trying to get the fq name of a type argument and I've been using
    KotlinType#getJetTypeFqName
    , but I just noticed that it doesn't print the type arguments of the type arguments of this
    KotlinType
    . For example: If we have a type projection
    A<B<C>>
    , and we have
    A
    as a
    KotlinType
    , executing
    getJetTypeFqName
    on
    A
    returns
    A<B>
    and the arguments of
    B
    are simply ignored or erased. How do we get around this?
    r
    • 2
    • 3
  • a

    Ahmed Mourad

    12/24/2020, 2:42 PM
    There is also another generics problem where types are erased and replaced with their upper bounds. So if there is a property of type
    T
    , it is replaced with
    kotlin.Any
    , if it's of type
    T : List<*>
    , it's of type
    List<kotlin.Any>
    . I know that type-erasure is a thing, but what if I want to get the generic type (
    T
    ) where the type is generic, and the regular fq name when it is not? Is there a way to check if a type is a generic one?
    r
    • 2
    • 7
  • y

    Youssef Shoaib [MOD]

    01/10/2021, 2:29 PM
    Does meta type proofs have the ability to work on a multiplatform project yet? Because I'm trying to use it on the
    jvmMain
    sourceset in a very basic test multiplatform project and nothing is being replaced at all. I tried both
    @Given
    and
    @Coercion
    but to no avail. This is with the 1.4.10 snapshot. Oddly enough, I do recall it working on the
    jvmMain
    sourceset before with the 1.3.61 snapshot but I'm not sure. So yeah, is it maybe another issue, or does the plugin just not go through these sourcesets yet? And if so, is there a way to edit its configuration options to add the
    jvmMain
    directory manually as a user? Kinda like how it already goes through
    main
    and
    test
    , or should I just admit defeat and use a normal kotlin jvm project?
    r
    • 2
    • 1
  • d

    dalexander

    01/14/2021, 2:19 PM
    Is there a release schedule for snapshots? Is it a typically lot of work on the library side for your guys to update from 1.4.x to 1.4.(x+1)? If it's not too much work, a 1.4.21 snapshot might be useful in the near future.
    r
    • 2
    • 3
  • n

    Nikita Klimenko [JB]

    01/27/2021, 11:45 AM
    Hi! Is there a way to avoid hardcoded shapshot version of arrow meta intellij plugin?
    r
    • 2
    • 3
  • m

    Max Härtwig

    02/11/2021, 10:57 AM
    Hi everyone! I'm new here and I've just started to work with Kotlin and Arrow Meta. Is there a way to see the compiler plugin's stdout in the console when compiling it with gradle? 
    println
     doesn't seem to show up...
    r
    r
    • 3
    • 3
  • d

    dalexander

    02/11/2021, 3:27 PM
    https://android-developers.googleblog.com/2021/02/announcing-kotlin-symbol-processing-ksp.html Is there an ArrowMeta response to this announcement anywhere? I haven't looked closely at it yet but it seems like a comparison between the differing goals would be valuable information for potential users.
    👀 3
    a
    • 2
    • 4
  • b

    Big Chungus

    02/11/2021, 3:56 PM
    Are there any guides on starting up with mpp compiler plugin with arrow-meta?
    r
    • 2
    • 1
Powered by Linen
Title
b

Big Chungus

02/11/2021, 3:56 PM
Are there any guides on starting up with mpp compiler plugin with arrow-meta?
r

raulraja

02/11/2021, 5:00 PM
Hi @Big Chungus. Arrow Meta only targets Kotlin IR. Once the IR format is stable and used for MPP we can use Meta for MPP compiler plugins. We are hoping that happens in Kotlin 1.5.
😛 2
View count: 1