/**
* The version number of this release.
*/
- public static final String version = "3.17.1-GA";
+ public static final String version = "3.18.0-GA";
/**
* Prints the version number and the copyright notice.
*/
public static void main(String[] args) {
System.out.println("Javassist version " + CtClass.version);
- System.out.println("Copyright (C) 1999-2012 Shigeru Chiba."
+ System.out.println("Copyright (C) 1999-2013 Shigeru Chiba."
+ " All Rights Reserved.");
}
public void addInvokevirtual(int clazz, String name, String desc) {
add(INVOKEVIRTUAL);
addIndex(constPool.addMethodrefInfo(clazz, name, desc));
- growStack(Descriptor.dataSize(desc)); // assume CosntPool#REF_invokeStatic
+ growStack(Descriptor.dataSize(desc) - 1);
}
/**
add(INVOKEDYNAMIC);
addIndex(dyn);
add(0, 0);
- growStack(Descriptor.dataSize(desc) - 1);
+ growStack(Descriptor.dataSize(desc)); // assume ConstPool#REF_invokeStatic
}
/**
assertEquals(10, invoke(obj, "test33"));
assertEquals(100, invoke(obj, "test44"));
}
+
+ public void testJIRA186() throws Exception {
+ CtClass cc = sloader.get("test4.JIRA186");
+ cc.getDeclaredMethod("test").insertBefore("{" +
+ " java.util.List l = new java.util.ArrayList();" +
+ " l.add(this.toString());" +
+ "}");
+ cc.writeFile();
+ Object obj = make(cc.getName());
+ assertEquals(1, invoke(obj, "test"));
+ }
}