lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <>
Subject Re: BytesRef violates the principle of least astonishment
Date Wed, 20 May 2015 20:36:29 GMT
> 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

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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message