SlideShare a Scribd company logo
Decompiling Java James Hamilton, PhD Student 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1
What we did We tested 10 different decompilers with the latests Java class file format using 10 different test programs. In 2003, Emmerik tested the first 8 + 2 other, unobtainable ones.
What is a Java Decompiler? transforms Java bytecode into Java source code public class HelloWorld { public static void main(String[] args) { System.out.println(&quot;Hello World&quot;); } } public class HelloWorld extends java.lang.Object{ public HelloWorld(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object.&quot;<init>&quot;:()V 4: return public static void main(java.lang.String[]); Code: 0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3; //String Hello World 5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return }
What are they for? Static Single Assignment for Decompilation, Michael Van Emmerik, 2007
Java bytecode cycle
Java bytecode cycle
Assumption about how the bytecode was generated Java compiler generated bytecode most likely Sun's  javac aribtrary bytecode generated by another language to Java bytecode compiler
generated manually by a programmer
transformed Java compiled bytecode
Our evaluation 10 decompilers tested
10 programs testing different problem areas 6  javac  generated
4 abitrary based on a 2003 survey
effectiveness scale
+ indication of the general effectiveness of a Java decompiler.

More Related Content

What's hot (20)

PPT
Java exception
Arati Gadgil
 
PPT
Exception Handling
Sunil OS
 
PPTX
Error and exception in python
junnubabu
 
PPTX
Exception handling in java
Lovely Professional University
 
PPTX
Java exception handling
BHUVIJAYAVELU
 
PPTX
Exception handling in Java
Prasad Sawant
 
PPT
Exception handling in java
Pratik Soares
 
PPTX
Exception Handling in Java
Ganesh kumar reddy
 
PPTX
Exception handling in Java
Abhishek Pachisia
 
PPTX
OCJP Samples Questions: Exceptions and assertions
Hari kiran G
 
PDF
OCP Java SE 8 Exam - Sample Questions - Java Streams API
Ganesh Samarthyam
 
PPSX
Exception Handling
Reddhi Basu
 
PDF
Exception handling & logging in Java - Best Practices (Updated)
Angelin R
 
PPTX
Exception handling in java
Elizabeth alexander
 
ODP
Exception handling in java
priyankazope
 
PPTX
Exception handling in java
pooja kumari
 
PPT
Multi catch statement
myrajendra
 
PPT
Types of exceptions
myrajendra
 
PPTX
TDD? Sure, but What About My Legacy Code?
Rob Myers
 
Java exception
Arati Gadgil
 
Exception Handling
Sunil OS
 
Error and exception in python
junnubabu
 
Exception handling in java
Lovely Professional University
 
Java exception handling
BHUVIJAYAVELU
 
Exception handling in Java
Prasad Sawant
 
Exception handling in java
Pratik Soares
 
Exception Handling in Java
Ganesh kumar reddy
 
Exception handling in Java
Abhishek Pachisia
 
OCJP Samples Questions: Exceptions and assertions
Hari kiran G
 
OCP Java SE 8 Exam - Sample Questions - Java Streams API
Ganesh Samarthyam
 
Exception Handling
Reddhi Basu
 
Exception handling & logging in Java - Best Practices (Updated)
Angelin R
 
Exception handling in java
Elizabeth alexander
 
Exception handling in java
priyankazope
 
Exception handling in java
pooja kumari
 
Multi catch statement
myrajendra
 
Types of exceptions
myrajendra
 
TDD? Sure, but What About My Legacy Code?
Rob Myers
 

Similar to Decompiling Java - SCAM2009 Presentation (20)

ODP
Java Attacks & Defenses - End of Year 2010 Presentation
James Hamilton
 
PDF
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
PDF
Decompiling Android Discover How Android Apps Are Compiled And Built To Secur...
wayhoyaluc
 
PDF
Understanding the Dalvik bytecode with the Dedexer tool
Gabor Paller
 
PPTX
Java Decompiler
Manjunath Badiger
 
PDF
College Project - Java Disassembler - Description
Ganesh Samarthyam
 
DOCX
Viva file
anupamasingh87
 
PDF
Lifecycle of a JIT compiled code
J On The Beach
 
PPT
Java Intro
Vijay A Raj
 
PPTX
Ahead-Of-Time Compilation of Java Applications
Nikita Lipsky
 
ODP
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Carol McDonald
 
PDF
Building Large Java Projects Faster: Multicore javac and Makefile integration
Fredrik Öhrström
 
DOCX
Java 7 Dolphin manjula kollipara
Manjula Kollipara
 
PDF
Javanotes ww8
kumar467
 
PPT
Object Oriented Programming-JAVA
Home
 
PPT
Java API, Exceptions and IO
Jussi Pohjolainen
 
PPTX
Java is a new language on the mainframe
Michael Erichsen
 
PPTX
Java byte code & virtual machine
Laxman Puri
 
PDF
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
David Buck
 
Java Attacks & Defenses - End of Year 2010 Presentation
James Hamilton
 
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Decompiling Android Discover How Android Apps Are Compiled And Built To Secur...
wayhoyaluc
 
Understanding the Dalvik bytecode with the Dedexer tool
Gabor Paller
 
Java Decompiler
Manjunath Badiger
 
College Project - Java Disassembler - Description
Ganesh Samarthyam
 
Viva file
anupamasingh87
 
Lifecycle of a JIT compiled code
J On The Beach
 
Java Intro
Vijay A Raj
 
Ahead-Of-Time Compilation of Java Applications
Nikita Lipsky
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Carol McDonald
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Fredrik Öhrström
 
Java 7 Dolphin manjula kollipara
Manjula Kollipara
 
Javanotes ww8
kumar467
 
Object Oriented Programming-JAVA
Home
 
Java API, Exceptions and IO
Jussi Pohjolainen
 
Java is a new language on the mainframe
Michael Erichsen
 
Java byte code & virtual machine
Laxman Puri
 
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
David Buck
 
Ad

Recently uploaded (20)

PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PPTX
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Empowering Cloud Providers with Apache CloudStack and Stackbill
ShapeBlue
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Top Managed Service Providers in Los Angeles
Captain IT
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Ampere Offers Energy-Efficient Future For AI And Cloud
ShapeBlue
 
Ad

Decompiling Java - SCAM2009 Presentation

  • 1. Decompiling Java James Hamilton, PhD Student 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1
  • 2. What we did We tested 10 different decompilers with the latests Java class file format using 10 different test programs. In 2003, Emmerik tested the first 8 + 2 other, unobtainable ones.
  • 3. What is a Java Decompiler? transforms Java bytecode into Java source code public class HelloWorld { public static void main(String[] args) { System.out.println(&quot;Hello World&quot;); } } public class HelloWorld extends java.lang.Object{ public HelloWorld(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object.&quot;<init>&quot;:()V 4: return public static void main(java.lang.String[]); Code: 0: getstatic #2; //Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #3; //String Hello World 5: invokevirtual #4; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: return }
  • 4. What are they for? Static Single Assignment for Decompilation, Michael Van Emmerik, 2007
  • 7. Assumption about how the bytecode was generated Java compiler generated bytecode most likely Sun's javac aribtrary bytecode generated by another language to Java bytecode compiler
  • 8. generated manually by a programmer
  • 10. Our evaluation 10 decompilers tested
  • 11. 10 programs testing different problem areas 6 javac generated
  • 12. 4 abitrary based on a 2003 survey
  • 14. + indication of the general effectiveness of a Java decompiler.
  • 15. - manual inspection and subjective scale. Emmerik, 2003, http://www.program-transformation.org/Transform/JavaDecompilerTests
  • 16. Results many of the current decompilers cannot parse the latest class files 4 obsolete
  • 17. 3 unmaintained no currently maintained commercial decompilers
  • 18. best decompiler? depends on the tool which generated the class file Dava for abitrary bytecode
  • 19. Java Decompiler or JODE for javac bytecode
  • 20. The sorts of problems the Java decompilers had Type inference for local variables – giving the tighest possible type to local variables
  • 23. Where decompilers failed public class TypeSet { public void m1(Integer i, String s) { untyped x; if(i != null) x = i; else x = s; m2(x); } public void m2(Comparable x) { } } this example is easy but multiple inheritance via interfaces complicates things*.
  • 24. is this really a problem, if all we need is compilable code?
  • 25. can we just make everything an object, and use typecasts? invokevirtual TypeSet/m2(Ljava/lang/Comparable;)V Example from: Java and the Java Virtual Machine: Definition, Verification and Validation, Stärk et al, 2001 * see Efficient Inference of Static Types for Java Bytecode, Gagnon et al. 2000 and Efficient local type inference, Bellamy et al. 2008. Type Inference
  • 26. most decompilers, except Dava, do not expect this. System.out.println(&quot;a&quot;); label_0: { try { System.out.println(&quot;b&quot;); }catch (RuntimeException $r9) { System.out.println(&quot;g&quot;); break label_0; } try { System.out.println(&quot;c&quot;); }catch (RuntimeException $r9) { System.out.println(&quot;g&quot;); break label_0; }catch (Exception $r6) { System.out.println(&quot;e&quot;); break label_0; } try { System.out.println(&quot;d&quot;); }catch (Exception $r6) { System.out.println(&quot;e&quot;); } } //end label_0: System.out.println(&quot;f&quot;); Example from: Decompiling Java Bytecode: Problems, Traps and Pitfalls, Miecznikowski et al, 2002 Where decompilers failed Intersecting try-catch blocks
  • 27. public static int foo(int i, int j) { while (true) { try{ while (i < j) i = j++/i; }catch (RuntimeException re) { i = 10; continue; } break; } return j; } Example from: Decompiling Java Bytecode: Problems, Traps and Pitfalls, Miecznikowski et al, 2002 Where decompilers failed Control Flow
  • 28. Not much improvement in 6 years all decompilers aren't very good Problems caused by newer class file specification
  • 29. Different decompilers for different problems can we produce a decompiler which combines the best of javac decompilers and abitrary decompilers?
  • 30. do we really need to perform type inference if the only condition is that we require re-compilable code?
  • 31. are the problems with the Java decompilers fundamental or just bugs? Conclusion Questions