( Class<T> classToInstantiate, Class<? super T> constructorClass, Class<?>[] consArgTypes, Object[] consArgs )
| 64 | return createWithConstructor(classToInstantiate, Object.class, new Class[0], new Object[0]); |
| 65 | } |
| 66 | public static <T> T createWithConstructor ( Class<T> classToInstantiate, Class<? super T> constructorClass, Class<?>[] consArgTypes, Object[] consArgs ) |
| 67 | throws Exception { |
| 68 | Constructor<? super T> objCons = constructorClass.getDeclaredConstructor(consArgTypes); |
| 69 | setAccessible(objCons); |
| 70 | Constructor<?> sc = ReflectionFactory.getReflectionFactory().newConstructorForSerialization(classToInstantiate, objCons); |
| 71 | setAccessible(sc); |
| 72 | return (T)sc.newInstance(consArgs); |
| 73 | } |
| 74 | public static void setAccessible(AccessibleObject member) { |
| 75 | String versionStr = System.getProperty("java.version"); |
| 76 | int javaVersion = Integer.parseInt(versionStr.split("\\.")[0]); |
no test coverage detected