Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 27th, 2007, 2:11 PM   #11
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Java Decompiler..

IDA Pro does a perfect decompilation. It's a nice program.
Harakim is offline   Reply With Quote
Old Nov 27th, 2007, 3:40 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Java Decompiler..

Nothing does a perfect decompilation unless it's studded with information that renders it ineffictive as a truly good implementation. If you don't understand this concept, I invite you to behave as a VonNeuman processor divorced from wasteful hints.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 27th, 2007, 6:02 PM   #13
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Java Decompiler..

Java classes include all of the information needed to decompile the class. It doesn't compile to machine code.
Harakim is offline   Reply With Quote
Old Nov 27th, 2007, 6:09 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Java Decompiler..

That's why it's inferior, when push comes to shove. Any implementation which produces even byte code, tops, isn't going to include the labels which are programmer-helpful. I can show you dozens of pieces of executing code which cannot be traced back to high-livel constructs. That says all that there needs to be said about the subject. Reasonable and accurate decompilation presupposes worthless inefficiencies. If that flips your skirt, so be it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 27th, 2007, 6:15 PM   #15
null_ptr0
11 years old
 
Join Date: Nov 2007
Posts: 79
Rep Power: 1 null_ptr0 is on a distinguished road
Re: Java Decompiler..

As others said, your best bet is obfuscation; might I recommend the Zelix KlassMaster obfuscater.
__________________
iload_0 iconst_1 ishl or
iload_0 iconst_2 idiv or
iload_0 iconst_2 iconst_1 imul idiv
[1] & [2] use the smallest stack size
null_ptr0 is offline   Reply With Quote
Old Nov 27th, 2007, 6:16 PM   #16
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Java Decompiler..

Obfuscation is the last resort of the inadequate.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 27th, 2007, 6:16 PM   #17
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Java Decompiler..

It is my understanding and experience that Java classes (since they use String-based reflection) contain a description of all classes, methods, and member variables. My experience has also shown that they contain local-scoped variable names, though I see no reason this would always be the case. Of course, when the JIT runs, it doesn't include this information unless you're doing a lot of reflection.

If you could give me a class file that does not contain this information, I would appreciate it as it would help me to learn more about compilers.
Harakim is offline   Reply With Quote
Old Nov 28th, 2007, 9:20 PM   #18
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 895
Rep Power: 4 lectricpharaoh will become famous soon enough
Re: Java Decompiler..

Quote:
Originally Posted by DaWei
That's why it's inferior, when push comes to shove. Any implementation which produces even byte code, tops, isn't going to include the labels which are programmer-helpful. I can show you dozens of pieces of executing code which cannot be traced back to high-livel constructs. That says all that there needs to be said about the subject. Reasonable and accurate decompilation presupposes worthless inefficiencies. If that flips your skirt, so be it.
I expect that one reason Java is so straightforward to decompile is because the designers wanted to defer most optimizations until the app gets deployed on the target machine. Some information, such as high-level looping constructs, might be helpful to the JIT compiler's optimizer. Why the hell they'd include other, irrelevant information is beyond me, though. Examples might include the original names of variables and references; very often, these names are a strong hint as to the object's purpose.
__________________
A man's knowledge is like an expanding sphere, the surface corresponding to the boundary between the known and the unknown. As the sphere grows, so does its surface; the more a man learns, the more he realizes how much he does not know. Hence, the most ignorant man thinks he knows it all. - L. Sprague de Camp
lectricpharaoh is offline   Reply With Quote
Old Nov 29th, 2007, 4:51 AM   #19
Harakim
Hobbyist Programmer
 
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3 Harakim is on a distinguished road
Re: Java Decompiler..

Class names, method names, and class level variable names are used by Java's reflection facilities. For instance, Java programmers will probably recognize Class.forName( String className ) which is commonly used for loading jdbc drivers.

I don't know why they used strings for reflection, but that is why the metadata is kept there.
Harakim is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming with Java: Tutorial ReggaetonKing Java 7 May 20th, 2008 10:58 AM
Special browser in Java (Project) stalefish Java 3 Feb 9th, 2008 4:22 PM
First Java Program duale2005 Java 3 May 22nd, 2006 5:17 PM
Java programmers, game developers, artists, be ware! RPG game team is recruiting! atcomputers.us Paid Job Offers 7 Sep 25th, 2005 7:25 PM
JAVA and C#??? java_roshan C# 6 Apr 13th, 2005 10:18 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC