package com.google.common.reflect; import com.google.common.base.Preconditions; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; /* loaded from: classes2.dex */ public final class Reflection { public static String getPackageName(Class cls) { return getPackageName(cls.getName()); } public static String getPackageName(String str) { int lastIndexOf = str.lastIndexOf(46); return lastIndexOf < 0 ? "" : str.substring(0, lastIndexOf); } public static void initialize(Class... clsArr) { for (Class cls : clsArr) { try { Class.forName(cls.getName(), true, cls.getClassLoader()); } catch (ClassNotFoundException e) { throw new AssertionError(e); } } } public static T newProxy(Class cls, InvocationHandler invocationHandler) { Preconditions.checkNotNull(invocationHandler); Preconditions.checkArgument(cls.isInterface(), "%s is not an interface", cls); return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, invocationHandler)); } private Reflection() { } }