Currently the call of an inline function produces stack traces with line numbers at the end of the given kotlin file. I understand the reason for the generated code, but wouldn’t it be possible to supply the actual line where the code fragment was inserted/introduced? Current stack trace makes it near impossible to identify the actual source of an exception.
If you are using intellij there is a feature called “analyze stacktrace”. It should be able to resolve it for you. I think it’s under “Analyze > Analyze Stacktrace”
Nope. It doesn’t. Still gives me a line outside the actual file. No mapping taking place. I’m left to guessing. Having the insertion line would be a great help
Mmm. Your right. I could have sworn that it worked that way. I also found this:
So I guess it should work.
Also found that. For me it doesn’t work. Never have seen it work. Right now I feel forced to ignore inline functions but I need reification at some points and am lost in case of a stack trace.
Maybe create an issue: https://youtrack.jetbrains.com/issues/KT. I mean there must be a way to resolve this.
I can do that. But I’d still like to know if adding the insertion line of an line function is still an option. This way it would be easier to read the stack trace without any additional tooling.
I think I will first need to check if the problem is due to different commit states. Sadly in this case it is hard to say if it is at the right not existing line
By the insertion line you mean the line where the inline function was invoked?
AFAIK, a stack trace is a printout of stack frames. Calling an inline function by definition does not append another stack frame to the stack trace.
The stack trace is generated by JVM and I’m not aware of any way to augment or post-process that stack trace, are you?
For lack of that we have to choose between the readability of raw stack traces and ability to debug the inline functions. Given that the first could be alleviated with the “Analyze stacktrace” tool, we have chosen the second for the user-defined inline functions.