ConstructorInvoker: AccessibleObject#setAccessible does not change the accessibility of the underlying object, so remove the code which resets the visibility to the previous visibility.
@@ -26,15 +26,8 @@ class ConstructorInvoker {
Object newInstance(String className, Class<?>[] parameterTypes, Object... parameterValues) throws Exception {
Class<?> targetType = Class.forName(className);
Constructor<?> constructor = targetType.getConstructor(parameterTypes);
- boolean accessible = constructor.isAccessible();
- try {
setAccessible(constructor, true);
return constructor.newInstance(parameterValues);
- } finally {
- try {
- setAccessible(constructor, accessible);
- } catch (RuntimeException e) {}
- }
}
private void setAccessible(AccessibleObject accessible, boolean value) {
