diff options
author | chibash <chiba@javassist.org> | 2013-12-02 01:51:27 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2013-12-02 01:51:27 +0900 |
commit | 81215a06fb666657faca5dc55e9373baaaf8a039 (patch) | |
tree | d195bf752f6c129591c4e819aff4c361957689f4 | |
parent | f2106b67e240fb43ce218216092901c85b088329 (diff) | |
download | javassist-81215a06fb666657faca5dc55e9373baaaf8a039.tar.gz javassist-81215a06fb666657faca5dc55e9373baaaf8a039.zip |
fixed JASSIST-212
-rw-r--r-- | src/main/javassist/bytecode/stackmap/MapMaker.java | 6 | ||||
-rw-r--r-- | src/test/javassist/JvstTest4.java | 19 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/stackmap/MapMaker.java b/src/main/javassist/bytecode/stackmap/MapMaker.java index f1bfbc4c..5c4d7a53 100644 --- a/src/main/javassist/bytecode/stackmap/MapMaker.java +++ b/src/main/javassist/bytecode/stackmap/MapMaker.java @@ -183,10 +183,10 @@ public class MapMaker extends Tracer { int pos = tb.position; int end = pos + tb.length; - while (pos < end) + while (pos < end) { pos += doOpcode(pos, code); - - traceException(code, tb.toCatch); + traceException(code, tb.toCatch); + } if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 85ee4b0f..df4533bb 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -919,4 +919,23 @@ public class JvstTest4 extends JvstTestRoot { } catch (Exception e) {} } + + public void testJIRA212() throws Exception { + CtClass cc = sloader.get("test4.JIRA212"); + for (final CtBehavior behavior : cc.getDeclaredBehaviors()) { + behavior.instrument(new ExprEditor() { + public void edit(FieldAccess fieldAccess) throws CannotCompileException { + String fieldName = fieldAccess.getFieldName().substring(0,1).toUpperCase() + fieldAccess.getFieldName().substring(1); + if (fieldAccess.isReader()) { + // Rewrite read access + fieldAccess.replace("$_ = $0.get" + fieldName + "();"); + } else if (fieldAccess.isWriter()) { + // Rewrite write access + fieldAccess.replace("$0.set" + fieldName + "($1);"); + } + }}); + } + cc.writeFile(); + Object obj = make(cc.getName()); + } } |