• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reflection - getFields ordered?  RSS feed

 
Peter White
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked the Sun docs but can't find if the fields are guaranteed to be returned in the same order always. I would hope that they are in diffinition order, but don't want to depend on that fact in production

Peter
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, they're in an unspecified order, which can (and has in the past) change between Java versions.
 
Peter White
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the order at least consistent during the lifetime of a running JVM? Or is that also unspecified?

Cheers

Peter
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter White:
Is the order at least consistent during the lifetime of a running JVM? Or is that also unspecified?


I don't think there are any guarantees at all. My experience, however, is that it is consistent over all runs within a particular JVM implementation.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!