Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-10685

reduce overall usage of (shaded) Guava

    XMLWordPrintableJSON

Details

    • Task
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      for i in oak*/src/main ; do ( cd $i ; grep -h "import.*guava.*;"  -R $(find . -name "*.java")) ; done | sort | uniq -c | sort -n
      

      currently yields

            1 import org.apache.jackrabbit.guava.common.base.CaseFormat;
            1 import org.apache.jackrabbit.guava.common.base.CharMatcher;
            1 import org.apache.jackrabbit.guava.common.collect.ClassToInstanceMap;
            1 import org.apache.jackrabbit.guava.common.collect.HashBiMap;
            1 import org.apache.jackrabbit.guava.common.collect.ImmutableListMultimap;
            1 import org.apache.jackrabbit.guava.common.collect.MutableClassToInstanceMap;
            1 import org.apache.jackrabbit.guava.common.escape.Escapers;
            1 import org.apache.jackrabbit.guava.common.graph.SuccessorsFunction;
            1 import org.apache.jackrabbit.guava.common.graph.Traverser;
            1 import org.apache.jackrabbit.guava.common.hash.Funnel;
            1 import org.apache.jackrabbit.guava.common.hash.Funnels;
            1 import org.apache.jackrabbit.guava.common.hash.HashCode;
            1 import org.apache.jackrabbit.guava.common.hash.PrimitiveSink;
            1 import org.apache.jackrabbit.guava.common.primitives.Chars;
            1 import org.apache.jackrabbit.guava.common.primitives.UnsignedBytes;
            1 import org.apache.jackrabbit.guava.common.util.concurrent.AbstractListeningExecutorService;
            1 import org.apache.jackrabbit.guava.common.util.concurrent.FutureCallback;
            1 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkPositionIndex;
            1 import static org.apache.jackrabbit.guava.common.base.Predicates.alwaysTrue;
            1 import static org.apache.jackrabbit.guava.common.base.Predicates.isNull;
            1 import static org.apache.jackrabbit.guava.common.base.StandardSystemProperty.JAVA_IO_TMPDIR;
            1 import static org.apache.jackrabbit.guava.common.base.Strings.nullToEmpty;
            1 import static org.apache.jackrabbit.guava.common.base.Strings.repeat;
            1 import static org.apache.jackrabbit.guava.common.base.Throwables.getStackTraceAsString;
            1 import static org.apache.jackrabbit.guava.common.cache.CacheBuilder.newBuilder;
            1 import static org.apache.jackrabbit.guava.common.cache.RemovalCause.COLLECTED;
            1 import static org.apache.jackrabbit.guava.common.cache.RemovalCause.EXPIRED;
            1 import static org.apache.jackrabbit.guava.common.cache.RemovalCause.SIZE;
            1 import static org.apache.jackrabbit.guava.common.collect.Collections2.transform;
            1 import static org.apache.jackrabbit.guava.common.collect.ImmutableMap.copyOf;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterables.all;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterables.cycle;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterables.elementsEqual;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterables.limit;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterables.mergeSorted;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterators.partition;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterators.peekingIterator;
            1 import static org.apache.jackrabbit.guava.common.collect.Iterators.size;
            1 import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayListWithExpectedSize;
            1 import static org.apache.jackrabbit.guava.common.collect.Lists.newCopyOnWriteArrayList;
            1 import static org.apache.jackrabbit.guava.common.collect.Queues.newArrayBlockingQueue;
            1 import static org.apache.jackrabbit.guava.common.collect.Queues.newArrayDeque;
            1 import static org.apache.jackrabbit.guava.common.collect.Sets.filter;
            1 import static org.apache.jackrabbit.guava.common.collect.Sets.intersection;
            1 import static org.apache.jackrabbit.guava.common.escape.Escapers.builder;
            1 import static org.apache.jackrabbit.guava.common.io.ByteStreams.read;
            1 import static org.apache.jackrabbit.guava.common.io.FileWriteMode.APPEND;
            1 import static org.apache.jackrabbit.guava.common.io.Files.asByteSink;
            1 import static org.apache.jackrabbit.guava.common.math.DoubleMath.fuzzyCompare;
            1 import static org.apache.jackrabbit.guava.common.math.DoubleMath.fuzzyEquals;
            1 import static org.apache.jackrabbit.guava.common.util.concurrent.Atomics.newReference;
            2 import org.apache.jackrabbit.guava.common.annotations.VisibleForTesting;
            2 import org.apache.jackrabbit.guava.common.base.Throwables;
            2 import org.apache.jackrabbit.guava.common.cache.AbstractCache;
            2 import org.apache.jackrabbit.guava.common.collect.HashMultimap;
            2 import org.apache.jackrabbit.guava.common.collect.LinkedListMultimap;
            2 import org.apache.jackrabbit.guava.common.hash.BloomFilter;
            2 import org.apache.jackrabbit.guava.common.hash.Hasher;
            2 import org.apache.jackrabbit.guava.common.io.BaseEncoding;
            2 import org.apache.jackrabbit.guava.common.util.concurrent.Futures;
            2 import org.apache.jackrabbit.guava.common.util.concurrent.ListenableFutureTask;
            2 import org.apache.jackrabbit.guava.common.util.concurrent.Monitor.Guard;
            2 import org.apache.jackrabbit.guava.common.util.concurrent.Striped;
            2 import static org.apache.jackrabbit.guava.common.base.Objects.equal;
            2 import static org.apache.jackrabbit.guava.common.base.Stopwatch.createStarted;
            2 import static org.apache.jackrabbit.guava.common.base.Strings.isNullOrEmpty;
            2 import static org.apache.jackrabbit.guava.common.base.Suppliers.ofInstance;
            2 import static org.apache.jackrabbit.guava.common.collect.Iterables.isEmpty;
            2 import static org.apache.jackrabbit.guava.common.collect.Iterators.concat;
            2 import static org.apache.jackrabbit.guava.common.collect.Iterators.singletonIterator;
            2 import static org.apache.jackrabbit.guava.common.collect.Lists.reverse;
            2 import static org.apache.jackrabbit.guava.common.collect.Maps.filterValues;
            2 import static org.apache.jackrabbit.guava.common.collect.Maps.immutableEntry;
            2 import static org.apache.jackrabbit.guava.common.collect.Maps.newHashMapWithExpectedSize;
            2 import static org.apache.jackrabbit.guava.common.collect.Queues.newConcurrentLinkedQueue;
            2 import static org.apache.jackrabbit.guava.common.collect.Sets.difference;
            2 import static org.apache.jackrabbit.guava.common.collect.Sets.newConcurrentHashSet;
            2 import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSetWithExpectedSize;
            2 import static org.apache.jackrabbit.guava.common.io.Closeables.close;
            2 import static org.apache.jackrabbit.guava.common.io.Files.move;
            2 import static org.apache.jackrabbit.guava.common.io.Files.newWriter;
            3 import org.apache.jackrabbit.guava.common.base.Optional;
            3 import org.apache.jackrabbit.guava.common.base.Ticker;
            3 import org.apache.jackrabbit.guava.common.cache.LoadingCache;
            3 import org.apache.jackrabbit.guava.common.cache.RemovalListener;
            3 import org.apache.jackrabbit.guava.common.cache.RemovalNotification;
            3 import org.apache.jackrabbit.guava.common.collect.Collections2;
            3 import org.apache.jackrabbit.guava.common.collect.EvictingQueue;
            3 import org.apache.jackrabbit.guava.common.collect.ObjectArrays;
            3 import org.apache.jackrabbit.guava.common.util.concurrent.AtomicDouble;
            3 import org.apache.jackrabbit.guava.common.util.concurrent.ListenableFuture;
            3 import org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorService;
            3 import org.apache.jackrabbit.guava.common.util.concurrent.Monitor;
            3 import org.apache.jackrabbit.guava.common.util.concurrent.SettableFuture;
            3 import static org.apache.jackrabbit.guava.common.base.StandardSystemProperty.FILE_SEPARATOR;
            3 import static org.apache.jackrabbit.guava.common.base.StandardSystemProperty.LINE_SEPARATOR;
            3 import static org.apache.jackrabbit.guava.common.collect.ImmutableList.of;
            3 import static org.apache.jackrabbit.guava.common.collect.ImmutableSet.copyOf;
            3 import static org.apache.jackrabbit.guava.common.collect.Iterables.partition;
            3 import static org.apache.jackrabbit.guava.common.collect.Iterables.size;
            3 import static org.apache.jackrabbit.guava.common.collect.Iterators.filter;
            3 import static org.apache.jackrabbit.guava.common.collect.Maps.newTreeMap;
            3 import static org.apache.jackrabbit.guava.common.collect.Sets.union;
            4 import org.apache.jackrabbit.guava.common.collect.Ordering;
            4 import org.apache.jackrabbit.guava.common.io.CountingInputStream;
            4 import org.apache.jackrabbit.guava.common.primitives.Longs;
            4 import org.apache.jackrabbit.guava.common.util.concurrent.ThreadFactoryBuilder;
            4 import static org.apache.jackrabbit.guava.common.collect.Lists.newLinkedList;
            4 import static org.apache.jackrabbit.guava.common.collect.Maps.filterKeys;
            4 import static org.apache.jackrabbit.guava.common.collect.Sets.newIdentityHashSet;
            5 import org.apache.jackrabbit.guava.common.base.MoreObjects;
            5 import org.apache.jackrabbit.guava.common.base.Suppliers;
            5 import org.apache.jackrabbit.guava.common.cache.CacheLoader;
            5 import org.apache.jackrabbit.guava.common.cache.RemovalCause;
            5 import org.apache.jackrabbit.guava.common.collect.ComparisonChain;
            5 import org.apache.jackrabbit.guava.common.collect.Multimap;
            5 import org.apache.jackrabbit.guava.common.collect.TreeTraverser;
            5 import org.apache.jackrabbit.guava.common.hash.Hashing;
            5 import static org.apache.jackrabbit.guava.common.base.Predicates.not;
            5 import static org.apache.jackrabbit.guava.common.collect.ImmutableList.copyOf;
            5 import static org.apache.jackrabbit.guava.common.collect.Iterables.any;
            5 import static org.apache.jackrabbit.guava.common.collect.Lists.partition;
            5 import static org.apache.jackrabbit.guava.common.collect.Maps.newLinkedHashMap;
            5 import static org.apache.jackrabbit.guava.common.collect.Sets.newTreeSet;
            6 import org.apache.jackrabbit.guava.common.collect.PeekingIterator;
            6 import org.apache.jackrabbit.guava.common.io.ByteSource;
            6 import org.apache.jackrabbit.guava.common.util.concurrent.UncheckedExecutionException;
            6 import static org.apache.jackrabbit.guava.common.base.Suppliers.memoize;
            7 import org.apache.jackrabbit.guava.common.base.StandardSystemProperty;
            7 import org.apache.jackrabbit.guava.common.primitives.Ints;
            7 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkPositionIndexes;
            7 import static org.apache.jackrabbit.guava.common.collect.Iterables.addAll;
            7 import static org.apache.jackrabbit.guava.common.collect.Iterables.concat;
            7 import static org.apache.jackrabbit.guava.common.collect.Iterables.contains;
            8 import org.apache.jackrabbit.guava.common.collect.ArrayListMultimap;
            8 import org.apache.jackrabbit.guava.common.collect.ListMultimap;
            8 import org.apache.jackrabbit.guava.common.collect.Queues;
            8 import org.apache.jackrabbit.guava.common.util.concurrent.MoreExecutors;
            8 import static org.apache.jackrabbit.guava.common.base.Predicates.in;
            8 import static org.apache.jackrabbit.guava.common.collect.Iterables.toArray;
            9 import org.apache.jackrabbit.guava.common.cache.CacheBuilder;
            9 import org.apache.jackrabbit.guava.common.cache.CacheStats;
            9 import static org.apache.jackrabbit.guava.common.base.MoreObjects.toStringHelper;
            9 import static org.apache.jackrabbit.guava.common.collect.Iterators.transform;
            9 import static org.apache.jackrabbit.guava.common.collect.Maps.newConcurrentMap;
           10 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkElementIndex;
           10 import static org.apache.jackrabbit.guava.common.base.Predicates.notNull;
           11 import org.apache.jackrabbit.guava.common.io.ByteStreams;
           11 import org.apache.jackrabbit.guava.common.io.Closeables;
           11 import static org.apache.jackrabbit.guava.common.collect.Sets.newLinkedHashSet;
           12 import org.apache.jackrabbit.guava.common.collect.FluentIterable;
           13 import org.apache.jackrabbit.guava.common.cache.Weigher;
           14 import static org.apache.jackrabbit.guava.common.base.Charsets.UTF_8;
           15 import org.apache.jackrabbit.guava.common.base.Splitter;
           15 import static org.apache.jackrabbit.guava.common.collect.ImmutableSet.of;
           16 import org.apache.jackrabbit.guava.common.base.Preconditions;
           18 import org.apache.jackrabbit.guava.common.base.Predicates;
           18 import org.apache.jackrabbit.guava.common.cache.Cache;
           20 import org.apache.jackrabbit.guava.common.io.Files;
           23 import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayListWithCapacity;
           24 import static org.apache.jackrabbit.guava.common.collect.Iterables.filter;
           28 import org.apache.jackrabbit.guava.common.base.Supplier;
           29 import static org.apache.jackrabbit.guava.common.collect.Iterables.transform;
           30 import org.apache.jackrabbit.guava.common.base.Objects;
           31 import org.apache.jackrabbit.guava.common.base.Joiner;
           31 import org.apache.jackrabbit.guava.common.collect.AbstractIterator;
           34 import org.apache.jackrabbit.guava.common.base.Charsets;
           36 import static org.apache.jackrabbit.guava.common.collect.Maps.newHashMap;
           51 import static org.apache.jackrabbit.guava.common.collect.Sets.newHashSet;
           55 import org.apache.jackrabbit.guava.common.base.Strings;
           58 import org.apache.jackrabbit.guava.common.collect.Iterators;
           63 import org.apache.jackrabbit.guava.common.collect.ImmutableMap;
           64 import static org.apache.jackrabbit.guava.common.collect.Lists.newArrayList;
           65 import org.apache.jackrabbit.guava.common.base.Predicate;
           76 import org.apache.jackrabbit.guava.common.base.Stopwatch;
           76 import org.apache.jackrabbit.guava.common.io.Closer;
           77 import org.apache.jackrabbit.guava.common.collect.ImmutableList;
           80 import org.apache.jackrabbit.guava.common.collect.ImmutableSet;
           85 import org.apache.jackrabbit.guava.common.base.Function;
           85 import org.apache.jackrabbit.guava.common.collect.Sets;
           91 import org.apache.jackrabbit.guava.common.collect.Maps;
           91 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkState;
          117 import org.apache.jackrabbit.guava.common.collect.Iterables;
          122 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkArgument;
          128 import org.apache.jackrabbit.guava.common.collect.Lists;
          346 import static org.apache.jackrabbit.guava.common.base.Preconditions.checkNotNull;
      

      For now, we should try to reduce the number of usages where a simple JDK/apache-commons equivalent is available.

      Here's a script to count imports per sub project:

      for i in *; do [ -d $i ] && (cnt=$(grep -R ".*import.*guava.*" $i | wc -l); echo $cnt $i); done | sort -n
      

      Attachments

        Issue Links

          1.
          remove use of Guava Charsets class Technical task Closed Julian Reschke
          2.
          remove use of Guava Preconditions.checkNotNull() Technical task Closed Rishabh Daim
          3.
          store-spi: remove use of Guava CharMatcher in test case Technical task Closed Julian Reschke
          4.
          oak-run: avoid use of Guava's ClassToInstanceMap Technical task Closed Julian Reschke
          5.
          Remove usage of Guava Function interface Technical task Closed Julian Reschke
          6.
          remove unused import of java.io.UnsupportedEncodingException Technical task Closed Julian Reschke
          7.
          Remove usage of Guava Predicate interface Technical task Closed Julian Reschke
          8.
          Remove usage of Guava Supplier interface Technical task Closed Julian Reschke
          9.
          Remove usage of Guava newHashMap Technical task Closed Julian Reschke
          10.
          Remove usage of Guava Objects.equal() Technical task Closed Julian Reschke
          11.
          Remove usage of Guava Optional Technical task Closed Julian Reschke
          12.
          Remove usage of Guava StandardSystemProperty Technical task Closed Julian Reschke
          13.
          Remove usage of Guava newArrayList Technical task Closed Julian Reschke
          14.
          Remove usage of Guava newHashSet Technical task Closed Rishabh Daim
          15.
          Remove usage of Guava Objects class Technical task Closed Julian Reschke
          16.
          Remove usage of Guava Strings.nullToEmpty Technical task Closed Julian Reschke
          17.
          Remove usage of Guava Strings.isNullToEmpty Technical task Closed Julian Reschke
          18.
          Remove usage of Guava Strings.repeat Technical task Closed Julian Reschke
          19.
          Remove usage of Guava BiMap Technical task Closed Julian Reschke
          20.
          Create utils in oak-commons to convert iterables/iterators to set/list/stream, and to support HashMaps with known capacity Technical task Closed Rishabh Daim
          21.
          Remove usage of Guava checkArgument Technical task Closed Julian Reschke
          22.
          Remove usage of Guava Predicates.in() Technical task Closed Julian Reschke
          23.
          Remove usage of Guava Predicates.not() Technical task Closed Julian Reschke
          24.
          remove remaining use of Guava predicates Technical task Closed Julian Reschke
          25.
          remove use of Guava transform/filter Technical task In Progress Julian Reschke
          26.
          Remove usage of Guava ImmutableSet.of() Technical task Closed Rishabh Daim
          27.
          Remove usage of Guava ImmutableList.of() Technical task Open Rishabh Daim
          28.
          Remove usage of Guava Lists.newArrayListWithCapacity Technical task Closed Rishabh Daim
          29.
          Remove usage of Guava Preconditions.checkState Technical task Closed Rishabh Daim
          30.
          Remove usage of Guava ImmutableMap.of() Technical task Open Rishabh Daim
          31.
          Remove usage of Guava Iterables.any() Technical task Closed Julian Reschke
          32.
          Remove usage of Guava Maps.newHashMapWithExpectedSize() Technical task Closed Rishabh Daim
          33.
          Remove usage of Guava Sets.newHashSetWithExpectedSize() Technical task Closed Rishabh Daim
          34.
          Remove usage of Guava Sets.newLinkedHashSet Technical task Closed Rishabh Daim
          35.
          Remove usage of Guava Sets.newTreeSet Technical task Closed Rishabh Daim
          36.
          Remove usage of Guava Atomics.newReference Technical task Closed Rishabh Daim
          37.
          Create utils in oak-commons to convert iterables set/linkedHashSet and to support HashSet/LinkedHashSet with known capacity Technical task Closed Rishabh Daim
          38.
          Create utils in oak-commons to convert iterables to TreeSet Technical task Closed Rishabh Daim
          39.
          Remove usage of Guava Maps.newConcurrentMap Technical task Closed Rishabh Daim
          40.
          Remove usage of Guava ImmutableMap.copyOf() Technical task Open Rishabh Daim
          41.
          Remove usage of Guava Lists.newLinkedList Technical task Closed Rishabh Daim
          42.
          Remove usage of Guava Maps.newLinkedHashMap Technical task Closed Rishabh Daim
          43.
          Remove usage of Guava Sets.newIdentityHashSet Technical task Closed Rishabh Daim
          44.
          Remove usage of Guava MoreObjects Technical task Open Rishabh Daim
          45.
          Create utils in oak-commons to convert iterables to LinkedList and create IdentityHashSet Technical task Closed Rishabh Daim
          46.
          Remove usage of Guava Maps.newTreeMap Technical task Closed Rishabh Daim
          47.
          Removal of Guava Queues.newArrayDeque Technical task Closed Rishabh Daim
          48.
          Remove usage of Guava Lists.partition Technical task Closed Rishabh Daim
          49.
          Create utils in oak-commons to partition lists Technical task Closed Rishabh Daim
          50.
          Create utils in oak-commons to convert iterables to ArrayDeque Technical task Closed Rishabh Daim
          51.
          Removal of Guava Queues.newArrayBlockingQueue Technical task Closed Rishabh Daim
          52.
          Remove usage of Guava Queues.newConcurrentLinkedQueue Technical task Closed Rishabh Daim
          53.
          Remove usage of Guava Sets.newConcurrentHashSet Technical task Resolved Rishabh Daim
          54.
          Remove usage of Guava EvictingQueue Technical task Open Rishabh Daim
          55.
          Remove usage of Guava newArrayList (no param variant) Technical task Closed Julian Reschke
          56.
          remove guava dependencies from POMs (ongoing) Technical task In Progress Julian Reschke
          57.
          remove unused Guava related imports (ongoing) Technical task In Progress Julian Reschke
          58.
          remove usage of newArrayListWithExpectedSize Technical task Closed Julian Reschke
          59.
          remove usage of newArrayList(Iterable/Iterator) Technical task Closed Julian Reschke
          60.
          Remove usage of Guava newArrayList(vargargs) in test classes Technical task Closed Julian Reschke

          Activity

            People

              reschke Julian Reschke
              reschke Julian Reschke
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: