Skip to content

Commit c266c52

Browse files
committed
Fix SpEL generated code for default method invocation
Closes gh-25706
1 parent 5f51728 commit c266c52

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/ast/MethodReference.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -351,8 +351,9 @@ public void generateCode(MethodVisitor mv, CodeFlow cf) {
351351
}
352352

353353
generateCodeForArguments(mv, cf, method, this.children);
354-
mv.visitMethodInsn((isStaticMethod ? INVOKESTATIC : INVOKEVIRTUAL), classDesc, method.getName(),
355-
CodeFlow.createSignatureDescriptor(method), method.getDeclaringClass().isInterface());
354+
mv.visitMethodInsn((isStaticMethod ? INVOKESTATIC : (method.isDefault() ? INVOKEINTERFACE : INVOKEVIRTUAL)),
355+
classDesc, method.getName(), CodeFlow.createSignatureDescriptor(method),
356+
method.getDeclaringClass().isInterface());
356357
cf.pushDescriptor(this.exitTypeDescriptor);
357358

358359
if (this.originalPrimitiveExitTypeDescriptor != null) {

0 commit comments

Comments
 (0)