Missing inner classes
dead-end opened this issue · comments
I have written a little demo class:
package pkg;
public class MyClass {
public static void main(String[] args) {
new InnerClass().hello();
}
private static class InnerClass {
public void hello() {
System.out.println("Hello");
}
}
}
The resulting jar contains the following content:
# unzip -l jd-test-0.0.1-SNAPSHOT.jar
Archive: jd-test-0.0.1-SNAPSHOT.jar
Length Date Time Name
--------- ---------- ----- ----
0 2019-11-21 17:01 META-INF/
133 2019-11-21 17:01 META-INF/MANIFEST.MF
0 2019-11-21 17:01 pkg/
177 2019-11-21 17:01 pkg/MyClass$1.class
703 2019-11-21 17:01 pkg/MyClass$InnerClass.class
535 2019-11-21 17:01 pkg/MyClass.class
0 2019-11-21 17:01 META-INF/maven/
0 2019-11-21 17:01 META-INF/maven/jd-test/
0 2019-11-21 17:01 META-INF/maven/jd-test/jd-test/
381 2019-11-21 16:58 META-INF/maven/jd-test/jd-test/pom.xml
113 2019-11-21 17:01 META-INF/maven/jd-test/jd-test/pom.properties
--------- -------
2042 11 files
The decompilation is done with the following command:
# java -jar jd-cli.jar --skipResources -n jd-test-0.0.1-SNAPSHOT.jar
17:05:18.417 INFO com.github.kwart.jd.cli.Main - Decompiling jd-test-0.0.1-SNAPSHOT.jar
17:05:18.434 INFO com.github.kwart.jd.output.ZipOutput - ZIP file output will be initialized - jd-test-0.0.1-SNAPSHOT.src.jar
17:05:18.672 INFO com.github.kwart.jd.output.ZipOutput - Finished with 1 class file(s) and 0 resource file(s) written.
The result is:
# unzip -l jd-test-0.0.1-SNAPSHOT.src.jar
Archive: jd-test-0.0.1-SNAPSHOT.src.jar
Length Date Time Name
--------- ---------- ----- ----
161 2019-11-21 17:05 pkg/MyClass.java
--------- -------
161 1 file
But the decompiled sources does not contain the inner class:
# unzip -p jd-test-0.0.1-SNAPSHOT.src.jar pkg/MyClass.java
/* 0 */ package pkg;
/* 0 */
/* 0 */ public class MyClass {
/* 6 */ public static void main(String[] args) { (new InnerClass(null)).hello(); }
/* 0 */ }
I am using: jd-cli-1.0.0.Final-dist.tar.gz
Fixed by 782105a in 1.0.1.
Thanks for reporting the issue.