diff --git a/build.gradle b/build.gradle index 8ae74273..461ac8c4 100644 --- a/build.gradle +++ b/build.gradle @@ -88,6 +88,7 @@ dependencies { compile 'net.minecraft:launchwrapper:1.11' compile 'com.google.code.gson:gson:2.2.4' compile 'commons-io:commons-io:2.4' + compile 'commons-codec:commons-codec:1.9' testCompile 'junit:junit:4.11' testCompile 'org.hamcrest:hamcrest-library:1.3' testCompile 'org.mockito:mockito-core:1.9.0' diff --git a/src/main/java/org/spongepowered/asm/util/ASMHelper.java b/src/main/java/org/spongepowered/asm/util/ASMHelper.java index 9c9ed2d8..00a6eae6 100644 --- a/src/main/java/org/spongepowered/asm/util/ASMHelper.java +++ b/src/main/java/org/spongepowered/asm/util/ASMHelper.java @@ -364,7 +364,7 @@ public class ASMHelper { if (node instanceof LabelNode) { System.err.printf("[%s]", ((LabelNode)node).getLabel()); } else if (node instanceof JumpInsnNode) { - System.err.printf("[%s]", ((JumpInsnNode)node).label.getLabel()); + System.err.printf("[%s] [%s]", ASMHelper.getOpcodeName(node), ((JumpInsnNode)node).label.getLabel()); } else if (node instanceof VarInsnNode) { System.err.printf("[%s] %d", ASMHelper.getOpcodeName(node), ((VarInsnNode)node).var); } else if (node instanceof MethodInsnNode) { diff --git a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java index 4168d05d..c812ea87 100644 --- a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java +++ b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java @@ -39,7 +39,7 @@ public class PrettyPrinter { /** * "Horizontal rule" marker */ - private static final String HR = "---"; + private static final char HR = '\253'; /** * If specified as the first character on a line, centres the line @@ -95,7 +95,18 @@ public class PrettyPrinter { * @return fluent interface */ public PrettyPrinter hr() { - this.lines.add(PrettyPrinter.HR); + return this.hr('*'); + } + + + /** + * Adds a horizontal rule of the specified char to the output + * + * @param ruleChar character to use for the horizontal rule + * @return fluent interface + */ + public PrettyPrinter hr(char ruleChar) { + this.lines.add("" + PrettyPrinter.HR + ruleChar); return this; } @@ -117,22 +128,23 @@ public class PrettyPrinter { * @param stream stream to print to */ public void print(PrintStream stream) { - this.printHr(stream); + this.printHr(stream, '*'); for (String line : this.lines) { - if (line == PrettyPrinter.HR) { - this.printHr(stream); + int len = line.length(); + if (len > 1 && line.charAt(0) == PrettyPrinter.HR) { + this.printHr(stream, line.charAt(1)); } else { - if (line.length() > 0 && line.charAt(0) == PrettyPrinter.CENTRE) { + if (len > 0 && line.charAt(0) == PrettyPrinter.CENTRE) { String text = line.substring(1); line = String.format("%" + (((this.width - (text.length())) / 2) + text.length()) + "s", text); } stream.printf("/* %-" + this.width + "s */\n", line); } } - this.printHr(stream); + this.printHr(stream, '*'); } - private void printHr(PrintStream stream) { - stream.printf("/*%s*/\n", Strings.repeat("*", this.width + 2)); + private void printHr(PrintStream stream, char... hrChars) { + stream.printf("/*%s*/\n", Strings.repeat(new String(hrChars), this.width + 2)); } }