Skip to content

Commit cbba1f7

Browse files
Vincent PotucekGoogle Java Core Libraries
authored andcommitted
Apply RemoveUnusedPrivateMethods.
Fixes #7938 RELNOTES=n/a PiperOrigin-RevId: 793787039
1 parent ece6340 commit cbba1f7

File tree

6 files changed

+0
-122
lines changed

6 files changed

+0
-122
lines changed

android/guava-tests/test/com/google/common/cache/CacheReferencesTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
import static com.google.common.cache.LocalCache.Strength.STRONG;
1818
import static com.google.common.collect.Maps.immutableEntry;
1919
import static com.google.common.truth.Truth.assertThat;
20-
import static java.lang.Math.max;
2120

2221
import com.google.common.base.Function;
2322
import com.google.common.cache.LocalCache.Strength;
24-
import com.google.common.cache.TestingRemovalListeners.CountingRemovalListener;
2523
import com.google.common.collect.ImmutableSet;
2624
import com.google.common.collect.Iterables;
2725
import java.lang.ref.WeakReference;
@@ -125,41 +123,6 @@ public void testInvalidate() {
125123

126124
// fails in Maven with 64-bit JDK: https://github.com/google/guava/issues/1568
127125

128-
private void assertCleanup(
129-
LoadingCache<Integer, String> cache,
130-
CountingRemovalListener<Integer, String> removalListener) {
131-
132-
// initialSize will most likely be 2, but it's possible for the GC to have already run, so we'll
133-
// observe a size of 1
134-
long initialSize = cache.size();
135-
assertTrue(initialSize == 1 || initialSize == 2);
136-
137-
// wait up to 5s
138-
byte[] filler = new byte[1024];
139-
for (int i = 0; i < 500; i++) {
140-
System.gc();
141-
142-
CacheTesting.drainReferenceQueues(cache);
143-
if (cache.size() == 1) {
144-
break;
145-
}
146-
try {
147-
Thread.sleep(10);
148-
} catch (InterruptedException e) {
149-
/* ignore */
150-
}
151-
try {
152-
// Fill up heap so soft references get cleared.
153-
filler = new byte[max(filler.length, filler.length * 2)];
154-
} catch (OutOfMemoryError e) {
155-
}
156-
}
157-
158-
CacheTesting.processPendingNotifications(cache);
159-
assertEquals(1, cache.size());
160-
assertEquals(1, removalListener.getCount());
161-
}
162-
163126
// A simple type whose .toString() will return the same value each time, but without maintaining
164127
// a strong reference to that value.
165128
static class Key {

android/guava-tests/test/com/google/common/reflect/ClassPathTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,6 @@ public void testGetClassPathUrls() throws Exception {
404404
}
405405
}
406406

407-
private static boolean contentEquals(URL left, URL right) throws IOException {
408-
return Resources.asByteSource(left).contentEquals(Resources.asByteSource(right));
409-
}
410-
411407
private static class Nested {}
412408

413409

android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import com.google.common.annotations.GwtIncompatible;
2626
import com.google.common.annotations.J2ktIncompatible;
27-
import com.google.common.base.Function;
2827
import com.google.common.testing.GcFinalization;
2928
import com.google.common.testing.TestLogHandler;
3029
import com.google.j2objc.annotations.J2ObjCIncompatible;
@@ -304,25 +303,6 @@ public Integer call() {
304303
.isLessThan(Thread.currentThread().getStackTrace().length + 100);
305304
}
306305

307-
private static Function<Integer, Integer> add(int delta) {
308-
return new Function<Integer, Integer>() {
309-
@Override
310-
public Integer apply(Integer input) {
311-
return input + delta;
312-
}
313-
};
314-
}
315-
316-
private static AsyncCallable<Integer> asyncAdd(
317-
ListenableFuture<Integer> future, int delta, Executor executor) {
318-
return new AsyncCallable<Integer>() {
319-
@Override
320-
public ListenableFuture<Integer> call() throws Exception {
321-
return Futures.transform(future, add(delta), executor);
322-
}
323-
};
324-
}
325-
326306
private static final class LongHolder {
327307
long count;
328308
}

guava-tests/test/com/google/common/cache/CacheReferencesTest.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
import static com.google.common.cache.LocalCache.Strength.STRONG;
1818
import static com.google.common.collect.Maps.immutableEntry;
1919
import static com.google.common.truth.Truth.assertThat;
20-
import static java.lang.Math.max;
2120

2221
import com.google.common.base.Function;
2322
import com.google.common.cache.LocalCache.Strength;
24-
import com.google.common.cache.TestingRemovalListeners.CountingRemovalListener;
2523
import com.google.common.collect.ImmutableSet;
2624
import com.google.common.collect.Iterables;
2725
import java.lang.ref.WeakReference;
@@ -125,41 +123,6 @@ public void testInvalidate() {
125123

126124
// fails in Maven with 64-bit JDK: https://github.com/google/guava/issues/1568
127125

128-
private void assertCleanup(
129-
LoadingCache<Integer, String> cache,
130-
CountingRemovalListener<Integer, String> removalListener) {
131-
132-
// initialSize will most likely be 2, but it's possible for the GC to have already run, so we'll
133-
// observe a size of 1
134-
long initialSize = cache.size();
135-
assertTrue(initialSize == 1 || initialSize == 2);
136-
137-
// wait up to 5s
138-
byte[] filler = new byte[1024];
139-
for (int i = 0; i < 500; i++) {
140-
System.gc();
141-
142-
CacheTesting.drainReferenceQueues(cache);
143-
if (cache.size() == 1) {
144-
break;
145-
}
146-
try {
147-
Thread.sleep(10);
148-
} catch (InterruptedException e) {
149-
/* ignore */
150-
}
151-
try {
152-
// Fill up heap so soft references get cleared.
153-
filler = new byte[max(filler.length, filler.length * 2)];
154-
} catch (OutOfMemoryError e) {
155-
}
156-
}
157-
158-
CacheTesting.processPendingNotifications(cache);
159-
assertEquals(1, cache.size());
160-
assertEquals(1, removalListener.getCount());
161-
}
162-
163126
// A simple type whose .toString() will return the same value each time, but without maintaining
164127
// a strong reference to that value.
165128
static class Key {

guava-tests/test/com/google/common/reflect/ClassPathTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,6 @@ public void testGetClassPathUrls() throws Exception {
470470
}
471471
}
472472

473-
private static boolean contentEquals(URL left, URL right) throws IOException {
474-
return Resources.asByteSource(left).contentEquals(Resources.asByteSource(right));
475-
}
476-
477473
private static class Nested {}
478474

479475

guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import com.google.common.annotations.GwtIncompatible;
2626
import com.google.common.annotations.J2ktIncompatible;
27-
import com.google.common.base.Function;
2827
import com.google.common.testing.GcFinalization;
2928
import com.google.common.testing.TestLogHandler;
3029
import com.google.j2objc.annotations.J2ObjCIncompatible;
@@ -304,25 +303,6 @@ public Integer call() {
304303
.isLessThan(Thread.currentThread().getStackTrace().length + 100);
305304
}
306305

307-
private static Function<Integer, Integer> add(int delta) {
308-
return new Function<Integer, Integer>() {
309-
@Override
310-
public Integer apply(Integer input) {
311-
return input + delta;
312-
}
313-
};
314-
}
315-
316-
private static AsyncCallable<Integer> asyncAdd(
317-
ListenableFuture<Integer> future, int delta, Executor executor) {
318-
return new AsyncCallable<Integer>() {
319-
@Override
320-
public ListenableFuture<Integer> call() throws Exception {
321-
return Futures.transform(future, add(delta), executor);
322-
}
323-
};
324-
}
325-
326306
private static final class LongHolder {
327307
long count;
328308
}

0 commit comments

Comments
 (0)