The Java documentation is very careful to state that Class.getDeclaredFields() and similar methods make no guarantees about method ordering. There are a few exceptions: it's easy to get declaration order for enum
s and for record
components, and a few other semi-obscure things. But not for methods or fields. My questions is: WHY? It seems to me that it's cheap for Java to guarantee declaration order, and it's obviously sometimes useful, so it seems to be a pure win. Is there a catch I'm missing?
lundi 7 novembre 2022
why does Java not guarantee ordering in Class.getDeclaredFields() and similar methods
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire