Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moe Sync #3393

Merged
merged 23 commits into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
504978f
Add Report-To header.
Jan 30, 2019
f0945a2
Remove unused imports and warnings.
OleksiiBondar Jan 30, 2019
7809097
Reformat with google-java-format
cushon Feb 1, 2019
8843b6c
Add missing @Override annotations
cushon Feb 1, 2019
f6287e1
Document the retention of listeners added to Guava implementations of…
jdcormie Feb 1, 2019
28cff42
Reformat with google-java-format
cushon Feb 4, 2019
0967c79
Name the method parameter 'unused' for ImmutableSortedSet.readObject(…
kluever Feb 5, 2019
068cb90
Remove @Beta from APIs:
cpovirk Feb 6, 2019
e7ec537
Add some known UTF-8 hash values to Murmur3_32 tests. UTF-8 is more c…
awused Feb 6, 2019
da2895f
Remove @CanIgnoreReturnValue from Ordering.sortedCopy() and immutable…
kluever Feb 7, 2019
b1933ce
Make a constructor private.
cpovirk Feb 11, 2019
2115c74
Delete WellBehavedMap.
cpovirk Feb 11, 2019
1d49ade
Internal GWT change
Feb 12, 2019
46a2123
Automated rollback of commit 1d49ade94c3e7d2c056893a630739c8a6b897f66
Feb 12, 2019
76c9545
Use J2ObjC's @RetainedWith annotation instead of @Weak on ImmutableMa…
kstanger Feb 13, 2019
63d0b31
Annotate checkNotNull's input and output as @NonNull.
cpovirk Feb 14, 2019
998858f
Document the JDK 9+ alternative to `Maps#immutableEntry`
Stephan202 Feb 15, 2019
7eafede
Modernize book reference.
Feb 15, 2019
81f191e
Create constants for the SourceMap header
lukesandberg Feb 16, 2019
db6ada7
Internal GWT change
magdazk Feb 20, 2019
05ac563
Use J2ObjC's @RetainedWith annotation instead of @Weak on ImmutableMa…
kstanger Feb 22, 2019
d8bdef5
Fix Javadoc breakage under JDK11 canary.
cpovirk Feb 22, 2019
be02df5
Remove GWT emulations that are no longer needed as of GWT 2.8.2.
cpovirk Feb 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@
public class AbstractListMultimapTester<K, V>
extends AbstractMultimapTester<K, V, ListMultimap<K, V>> {

@Override
protected void assertGet(K key, V... values) {
assertGet(key, Arrays.asList(values));
}

@Override
protected void assertGet(K key, Collection<V> values) {
assertEqualInOrder(values, multimap().get(key));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ public void testSetCount_removeNull_nullSupported() {
}

@CollectionFeature.Require(
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS
)
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS)
public void testSetCount_addNull_nullSupported() {
assertSetCount(null, 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public V[] createValueArray(int length) {
return (V[]) new Object[length];
}

@Override
public TestSubjectGenerator<?> getInnerGenerator() {
return generator;
}
Expand Down Expand Up @@ -144,6 +145,7 @@ public K[] createValueArray(int length) {
return (K[]) new Object[length];
}

@Override
public TestSubjectGenerator<?> getInnerGenerator() {
return generator;
}
Expand Down Expand Up @@ -202,6 +204,7 @@ public Iterable<V> order(List<V> insertionOrder) {
return insertionOrder;
}

@Override
public TestSubjectGenerator<?> getInnerGenerator() {
return mapGenerator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ public void testAddAll_unsupportedAllPresent() {
}

@CollectionFeature.Require(
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS
)
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS)
public void testAddAll_nullSupported() {
List<E> containsNull = singletonList(null);
assertTrue("addAll(containsNull) should return true", collection.addAll(containsNull));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ public void testAdd_unsupportedPresent() {
}

@CollectionFeature.Require(
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS
)
value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
absent = RESTRICTS_ELEMENTS)
public void testAdd_nullSupported() {
assertTrue("add(null) should return true", collection.add(null));
expectAdded((E) null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public interface FinalizationPredicate {
public static void awaitClear(final WeakReference<?> ref) {
awaitDone(
new FinalizationPredicate() {
@Override
public boolean isDone() {
return ref.get() == null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.google.caliper.Benchmark;
import com.google.caliper.Param;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints;
import java.util.List;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ public void testLenientFormat_badArgumentToString() {

public void testLenientFormat_badArgumentToString_gwtFriendly() {
assertThat(Strings.lenientFormat("boiler %s plate", new ThrowsOnToString()))
.matches(
"boiler <.*> plate");
.matches("boiler <.*> plate");
}

private static class ThrowsOnToString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,27 @@
public class CompactHashMapTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = CompactHashMap.create();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return map;
}
})
.named("CompactHashMap")
.withFeatures(
CollectionSize.ANY, MapFeature.GENERAL_PURPOSE, MapFeature.ALLOWS_NULL_KEYS,
MapFeature.ALLOWS_NULL_VALUES, CollectionFeature.SERIALIZABLE,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
suite.addTest(
MapTestSuiteBuilder.using(
new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = CompactHashMap.create();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return map;
}
})
.named("CompactHashMap")
.withFeatures(
CollectionSize.ANY,
MapFeature.GENERAL_PURPOSE,
MapFeature.ALLOWS_NULL_KEYS,
MapFeature.ALLOWS_NULL_VALUES,
CollectionFeature.SERIALIZABLE,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
.createTestSuite());
suite.addTestSuite(CompactHashMapTest.class);
return suite;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,49 @@
@GwtIncompatible // java.util.Arrays#copyOf(Object[], int), java.lang.reflect.Array
public class CompactHashSetTest extends TestCase {
public static Test suite() {
List<Feature<?>> allFeatures = Arrays.<Feature<?>>asList(
CollectionSize.ANY,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.GENERAL_PURPOSE,
CollectionFeature.REMOVE_OPERATIONS,
CollectionFeature.SERIALIZABLE,
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE);
List<Feature<?>> allFeatures =
Arrays.<Feature<?>>asList(
CollectionSize.ANY,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.GENERAL_PURPOSE,
CollectionFeature.REMOVE_OPERATIONS,
CollectionFeature.SERIALIZABLE,
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE);

TestSuite suite = new TestSuite();
suite.addTestSuite(CompactHashSetTest.class);
suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override protected Set<String> create(String[] elements) {
return CompactHashSet.create(Arrays.asList(elements));
}
}).named("CompactHashSet")
.withFeatures(allFeatures)
.createTestSuite());
suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override protected Set<String> create(String[] elements) {
CompactHashSet set = CompactHashSet.create(Arrays.asList(elements));
for (int i = 0; i < 100; i++) {
set.add(i);
}
for (int i = 0; i < 100; i++) {
set.remove(i);
}
set.trimToSize();
return set;
}
}).named("CompactHashSet#TrimToSize")
.withFeatures(allFeatures)
.createTestSuite());
suite.addTest(
SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return CompactHashSet.create(Arrays.asList(elements));
}
})
.named("CompactHashSet")
.withFeatures(allFeatures)
.createTestSuite());
suite.addTest(
SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
CompactHashSet set = CompactHashSet.create(Arrays.asList(elements));
for (int i = 0; i < 100; i++) {
set.add(i);
}
for (int i = 0; i < 100; i++) {
set.remove(i);
}
set.trimToSize();
return set;
}
})
.named("CompactHashSet#TrimToSize")
.withFeatures(allFeatures)
.createTestSuite());
return suite;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,28 @@
public class CompactLinkedHashMapTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(MapTestSuiteBuilder.using(new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = CompactLinkedHashMap.create();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return map;
}
}).named("CompactLinkedHashMap").withFeatures(CollectionSize.ANY,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
MapFeature.GENERAL_PURPOSE,
MapFeature.ALLOWS_NULL_KEYS,
MapFeature.ALLOWS_NULL_VALUES,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER).createTestSuite());
suite.addTest(
MapTestSuiteBuilder.using(
new TestStringMapGenerator() {
@Override
protected Map<String, String> create(Entry<String, String>[] entries) {
Map<String, String> map = CompactLinkedHashMap.create();
for (Entry<String, String> entry : entries) {
map.put(entry.getKey(), entry.getValue());
}
return map;
}
})
.named("CompactLinkedHashMap")
.withFeatures(
CollectionSize.ANY,
CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
MapFeature.GENERAL_PURPOSE,
MapFeature.ALLOWS_NULL_KEYS,
MapFeature.ALLOWS_NULL_VALUES,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER)
.createTestSuite());
suite.addTestSuite(CompactLinkedHashMapTest.class);
return suite;
}
Expand Down Expand Up @@ -119,8 +125,7 @@ public void testTrimToSize() {
testHasMapEntriesInOrder(map, 1, "a", 4, "b", 3, "d", 2, "c");
}

private void testHasMapEntriesInOrder(Map<?, ?> map,
Object... alternatingKeysAndValues) {
private void testHasMapEntriesInOrder(Map<?, ?> map, Object... alternatingKeysAndValues) {
List<? extends Entry<?, ?>> entries = Lists.newArrayList(map.entrySet());
List<Object> keys = Lists.newArrayList(map.keySet());
List<Object> values = Lists.newArrayList(map.values());
Expand All @@ -130,8 +135,7 @@ private void testHasMapEntriesInOrder(Map<?, ?> map,
for (int i = 0; i < map.size(); i++) {
Object expectedKey = alternatingKeysAndValues[2 * i];
Object expectedValue = alternatingKeysAndValues[2 * i + 1];
Entry<Object, Object> expectedEntry = Maps.immutableEntry(
expectedKey, expectedValue);
Entry<Object, Object> expectedEntry = Maps.immutableEntry(expectedKey, expectedValue);
assertEquals(expectedEntry, entries.get(i));
assertEquals(expectedKey, keys.get(i));
assertEquals(expectedValue, values.get(i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,31 @@
@GwtIncompatible // java.util.Arrays#copyOf(Object[], int), java.lang.reflect.Array
public class CompactLinkedHashSetTest extends TestCase {
public static Test suite() {
List<Feature<?>> allFeatures = Arrays.<Feature<?>>asList(
CollectionSize.ANY,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.GENERAL_PURPOSE,
CollectionFeature.REMOVE_OPERATIONS,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE);
List<Feature<?>> allFeatures =
Arrays.<Feature<?>>asList(
CollectionSize.ANY,
CollectionFeature.ALLOWS_NULL_VALUES,
CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
CollectionFeature.GENERAL_PURPOSE,
CollectionFeature.REMOVE_OPERATIONS,
CollectionFeature.SERIALIZABLE,
CollectionFeature.KNOWN_ORDER,
CollectionFeature.SUPPORTS_ADD,
CollectionFeature.SUPPORTS_REMOVE);

TestSuite suite = new TestSuite();
suite.addTestSuite(CompactLinkedHashSetTest.class);
suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
@Override protected Set<String> create(String[] elements) {
return CompactLinkedHashSet.create(Arrays.asList(elements));
}
}).named("CompactLinkedHashSet")
.withFeatures(allFeatures)
.createTestSuite());
suite.addTest(
SetTestSuiteBuilder.using(
new TestStringSetGenerator() {
@Override
protected Set<String> create(String[] elements) {
return CompactLinkedHashSet.create(Arrays.asList(elements));
}
})
.named("CompactLinkedHashSet")
.withFeatures(allFeatures)
.createTestSuite());
return suite;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,11 @@ protected Map<K, V> delegate() {
};
}

private static final ImmutableMap<String, String> JUF_METHODS = ImmutableMap.of(
"java.util.function.Predicate", "test",
"java.util.function.Consumer", "accept",
"java.util.function.IntFunction", "apply");
private static final ImmutableMap<String, String> JUF_METHODS =
ImmutableMap.of(
"java.util.function.Predicate", "test",
"java.util.function.Consumer", "accept",
"java.util.function.IntFunction", "apply");

private static Object getDefaultValue(final TypeToken<?> type) {
Class<?> rawType = type.getRawType();
Expand Down Expand Up @@ -387,8 +388,7 @@ private static <T> void callAllPublicMethods(TypeToken<T> type, T object)
}
}
} catch (Throwable cause) {
throw new InvocationTargetException(
cause, method + " with args: " + Arrays.toString(args));
throw new InvocationTargetException(cause, method + " with args: " + Arrays.toString(args));
}
}
}
Expand Down
Loading