Skip to content

Commit

Permalink
fix: check if synthetic class not yet processed but must be removed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Mar 2, 2019
1 parent dd13edf commit d069928
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ public boolean visit(ClassNode cls) throws JadxException {
for (ClassNode inner : cls.getInnerClasses()) {
visit(inner);
}
if (cls.getAccessFlags().isSynthetic()
&& cls.getFields().isEmpty()
&& cls.getMethods().isEmpty()
&& cls.getInnerClasses().isEmpty()) {
if (isEmptySyntheticClass(cls)) {
cls.add(AFlag.DONT_GENERATE);
return false;
}
Expand All @@ -62,6 +59,13 @@ public boolean visit(ClassNode cls) throws JadxException {
return false;
}

private static boolean isEmptySyntheticClass(ClassNode cls) {
return cls.getAccessFlags().isSynthetic()
&& cls.getFields().isEmpty()
&& cls.getMethods().isEmpty()
&& cls.getInnerClasses().isEmpty();
}

private void markAnonymousClass(ClassNode cls) {
if (cls.isAnonymous()) {
cls.add(AFlag.ANONYMOUS_CLASS);
Expand Down Expand Up @@ -173,7 +177,7 @@ private static boolean isRemovedClassInArgs(ClassNode cls, List<RegisterArg> mth
return true;
}
} else {
if (argCls.contains(AFlag.DONT_GENERATE)) {
if (argCls.contains(AFlag.DONT_GENERATE) || isEmptySyntheticClass(argCls)) {
return true;
}
}
Expand Down

0 comments on commit d069928

Please sign in to comment.