diff options
author | chibash <chiba@javassist.org> | 2016-02-24 01:57:05 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2016-02-24 01:57:05 +0900 |
commit | b110efa847be1d1f7c9d4932def4b49ea8a6dcaf (patch) | |
tree | 39f2b37cedc3f1c603de225b0f3b437e32d73a46 | |
parent | d2d00601aa273adc4ceb47cc449fada0d35cb893 (diff) | |
download | javassist-b110efa847be1d1f7c9d4932def4b49ea8a6dcaf.tar.gz javassist-b110efa847be1d1f7c9d4932def4b49ea8a6dcaf.zip |
fixes JIRA JASSIST-250
-rw-r--r-- | src/main/javassist/compiler/MemberResolver.java | 6 | ||||
-rw-r--r-- | src/test/javassist/JvstTest5.java | 12 | ||||
-rw-r--r-- | src/test/test5/JIRA250Super.java | 17 | ||||
-rw-r--r-- | src/test/test5/JIRA250Super2.java | 5 |
4 files changed, 38 insertions, 2 deletions
diff --git a/src/main/javassist/compiler/MemberResolver.java b/src/main/javassist/compiler/MemberResolver.java index ddbe1be4..a1073a76 100644 --- a/src/main/javassist/compiler/MemberResolver.java +++ b/src/main/javassist/compiler/MemberResolver.java @@ -104,7 +104,8 @@ public class MemberResolver implements TokenId { int n = list.size(); for (int i = 0; i < n; ++i) { MethodInfo minfo = (MethodInfo)list.get(i); - if (minfo.getName().equals(methodName)) { + if (minfo.getName().equals(methodName) + && (minfo.getAccessFlags() & AccessFlag.BRIDGE) == 0) { int res = compareSignature(minfo.getDescriptor(), argTypes, argDims, argClassNames); if (res != NO) { @@ -121,7 +122,8 @@ public class MemberResolver implements TokenId { if (onlyExact) maybe = null; else - onlyExact = maybe != null; + if (maybe != null) + return maybe; int mod = clazz.getModifiers(); boolean isIntf = Modifier.isInterface(mod); diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java index 3c195faf..33740f7f 100644 --- a/src/test/javassist/JvstTest5.java +++ b/src/test/javassist/JvstTest5.java @@ -171,6 +171,18 @@ public class JvstTest5 extends JvstTestRoot { assertEquals(1, annotations.length); } + public void testJIRA250() throws Exception { + CtClass cc = sloader.makeClass("test5.JIRA250", sloader.get("test5.JIRA250Super")); + cc.addMethod(CtNewMethod.make( + " public test5.JIRA250Bar getBar() {" + + " return super.getBar();\n" + + " }\n", cc)); + cc.addMethod(CtNewMethod.make("public int run() { getBar(); return 1; }", cc)); + cc.writeFile(); + Object obj = make(cc.getName()); + assertEquals(1, invoke(obj, "run")); + } + public void testProceedToDefaultMethod() throws Exception { CtClass cc = ClassPool.getDefault().get("test5.ProceedDefault"); CtMethod mth = cc.getDeclaredMethod("bar"); diff --git a/src/test/test5/JIRA250Super.java b/src/test/test5/JIRA250Super.java new file mode 100644 index 00000000..9c328ee4 --- /dev/null +++ b/src/test/test5/JIRA250Super.java @@ -0,0 +1,17 @@ +package test5; + +interface JIRA250BarI { + int foo(); +} + +class JIRA250Bar implements JIRA250BarI { + public int foo() { return 1; } +} + +interface JIRA250SuperI { + JIRA250BarI getBar(); +} + +public class JIRA250Super extends JIRA250Super2 implements JIRA250SuperI { +} + diff --git a/src/test/test5/JIRA250Super2.java b/src/test/test5/JIRA250Super2.java new file mode 100644 index 00000000..919b0860 --- /dev/null +++ b/src/test/test5/JIRA250Super2.java @@ -0,0 +1,5 @@ +package test5; + +public class JIRA250Super2 { + public JIRA250Bar getBar() { return null; } +} |