diff options
author | Johan Kaving <johan.kaving@symsoft.com> | 2014-07-02 16:45:46 +0200 |
---|---|---|
committer | Johan Kaving <johan.kaving@symsoft.com> | 2014-07-03 15:49:59 +0200 |
commit | b510f4c43b12a283294718e906a7502958f71cd6 (patch) | |
tree | 058dc10f3cbf0abaf95445812851970cae6b3e7a /src/test/javassist/JvstTest4.java | |
parent | c499faf6a8579cdfd266a22c2d5ef491d3bea6cb (diff) | |
download | javassist-b510f4c43b12a283294718e906a7502958f71cd6.tar.gz javassist-b510f4c43b12a283294718e906a7502958f71cd6.zip |
Fix JASSIST-220
Static methods on interfaces in Java 8 means
that the INVOKESTATIC opcode can sometimes refer
to an item that is an InterfaceMethodrefInfo
(instead of a MethodrefInfo).
This is now handled in the
ConstPool.getMethodref...() methods by casting
to MemberrefInfo instead (since MemberrefInfo
contains all the needed information).
Diffstat (limited to 'src/test/javassist/JvstTest4.java')
-rw-r--r-- | src/test/javassist/JvstTest4.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index f8994cd7..6ea33308 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -980,4 +980,20 @@ public class JvstTest4 extends JvstTestRoot { assertEquals("i", cp.getUtf8Info(attr.name(0))); assertEquals("s", cp.getUtf8Info(attr.name(1))); } + + // JIRA JASSIST-220 + public void testStaticInterfaceMethods() throws Exception { + CtClass cc = sloader.get("test4.JIRA220"); + + cc.getMethod("foo", "()V").instrument(new ExprEditor() { + @Override + public void edit(MethodCall m) throws CannotCompileException { + try { + m.getClassName(); + } catch (Exception e) { + fail(e.getMessage()); + } + } + }); + } } |