lundi 11 avril 2016

getDeclaredConstructor on an interface?

The javadoc for Class::getDeclaredConstructor (http://ift.tt/1TO818p) says:

Returns a Constructor object that reflects the specified constructor of the class or interface represented by this Class object. [emphasis mine]

Since you can't declare a constructor for an interface, what could it mean to return a "specified constructor" of an interface?

I tried it on Runnable.class and got NoSuchMethodException. Is there a case where getDeclaredConstructor will work on an interface? Or is this language in the javadoc just an error? Or does it mean something other than how I'm interpreting it?





Aucun commentaire:

Enregistrer un commentaire