IDEA-76019 Update guava to r11.0.1
authorMaxim.Mossienko <maxim.mossienko@jetbrains.com>
Mon, 30 Jan 2012 17:50:35 +0000 (21:50 +0400)
committerMaxim.Mossienko <maxim.mossienko@jetbrains.com>
Mon, 30 Jan 2012 17:50:35 +0000 (21:50 +0400)
.idea/libraries/Guava.xml
build/scripts/layouts.gant
jps/jps-builders/src/org/jetbrains/jps/server/ClasspathBootstrap.java
lib/guava-11.0.1.jar [new file with mode: 0644]
lib/guava-r09.jar [deleted file]
lib/required_for_dist.txt
lib/src/guava-11.0.1-sources.jar [new file with mode: 0644]
lib/src/guava-src-r09.zip [deleted file]
platform/util/src/com/intellij/util/containers/ConcurrentSLRUMap.java

index 3024d55693eb6a3683d3985ec8d76d64d9a90fa5..555ca8377a3ce545d6feaa086ead0b62da3964ba 100644 (file)
@@ -1,11 +1,11 @@
 <component name="libraryTable">
   <library name="Guava">
     <CLASSES>
-      <root url="jar://$PROJECT_DIR$/lib/guava-r09.jar!/" />
+      <root url="jar://$PROJECT_DIR$/lib/guava-11.0.1.jar!/" />
     </CLASSES>
     <JAVADOC />
     <SOURCES>
-      <root url="jar://$PROJECT_DIR$/lib/src/guava-src-r09.zip!/" />
+      <root url="jar://$PROJECT_DIR$/lib/src/guava-11.0.1-sources.jar!/" />
     </SOURCES>
   </library>
 </component>
\ No newline at end of file
index 69620ce424a2d3d2d2324f8504c00182da901547..8ff3cb98ebf2e19b9ed938bc10c3005f0b7e2c22 100644 (file)
@@ -485,7 +485,7 @@ def layout_core(String home, String target) {
     }
 
     fileset(dir: "$home/lib") {
-      include(name: "guava-r09.jar")
+      include(name: "guava-11.0.1.jar")
       include(name: "picocontainer.jar")
       include(name: "trove4j.jar")
       include(name: "asm.jar")
index 3b37a52a500585040f2796da5f5a16be6de15806..f520c8128d28f57292c3cb9a676daa2ed0183761 100644 (file)
@@ -15,6 +15,7 @@
  */
 package org.jetbrains.jps.server;
 
+import com.google.common.cache.CacheBuilder;
 import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
 import com.intellij.openapi.application.PathManager;
 import com.intellij.openapi.util.io.FileUtil;
@@ -77,7 +78,7 @@ public class ClasspathBootstrap {
     cp.add(getResourcePath(TIntHash.class));  // trove
     cp.add(getResourcePath(FileUtil.class));  // util module
     cp.add(getResourcePath(Pointer.class));  // jna.jar
-    cp.add(getResourcePath(com.google.common.collect.MapMaker.class));  // guava
+    cp.add(getResourcePath(CacheBuilder.class));  // guava
     cp.add(getResourcePath(FileMonitor.class));  // jna-utils.jar
     cp.add(getResourcePath(ClassWriter.class));  // asm
     cp.add(getResourcePath(org.objectweb.asm.commons.EmptyVisitor.class));  // asm-commons
@@ -123,7 +124,7 @@ public class ClasspathBootstrap {
     cp.add(getResourcePath(TIntHash.class));  // trove
     cp.add(getResourcePath(FileUtil.class));  // util module
     cp.add(getResourcePath(Pointer.class));  // jna.jar
-    cp.add(getResourcePath(com.google.common.collect.MapMaker.class));  // guava
+    cp.add(getResourcePath(CacheBuilder.class));  // guava
     cp.add(getResourcePath(FileMonitor.class));  // jna-utils.jar
     cp.add(getResourcePath(org.jdom.input.SAXBuilder.class));  // jdom
 
diff --git a/lib/guava-11.0.1.jar b/lib/guava-11.0.1.jar
new file mode 100644 (file)
index 0000000..af4a383
Binary files /dev/null and b/lib/guava-11.0.1.jar differ
diff --git a/lib/guava-r09.jar b/lib/guava-r09.jar
deleted file mode 100644 (file)
index f8da8b1..0000000
Binary files a/lib/guava-r09.jar and /dev/null differ
index 5a2fd8ed757e0ecf4e3d8950cc294f58dc67dc36..f275d28c8ff6b889dcda82e1bf9a85822d6824eb 100644 (file)
@@ -12,7 +12,7 @@ commons-net-2.0-patched.jar
 dtdparser113.jar
 groovy-all-1.8.5.jar
 gson-2.0.jar
-guava-r09.jar
+guava-11.0.1.jar
 jaxen-1.1.3.jar
 jcip-annotations.jar
 jdom.jar
diff --git a/lib/src/guava-11.0.1-sources.jar b/lib/src/guava-11.0.1-sources.jar
new file mode 100644 (file)
index 0000000..778c0c4
Binary files /dev/null and b/lib/src/guava-11.0.1-sources.jar differ
diff --git a/lib/src/guava-src-r09.zip b/lib/src/guava-src-r09.zip
deleted file mode 100644 (file)
index 2bb7699..0000000
Binary files a/lib/src/guava-src-r09.zip and /dev/null differ
index 2900621fa81bbb902e26d9b656541559a2bcf748..b32794552bab903db8dc4ab7053c20c60fa64465 100644 (file)
  */
 package com.intellij.util.containers;
 
-import com.google.common.collect.MapEvictionListener;
-import com.google.common.collect.MapMaker;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.RemovalListener;
+import com.google.common.cache.RemovalNotification;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 
 public class ConcurrentSLRUMap<K,V> {
-  protected final Map<K,V> myProtectedQueue;
-  protected final Map<K,V> myProbationalQueue;
+  protected final ConcurrentMap<K,V> myProtectedQueue;
+  protected final ConcurrentMap<K,V> myProbationalQueue;
 
   private final AtomicInteger probationalHits = new AtomicInteger();
   private final AtomicInteger protectedHits = new AtomicInteger();
   private final AtomicInteger misses = new AtomicInteger();
 
   public ConcurrentSLRUMap(final int protectedQueueSize, final int probationalQueueSize) {
-    myProtectedQueue = new MapMaker().concurrencyLevel(4).evictionListener(new MapEvictionListener<K, V>() {
+    myProtectedQueue = CacheBuilder.newBuilder().concurrencyLevel(4).removalListener(new RemovalListener<K, V>() {
       @Override
-      public void onEviction(K key, V value) {
-        myProbationalQueue.put(key, value); // no size check since it is costly
+      public void onRemoval(RemovalNotification<K, V> notification) {
+        myProbationalQueue.put(notification.getKey(), notification.getValue());
       }
-    }).initialCapacity(10).maximumSize(protectedQueueSize).makeMap();
+    }).initialCapacity(10).maximumSize(protectedQueueSize).<K, V>build().asMap();
 
-    myProbationalQueue = new MapMaker().concurrencyLevel(4).evictionListener(new MapEvictionListener<K, V>() {
+    myProbationalQueue = CacheBuilder.newBuilder().concurrencyLevel(4).removalListener(new RemovalListener<K, V>() {
       @Override
-      public void onEviction(K key, V value) {
-        onDropFromCache(key, value);  // no size check since it is costly
+      public void onRemoval(RemovalNotification<K, V> notification) {
+        onDropFromCache(notification.getKey(), notification.getValue());
       }
-    }).initialCapacity(10).maximumSize(probationalQueueSize).makeMap();
+    }).initialCapacity(10).maximumSize(probationalQueueSize).<K, V>build().asMap();
   }
 
   @Nullable