From d96104bdec9bb0a15247aad537d0df315374c710 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 7 Oct 2014 21:45:26 +0200 Subject: [PATCH] Cleanup (formatting) --- .../decompiler/main/ClassesProcessor.java | 28 ++++++++----------- .../main/rels/NestedClassProcessor.java | 12 ++++---- .../modules/decompiler/DomHelper.java | 3 +- .../modules/decompiler/exps/NewExprent.java | 8 +++--- 4 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java index 42f4719..bcb1d04 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java @@ -48,10 +48,8 @@ public class ClassesProcessor { public ClassesProcessor(StructContext context) { HashMap mapInnerClasses = new HashMap(); - HashMap> mapNestedClassReferences = new HashMap>(); HashMap> mapEnclosingClassReferences = new HashMap>(); - HashMap mapNewSimpleNames = new HashMap(); boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER); @@ -113,11 +111,9 @@ public class ClassesProcessor { if (arrold == null) { mapInnerClasses.put(innername, arr); } - else { - if (!InterpreterUtil.equalObjectArrays(arrold, arr)) { - DecompilerContext.getLogger() - .writeMessage("Inconsistent inner class entries for " + innername + "!", IFernflowerLogger.Severity.WARN); - } + else if (!InterpreterUtil.equalObjectArrays(arrold, arr)) { + String message = "Inconsistent inner class entries for " + innername + "!"; + DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN); } // reference to the nested class @@ -174,15 +170,13 @@ public class ClassesProcessor { continue; } - if (setVisited.contains(nestedClass)) { + if (!setVisited.add(nestedClass)) { continue; } - setVisited.add(nestedClass); ClassNode nestednode = mapRootClasses.get(nestedClass); if (nestednode == null) { - DecompilerContext.getLogger().writeMessage("Nested class " + nestedClass + " missing!", - IFernflowerLogger.Severity.WARN); + DecompilerContext.getLogger().writeMessage("Nested class " + nestedClass + " missing!", IFernflowerLogger.Severity.WARN); continue; } @@ -207,13 +201,13 @@ public class ClassesProcessor { if (interfaces.length > 0) { if (interfaces.length > 1) { - DecompilerContext.getLogger() - .writeMessage("Inconsistent anonymous class definition: " + cl.qualifiedName, IFernflowerLogger.Severity.WARN); + String message = "Inconsistent anonymous class definition: " + cl.qualifiedName; + DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN); } - nestednode.anonimousClassType = new VarType(cl.getInterface(0), true); + nestednode.anonymousClassType = new VarType(cl.getInterface(0), true); } else { - nestednode.anonimousClassType = new VarType(cl.superClass.getString(), true); + nestednode.anonymousClassType = new VarType(cl.superClass.getString(), true); } } else if (nestednode.type == ClassNode.CLASS_LOCAL) { @@ -366,7 +360,7 @@ public class ClassesProcessor { public HashMap mapFieldsToVars = new HashMap(); - public VarType anonimousClassType; + public VarType anonymousClassType; public List nested = new ArrayList(); @@ -401,7 +395,7 @@ public class ClassesProcessor { lambda_information.content_method_key = InterpreterUtil.makeUniqueKey(lambda_information.content_method_name, lambda_information.content_method_descriptor); - anonimousClassType = new VarType(lambda_class_name, true); + anonymousClassType = new VarType(lambda_class_name, true); boolean is_method_reference = (content_class_name != classStruct.qualifiedName); if (!is_method_reference) { // content method in the same class, check synthetic flag diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java index 2e83946..25ff812 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java @@ -221,12 +221,12 @@ public class NestedClassProcessor { if (!hasEnclosing) { if (child.type == ClassNode.CLASS_ANONYMOUS) { - DecompilerContext.getLogger() - .writeMessage("Unreferenced anonymous class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN); + String message = "Unreferenced anonymous class " + child.classStruct.qualifiedName + "!"; + DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN); } else if (child.type == ClassNode.CLASS_LOCAL) { - DecompilerContext.getLogger() - .writeMessage("Unreferenced local class " + child.classStruct.qualifiedName + "!", IFernflowerLogger.Severity.WARN); + String message = "Unreferenced local class " + child.classStruct.qualifiedName + "!"; + DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN); } } } @@ -275,8 +275,8 @@ public class NestedClassProcessor { HashMap> mask = getMaskLocalVars(nd.wrapper); if (mask.isEmpty()) { - DecompilerContext.getLogger() - .writeMessage("Nested class " + nd.classStruct.qualifiedName + " has no constructor!", IFernflowerLogger.Severity.WARN); + String message = "Nested class " + nd.classStruct.qualifiedName + " has no constructor!"; + DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN); } else { mapVarMasks.put(nd.classStruct.qualifiedName, mask); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java index 5c05910..8c5dd4c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java @@ -347,8 +347,7 @@ public class DomHelper { } else { if (mapstage == 2 || mapRefreshed) { // last chance lost - DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!", - IFernflowerLogger.Severity.ERROR); + DecompilerContext.getLogger().writeMessage("Statement cannot be decomposed although reducible!", IFernflowerLogger.Severity.ERROR); } break; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java index 5006d30..bb55e45 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java @@ -95,7 +95,7 @@ public class NewExprent extends Exprent { if (anonymous) { ClassNode node = DecompilerContext.getClassProcessor().getMapRootClasses().get(newtype.value); - return node.anonimousClassType; + return node.anonymousClassType; } else { return newtype; @@ -233,13 +233,13 @@ public class NewExprent extends Exprent { if (!enumconst) { String enclosing = null; if (!lambda && constructor != null) { - enclosing = getQualifiedNewInstance(child.anonimousClassType.value, constructor.getLstParameters(), indent, tracer); + enclosing = getQualifiedNewInstance(child.anonymousClassType.value, constructor.getLstParameters(), indent, tracer); } - String typename = ExprProcessor.getCastTypeName(child.anonimousClassType); + String typename = ExprProcessor.getCastTypeName(child.anonymousClassType); if (enclosing != null) { - ClassNode anonimousNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(child.anonimousClassType.value); + ClassNode anonimousNode = DecompilerContext.getClassProcessor().getMapRootClasses().get(child.anonymousClassType.value); if (anonimousNode != null) { typename = anonimousNode.simpleName; }