https://kotlinlang.org logo
#arrow-meta
Title
# arrow-meta
b

Burkhard

04/02/2020, 9:32 AM
Anyone else having problems debugging projects that use the arrow meta? Specifically the line number information gets changed which makes it impossible to properly set breakpoints. This can easily be seen in https://github.com/arrow-kt/arrow-meta-examples/tree/master/hello-world. After building you can inspect the bytecode using
javap -c -l use-plugin/build/classes/../HelloWorldKt.class
Looking at the line information you see that it no longer matches the source file.
r

raulraja

04/02/2020, 9:38 AM
We don’t have yet a strategy for mutations in place that alter the line numbers. I guess this is also true for any other plugin that for example modifies the IR backend. I’m not aware of an API that would allow us to do this so any ideas are welcome
If you use
Transform.newSources
is like kapt and the line numbers is not an issue since you are just generating code in new files that are processed before analysis
This is a general issue for all compiler plugins not just meta so I’m thinking we should ask in #compiler to see what people are doing in cases to keep debugging sane
b

Burkhard

04/02/2020, 9:49 AM
Transform.newSources
doesn’t really help me much. I’m thinking about switching from kapt to arrow-meta because I want the ability to modify existing code (add functions to existing classes to automatically implement interfaces).
r

raulraja

04/02/2020, 10:03 AM
For what is worth is something we need to address but we are not sure how to implement this.
Our comprehensions plugins that rewrites:
Copy code
val a by fa
val b by fb
to
Copy code
fa.flatMap { a -> 
  fb.flatMap { b ->
    ...
  }
}
has the same issue
Also you should consider that if you are creating new members in place as the users types in the IDE for those to show up in IDEA you need an IDEA plugin or depend on the Meta IDEA plugin which exposes those members as synthetic descriptor so IDEA knows that the underlying document has more stuff than what is being parsed.
This is currently another limitation of in place mutation that I brought up to the compiler team illustrating some of these issues
IDEA never looks for new members generated by compiler plugins
PLugin like
Serialization
are bundled so you can refer to
seralized()
etc. But community plugins currently have to go through an awful process of discovery through a Marketplace modal
instead of just loading whatever IDEA plugin a project says to depend upon.
b

Burkhard

04/02/2020, 10:15 AM
Yeah I’m hoping that I can avoid the IDEA plugin since the functions I generate should only ever be called through the parent interface, but I’m currently just investigating to see if it is even possible to switch to arrow-meta. Might be a bit early.
2 Views