This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a52736  improve readability of StackMap toString() output (#97)
3a52736 is described below

commit 3a52736bb3b7717c1f772a27077c28483e78296f
Author: Mark Roberts <markr...@users.noreply.github.com>
AuthorDate: Thu Jul 15 06:08:31 2021 -0700

    improve readability of StackMap toString() output (#97)
---
 src/main/java/org/apache/bcel/classfile/StackMap.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/bcel/classfile/StackMap.java 
b/src/main/java/org/apache/bcel/classfile/StackMap.java
index 99ec3b2..ad61b70 100644
--- a/src/main/java/org/apache/bcel/classfile/StackMap.java
+++ b/src/main/java/org/apache/bcel/classfile/StackMap.java
@@ -115,8 +115,10 @@ public final class StackMap extends Attribute {
     @Override
     public String toString() {
         final StringBuilder buf = new StringBuilder("StackMap(");
+        int running_offset = -1; // no +1 on first entry
         for (int i = 0; i < map.length; i++) {
-            buf.append(map[i]);
+            running_offset = map[i].getByteCodeOffset() + running_offset + 1;
+            buf.append(String.format("%n@%03d %s", running_offset, map[i]));
             if (i < map.length - 1) {
                 buf.append(", ");
             }

Reply via email to