Commit d0699286 authored by Skylot's avatar Skylot

fix: check if synthetic class not yet processed but must be removed (#450)

parent dd13edf2
......@@ -47,10 +47,7 @@ public class ClassModifier extends AbstractVisitor {
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;
}
......@@ -62,6 +59,13 @@ public class ClassModifier extends AbstractVisitor {
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);
......@@ -173,7 +177,7 @@ public class ClassModifier extends AbstractVisitor {
return true;
}
} else {
if (argCls.contains(AFlag.DONT_GENERATE)) {
if (argCls.contains(AFlag.DONT_GENERATE) || isEmptySyntheticClass(argCls)) {
return true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment