MCPcopy Create free account
hub / github.com/cinit/TMoe / newInstance

Method newInstance

app/src/main/java/cc/ioctl/tmoe/util/Reflex.java:988–1008  ·  view source on GitHub ↗
(Class clazz, Object... argsAndTypes)

Source from the content-addressed store, hash-verified

986 }
987
988 public static Object newInstance(Class clazz, Object... argsAndTypes)
989 throws ReflectiveOperationException {
990 int argc = argsAndTypes.length / 2;
991 Class[] argt = new Class[argc];
992 Object[] argv = new Object[argc];
993 int i;
994 Constructor m;
995 for (i = 0; i < argc; i++) {
996 argt[i] = (Class) argsAndTypes[argc + i];
997 argv[i] = argsAndTypes[i];
998 }
999 m = clazz.getDeclaredConstructor(argt);
1000 m.setAccessible(true);
1001 try {
1002 return m.newInstance(argv);
1003 } catch (IllegalAccessException e) {
1004 loge(e);
1005 //should NOT happen
1006 throw new RuntimeException(e);
1007 }
1008 }
1009
1010 public static Field findField(Class<?> clazz, Class<?> type, String name) throws NoSuchFieldException {
1011 if (clazz == null) {

Callers 12

newActivityMethod · 0.80
initOnceMethod · 0.80
createMinimalUserMethod · 0.80
initOnceMethod · 0.80
plusOneMethod · 0.80
forUserMethod · 0.80
forChatMethod · 0.80
forChannelMethod · 0.80

Calls 1

logeMethod · 0.45

Tested by

no test coverage detected