Understandability in Decompilation
<h2>Code Understandability in Java Decompilation</h2><p>Data and tools of the paper "Demystifying and Assessing Code Understandability in Java Decompilation".</p><h3><strong>Data</strong></h3><p>Our data in the directory data/ includes three parts:</p><ol><li>Experimental data including original source code and corresponding code decompiled by CFR, Fernflower and Jadx respectively in directory data/code/.</li><li>Calculation results in directory data/results/.</li><li>The annotated dataset data/relative_understandability.csv denotes the relative understandability of the file decompiled by the decompiler compared to the original file, in which -1, indicating that the decompiled file is less understandable than the original file; 0, signifying equivalent; and 1, indicating more understandable.</li></ol><h3><strong>Tools</strong></h3><p>Our tools in the directory tool/ includes tools for assessing the understandability of decompiled code with perplexity, Cognitive Complexity and Cognitive Complexity for Decompilation.</p><h4><strong>Environment</strong></h4><ul><li>System: Ubuntu 20.04</li><li>Python: python 3.10<ul><li>pip install kenlm</li><li>pip install javalang</li></ul></li><li>Java: JDK >= 11</li></ul><h4><strong>Perplexity Calculator</strong></h4><p>perplexity_calculator.py calculates the perplexity of n-gram models for a Java file. 5-gram.binary is our 5-gram language model.</p><ul><li>python perplexity_calculator.py <5_gram.binary> <file></li></ul><p>Where <5_gram.binary> represents path to the n-gram model, <file> represents the Java file to be evaluated.</p><h4><strong>Cognitive Complexity Calculator and Cognitive Complexity for Decompilation Calculator</strong></h4><p>CognitiveComplexityCalculator-1.0.jar calculates the Cognitive Complexity for Java files. CognitiveComplexityforDecompilationCalculator-1.0.jar calculates the Cognitive Complexity for Decompilation for Java files.</p><ul><li>java -jar CognitiveComplexityCalculator-1.0.jar <input_directory> <output_file></li><li>java -jar CognitiveComplexityforDecompilationCalculator-1.0.jar <input_directory> <output_file></li></ul><p>Where <input_directory> represents the directory of all Java files to analyze, including all the files in the subdirectories. <output_file> represents where the output file is created.</p><p>The output file is a .csv file which contains the Cognitive Complexity or Cognitive Complexity for Decompilation value for each method. Specifically it contains:</p><ul><li>Absolute Module Path: The path of the class containing the method</li><li>Module Position: The line in the .java file where the method starts</li><li>Module declaration: The method signature and return type or pattern type</li><li>Max Nesting: The maximum level of nesting reached by the method (considering as 1 the starting level)</li><li>Cognitive Complexity or Cognitive Complexity for Decompilation</li></ul><h2><strong>Reference</strong></h2><ol><li>Cognitive Complexity Calculator: <a href="https://github.com/BruhZul/cognitive-complexity-calculator">https://github.com/BruhZul/cognitive-complexity-calculator</a></li></ol><p> </p>
ShareScore
16/100
Overall dataset sharing score
Score breakdown
These five areas show where the dataset supports — or may limit — practical reuse.
- Stewardship
- 4
- Harmonization
- 4
- Access
- 8
- Reuse readiness
- 0
- Engagement
- 0