Reverse Engineering in Intellij IDEA

Hi friends,

  I joined a new company and we are using Intellij IDEA 9.0.4. Since they don't have a documentation, I have to look for the source code to understand things. But I hope there is a way to do Reverse Engineering the code and generate Class diagrams and/or other documentations. Can you help me how to get in to that? Thanks

7 comments

On Fri, 04 Nov 2011 17:49:53 MSK, Mat abi <no_reply@jetbrains.com>
wrote, quoted or indirectly quoted someone who said :

>  I joined a new company and we are using Intellij IDEA 9.0.4. Since they don't have a documentation, I have to look for the source code to understand things. But I hope there is a way to do Reverse Engineering the code and generate Class diagrams and/or other documentations. Can you help me how to get in to that? Thanks

see http://mindprod.com/jgloss/decompiler.html
http://mindprod.com/jgloss/disassember.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and
faster each year, but the focus on money makes software manufacturers
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore
ignored. The manufacturer focuses on cheap gimicks like dancing paper
clips to dazzle naive first-time buyers. The needs of existing
experienced users are almost irrelevant. I see software rental as the
best remedy.

0

Welcome to the IntelliJ IDEA community.

  • You can generate a class diagram of any class. Place your cursor on the class name (even if it is just a variable declaration), then right click, diagrams > show diagram. Alternatively, just type CTRL+ALT+SHIFT+U (U for UML) with your cursor on the class declaration. If your cursor is anywhere else in the source code, it will create the diagram for the class open in the tab. At the top of the diagram, you can turn on & off the visibility of methods, fields, etc.
  • You can view, in the hierarchy tool window, the following hierarchy. Just place your cursor on the appropriate declaration. In the hierarchy tool window, there are a number of options, including reversing the hierarchy display. The options are also in the 'Navigate' menu in the IDEA 11 EAP and in the 'Go to' (if I remember correctly) menu in IDEA 10 and earlier. In the help guide, see Reference > Tool Window Reference > Hierarchy Tool Window and IntelliJ IDEA Usage Guidelines > Analyzing Applications > Viewing Structure and Hierarchy of the Source Code for more information. The Hierarchy tool window is very helpful when trying to trace through and figure out code.
    • Type Hierarchy CTRL+H
    • Method hierarhy CTRL+SHIFT+H
    • Call Hierarchy CTRL+ALT+H
  • The IntelliJad plugin allows you to use the JAD decompiler to instantly decompile any binary file in IDEA. I beleive the "IntelliJad 9" version works ok with IDEA 10.


I hope that helps. Good luck and congratulations on your new job.

Best Regards,
Mark

0

Thank you so much my friend. Actually I generated the class diagram. But couldn't see the r/s, methods, and the properties. Now everything is coming up and clear.

However, why do I need decompiling a binary file if I already can generate class diagram directly fromt the class.

FYI: In case if you are a developer or admin of this forum, it has some bug. I clicked helpful answer on your answer and I then clicked back and clicked right answer. At that point it had some errors.

0

matiman wrote:

Thank you so much my friend. Actually I generated the class diagram. But couldn't see the r/s, methods, and the properties. Now everything is coming up and clear.

Glad to hear. And glad to help. Yeah, by default it only shows the class names. You have to turn on visibility to the details (methods, properties, etc.)

However, why do I need decompiling a binary file if I already can generate class diagram directly fromt the class.

That would be for cases where you want/need to see what's going on inside. If you only need black box information (i.e. the ins & outs of a method) than obviously a class diagram (and *hopefully* its JavaDoc that someone was thoughtful enough to write) is sufficient. But for cases where you want to take a peek under the hood, and the source code is not available, and you have the legal rights to decompile (the lawyers are always watching ;)), than decompiling can be helpful. For example, say the documentation does not indicate if a method is null safe for its parameter, a quick decompile to check can be more efficient than setting up a little test, or tracking down the source code. Obviously, if you have the source code handy, it's easier to attach the source code to your library definitions than having to decomple. Decompiling is simply one more arrow in your quiver when reverse engineering or learning an application.

FYI: In case if you are a developer or admin of this forum, it has some bug. I clicked helpful answer on your answer and I then clicked back and clicked right answer. At that point it had some errors.

Nope. Just a regular old user :)


Also, in case you have not yet discovered them yet, the various "Find/Show Usages" functions are very helpful when tracing through code. In the help guide, see IntelliJ IDEA Usage Guidelines > Searching Through the Source Code > Finding Usages. There are options to search not just the project's code, but libraries as well. ALT+F7 (Find Usages) is one of the most used features for me in IDEA. Also, if you are not aware, you can 'pin' search results so you can refer back to them later, or have multiple searches active. Just click the pin icon on the search results tool window.

Let us know if you have any other questions. After using it for a bit, I suspect you'll end up loving IntelliJ IDEA at a minimum. . .  or more potentially, become very passionate about it like most people on this forum.

0

  Again, thanks for your reply. One thing I might ask is, which is out of this topic, I wanted to use Intellij IDEA on my own PC. So which free version do you recommend that helps me build easy applications, which include deployment and debugging tools as well? I am not going to use it for commercial. But to develop some real applications and might use them in the future. It might be a plugin or just a normal app.

0

And of course for mobile development.

0

The free Idea IC supports straight java rich client development, including mobile platforms.

It doesn't include web development or most other languages (ruby/php/python/...) support. Feature matrix here: http://www.jetbrains.com/idea/features/editions_comparison_matrix.html?IC

If you need support for these, you need a ultimate license (academic/personal/...).

0

Please sign in to leave a comment.