Skip to content

JavaStackTrace: Added support for package prefix#2658

Merged
RunDevelopment merged 2 commits intoPrismJS:masterfrom
RunDevelopment:java-stack-trace-package-fix
Nov 28, 2020
Merged

JavaStackTrace: Added support for package prefix#2658
RunDevelopment merged 2 commits intoPrismJS:masterfrom
RunDevelopment:java-stack-trace-package-fix

Conversation

@RunDevelopment
Copy link
Member

This adds support for modules in Java stack traces.

This fixes #2657.

@mAAdhaTTah
Copy link
Member

Just to confirm, does this/should this match something like java.base/arrays.helpers/Collection (or some other example where / appears twice)? Is that even valid? If it's invalid should we still highlight it? Does it matter (maybe not)? Thoughts?

@RunDevelopment
Copy link
Member Author

Good questions. I investigated a little: The print method of Java Throwable uses the standard toString method of StackFrameElement which is technically implementation-defined but the doc lists some examples of what you can expect. Examples like com.foo.loader/foo@9.0/com.foo.Main.run(Main.java:101), com.foo.loader/foo@9.0/com.foo.Main.run(Unknown Source), and acme@2.1/org.acme.Lib.test(Lib.java:80).

Why can't it ever be easy...

I'll fix it.

Also, I intentionally made the stack frame pattern more accepting than it has to be. This makes the pattern simpler and more robust in case I forgot a case (like I did).

@RunDevelopment RunDevelopment merged commit 0bb4f09 into PrismJS:master Nov 28, 2020
@RunDevelopment RunDevelopment deleted the java-stack-trace-package-fix branch November 28, 2020 22:05
This was referenced Mar 6, 2021
This was referenced Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java stack trace doesn't highlight java.base/ stack frames

2 participants