Cleanup (warnings; formatting; unneeded comments)

This commit is contained in:
Roman Shevchenko
2018-08-10 15:21:05 +02:00
parent b2a6767640
commit 9669276a3e
3 changed files with 215 additions and 216 deletions

View File

@@ -59,23 +59,24 @@ public class Instruction implements CodeConstants {
opcode != opc_jsr && opcode != opc_tableswitch && opcode != opc_lookupswitch;
}
@Override
public String toString() {
String res = wide ? "@wide " : "";
res += "@" + TextUtil.getInstructionName(opcode);
StringBuilder res = new StringBuilder();
if (wide) res.append("@wide ");
res.append("@").append(TextUtil.getInstructionName(opcode));
int len = operandsCount();
for (int i = 0; i < len; i++) {
int op = operands[i];
if (op < 0) {
res += " -" + Integer.toHexString(-op);
res.append(" -").append(Integer.toHexString(-op));
}
else {
res += " " + Integer.toHexString(op);
res.append(" ").append(Integer.toHexString(op));
}
}
return res;
return res.toString();
}
@Override

View File

@@ -1,12 +1,12 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.java.decompiler.code.cfg;
import org.jetbrains.java.decompiler.main.DecompilerContext;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.jetbrains.java.decompiler.main.DecompilerContext;
public class ExceptionRangeCFG {
private final List<BasicBlock> protectedRange; // FIXME: replace with set
private BasicBlock handler;
@@ -25,10 +25,9 @@ public class ExceptionRangeCFG {
return protectedRange.contains(handler);
}
@Override
public String toString() {
String new_line_separator = DecompilerContext.getNewLineSeparator();
StringBuilder buf = new StringBuilder();
buf.append("exceptionType:");
@@ -39,8 +38,8 @@ public class ExceptionRangeCFG {
buf.append("handler: ").append(handler.id).append(new_line_separator);
buf.append("range: ");
for (int i = 0; i < protectedRange.size(); i++) {
buf.append(protectedRange.get(i).id).append(" ");
for (BasicBlock block : protectedRange) {
buf.append(block.id).append(" ");
}
buf.append(new_line_separator);