Skip to content

Commit

Permalink
[GR-58967] Fix invoking interface methods and overridden default meth…
Browse files Browse the repository at this point in the history
…ods through jdwp.

PullRequest: graal/19001
  • Loading branch information
javeleon committed Oct 14, 2024
2 parents aed5e74 + 0f6fa31 commit d3dc5fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ public interface MethodRef {
*/
Object invokeMethodSpecial(Object... args);

/**
* Invokes an interface method with input arguments. The first argument must be the self object.
*
* @param args guest-language arguments used when calling the method
* @return the guest-language return value
*/
Object invokeInterfaceMethod(Object... args);

/**
* Determines if the declaring class has a source file attribute.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,8 @@ static CommandResult createReply(Packet packet, DebuggerController controller, D
ThreadJob<Object> job = new ThreadJob<>(thread, () -> {
if (Modifier.isPrivate(method.getModifiers())) {
return method.invokeMethodSpecial(args);
} else if (method.getDeclaringKlassRef().isInterface()) {
return method.invokeInterfaceMethod(args);
} else {
return method.invokeMethodVirtual(args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,12 @@ public Object invokeMethodSpecial(Object... args) {
return invokeDirectSpecial(args);
}

@Override
public Object invokeInterfaceMethod(Object... args) {
checkRemovedByRedefinition();
return invokeDirectInterface(args);
}

private void checkRemovedByRedefinition() {
if (getMethod().isRemovedByRedefinition()) {
Meta meta = getMeta();
Expand Down

0 comments on commit d3dc5fd

Please sign in to comment.