lundi 18 avril 2016

More than one method with the same parameter types in a class

I know, there is already at least one question on this topic. But I want to ask it again because this is what I discovered in the javadoc of Class#getDeclaredMethod(...):

If more than one method with the same parameter types is declared in a class, and one of these methods has a return type that is more specific than any of the others, that method is returned; otherwise one of the methods is chosen arbitrarily.

So the developers of the reflection in java consider that case as a probable one, is it maybe possible after all to do such declaration? Or is it maybe just deprecated?





Aucun commentaire:

Enregistrer un commentaire