summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-06-25 13:37:41 +0200
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>2014-06-25 13:37:41 +0200
commite39ae1e71d497bcedccc1e88ccf01f274d377b76 (patch)
treebb743f6a03a5cfff982e621487e1bccab407db01
parent6e303d859231a57051ffff8fc25be72e79ff0d26 (diff)
downloadfernflower-e39ae1e71d497bcedccc1e88ccf01f274d377b76.tar
fernflower-e39ae1e71d497bcedccc1e88ccf01f274d377b76.tar.gz
fernflower-e39ae1e71d497bcedccc1e88ccf01f274d377b76.tar.lz
fernflower-e39ae1e71d497bcedccc1e88ccf01f274d377b76.tar.xz
fernflower-e39ae1e71d497bcedccc1e88ccf01f274d377b76.zip
repeatable nameless class names
-rw-r--r--src/de/fernflower/main/rels/NestedClassProcessor.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/de/fernflower/main/rels/NestedClassProcessor.java b/src/de/fernflower/main/rels/NestedClassProcessor.java
index 58af225..7fdd4f8 100644
--- a/src/de/fernflower/main/rels/NestedClassProcessor.java
+++ b/src/de/fernflower/main/rels/NestedClassProcessor.java
@@ -75,16 +75,20 @@ public class NestedClassProcessor {
// for each local or anonymous class ensure not empty enclosing method
checkNotFoundClasses(root, node);
}
-
- for(ClassNode child : node.nested) {
- // ensure not-empty class name
- if((child.type == ClassNode.CLASS_LOCAL || child.type == ClassNode.CLASS_MEMBER) && child.simpleName == null) {
- DecompilerContext.getLogger().writeMessage("Nameless local or member class "+child.classStruct.qualifiedName+"!", IFernflowerLogger.WARNING);
- child.simpleName = "NamelessClass"+child.hashCode();
- }
- }
-
-
+
+ int nameless = 0, synthetics = 0;
+ for(ClassNode child : node.nested) {
+ // ensure not-empty class name
+ if((child.type == ClassNode.CLASS_LOCAL || child.type == ClassNode.CLASS_MEMBER) && child.simpleName == null) {
+ if((child.classStruct.access_flags & CodeConstants.ACC_SYNTHETIC) == 0) {
+ DecompilerContext.getLogger().writeMessage("Nameless local or member class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.WARNING);
+ child.simpleName = "NamelessClass_" + (++nameless);
+ } else {
+ child.simpleName = "SyntheticClass_" + (++synthetics);
+ }
+ }
+ }
+
for(ClassNode child : node.nested) {
if(child.type == ClassNode.CLASS_LAMBDA) {
setLambdaVars(node, child);