From 57a1db12c9b4f4df984141cd090beed6fabe77bf Mon Sep 17 00:00:00 2001 From: Jan Peter Stotz Date: Mon, 10 Feb 2020 19:22:10 +0100 Subject: [PATCH] fix: additionally show smali code of all inner classes (recursively) --- .../java/jadx/core/dex/nodes/ClassNode.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java b/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java index 06aa3ea9717..9d51039b163 100644 --- a/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java +++ b/jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java @@ -2,6 +2,7 @@ import java.io.StringWriter; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -451,6 +452,18 @@ public List getInnerClasses() { return innerClasses; } + /** + * Get all inner classes recursively + * + * @param innerClassesColl all identified inner classes are added to this collection + */ + public void getInnerClassesRecursive(Collection innerClassesColl) { + for (ClassNode innerClass : innerClasses) { + innerClassesColl.add(innerClass); + innerClass.getInnerClassesRecursive(innerClassesColl); + } + } + public void addInnerClass(ClassNode cls) { if (innerClasses.isEmpty()) { innerClasses = new ArrayList<>(5); @@ -537,7 +550,9 @@ public String getSmali() { StringWriter stringWriter = new StringWriter(4096); getSmali(this, stringWriter); stringWriter.append(System.lineSeparator()); - for (ClassNode innerClass : innerClasses) { + List allInnerClasses = new ArrayList<>(); + getInnerClassesRecursive(allInnerClasses); + for (ClassNode innerClass : allInnerClasses) { getSmali(innerClass, stringWriter); stringWriter.append(System.lineSeparator()); }