-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
16
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
I use Kotlin which has a feature of inline functions. If an exception is thrown and a stack trace is produced, it contains wrong references to files and their line numbers. It's very annoying to receive a stack trace from production that in most cases is enough to pinpoint the problem, only to find out that it's useless due to this issue. It's caused by the fact that JVM doesn't respect extra information provided in SourceDebugExtension, as specified in JSR 45 (https://jcp.org/en/jsr/detail?id=45).
There's an existing bug in Java bug tracker: https://bugs.openjdk.java.net/browse/JDK-4972961 however it's been stale for almost 18 years now (!). Since there's no way to upvote or comment under the existing bugs, and that bug tracker item doesn't reflect the impact and urgency of this bug nowadays where we have Kotlin as a popular alternative to Java, I decided to file a new item to revive the topic.
A corresponding issue in the Kotlin bug tracker, resolved because it's not Kotlin's responsibility to fix: https://youtrack.jetbrains.com/issue/KT-8628. The comments section contains most valuable information.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create such Kotlin files:
File a.kt:
inline fun a() {
error("")
}
File b.kt (some empty lines at the end of file for the demonstrative purpose):
fun main() {
a()
}
// line 5
// line 6
// line 7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.IllegalStateException:
at AKt.a(a.kt:2)
at BKt.main(b.kt:2)
ACTUAL -
Exception in thread "main" java.lang.IllegalStateException:
at BKt.main(b.kt:9)
at BKt.main(b.kt)
---------- BEGIN SOURCE ----------
This bug relates to Kotlin - not sure how to reproduce this issue using Java.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Unknown.
FREQUENCY : always
I use Kotlin which has a feature of inline functions. If an exception is thrown and a stack trace is produced, it contains wrong references to files and their line numbers. It's very annoying to receive a stack trace from production that in most cases is enough to pinpoint the problem, only to find out that it's useless due to this issue. It's caused by the fact that JVM doesn't respect extra information provided in SourceDebugExtension, as specified in JSR 45 (https://jcp.org/en/jsr/detail?id=45).
There's an existing bug in Java bug tracker: https://bugs.openjdk.java.net/browse/JDK-4972961 however it's been stale for almost 18 years now (!). Since there's no way to upvote or comment under the existing bugs, and that bug tracker item doesn't reflect the impact and urgency of this bug nowadays where we have Kotlin as a popular alternative to Java, I decided to file a new item to revive the topic.
A corresponding issue in the Kotlin bug tracker, resolved because it's not Kotlin's responsibility to fix: https://youtrack.jetbrains.com/issue/KT-8628. The comments section contains most valuable information.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create such Kotlin files:
File a.kt:
inline fun a() {
error("")
}
File b.kt (some empty lines at the end of file for the demonstrative purpose):
fun main() {
a()
}
// line 5
// line 6
// line 7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.IllegalStateException:
at AKt.a(a.kt:2)
at BKt.main(b.kt:2)
ACTUAL -
Exception in thread "main" java.lang.IllegalStateException:
at BKt.main(b.kt:9)
at BKt.main(b.kt)
---------- BEGIN SOURCE ----------
This bug relates to Kotlin - not sure how to reproduce this issue using Java.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Unknown.
FREQUENCY : always
- duplicates
-
JDK-4972961 Use SourceDebugExtension in stack traces
- Closed