1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
Description: Preserve the methods removed from the hash package in Guava 16
* PrimitiveSink.putString(CharSequence)
* Funnels.stringFunnel()
* HashFunction.hashString(CharSequence)
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java
+++ b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java
@@ -162,6 +162,14 @@
return this;
}
+ /**
+ * @deprecated Use {@link Hasher#putUnencodedChars} instead.
+ */
+ @Deprecated
+ @Override public Hasher putString(CharSequence chars) {
+ return putUnencodedChars(chars);
+ }
+
@Override
public Hasher putUnencodedChars(CharSequence chars) {
for (Hasher hasher : hashers) {
--- a/guava/src/com/google/common/hash/AbstractHasher.java
+++ b/guava/src/com/google/common/hash/AbstractHasher.java
@@ -46,6 +46,14 @@
return putInt(Float.floatToRawIntBits(f));
}
+ /**
+ * @deprecated Use {@link AbstractHasher#putUnencodedChars} instead.
+ */
+ @Deprecated
+ @Override public Hasher putString(CharSequence charSequence) {
+ return putUnencodedChars(charSequence);
+ }
+
@Override
@CanIgnoreReturnValue
public Hasher putUnencodedChars(CharSequence charSequence) {
--- a/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
+++ b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
@@ -53,6 +53,14 @@
return hashBytes(ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(input).array());
}
+ /**
+ * @deprecated Use {@link AbstractNonStreamingHashFunction#hashUnencodedChars} instead.
+ */
+ @Deprecated
+ @Override public HashCode hashString(CharSequence input) {
+ return hashUnencodedChars(input);
+ }
+
@Override
public HashCode hashUnencodedChars(CharSequence input) {
int len = input.length();
--- a/guava/src/com/google/common/hash/Funnels.java
+++ b/guava/src/com/google/common/hash/Funnels.java
@@ -65,6 +65,17 @@
return UnencodedCharsFunnel.INSTANCE;
}
+ /**
+ * Returns a funnel that extracts the characters from a {@code CharSequence}.
+ *
+ * @deprecated Use {@link Funnels#unencodedCharsFunnel} instead. This method is scheduled for
+ * removal in Guava 16.0.
+ */
+ @Deprecated
+ public static Funnel<CharSequence> stringFunnel() {
+ return unencodedCharsFunnel();
+ }
+
private enum UnencodedCharsFunnel implements Funnel<CharSequence> {
INSTANCE;
--- a/guava/src/com/google/common/hash/HashFunction.java
+++ b/guava/src/com/google/common/hash/HashFunction.java
@@ -194,6 +194,18 @@
HashCode hashUnencodedChars(CharSequence input);
/**
+ * Shortcut for {@code newHasher().putUnencodedChars(input).hash()}. The implementation
+ * <i>might</i> perform better than its longhand equivalent, but should not perform worse.
+ * Note that no character encoding is performed; the low byte and high byte of each {@code char}
+ * are hashed directly (in that order).
+ *
+ * @deprecated Use {@link HashFunction#hashUnencodedChars} instead. This method is scheduled for
+ * removal in Guava 16.0.
+ */
+ @Deprecated
+ HashCode hashString(CharSequence input);
+
+ /**
* Shortcut for {@code newHasher().putString(input, charset).hash()}. Characters are encoded using
* the given {@link Charset}. The implementation <i>might</i> perform better than its longhand
* equivalent, but should not perform worse.
--- a/guava/src/com/google/common/hash/Hasher.java
+++ b/guava/src/com/google/common/hash/Hasher.java
@@ -121,6 +121,16 @@
Hasher putUnencodedChars(CharSequence charSequence);
/**
+ * Equivalent to processing each {@code char} value in the {@code CharSequence}, in order.
+ * The input must not be updated while this method is in progress.
+ *
+ * @deprecated Use {@link Hasher#putUnencodedChars} instead. This method is scheduled for
+ * removal in Guava 16.0.
+ */
+ @Deprecated
+ @Override Hasher putString(CharSequence charSequence);
+
+ /**
* Equivalent to {@code putBytes(charSequence.toString().getBytes(charset))}.
*
* <p><b>Warning:</b> This method, which reencodes the input before hashing it, is useful only for
--- a/guava/src/com/google/common/hash/PrimitiveSink.java
+++ b/guava/src/com/google/common/hash/PrimitiveSink.java
@@ -101,6 +101,15 @@
PrimitiveSink putChar(char c);
/**
+ * Puts a string into this sink.
+ *
+ * @deprecated Use {PrimitiveSink#putUnencodedChars} instead. This method is scheduled for
+ * removal in Guava 16.0.
+ */
+ @Deprecated
+ PrimitiveSink putString(CharSequence charSequence);
+
+ /**
* Puts each 16-bit code unit from the {@link CharSequence} into this sink.
*
* <p><b>Warning:</b> This method will produce different output than most other languages do when
--- a/guava/src/com/google/common/hash/AbstractHashFunction.java
+++ b/guava/src/com/google/common/hash/AbstractHashFunction.java
@@ -47,6 +47,11 @@
return newHasher().putString(input, charset).hash();
}
+ @Deprecated
+ @Override public HashCode hashString(CharSequence input) {
+ return hashUnencodedChars(input);
+ }
+
@Override
public HashCode hashInt(int input) {
return newHasher(4).putInt(input).hash();
|