Skip to content

Commit

Permalink
Fix ASM generating an invalid reference for static methods in interfa…
Browse files Browse the repository at this point in the history
…ce classes

Static calls to interface methods should use InterfaceMethodRefs instead of MethodRefs. Otherwise, newer JVM versions will throw an IncompatibleClassChangeError.

See openjdk/jdk@c36295e#diff-2e49825df1451e2d44694826a70e86bf1a511371482e4de50f7ef09c300bd9bbR780 and
https://bugs.openjdk.org/browse/JDK-8145148?focusedCommentId=13958798&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13958798 for more details.
  • Loading branch information
MarcMil committed Nov 21, 2024
1 parent a81d271 commit b2c817c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/soot/baf/BafASMBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ public void caseClassConstant(ClassConstant v) {
public void caseStaticInvokeInst(StaticInvokeInst i) {
SootMethodRef m = i.getMethodRef();
mv.visitMethodInsn(Opcodes.INVOKESTATIC, slashify(m.declaringClass().getName()), m.name(), toTypeDesc(m),
m.declaringClass().isInterface() && !m.isStatic());
m.declaringClass().isInterface());
}

@Override
Expand Down

0 comments on commit b2c817c

Please sign in to comment.