[java] Less raw types

GitOrigin-RevId: 0bb21ea1ab22c45d79e74e8c839c6b8495a9036a
This commit is contained in:
Tagir Valeev
2024-09-17 10:55:16 +02:00
committed by intellij-monorepo-bot
parent aee119040c
commit 33a3a3d3d9
12 changed files with 57 additions and 74 deletions

View File

@@ -10,7 +10,7 @@ public final class MethodInvoker {
// TODO: may leak objects here
static ThreadLocal<Object> returnValue = new ThreadLocal<>();
public static Object invoke(Class cls, Object obj, String name, Class[] parameterTypes, Object[] args)
public static Object invoke(Class<?> cls, Object obj, String name, Class<?>[] parameterTypes, Object[] args)
throws Throwable {
ArrayList<Method> methods = new ArrayList<>();
// TODO: better collect methods lazily
@@ -40,17 +40,17 @@ public final class MethodInvoker {
}
//TODO: avoid recursion
private static void addMatchingMethods(List<Method> methods, Class cls, String name, Class[] parameterTypes) {
private static void addMatchingMethods(List<Method> methods, Class<?> cls, String name, Class<?>[] parameterTypes) {
try {
methods.add(cls.getDeclaredMethod(name, parameterTypes));
}
catch (NoSuchMethodException ignored) {
}
Class superclass = cls.getSuperclass();
Class<?> superclass = cls.getSuperclass();
if (superclass != null) {
addMatchingMethods(methods, superclass, name, parameterTypes);
}
for (Class anInterface : cls.getInterfaces()) {
for (Class<?> anInterface : cls.getInterfaces()) {
addMatchingMethods(methods, anInterface, name, parameterTypes);
}
}