package o5; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /* loaded from: classes2.dex */ class e { /* renamed from: a, reason: collision with root package name */ private final Class f12707a; /* renamed from: b, reason: collision with root package name */ private final String f12708b; /* renamed from: c, reason: collision with root package name */ private final Class[] f12709c; e(Class cls, String str, Class... clsArr) { this.f12707a = cls; this.f12708b = str; this.f12709c = clsArr; } private Method b(Class cls) { Class cls2; String str = this.f12708b; if (str == null) { return null; } Method c10 = c(cls, str, this.f12709c); if (c10 == null || (cls2 = this.f12707a) == null || cls2.isAssignableFrom(c10.getReturnType())) { return c10; } return null; } private static Method c(Class cls, String str, Class[] clsArr) { try { Method method = cls.getMethod(str, clsArr); try { if ((method.getModifiers() & 1) == 0) { return null; } } catch (NoSuchMethodException unused) { } return method; } catch (NoSuchMethodException unused2) { return null; } } public Object a(Object obj, Object... objArr) { Method b10 = b(obj.getClass()); if (b10 != null) { try { return b10.invoke(obj, objArr); } catch (IllegalAccessException e10) { throw new AssertionError("Unexpectedly could not call: " + b10, e10); } } throw new AssertionError("Method " + this.f12708b + " not supported for object " + obj); } public boolean d(Object obj) { return b(obj.getClass()) != null; } public Object e(Object obj, Object... objArr) { Method b10 = b(obj.getClass()); if (b10 == null) { return null; } try { return b10.invoke(obj, objArr); } catch (IllegalAccessException unused) { return null; } } public Object f(Object obj, Object... objArr) { try { return e(obj, objArr); } catch (InvocationTargetException e10) { Throwable targetException = e10.getTargetException(); if (targetException instanceof RuntimeException) { throw ((RuntimeException) targetException); } throw new AssertionError("Unexpected exception", targetException); } } public Object g(Object obj, Object... objArr) { try { return a(obj, objArr); } catch (InvocationTargetException e10) { Throwable targetException = e10.getTargetException(); if (targetException instanceof RuntimeException) { throw ((RuntimeException) targetException); } throw new AssertionError("Unexpected exception", targetException); } } }