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

          Activity

            People

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

              Dates

                Created:
                Updated: