The javadoc for Void
says:
The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.
but the constructor is simply:
private Void() {}
and this code instantiates a Void
:
Constructor<Void> c = Void.class.getDeclaredConstructor();
c.setAccessible(true);
Void v = c.newInstance(); // Hello sailor
So Void
is not uninstantiable.
Would there have been a way to make Void
truly uninstantiable?
void
... Maybe of help only for proxies? – fge