Support calling private constructors

This commit is contained in:
Jesse Wilson 2011-09-09 03:42:03 +00:00
parent 4f6a36d68f
commit 0aab1d0659

View File

@ -34,6 +34,9 @@ final class Reflection {
// TODO: this should use Joel's unsafe constructor stuff
public static <T> T newInstance(Constructor<T> constructor) {
if (!constructor.isAccessible()) {
constructor.setAccessible(true);
}
try {
Object[] args = null;
return constructor.newInstance(args);