You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2013/05/17 10:04:23 UTC
svn commit: r1483682 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/core/ lucene/core/src/java/org/apache/lucene/util/
Author: dweiss
Date: Fri May 17 08:04:22 2013
New Revision: 1483682
URL: http://svn.apache.org/r1483682
Log:
Added javadocs to *Ref about clone() performing a shallow copy. I know, this is obvious and to be expected, but I fell a victim to this anyway, it's a damn thing to debug if you use clone() in hash maps etc. so perhaps it'll help somebody.
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/BytesRef.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/CharsRef.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/IntsRef.java
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/LongsRef.java
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/BytesRef.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/BytesRef.java?rev=1483682&r1=1483681&r2=1483682&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/BytesRef.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/BytesRef.java Fri May 17 08:04:22 2013
@@ -119,11 +119,17 @@ public final class BytesRef implements C
}
}
+ /**
+ * Returns a shallow clone of this instance (the underlying bytes are
+ * <b>not</b> copied and will be shared by both the returned object and this
+ * object.
+ *
+ * @see #deepCopyOf
+ */
@Override
public BytesRef clone() {
return new BytesRef(bytes, offset, length);
}
-
/** Calculates the hash code as required by TermsHash during indexing.
* <p>It is defined as:
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/CharsRef.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/CharsRef.java?rev=1483682&r1=1483681&r2=1483682&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/CharsRef.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/CharsRef.java Fri May 17 08:04:22 2013
@@ -71,6 +71,13 @@ public final class CharsRef implements C
this.length = chars.length;
}
+ /**
+ * Returns a shallow clone of this instance (the underlying characters are
+ * <b>not</b> copied and will be shared by both the returned object and this
+ * object.
+ *
+ * @see #deepCopyOf
+ */
@Override
public CharsRef clone() {
return new CharsRef(chars, offset, length);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/IntsRef.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/IntsRef.java?rev=1483682&r1=1483681&r2=1483682&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/IntsRef.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/IntsRef.java Fri May 17 08:04:22 2013
@@ -56,6 +56,13 @@ public final class IntsRef implements Co
assert isValid();
}
+ /**
+ * Returns a shallow clone of this instance (the underlying ints are
+ * <b>not</b> copied and will be shared by both the returned object and this
+ * object.
+ *
+ * @see #deepCopyOf
+ */
@Override
public IntsRef clone() {
return new IntsRef(ints, offset, length);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/LongsRef.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/LongsRef.java?rev=1483682&r1=1483681&r2=1483682&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/LongsRef.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/util/LongsRef.java Fri May 17 08:04:22 2013
@@ -55,6 +55,13 @@ public final class LongsRef implements C
assert isValid();
}
+ /**
+ * Returns a shallow clone of this instance (the underlying longs are
+ * <b>not</b> copied and will be shared by both the returned object and this
+ * object.
+ *
+ * @see #deepCopyOf
+ */
@Override
public LongsRef clone() {
return new LongsRef(longs, offset, length);