I'm using Intellij Idea 14
working with big java project where a lot of code is compiled and w/o sources.
As far as I know Idea
can't make a search in compiled code (as eclipse
does), but it can decompile single file using build-in fernflower
and this also gives a possibility to debug through compiled code.
Is there a way to decompile all compiled code at once the same way Idea does and attach it to project so that it was possible to search through "Project and Libs" w/o loosing debugging feature in decompiled sources?
I've tried using Bytecodeviewer
with different fernflower
options, but the result was that debugging was broken (showed wrong lines) after attaching the decompiled sources.
In contrast to Eclipse, IntelliJ IDEA provides the FernFlower decompiler as a default. To use it, we simply Ctrl+Left-Click on a class name and view the code: Also, we can download the source. Downloading the source will provide the actual code and comments.
In order to decompile class file, just open any of your Java projects and go to Maven dependencies of libraries to see the jar files included in your project. Just expand any jar file for which you don't have the source attached in Eclipse and click on the . class file.
The decompiler can not only convert bytecode to Java code, but it can also debug it. This means you can use breakpoints anywhere in the decompiled code with almost the same experience that you'd normally have when you debug your source code. Of course, you can always open the bytecode viewer for any compiled class.
I found that on OSX you can change this setting in the following file:
~/Library/Preferences/IntelliJIdea2016.1/options/options.xml
Add the following properties:
<property name="decompiler.use.line.mapping" value="true" />
<property name="decompiler.dump.original.lines" value="true" />
ok, as there are no news regarding this, I've created a little plugin which decompiles the jar file with compiled code to new *-sources.jar
file using build-in Intellij
fernflower
decompiler and attaches sources to project. anyone interested, can take a look at decompile and attach
plugin in jetbrains plugin repository
Update
answering my question about line numbers in decompiled code using fernflower
. I found 'decompiler.use.line.table
' flag in Intellij
's fernflower
which preserves line numbers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With