Silly question, is the with creating a function us...
# arrow
k
Silly question, is the with creating a function using a context receiver using the raise dsl, does it default to a suspendable or do you have to specifically annotate your method signature with suspend?
I added suspend to some functions and now I’m receiving a lot of
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Inconsistent number of parameters in the descriptor and Java reflection object: 7 != 6
type errors
y
If I understand your question right: The raise builders are transparent. They're suspending if your calling context is, and not suspending otherwise.
c
Context receivers have nothing to do with suspension ; if a function is not
suspend
, adding a context receiver will not make it a
suspend
k
Thank you for the feedback. Any idea why I would receive an error such as the one in my first comment?
r
Can you share the code that is throwing such an exception?
w
Adding
suspend
to a function signature adds a hidden
Continuation
parameter to the function.
☝️ 1
s
That looks like a runtime bug somehow.. 🤔 It seems indeed something is going wrong with the
Continuation
param being added, and some other reflection tool looking for the function without continuations. Are you using any library that uses reflection, that is interacting with a
suspend
method?
k
I’m using Spring Boot with WebFlux and Arrow. During the flow of function calls, toggling one of them from suspend to non suspend fixes the issue. There is nothing obviously different than the rest of the codebase which makes me scratch my head.
s
Hmm, strange. Are you using
suspend
somewhere where it's not actually used?
inline
might also be messing something up, but that'd be an compile & runtime issue instead of just runtime 🤕
r
@Kev Do you get a stack trace with that message? Is any of the types a
value class
?. There are bugs that seems related still open https://youtrack.jetbrains.com/issue/KT-55395/Reflection-KotlinReflectionInternalError-I[…]ameters-with-javaMethod-on-function-with-context-receiver for stuff related to reflection
k
I am using value classes to represent different types of domain ID’s. This could very well be that bug.
1