Closed gruberrolandvaltech closed 1 year 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
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.
@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 :)
2.0.0 has sth like that:
Thanks a lot for this great tool. :)
It would be great if you could display the line numbers when showing a decompiled class.