better filtering of synthetic inner classes

master
Roman Shevchenko 11 years ago
parent 879330b555
commit 95476dc36b
  1. 2
      src/de/fernflower/main/ClassWriter.java
  2. 9
      src/de/fernflower/main/rels/NestedClassProcessor.java

@ -296,7 +296,7 @@ public class ClassWriter {
if(inner.type == ClassNode.CLASS_MEMBER) { if(inner.type == ClassNode.CLASS_MEMBER) {
StructClass innercl = inner.classStruct; StructClass innercl = inner.classStruct;
boolean isSynthetic = (innercl.access_flags & CodeConstants.ACC_SYNTHETIC) != 0 || innercl.getAttributes().containsKey("Synthetic"); boolean isSynthetic = ((inner.access | innercl.access_flags) & CodeConstants.ACC_SYNTHETIC) != 0 || innercl.getAttributes().containsKey("Synthetic");
if((!isSynthetic || !DecompilerContext.getOption(IFernflowerPreferences.REMOVE_SYNTHETIC)) if((!isSynthetic || !DecompilerContext.getOption(IFernflowerPreferences.REMOVE_SYNTHETIC))
&& !wrapper.getHideMembers().contains(innercl.qualifiedName)) { && !wrapper.getHideMembers().contains(innercl.qualifiedName)) {
writer.write(DecompilerContext.getNewLineSeparator()); writer.write(DecompilerContext.getNewLineSeparator());

@ -80,11 +80,12 @@ public class NestedClassProcessor {
for(ClassNode child : node.nested) { for(ClassNode child : node.nested) {
// ensure not-empty class name // ensure not-empty class name
if((child.type == ClassNode.CLASS_LOCAL || child.type == ClassNode.CLASS_MEMBER) && child.simpleName == null) { if((child.type == ClassNode.CLASS_LOCAL || child.type == ClassNode.CLASS_MEMBER) && child.simpleName == null) {
if((child.classStruct.access_flags & CodeConstants.ACC_SYNTHETIC) == 0) { StructClass cl = child.classStruct;
DecompilerContext.getLogger().writeMessage("Nameless local or member class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.WARNING); if(((child.access | cl.access_flags) & CodeConstants.ACC_SYNTHETIC) != 0 || cl.getAttributes().containsKey("Synthetic")) {
child.simpleName = "NamelessClass_" + (++nameless);
} else {
child.simpleName = "SyntheticClass_" + (++synthetics); child.simpleName = "SyntheticClass_" + (++synthetics);
} else {
DecompilerContext.getLogger().writeMessage("Nameless local or member class " + cl.qualifiedName + "!", IFernflowerLogger.WARNING);
child.simpleName = "NamelessClass_" + (++nameless);
} }
} }
} }

Loading…
Cancel
Save