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/main/javassist/bytecode/ConstPool.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/main/javassist/bytecode/ConstPool.java')
-rw-r--r-- | src/main/javassist/bytecode/ConstPool.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java index f1024216..f05dfd4f 100644 --- a/src/main/javassist/bytecode/ConstPool.java +++ b/src/main/javassist/bytecode/ConstPool.java @@ -389,7 +389,7 @@ public final class ConstPool { * at the given index. */ public int getMethodrefClass(int index) { - MethodrefInfo minfo = (MethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); return minfo.classIndex; } @@ -401,7 +401,7 @@ public final class ConstPool { * @return the name of the class at that <code>class_index</code>. */ public String getMethodrefClassName(int index) { - MethodrefInfo minfo = (MethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); if (minfo == null) return null; else @@ -414,7 +414,7 @@ public final class ConstPool { * at the given index. */ public int getMethodrefNameAndType(int index) { - MethodrefInfo minfo = (MethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); return minfo.nameAndTypeIndex; } @@ -427,7 +427,7 @@ public final class ConstPool { * @return the name of the method. */ public String getMethodrefName(int index) { - MethodrefInfo minfo = (MethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); if (minfo == null) return null; else { @@ -449,7 +449,7 @@ public final class ConstPool { * @return the descriptor of the method. */ public String getMethodrefType(int index) { - MethodrefInfo minfo = (MethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); if (minfo == null) return null; else { @@ -468,8 +468,7 @@ public final class ConstPool { * at the given index. */ public int getInterfaceMethodrefClass(int index) { - InterfaceMethodrefInfo minfo - = (InterfaceMethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); return minfo.classIndex; } @@ -481,8 +480,7 @@ public final class ConstPool { * @return the name of the class at that <code>class_index</code>. */ public String getInterfaceMethodrefClassName(int index) { - InterfaceMethodrefInfo minfo - = (InterfaceMethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); return getClassInfo(minfo.classIndex); } @@ -492,8 +490,7 @@ public final class ConstPool { * at the given index. */ public int getInterfaceMethodrefNameAndType(int index) { - InterfaceMethodrefInfo minfo - = (InterfaceMethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); return minfo.nameAndTypeIndex; } @@ -507,8 +504,7 @@ public final class ConstPool { * @return the name of the method. */ public String getInterfaceMethodrefName(int index) { - InterfaceMethodrefInfo minfo - = (InterfaceMethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); if (minfo == null) return null; else { @@ -531,8 +527,7 @@ public final class ConstPool { * @return the descriptor of the method. */ public String getInterfaceMethodrefType(int index) { - InterfaceMethodrefInfo minfo - = (InterfaceMethodrefInfo)getItem(index); + MemberrefInfo minfo = (MemberrefInfo)getItem(index); if (minfo == null) return null; else { |