Skip to content

Commit

Permalink
Rolled back Guava 18 cycle fixes.
Browse files Browse the repository at this point in the history
	Change on 2015/04/08 by tball <tball@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=90625504
  • Loading branch information
tomball authored and kstanger committed Apr 9, 2015
1 parent b8cf615 commit 1f2c3fe
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 152 deletions.
9 changes: 0 additions & 9 deletions guava/cycle_whitelist
Expand Up @@ -3,7 +3,6 @@ TYPE java.lang.Runnable


# *** REAL CYCLES *** # *** REAL CYCLES ***
# Inverses # Inverses
FIELD com.google.common.base.Converter.reverse
FIELD com.google.common.collect.AbstractBiMap.inverse FIELD com.google.common.collect.AbstractBiMap.inverse
FIELD com.google.common.collect.ImmutableListMultimap.inverse FIELD com.google.common.collect.ImmutableListMultimap.inverse
FIELD com.google.common.collect.ImmutableSetMultimap.inverse FIELD com.google.common.collect.ImmutableSetMultimap.inverse
Expand Down Expand Up @@ -34,11 +33,3 @@ NAMESPACE com.google.common.cache
NAMESPACE com.google.common.hash NAMESPACE com.google.common.hash
NAMESPACE com.google.common.io NAMESPACE com.google.common.io
NAMESPACE com.google.common.net NAMESPACE com.google.common.net

# TODO(kstanger): investigate these Guava 18.0 cycles:
FIELD com.google.common.collect.ConcurrentHashMultiset.countMap
FIELD com.google.common.collect.TreeTraverser.PreOrderIterator.stack
FIELD com.google.common.collect.TreeTraverser.PostOrderIterator.stack
FIELD com.google.common.collect.TreeTraverser.PostOrderNode.childIterator
FIELD com.google.common.util.concurrent.Futures.WrappedCombiner.outputFuture
FIELD com.google.common.util.concurrent.AbstractScheduledService.ServiceDelegate.executorService
Expand Up @@ -1317,7 +1317,6 @@ Entry<K, Collection<V>> wrapEntry(Entry<K, Collection<V>> entry) {
return Maps.immutableEntry(key, wrapCollection(key, entry.getValue())); return Maps.immutableEntry(key, wrapCollection(key, entry.getValue()));
} }


@WeakOuter
class AsMapEntries extends Maps.EntrySet<K, Collection<V>> { class AsMapEntries extends Maps.EntrySet<K, Collection<V>> {
@Override @Override
Map<K, Collection<V>> map() { Map<K, Collection<V>> map() {
Expand Down Expand Up @@ -1428,7 +1427,6 @@ SortedSet<K> createKeySet() {
} }


@GwtIncompatible("NavigableAsMap") @GwtIncompatible("NavigableAsMap")
@WeakOuter
class NavigableAsMap extends SortedAsMap implements NavigableMap<K, Collection<V>> { class NavigableAsMap extends SortedAsMap implements NavigableMap<K, Collection<V>> {


NavigableAsMap(NavigableMap<K, Collection<V>> submap) { NavigableAsMap(NavigableMap<K, Collection<V>> submap) {
Expand Down
Expand Up @@ -181,7 +181,6 @@ Collection<V> createValues() {
return new Values(); return new Values();
} }


@WeakOuter
class Values extends AbstractCollection<V> { class Values extends AbstractCollection<V> {
@Override public Iterator<V> iterator() { @Override public Iterator<V> iterator() {
return valueIterator(); return valueIterator();
Expand Down
3 changes: 0 additions & 3 deletions guava/sources/com/google/common/collect/AbstractTable.java
Expand Up @@ -15,7 +15,6 @@
package com.google.common.collect; package com.google.common.collect;


import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtCompatible;
import com.google.j2objc.annotations.WeakOuter;


import java.util.AbstractCollection; import java.util.AbstractCollection;
import java.util.AbstractSet; import java.util.AbstractSet;
Expand Down Expand Up @@ -118,7 +117,6 @@ Set<Cell<R, C, V>> createCellSet() {


abstract Iterator<Table.Cell<R, C, V>> cellIterator(); abstract Iterator<Table.Cell<R, C, V>> cellIterator();


@WeakOuter
class CellSet extends AbstractSet<Cell<R, C, V>> { class CellSet extends AbstractSet<Cell<R, C, V>> {
@Override @Override
public boolean contains(Object o) { public boolean contains(Object o) {
Expand Down Expand Up @@ -179,7 +177,6 @@ V transform(Cell<R, C, V> cell) {
}; };
} }


@WeakOuter
class Values extends AbstractCollection<V> { class Values extends AbstractCollection<V> {
@Override @Override
public Iterator<V> iterator() { public Iterator<V> iterator() {
Expand Down
54 changes: 22 additions & 32 deletions guava/sources/com/google/common/collect/DenseImmutableTable.java
Expand Up @@ -17,8 +17,6 @@
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;


import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtCompatible;
import com.google.j2objc.annotations.Weak;
import com.google.j2objc.annotations.WeakOuter;


import java.util.Map; import java.util.Map;


Expand Down Expand Up @@ -124,36 +122,30 @@ public V get(@Nullable Object key) {


@Override @Override
ImmutableSet<Entry<K, V>> createEntrySet() { ImmutableSet<Entry<K, V>> createEntrySet() {
return new EntrySet<K, V>(this); return new ImmutableMapEntrySet<K, V>() {
} @Override ImmutableMap<K, V> map() {

return ImmutableArrayMap.this;
static class EntrySet<K, V> extends ImmutableMapEntrySet<K, V> { }
@Weak ImmutableArrayMap<K, V> map;
EntrySet(ImmutableArrayMap<K, V> map) { @Override
this.map = map; public UnmodifiableIterator<Entry<K, V>> iterator() {
} return new AbstractIterator<Entry<K, V>>() {
@Override ImmutableMap<K, V> map() { private int index = -1;
return map; private final int maxIndex = keyToIndex().size();
}

@Override
@Override protected Entry<K, V> computeNext() {
public UnmodifiableIterator<Entry<K, V>> iterator() { for (index++; index < maxIndex; index++) {
return new AbstractIterator<Entry<K, V>>() { V value = getValue(index);
private int index = -1; if (value != null) {
private final int maxIndex = map.keyToIndex().size(); return Maps.immutableEntry(getKey(index), value);

}
@Override
protected Entry<K, V> computeNext() {
for (index++; index < maxIndex; index++) {
V value = map.getValue(index);
if (value != null) {
return Maps.immutableEntry(map.getKey(index), value);
} }
return endOfData();
} }
return endOfData(); };
} }
}; };
}
} }
} }


Expand Down Expand Up @@ -205,7 +197,6 @@ boolean isPartialView() {
} }
} }


@WeakOuter
private final class RowMap extends ImmutableArrayMap<R, Map<C, V>> { private final class RowMap extends ImmutableArrayMap<R, Map<C, V>> {
private RowMap() { private RowMap() {
super(rowCounts.length); super(rowCounts.length);
Expand All @@ -227,7 +218,6 @@ boolean isPartialView() {
} }
} }


@WeakOuter
private final class ColumnMap extends ImmutableArrayMap<C, Map<R, V>> { private final class ColumnMap extends ImmutableArrayMap<C, Map<R, V>> {
private ColumnMap() { private ColumnMap() {
super(columnCounts.length); super(columnCounts.length);
Expand Down
25 changes: 6 additions & 19 deletions guava/sources/com/google/common/collect/FilteredEntryMultimap.java
Expand Up @@ -218,12 +218,7 @@ public Collection<V> remove(@Nullable Object key) {


@Override @Override
Set<K> createKeySet() { Set<K> createKeySet() {
@WeakOuter return new Maps.KeySet<K, Collection<V>>(this) {
class KeySet extends Maps.KeySet<K, Collection<V>> {
KeySet(Map<K, Collection<V>> map) {
super(map);
}

@Override @Override
public boolean removeAll(Collection<?> c) { public boolean removeAll(Collection<?> c) {
return removeEntriesIf(Maps.<K>keyPredicateOnEntries(in(c))); return removeEntriesIf(Maps.<K>keyPredicateOnEntries(in(c)));
Expand All @@ -238,14 +233,12 @@ public boolean retainAll(Collection<?> c) {
public boolean remove(@Nullable Object o) { public boolean remove(@Nullable Object o) {
return AsMap.this.remove(o) != null; return AsMap.this.remove(o) != null;
} }
} };
return new KeySet(this);
} }


@Override @Override
Set<Entry<K, Collection<V>>> createEntrySet() { Set<Entry<K, Collection<V>>> createEntrySet() {
@WeakOuter return new Maps.EntrySet<K, Collection<V>>() {
class AsMapEntrySet extends Maps.EntrySet<K, Collection<V>> {
@Override @Override
Map<K, Collection<V>> map() { Map<K, Collection<V>> map() {
return AsMap.this; return AsMap.this;
Expand Down Expand Up @@ -287,17 +280,12 @@ public boolean retainAll(Collection<?> c) {
public int size() { public int size() {
return Iterators.size(iterator()); return Iterators.size(iterator());
} }
} };
return new AsMapEntrySet();
} }


@Override @Override
Collection<Collection<V>> createValues() { Collection<Collection<V>> createValues() {
@WeakOuter return new Maps.Values<K, Collection<V>>(AsMap.this) {
class Values extends Maps.Values<K, Collection<V>> {
Values(Map<K, Collection<V>> map) {
super(map);
}
@Override @Override
public boolean remove(@Nullable Object o) { public boolean remove(@Nullable Object o) {
if (o instanceof Collection) { if (o instanceof Collection) {
Expand Down Expand Up @@ -331,8 +319,7 @@ public boolean removeAll(Collection<?> c) {
public boolean retainAll(Collection<?> c) { public boolean retainAll(Collection<?> c) {
return removeEntriesIf(Maps.<Collection<V>>valuePredicateOnEntries(not(in(c)))); return removeEntriesIf(Maps.<Collection<V>>valuePredicateOnEntries(not(in(c))));
} }
} };
return new Values(AsMap.this);
} }
} }


Expand Down
Expand Up @@ -19,7 +19,6 @@


import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtCompatible;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.j2objc.annotations.WeakOuter;


import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
Expand Down Expand Up @@ -181,7 +180,6 @@ Collection<Entry<K, V>> createEntries() {
return new Entries(); return new Entries();
} }


@WeakOuter
class Entries extends ForwardingCollection<Entry<K, V>> { class Entries extends ForwardingCollection<Entry<K, V>> {
@Override @Override
protected Collection<Entry<K, V>> delegate() { protected Collection<Entry<K, V>> delegate() {
Expand Down
Expand Up @@ -20,7 +20,6 @@
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.j2objc.annotations.Weak;


import java.util.AbstractCollection; import java.util.AbstractCollection;
import java.util.Collection; import java.util.Collection;
Expand All @@ -37,7 +36,7 @@
*/ */
@GwtCompatible @GwtCompatible
final class FilteredMultimapValues<K, V> extends AbstractCollection<V> { final class FilteredMultimapValues<K, V> extends AbstractCollection<V> {
@Weak private final FilteredMultimap<K, V> multimap; private final FilteredMultimap<K, V> multimap;


FilteredMultimapValues(FilteredMultimap<K, V> multimap) { FilteredMultimapValues(FilteredMultimap<K, V> multimap) {
this.multimap = checkNotNull(multimap); this.multimap = checkNotNull(multimap);
Expand Down
Expand Up @@ -22,7 +22,6 @@
import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtCompatible;
import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.GwtIncompatible;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.j2objc.annotations.Weak;


import java.io.IOException; import java.io.IOException;
import java.io.InvalidObjectException; import java.io.InvalidObjectException;
Expand Down Expand Up @@ -424,7 +423,7 @@ private ImmutableSetMultimap<V, K> invert() {
} }


private static final class EntrySet<K, V> extends ImmutableSet<Entry<K, V>> { private static final class EntrySet<K, V> extends ImmutableSet<Entry<K, V>> {
@Weak private transient final ImmutableSetMultimap<K, V> multimap; private transient final ImmutableSetMultimap<K, V> multimap;


EntrySet(ImmutableSetMultimap<K, V> multimap) { EntrySet(ImmutableSetMultimap<K, V> multimap) {
this.multimap = multimap; this.multimap = multimap;
Expand Down
Expand Up @@ -23,7 +23,6 @@
import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.GwtIncompatible;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.j2objc.annotations.WeakOuter;


import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
Expand Down Expand Up @@ -301,7 +300,6 @@ public Set<V> replaceValues(@Nullable K key, Iterable<? extends V> values) {
} }


@VisibleForTesting @VisibleForTesting
@WeakOuter
final class ValueSet extends Sets.ImprovedAbstractSet<V> implements ValueSetLink<K, V> { final class ValueSet extends Sets.ImprovedAbstractSet<V> implements ValueSetLink<K, V> {
/* /*
* We currently use a fixed load factor of 1.0, a bit higher than normal to reduce memory * We currently use a fixed load factor of 1.0, a bit higher than normal to reduce memory
Expand Down
12 changes: 4 additions & 8 deletions guava/sources/com/google/common/collect/LinkedListMultimap.java
Expand Up @@ -684,8 +684,7 @@ class LinkedListMultimapList extends AbstractSequentialList<V> {


@Override @Override
Set<K> createKeySet() { Set<K> createKeySet() {
@WeakOuter return new Sets.ImprovedAbstractSet<K>() {
class LinkedListMultimapKeySet extends Sets.ImprovedAbstractSet<K> {
@Override public int size() { @Override public int size() {
return keyToKeyList.size(); return keyToKeyList.size();
} }
Expand All @@ -699,8 +698,7 @@ class LinkedListMultimapKeySet extends Sets.ImprovedAbstractSet<K> {
public boolean remove(Object o) { // for performance public boolean remove(Object o) { // for performance
return !LinkedListMultimap.this.removeAll(o).isEmpty(); return !LinkedListMultimap.this.removeAll(o).isEmpty();
} }
} };
return new LinkedListMultimapKeySet();
} }


/** /**
Expand Down Expand Up @@ -768,17 +766,15 @@ public List<Entry<K, V>> entries() {


@Override @Override
List<Entry<K, V>> createEntries() { List<Entry<K, V>> createEntries() {
@WeakOuter return new AbstractSequentialList<Entry<K, V>>() {
class Entries extends AbstractSequentialList<Entry<K, V>> {
@Override public int size() { @Override public int size() {
return size; return size;
} }


@Override public ListIterator<Entry<K, V>> listIterator(int index) { @Override public ListIterator<Entry<K, V>> listIterator(int index) {
return new NodeIterator(index); return new NodeIterator(index);
} }
} };
return new Entries();
} }


@Override @Override
Expand Down
Expand Up @@ -3806,7 +3806,6 @@ public void clear() {
} }
} }


@WeakOuter
final class Values extends AbstractCollection<V> { final class Values extends AbstractCollection<V> {


@Override @Override
Expand Down

0 comments on commit 1f2c3fe

Please sign in to comment.