neva-dev / felix-search-webconsole-plugin

Search Web Console Plugin for Apache Felix
https://bintray.com/neva-dev/maven-public/felix-search-webconsole-plugin
Apache License 2.0
94 stars 21 forks source link

Show line numbers #16

Closed gruberrolandvaltech closed 1 year ago

gruberrolandvaltech commented 6 years ago

Thanks a lot for this great tool. :)

It would be great if you could display the line numbers when showing a decompiled class.

pun-ky commented 6 years ago

It is not trivial. Usually the line numbers from exception stack trace are not matching the line numbers in decompiled class so that I am intentionally not showing it. However decompiler could be improved / in detail be replaced by that one used by IntelliJ which better decompiles classes in case of matching origin class source line numbers. Still PR is appreciated 😉 in other words, covered by #13

paul-bjorkstrand commented 5 years ago

While still not trivial, it isn't as complex as requiring a different decompilation library. You could use the output from a decompilation to match the outputted source to the original source (as listed in the line number table in the compiled class.

You would start by not using Decompilter.decompile. Instead, copy most of the code there (thank you Apache License) into your OsgiExplorer.decompileClass. Then, use the output of Language.decompileType (called here, which returns a TypeDecompilationResults. That result type contains a list of LineNumberPosition, which can be used to match line numbers in the outputted source, with the original line numbers from the decompiled class.

Again, I am not trying to trivialize it, just giving some information for anyone who has the time to dig in, develop it, and test it.

pun-ky commented 5 years ago

@paul-bjorkstrand thanks for nice analysis, as you stated

anyone who has the time to dig in, develop it, and test it.

looking for such awesome person :)

krystian-panek-vmltech commented 1 year ago

2.0.0 has sth like that:

image