Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 347710478
  • Loading branch information
java-team-github-bot authored and cgdecker committed Dec 16, 2020
1 parent 4ce1869 commit 2b55799
Show file tree
Hide file tree
Showing 228 changed files with 1,158 additions and 847 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,3 @@ flavor.

[using Guava in your build]: https://github.com/google/guava/wiki/UseGuavaInYourBuild
[repackage]: https://github.com/google/guava/wiki/UseGuavaInYourBuild#what-if-i-want-to-use-beta-apis-from-a-library-that-people-use-as-a-dependency

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* serialization tests require more setup. This no-op behavior allows test authors to intersperse
* {@code SerializableTester} calls with other, GWT-compatible tests.
*
*
* @author Mike Bostock
* @since 10.0
*/
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void runConcurrentTest(int numberOfThreads, final Callable<Void> callabl
final CountDownLatch startLatch = new CountDownLatch(numberOfThreads);
final CountDownLatch doneLatch = new CountDownLatch(numberOfThreads);
for (int i = numberOfThreads; i > 0; i--) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
executorService.submit(
new Callable<Void>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.common.testing;


/** Test nulls for the entire package. */

public class PackageSanityTests extends AbstractPackageSanityTests {}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
/**
* Benchmark for the {@link CharMatcher} class.
*
*
* @author David Beaumont
* @author Kevin Bourrillion
* @author David Richter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void setUp() throws Exception {
final AtomicInteger integer = new AtomicInteger();
// Execute a bunch of tasks to ensure that our threads are allocated and hot
for (int i = 0; i < NUM_THREADS * 10; i++) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
executorService.submit(
new Runnable() {
Expand Down Expand Up @@ -334,10 +334,10 @@ public void run() {
list = impl.newExecutionList();
listenerLatch = new CountDownLatch(numListeners * NUM_THREADS);
for (int j = 0; j < NUM_THREADS; j++) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = executorService.submit(addTask);
}
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = executorService.submit(executeTask);
returnValue += (int) listenerLatch.getCount();
listenerLatch.await();
Expand All @@ -360,10 +360,10 @@ public void run() {
for (int i = 0; i < reps; i++) {
list = impl.newExecutionList();
listenerLatch = new CountDownLatch(numListeners * NUM_THREADS);
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = executorService.submit(executeTask);
for (int j = 0; j < NUM_THREADS; j++) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError1 = executorService.submit(addTask);
}
returnValue += (int) listenerLatch.getCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public Integer computeNext() {
}
}


@GwtIncompatible // weak references
public void testFreesNextReference() {
Iterator<Object> itr =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* Google-internal Android suite generators. Note that those generators also suppress any test
* annotated with MediumTest or LargeTest.
*
*
* <p>Why use a custom annotation instead of {@code android.test.suitebuilder.annotation.Suppress}?
* I'm not completely sure that this is the right choice, but it has various advantages:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public void testGetIfPresent_whenNoMatchingConstant() {
assertThat(Enums.getIfPresent(TestEnum.class, "WOMBAT")).isAbsent();
}


@GwtIncompatible // weak references
public void testGetIfPresent_doesNotPreventClassUnloading() throws Exception {
WeakReference<?> shadowLoaderReference = doTestClassUnloading();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @author Eamonn McManus
*/


public class FinalizableReferenceQueueClassLoaderUnloadingTest extends TestCase {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ protected void tearDown() throws Exception {
frq = null;
}


public void testFinalizeReferentCalled() {
final MockReference reference = new MockReference(frq = new FinalizableReferenceQueue());

Expand Down Expand Up @@ -71,6 +72,7 @@ public void finalizeReferent() {
*/
private WeakReference<ReferenceQueue<Object>> queueReference;


public void testThatFinalizerStops() {
weaklyReferenceQueue();
GcFinalization.awaitClear(queueReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public void testRemovalNotification_clear_basher() throws InterruptedException {
final CountDownLatch tasksFinished = new CountDownLatch(nTasks);
for (int i = 0; i < nTasks; i++) {
final String s = "a" + i;
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
threadPool.submit(
new Runnable() {
Expand Down Expand Up @@ -595,7 +595,7 @@ public String load(String key) throws InterruptedException {

ExecutorService threadPool = Executors.newFixedThreadPool(nThreads);
for (int i = 0; i < nTasks; i++) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
threadPool.submit(
new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Map<Object, Object> loadAll(Iterable<?> keys) {
assertEquals(0, loadAllCount.get());

baseLoader.load(new Object());
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = baseLoader.reload(new Object(), new Object());
baseLoader.loadAll(ImmutableList.of(new Object()));
assertEquals(1, loadCount.get());
Expand All @@ -90,7 +90,7 @@ public Map<Object, Object> loadAll(Iterable<?> keys) {
CacheLoader<Object, Object> asyncReloader = CacheLoader.asyncReloading(baseLoader, executor);

asyncReloader.load(new Object());
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError1 = asyncReloader.reload(new Object(), new Object());
asyncReloader.loadAll(ImmutableList.of(new Object()));
assertEquals(2, loadCount.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,7 @@ public String load(Integer key) throws Exception {
assertEquals(0, removalListener.getCount());
}


public void testReloadAfterValueReclamation() throws InterruptedException, ExecutionException {
CountingLoader countingLoader = new CountingLoader();
LoadingCache<Object, Object> cache =
Expand Down Expand Up @@ -1940,6 +1941,7 @@ public void testBulkLoadingExceptionWithCause() {
}
}


public void testConcurrentLoading() throws InterruptedException {
testConcurrentLoading(CacheBuilder.newBuilder());
}
Expand All @@ -1952,6 +1954,7 @@ private static void testConcurrentLoading(CacheBuilder<Object, Object> builder)
testConcurrentLoadingCheckedException(builder);
}


public void testConcurrentExpirationLoading() throws InterruptedException {
testConcurrentLoading(CacheBuilder.newBuilder().expireAfterWrite(10, TimeUnit.SECONDS));
}
Expand Down Expand Up @@ -2181,6 +2184,7 @@ public void run() {
return resultList;
}


public void testAsMapDuringLoading() throws InterruptedException, ExecutionException {
final CountDownLatch getStartedSignal = new CountDownLatch(2);
final CountDownLatch letGetFinishSignal = new CountDownLatch(1);
Expand Down Expand Up @@ -2239,6 +2243,7 @@ public void run() {
assertEquals(refreshKey + suffix, map.get(refreshKey));
}


public void testInvalidateDuringLoading() throws InterruptedException, ExecutionException {
// computation starts; invalidate() is called on the key being computed, computation finishes
final CountDownLatch computationStarted = new CountDownLatch(2);
Expand Down Expand Up @@ -2295,6 +2300,7 @@ public void run() {
assertEquals(2, cache.size());
}


public void testInvalidateAndReloadDuringLoading()
throws InterruptedException, ExecutionException {
// computation starts; clear() is called, computation finishes
Expand Down Expand Up @@ -2367,6 +2373,7 @@ public void run() {
assertEquals(refreshKey + suffix, map.get(refreshKey));
}


public void testExpandDuringLoading() throws InterruptedException {
final int count = 3;
final AtomicInteger callCount = new AtomicInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void testEmpty() {
}
}


public void testInvalidate_empty() {
for (LoadingCache<Object, Object> cache : caches()) {
cache.getUnchecked("a");
Expand All @@ -68,6 +69,7 @@ public void testInvalidateAll_empty() {
}
}


public void testEquals_null() {
for (LoadingCache<Object, Object> cache : caches()) {
assertFalse(cache.equals(null));
Expand Down Expand Up @@ -137,6 +139,7 @@ public void testKeySet_addNotSupported() {
}
}


public void testKeySet_clear() {
for (LoadingCache<Object, Object> cache : caches()) {
warmUp(cache, 0, 100);
Expand Down Expand Up @@ -211,6 +214,7 @@ public void testValues_addNotSupported() {
}
}


public void testValues_clear() {
for (LoadingCache<Object, Object> cache : caches()) {
warmUp(cache, 0, 100);
Expand Down Expand Up @@ -285,6 +289,7 @@ public void testEntrySet_addNotSupported() {
}
}


public void testEntrySet_clear() {
for (LoadingCache<Object, Object> cache : caches()) {
warmUp(cache, 0, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ protected Map<String, String> create(Entry<String, String>[] entries) {
}
}


public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(LocalCacheTest.class);
Expand Down Expand Up @@ -700,6 +701,7 @@ public void testValues() {
assertEquals(1, map.size());
}


public void testCopyEntry_computing() {
final CountDownLatch startSignal = new CountDownLatch(1);
final CountDownLatch computingSignal = new CountDownLatch(1);
Expand Down Expand Up @@ -801,6 +803,7 @@ public void onRemoval(RemovalNotification<Object, Object> notification) {
checkLogged(e);
}


public void testRemovalListener_replaced_computing() {
final CountDownLatch startSignal = new CountDownLatch(1);
final CountDownLatch computingSignal = new CountDownLatch(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void testStatsNoops() {
assertThat(map).containsEntry(three, one);
assertThat(map).containsEntry(one, two);

// TODO(cgruber): Confirm with fry@ that this is a reasonable substitute.
// TODO(user): Confirm with fry@ that this is a reasonable substitute.
// Set<Entry<Object, Object>> entries = map.entrySet();
// assertThat(entries).containsExactly(
// Maps.immutableEntry(three, one), Maps.immutableEntry(one, two));
Expand Down Expand Up @@ -293,6 +293,7 @@ public void testAsMapRecency() {
assertFalse(segment.recencyQueue.isEmpty());
}


public void testRecursiveComputation() throws InterruptedException {
final AtomicReference<LoadingCache<Integer, String>> cacheRef = new AtomicReference<>();
CacheLoader<Integer, String> recursiveLoader =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public void testRemove_byKeyAndValue() {
}
}


public void testKeySet_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
Set<Object> keys = cache.asMap().keySet();
Expand Down Expand Up @@ -237,6 +238,7 @@ public void testValues_populated() {
}
}


public void testEntrySet_populated() {
for (LoadingCache<Object, Object> cache : caches()) {
Set<Entry<Object, Object>> entries = cache.asMap().entrySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public Integer computeNext() {
}
}


@GwtIncompatible // weak references
public void testFreesNextReference() {
Iterator<Object> itr =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public void testAsMapOfRanges() {
}
}


public void testSubRangeMap() {
for (Range<Integer> range1 : RANGES) {
for (Range<Integer> range2 : RANGES) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public void testWeak_builder() {
assertEquals(concurrencyLevel, internerImpl.map.concurrencyLevel);
}


public void testWeak_afterGC() throws InterruptedException {
Integer canonical = new Integer(5);
Integer not = new Integer(5);
Expand Down
20 changes: 10 additions & 10 deletions android/guava-tests/test/com/google/common/collect/QueuesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ public void testMultipleProducers() throws Exception {

private void testMultipleProducers(BlockingQueue<Object> q) throws InterruptedException {
for (boolean interruptibly : new boolean[] {true, false}) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = threadPool.submit(new Producer(q, 20));
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError1 = threadPool.submit(new Producer(q, 20));
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError2 = threadPool.submit(new Producer(q, 20));
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError3 = threadPool.submit(new Producer(q, 20));
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError4 = threadPool.submit(new Producer(q, 20));

List<Object> buf = newArrayList();
Expand Down Expand Up @@ -182,7 +182,7 @@ public void testNegativeMaxElements() throws Exception {
}

private void testNegativeMaxElements(BlockingQueue<Object> q) throws InterruptedException {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = threadPool.submit(new Producer(q, 1));

List<Object> buf = newArrayList();
Expand All @@ -201,7 +201,7 @@ public void testDrain_throws() throws Exception {
}

private void testDrain_throws(BlockingQueue<Object> q) {
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = threadPool.submit(new Interrupter(currentThread()));
try {
Queues.drain(q, ImmutableList.of(), 100, MAX_VALUE, NANOSECONDS);
Expand All @@ -218,7 +218,7 @@ public void testDrainUninterruptibly_doesNotThrow() throws Exception {

private void testDrainUninterruptibly_doesNotThrow(final BlockingQueue<Object> q) {
final Thread mainThread = currentThread();
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError =
threadPool.submit(
new Callable<Void>() {
Expand Down Expand Up @@ -275,7 +275,7 @@ private void assertInterruptibleDrained(BlockingQueue<Object> q) {
}

// but does the wait actually occurs?
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = threadPool.submit(new Interrupter(currentThread()));
try {
// if waiting works, this should get stuck
Expand All @@ -291,7 +291,7 @@ private void assertUninterruptibleDrained(BlockingQueue<Object> q) {
assertEquals(0, Queues.drainUninterruptibly(q, ImmutableList.of(), 0, 10, MILLISECONDS));

// but does the wait actually occurs?
@SuppressWarnings("unused") // go/futurereturn-lsc
@SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored
Future<?> possiblyIgnoredError = threadPool.submit(new Interrupter(currentThread()));

Stopwatch timer = Stopwatch.createStarted();
Expand Down

0 comments on commit 2b55799

Please sign in to comment.