[guava-libraries] 01/01: Restored the hash methods (removed in Guava 16)

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Fri Jul 24 13:35:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository guava-libraries.

commit 98233908fa3e03377ebf3985b6ae4b2e910f60a6
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Fri Jul 24 15:31:06 2015 +0200

    Restored the hash methods (removed in Guava 16)
---
 debian/changelog                                   |  11 ++
 .../patches/11-preserve-charset-less-methods.patch | 152 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 164 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index e93fea2..132e93c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+guava-libraries (18.0-4) unstable; urgency=medium
+
+  * Improved the backward compatibility:
+    - Restored the PrimitiveSink.putString(CharSequence) interface method
+      and its implementations (removed in Guava 16)
+    - Restored the Funnels.stringFunnel() method (removed in Guava 16)
+    - Restored the HashFunction.hashString(CharSequence) interface method
+      and its implementations (removed in Guava 16)
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Fri, 24 Jul 2015 13:58:32 +0200
+
 guava-libraries (18.0-3) unstable; urgency=medium
 
   * Improved the backward compatibility:
diff --git a/debian/patches/11-preserve-charset-less-methods.patch b/debian/patches/11-preserve-charset-less-methods.patch
new file mode 100644
index 0000000..c020f5b
--- /dev/null
+++ b/debian/patches/11-preserve-charset-less-methods.patch
@@ -0,0 +1,152 @@
+Description: Preserve the methods removed from the hash package in Guava 16
+ * PrimitiveSink.putString(CharSequence)
+ * Funnels.stringFunnel()
+ * HashFunction.hashString(CharSequence)
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: not-needed
+--- a/guava/src/com/google/common/hash/Hasher.java
++++ b/guava/src/com/google/common/hash/Hasher.java
+@@ -83,6 +83,16 @@
+   @Override 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))}.
+    */
+   @Override Hasher putString(CharSequence charSequence, Charset charset);
+--- a/guava/src/com/google/common/hash/PrimitiveSink.java
++++ b/guava/src/com/google/common/hash/PrimitiveSink.java
+@@ -91,6 +91,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.
+    *
+    * @since 15.0 (since 11.0 as putString(CharSequence))
+--- a/guava/src/com/google/common/hash/AbstractHasher.java
++++ b/guava/src/com/google/common/hash/AbstractHasher.java
+@@ -36,6 +36,14 @@
+     return putInt(Float.floatToRawIntBits(f));
+   }
+ 
++  /**
++   * @deprecated Use {@link AbstractHasher#putUnencodedChars} instead.
++   */
++  @Deprecated
++  @Override public Hasher putString(CharSequence charSequence) {
++    return putUnencodedChars(charSequence);
++  }
++
+   @Override public Hasher putUnencodedChars(CharSequence charSequence) {
+     for (int i = 0, len = charSequence.length(); i < len; i++) {
+       putChar(charSequence.charAt(i));
+--- a/guava/src/com/google/common/hash/Funnels.java
++++ b/guava/src/com/google/common/hash/Funnels.java
+@@ -63,6 +63,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/AbstractNonStreamingHashFunction.java
++++ b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
+@@ -45,6 +45,14 @@
+     return newHasher().putObject(instance, funnel).hash();
+   }
+ 
++  /**
++   * @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();
+     Hasher hasher = newHasher(len * 2);
+--- a/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java
++++ b/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java
+@@ -37,6 +37,14 @@
+     return newHasher().putObject(instance, funnel).hash();
+   }
+ 
++  /**
++   * @deprecated Use {@link AbstractStreamingHashFunction#hashUnencodedChars} instead.
++   */
++  @Deprecated
++  @Override public HashCode hashString(CharSequence input) {
++    return hashUnencodedChars(input);
++  }
++
+   @Override public HashCode hashUnencodedChars(CharSequence input) {
+     return newHasher().putUnencodedChars(input).hash();
+   }
+--- a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java
++++ b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java
+@@ -122,6 +122,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) {
+           hasher.putUnencodedChars(chars);
diff --git a/debian/patches/series b/debian/patches/series
index 92cc7f8..8cae32f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@
 08-preserve-enums-methods.patch
 09-preserve-stopwatch-methods.patch
 10-preserve-ranges-class.patch
+11-preserve-charset-less-methods.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/guava-libraries.git



More information about the pkg-java-commits mailing list