Skip to content

Commit 66b108f

Browse files
author
LeoDefossez
committed
Find the method with only the parameter name instead of the parameter type
this reduce the possibilities of exceptions
1 parent b4ecec7 commit 66b108f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/main/java/app/breakpoint/BreakPointInstaller.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ public static BreakpointWrapper addBreakpoint(VirtualMachine vm, JsonNode method
5353
* @param vm the Virtual Machine
5454
* @param methodInfos information on the method at which the breakpoint is installed
5555
* @return the method if one match
56-
* @throws ClassNotLoadedException if no method matches the characteristics
5756
*/
58-
private static Method findMethod(VirtualMachine vm, JsonNode methodInfos) throws ClassNotLoadedException {
57+
private static Method findMethod(VirtualMachine vm, JsonNode methodInfos) {
5958
// finding the class
6059
// TODO can only find classes in the JDK ?
6160
List<ReferenceType> classes = vm.classesByName(methodInfos.get("className").textValue());
@@ -74,15 +73,15 @@ private static Method findMethod(VirtualMachine vm, JsonNode methodInfos) throws
7473

7574
// if we have multiple methods and given arguments types, we search if one correspond
7675
for (Method m : allMethods) {
77-
List<Type> paramTypes = m.argumentTypes();
76+
List<String> paramTypeNames = m.argumentTypeNames();
7877
// if not the same number of types just pass this method
79-
if (paramTypes.size() != methodInfos.get("methodArguments").size()) {
78+
if (paramTypeNames.size() != methodInfos.get("methodArguments").size()) {
8079
continue;
8180
}
8281
// starting on the hypothesis that we found the method, and trying to invalidate it
8382
boolean matches = true;
84-
for (int i = 0; i < paramTypes.size(); i++) {
85-
if (!paramTypes.get(i).name().equals(methodInfos.get("methodArguments").get(i).textValue())) {
83+
for (int i = 0; i < paramTypeNames.size(); i++) {
84+
if (!paramTypeNames.get(i).equals(methodInfos.get("methodArguments").get(i).textValue())) {
8685
matches = false;
8786
break;
8887
}

0 commit comments

Comments
 (0)