Here's a starting patch so the factions can start duking it out:
I put the readVersion/writeVersion methods inside CodecUtil.java.
Yes, it's not great that this means Version's ctor is public, but in
CodecUtil it's at least more apparent that these methods are
committing to a particular format, and that format is really "scoped"
by the caller (meaning if ever we change what ints we write / how we
encode them, the caller's own format tracking must handle that
change). I put spooky javadocs and comments to convey this
I'm also defensively writing 4 (not 3) ints since it seems at least
possible we may once again release alpha/beta releases and it seems
safest to at least not preclude the possibility ... but some factions
want 3 ints instead.
Finally, I'm encoding using vInt, not unsigned byte. I know this is
ridiculously defensive, and surely Lucene will never get to major or
minor or bugfix version 256 (it would be a strange world), but the
fact is that we are using java's "int" for these instance vars in
Version.java... I can't remember whether there were factions
upset by this.
But as is I (my faction) think the patch is ready!