https://kotlinlang.org logo
#arrow
Title
# arrow
ł

Łukasz Gendek

12/01/2023, 9:05 PM
Copy code
import arrow.core.raise.ExperimentalTraceApi
import arrow.core.raise.Trace
import arrow.core.raise.either
import arrow.core.raise.traced

@OptIn(ExperimentalTraceApi::class)
fun main() {
    either {
        traced({
            raise("error")
        }, {
                a: Trace, _: String ->
            a.printStackTrace()
        })
    }
}
Exception in thread "main" java.lang.IllegalAccessError: failed to access class arrow.core.raise.RaiseCancellationException from class MainKt (arrow.core.raise.RaiseCancellationException and MainKt are in unnamed module of loader 'app') at MainKt.main(Main.kt:10) at MainKt.main(Main.kt) Process finished with exit code 1
s

simon.vergauwen

12/02/2023, 4:30 PM
Hey @Łukasz Gendek, That's strange. 🤔 Can you share your gradle file, so I can try reproducing this locally?
ł

Łukasz Gendek

12/02/2023, 4:33 PM
here you go
Hey. I just want to ask, if you were able to reproduce this?
s

simon.vergauwen

12/05/2023, 5:16 PM
Hey @Łukasz Gendek, Yes, I am able to reproduce this. First moment I had free to check this, thanks for you reminder. That is definitely a bug.. I think it's a combination of
inline
and
private
, which shouldn't have been allowed but somehow the compiler didn't complain 🤔
Thanks for sharing the Gradle config, made it easy to reproduce. Silly thing is we cannot write a test for this in Arrow since it requires being called from a different compilation unit 🙃
ł

Łukasz Gendek

12/05/2023, 8:03 PM
It is interesting that this works when moving the code to the arrow.core.raise package.
So I have a workound.
But still I can't wait till it gets fixed and I would not need the workaround :)
2 Views