I got the following warning from intellij > Rai...
# arrow
l
I got the following warning from intellij
Raise context may escape through this lambda
For example with such code:
Copy code
either {
        parMap(Dispatchers.Default) { it().bind() }
    }
which is exactly the code of
parSequenceEither
that has been deprecated what am I doing wrong? (I have arrow 1.2.4) Thx
a
mmmm, I think this is an issue with the inspection
I'll take a look at it this weekend, thanks for reporting!
l
My pleasure, I'd love to make the warning disappear 🙂
Hi is there any chance you had a look 😊 ?
a
I indeed had a look... and I think I know where the problem is
but I also want to move the whole plugin to K2 😅
K 1
l
Do you know if there is anything I can do to fix the warning at some places? Any idea what is the root cause?
a
I think there's a wrong assumption that
.bind()
is working on a context without
Raise
. because the plugin doesn't correctly recognize that
parMap
would be inlined
right now the only thing you can do is disable the inspection for that line 😞
btw, if you just want to bind over a bunch of stuff, it's better to use
thing.bindAll()
instead of
map(thing) { it.bind() }
just to double check, @simon.vergauwen is it always OK to use
parMap
in this fashion?
l
if that can help, it appears only if I have the Arrow plugin
a
that's expected, that's one of the special checks brought by that plugin
l
is it pointing a potential bug, or "just" a code quality issue?
a
that's the thing, I'm not entirely sure myself 😅
🥵 1
s
It's not a potential bug, nor is it a code quality issue here. It's perfect usage.
Sorry for the late reply.
l
Hi when you "It's perfect usage." does it means that I can ignore it?
a
thanks for clarifying this; then I'll add some code to whitelist functions like
async
,
launch
,
parZip
, and `parMap`; does it sound ok to you, @simon.vergauwen?
mmmmm, now that I think,
parMap
and similar are only OK if they are run directly, but they may escape through an
async
or something like that...
s
Yes, it might indeed escape through
async
unless the
awaitAll { }
scope is used
Hi when you "It's perfect usage." does it means that I can ignore it?
@Laurent Thiebaud Yes, you can ignore the warning from the Arrow plugin. I can file an issue for this to be solved ☺️
l
💚 thanks
a
a new version of the plugin has been sent to the Marketplace, it's just waiting for approval, and should lead to fewer false positives
K 2