(Class clazz, Object... argsAndTypes)
| 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) { |
no test coverage detected