aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javassist/JvstTest5.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/javassist/JvstTest5.java')
-rw-r--r--src/test/javassist/JvstTest5.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java
index e7fdb28c..6f6eb075 100644
--- a/src/test/javassist/JvstTest5.java
+++ b/src/test/javassist/JvstTest5.java
@@ -10,6 +10,7 @@ import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.InnerClassesAttribute;
import javassist.expr.ExprEditor;
+import javassist.expr.Handler;
import javassist.expr.MethodCall;
@SuppressWarnings({"rawtypes","unchecked","unused"})
@@ -399,4 +400,20 @@ public class JvstTest5 extends JvstTestRoot {
assertTrue(Modifier.isVarArgs(cc.getDeclaredMethod("foo").getModifiers()));
assertFalse(Modifier.isVarArgs(cc.getDeclaredMethod("bar").getModifiers()));
}
+
+ public void testIssue155() throws Exception {
+ CtClass cc = sloader.get("test5.Issue155");
+ CtMethod testMethod = cc.getDeclaredMethod("foo");
+ testMethod.instrument(
+ new ExprEditor() {
+ public void edit(Handler m)
+ throws CannotCompileException {
+ m.insertBefore("throw $1;");
+ }
+ });
+
+ cc.writeFile();
+ Object obj = make(cc.getName());
+ assertEquals(1, invoke(obj, "test"));
+ }
}