Support calling private constructors
This commit is contained in:
parent
4f6a36d68f
commit
0aab1d0659
@ -34,6 +34,9 @@ final class Reflection {
|
|||||||
|
|
||||||
// TODO: this should use Joel's unsafe constructor stuff
|
// TODO: this should use Joel's unsafe constructor stuff
|
||||||
public static <T> T newInstance(Constructor<T> constructor) {
|
public static <T> T newInstance(Constructor<T> constructor) {
|
||||||
|
if (!constructor.isAccessible()) {
|
||||||
|
constructor.setAccessible(true);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Object[] args = null;
|
Object[] args = null;
|
||||||
return constructor.newInstance(args);
|
return constructor.newInstance(args);
|
||||||
|
Loading…
Reference in New Issue
Block a user