> BytesRef is not different, because it is just a "reference" to pass around. > And cloning a reference for sure should not clone the target of the > reference. You are "cloning" the reference and only that (as the name of the > class says: Bytes*Ref*)!
Exactly. It is a reference and as such, clone() applies to it in a perfectly valid way (it actually clones the reference, which can be, for example, length-adjusted without destroying the original reference). I think this should be clearer in the documentation of BytesRef to make sure people don't get the idea that BytesRef acts as some sort of byte list/ buffer. Dawid --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org