aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/javassist/JvstTest5.java15
-rw-r--r--src/test/test5/ProceedDefault.java13
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java
index eff7b451..3c195faf 100644
--- a/src/test/javassist/JvstTest5.java
+++ b/src/test/javassist/JvstTest5.java
@@ -7,6 +7,8 @@ import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
import javassist.bytecode.ConstPool;
import javassist.bytecode.InnerClassesAttribute;
+import javassist.expr.ExprEditor;
+import javassist.expr.MethodCall;
public class JvstTest5 extends JvstTestRoot {
public JvstTest5(String name) {
@@ -168,4 +170,17 @@ public class JvstTest5 extends JvstTestRoot {
java.lang.annotation.Annotation[] annotations = o.getClass().getDeclaredAnnotations();
assertEquals(1, annotations.length);
}
+
+ public void testProceedToDefaultMethod() throws Exception {
+ CtClass cc = ClassPool.getDefault().get("test5.ProceedDefault");
+ CtMethod mth = cc.getDeclaredMethod("bar");
+ mth.instrument(new ExprEditor() {
+ public void edit(MethodCall c) throws CannotCompileException {
+ c.replace("$_ = $proceed($$) + 10000;");
+ }
+ });
+ cc.writeFile();
+ Object obj = make(cc.getName());
+ assertEquals(21713, invoke(obj, "run"));
+ }
}
diff --git a/src/test/test5/ProceedDefault.java b/src/test/test5/ProceedDefault.java
new file mode 100644
index 00000000..18e2ee18
--- /dev/null
+++ b/src/test/test5/ProceedDefault.java
@@ -0,0 +1,13 @@
+package test5;
+
+interface ProceedDefaultI {
+ default int foo() { return 13; }
+}
+
+public class ProceedDefault implements ProceedDefaultI {
+ public int run() { return bar(); }
+ public int foo() { return 1700; }
+ public int bar() {
+ return foo() + ProceedDefaultI.super.foo();
+ }
+}