aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javassist/JvstTest4.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/javassist/JvstTest4.java')
-rw-r--r--src/test/javassist/JvstTest4.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java
index f7fcd968..f7319008 100644
--- a/src/test/javassist/JvstTest4.java
+++ b/src/test/javassist/JvstTest4.java
@@ -711,4 +711,17 @@ public class JvstTest4 extends JvstTestRoot {
assertTrue(javassist.runtime.Desc.getClazz("[Ljava.lang.String;") != null);
javassist.runtime.Desc.useContextClassLoader = old;
}
+
+ public void testJIRA166() throws Exception {
+ CtClass cc = sloader.get("test4.JIRA166");
+ cc.instrument(new ExprEditor() {
+ public void edit(FieldAccess fa) throws CannotCompileException {
+ if (fa.isReader() && fa.getFieldName().equals("length"))
+ fa.replace("length = self().length + \"!\"; $_ = ($r) this.length.substring(1);");
+ }
+ });
+ cc.writeFile();
+ Object obj = make(cc.getName());
+ assertEquals(1, invoke(obj, "run"));
+ }
}