aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/test5/JIRA241.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test5/JIRA241.java')
-rw-r--r--src/test/test5/JIRA241.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/test5/JIRA241.java b/src/test/test5/JIRA241.java
new file mode 100644
index 00000000..e6f8e957
--- /dev/null
+++ b/src/test/test5/JIRA241.java
@@ -0,0 +1,33 @@
+package test5;
+
+import java.util.Random;
+import javassist.*;
+
+public class JIRA241 {
+ public int run() {
+ test(this);
+ return 10;
+ }
+
+ public static void test(Object o) {
+ //part 1
+ if (o == null) {
+ return;
+ }
+
+ //part 2
+ int oper = new Random().nextInt();
+ switch (oper) {
+ case 1:
+ break;
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ ClassPool pool = ClassPool.getDefault();
+ CtClass cc = pool.get("test5.JIRA241");
+ CtMethod testMethod = cc.getMethod("test", "(Ljava/lang/Object;)V");
+ testMethod.insertAfter("System.out.println(\"inserted!\");");
+ cc.writeFile();
+ }
+}