Skip to content

Commit

Permalink
bugfix: invocation of a static/class method wasn't possible
Browse files Browse the repository at this point in the history
  • Loading branch information
jpstotz committed May 26, 2024
1 parent fc287a9 commit 0b26602
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ public static Method getDeclaredMethod(Object object, String methodName, Class[]
return null;
}

for (Class clazz = object.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {
Class clazz;
if ((object instanceof Class)) {
clazz = (Class) object;
} else {
clazz = object.getClass();
}
do {
try {
return clazz.getDeclaredMethod(methodName, parameterTypes);
} catch (Exception e) {
}
}
clazz = clazz.getSuperclass();
} while (clazz != Object.class);

return null;
}
Expand Down

0 comments on commit 0b26602

Please sign in to comment.