summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2015-09-25 15:08:57 +0900
committerchibash <chiba@javassist.org>2015-09-25 15:08:57 +0900
commite44bf416bf4f7d705deef9f9243197d4fff9f2d0 (patch)
tree6a97f1fbf68ecae275e827abf0545f006eb4130d
parent5bbbcdf552934c72b71f15bf97a35d853d309236 (diff)
downloadjavassist-e44bf416bf4f7d705deef9f9243197d4fff9f2d0.tar.gz
javassist-e44bf416bf4f7d705deef9f9243197d4fff9f2d0.zip
fixes JIRA JASSIST-248.
Javassist cannot compile super.m() if m is a default method declared in an interface.
-rw-r--r--Readme.html2
-rw-r--r--javassist.jarbin724840 -> 725035 bytes
-rw-r--r--src/main/javassist/compiler/MemberCodeGen.java2
-rw-r--r--src/test/javassist/JvstTest5.java4
-rw-r--r--src/test/test5/JIRA248.java7
5 files changed, 10 insertions, 5 deletions
diff --git a/Readme.html b/Readme.html
index c646c9a6..c3046502 100644
--- a/Readme.html
+++ b/Readme.html
@@ -283,7 +283,7 @@ see javassist.Dump.
<p>-version 3.21
<ul>
-<li>JIRA JASSIST-244
+<li>JIRA JASSIST-244, 248
</ul>
</p>
diff --git a/javassist.jar b/javassist.jar
index 7cae24bb..971c83ed 100644
--- a/javassist.jar
+++ b/javassist.jar
Binary files differ
diff --git a/src/main/javassist/compiler/MemberCodeGen.java b/src/main/javassist/compiler/MemberCodeGen.java
index 67031992..b1f932ca 100644
--- a/src/main/javassist/compiler/MemberCodeGen.java
+++ b/src/main/javassist/compiler/MemberCodeGen.java
@@ -642,7 +642,7 @@ public class MemberCodeGen extends CodeGen {
bytecode.addInvokestatic(declClass, mname, desc);
}
else if (isSpecial) // if (isSpecial && notStatic(acc))
- bytecode.addInvokespecial(declClass, mname, desc);
+ bytecode.addInvokespecial(targetClass, mname, desc);
else {
if (!Modifier.isPublic(declClass.getModifiers())
|| declClass.isInterface() != targetClass.isInterface())
diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java
index 249f4fad..1767436e 100644
--- a/src/test/javassist/JvstTest5.java
+++ b/src/test/javassist/JvstTest5.java
@@ -128,11 +128,11 @@ public class JvstTest5 extends JvstTestRoot {
public void testJIRA248() throws Exception {
CtClass cc = sloader.get("test5.JIRA248");
- String methodBody = "public int run() { return foo() + super.foo(); }";
+ String methodBody = "public int run() { return foo() + super.foo() + super.bar(); }";
CtMethod ctMethod = CtMethod.make(methodBody, cc);
cc.addMethod(ctMethod);
cc.writeFile();
Object obj = make(cc.getName());
- assertEquals(71, invoke(obj, "run"));
+ assertEquals(271, invoke(obj, "run"));
}
}
diff --git a/src/test/test5/JIRA248.java b/src/test/test5/JIRA248.java
index 0a0abcbe..5ea8472f 100644
--- a/src/test/test5/JIRA248.java
+++ b/src/test/test5/JIRA248.java
@@ -4,9 +4,14 @@ interface JIRA248Intf {
default int foo() { return 1; }
}
-class JIRA248Sup implements JIRA248Intf {
+class JIRA248Sup2 {
+ public int bar() { return 200; }
+}
+
+class JIRA248Sup extends JIRA248Sup2 implements JIRA248Intf {
}
public class JIRA248 extends JIRA248Sup {
public int foo() { return 70; }
+ public int bar() { return 3000; }
}