Blame SOURCES/guava-jdk8-HashMap-testfix.patch

ad9b3d
diff -ur guava-18.0.vanilla/guava/src/com/google/common/collect/Maps.java guava-18.0/guava/src/com/google/common/collect/Maps.java
ad9b3d
--- guava-18.0.vanilla/guava/src/com/google/common/collect/Maps.java	2014-08-25 18:39:22.000000000 +0000
ad9b3d
+++ guava-18.0/guava/src/com/google/common/collect/Maps.java	2015-06-03 21:02:12.498000000 +0000
ad9b3d
@@ -206,11 +206,15 @@
ad9b3d
       return expectedSize + 1;
ad9b3d
     }
ad9b3d
     if (expectedSize < Ints.MAX_POWER_OF_TWO) {
ad9b3d
-      return expectedSize + expectedSize / 3;
ad9b3d
+      // This is the calculation used in JDK8 to resize when a putAll
ad9b3d
+      // happens; it seems to be the most conservative calculation we
ad9b3d
+      // can make.  0.75 is the default load factor.
ad9b3d
+      return (int) ((float) expectedSize / 0.75F + 1.0F);
ad9b3d
     }
ad9b3d
     return Integer.MAX_VALUE; // any large value
ad9b3d
   }
ad9b3d
 
ad9b3d
+
ad9b3d
   /**
ad9b3d
    * Creates a mutable {@code HashMap} instance with the same mappings as
ad9b3d
    * the specified map.
ad9b3d
diff -ur guava-18.0.vanilla/guava-tests/test/com/google/common/collect/MapsTest.java guava-18.0/guava-tests/test/com/google/common/collect/MapsTest.java
ad9b3d
--- guava-18.0.vanilla/guava-tests/test/com/google/common/collect/MapsTest.java	2014-08-25 18:39:22.000000000 +0000
ad9b3d
+++ guava-18.0/guava-tests/test/com/google/common/collect/MapsTest.java	2015-06-03 21:04:15.463000000 +0000
ad9b3d
@@ -156,7 +156,8 @@
ad9b3d
     Field tableField = HashMap.class.getDeclaredField("table");
ad9b3d
     tableField.setAccessible(true);
ad9b3d
     Object[] table = (Object[]) tableField.get(hashMap);
ad9b3d
-    return table.length;
ad9b3d
+    // In JDK8, table is set lazily, so it may be null.
ad9b3d
+    return table == null ? 0 : table.length;
ad9b3d
   }
ad9b3d
 
ad9b3d
   public void testCapacityForLargeSizes() {