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()); }