Cleanup (formatting; naming)
authorRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 14 Oct 2014 12:14:49 +0000 (14:14 +0200)
committerRoman Shevchenko <roman.shevchenko@jetbrains.com>
Tue, 14 Oct 2014 13:27:13 +0000 (15:27 +0200)
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassWriter.java
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java
plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java

index ea78c723d01197a41065971f7fadc0dd29fe8fee..6de59331618d93561285c5e4138a4a2f2d48fd00 100644 (file)
@@ -99,31 +99,31 @@ public class ClassWriter {
 
       DecompilerContext.getLogger().startWriteClass(node.simpleName);
 
-      if (node.lambda_information.is_method_reference) {
-        if (!node.lambda_information.is_content_method_static && method_object != null) {
+      if (node.lambdaInformation.is_method_reference) {
+        if (!node.lambdaInformation.is_content_method_static && method_object != null) {
           // reference to a virtual method
           buffer.append(method_object.toJava(indent, tracer));
         }
         else {
           // reference to a static method
-          buffer.append(ExprProcessor.getCastTypeName(new VarType(node.lambda_information.content_class_name, false)));
+          buffer.append(ExprProcessor.getCastTypeName(new VarType(node.lambdaInformation.content_class_name, false)));
         }
 
         buffer.append("::");
-        buffer.append(node.lambda_information.content_method_name);
+        buffer.append(node.lambdaInformation.content_method_name);
       }
       else {
         // lambda method
-        StructMethod mt = cl.getMethod(node.lambda_information.content_method_key);
+        StructMethod mt = cl.getMethod(node.lambdaInformation.content_method_key);
         MethodWrapper methodWrapper = wrapper.getMethodWrapper(mt.getName(), mt.getDescriptor());
-        MethodDescriptor md_content = MethodDescriptor.parseDescriptor(node.lambda_information.content_method_descriptor);
-        MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(node.lambda_information.method_descriptor);
+        MethodDescriptor md_content = MethodDescriptor.parseDescriptor(node.lambdaInformation.content_method_descriptor);
+        MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(node.lambdaInformation.method_descriptor);
 
         if (!lambdaToAnonymous) {
           buffer.append('(');
 
           boolean firstParameter = true;
-          int index = node.lambda_information.is_content_method_static ? 0 : 1;
+          int index = node.lambdaInformation.is_content_method_static ? 0 : 1;
           int start_index = md_content.params.length - md_lambda.params.length;
 
           for (int i = 0; i < md_content.params.length; i++) {
@@ -485,9 +485,9 @@ public class ClassWriter {
     DecompilerContext.setProperty(DecompilerContext.CURRENT_METHOD_WRAPPER, methodWrapper);
 
     try {
-      String method_name = lambdaNode.lambda_information.method_name;
-      MethodDescriptor md_content = MethodDescriptor.parseDescriptor(lambdaNode.lambda_information.content_method_descriptor);
-      MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(lambdaNode.lambda_information.method_descriptor);
+      String method_name = lambdaNode.lambdaInformation.method_name;
+      MethodDescriptor md_content = MethodDescriptor.parseDescriptor(lambdaNode.lambdaInformation.content_method_descriptor);
+      MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(lambdaNode.lambdaInformation.method_descriptor);
 
       if (!codeOnly) {
         buffer.appendIndent(indent);
@@ -496,7 +496,7 @@ public class ClassWriter {
         buffer.append("(");
 
         boolean firstParameter = true;
-        int index = lambdaNode.lambda_information.is_content_method_static ? 0 : 1;
+        int index = lambdaNode.lambdaInformation.is_content_method_static ? 0 : 1;
         int start_index = md_content.params.length - md_lambda.params.length;
 
         for (int i = 0; i < md_content.params.length; i++) {
index 987c1a5316a437c4943b00e7cf7a1b92d54e8be5..32470e0637307ad86f545c2dd95a4ea0273bd8b4 100644 (file)
@@ -347,30 +347,18 @@ public class ClassesProcessor {
     public static final int CLASS_LAMBDA = 8;
 
     public int type;
-
     public int access;
-
     public String simpleName;
-
     public StructClass classStruct;
-
     public ClassWrapper wrapper;
-
     public String enclosingMethod;
-
     public InvocationExprent superInvocation;
-
-    public HashMap<String, VarVersionPaar> mapFieldsToVars = new HashMap<String, VarVersionPaar>();
-
+    public Map<String, VarVersionPaar> mapFieldsToVars = new HashMap<String, VarVersionPaar>();
     public VarType anonymousClassType;
-
     public List<ClassNode> nested = new ArrayList<ClassNode>();
-
     public Set<String> enclosingClasses = new HashSet<String>();
-
     public ClassNode parent;
-
-    public LambdaInformation lambda_information;
+    public LambdaInformation lambdaInformation;
 
     public ClassNode(String content_class_name,
                      String content_method_name,
@@ -383,19 +371,19 @@ public class ClassesProcessor {
       this.type = CLASS_LAMBDA;
       this.classStruct = classStruct; // 'parent' class containing the static function
 
-      lambda_information = new LambdaInformation();
+      lambdaInformation = new LambdaInformation();
 
-      lambda_information.class_name = lambda_class_name;
-      lambda_information.method_name = lambda_method_name;
-      lambda_information.method_descriptor = lambda_method_descriptor;
+      lambdaInformation.class_name = lambda_class_name;
+      lambdaInformation.method_name = lambda_method_name;
+      lambdaInformation.method_descriptor = lambda_method_descriptor;
 
-      lambda_information.content_class_name = content_class_name;
-      lambda_information.content_method_name = content_method_name;
-      lambda_information.content_method_descriptor = content_method_descriptor;
-      lambda_information.content_method_invocation_type = content_method_invocation_type;
+      lambdaInformation.content_class_name = content_class_name;
+      lambdaInformation.content_method_name = content_method_name;
+      lambdaInformation.content_method_descriptor = content_method_descriptor;
+      lambdaInformation.content_method_invocation_type = content_method_invocation_type;
 
-      lambda_information.content_method_key =
-        InterpreterUtil.makeUniqueKey(lambda_information.content_method_name, lambda_information.content_method_descriptor);
+      lambdaInformation.content_method_key =
+        InterpreterUtil.makeUniqueKey(lambdaInformation.content_method_name, lambdaInformation.content_method_descriptor);
 
       anonymousClassType = new VarType(lambda_class_name, true);
 
@@ -405,9 +393,9 @@ public class ClassesProcessor {
         is_method_reference = !mt.isSynthetic(); // if not synthetic -> method reference
       }
 
-      lambda_information.is_method_reference = is_method_reference;
-      lambda_information.is_content_method_static =
-        (lambda_information.content_method_invocation_type == CodeConstants.CONSTANT_MethodHandle_REF_invokeStatic); // FIXME: redundant?
+      lambdaInformation.is_method_reference = is_method_reference;
+      lambdaInformation.is_content_method_static =
+        (lambdaInformation.content_method_invocation_type == CodeConstants.CONSTANT_MethodHandle_REF_invokeStatic); // FIXME: redundant?
     }
 
     public ClassNode(int type, StructClass classStruct) {
@@ -435,7 +423,6 @@ public class ClassesProcessor {
       public String content_method_name;
       public String content_method_descriptor;
       public int content_method_invocation_type; // values from CONSTANT_MethodHandle_REF_*
-
       public String content_method_key;
 
       public boolean is_method_reference;
index 743ce121538173a52c0694490586b7c37c684677..398fedb0222d884f387c0e8b600cf55d497f7028 100644 (file)
@@ -122,7 +122,7 @@ public class LambdaProcessor {
               node_lambda.parent = node;
 
               clprocessor.getMapRootClasses().put(node_lambda.simpleName, node_lambda);
-              mapMethodsLambda.put(node_lambda.lambda_information.content_method_key, node_lambda.simpleName);
+              mapMethodsLambda.put(node_lambda.lambdaInformation.content_method_key, node_lambda.simpleName);
             }
           }
         }
index 25ff8125a7f69ec282bf8f3e106f674ea24f86aa..6218319b7a98724e26c28d9bbf0d6b7f8b0dc572 100644 (file)
@@ -47,10 +47,10 @@ public class NestedClassProcessor {
   public void processClass(ClassNode root, ClassNode node) {
 
     // hide synthetic lambda content methods
-    if (node.type == ClassNode.CLASS_LAMBDA && !node.lambda_information.is_method_reference) {
+    if (node.type == ClassNode.CLASS_LAMBDA && !node.lambdaInformation.is_method_reference) {
       ClassNode node_content = DecompilerContext.getClassProcessor().getMapRootClasses().get(node.classStruct.qualifiedName);
       if (node_content != null && node_content.wrapper != null) {
-        node_content.wrapper.getHiddenMembers().add(node.lambda_information.content_method_key);
+        node_content.wrapper.getHiddenMembers().add(node.lambdaInformation.content_method_key);
       }
     }
 
@@ -75,8 +75,8 @@ public class NestedClassProcessor {
           child.simpleName = "SyntheticClass_" + (++synthetics);
         }
         else {
-          DecompilerContext.getLogger().writeMessage("Nameless local or member class " + cl.qualifiedName + "!",
-                                                     IFernflowerLogger.Severity.WARN);
+          String message = "Nameless local or member class " + cl.qualifiedName + "!";
+          DecompilerContext.getLogger().writeMessage(message, IFernflowerLogger.Severity.WARN);
           child.simpleName = "NamelessClass_" + (++nameless);
         }
       }
@@ -86,13 +86,11 @@ public class NestedClassProcessor {
       if (child.type == ClassNode.CLASS_LAMBDA) {
         setLambdaVars(node, child);
       }
-      else {
-        if (child.type != ClassNode.CLASS_MEMBER || (child.access & CodeConstants.ACC_STATIC) == 0) {
-          insertLocalVars(node, child);
+      else if (child.type != ClassNode.CLASS_MEMBER || (child.access & CodeConstants.ACC_STATIC) == 0) {
+        insertLocalVars(node, child);
 
-          if (child.type == ClassNode.CLASS_LOCAL) {
-            setLocalClassDefinition(node.wrapper.getMethods().getWithKey(child.enclosingMethod), child);
-          }
+        if (child.type == ClassNode.CLASS_LOCAL) {
+          setLocalClassDefinition(node.wrapper.getMethods().getWithKey(child.enclosingMethod), child);
         }
       }
     }
@@ -104,22 +102,22 @@ public class NestedClassProcessor {
 
   private static void setLambdaVars(ClassNode parent, ClassNode child) {
 
-    if (child.lambda_information.is_method_reference) { // method reference, no code and no parameters
+    if (child.lambdaInformation.is_method_reference) { // method reference, no code and no parameters
       return;
     }
 
-    final MethodWrapper meth = parent.wrapper.getMethods().getWithKey(child.lambda_information.content_method_key);
+    final MethodWrapper meth = parent.wrapper.getMethods().getWithKey(child.lambdaInformation.content_method_key);
     final MethodWrapper encmeth = parent.wrapper.getMethods().getWithKey(child.enclosingMethod);
 
-    MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(child.lambda_information.method_descriptor);
-    final MethodDescriptor md_content = MethodDescriptor.parseDescriptor(child.lambda_information.content_method_descriptor);
+    MethodDescriptor md_lambda = MethodDescriptor.parseDescriptor(child.lambdaInformation.method_descriptor);
+    final MethodDescriptor md_content = MethodDescriptor.parseDescriptor(child.lambdaInformation.content_method_descriptor);
 
     final int vars_count = md_content.params.length - md_lambda.params.length;
     //         if(vars_count < 0) { // should not happen, but just in case...
     //                 vars_count = 0;
     //         }
 
-    final boolean is_static_lambda_content = child.lambda_information.is_content_method_static;
+    final boolean is_static_lambda_content = child.lambdaInformation.is_content_method_static;
 
     final String parent_class_name = parent.wrapper.getClassStruct().qualifiedName;
     final String lambda_class_name = child.simpleName;