diff options
770 files changed, 9179 insertions, 6419 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df20b1ac9..ea5961ae0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,9 @@ jobs: with: access_token: ${{ github.token }} - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} @@ -57,9 +57,9 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} @@ -86,9 +86,9 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} diff --git a/Android.bp b/Android.bp index 376abe982..6a861aa81 100644 --- a/Android.bp +++ b/Android.bp @@ -108,6 +108,11 @@ java_library_host { "error_prone_annotations", ], java_version: "1.8", + errorprone: { + javacflags: [ + "-Xep:NoCanIgnoreReturnValueOnClasses:WARN", + ], + }, } java_library_host { @@ -121,6 +126,11 @@ java_library_host { "junit", ], java_version: "1.8", + errorprone: { + javacflags: [ + "-Xep:ReturnValueIgnored:WARN", + ], + }, } // Guava for Android can't compile against an Android bootclasspath, compile @@ -135,6 +145,11 @@ java_library_host { "error_prone_annotations", ], java_version: "1.8", + errorprone: { + javacflags: [ + "-Xep:NoCanIgnoreReturnValueOnClasses:WARN", + ], + }, } java_host_for_device { @@ -142,19 +157,22 @@ java_host_for_device { libs: ["guava-android-host"], } -// Compatibility name for existing host modules -java_library_host { - name: "guavalib", - static_libs: ["guava"], -} - // Compile dummy implementations of annotations used by guava but not // present in the Android tree. +// 30 may not be the lowest min_sdk_version, but the min sdk version +// for permission controller. java_library { name: "guava-android-annotation-stubs", host_supported: true, + // b/267831518: Pin tradefed and dependencies to Java 11. + java_version: "11", sdk_version: "core_current", + min_sdk_version: "30", srcs: ["android-annotation-stubs/src/**/*.java"], + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], } // Compile guava testlib @@ -167,4 +185,9 @@ java_library { "guava-android-annotation-stubs", "junit", ], + errorprone: { + javacflags: [ + "-Xep:ReturnValueIgnored:WARN", + ], + }, } diff --git a/BUILD b/BUILD deleted file mode 100644 index 22c9e622f..000000000 --- a/BUILD +++ /dev/null @@ -1,58 +0,0 @@ -# TODO(b/198224074): auto-generate this file using bp2build. -# - -alias( - name = "guava", - actual = select({ - "//build/bazel/platforms/os:android": ":guava-android-host", - "//conditions:default": ":guava-jre", - }), - visibility = ["//visibility:public"], -) - -java_library( - name = "guava-android-host", - srcs = glob(["android/guava/src/**/*.java"]), - visibility = ["//visibility:public"], - deps = [ - ":guava-android-annotation-stubs", - ":guava-both", - "//external/error_prone:error_prone_annotations", - ], - exports = [ - ":guava-both", - ], - target_compatible_with = ["//build/bazel/platforms/os:android"], -) - -java_library( - name = "guava-android-annotation-stubs", - srcs = glob(["android-annotation-stubs/src/**/*.java"]), -) - -java_library( - name = "guava-both", - srcs = glob(["futures/failureaccess/**/*.java"]), - deps = [ - ":guava-android-annotation-stubs", - "//external/error_prone:error_prone_annotations", - "//external/jsr305", - ], - exports = [ - "//external/jsr305", - ], -) - -java_library( - name = "guava-jre", - srcs = glob(["guava/src/**/*.java"]), - visibility = ["//visibility:public"], - deps = [ - ":guava-android-annotation-stubs", - ":guava-both", - "//external/error_prone:error_prone_annotations", - ], - exports = [ - ":guava-both", - ], -) @@ -9,11 +9,11 @@ third_party { type: GIT value: "https://github.com/google/guava.git" } - version: "31.0.1" + version: "31.1" license_type: NOTICE last_upgrade_date { - year: 2021 - month: 12 + year: 2022 + month: 6 day: 7 } } @@ -9,11 +9,11 @@ utilities for concurrency, I/O, hashing, caching, primitives, strings, and more! is widely used on most Java projects within Google, and widely used by many other companies as well. -Guava comes in two flavors. +Guava comes in two flavors: * The JRE flavor requires JDK 1.8 or higher. -* If you need support for JDK 1.7 or Android, use the Android flavor. You can - find the Android Guava source in the [`android` directory]. +* If you need support for Android, use the Android flavor. You can find the + Android Guava source in the [`android` directory]. [`android` directory]: https://github.com/google/guava/tree/master/android @@ -21,9 +21,9 @@ Guava comes in two flavors. Guava's Maven group ID is `com.google.guava`, and its artifact ID is `guava`. Guava provides two different "flavors": one for use on a (Java 8+) JRE and one -for use on Android or Java 7 or by any library that wants to be compatible with -either of those. These flavors are specified in the Maven version field as -either `31.0.1-jre` or `31.0.1-android`. For more about depending on Guava, see +for use on Android or by any library that wants to be compatible with Android. +These flavors are specified in the Maven version field as either `31.1-jre` or +`31.1-android`. For more about depending on Guava, see [using Guava in your build]. To add a dependency on Guava using Maven, use the following: @@ -32,9 +32,9 @@ To add a dependency on Guava using Maven, use the following: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> <!-- or, for Android: --> - <version>31.0.1-android</version> + <version>31.1-android</version> </dependency> ``` @@ -45,16 +45,16 @@ dependencies { // Pick one: // 1. Use Guava in your implementation only: - implementation("com.google.guava:guava:31.0.1-jre") + implementation("com.google.guava:guava:31.1-jre") // 2. Use Guava types in your public API: - api("com.google.guava:guava:31.0.1-jre") + api("com.google.guava:guava:31.1-jre") // 3. Android - Use Guava in your implementation only: - implementation("com.google.guava:guava:31.0.1-android") + implementation("com.google.guava:guava:31.1-android") // 4. Android - Use Guava types in your public API: - api("com.google.guava:guava:31.0.1-android") + api("com.google.guava:guava:31.1-android") } ``` diff --git a/android/guava-bom/pom.xml b/android/guava-bom/pom.xml index b0afa45f9..736c02fd8 100644 --- a/android/guava-bom/pom.xml +++ b/android/guava-bom/pom.xml @@ -8,7 +8,7 @@ <groupId>com.google.guava</groupId> <artifactId>guava-bom</artifactId> - <version>31.0.1-android</version> + <version>31.1-android</version> <packaging>pom</packaging> <parent> diff --git a/android/guava-testlib/pom.xml b/android/guava-testlib/pom.xml index 8e67de760..1fcf05867 100644 --- a/android/guava-testlib/pom.xml +++ b/android/guava-testlib/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-android</version> + <version>31.1-android</version> </parent> <artifactId>guava-testlib</artifactId> <name>Guava Testing Library</name> @@ -19,10 +19,6 @@ <artifactId>jsr305</artifactId> </dependency> <dependency> - <groupId>org.checkerframework</groupId> - <artifactId>checker-compat-qual</artifactId> - </dependency> - <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> </dependency> diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index a5674d3db..b86ef1750 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -188,7 +188,7 @@ public abstract class AbstractContainerTester<C, E> E[] elements = createSamplesArray(); E duplicate = elements[(elements.length / 2) - 1]; elements[(elements.length / 2) + 1] = duplicate; - return new ArrayWithDuplicate<E>(elements, duplicate); + return new ArrayWithDuplicate<>(elements, duplicate); } // Helper methods to improve readability of derived classes @@ -211,7 +211,7 @@ public abstract class AbstractContainerTester<C, E> * requirement {@link com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER}. */ protected List<E> getOrderedElements() { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) { list.add(e); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index 090442edc..5e0de3ccc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -72,8 +72,8 @@ public abstract class AbstractMapTester<K, V> /** @return an array of the proper size with {@code null} as the key of the middle element. */ protected Entry<K, V>[] createArrayWithNullKey() { Entry<K, V>[] array = createSamplesArray(); - final int nullKeyLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullKeyLocation]; + int nullKeyLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullKeyLocation]; array[nullKeyLocation] = entry(null, oldEntry.getValue()); return array; } @@ -97,8 +97,8 @@ public abstract class AbstractMapTester<K, V> /** @return an array of the proper size with {@code null} as the value of the middle element. */ protected Entry<K, V>[] createArrayWithNullValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullValueLocation]; + int nullValueLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullValueLocation]; array[nullValueLocation] = entry(oldEntry.getKey(), null); return array; } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 3588e856f..a04d3ffe3 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -96,9 +96,9 @@ public final class DerivedCollectionGenerators { public MapKeySetGenerator(OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<K>( + new SampleElements<>( mapSamples.e0().getKey(), mapSamples.e1().getKey(), mapSamples.e2().getKey(), @@ -203,9 +203,9 @@ public final class DerivedCollectionGenerators { public MapValueCollectionGenerator( OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<V>( + new SampleElements<>( mapSamples.e0().getValue(), mapSamples.e1().getValue(), mapSamples.e2().getValue(), @@ -239,14 +239,13 @@ public final class DerivedCollectionGenerators { @Override public V[] createArray(int length) { // noinspection UnnecessaryLocalVariable - final V[] vs = - ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); + V[] vs = ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); return vs; } @Override public Iterable<V> order(List<V> insertionOrder) { - final List<Entry<K, V>> orderedEntries = + List<Entry<K, V>> orderedEntries = castOrCopyToList(mapGenerator.order(castOrCopyToList(mapGenerator.getSampleElements(5)))); sort( insertionOrder, diff --git a/android/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java index b629fa90f..db086aa30 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java @@ -185,7 +185,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< TestSuite suite = new TestSuite(name); for (Class<? extends AbstractTester> testerClass : testers) { - final TestSuite testerSuite = + TestSuite testerSuite = makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass); if (testerSuite.countTestCases() > 0) { suite.addTest(testerSuite); @@ -211,7 +211,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< protected abstract List<Class<? extends AbstractTester>> getTesters(); private boolean matches(Test test) { - final Method method; + Method method; try { method = extractMethod(test); } catch (IllegalArgumentException e) { @@ -222,7 +222,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< logger.finer(Platform.format("%s: excluding because it was explicitly suppressed.", test)); return false; } - final TesterRequirements requirements; + TesterRequirements requirements; try { requirements = FeatureUtil.getTesterRequirements(method); } catch (ConflictingRequirementsException e) { @@ -268,8 +268,8 @@ public abstract class FeatureSpecificTestSuiteBuilder< } protected TestSuite makeSuiteForTesterClass(Class<? extends AbstractTester<?>> testerClass) { - final TestSuite candidateTests = new TestSuite(testerClass); - final TestSuite suite = filterSuite(candidateTests); + TestSuite candidateTests = new TestSuite(testerClass); + TestSuite suite = filterSuite(candidateTests); Enumeration<?> allTests = suite.tests(); while (allTests.hasMoreElements()) { @@ -286,7 +286,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< private TestSuite filterSuite(TestSuite suite) { TestSuite filtered = new TestSuite(suite.getName()); - final Enumeration<?> tests = suite.tests(); + Enumeration<?> tests = suite.tests(); while (tests.hasMoreElements()) { Test test = (Test) tests.nextElement(); if (matches(test)) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java index 8efafc373..aac71cc4e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -49,7 +49,7 @@ public class Helpers { // Clone of Lists.newArrayList public static <E> List<E> copyToList(Iterable<? extends E> elements) { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); addAll(list, elements); return list; } @@ -60,7 +60,7 @@ public class Helpers { // Clone of Sets.newLinkedHashSet public static <E> Set<E> copyToSet(Iterable<? extends E> elements) { - Set<E> set = new LinkedHashSet<E>(); + Set<E> set = new LinkedHashSet<>(); addAll(set, elements); return set; } @@ -188,11 +188,11 @@ public class Helpers { return modified; } - static <T> Iterable<T> reverse(final List<T> list) { + static <T> Iterable<T> reverse(List<T> list) { return new Iterable<T>() { @Override public Iterator<T> iterator() { - final ListIterator<T> listIter = list.listIterator(list.size()); + ListIterator<T> listIter = list.listIterator(list.size()); return new Iterator<T>() { @Override public boolean hasNext() { @@ -213,7 +213,7 @@ public class Helpers { }; } - static <T> Iterator<T> cycle(final Iterable<T> iterable) { + static <T> Iterator<T> cycle(Iterable<T> iterable) { return new Iterator<T>() { Iterator<T> iterator = Collections.<T>emptySet().iterator(); @@ -251,7 +251,7 @@ public class Helpers { } public static <K, V> Comparator<Entry<K, V>> entryComparator( - final Comparator<? super K> keyComparator) { + Comparator<? super K> keyComparator) { return new Comparator<Entry<K, V>>() { @Override @SuppressWarnings("unchecked") // no less safe than putting it in the map! @@ -345,7 +345,7 @@ public class Helpers { * @param delta the difference between the true size of the collection and the values returned by * the size method */ - public static <T> Collection<T> misleadingSizeCollection(final int delta) { + public static <T> Collection<T> misleadingSizeCollection(int delta) { // It would be nice to be able to return a real concurrent // collection like ConcurrentLinkedQueue, so that e.g. concurrent // iteration would work, but that would not be GWT-compatible. @@ -363,7 +363,7 @@ public class Helpers { * equals. This is used for testing unmodifiable collections of map entries; for example, it * should not be possible to access the raw (modifiable) map entry via a nefarious equals method. */ - public static <K, V> Entry<K, V> nefariousMapEntry(final K key, final V value) { + public static <K, V> Entry<K, V> nefariousMapEntry(K key, V value) { return new Entry<K, V>() { @Override public K getKey() { @@ -410,7 +410,7 @@ public class Helpers { if (iterable instanceof List) { return (List<E>) iterable; } - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : iterable) { list.add(e); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index b8b5c28fb..484913878 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -149,7 +149,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { for (V value : values) { if (value != null) { try { - value.hashCode(); + int unused = value.hashCode(); } catch (Exception e) { return false; } @@ -265,7 +265,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { protected void assertMoreInvariants(Map<K, V> map) {} public void testClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -286,8 +286,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testContainsKey() { - final Map<K, V> map; - final K unmappedKey; + Map<K, V> map; + K unmappedKey; try { map = makePopulatedMap(); unmappedKey = getKeyNotInPopulatedMap(); @@ -312,8 +312,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testContainsValue() { - final Map<K, V> map; - final V unmappedValue; + Map<K, V> map; + V unmappedValue; try { map = makePopulatedMap(); unmappedValue = getValueNotInPopulatedMap(); @@ -334,8 +334,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySet() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -344,8 +344,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final K unmappedKey; - final V unmappedValue; + K unmappedKey; + V unmappedValue; try { unmappedKey = getKeyNotInPopulatedMap(); unmappedValue = getValueNotInPopulatedMap(); @@ -359,7 +359,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -369,8 +369,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetContainsEntryIncompatibleKey() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -379,7 +379,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -396,8 +396,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!allowsNullKeys || !supportsPut) { return; } - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -406,7 +406,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -420,8 +420,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetContainsEntryNullKeyMissing() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -430,7 +430,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -450,7 +450,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetIteratorRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -488,7 +488,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -512,8 +512,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveMissingKey() { - final Map<K, V> map; - final K key; + Map<K, V> map; + K key; try { map = makeEitherMap(); key = getKeyNotInPopulatedMap(); @@ -540,7 +540,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveDifferentValue() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -570,8 +570,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!allowsNullKeys || !supportsPut || !supportsRemove) { return; } - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -580,7 +580,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -597,7 +597,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveNullKeyMissing() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -626,7 +626,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -663,7 +663,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -689,7 +689,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -717,7 +717,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -743,7 +743,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -765,10 +765,10 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetAddAndAddAll() { - final Map<K, V> map = makeEitherMap(); + Map<K, V> map = makeEitherMap(); Set<Entry<K, V>> entrySet = map.entrySet(); - final Entry<K, V> entryToAdd = mapEntry(null, null); + Entry<K, V> entryToAdd = mapEntry(null, null); try { entrySet.add(entryToAdd); fail("Expected UnsupportedOperationException or NullPointerException."); @@ -793,8 +793,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final V valueToSet; + Map<K, V> map; + V valueToSet; try { map = makePopulatedMap(); valueToSet = getValueNotInPopulatedMap(); @@ -804,8 +804,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { Set<Entry<K, V>> entrySet = map.entrySet(); Entry<K, V> entry = entrySet.iterator().next(); - final V oldValue = entry.getValue(); - final V returnedValue = entry.setValue(valueToSet); + V oldValue = entry.getValue(); + V returnedValue = entry.setValue(valueToSet); assertEquals(oldValue, returnedValue); assertTrue(entrySet.contains(mapEntry(entry.getKey(), valueToSet))); assertEquals(valueToSet, map.get(entry.getKey())); @@ -819,7 +819,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -828,8 +828,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { Set<Entry<K, V>> entrySet = map.entrySet(); Entry<K, V> entry = entrySet.iterator().next(); - final V oldValue = entry.getValue(); - final V returnedValue = entry.setValue(oldValue); + V oldValue = entry.getValue(); + V returnedValue = entry.setValue(oldValue); assertEquals(oldValue, returnedValue); assertTrue(entrySet.contains(mapEntry(entry.getKey(), oldValue))); assertEquals(oldValue, map.get(entry.getKey())); @@ -837,15 +837,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEqualsForEqualMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { return; } - assertEquals(map, map); - assertEquals(makePopulatedMap(), map); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(map.equals(map)); + assertTrue(makePopulatedMap().equals(map)); assertFalse(map.equals(Collections.emptyMap())); // no-inspection ObjectEqualsNull assertFalse(map.equals(null)); @@ -856,8 +857,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final Map<K, V> largerMap; + Map<K, V> map; + Map<K, V> largerMap; try { map = makePopulatedMap(); largerMap = makePopulatedMap(); @@ -874,8 +875,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final Map<K, V> smallerMap; + Map<K, V> map; + Map<K, V> smallerMap; try { map = makePopulatedMap(); smallerMap = makePopulatedMap(); @@ -888,15 +889,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEqualsForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { return; } - assertEquals(map, map); - assertEquals(makeEmptyMap(), map); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(map.equals(map)); + assertTrue(makeEmptyMap().equals(map)); assertEquals(Collections.emptyMap(), map); assertFalse(map.equals(Collections.emptySet())); // noinspection ObjectEqualsNull @@ -904,7 +906,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testGet() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -925,7 +927,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testGetForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; K unmappedKey = null; try { map = makeEmptyMap(); @@ -954,7 +956,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testHashCode() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -964,7 +966,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testHashCodeForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -974,9 +976,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutNewKey() { - final Map<K, V> map = makeEitherMap(); - final K keyToPut; - final V valueToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; + V valueToPut; try { keyToPut = getKeyNotInPopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1002,9 +1004,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutExistingKey() { - final Map<K, V> map; - final K keyToPut; - final V valueToPut; + Map<K, V> map; + K keyToPut; + V valueToPut; try { map = makePopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1033,16 +1035,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map = makeEitherMap(); - final V valueToPut; + Map<K, V> map = makeEitherMap(); + V valueToPut; try { valueToPut = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { return; } if (allowsNullKeys) { - final V oldValue = map.get(null); - final V returnedValue = map.put(null, valueToPut); + V oldValue = map.get(null); + V returnedValue = map.put(null, valueToPut); assertEquals(oldValue, returnedValue); assertEquals(valueToPut, map.get(null)); assertTrue(map.containsKey(null)); @@ -1061,8 +1063,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map = makeEitherMap(); - final K keyToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; try { keyToPut = getKeyNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1070,8 +1072,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } if (allowsNullValues) { int initialSize = map.size(); - final V oldValue = map.get(keyToPut); - final V returnedValue = map.put(keyToPut, null); + V oldValue = map.get(keyToPut); + V returnedValue = map.put(keyToPut, null); assertEquals(oldValue, returnedValue); assertNull(map.get(keyToPut)); assertTrue(map.containsKey(keyToPut)); @@ -1091,8 +1093,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map; - final K keyToPut; + Map<K, V> map; + K keyToPut; try { map = makePopulatedMap(); keyToPut = map.keySet().iterator().next(); @@ -1101,8 +1103,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } if (allowsNullValues) { int initialSize = map.size(); - final V oldValue = map.get(keyToPut); - final V returnedValue = map.put(keyToPut, null); + V oldValue = map.get(keyToPut); + V returnedValue = map.put(keyToPut, null); assertEquals(oldValue, returnedValue); assertNull(map.get(keyToPut)); assertTrue(map.containsKey(keyToPut)); @@ -1119,16 +1121,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutAllNewKey() { - final Map<K, V> map = makeEitherMap(); - final K keyToPut; - final V valueToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; + V valueToPut; try { keyToPut = getKeyNotInPopulatedMap(); valueToPut = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { return; } - final Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); + Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); if (supportsPut) { int initialSize = map.size(); map.putAll(mapToPut); @@ -1147,9 +1149,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutAllExistingKey() { - final Map<K, V> map; - final K keyToPut; - final V valueToPut; + Map<K, V> map; + K keyToPut; + V valueToPut; try { map = makePopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1157,7 +1159,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } keyToPut = map.keySet().iterator().next(); - final Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); + Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); int initialSize = map.size(); if (supportsPut) { map.putAll(mapToPut); @@ -1176,8 +1178,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testRemove() { - final Map<K, V> map; - final K keyToRemove; + Map<K, V> map; + K keyToRemove; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1202,8 +1204,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testRemoveMissingKey() { - final Map<K, V> map; - final K keyToRemove; + Map<K, V> map; + K keyToRemove; try { map = makePopulatedMap(); keyToRemove = getKeyNotInPopulatedMap(); @@ -1229,7 +1231,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1254,7 +1256,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1279,7 +1281,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1303,7 +1305,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -1325,7 +1327,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1351,7 +1353,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1377,8 +1379,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValues() { - final Map<K, V> map; - final Collection<V> valueCollection; + Map<K, V> map; + Collection<V> valueCollection; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1387,7 +1389,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); valueCollection = map.values(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1399,7 +1401,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesIteratorRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1434,7 +1436,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1460,8 +1462,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveMissing() { - final Map<K, V> map; - final V valueToRemove; + Map<K, V> map; + V valueToRemove; try { map = makeEitherMap(); valueToRemove = getValueNotInPopulatedMap(); @@ -1485,7 +1487,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1513,7 +1515,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1539,7 +1541,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1567,7 +1569,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1593,7 +1595,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index a6ec93d1e..2adf07251 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -33,12 +33,12 @@ public class MinimalCollection<E> extends AbstractCollection<E> { // TODO: expose allow nulls parameter? public static <E> MinimalCollection<E> of(E... contents) { - return new MinimalCollection<E>(Object.class, true, contents); + return new MinimalCollection<>(Object.class, true, contents); } // TODO: use this public static <E> MinimalCollection<E> ofClassAndContents(Class<? super E> type, E... contents) { - return new MinimalCollection<E>(type, true, contents); + return new MinimalCollection<>(type, true, contents); } private final E[] contents; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java index c151c15e1..15d48dbbd 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java @@ -51,7 +51,7 @@ public final class MinimalIterable<E> implements Iterable<E> { /** Returns an iterable whose iterator returns the given elements in order. */ public static <E> MinimalIterable<E> of(E... elements) { // Make sure to get an unmodifiable iterator - return new MinimalIterable<E>(Arrays.asList(elements).iterator()); + return new MinimalIterable<>(Arrays.asList(elements).iterator()); } /** @@ -59,7 +59,7 @@ public final class MinimalIterable<E> implements Iterable<E> { * out of the source collection at the time this method is called. */ @SuppressWarnings("unchecked") // Es come in, Es go out - public static <E> MinimalIterable<E> from(final Collection<E> elements) { + public static <E> MinimalIterable<E> from(Collection<E> elements) { return (MinimalIterable) of(elements.toArray()); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 988dd3f95..9a87d244d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -45,13 +45,13 @@ public class MinimalSet<E> extends MinimalCollection<E> implements Set<E> { public static <E> MinimalSet<E> ofClassAndContents( Class<? super E> type, E[] emptyArrayForContents, Iterable<? extends E> contents) { - List<E> setContents = new ArrayList<E>(); + List<E> setContents = new ArrayList<>(); for (E e : contents) { if (!setContents.contains(e)) { setContents.add(e); } } - return new MinimalSet<E>(type, setContents.toArray(emptyArrayForContents)); + return new MinimalSet<>(type, setContents.toArray(emptyArrayForContents)); } private MinimalSet(Class<? super E> type, E... contents) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java index 77a198454..0e1a22920 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java @@ -116,10 +116,10 @@ public class NavigableMapTestSuiteBuilder<K, V> extends SortedMapTestSuiteBuilde /** Create a suite whose maps are descending views of other maps. */ private TestSuite createDescendingSuite( - final FeatureSpecificTestSuiteBuilder< + FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { - final TestSortedMapGenerator<K, V> delegate = + TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java index 38eb56e09..4c86ab462 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java @@ -40,7 +40,7 @@ import junit.framework.TestSuite; @GwtIncompatible public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBuilder<E> { public static <E> NavigableSetTestSuiteBuilder<E> using(TestSortedSetGenerator<E> generator) { - NavigableSetTestSuiteBuilder<E> builder = new NavigableSetTestSuiteBuilder<E>(); + NavigableSetTestSuiteBuilder<E> builder = new NavigableSetTestSuiteBuilder<>(); builder.usingGenerator(generator); return builder; } @@ -99,10 +99,9 @@ public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBui /** Create a suite whose maps are descending views of other maps. */ private TestSuite createDescendingSuite( - final FeatureSpecificTestSuiteBuilder< - ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> + FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { - final TestSetGenerator<E> delegate = + TestSetGenerator<E> delegate = (TestSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); @@ -124,7 +123,7 @@ public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBui @Override public Iterable<E> order(List<E> insertionOrder) { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : delegate.order(insertionOrder)) { list.add(e); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index 1b8924c07..1ff3facc4 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -70,7 +70,7 @@ public final class OneSizeGenerator<T, E> implements OneSizeTestContainerGenerat @SuppressWarnings("unchecked") List<E> allSampleElements = Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4()); - return new ArrayList<E>(allSampleElements.subList(0, howMany)); + return new ArrayList<>(allSampleElements.subList(0, howMany)); } @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java index 28d6f7917..923f56fd4 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java @@ -42,7 +42,7 @@ public class ReserializingTestCollectionGenerator<E> implements TestCollectionGe public static <E> ReserializingTestCollectionGenerator<E> newInstance( TestCollectionGenerator<E> delegate) { - return new ReserializingTestCollectionGenerator<E>(delegate); + return new ReserializingTestCollectionGenerator<>(delegate); } @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java index c92a3ff20..555440adc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java @@ -35,7 +35,7 @@ public class ReserializingTestSetGenerator<E> extends ReserializingTestCollectio } public static <E> TestSetGenerator<E> newInstance(TestSetGenerator<E> delegate) { - return new ReserializingTestSetGenerator<E>(delegate); + return new ReserializingTestSetGenerator<>(delegate); } @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java b/android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java index 8ed481073..91d9fd9f7 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java @@ -117,7 +117,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> descendingSet() { - return new SafeTreeSet<E>(delegate.descendingSet()); + return new SafeTreeSet<>(delegate.descendingSet()); } @Override @@ -137,7 +137,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> headSet(E toElement, boolean inclusive) { - return new SafeTreeSet<E>(delegate.headSet(checkValid(toElement), inclusive)); + return new SafeTreeSet<>(delegate.headSet(checkValid(toElement), inclusive)); } @Override @@ -198,7 +198,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { - return new SafeTreeSet<E>( + return new SafeTreeSet<>( delegate.subSet( checkValid(fromElement), fromInclusive, checkValid(toElement), toInclusive)); } @@ -215,7 +215,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> tailSet(E fromElement, boolean inclusive) { - return new SafeTreeSet<E>(delegate.tailSet(checkValid(fromElement), inclusive)); + return new SafeTreeSet<>(delegate.tailSet(checkValid(fromElement), inclusive)); } @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java b/android/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java index 829c4cc27..03266ab47 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java @@ -56,7 +56,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapWriteThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -82,7 +82,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapRemoveThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -105,7 +105,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapClearThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java index aa1d6d5e4..7944aaa6a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java @@ -105,12 +105,12 @@ public class SortedMapTestSuiteBuilder<K, V> extends MapTestSuiteBuilder<K, V> { * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubmapSuite( - final FeatureSpecificTestSuiteBuilder< + FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder, - final Bound from, - final Bound to) { - final TestSortedMapGenerator<K, V> delegate = + Bound from, + Bound to) { + TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java index 509266148..2835769e3 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java @@ -34,7 +34,7 @@ import junit.framework.TestSuite; @GwtIncompatible public class SortedSetTestSuiteBuilder<E> extends SetTestSuiteBuilder<E> { public static <E> SortedSetTestSuiteBuilder<E> using(TestSortedSetGenerator<E> generator) { - SortedSetTestSuiteBuilder<E> builder = new SortedSetTestSuiteBuilder<E>(); + SortedSetTestSuiteBuilder<E> builder = new SortedSetTestSuiteBuilder<>(); builder.usingGenerator(generator); return builder; } @@ -78,12 +78,11 @@ public class SortedSetTestSuiteBuilder<E> extends SetTestSuiteBuilder<E> { * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubsetSuite( - final FeatureSpecificTestSuiteBuilder< - ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> + FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder, - final Bound from, - final Bound to) { - final TestSortedSetGenerator<E> delegate = + Bound from, + Bound to) { + TestSortedSetGenerator<E> delegate = (TestSortedSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(parentBuilder.getFeatures()); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java b/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java index 95cbc0b3d..2d11a0863 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java @@ -139,12 +139,12 @@ public class FeatureUtil { */ static TesterRequirements buildTesterRequirements(Class<?> testerClass) throws ConflictingRequirementsException { - final TesterRequirements declaredRequirements = buildDeclaredTesterRequirements(testerClass); + TesterRequirements declaredRequirements = buildDeclaredTesterRequirements(testerClass); Class<?> baseClass = testerClass.getSuperclass(); if (baseClass == null) { return declaredRequirements; } else { - final TesterRequirements clonedBaseRequirements = + TesterRequirements clonedBaseRequirements = new TesterRequirements(getTesterRequirements(baseClass)); return incorporateRequirements(clonedBaseRequirements, declaredRequirements, testerClass); } @@ -176,8 +176,8 @@ public class FeatureUtil { private static TesterRequirements buildTesterRequirements(Annotation testerAnnotation) throws ConflictingRequirementsException { Class<? extends Annotation> annotationClass = testerAnnotation.annotationType(); - final Feature<?>[] presentFeatures; - final Feature<?>[] absentFeatures; + Feature<?>[] presentFeatures; + Feature<?>[] absentFeatures; try { presentFeatures = (Feature[]) annotationClass.getMethod("value").invoke(testerAnnotation); absentFeatures = (Feature[]) annotationClass.getMethod("absent").invoke(testerAnnotation); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index 7b7801db2..7f649e757 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java @@ -48,8 +48,8 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> /** @return an array of the proper size with {@code null} as the key of the middle element. */ protected Entry<K, V>[] createArrayWithNullKey() { Entry<K, V>[] array = createSamplesArray(); - final int nullKeyLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullKeyLocation]; + int nullKeyLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullKeyLocation]; array[nullKeyLocation] = Helpers.mapEntry(null, oldEntry.getValue()); return array; } @@ -57,8 +57,8 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> /** @return an array of the proper size with {@code null} as the value of the middle element. */ protected Entry<K, V>[] createArrayWithNullValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullValueLocation]; + int nullValueLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullValueLocation]; array[nullValueLocation] = Helpers.mapEntry(oldEntry.getKey(), null); return array; } @@ -69,7 +69,7 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> */ protected Entry<K, V>[] createArrayWithNullKeyAndValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); + int nullValueLocation = getNullLocation(); array[nullValueLocation] = Helpers.mapEntry(null, null); return array; } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index bbeefd278..35579a01d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java @@ -159,9 +159,9 @@ public final class DerivedGoogleCollectionGenerators { public BiMapValueSetGenerator( OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<V>( + new SampleElements<>( mapSamples.e0().getValue(), mapSamples.e1().getValue(), mapSamples.e2().getValue(), @@ -194,7 +194,7 @@ public final class DerivedGoogleCollectionGenerators { @Override public V[] createArray(int length) { - final V[] vs = + V[] vs = ((TestBiMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); return vs; } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index bb84ea15f..35063e815 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java @@ -54,7 +54,7 @@ public class MapGenerators { for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } - return builder.build(); + return builder.buildOrThrow(); } } @@ -86,7 +86,7 @@ public class MapGenerators { for (UnhashableObject value : elements) { builder.put(key++, value); } - return builder.build().values(); + return builder.buildOrThrow().values(); } } @@ -97,7 +97,7 @@ public class MapGenerators { for (int i = 0; i < elements.length; i++) { builder.put(elements[i], i); } - return builder.build().keySet().asList(); + return builder.buildOrThrow().keySet().asList(); } } @@ -108,7 +108,7 @@ public class MapGenerators { for (int i = 0; i < elements.length; i++) { builder.put(i, elements[i]); } - return builder.build().values().asList(); + return builder.buildOrThrow().values().asList(); } } @@ -144,7 +144,7 @@ public class MapGenerators { Entry<String, Integer> entry = (Entry<String, Integer>) o; builder.put(entry); } - return builder.build().entrySet().asList(); + return builder.buildOrThrow().entrySet().asList(); } } @@ -210,7 +210,7 @@ public class MapGenerators { Integer value = Iterables.getOnlyElement(entry.getValue()); builder.put(entry.getKey(), value); } - return builder.build().asMultimap().asMap(); + return builder.buildOrThrow().asMultimap().asMap(); } @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java index b65cd967a..ce8e283a9 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java @@ -82,7 +82,7 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> { @SuppressWarnings("unchecked") // Needed to stop Eclipse whining private void resetWithHole() { - List<E> container = new ArrayList<E>(); + List<E> container = new ArrayList<>(); container.addAll(Collections.nCopies(a.getCount(), a.getElement())); container.addAll(Collections.nCopies(c.getCount(), c.getElement())); super.resetContainer(getSubjectGenerator().create(container.toArray())); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 49187dd1d..6e7995720 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java @@ -58,7 +58,7 @@ public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, S @MapFeature.Require(SUPPORTS_REMOVE) public void testAsMapRemoveImplementsSet() { - List<K> keys = new ArrayList<K>(multimap().keySet()); + List<K> keys = new ArrayList<>(multimap().keySet()); for (K key : keys) { resetCollection(); assertTrue(multimap().asMap().remove(key) instanceof Set); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java index dafd52187..b44494b81 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java @@ -56,7 +56,7 @@ import junit.framework.TestSuite; @GwtIncompatible public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder<E> { public static <E> SortedMultisetTestSuiteBuilder<E> using(TestMultisetGenerator<E> generator) { - SortedMultisetTestSuiteBuilder<E> result = new SortedMultisetTestSuiteBuilder<E>(); + SortedMultisetTestSuiteBuilder<E> result = new SortedMultisetTestSuiteBuilder<>(); result.usingGenerator(generator); return result; } @@ -138,8 +138,8 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createSubMultisetSuite( - SortedMultisetTestSuiteBuilder<E> parentBuilder, final Bound from, final Bound to) { - final TestMultisetGenerator<E> delegate = + SortedMultisetTestSuiteBuilder<E> parentBuilder, Bound from, Bound to) { + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(); @@ -152,15 +152,15 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } SortedMultiset<E> emptyMultiset = (SortedMultiset<E>) delegate.create(); - final Comparator<? super E> comparator = emptyMultiset.comparator(); + Comparator<? super E> comparator = emptyMultiset.comparator(); SampleElements<E> samples = delegate.samples(); @SuppressWarnings("unchecked") List<E> samplesList = Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4()); Collections.sort(samplesList, comparator); - final E firstInclusive = samplesList.get(0); - final E lastInclusive = samplesList.get(samplesList.size() - 1); + E firstInclusive = samplesList.get(0); + E lastInclusive = samplesList.get(samplesList.size() - 1); return SortedMultisetTestSuiteBuilder.using( new ForwardingTestMultisetGenerator<E>(delegate) { @@ -187,7 +187,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } // the regular values should be visible after filtering - List<E> allEntries = new ArrayList<E>(); + List<E> allEntries = new ArrayList<>(); allEntries.addAll(extremeValues); allEntries.addAll(normalValues); SortedMultiset<E> multiset = @@ -234,7 +234,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createDescendingSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) { - final TestMultisetGenerator<E> delegate = + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(); @@ -263,7 +263,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) { - final TestMultisetGenerator<E> delegate = + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(parentBuilder.getFeatures()); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java index 1c00f0970..e95b74f84 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java @@ -52,7 +52,7 @@ public class SortedSetMultimapAsMapTester<K, V> @MapFeature.Require(SUPPORTS_REMOVE) public void testAsMapRemoveImplementsSortedSet() { - List<K> keys = new ArrayList<K>(multimap().keySet()); + List<K> keys = new ArrayList<>(multimap().keySet()); for (K key : keys) { resetCollection(); SortedSet<V> valueSet = (SortedSet<V>) multimap().asMap().remove(key); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index 005746f4b..40b2c859d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java @@ -201,7 +201,7 @@ public class UnmodifiableCollectionTests { * @param sampleElement an element of the same type as that contained by {@code multiset}. {@code * multiset} may or may not have {@code sampleElement} as a member. */ - public static <E> void assertMultisetIsUnmodifiable(Multiset<E> multiset, final E sampleElement) { + public static <E> void assertMultisetIsUnmodifiable(Multiset<E> multiset, E sampleElement) { Multiset<E> copy = LinkedHashMultiset.create(multiset); assertCollectionsAreEquivalent(multiset, copy); @@ -264,7 +264,7 @@ public class UnmodifiableCollectionTests { * multimap} may or may not have {@code sampleValue} as a key. */ public static <K, V> void assertMultimapIsUnmodifiable( - Multimap<K, V> multimap, final K sampleKey, final V sampleValue) { + Multimap<K, V> multimap, K sampleKey, V sampleValue) { List<Entry<K, V>> originalEntries = Collections.unmodifiableList(Lists.newArrayList(multimap.entries())); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index b17049709..1699fe19d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java @@ -51,7 +51,7 @@ import org.junit.Ignore; @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { public void testIterator() { - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } @@ -60,7 +60,7 @@ public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { @CollectionFeature.Require(KNOWN_ORDER) public void testIterationOrdering() { - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } @@ -72,7 +72,7 @@ public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { @CollectionSize.Require(absent = ZERO) public void testIterator_nullElement() { initCollectionWithNullElement(); - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java index 39016169d..8b056b4cb 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java @@ -218,7 +218,7 @@ public class NavigableSetNavigationTester<E> extends AbstractSetTester<E> { @CollectionSize.Require(SEVERAL) public void testDescendingNavigation() { - List<E> descending = new ArrayList<E>(); + List<E> descending = new ArrayList<>(); for (Iterator<E> i = navigableSet.descendingIterator(); i.hasNext(); ) { descending.add(i.next()); } diff --git a/android/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java b/android/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java index 3920afe4c..31ac2015d 100644 --- a/android/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java +++ b/android/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java @@ -18,7 +18,6 @@ package com.google.common.escape.testing; import static com.google.common.escape.Escapers.computeReplacement; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.CharEscaper; import com.google.common.escape.Escaper; @@ -32,7 +31,6 @@ import junit.framework.Assert; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible public final class EscaperAsserts { private EscaperAsserts() {} diff --git a/android/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java b/android/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java index 962b15f6d..1e31bbfb4 100644 --- a/android/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java +++ b/android/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java @@ -116,12 +116,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { * @since 19.0 */ public static final Predicate<Class<?>> UNDERSCORE_IN_NAME = - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> c) { - return c.getSimpleName().contains("_"); - } - }; + (Class<?> c) -> c.getSimpleName().contains("_"); /* The names of the expected method that tests null checks. */ private static final ImmutableList<String> NULL_TEST_METHOD_NAMES = @@ -152,12 +147,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { private final ClassSanityTester tester = new ClassSanityTester(); private Visibility visibility = Visibility.PACKAGE; private Predicate<Class<?>> classFilter = - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> cls) { - return visibility.isVisible(cls.getModifiers()); - } - }; + (Class<?> cls) -> visibility.isVisible(cls.getModifiers()); /** * Restricts the sanity tests for public API only. By default, package-private API are also @@ -415,8 +405,8 @@ public abstract class AbstractPackageSanityTests extends TestCase { abstract static class Chopper { - final Chopper or(final Chopper you) { - final Chopper i = this; + final Chopper or(Chopper you) { + Chopper i = this; return new Chopper() { @Override Optional<String> chop(String str) { @@ -427,7 +417,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { abstract Optional<String> chop(String str); - static Chopper suffix(final String suffix) { + static Chopper suffix(String suffix) { return new Chopper() { @Override Optional<String> chop(String str) { diff --git a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index 01904d6c2..26f4df474 100644 --- a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.CharMatcher; import com.google.common.base.Charsets; @@ -74,6 +73,7 @@ import com.google.common.io.CharSource; import com.google.common.primitives.Primitives; import com.google.common.primitives.UnsignedInteger; import com.google.common.primitives.UnsignedLong; +import com.google.errorprone.annotations.Keep; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -142,7 +142,7 @@ import java.util.logging.Logger; import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Supplies an arbitrary "default" instance for a wide range of types, often useful in testing @@ -166,7 +166,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableDecl; * @author Ben Yu * @since 12.0 */ -@Beta @GwtIncompatible public final class ArbitraryInstances { @@ -327,7 +326,7 @@ public final class ArbitraryInstances { } @SuppressWarnings("unchecked") // it's a subtype map - @NullableDecl + @CheckForNull private static <T> Class<? extends T> getImplementation(Class<T> type) { return (Class<? extends T>) implementations.get(type); } @@ -338,7 +337,7 @@ public final class ArbitraryInstances { * Returns an arbitrary instance for {@code type}, or {@code null} if no arbitrary instance can be * determined. */ - @NullableDecl + @CheckForNull public static <T> T get(Class<T> type) { T defaultValue = DEFAULTS.getInstance(type); if (defaultValue != null) { @@ -386,7 +385,7 @@ public final class ArbitraryInstances { } } - @NullableDecl + @CheckForNull private static <T> T arbitraryConstantInstanceOrNull(Class<T> type) { Field[] fields = type.getDeclaredFields(); Arrays.sort(fields, BY_FIELD_NAME); @@ -430,6 +429,7 @@ public final class ArbitraryInstances { } public static final class DeterministicRandom extends Random { + @Keep public DeterministicRandom() { super(0); } diff --git a/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java b/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java index 55f167edd..093178545 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java @@ -50,9 +50,9 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; import java.util.Set; +import javax.annotation.CheckForNull; import junit.framework.Assert; import junit.framework.AssertionFailedError; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tester that runs automated sanity tests for any given class. A typical use case is to test static @@ -334,7 +334,7 @@ public final class ClassSanityTester { * @return The instantiated instance, or {@code null} if the class has no non-private constructor * or factory method to be constructed. */ - @NullableDecl + @CheckForNull <T> T instantiate(Class<T> cls) throws ParameterNotInstantiableException, IllegalAccessException, InvocationTargetException, FactoryMethodReturnsNullException { @@ -383,7 +383,7 @@ public final class ClassSanityTester { * class, preventing its methods from being accessible. * @throws InvocationTargetException if a static method threw exception. */ - @NullableDecl + @CheckForNull private <T> T instantiate(Invokable<?, ? extends T> factory) throws ParameterNotInstantiableException, InvocationTargetException, IllegalAccessException { return invoke(factory, getDummyArguments(factory)); @@ -664,7 +664,7 @@ public final class ClassSanityTester { return generator; } - @NullableDecl + @CheckForNull private static Object generateDummyArg(Parameter param, FreshValueGenerator generator) throws ParameterNotInstantiableException { if (isNullable(param)) { @@ -761,7 +761,7 @@ public final class ClassSanityTester { return instance; } - @NullableDecl + @CheckForNull private static <T> T invoke(Invokable<?, ? extends T> factory, List<?> args) throws InvocationTargetException, IllegalAccessException { T returnValue = factory.invoke(null, args.toArray()); diff --git a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java index 2c8e08b87..9c93c9a49 100644 --- a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Equivalence; import com.google.common.collect.ImmutableList; @@ -74,7 +73,6 @@ import java.util.List; * @author Jige Yu * @since 10.0 */ -@Beta @GwtCompatible public final class EqualsTester { private static final int REPETITIONS = 3; @@ -122,7 +120,7 @@ public final class EqualsTester { assertTrue( item + " must not be Object#equals to an arbitrary object of another class", !item.equals(NotAnInstance.EQUAL_TO_NOTHING)); - assertEquals(item + " must be Object#equals to itself", item, item); + assertTrue(item + " must be Object#equals to itself", item.equals(item)); assertEquals( "the Object#hashCode of " + item + " must be consistent", item.hashCode(), diff --git a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ce1dc98c4..8de2625d0 100644 --- a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Equivalence; import com.google.common.collect.ImmutableList; @@ -49,7 +48,6 @@ import java.util.List; * @author Gregory Kick * @since 10.0 */ -@Beta @GwtCompatible public final class EquivalenceTester<T> { private static final int REPETITIONS = 3; @@ -60,12 +58,11 @@ public final class EquivalenceTester<T> { private EquivalenceTester(Equivalence<? super T> equivalence) { this.equivalence = checkNotNull(equivalence); - this.delegate = - new RelationshipTester<T>(equivalence, "equivalent", "hash", new ItemReporter()); + this.delegate = new RelationshipTester<>(equivalence, "equivalent", "hash", new ItemReporter()); } public static <T> EquivalenceTester<T> of(Equivalence<? super T> equivalence) { - return new EquivalenceTester<T>(equivalence); + return new EquivalenceTester<>(equivalence); } /** diff --git a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java index 698db6a00..573635393 100644 --- a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ticker; import java.util.concurrent.TimeUnit; @@ -35,7 +34,6 @@ import java.util.concurrent.atomic.AtomicLong; * @author Jige Yu * @since 10.0 */ -@Beta @GwtCompatible public class FakeTicker extends Ticker { diff --git a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 4ee461eb2..605d3a055 100644 --- a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -22,7 +22,6 @@ import static com.google.common.base.Throwables.throwIfUnchecked; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.fail; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Function; import com.google.common.base.Throwables; @@ -53,7 +52,6 @@ import java.util.concurrent.atomic.AtomicInteger; * @author Ben Yu * @since 14.0 */ -@Beta @GwtIncompatible public final class ForwardingWrapperTester { @@ -129,7 +127,7 @@ public final class ForwardingWrapperTester { private static <T> void testExceptionPropagation( Class<T> interfaceType, Method method, Function<? super T, ? extends T> wrapperFunction) { - final RuntimeException exception = new RuntimeException(); + RuntimeException exception = new RuntimeException(); T proxy = Reflection.newProxy( interfaceType, @@ -175,7 +173,7 @@ public final class ForwardingWrapperTester { private static Object[] getParameterValues(Method method) { FreshValueGenerator paramValues = new FreshValueGenerator(); - final List<Object> passedArgs = Lists.newArrayList(); + List<Object> passedArgs = Lists.newArrayList(); for (Class<?> paramType : method.getParameterTypes()) { passedArgs.add(paramValues.generateFresh(paramType)); } diff --git a/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java b/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java index 911049093..259f50c45 100644 --- a/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java +++ b/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java @@ -118,7 +118,7 @@ import java.util.TreeSet; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Generates fresh instances of types that are different from each other (if possible). @@ -137,7 +137,7 @@ class FreshValueGenerator { builder.put(method.getReturnType(), method); } } - GENERATORS = builder.build(); + GENERATORS = builder.buildOrThrow(); } private static final ImmutableMap<Class<?>, Method> EMPTY_GENERATORS; @@ -149,7 +149,7 @@ class FreshValueGenerator { builder.put(method.getReturnType(), method); } } - EMPTY_GENERATORS = builder.build(); + EMPTY_GENERATORS = builder.buildOrThrow(); } private final AtomicInteger freshness = new AtomicInteger(1); @@ -175,7 +175,7 @@ class FreshValueGenerator { * <li>null if no value can be generated. * </ul> */ - @NullableDecl + @CheckForNull final Object generateFresh(TypeToken<?> type) { Object generated = generate(type); if (generated != null) { @@ -184,7 +184,7 @@ class FreshValueGenerator { return generated; } - @NullableDecl + @CheckForNull final <T> T generateFresh(Class<T> type) { return Primitives.wrap(type).cast(generateFresh(TypeToken.of(type))); } @@ -299,7 +299,7 @@ class FreshValueGenerator { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { if (obj instanceof FreshInvocationHandler) { FreshInvocationHandler that = (FreshInvocationHandler) obj; return identity == that.identity; @@ -647,29 +647,29 @@ class FreshValueGenerator { } @Generates - static <E> Iterable<E> generateIterable(@NullableDecl E freshElement) { + static <E> Iterable<E> generateIterable(@CheckForNull E freshElement) { return generateList(freshElement); } @Generates - static <E> Collection<E> generateCollection(@NullableDecl E freshElement) { + static <E> Collection<E> generateCollection(@CheckForNull E freshElement) { return generateList(freshElement); } @Generates - static <E> List<E> generateList(@NullableDecl E freshElement) { + static <E> List<E> generateList(@CheckForNull E freshElement) { return generateArrayList(freshElement); } @Generates - static <E> ArrayList<E> generateArrayList(@NullableDecl E freshElement) { + static <E> ArrayList<E> generateArrayList(@CheckForNull E freshElement) { ArrayList<E> list = Lists.newArrayList(); list.add(freshElement); return list; } @Generates - static <E> LinkedList<E> generateLinkedList(@NullableDecl E freshElement) { + static <E> LinkedList<E> generateLinkedList(@CheckForNull E freshElement) { LinkedList<E> list = Lists.newLinkedList(); list.add(freshElement); return list; @@ -686,17 +686,17 @@ class FreshValueGenerator { } @Generates - static <E> Set<E> generateSet(@NullableDecl E freshElement) { + static <E> Set<E> generateSet(@CheckForNull E freshElement) { return generateHashSet(freshElement); } @Generates - static <E> HashSet<E> generateHashSet(@NullableDecl E freshElement) { + static <E> HashSet<E> generateHashSet(@CheckForNull E freshElement) { return generateLinkedHashSet(freshElement); } @Generates - static <E> LinkedHashSet<E> generateLinkedHashSet(@NullableDecl E freshElement) { + static <E> LinkedHashSet<E> generateLinkedHashSet(@CheckForNull E freshElement) { LinkedHashSet<E> set = Sets.newLinkedHashSet(); set.add(freshElement); return set; @@ -731,19 +731,19 @@ class FreshValueGenerator { } @Generates - static <E> Multiset<E> generateMultiset(@NullableDecl E freshElement) { + static <E> Multiset<E> generateMultiset(@CheckForNull E freshElement) { return generateHashMultiset(freshElement); } @Generates - static <E> HashMultiset<E> generateHashMultiset(@NullableDecl E freshElement) { + static <E> HashMultiset<E> generateHashMultiset(@CheckForNull E freshElement) { HashMultiset<E> multiset = HashMultiset.create(); multiset.add(freshElement); return multiset; } @Generates - static <E> LinkedHashMultiset<E> generateLinkedHashMultiset(@NullableDecl E freshElement) { + static <E> LinkedHashMultiset<E> generateLinkedHashMultiset(@CheckForNull E freshElement) { LinkedHashMultiset<E> multiset = LinkedHashMultiset.create(); multiset.add(freshElement); return multiset; @@ -773,18 +773,18 @@ class FreshValueGenerator { } @Generates - static <K, V> Map<K, V> generateMap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> Map<K, V> generateMap(@CheckForNull K key, @CheckForNull V value) { return generateHashdMap(key, value); } @Generates - static <K, V> HashMap<K, V> generateHashdMap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> HashMap<K, V> generateHashdMap(@CheckForNull K key, @CheckForNull V value) { return generateLinkedHashMap(key, value); } @Generates static <K, V> LinkedHashMap<K, V> generateLinkedHashMap( - @NullableDecl K key, @NullableDecl V value) { + @CheckForNull K key, @CheckForNull V value) { LinkedHashMap<K, V> map = Maps.newLinkedHashMap(); map.put(key, value); return map; @@ -809,19 +809,19 @@ class FreshValueGenerator { @Generates static <K extends Comparable<? super K>, V> SortedMap<K, V> generateSortedMap( - K key, @NullableDecl V value) { + K key, @CheckForNull V value) { return generateNavigableMap(key, value); } @Generates static <K extends Comparable<? super K>, V> NavigableMap<K, V> generateNavigableMap( - K key, @NullableDecl V value) { + K key, @CheckForNull V value) { return generateTreeMap(key, value); } @Generates static <K extends Comparable<? super K>, V> TreeMap<K, V> generateTreeMap( - K key, @NullableDecl V value) { + K key, @CheckForNull V value) { TreeMap<K, V> map = Maps.newTreeMap(); map.put(key, value); return map; @@ -834,7 +834,7 @@ class FreshValueGenerator { } @Generates - static <K, V> Multimap<K, V> generateMultimap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> Multimap<K, V> generateMultimap(@CheckForNull K key, @CheckForNull V value) { return generateListMultimap(key, value); } @@ -845,13 +845,13 @@ class FreshValueGenerator { @Generates static <K, V> ListMultimap<K, V> generateListMultimap( - @NullableDecl K key, @NullableDecl V value) { + @CheckForNull K key, @CheckForNull V value) { return generateArrayListMultimap(key, value); } @Generates static <K, V> ArrayListMultimap<K, V> generateArrayListMultimap( - @NullableDecl K key, @NullableDecl V value) { + @CheckForNull K key, @CheckForNull V value) { ArrayListMultimap<K, V> multimap = ArrayListMultimap.create(); multimap.put(key, value); return multimap; @@ -863,13 +863,13 @@ class FreshValueGenerator { } @Generates - static <K, V> SetMultimap<K, V> generateSetMultimap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> SetMultimap<K, V> generateSetMultimap(@CheckForNull K key, @CheckForNull V value) { return generateLinkedHashMultimap(key, value); } @Generates static <K, V> HashMultimap<K, V> generateHashMultimap( - @NullableDecl K key, @NullableDecl V value) { + @CheckForNull K key, @CheckForNull V value) { HashMultimap<K, V> multimap = HashMultimap.create(); multimap.put(key, value); return multimap; @@ -877,7 +877,7 @@ class FreshValueGenerator { @Generates static <K, V> LinkedHashMultimap<K, V> generateLinkedHashMultimap( - @NullableDecl K key, @NullableDecl V value) { + @CheckForNull K key, @CheckForNull V value) { LinkedHashMultimap<K, V> multimap = LinkedHashMultimap.create(); multimap.put(key, value); return multimap; @@ -889,12 +889,12 @@ class FreshValueGenerator { } @Generates - static <K, V> BiMap<K, V> generateBimap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> BiMap<K, V> generateBimap(@CheckForNull K key, @CheckForNull V value) { return generateHashBiMap(key, value); } @Generates - static <K, V> HashBiMap<K, V> generateHashBiMap(@NullableDecl K key, @NullableDecl V value) { + static <K, V> HashBiMap<K, V> generateHashBiMap(@CheckForNull K key, @CheckForNull V value) { HashBiMap<K, V> bimap = HashBiMap.create(); bimap.put(key, value); return bimap; @@ -907,13 +907,13 @@ class FreshValueGenerator { @Generates static <R, C, V> Table<R, C, V> generateTable( - @NullableDecl R row, @NullableDecl C column, @NullableDecl V value) { + @CheckForNull R row, @CheckForNull C column, @CheckForNull V value) { return generateHashBasedTable(row, column, value); } @Generates static <R, C, V> HashBasedTable<R, C, V> generateHashBasedTable( - @NullableDecl R row, @NullableDecl C column, @NullableDecl V value) { + @CheckForNull R row, @CheckForNull C column, @CheckForNull V value) { HashBasedTable<R, C, V> table = HashBasedTable.create(); table.put(row, column, value); return table; diff --git a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java index 015afea54..da6aa2211 100644 --- a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static java.util.concurrent.TimeUnit.SECONDS; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.errorprone.annotations.DoNotMock; import com.google.j2objc.annotations.J2ObjCIncompatible; @@ -103,7 +102,6 @@ import java.util.concurrent.TimeoutException; * @author Martin Buchholz * @since 11.0 */ -@Beta @GwtIncompatible @J2ObjCIncompatible // gc public final class GcFinalization { @@ -138,8 +136,8 @@ public final class GcFinalization { if (future.isDone()) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (future.isDone()) { @@ -170,8 +168,8 @@ public final class GcFinalization { if (predicate.isDone()) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (predicate.isDone()) { @@ -198,8 +196,8 @@ public final class GcFinalization { if (latch.getCount() == 0) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (latch.getCount() == 0) { @@ -222,13 +220,14 @@ public final class GcFinalization { * Creates a garbage object that counts down the latch in its finalizer. Sequestered into a * separate method to make it somewhat more likely to be unreachable. */ - private static void createUnreachableLatchFinalizer(final CountDownLatch latch) { - new Object() { - @Override - protected void finalize() { - latch.countDown(); - } - }; + private static void createUnreachableLatchFinalizer(CountDownLatch latch) { + Object unused = + new Object() { + @Override + protected void finalize() { + latch.countDown(); + } + }; } /** @@ -263,7 +262,7 @@ public final class GcFinalization { * * @throws RuntimeException if timed out or interrupted while waiting */ - public static void awaitClear(final WeakReference<?> ref) { + public static void awaitClear(WeakReference<?> ref) { awaitDone( new FinalizationPredicate() { @Override @@ -296,9 +295,9 @@ public final class GcFinalization { * @since 12.0 */ public static void awaitFullGc() { - final CountDownLatch finalizerRan = new CountDownLatch(1); + CountDownLatch finalizerRan = new CountDownLatch(1); WeakReference<Object> ref = - new WeakReference<Object>( + new WeakReference<>( new Object() { @Override protected void finalize() { diff --git a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java index e32a950ac..4c24c65e1 100644 --- a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -19,7 +19,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Converter; import com.google.common.base.Objects; @@ -45,9 +44,9 @@ import java.lang.reflect.Type; import java.util.Arrays; import java.util.List; import java.util.concurrent.ConcurrentMap; +import javax.annotation.CheckForNull; import junit.framework.Assert; import junit.framework.AssertionFailedError; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * A test utility that verifies that your methods and constructors throw {@link @@ -66,7 +65,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableDecl; * @author Kevin Bourrillion * @since 10.0 */ -@Beta @GwtIncompatible public final class NullPointerTester { @@ -176,7 +174,7 @@ public final class NullPointerTester { * * @param instance the instance to invoke {@code method} on, or null if {@code method} is static */ - public void testMethod(@NullableDecl Object instance, Method method) { + public void testMethod(@CheckForNull Object instance, Method method) { Class<?>[] types = method.getParameterTypes(); for (int nullIndex = 0; nullIndex < types.length; nullIndex++) { testMethodParameter(instance, method, nullIndex); @@ -208,7 +206,7 @@ public final class NullPointerTester { * @param instance the instance to invoke {@code method} on, or null if {@code method} is static */ public void testMethodParameter( - @NullableDecl final Object instance, final Method method, int paramIndex) { + @CheckForNull final Object instance, final Method method, int paramIndex) { method.setAccessible(true); testParameter(instance, invokable(instance, method), paramIndex, method.getDeclaringClass()); } @@ -461,7 +459,7 @@ public final class NullPointerTester { }.newProxy(type); } - private static Invokable<?, ?> invokable(@NullableDecl Object instance, Method method) { + private static Invokable<?, ?> invokable(@CheckForNull Object instance, Method method) { if (instance == null) { return Invokable.from(method); } else { diff --git a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java index 5adf01091..d5b9b6a18 100644 --- a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -147,7 +147,7 @@ final class RelationshipTester<T> { } private Item<T> getItem(int groupNumber, int itemNumber) { - return new Item<T>(groups.get(groupNumber).get(itemNumber), groupNumber, itemNumber); + return new Item<>(groups.get(groupNumber).get(itemNumber), groupNumber, itemNumber); } static final class Item<T> { diff --git a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java index 62980764d..c4e6d236e 100644 --- a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -16,7 +16,6 @@ package com.google.common.testing; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import junit.framework.Assert; import junit.framework.AssertionFailedError; @@ -32,7 +31,6 @@ import junit.framework.AssertionFailedError; * @author Mike Bostock * @since 10.0 */ -@Beta @GwtCompatible // but no-op! public final class SerializableTester { private SerializableTester() {} @@ -52,7 +50,6 @@ public final class SerializableTester { * @throws RuntimeException if the specified object was not successfully serialized or * deserialized */ - @SuppressWarnings("unchecked") public static <T> T reserialize(T object) { return Platform.reserialize(object); } diff --git a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java index c03093be5..263f8908a 100644 --- a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -16,14 +16,13 @@ package com.google.common.testing; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Handler; import java.util.logging.LogRecord; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Tests may use this to intercept messages that are logged by the code under test. Example: @@ -52,7 +51,6 @@ import org.checkerframework.checker.nullness.compatqual.NullableDecl; * @author Kevin Bourrillion * @since 10.0 */ -@Beta @GwtCompatible public class TestLogHandler extends Handler { /** We will keep a private list of all logged records */ @@ -60,7 +58,7 @@ public class TestLogHandler extends Handler { /** Adds the most recently logged record to our list. */ @Override - public synchronized void publish(@NullableDecl LogRecord record) { + public synchronized void publish(@CheckForNull LogRecord record) { list.add(record); } diff --git a/android/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java b/android/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java index 2ba751537..b5bec2c09 100644 --- a/android/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java +++ b/android/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java @@ -16,6 +16,9 @@ package com.google.common.util.concurrent.testing; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.util.concurrent.ListenableFuture; @@ -68,21 +71,18 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertFalse(future.isDone()); assertFalse(future.isCancelled()); - final CountDownLatch successLatch = new CountDownLatch(1); - final Throwable[] badness = new Throwable[1]; + CountDownLatch successLatch = new CountDownLatch(1); + Throwable[] badness = new Throwable[1]; // Wait on the future in a separate thread. new Thread( - new Runnable() { - @Override - public void run() { - try { - assertSame(Boolean.TRUE, future.get()); - successLatch.countDown(); - } catch (Throwable t) { - t.printStackTrace(); - badness[0] = t; - } + () -> { + try { + assertSame(Boolean.TRUE, future.get()); + successLatch.countDown(); + } catch (Throwable t) { + t.printStackTrace(); + badness[0] = t; } }) .start(); @@ -90,7 +90,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { // Release the future value. latch.countDown(); - assertTrue(successLatch.await(10, TimeUnit.SECONDS)); + assertTrue(successLatch.await(10, SECONDS)); if (badness[0] != null) { throw badness[0]; @@ -105,7 +105,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { // The task thread waits for the latch, so we expect a timeout here. try { - future.get(20, TimeUnit.MILLISECONDS); + future.get(20, MILLISECONDS); fail("Should have timed out trying to get the value."); } catch (TimeoutException expected) { } finally { @@ -123,20 +123,17 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertFalse(future.isDone()); assertFalse(future.isCancelled()); - final CountDownLatch successLatch = new CountDownLatch(1); + CountDownLatch successLatch = new CountDownLatch(1); // Run cancellation in a separate thread as an extra thread-safety test. new Thread( - new Runnable() { - @Override - public void run() { - try { - future.get(); - } catch (CancellationException expected) { - successLatch.countDown(); - } catch (Exception ignored) { - // All other errors are ignored, we expect a cancellation. - } + () -> { + try { + future.get(); + } catch (CancellationException expected) { + successLatch.countDown(); + } catch (Exception ignored) { + // All other errors are ignored, we expect a cancellation. } }) .start(); @@ -149,37 +146,27 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertTrue(future.isDone()); assertTrue(future.isCancelled()); - assertTrue(successLatch.await(200, TimeUnit.MILLISECONDS)); + assertTrue(successLatch.await(200, MILLISECONDS)); latch.countDown(); } public void testListenersNotifiedOnError() throws Exception { - final CountDownLatch successLatch = new CountDownLatch(1); - final CountDownLatch listenerLatch = new CountDownLatch(1); + CountDownLatch successLatch = new CountDownLatch(1); + CountDownLatch listenerLatch = new CountDownLatch(1); ExecutorService exec = Executors.newCachedThreadPool(); - future.addListener( - new Runnable() { - @Override - public void run() { - listenerLatch.countDown(); - } - }, - exec); + future.addListener(listenerLatch::countDown, exec); new Thread( - new Runnable() { - @Override - public void run() { - try { - future.get(); - } catch (CancellationException expected) { - successLatch.countDown(); - } catch (Exception ignored) { - // No success latch count down. - } + () -> { + try { + future.get(); + } catch (CancellationException expected) { + successLatch.countDown(); + } catch (Exception ignored) { + // No success latch count down. } }) .start(); @@ -189,13 +176,13 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertTrue(future.isCancelled()); assertTrue(future.isDone()); - assertTrue(successLatch.await(200, TimeUnit.MILLISECONDS)); - assertTrue(listenerLatch.await(200, TimeUnit.MILLISECONDS)); + assertTrue(successLatch.await(200, MILLISECONDS)); + assertTrue(listenerLatch.await(200, MILLISECONDS)); latch.countDown(); exec.shutdown(); - exec.awaitTermination(100, TimeUnit.MILLISECONDS); + exec.awaitTermination(100, MILLISECONDS); } /** @@ -209,7 +196,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { ExecutorService exec = Executors.newCachedThreadPool(); int listenerCount = 20; - final CountDownLatch listenerLatch = new CountDownLatch(listenerCount); + CountDownLatch listenerLatch = new CountDownLatch(listenerCount); // Test that listeners added both before and after the value is available // get called correctly. @@ -217,31 +204,17 @@ public abstract class AbstractListenableFutureTest extends TestCase { // Right in the middle start up a thread to close the latch. if (i == 10) { - new Thread( - new Runnable() { - @Override - public void run() { - latch.countDown(); - } - }) - .start(); + new Thread(() -> latch.countDown()).start(); } - future.addListener( - new Runnable() { - @Override - public void run() { - listenerLatch.countDown(); - } - }, - exec); + future.addListener(listenerLatch::countDown, exec); } assertSame(Boolean.TRUE, future.get()); // Wait for the listener latch to complete. - listenerLatch.await(500, TimeUnit.MILLISECONDS); + listenerLatch.await(500, MILLISECONDS); exec.shutdown(); - exec.awaitTermination(500, TimeUnit.MILLISECONDS); + exec.awaitTermination(500, MILLISECONDS); } } diff --git a/android/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java b/android/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java index fc3ed21f1..a2fe4f447 100644 --- a/android/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java +++ b/android/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java @@ -17,13 +17,13 @@ package com.google.common.util.concurrent.testing; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.util.concurrent.ListenableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; import junit.framework.Assert; /** @@ -59,7 +59,7 @@ public class MockFutureListener implements Runnable { */ public void assertSuccess(Object expectedData) throws Throwable { // Verify that the listener executed in a reasonable amount of time. - Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertTrue(countDownLatch.await(1L, SECONDS)); try { Assert.assertEquals(expectedData, future.get()); @@ -75,7 +75,7 @@ public class MockFutureListener implements Runnable { */ public void assertException(Throwable expectedCause) throws Exception { // Verify that the listener executed in a reasonable amount of time. - Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertTrue(countDownLatch.await(1L, SECONDS)); try { future.get(); @@ -88,6 +88,6 @@ public class MockFutureListener implements Runnable { public void assertTimeout() throws Exception { // Verify that the listener does not get called in a reasonable amount of // time. - Assert.assertFalse(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertFalse(countDownLatch.await(1L, SECONDS)); } } diff --git a/android/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java b/android/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java index c232218fb..25b7ef791 100644 --- a/android/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java +++ b/android/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java @@ -140,11 +140,11 @@ class SameThreadScheduledExecutorService extends AbstractExecutorService @Override public <V> ListenableScheduledFuture<V> schedule( - final Callable<V> callable, long delay, TimeUnit unit) { + Callable<V> callable, long delay, TimeUnit unit) { Preconditions.checkNotNull(callable, "callable must not be null!"); Preconditions.checkNotNull(unit, "unit must not be null!"); ListenableFuture<V> delegateFuture = submit(callable); - return new ImmediateScheduledFuture<V>(delegateFuture); + return new ImmediateScheduledFuture<>(delegateFuture); } private static class ImmediateScheduledFuture<V> extends SimpleForwardingListenableFuture<V> diff --git a/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java b/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java index 421243043..dc2c40d37 100644 --- a/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java +++ b/android/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java @@ -16,6 +16,8 @@ package com.google.common.util.concurrent.testing; +import static java.util.concurrent.TimeUnit.NANOSECONDS; + import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.ImmutableList; @@ -153,7 +155,7 @@ public final class TestingExecutors { implements ListenableScheduledFuture<V> { static <V> NeverScheduledFuture<V> create() { - return new NeverScheduledFuture<V>(); + return new NeverScheduledFuture<>(); } @Override @@ -163,7 +165,7 @@ public final class TestingExecutors { @Override public int compareTo(Delayed other) { - return Longs.compare(getDelay(TimeUnit.NANOSECONDS), other.getDelay(TimeUnit.NANOSECONDS)); + return Longs.compare(getDelay(NANOSECONDS), other.getDelay(NANOSECONDS)); } } } diff --git a/android/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java b/android/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java index dc0fe37b4..4d617d64d 100644 --- a/android/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java +++ b/android/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java @@ -27,7 +27,7 @@ import org.junit.Ignore; /** @author Max Ross */ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { - static boolean testWasRun; + private static boolean testWasRun; @Override protected void setUp() throws Exception { @@ -52,7 +52,7 @@ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { } public void testLifecycle() { - final boolean setUp[] = {false}; + boolean[] setUp = {false}; Runnable setUpRunnable = new Runnable() { @Override @@ -61,7 +61,7 @@ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { } }; - final boolean tearDown[] = {false}; + boolean[] tearDown = {false}; Runnable tearDownRunnable = new Runnable() { @Override diff --git a/android/guava-testlib/test/com/google/common/testing/ClassSanityTesterTest.java b/android/guava-testlib/test/com/google/common/testing/ClassSanityTesterTest.java index 586eb284e..be1752d47 100644 --- a/android/guava-testlib/test/com/google/common/testing/ClassSanityTesterTest.java +++ b/android/guava-testlib/test/com/google/common/testing/ClassSanityTesterTest.java @@ -34,9 +34,9 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; +import javax.annotation.CheckForNull; import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit tests for {@link ClassSanityTester}. @@ -58,7 +58,7 @@ public class ClassSanityTesterTest extends TestCase { // oneConstantOnly doesn't matter since it's not nullable and can be only 1 value. @SuppressWarnings("unused") OneConstantEnum oneConstantOnly, // noConstant doesn't matter since it can only be null - @SuppressWarnings("unused") @NullableDecl NoConstantEnum noConstant) { + @SuppressWarnings("unused") @CheckForNull NoConstantEnum noConstant) { return new GoodEquals(a, b); } // instance method ignored @@ -106,7 +106,7 @@ public class ClassSanityTesterTest extends TestCase { private static class BadEqualsFactory { /** oneConstantOnly matters now since it can be either null or the constant. */ @SuppressWarnings("unused") // Called by reflection - public static Object bad(String a, int b, @NullableDecl OneConstantEnum oneConstantOnly) { + public static Object bad(String a, int b, @CheckForNull OneConstantEnum oneConstantOnly) { return new GoodEquals(a, b); } } @@ -287,7 +287,7 @@ public class ClassSanityTesterTest extends TestCase { } public static class FactoryThatReturnsNullAndAnnotated { - @NullableDecl + @CheckForNull public static Object bad() { return null; } @@ -616,7 +616,7 @@ public class ClassSanityTesterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { if (obj instanceof HasAnInterface) { HasAnInterface that = (HasAnInterface) obj; return i.equals(that.i); @@ -673,7 +673,7 @@ public class ClassSanityTesterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { // In general getClass().isInstance() is bad for equals. // But here we fully control the subclasses to ensure symmetry. if (getClass().isInstance(obj)) { @@ -753,13 +753,13 @@ public class ClassSanityTesterTest extends TestCase { // keep trying @SuppressWarnings("unused") - @NullableDecl + @CheckForNull public static GoodEquals createMayReturnNull(int a, int b) { return null; } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { if (obj instanceof GoodEquals) { GoodEquals that = (GoodEquals) obj; return a.equals(that.a) && b == that.b; @@ -778,12 +778,12 @@ public class ClassSanityTesterTest extends TestCase { public BadEquals() {} // ignored by testEquals() since it has less parameters. - public static BadEquals create(@SuppressWarnings("unused") @NullableDecl String s) { + public static BadEquals create(@SuppressWarnings("unused") @CheckForNull String s) { return new BadEquals(); } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { return obj instanceof BadEquals; } @@ -1122,7 +1122,7 @@ public class ClassSanityTesterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { return obj instanceof BadEqualsWithParameterizedType; } @@ -1156,12 +1156,12 @@ public class ClassSanityTesterTest extends TestCase { void primitiveOnly(int i) {} @SuppressWarnings("unused") // reflected - void nullableOnly(@NullableDecl String s) {} + void nullableOnly(@CheckForNull String s) {} public void noParameter() {} @SuppressWarnings("unused") // reflected - void primitiveAndNullable(@NullableDecl String s, int i) {} + void primitiveAndNullable(@CheckForNull String s, int i) {} } static class FactoryMethodReturnsNullButNotAnnotated { @@ -1175,7 +1175,7 @@ public class ClassSanityTesterTest extends TestCase { static class FactoryMethodReturnsNullAndAnnotated { private FactoryMethodReturnsNullAndAnnotated() {} - @NullableDecl + @CheckForNull public static FactoryMethodReturnsNullAndAnnotated returnsNull() { return null; } @@ -1189,7 +1189,7 @@ public class ClassSanityTesterTest extends TestCase { this.name = name; } - static FactoryMethodAcceptsNull create(@NullableDecl String name) { + static FactoryMethodAcceptsNull create(@CheckForNull String name) { return new FactoryMethodAcceptsNull(name); } } @@ -1211,7 +1211,7 @@ public class ClassSanityTesterTest extends TestCase { final String name; - public ConstructorAcceptsNull(@NullableDecl String name) { + public ConstructorAcceptsNull(@CheckForNull String name) { this.name = name; } } @@ -1237,7 +1237,7 @@ public class ClassSanityTesterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { if (obj instanceof ConstructorParameterMapOfNotInstantiable) { return m.equals(((ConstructorParameterMapOfNotInstantiable) obj).m); } else { @@ -1258,7 +1258,7 @@ public class ClassSanityTesterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object obj) { + public boolean equals(@CheckForNull Object obj) { throw new UnsupportedOperationException(); } diff --git a/android/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java b/android/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java index d612b2c2c..865c198e7 100644 --- a/android/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java +++ b/android/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java @@ -237,7 +237,7 @@ public class EquivalenceTesterTest extends TestCase { void replay() { checkRecording(); equivalentExpectations = equivalentExpectationsBuilder.build(); - hashExpectations = hashExpectationsBuilder.build(); + hashExpectations = hashExpectationsBuilder.buildOrThrow(); } @Override diff --git a/android/guava-testlib/test/com/google/common/testing/NullPointerTesterTest.java b/android/guava-testlib/test/com/google/common/testing/NullPointerTesterTest.java index d1dc49bf1..218edef0a 100644 --- a/android/guava-testlib/test/com/google/common/testing/NullPointerTesterTest.java +++ b/android/guava-testlib/test/com/google/common/testing/NullPointerTesterTest.java @@ -44,9 +44,9 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.SortedSet; +import javax.annotation.CheckForNull; import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit test for {@link NullPointerTester}. @@ -86,11 +86,11 @@ public class NullPointerTesterTest extends TestCase { // null? no problem } - public static void staticOneArgJsr305NullableCorrectlyDoesNotThrowNPE(@NullableDecl String s) { + public static void staticOneArgJsr305NullableCorrectlyDoesNotThrowNPE(@CheckForNull String s) { // null? no problem } - public static void staticOneArgNullableCorrectlyDoesNotThrowNPE(@NullableDecl String s) { + public static void staticOneArgNullableCorrectlyDoesNotThrowNPE(@CheckForNull String s) { // null? no problem } @@ -99,7 +99,7 @@ public class NullPointerTesterTest extends TestCase { throw new FooException(); // ok, as long as it's not NullPointerException } - public static void staticOneArgNullableCorrectlyThrowsOtherThanNPE(@NullableDecl String s) { + public static void staticOneArgNullableCorrectlyThrowsOtherThanNPE(@CheckForNull String s) { throw new FooException(); // ok, as long as it's not NullPointerException } @@ -107,7 +107,7 @@ public class NullPointerTesterTest extends TestCase { checkNotNull(s); // doesn't check if you said you'd accept null, but you don't } - public static void staticOneArgNullableThrowsNPE(@NullableDecl String s) { + public static void staticOneArgNullableThrowsNPE(@CheckForNull String s) { checkNotNull(s); // doesn't check if you said you'd accept null, but you don't } @@ -128,7 +128,7 @@ public class NullPointerTesterTest extends TestCase { // null? no problem } - public void oneArgNullableCorrectlyDoesNotThrowNPE(@NullableDecl String s) { + public void oneArgNullableCorrectlyDoesNotThrowNPE(@CheckForNull String s) { // null? no problem } @@ -137,7 +137,7 @@ public class NullPointerTesterTest extends TestCase { throw new FooException(); // ok, as long as it's not NullPointerException } - public void oneArgNullableCorrectlyThrowsOtherThanNPE(@NullableDecl String s) { + public void oneArgNullableCorrectlyThrowsOtherThanNPE(@CheckForNull String s) { throw new FooException(); // ok, as long as it's not NullPointerException } @@ -145,7 +145,7 @@ public class NullPointerTesterTest extends TestCase { checkNotNull(s); // doesn't check if you said you'd accept null, but you don't } - public void oneArgNullableThrowsNPE(@NullableDecl String s) { + public void oneArgNullableThrowsNPE(@CheckForNull String s) { checkNotNull(s); // doesn't check if you said you'd accept null, but you don't } } @@ -347,19 +347,19 @@ public class NullPointerTesterTest extends TestCase { /** Two-arg method with the second param Nullable. */ @SuppressWarnings("GoodTime") // false positive; b/122617528 - public void normalNullable(String first, @NullableDecl Integer second) { + public void normalNullable(String first, @CheckForNull Integer second) { reactToNullParameters(first, second); } /** Two-arg method with the first param Nullable. */ @SuppressWarnings("GoodTime") // false positive; b/122617528 - public void nullableNormal(@NullableDecl String first, Integer second) { + public void nullableNormal(@CheckForNull String first, Integer second) { reactToNullParameters(first, second); } /** Two-arg method with the both params Nullable. */ @SuppressWarnings("GoodTime") // false positive; b/122617528 - public void nullableNullable(@NullableDecl String first, @NullableDecl Integer second) { + public void nullableNullable(@CheckForNull String first, @CheckForNull Integer second) { reactToNullParameters(first, second); } @@ -473,9 +473,9 @@ public class NullPointerTesterTest extends TestCase { checkNotNull(s); } - public void oneNullableArg(@NullableDecl String s) {} + public void oneNullableArg(@CheckForNull String s) {} - public void oneNullableArgThrows(@NullableDecl String s) { + public void oneNullableArgThrows(@CheckForNull String s) { doThrow(s); } @@ -484,31 +484,31 @@ public class NullPointerTesterTest extends TestCase { i.intValue(); } - public void twoMixedArgs(String s, @NullableDecl Integer i) { + public void twoMixedArgs(String s, @CheckForNull Integer i) { checkNotNull(s); } - public void twoMixedArgs(@NullableDecl Integer i, String s) { + public void twoMixedArgs(@CheckForNull Integer i, String s) { checkNotNull(s); } - public void twoMixedArgsThrows(String s, @NullableDecl Integer i) { + public void twoMixedArgsThrows(String s, @CheckForNull Integer i) { checkNotNull(s); doThrow(i); } - public void twoMixedArgsThrows(@NullableDecl Integer i, String s) { + public void twoMixedArgsThrows(@CheckForNull Integer i, String s) { checkNotNull(s); doThrow(i); } - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) {} + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) {} - public void twoNullableArgsThrowsFirstArg(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgsThrowsFirstArg(@CheckForNull String s, @CheckForNull Integer i) { doThrow(s); } - public void twoNullableArgsThrowsSecondArg(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgsThrowsSecondArg(@CheckForNull String s, @CheckForNull Integer i) { doThrow(i); } @@ -516,9 +516,9 @@ public class NullPointerTesterTest extends TestCase { checkNotNull(s); } - public static void staticOneNullableArg(@NullableDecl String s) {} + public static void staticOneNullableArg(@CheckForNull String s) {} - public static void staticOneNullableArgThrows(@NullableDecl String s) { + public static void staticOneNullableArgThrows(@CheckForNull String s) { doThrow(s); } } @@ -551,7 +551,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassOneNullableArgThrowsNPE extends PassObject { @Override - public void oneNullableArg(@NullableDecl String s) { + public void oneNullableArg(@CheckForNull String s) { checkNotNull(s); // ok to throw NPE } } @@ -610,7 +610,7 @@ public class NullPointerTesterTest extends TestCase { private static class FailTwoMixedArgsFirstArgDoesntThrowNPE extends PassObject { @Override - public void twoMixedArgs(String s, @NullableDecl Integer i) { + public void twoMixedArgs(String s, @CheckForNull Integer i) { // Fail: missing NPE for s } } @@ -621,7 +621,7 @@ public class NullPointerTesterTest extends TestCase { private static class FailTwoMixedArgsFirstArgThrowsWrongType extends PassObject { @Override - public void twoMixedArgs(String s, @NullableDecl Integer i) { + public void twoMixedArgs(String s, @CheckForNull Integer i) { doThrow(s); // Fail: throwing non-NPE exception for null s } } @@ -632,7 +632,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoMixedArgsNullableArgThrowsNPE extends PassObject { @Override - public void twoMixedArgs(String s, @NullableDecl Integer i) { + public void twoMixedArgs(String s, @CheckForNull Integer i) { checkNotNull(s); i.intValue(); // ok to throw NPE? } @@ -644,7 +644,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoMixedArgSecondNullableArgThrowsOther extends PassObject { @Override - public void twoMixedArgs(String s, @NullableDecl Integer i) { + public void twoMixedArgs(String s, @CheckForNull Integer i) { checkNotNull(s); doThrow(i); // ok to throw non-NPE exception for null i } @@ -656,7 +656,7 @@ public class NullPointerTesterTest extends TestCase { private static class FailTwoMixedArgsSecondArgDoesntThrowNPE extends PassObject { @Override - public void twoMixedArgs(@NullableDecl Integer i, String s) { + public void twoMixedArgs(@CheckForNull Integer i, String s) { // Fail: missing NPE for null s } } @@ -667,7 +667,7 @@ public class NullPointerTesterTest extends TestCase { private static class FailTwoMixedArgsSecondArgThrowsWrongType extends PassObject { @Override - public void twoMixedArgs(@NullableDecl Integer i, String s) { + public void twoMixedArgs(@CheckForNull Integer i, String s) { doThrow(s); // Fail: throwing non-NPE exception for null s } } @@ -678,7 +678,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoNullableArgsFirstThrowsNPE extends PassObject { @Override - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) { checkNotNull(s); // ok to throw NPE? } } @@ -689,7 +689,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoNullableArgsFirstThrowsOther extends PassObject { @Override - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) { doThrow(s); // ok to throw non-NPE exception for null s } } @@ -700,7 +700,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoNullableArgsSecondThrowsNPE extends PassObject { @Override - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) { i.intValue(); // ok to throw NPE? } } @@ -711,7 +711,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoNullableArgsSecondThrowsOther extends PassObject { @Override - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) { doThrow(i); // ok to throw non-NPE exception for null i } } @@ -722,7 +722,7 @@ public class NullPointerTesterTest extends TestCase { private static class PassTwoNullableArgsNeitherThrowsAnything extends PassObject { @Override - public void twoNullableArgs(@NullableDecl String s, @NullableDecl Integer i) { + public void twoNullableArgs(@CheckForNull String s, @CheckForNull Integer i) { // ok to do nothing } } @@ -768,7 +768,7 @@ public class NullPointerTesterTest extends TestCase { private static class SubclassThatOverridesBadSuperclassMethod extends BaseClassThatFailsToThrow { @Override - public void oneArg(@NullableDecl String s) {} + public void oneArg(@CheckForNull String s) {} } public void testSubclassThatOverridesBadSuperclassMethod() { @@ -777,7 +777,7 @@ public class NullPointerTesterTest extends TestCase { @SuppressWarnings("unused") // for NullPointerTester private static class SubclassOverridesTheWrongMethod extends BaseClassThatFailsToThrow { - public void oneArg(@NullableDecl CharSequence s) {} + public void oneArg(@CheckForNull CharSequence s) {} } public void testSubclassOverridesTheWrongMethod() { @@ -801,7 +801,7 @@ public class NullPointerTesterTest extends TestCase { private static class SubclassThatTriesToOverrideBadStaticMethod extends ClassThatFailsToThrowForStatic { - static void staticOneArg(@NullableDecl String s) {} + static void staticOneArg(@CheckForNull String s) {} } public void testSubclassThatTriesToOverrideBadStaticMethod() { @@ -814,7 +814,7 @@ public class NullPointerTesterTest extends TestCase { @SuppressWarnings("unused") // used by reflection private static class CanCreateDefault { - public void foo(@NullableDecl HardToCreate ignored, String required) { + public void foo(@CheckForNull HardToCreate ignored, String required) { checkNotNull(required); } } @@ -877,7 +877,7 @@ public class NullPointerTesterTest extends TestCase { @SuppressWarnings("unused") // used by reflection private static class PrivateClassWithPrivateConstructor { - private PrivateClassWithPrivateConstructor(@NullableDecl Integer argument) {} + private PrivateClassWithPrivateConstructor(@CheckForNull Integer argument) {} } public void testPrivateClass() { diff --git a/android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java b/android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java index 5b713f26b..086a63493 100644 --- a/android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java +++ b/android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java @@ -37,7 +37,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Benchmarks for {@link ConcurrentHashMultiset}. @@ -192,7 +192,7 @@ public class ConcurrentHashMultisetBenchmark { * @return the nonnegative number of occurrences of the element */ @Override - public int count(@NullableDecl Object element) { + public int count(@CheckForNull Object element) { try { return unbox(countMap.get(element)); } catch (NullPointerException | ClassCastException e) { @@ -295,7 +295,7 @@ public class ConcurrentHashMultisetBenchmark { * @throws IllegalArgumentException if {@code occurrences} is negative */ @Override - public int remove(@NullableDecl Object element, int occurrences) { + public int remove(@CheckForNull Object element, int occurrences) { if (occurrences == 0) { return count(element); } @@ -330,7 +330,7 @@ public class ConcurrentHashMultisetBenchmark { * @param element the element whose occurrences should all be removed * @return the number of occurrences successfully removed, possibly zero */ - private int removeAllOccurrences(@NullableDecl Object element) { + private int removeAllOccurrences(@CheckForNull Object element) { try { return unbox(countMap.remove(element)); } catch (NullPointerException | ClassCastException e) { @@ -349,7 +349,7 @@ public class ConcurrentHashMultisetBenchmark { * @param occurrences the number of occurrences of {@code element} to remove * @return {@code true} if the removal was possible (including if {@code occurrences} is zero) */ - public boolean removeExactly(@NullableDecl Object element, int occurrences) { + public boolean removeExactly(@CheckForNull Object element, int occurrences) { if (occurrences == 0) { return true; } @@ -543,7 +543,7 @@ public class ConcurrentHashMultisetBenchmark { } /** We use a special form of unboxing that treats null as zero. */ - private static int unbox(@NullableDecl Integer i) { + private static int unbox(@CheckForNull Integer i) { return (i == null) ? 0 : i; } } diff --git a/android/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java b/android/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java index f10b94ea6..cd8e24b1e 100644 --- a/android/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java +++ b/android/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java @@ -139,7 +139,7 @@ public class MapBenchmark { for (Element element : keys) { builder.put(element, element); } - return builder.build(); + return builder.buildOrThrow(); } }, ImmutableSorted { diff --git a/android/guava-tests/benchmark/com/google/common/util/concurrent/ExecutionListBenchmark.java b/android/guava-tests/benchmark/com/google/common/util/concurrent/ExecutionListBenchmark.java index c9df77483..22053c8d6 100644 --- a/android/guava-tests/benchmark/com/google/common/util/concurrent/ExecutionListBenchmark.java +++ b/android/guava-tests/benchmark/com/google/common/util/concurrent/ExecutionListBenchmark.java @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** Benchmarks for {@link ExecutionList}. */ @VmOptions({"-Xms8g", "-Xmx8g"}) @@ -488,7 +488,7 @@ public class ExecutionListBenchmark { private static final class RunnableExecutorPair { final Runnable runnable; final Executor executor; - @NullableDecl RunnableExecutorPair next; + @CheckForNull RunnableExecutorPair next; RunnableExecutorPair(Runnable runnable, Executor executor, RunnableExecutorPair next) { this.runnable = runnable; @@ -563,7 +563,7 @@ public class ExecutionListBenchmark { private static final class RunnableExecutorPair { Runnable runnable; Executor executor; - @NullableDecl RunnableExecutorPair next; + @CheckForNull RunnableExecutorPair next; RunnableExecutorPair(Runnable runnable, Executor executor) { this.runnable = runnable; @@ -669,7 +669,7 @@ public class ExecutionListBenchmark { final Runnable runnable; final Executor executor; // Volatile because this is written on one thread and read on another with no synchronization. - @NullableDecl volatile RunnableExecutorPair next; + @CheckForNull volatile RunnableExecutorPair next; RunnableExecutorPair(Runnable runnable, Executor executor) { this.runnable = runnable; diff --git a/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedArrayBlockingQueue.java b/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedArrayBlockingQueue.java index 61f735d48..2233fb47d 100644 --- a/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedArrayBlockingQueue.java +++ b/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedArrayBlockingQueue.java @@ -25,7 +25,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * A bounded {@linkplain BlockingQueue blocking queue} backed by an array. This queue orders @@ -388,7 +388,7 @@ public class MonitorBasedArrayBlockingQueue<E> extends AbstractQueue<E> * @return {@code true} if this queue changed as a result of the call */ @Override - public boolean remove(@NullableDecl Object o) { + public boolean remove(@CheckForNull Object o) { if (o == null) return false; final E[] items = this.items; final Monitor monitor = this.monitor; @@ -418,7 +418,7 @@ public class MonitorBasedArrayBlockingQueue<E> extends AbstractQueue<E> * @return {@code true} if this queue contains the specified element */ @Override - public boolean contains(@NullableDecl Object o) { + public boolean contains(@CheckForNull Object o) { if (o == null) return false; final E[] items = this.items; final Monitor monitor = this.monitor; diff --git a/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedPriorityBlockingQueue.java b/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedPriorityBlockingQueue.java index 086253d5c..f61885be2 100644 --- a/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedPriorityBlockingQueue.java +++ b/android/guava-tests/benchmark/com/google/common/util/concurrent/MonitorBasedPriorityBlockingQueue.java @@ -30,7 +30,7 @@ import java.util.Queue; import java.util.SortedSet; import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * An unbounded {@linkplain BlockingQueue blocking queue} that uses the same ordering rules as class @@ -124,7 +124,7 @@ public class MonitorBasedPriorityBlockingQueue<E> extends AbstractQueue<E> * @throws IllegalArgumentException if {@code initialCapacity} is less than 1 */ public MonitorBasedPriorityBlockingQueue( - int initialCapacity, @NullableDecl Comparator<? super E> comparator) { + int initialCapacity, @CheckForNull Comparator<? super E> comparator) { q = new PriorityQueue<E>(initialCapacity, comparator); } @@ -303,7 +303,7 @@ public class MonitorBasedPriorityBlockingQueue<E> extends AbstractQueue<E> * @return {@code true} if this queue changed as a result of the call */ @Override - public boolean remove(@NullableDecl Object o) { + public boolean remove(@CheckForNull Object o) { final Monitor monitor = this.monitor; monitor.enter(); try { @@ -322,7 +322,7 @@ public class MonitorBasedPriorityBlockingQueue<E> extends AbstractQueue<E> * @return {@code true} if this queue contains the specified element */ @Override - public boolean contains(@NullableDecl Object o) { + public boolean contains(@CheckForNull Object o) { final Monitor monitor = this.monitor; monitor.enter(); try { diff --git a/android/guava-tests/pom.xml b/android/guava-tests/pom.xml index 7f57d8712..13a8d8dc1 100644 --- a/android/guava-tests/pom.xml +++ b/android/guava-tests/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-android</version> + <version>31.1-android</version> </parent> <artifactId>guava-tests</artifactId> <name>Guava Unit Tests</name> @@ -26,10 +26,6 @@ <artifactId>jsr305</artifactId> </dependency> <dependency> - <groupId>org.checkerframework</groupId> - <artifactId>checker-compat-qual</artifactId> - </dependency> - <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> </dependency> diff --git a/android/guava-tests/test/com/google/common/base/AbstractIteratorTest.java b/android/guava-tests/test/com/google/common/base/AbstractIteratorTest.java index da732bf54..ddb7d7097 100644 --- a/android/guava-tests/test/com/google/common/base/AbstractIteratorTest.java +++ b/android/guava-tests/test/com/google/common/base/AbstractIteratorTest.java @@ -205,7 +205,7 @@ public class AbstractIteratorTest extends TestCase { // hasNext/next), but we'll cop out for now, knowing that // next() both start by invoking hasNext() anyway. - /** Throws a undeclared checked exception. */ + /** Throws an undeclared checked exception. */ private static void sneakyThrow(Throwable t) { class SneakyThrower<T extends Throwable> { @SuppressWarnings("unchecked") // intentionally unsafe for test diff --git a/android/guava-tests/test/com/google/common/base/AsciiTest.java b/android/guava-tests/test/com/google/common/base/AsciiTest.java index d3a1f8f65..9e6b0e41a 100644 --- a/android/guava-tests/test/com/google/common/base/AsciiTest.java +++ b/android/guava-tests/test/com/google/common/base/AsciiTest.java @@ -54,8 +54,8 @@ public class AsciiTest extends TestCase { public void testCharsIgnored() { for (char c : IGNORED.toCharArray()) { String str = String.valueOf(c); - assertTrue(str, c == Ascii.toLowerCase(c)); - assertTrue(str, c == Ascii.toUpperCase(c)); + assertEquals(str, c, Ascii.toLowerCase(c)); + assertEquals(str, c, Ascii.toUpperCase(c)); assertFalse(str, Ascii.isLowerCase(c)); assertFalse(str, Ascii.isUpperCase(c)); } @@ -98,27 +98,26 @@ public class AsciiTest extends TestCase { } public void testTruncateIllegalArguments() { - String truncated = null; try { - truncated = Ascii.truncate("foobar", 2, "..."); + Ascii.truncate("foobar", 2, "..."); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", 8, "1234567890"); + Ascii.truncate("foobar", 8, "1234567890"); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", -1, "..."); + Ascii.truncate("foobar", -1, "..."); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", -1, ""); + Ascii.truncate("foobar", -1, ""); fail(); } catch (IllegalArgumentException expected) { } diff --git a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java index 5412882c5..49bdbbaff 100644 --- a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java @@ -386,7 +386,7 @@ public class CharMatcherTest extends TestCase { assertSame(s, matcher.replaceFrom(s, 'z')); assertSame(s, matcher.replaceFrom(s, "ZZ")); assertSame(s, matcher.trimFrom(s)); - assertSame(0, matcher.countIn(s)); + assertEquals(0, matcher.countIn(s)); } private void reallyTestMatchThenNoMatch(CharMatcher matcher, String s) { diff --git a/android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java b/android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java index 04b6f1ef5..948b4b560 100644 --- a/android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java +++ b/android/guava-tests/test/com/google/common/cache/CacheBuilderFactory.java @@ -26,7 +26,7 @@ import com.google.common.collect.Sets; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Helper class for creating {@link CacheBuilder} instances with all combinations of several sets of @@ -120,7 +120,7 @@ class CacheBuilderFactory { private static final Function<Object, Optional<?>> NULLABLE_TO_OPTIONAL = new Function<Object, Optional<?>>() { @Override - public Optional<?> apply(@NullableDecl Object obj) { + public Optional<?> apply(@CheckForNull Object obj) { return Optional.fromNullable(obj); } }; diff --git a/android/guava-tests/test/com/google/common/cache/CacheTesting.java b/android/guava-tests/test/com/google/common/cache/CacheTesting.java index 255a89480..4c58ed502 100644 --- a/android/guava-tests/test/com/google/common/cache/CacheTesting.java +++ b/android/guava-tests/test/com/google/common/cache/CacheTesting.java @@ -44,7 +44,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReferenceArray; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * A collection of utilities for {@link Cache} testing. @@ -367,7 +367,7 @@ class CacheTesting { } interface Receiver<T> { - void accept(@NullableDecl T object); + void accept(@CheckForNull T object); } /** diff --git a/android/guava-tests/test/com/google/common/cache/LocalCacheTest.java b/android/guava-tests/test/com/google/common/cache/LocalCacheTest.java index 3c4529caf..b8ec7dfe6 100644 --- a/android/guava-tests/test/com/google/common/cache/LocalCacheTest.java +++ b/android/guava-tests/test/com/google/common/cache/LocalCacheTest.java @@ -232,7 +232,7 @@ public class LocalCacheTest extends TestCase { private Throwable popLoggedThrowable() { List<LogRecord> logRecords = logHandler.getStoredLogRecords(); - assertSame(1, logRecords.size()); + assertEquals(1, logRecords.size()); LogRecord logRecord = logRecords.get(0); logHandler.clear(); return logRecord.getThrown(); diff --git a/android/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java b/android/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java index 8507e68f2..6cc026021 100644 --- a/android/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java +++ b/android/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java @@ -23,7 +23,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Utility {@link CacheLoader} implementations intended for use in testing. @@ -57,7 +57,7 @@ class TestingCacheLoaders { } /** Returns a {@link CacheLoader} that returns the given {@code constant} for every request. */ - static <K, V> ConstantLoader<K, V> constantLoader(@NullableDecl V constant) { + static <K, V> ConstantLoader<K, V> constantLoader(@CheckForNull V constant) { return new ConstantLoader<>(constant); } diff --git a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 35922105f..a76907cda 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java @@ -250,6 +250,7 @@ public class AbstractIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testCantRemove() { Iterator<Integer> iter = new AbstractIterator<Integer>() { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index 11c66a702..63c17deda 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java @@ -61,7 +61,8 @@ public class AbstractMapEntryTest extends TestCase { public void testEquals() { Entry<String, Integer> foo1 = entry("foo", 1); - assertEquals(foo1, foo1); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(foo1.equals(foo1)); assertEquals(control("foo", 1), foo1); assertEquals(control("bar", 2), entry("bar", 2)); assertFalse(control("foo", 1).equals(entry("foo", 2))); diff --git a/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java b/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java index e623f31d2..b8427b1c8 100644 --- a/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java +++ b/android/guava-tests/test/com/google/common/collect/FluentIterableTest.java @@ -38,9 +38,9 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.concurrent.TimeUnit; +import javax.annotation.CheckForNull; import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit test for {@link FluentIterable}. @@ -850,7 +850,7 @@ public class FluentIterableTest extends TestCase { .uniqueIndex( new Function<Integer, Object>() { @Override - public Object apply(@NullableDecl Integer input) { + public Object apply(@CheckForNull Integer input) { return String.valueOf(input); } }); diff --git a/android/guava-tests/test/com/google/common/collect/ForwardingMapTest.java b/android/guava-tests/test/com/google/common/collect/ForwardingMapTest.java index cc5d73967..cf2ed0d3b 100644 --- a/android/guava-tests/test/com/google/common/collect/ForwardingMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForwardingMapTest.java @@ -170,7 +170,7 @@ public class ForwardingMapTest extends TestCase { for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } - return new StandardImplForwardingMap<>(builder.build()); + return new StandardImplForwardingMap<>(builder.buildOrThrow()); } }) .named("ForwardingMap[ImmutableMap] with standard implementations") diff --git a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMultisetTest.java b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMultisetTest.java index d0673f1d0..2b77cd5e4 100644 --- a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMultisetTest.java @@ -27,10 +27,10 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.NavigableSet; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@link ForwardingSortedMultiset}. @@ -93,12 +93,12 @@ public class ForwardingSortedMultisetTest extends TestCase { } @Override - public int count(@NullableDecl Object element) { + public int count(@CheckForNull Object element) { return standardCount(element); } @Override - public boolean equals(@NullableDecl Object object) { + public boolean equals(@CheckForNull Object object) { return standardEquals(object); } @@ -123,7 +123,7 @@ public class ForwardingSortedMultisetTest extends TestCase { } @Override - public boolean contains(@NullableDecl Object object) { + public boolean contains(@CheckForNull Object object) { return standardContains(object); } @@ -143,7 +143,7 @@ public class ForwardingSortedMultisetTest extends TestCase { } @Override - public boolean remove(@NullableDecl Object object) { + public boolean remove(@CheckForNull Object object) { return standardRemove(object); } diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index e0dd1ef0e..e01b094fe 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java @@ -323,6 +323,7 @@ public class ImmutableBiMapTest extends TestCase { } } + @SuppressWarnings("AlwaysThrows") public void testPuttingTheSameKeyTwiceThrowsOnBuild() { Builder<String, Integer> builder = new Builder<String, Integer>() @@ -556,6 +557,7 @@ public class ImmutableBiMapTest extends TestCase { } } + @SuppressWarnings("AlwaysThrows") public void testOfWithDuplicateKey() { try { ImmutableBiMap.of("one", 1, "one", 1); @@ -640,7 +642,7 @@ public class ImmutableBiMapTest extends TestCase { .put("three", 3) .put("four", 4) .put("five", 5) - .build()); + .buildOrThrow()); assertMapEquals(bimap, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); assertMapEquals(bimap.inverse(), 1, "one", 2, "two", 3, "three", 4, "four", 5, "five"); } @@ -652,13 +654,14 @@ public class ImmutableBiMapTest extends TestCase { .put("two", 2) .put("uno", 1) .put("dos", 2) - .build(); + .buildOrThrow(); try { ImmutableBiMap.copyOf(map); fail(); } catch (IllegalArgumentException expected) { - assertThat(expected.getMessage()).contains("1"); + assertThat(expected.getMessage()).containsMatch("1|2"); + // We don't specify which of the two dups should be reported. } } @@ -689,6 +692,7 @@ public class ImmutableBiMapTest extends TestCase { public static class BiMapSpecificTests extends TestCase { + @SuppressWarnings("DoNotCall") public void testForcePut() { BiMap<String, Integer> bimap = ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2)); try { @@ -748,11 +752,11 @@ public class ImmutableBiMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } /** No-op test so that the class has at least one method, making Maven's test runner happy. */ diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index f4da97180..898d2a4b4 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -57,6 +57,8 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; @@ -68,6 +70,7 @@ import junit.framework.TestSuite; * @author Jesse Wilson */ @GwtCompatible(emulated = true) +@SuppressWarnings("AlwaysThrows") public class ImmutableMapTest extends TestCase { @GwtIncompatible // suite @@ -178,7 +181,7 @@ public class ImmutableMapTest extends TestCase { throw new UnsupportedOperationException(); } - private static final Joiner joiner = Joiner.on(", "); + private static final Joiner JOINER = Joiner.on(", "); @Override protected void assertMoreInvariants(Map<K, V> map) { @@ -187,10 +190,10 @@ public class ImmutableMapTest extends TestCase { assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString()); } - assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString()); - assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString()); - assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString()); - assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString()); + assertEquals("{" + JOINER.join(map.entrySet()) + "}", map.toString()); + assertEquals("[" + JOINER.join(map.entrySet()) + "]", map.entrySet().toString()); + assertEquals("[" + JOINER.join(map.keySet()) + "]", map.keySet().toString()); + assertEquals("[" + JOINER.join(map.values()) + "]", map.values().toString()); assertEquals(MinimalSet.from(map.entrySet()), map.entrySet()); assertEquals(Sets.newHashSet(map.keySet()), map.keySet()); @@ -318,12 +321,13 @@ public class ImmutableMapTest extends TestCase { public static class CreationTests extends TestCase { public void testEmptyBuilder() { - ImmutableMap<String, Integer> map = new Builder<String, Integer>().build(); + ImmutableMap<String, Integer> map = new Builder<String, Integer>().buildOrThrow(); assertEquals(Collections.<String, Integer>emptyMap(), map); } public void testSingletonBuilder() { - ImmutableMap<String, Integer> map = new Builder<String, Integer>().put("one", 1).build(); + ImmutableMap<String, Integer> map = + new Builder<String, Integer>().put("one", 1).buildOrThrow(); assertMapEquals(map, "one", 1); } @@ -335,7 +339,7 @@ public class ImmutableMapTest extends TestCase { .put("three", 3) .put("four", 4) .put("five", 5) - .build(); + .buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } @@ -348,7 +352,7 @@ public class ImmutableMapTest extends TestCase { } Object[] builderArrayAfterPuts = builder.alternatingKeysAndValues; RegularImmutableMap<Integer, Integer> map = - (RegularImmutableMap<Integer, Integer>) builder.build(); + (RegularImmutableMap<Integer, Integer>) builder.buildOrThrow(); Object[] mapInternalArray = map.alternatingKeysAndValues; assertSame(builderArray, builderArrayAfterPuts); assertSame(builderArray, mapInternalArray); @@ -363,16 +367,16 @@ public class ImmutableMapTest extends TestCase { .put("five", 5) .put("four", 4) .put("two", 2) - .build(); + .buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } public void testBuilder_orderEntriesByValueAfterExactSizeBuild() { Builder<String, Integer> builder = new Builder<String, Integer>(2).put("four", 4).put("one", 1); - ImmutableMap<String, Integer> keyOrdered = builder.build(); + ImmutableMap<String, Integer> keyOrdered = builder.buildOrThrow(); ImmutableMap<String, Integer> valueOrdered = - builder.orderEntriesByValue(Ordering.natural()).build(); + builder.orderEntriesByValue(Ordering.natural()).buildOrThrow(); assertMapEquals(keyOrdered, "four", 4, "one", 1); assertMapEquals(valueOrdered, "one", 1, "four", 4); } @@ -387,9 +391,45 @@ public class ImmutableMapTest extends TestCase { } } + @GwtIncompatible // we haven't implemented this + public void testBuilder_orderEntriesByValue_keepingLast() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .orderEntriesByValue(Ordering.natural()) + .put("three", 3) + .put("one", 1) + .put("five", 5) + .put("four", 3) + .put("four", 5) + .put("four", 4) // this should win because it's last + .put("two", 2); + assertMapEquals( + builder.buildKeepingLast(), "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + } + } + + @GwtIncompatible // we haven't implemented this + public void testBuilder_orderEntriesByValue_keepingLast_builderSizeFieldPreserved() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .orderEntriesByValue(Ordering.natural()) + .put("one", 1) + .put("one", 1); + assertMapEquals(builder.buildKeepingLast(), "one", 1); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + } + } + public void testBuilder_withImmutableEntry() { ImmutableMap<String, Integer> map = - new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build(); + new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).buildOrThrow(); assertMapEquals(map, "one", 1); } @@ -430,12 +470,14 @@ public class ImmutableMapTest extends TestCase { builder.put(entry); holder.string = "two"; - assertMapEquals(builder.build(), "one", 1); + assertMapEquals(builder.buildOrThrow(), "one", 1); } public void testBuilderPutAllWithEmptyMap() { ImmutableMap<String, Integer> map = - new Builder<String, Integer>().putAll(Collections.<String, Integer>emptyMap()).build(); + new Builder<String, Integer>() + .putAll(Collections.<String, Integer>emptyMap()) + .buildOrThrow(); assertEquals(Collections.<String, Integer>emptyMap(), map); } @@ -449,14 +491,14 @@ public class ImmutableMapTest extends TestCase { moreToPut.put("five", 5); ImmutableMap<String, Integer> map = - new Builder<String, Integer>().putAll(toPut).putAll(moreToPut).build(); + new Builder<String, Integer>().putAll(toPut).putAll(moreToPut).buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } public void testBuilderReuse() { Builder<String, Integer> builder = new Builder<>(); - ImmutableMap<String, Integer> mapOne = builder.put("one", 1).put("two", 2).build(); - ImmutableMap<String, Integer> mapTwo = builder.put("three", 3).put("four", 4).build(); + ImmutableMap<String, Integer> mapOne = builder.put("one", 1).put("two", 2).buildOrThrow(); + ImmutableMap<String, Integer> mapTwo = builder.put("three", 3).put("four", 4).buildOrThrow(); assertMapEquals(mapOne, "one", 1, "two", 2); assertMapEquals(mapTwo, "one", 1, "two", 2, "three", 3, "four", 4); @@ -470,7 +512,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } public void testBuilderPutImmutableEntryWithNullKeyFailsAtomically() { @@ -481,7 +523,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } // for GWT compatibility @@ -513,7 +555,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } public void testBuilderPutNullKey() { @@ -556,15 +598,108 @@ public class ImmutableMapTest extends TestCase { Builder<String, Integer> builder = new Builder<String, Integer>() .put("one", 1) - .put("one", 1); // throwing on this line would be even better + .put("one", 1); // throwing on this line might be better but it's too late to change try { - builder.build(); + builder.buildOrThrow(); fail(); } catch (IllegalArgumentException expected) { } } + public void testBuildKeepingLast_allowsOverwrite() { + Builder<Integer, String> builder = + new Builder<Integer, String>() + .put(1, "un") + .put(2, "deux") + .put(70, "soixante-dix") + .put(70, "septante") + .put(70, "seventy") + .put(1, "one") + .put(2, "two"); + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertMapEquals(map, 1, "one", 2, "two", 70, "seventy"); + } + + public void testBuildKeepingLast_smallTableSameHash() { + String key1 = "QED"; + String key2 = "R&D"; + assertThat(key1.hashCode()).isEqualTo(key2.hashCode()); + ImmutableMap<String, Integer> map = + ImmutableMap.<String, Integer>builder() + .put(key1, 1) + .put(key2, 2) + .put(key1, 3) + .put(key2, 4) + .buildKeepingLast(); + assertMapEquals(map, key1, 3, key2, 4); + } + + // The java7 branch has different code depending on whether the entry indexes fit in a byte, + // short, or int. The small table in testBuildKeepingLast_allowsOverwrite will test the byte + // case. This method tests the short case. + public void testBuildKeepingLast_shortTable() { + Builder<Integer, String> builder = ImmutableMap.builder(); + Map<Integer, String> expected = new LinkedHashMap<>(); + for (int i = 0; i < 1000; i++) { + // Truncate to even key, so we have put(0, "0") then put(0, "1"). Half the entries are + // duplicates. + Integer key = i & ~1; + String value = String.valueOf(i); + builder.put(key, value); + expected.put(key, value); + } + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertThat(map).hasSize(500); + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); + } + + // This method tests the int case. + public void testBuildKeepingLast_bigTable() { + Builder<Integer, String> builder = ImmutableMap.builder(); + Map<Integer, String> expected = new LinkedHashMap<>(); + for (int i = 0; i < 200_000; i++) { + // Truncate to even key, so we have put(0, "0") then put(0, "1"). Half the entries are + // duplicates. + Integer key = i & ~1; + String value = String.valueOf(i); + builder.put(key, value); + expected.put(key, value); + } + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertThat(map).hasSize(100_000); + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); + } + + @GwtIncompatible // Pattern, Matcher + public void testBuilder_keepingLast_thenOrThrow() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .put("three", 3) + .put("one", 1) + .put("five", 5) + .put("four", 3) + .put("four", 5) + .put("four", 4) // this should win because it's last + .put("two", 2); + assertMapEquals( + builder.buildKeepingLast(), "three", 3, "one", 1, "five", 5, "four", 4, "two", 2); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + // We don't really care which values the exception message contains, but they should be + // different from each other. If buildKeepingLast() collapsed duplicates, that might end up + // not being true. + Pattern pattern = + Pattern.compile("Multiple entries with same key: four=(.*) and four=(.*)"); + assertThat(expected).hasMessageThat().matches(pattern); + Matcher matcher = pattern.matcher(expected.getMessage()); + assertThat(matcher.matches()).isTrue(); + assertThat(matcher.group(1)).isNotEqualTo(matcher.group(2)); + } + } + public void testOf() { assertMapEquals(ImmutableMap.of("one", 1), "one", 1); assertMapEquals(ImmutableMap.of("one", 1, "two", 2), "one", 1, "two", 2); @@ -877,12 +1012,11 @@ public class ImmutableMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - assertEquals(map.size(), alternatingKeysAndValues.length / 2); - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } private static class IntHolder implements Serializable { @@ -982,50 +1116,53 @@ public class ImmutableMapTest extends TestCase { public void testEquals() { new EqualsTester() .addEqualityGroup( - ImmutableMap.of(), ImmutableMap.builder().build(), ImmutableMap.ofEntries(), map()) + ImmutableMap.of(), + ImmutableMap.builder().buildOrThrow(), + ImmutableMap.ofEntries(), + map()) .addEqualityGroup( ImmutableMap.of(1, 1), - ImmutableMap.builder().put(1, 1).build(), + ImmutableMap.builder().put(1, 1).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1)), map(1, 1)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2), - ImmutableMap.builder().put(1, 1).put(2, 2).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2)), map(1, 1, 2, 2)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3)), map(1, 1, 2, 2, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 4, 2, 2, 3, 3), - ImmutableMap.builder().put(1, 4).put(2, 2).put(3, 3).build(), + ImmutableMap.builder().put(1, 4).put(2, 2).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 4), entry(2, 2), entry(3, 3)), map(1, 4, 2, 2, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 4, 3, 3), - ImmutableMap.builder().put(1, 1).put(2, 4).put(3, 3).build(), + ImmutableMap.builder().put(1, 1).put(2, 4).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 4), entry(3, 3)), map(1, 1, 2, 4, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 4), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 4).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 4).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 4)), map(1, 1, 2, 2, 3, 4)) .addEqualityGroup( ImmutableMap.of(1, 2, 2, 3, 3, 1), - ImmutableMap.builder().put(1, 2).put(2, 3).put(3, 1).build(), + ImmutableMap.builder().put(1, 2).put(2, 3).put(3, 1).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 2), entry(2, 3), entry(3, 1)), map(1, 2, 2, 3, 3, 1)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3, 4, 4), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3), entry(4, 4)), map(1, 1, 2, 2, 3, 3, 4, 4)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).put(5, 5).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).put(5, 5).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3), entry(4, 4), entry(5, 5)), map(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)) .testEquals(); diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java index 5ca1f5861..4c2bf3f92 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java @@ -312,6 +312,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { assertEquals(expectedComplement, rangeSet.complement()); } + @SuppressWarnings("DoNotCall") public void testAddUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -327,6 +328,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testAddAllUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -342,6 +344,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testRemoveUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -357,6 +360,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testRemoveAllUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index 850a8e73b..4a9178b4a 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -56,6 +56,7 @@ import junit.framework.TestSuite; * @author Jared Levy */ @GwtCompatible(emulated = true) +@SuppressWarnings("AlwaysThrows") public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest @@ -875,12 +876,11 @@ public class ImmutableSortedMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - assertEquals(map.size(), alternatingKeysAndValues.length / 2); - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } private static class IntHolder implements Serializable { diff --git a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java index 15f7ccc20..e71c8bd51 100644 --- a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java @@ -74,6 +74,7 @@ public class IteratorsTest extends TestCase { return suite; } + @SuppressWarnings("DoNotCall") public void testEmptyIterator() { Iterator<String> iterator = Iterators.emptyIterator(); assertFalse(iterator.hasNext()); @@ -89,6 +90,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testEmptyListIterator() { ListIterator<String> iterator = Iterators.emptyListIterator(); assertFalse(iterator.hasNext()); @@ -1119,6 +1121,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testForArrayTypical() { String[] array = {"foo", "bar"}; Iterator<String> iterator = Iterators.forArray(array); @@ -1205,6 +1208,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testForEnumerationSingleton() { Enumeration<Integer> enumer = enumerate(1); Iterator<Integer> iter = Iterators.forEnumeration(enumer); diff --git a/android/guava-tests/test/com/google/common/collect/ListsTest.java b/android/guava-tests/test/com/google/common/collect/ListsTest.java index ef90e5493..33736d6d8 100644 --- a/android/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/android/guava-tests/test/com/google/common/collect/ListsTest.java @@ -619,14 +619,14 @@ public class ListsTest extends TestCase { public void testCartesianProduct_indexOf() { List<List<Integer>> actual = Lists.cartesianProduct(list(1, 2), list(3, 4)); - assertEquals(actual.indexOf(list(1, 3)), 0); - assertEquals(actual.indexOf(list(1, 4)), 1); - assertEquals(actual.indexOf(list(2, 3)), 2); - assertEquals(actual.indexOf(list(2, 4)), 3); - assertEquals(actual.indexOf(list(3, 1)), -1); - - assertEquals(actual.indexOf(list(1)), -1); - assertEquals(actual.indexOf(list(1, 1, 1)), -1); + assertEquals(0, actual.indexOf(list(1, 3))); + assertEquals(1, actual.indexOf(list(1, 4))); + assertEquals(2, actual.indexOf(list(2, 3))); + assertEquals(3, actual.indexOf(list(2, 4))); + assertEquals(-1, actual.indexOf(list(3, 1))); + + assertEquals(-1, actual.indexOf(list(1))); + assertEquals(-1, actual.indexOf(list(1, 1, 1))); } public void testCartesianProduct_lastIndexOf() { diff --git a/android/guava-tests/test/com/google/common/collect/MapMakerTest.java b/android/guava-tests/test/com/google/common/collect/MapMakerTest.java index 4b54f0dd5..9669ded7c 100644 --- a/android/guava-tests/test/com/google/common/collect/MapMakerTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapMakerTest.java @@ -57,31 +57,28 @@ public class MapMakerTest extends TestCase { * anywhere else */ - /** Tests for the builder. */ - public static class MakerTest extends TestCase { - public void testInitialCapacity_negative() { - MapMaker maker = new MapMaker(); - try { - maker.initialCapacity(-1); - fail(); - } catch (IllegalArgumentException expected) { - } + public void testInitialCapacity_negative() { + MapMaker maker = new MapMaker(); + try { + maker.initialCapacity(-1); + fail(); + } catch (IllegalArgumentException expected) { } + } - // TODO(cpovirk): enable when ready - public void xtestInitialCapacity_setTwice() { - MapMaker maker = new MapMaker().initialCapacity(16); - try { - // even to the same value is not allowed - maker.initialCapacity(16); - fail(); - } catch (IllegalArgumentException expected) { - } + // TODO(cpovirk): enable when ready (apparently after a change to our GWT emulation) + public void xtestInitialCapacity_setTwice() { + MapMaker maker = new MapMaker().initialCapacity(16); + try { + // even to the same value is not allowed + maker.initialCapacity(16); + fail(); + } catch (IllegalStateException expected) { } + } - public void testReturnsPlainConcurrentHashMapWhenPossible() { - Map<?, ?> map = new MapMaker().initialCapacity(5).makeMap(); - assertTrue(map instanceof ConcurrentHashMap); - } + public void testReturnsPlainConcurrentHashMapWhenPossible() { + Map<?, ?> map = new MapMaker().initialCapacity(5).makeMap(); + assertTrue(map instanceof ConcurrentHashMap); } } diff --git a/android/guava-tests/test/com/google/common/collect/MapsCollectionTest.java b/android/guava-tests/test/com/google/common/collect/MapsCollectionTest.java index 54aa1aa2e..9aa8e66b7 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsCollectionTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsCollectionTest.java @@ -49,10 +49,10 @@ import java.util.NavigableSet; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Test suites for wrappers in {@code Maps}. @@ -561,7 +561,7 @@ public class MapsCollectionTest extends TestCase { static final Predicate<String> FILTER_KEYS = new Predicate<String>() { @Override - public boolean apply(@NullableDecl String string) { + public boolean apply(@CheckForNull String string) { return !"banana".equals(string) && !"eggplant".equals(string); } }; @@ -569,7 +569,7 @@ public class MapsCollectionTest extends TestCase { static final Predicate<String> FILTER_VALUES = new Predicate<String>() { @Override - public boolean apply(@NullableDecl String string) { + public boolean apply(@CheckForNull String string) { return !"toast".equals(string) && !"spam".equals(string); } }; diff --git a/android/guava-tests/test/com/google/common/collect/MapsTest.java b/android/guava-tests/test/com/google/common/collect/MapsTest.java index 76394c883..d0f983863 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTest.java @@ -1153,8 +1153,8 @@ public class MapsTest extends TestCase { biMap.put("two", 2); Converter<String, Integer> converter = Maps.asConverter(biMap); - assertSame(1, converter.convert("one")); - assertSame(2, converter.convert("two")); + assertEquals((Integer) 1, converter.convert("one")); + assertEquals((Integer) 2, converter.convert("two")); try { converter.convert("three"); fail(); @@ -1163,9 +1163,9 @@ public class MapsTest extends TestCase { biMap.put("three", 3); - assertSame(1, converter.convert("one")); - assertSame(2, converter.convert("two")); - assertSame(3, converter.convert("three")); + assertEquals((Integer) 1, converter.convert("one")); + assertEquals((Integer) 2, converter.convert("two")); + assertEquals((Integer) 3, converter.convert("three")); } public void testAsConverter_withNullMapping() throws Exception { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java index d81f546c5..b4382dbca 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java @@ -25,7 +25,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Tests for {@link Maps#transformValues}. @@ -156,7 +156,7 @@ public class MapsTransformValuesTest extends MapInterfaceTest<String, String> { underlying, new Function<String, Boolean>() { @Override - public Boolean apply(@NullableDecl String from) { + public Boolean apply(@CheckForNull String from) { return from == null; } }); @@ -274,7 +274,7 @@ public class MapsTransformValuesTest extends MapInterfaceTest<String, String> { underlying, new Function<Boolean, Boolean>() { @Override - public Boolean apply(@NullableDecl Boolean from) { + public Boolean apply(@CheckForNull Boolean from) { return (from == null) ? true : null; } }); diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java index 81a2d935b..10739513f 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java @@ -25,7 +25,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Tests for {@link Maps#transformValues} when the backing map's views have iterators that don't @@ -232,7 +232,7 @@ public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTes underlying, new Function<String, Boolean>() { @Override - public Boolean apply(@NullableDecl String from) { + public Boolean apply(@CheckForNull String from) { return from == null; } }); @@ -350,7 +350,7 @@ public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTes underlying, new Function<Boolean, Boolean>() { @Override - public Boolean apply(@NullableDecl Boolean from) { + public Boolean apply(@CheckForNull Boolean from) { return (from == null) ? true : null; } }); diff --git a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java index 1a8f84e5a..02ea574bb 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -55,8 +55,8 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeSet; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit test for {@code Multimaps}. @@ -267,8 +267,8 @@ public class MultimapsTest extends TestCase { private static void checkUnmodifiableMultimap( Multimap<String, Integer> multimap, boolean permitsDuplicates, - @NullableDecl String nullKey, - @NullableDecl Integer nullValue) { + @CheckForNull String nullKey, + @CheckForNull Integer nullValue) { Multimap<String, Integer> unmodifiable = prepareUnmodifiableTests(multimap, permitsDuplicates, nullKey, nullValue); @@ -297,8 +297,8 @@ public class MultimapsTest extends TestCase { private static Multimap<String, Integer> prepareUnmodifiableTests( Multimap<String, Integer> multimap, boolean permitsDuplicates, - @NullableDecl String nullKey, - @NullableDecl Integer nullValue) { + @CheckForNull String nullKey, + @CheckForNull Integer nullValue) { multimap.clear(); multimap.put("foo", 1); multimap.put("foo", 2); @@ -610,7 +610,8 @@ public class MultimapsTest extends TestCase { assertEquals("[3, 1, 4]", ummodifiable.get(Color.BLUE).toString()); Collection<Integer> collection = multimap.get(Color.BLUE); - assertEquals(collection, collection); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(collection.equals(collection)); assertFalse(multimap.keySet() instanceof SortedSet); assertFalse(multimap.asMap() instanceof SortedMap); diff --git a/android/guava-tests/test/com/google/common/collect/OrderingTest.java b/android/guava-tests/test/com/google/common/collect/OrderingTest.java index b449a29ee..7c4acc943 100644 --- a/android/guava-tests/test/com/google/common/collect/OrderingTest.java +++ b/android/guava-tests/test/com/google/common/collect/OrderingTest.java @@ -40,8 +40,8 @@ import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.RandomAccess; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit tests for {@code Ordering}. @@ -1030,7 +1030,7 @@ public class OrderingTest extends TestCase { scenario.ordering.onResultOf( new Function<Integer, T>() { @Override - public T apply(@NullableDecl Integer from) { + public T apply(@CheckForNull Integer from) { return scenario.strictlyOrderedList.get(from); } }); diff --git a/android/guava-tests/test/com/google/common/collect/RangeTest.java b/android/guava-tests/test/com/google/common/collect/RangeTest.java index 9a2cd7416..e8578bfd1 100644 --- a/android/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/android/guava-tests/test/com/google/common/collect/RangeTest.java @@ -20,6 +20,7 @@ import static com.google.common.collect.BoundType.CLOSED; import static com.google.common.collect.BoundType.OPEN; import static com.google.common.collect.DiscreteDomain.integers; import static com.google.common.testing.SerializableTester.reserializeAndAssert; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; import com.google.common.annotations.GwtCompatible; @@ -349,11 +350,14 @@ public class RangeTest extends TestCase { range.intersection(Range.open(3, 5)); fail(); } catch (IllegalArgumentException expected) { + // TODO(kevinb): convert the rest of this file to Truth someday + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.closed(0, 2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } @@ -368,11 +372,13 @@ public class RangeTest extends TestCase { range.intersection(Range.lessThan(3)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.greaterThan(4)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } range = Range.closed(3, 4); @@ -395,11 +401,13 @@ public class RangeTest extends TestCase { range.intersection(Range.atLeast(4)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.atMost(2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } @@ -411,6 +419,7 @@ public class RangeTest extends TestCase { range.intersection(Range.closed(0, 2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } // adjacent below @@ -451,6 +460,7 @@ public class RangeTest extends TestCase { range.intersection(Range.closed(10, 12)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } diff --git a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index b6c2358c5..b0f9e16e4 100644 --- a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java @@ -30,7 +30,8 @@ public class RegularImmutableAsListTest extends TestCase { */ public void testDoesntCheckForNull() { ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3); - new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null}); + ImmutableList<Integer> unused = + new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null}); // shouldn't throw! } } diff --git a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java index 7a1ec3a65..9a26f2945 100644 --- a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java @@ -291,92 +291,90 @@ public class SetOperationsTest extends TestCase { .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES) .createTestSuite()); - suite.addTestSuite(MoreTests.class); + suite.addTestSuite(SetOperationsTest.class); return suite; } - public static class MoreTests extends TestCase { - Set<String> friends; - Set<String> enemies; - - @Override - public void setUp() { - friends = Sets.newHashSet("Tom", "Joe", "Dave"); - enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - } - - public void testUnion() { - Set<String> all = Sets.union(friends, enemies); - assertEquals(5, all.size()); - - ImmutableSet<String> immut = Sets.union(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.union(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Buck"); - assertEquals(6, all.size()); - assertEquals(5, immut.size()); - assertEquals(5, mut.size()); - } - - public void testIntersection() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> frenemies = Sets.intersection(friends, enemies); - assertEquals(1, frenemies.size()); - - ImmutableSet<String> immut = Sets.intersection(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.intersection(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Joe"); - assertEquals(2, frenemies.size()); - assertEquals(1, immut.size()); - assertEquals(1, mut.size()); - } - - public void testDifference() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> goodFriends = Sets.difference(friends, enemies); - assertEquals(2, goodFriends.size()); - - ImmutableSet<String> immut = Sets.difference(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.difference(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Dave"); - assertEquals(1, goodFriends.size()); - assertEquals(2, immut.size()); - assertEquals(2, mut.size()); - } - - public void testSymmetricDifference() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> symmetricDifferenceFriendsFirst = Sets.symmetricDifference(friends, enemies); - assertEquals(4, symmetricDifferenceFriendsFirst.size()); - - Set<String> symmetricDifferenceEnemiesFirst = Sets.symmetricDifference(enemies, friends); - assertEquals(4, symmetricDifferenceEnemiesFirst.size()); - - assertEquals(symmetricDifferenceFriendsFirst, symmetricDifferenceEnemiesFirst); - - ImmutableSet<String> immut = Sets.symmetricDifference(friends, enemies).immutableCopy(); - HashSet<String> mut = - Sets.symmetricDifference(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Dave"); - assertEquals(3, symmetricDifferenceFriendsFirst.size()); - assertEquals(4, immut.size()); - assertEquals(4, mut.size()); - - immut = Sets.symmetricDifference(enemies, friends).immutableCopy(); - mut = Sets.symmetricDifference(enemies, friends).copyInto(new HashSet<String>()); - friends.add("Harry"); - assertEquals(2, symmetricDifferenceEnemiesFirst.size()); - assertEquals(3, immut.size()); - assertEquals(3, mut.size()); - } + Set<String> friends; + Set<String> enemies; + + @Override + public void setUp() { + friends = Sets.newHashSet("Tom", "Joe", "Dave"); + enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + } + + public void testUnion() { + Set<String> all = Sets.union(friends, enemies); + assertEquals(5, all.size()); + + ImmutableSet<String> immut = Sets.union(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.union(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Buck"); + assertEquals(6, all.size()); + assertEquals(5, immut.size()); + assertEquals(5, mut.size()); + } + + public void testIntersection() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> frenemies = Sets.intersection(friends, enemies); + assertEquals(1, frenemies.size()); + + ImmutableSet<String> immut = Sets.intersection(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.intersection(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Joe"); + assertEquals(2, frenemies.size()); + assertEquals(1, immut.size()); + assertEquals(1, mut.size()); + } + + public void testDifference() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> goodFriends = Sets.difference(friends, enemies); + assertEquals(2, goodFriends.size()); + + ImmutableSet<String> immut = Sets.difference(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.difference(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Dave"); + assertEquals(1, goodFriends.size()); + assertEquals(2, immut.size()); + assertEquals(2, mut.size()); + } + + public void testSymmetricDifference() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> symmetricDifferenceFriendsFirst = Sets.symmetricDifference(friends, enemies); + assertEquals(4, symmetricDifferenceFriendsFirst.size()); + + Set<String> symmetricDifferenceEnemiesFirst = Sets.symmetricDifference(enemies, friends); + assertEquals(4, symmetricDifferenceEnemiesFirst.size()); + + assertEquals(symmetricDifferenceFriendsFirst, symmetricDifferenceEnemiesFirst); + + ImmutableSet<String> immut = Sets.symmetricDifference(friends, enemies).immutableCopy(); + HashSet<String> mut = + Sets.symmetricDifference(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Dave"); + assertEquals(3, symmetricDifferenceFriendsFirst.size()); + assertEquals(4, immut.size()); + assertEquals(4, mut.size()); + + immut = Sets.symmetricDifference(enemies, friends).immutableCopy(); + mut = Sets.symmetricDifference(enemies, friends).copyInto(new HashSet<String>()); + friends.add("Harry"); + assertEquals(2, symmetricDifferenceEnemiesFirst.size()); + assertEquals(3, immut.size()); + assertEquals(3, mut.size()); } } diff --git a/android/guava-tests/test/com/google/common/collect/SetsTest.java b/android/guava-tests/test/com/google/common/collect/SetsTest.java index 8aa8d8312..d7799cec0 100644 --- a/android/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetsTest.java @@ -73,10 +73,10 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.CopyOnWriteArraySet; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit test for {@code Sets}. @@ -325,6 +325,7 @@ public class SetsTest extends TestCase { D } + @SuppressWarnings("DoNotCall") public void testImmutableEnumSet() { Set<SomeEnum> units = Sets.immutableEnumSet(SomeEnum.D, SomeEnum.B); @@ -1076,7 +1077,7 @@ public class SetsTest extends TestCase { * same as the given comparator. */ private static <E> void verifySortedSetContents( - SortedSet<E> set, Iterable<E> iterable, @NullableDecl Comparator<E> comparator) { + SortedSet<E> set, Iterable<E> iterable, @CheckForNull Comparator<E> comparator) { assertSame(comparator, set.comparator()); verifySetContents(set, iterable); } diff --git a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java index 830536dfc..02ab44b9f 100644 --- a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java @@ -28,10 +28,10 @@ import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit test for {@link AbstractMultiset}. @@ -106,7 +106,7 @@ public class SimpleAbstractMultisetTest extends TestCase { } @Override - public int count(@NullableDecl Object element) { + public int count(@CheckForNull Object element) { for (Entry<E> entry : entrySet()) { if (Objects.equal(entry.getElement(), element)) { return entry.getCount(); @@ -116,7 +116,7 @@ public class SimpleAbstractMultisetTest extends TestCase { } @Override - public int add(@NullableDecl E element, int occurrences) { + public int add(@CheckForNull E element, int occurrences) { checkArgument(occurrences >= 0); Integer frequency = backingMap.get(element); if (frequency == null) { diff --git a/android/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java b/android/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java index b07802a7b..2e15eda32 100644 --- a/android/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java @@ -216,15 +216,15 @@ public class SynchronizedMapTest extends TestCase { } public void testEquals() { - create().equals(new HashMap<String, Integer>()); + boolean unused = create().equals(new HashMap<String, Integer>()); } public void testHashCode() { - create().hashCode(); + int unused = create().hashCode(); } public void testToString() { - create().toString(); + String unused = create().toString(); } public void testSerialization() { diff --git a/android/guava-tests/test/com/google/common/collect/SynchronizedMultimapTest.java b/android/guava-tests/test/com/google/common/collect/SynchronizedMultimapTest.java index 14111da78..3c4f1375a 100644 --- a/android/guava-tests/test/com/google/common/collect/SynchronizedMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/SynchronizedMultimapTest.java @@ -30,10 +30,10 @@ import java.util.Map; import java.util.Map.Entry; import java.util.RandomAccess; import java.util.Set; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@code Synchronized#multimap}. @@ -89,7 +89,7 @@ public class SynchronizedMultimapTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object o) { + public boolean equals(@CheckForNull Object o) { assertTrue(Thread.holdsLock(mutex)); return super.equals(o); } @@ -113,25 +113,25 @@ public class SynchronizedMultimapTest extends TestCase { } @Override - public boolean containsKey(@NullableDecl Object key) { + public boolean containsKey(@CheckForNull Object key) { assertTrue(Thread.holdsLock(mutex)); return super.containsKey(key); } @Override - public boolean containsValue(@NullableDecl Object value) { + public boolean containsValue(@CheckForNull Object value) { assertTrue(Thread.holdsLock(mutex)); return super.containsValue(value); } @Override - public boolean containsEntry(@NullableDecl Object key, @NullableDecl Object value) { + public boolean containsEntry(@CheckForNull Object key, @CheckForNull Object value) { assertTrue(Thread.holdsLock(mutex)); return super.containsEntry(key, value); } @Override - public Set<V> get(@NullableDecl K key) { + public Set<V> get(@CheckForNull K key) { assertTrue(Thread.holdsLock(mutex)); /* TODO: verify that the Collection is also synchronized? */ return super.get(key); @@ -144,7 +144,7 @@ public class SynchronizedMultimapTest extends TestCase { } @Override - public boolean putAll(@NullableDecl K key, Iterable<? extends V> values) { + public boolean putAll(@CheckForNull K key, Iterable<? extends V> values) { assertTrue(Thread.holdsLock(mutex)); return super.putAll(key, values); } @@ -156,19 +156,19 @@ public class SynchronizedMultimapTest extends TestCase { } @Override - public Set<V> replaceValues(@NullableDecl K key, Iterable<? extends V> values) { + public Set<V> replaceValues(@CheckForNull K key, Iterable<? extends V> values) { assertTrue(Thread.holdsLock(mutex)); return super.replaceValues(key, values); } @Override - public boolean remove(@NullableDecl Object key, @NullableDecl Object value) { + public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { assertTrue(Thread.holdsLock(mutex)); return super.remove(key, value); } @Override - public Set<V> removeAll(@NullableDecl Object key) { + public Set<V> removeAll(@CheckForNull Object key) { assertTrue(Thread.holdsLock(mutex)); return super.removeAll(key); } diff --git a/android/guava-tests/test/com/google/common/collect/SynchronizedSetTest.java b/android/guava-tests/test/com/google/common/collect/SynchronizedSetTest.java index 746ad3fc1..5ffcf5d54 100644 --- a/android/guava-tests/test/com/google/common/collect/SynchronizedSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/SynchronizedSetTest.java @@ -27,9 +27,9 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; +import javax.annotation.CheckForNull; import junit.framework.Test; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@code Synchronized#set}. @@ -82,7 +82,7 @@ public class SynchronizedSetTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object o) { + public boolean equals(@CheckForNull Object o) { assertTrue(Thread.holdsLock(mutex)); return super.equals(o); } @@ -94,7 +94,7 @@ public class SynchronizedSetTest extends TestCase { } @Override - public boolean add(@NullableDecl E o) { + public boolean add(@CheckForNull E o) { assertTrue(Thread.holdsLock(mutex)); return super.add(o); } @@ -112,7 +112,7 @@ public class SynchronizedSetTest extends TestCase { } @Override - public boolean contains(@NullableDecl Object o) { + public boolean contains(@CheckForNull Object o) { assertTrue(Thread.holdsLock(mutex)); return super.contains(o); } @@ -132,7 +132,7 @@ public class SynchronizedSetTest extends TestCase { /* Don't test iterator(); it may or may not hold the mutex. */ @Override - public boolean remove(@NullableDecl Object o) { + public boolean remove(@CheckForNull Object o) { assertTrue(Thread.holdsLock(mutex)); return super.remove(o); } diff --git a/android/guava-tests/test/com/google/common/collect/SynchronizedTableTest.java b/android/guava-tests/test/com/google/common/collect/SynchronizedTableTest.java index f418367ea..e1b454436 100644 --- a/android/guava-tests/test/com/google/common/collect/SynchronizedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/SynchronizedTableTest.java @@ -20,7 +20,7 @@ import java.io.Serializable; import java.util.Collection; import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; public class SynchronizedTableTest extends AbstractTableTest { private static final class TestTable<R, C, V> implements Table<R, C, V>, Serializable { @@ -34,7 +34,7 @@ public class SynchronizedTableTest extends AbstractTableTest { } @Override - public boolean equals(@NullableDecl Object o) { + public boolean equals(@CheckForNull Object o) { assertTrue(Thread.holdsLock(mutex)); return delegate.equals(o); } @@ -58,7 +58,7 @@ public class SynchronizedTableTest extends AbstractTableTest { } @Override - public boolean containsValue(@NullableDecl Object value) { + public boolean containsValue(@CheckForNull Object value) { assertTrue(Thread.holdsLock(mutex)); return delegate.containsValue(value); } diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index 77ecbf730..5e474aa70 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java @@ -29,6 +29,7 @@ import junit.framework.TestCase; @GwtCompatible public class UnmodifiableIteratorTest extends TestCase { + @SuppressWarnings("DoNotCall") public void testRemove() { final String[] array = {"a", "b", "c"}; diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index c9d3068e0..36a017d45 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java @@ -29,6 +29,7 @@ import junit.framework.TestCase; */ @GwtCompatible public class UnmodifiableListIteratorTest extends TestCase { + @SuppressWarnings("DoNotCall") public void testRemove() { Iterator<String> iterator = create(); @@ -41,6 +42,7 @@ public class UnmodifiableListIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testAdd() { ListIterator<String> iterator = create(); @@ -55,6 +57,7 @@ public class UnmodifiableListIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testSet() { ListIterator<String> iterator = create(); diff --git a/android/guava-tests/test/com/google/common/escape/EscapersTest.java b/android/guava-tests/test/com/google/common/escape/EscapersTest.java index 245560af6..442232030 100644 --- a/android/guava-tests/test/com/google/common/escape/EscapersTest.java +++ b/android/guava-tests/test/com/google/common/escape/EscapersTest.java @@ -85,7 +85,7 @@ public class EscapersTest extends TestCase { .put('x', "<hello>".toCharArray()) .put('\uD800', "<hi>".toCharArray()) .put('\uDC00', "<lo>".toCharArray()) - .build()); + .buildOrThrow()); UnicodeEscaper unicodeEscaper = Escapers.asUnicodeEscaper(charEscaper); EscaperAsserts.assertBasic(unicodeEscaper); assertEquals("<hello><hi><lo>", charEscaper.escape("x\uD800\uDC00")); diff --git a/android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java b/android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java index 5dee7ca45..225e55500 100644 --- a/android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java +++ b/android/guava-tests/test/com/google/common/eventbus/PackageSanityTests.java @@ -18,7 +18,7 @@ package com.google.common.eventbus; import com.google.common.testing.AbstractPackageSanityTests; import java.lang.reflect.Method; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Basic sanity tests for the entire package. @@ -41,7 +41,7 @@ public class PackageSanityTests extends AbstractPackageSanityTests { private final EventBus eventBus = new EventBus(); @Subscribe - public void handle(@NullableDecl Object anything) {} + public void handle(@CheckForNull Object anything) {} Subscriber toSubscriber() throws Exception { return Subscriber.create(eventBus, this, subscriberMethod()); diff --git a/android/guava-tests/test/com/google/common/eventbus/StringCatcher.java b/android/guava-tests/test/com/google/common/eventbus/StringCatcher.java index 282abe11b..198fa2eda 100644 --- a/android/guava-tests/test/com/google/common/eventbus/StringCatcher.java +++ b/android/guava-tests/test/com/google/common/eventbus/StringCatcher.java @@ -18,8 +18,8 @@ package com.google.common.eventbus; import com.google.common.collect.Lists; import java.util.List; +import javax.annotation.CheckForNull; import junit.framework.Assert; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * A simple EventSubscriber mock that records Strings. @@ -33,11 +33,11 @@ public class StringCatcher { private List<String> events = Lists.newArrayList(); @Subscribe - public void hereHaveAString(@NullableDecl String string) { + public void hereHaveAString(@CheckForNull String string) { events.add(string); } - public void methodWithoutAnnotation(@NullableDecl String string) { + public void methodWithoutAnnotation(@CheckForNull String string) { Assert.fail("Event bus must not call methods without @Subscribe!"); } diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java new file mode 100644 index 000000000..f4af7a751 --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import com.google.common.eventbus.EventBus; +import junit.framework.TestCase; + +/** + * Abstract base class for tests that EventBus finds the correct subscribers. + * + * <p>The actual tests are distributed among the other classes in this package based on whether they + * are annotated or abstract in the superclass. + * + * <p>This test must be outside the c.g.c.eventbus package to test correctly. + * + * @author Louis Wasserman + */ +abstract class AbstractEventBusTest<H> extends TestCase { + static final Object EVENT = new Object(); + + abstract H createSubscriber(); + + private H subscriber; + + H getSubscriber() { + return subscriber; + } + + @Override + protected void setUp() throws Exception { + subscriber = createSubscriber(); + EventBus bus = new EventBus(); + bus.register(subscriber); + bus.post(EVENT); + } + + @Override + protected void tearDown() throws Exception { + subscriber = null; + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java new file mode 100644 index 000000000..a391fcbad --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AbstractNotAnnotatedInSuperclassTest.SubClass; +import java.util.List; + +public class AbstractNotAnnotatedInSuperclassTest extends AbstractEventBusTest<SubClass> { + abstract static class SuperClass { + public abstract void overriddenInSubclassNowhereAnnotated(Object o); + + public abstract void overriddenAndAnnotatedInSubclass(Object o); + } + + static class SubClass extends SuperClass { + final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + + @Override + public void overriddenInSubclassNowhereAnnotated(Object o) { + overriddenInSubclassNowhereAnnotatedEvents.add(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testOverriddenInSubclassNowhereAnnotated() { + assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java new file mode 100644 index 000000000..aea17c3b4 --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AnnotatedAndAbstractInSuperclassTest.SubClass; +import java.util.List; + +public class AnnotatedAndAbstractInSuperclassTest extends AbstractEventBusTest<SubClass> { + abstract static class SuperClass { + @Subscribe + public abstract void overriddenAndAnnotatedInSubclass(Object o); + + @Subscribe + public abstract void overriddenInSubclass(Object o); + } + + static class SubClass extends SuperClass { + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenInSubclassEvents = Lists.newArrayList(); + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + + @Override + public void overriddenInSubclass(Object o) { + overriddenInSubclassEvents.add(o); + } + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenInSubclassEvents).contains(EVENT); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java new file mode 100644 index 000000000..3ec8ea470 --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AnnotatedNotAbstractInSuperclassTest.SubClass; +import java.util.List; + +public class AnnotatedNotAbstractInSuperclassTest extends AbstractEventBusTest<SubClass> { + static class SuperClass { + final List<Object> notOverriddenInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenNotAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenNotAnnotatedInSubclassBadEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenAnnotatedInSubclassBadEvents = Lists.newArrayList(); + + @Subscribe + public void notOverriddenInSubclass(Object o) { + notOverriddenInSubclassEvents.add(o); + } + + @Subscribe + public void overriddenNotAnnotatedInSubclass(Object o) { + overriddenNotAnnotatedInSubclassEvents.add(o); + } + + @Subscribe + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + + @Subscribe + public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { + // the subclass overrides this and does *not* call super.dONAIS(o) + differentlyOverriddenNotAnnotatedInSubclassBadEvents.add(o); + } + + @Subscribe + public void differentlyOverriddenAnnotatedInSubclass(Object o) { + // the subclass overrides this and does *not* call super.dOAIS(o) + differentlyOverriddenAnnotatedInSubclassBadEvents.add(o); + } + } + + static class SubClass extends SuperClass { + final List<Object> differentlyOverriddenNotAnnotatedInSubclassGoodEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenAnnotatedInSubclassGoodEvents = Lists.newArrayList(); + + @Override + public void overriddenNotAnnotatedInSubclass(Object o) { + super.overriddenNotAnnotatedInSubclass(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + super.overriddenAndAnnotatedInSubclass(o); + } + + @Override + public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { + differentlyOverriddenNotAnnotatedInSubclassGoodEvents.add(o); + } + + @Subscribe + @Override + public void differentlyOverriddenAnnotatedInSubclass(Object o) { + differentlyOverriddenAnnotatedInSubclassGoodEvents.add(o); + } + } + + public void testNotOverriddenInSubclass() { + assertThat(getSubscriber().notOverriddenInSubclassEvents).contains(EVENT); + } + + public void testOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenNotAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testDifferentlyOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassGoodEvents) + .contains(EVENT); + assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassBadEvents).isEmpty(); + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testDifferentlyOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassGoodEvents).contains(EVENT); + assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassBadEvents).isEmpty(); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java b/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java deleted file mode 100644 index a1cbb5944..000000000 --- a/android/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (C) 2012 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.eventbus.outside; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.common.collect.Lists; -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.Subscribe; -import java.util.List; -import junit.framework.TestCase; - -/** - * Test that EventBus finds the correct subscribers. - * - * <p>This test must be outside the c.g.c.eventbus package to test correctly. - * - * @author Louis Wasserman - */ -public class AnnotatedSubscriberFinderTests { - - private static final Object EVENT = new Object(); - - abstract static class AbstractEventBusTest<H> extends TestCase { - abstract H createSubscriber(); - - private H subscriber; - - H getSubscriber() { - return subscriber; - } - - @Override - protected void setUp() throws Exception { - subscriber = createSubscriber(); - EventBus bus = new EventBus(); - bus.register(subscriber); - bus.post(EVENT); - } - - @Override - protected void tearDown() throws Exception { - subscriber = null; - } - } - - /* - * We break the tests up based on whether they are annotated or abstract in the superclass. - */ - public static class BaseSubscriberFinderTest - extends AbstractEventBusTest<BaseSubscriberFinderTest.Subscriber> { - static class Subscriber { - final List<Object> nonSubscriberEvents = Lists.newArrayList(); - final List<Object> subscriberEvents = Lists.newArrayList(); - - public void notASubscriber(Object o) { - nonSubscriberEvents.add(o); - } - - @Subscribe - public void subscriber(Object o) { - subscriberEvents.add(o); - } - } - - public void testNonSubscriber() { - assertThat(getSubscriber().nonSubscriberEvents).isEmpty(); - } - - public void testSubscriber() { - assertThat(getSubscriber().subscriberEvents).contains(EVENT); - } - - @Override - Subscriber createSubscriber() { - return new Subscriber(); - } - } - - public static class AnnotatedAndAbstractInSuperclassTest - extends AbstractEventBusTest<AnnotatedAndAbstractInSuperclassTest.SubClass> { - abstract static class SuperClass { - @Subscribe - public abstract void overriddenAndAnnotatedInSubclass(Object o); - - @Subscribe - public abstract void overriddenInSubclass(Object o); - } - - static class SubClass extends SuperClass { - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenInSubclassEvents = Lists.newArrayList(); - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - - @Override - public void overriddenInSubclass(Object o) { - overriddenInSubclassEvents.add(o); - } - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenInSubclassEvents).contains(EVENT); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class AnnotatedNotAbstractInSuperclassTest - extends AbstractEventBusTest<AnnotatedNotAbstractInSuperclassTest.SubClass> { - static class SuperClass { - final List<Object> notOverriddenInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenNotAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> differentlyOverriddenNotAnnotatedInSubclassBadEvents = - Lists.newArrayList(); - final List<Object> differentlyOverriddenAnnotatedInSubclassBadEvents = Lists.newArrayList(); - - @Subscribe - public void notOverriddenInSubclass(Object o) { - notOverriddenInSubclassEvents.add(o); - } - - @Subscribe - public void overriddenNotAnnotatedInSubclass(Object o) { - overriddenNotAnnotatedInSubclassEvents.add(o); - } - - @Subscribe - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - - @Subscribe - public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { - // the subclass overrides this and does *not* call super.dONAIS(o) - differentlyOverriddenNotAnnotatedInSubclassBadEvents.add(o); - } - - @Subscribe - public void differentlyOverriddenAnnotatedInSubclass(Object o) { - // the subclass overrides this and does *not* call super.dOAIS(o) - differentlyOverriddenAnnotatedInSubclassBadEvents.add(o); - } - } - - static class SubClass extends SuperClass { - final List<Object> differentlyOverriddenNotAnnotatedInSubclassGoodEvents = - Lists.newArrayList(); - final List<Object> differentlyOverriddenAnnotatedInSubclassGoodEvents = Lists.newArrayList(); - - @Override - public void overriddenNotAnnotatedInSubclass(Object o) { - super.overriddenNotAnnotatedInSubclass(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - super.overriddenAndAnnotatedInSubclass(o); - } - - @Override - public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { - differentlyOverriddenNotAnnotatedInSubclassGoodEvents.add(o); - } - - @Subscribe - @Override - public void differentlyOverriddenAnnotatedInSubclass(Object o) { - differentlyOverriddenAnnotatedInSubclassGoodEvents.add(o); - } - } - - public void testNotOverriddenInSubclass() { - assertThat(getSubscriber().notOverriddenInSubclassEvents).contains(EVENT); - } - - public void testOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenNotAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testDifferentlyOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassGoodEvents) - .contains(EVENT); - assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassBadEvents).isEmpty(); - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testDifferentlyOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassGoodEvents) - .contains(EVENT); - assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassBadEvents).isEmpty(); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class AbstractNotAnnotatedInSuperclassTest - extends AbstractEventBusTest<AbstractNotAnnotatedInSuperclassTest.SubClass> { - abstract static class SuperClass { - public abstract void overriddenInSubclassNowhereAnnotated(Object o); - - public abstract void overriddenAndAnnotatedInSubclass(Object o); - } - - static class SubClass extends SuperClass { - final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - - @Override - public void overriddenInSubclassNowhereAnnotated(Object o) { - overriddenInSubclassNowhereAnnotatedEvents.add(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testOverriddenInSubclassNowhereAnnotated() { - assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class NeitherAbstractNorAnnotatedInSuperclassTest - extends AbstractEventBusTest<NeitherAbstractNorAnnotatedInSuperclassTest.SubClass> { - static class SuperClass { - final List<Object> neitherOverriddenNorAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - - public void neitherOverriddenNorAnnotated(Object o) { - neitherOverriddenNorAnnotatedEvents.add(o); - } - - public void overriddenInSubclassNowhereAnnotated(Object o) { - overriddenInSubclassNowhereAnnotatedEvents.add(o); - } - - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - } - - static class SubClass extends SuperClass { - @Override - public void overriddenInSubclassNowhereAnnotated(Object o) { - super.overriddenInSubclassNowhereAnnotated(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - super.overriddenAndAnnotatedInSubclass(o); - } - } - - public void testNeitherOverriddenNorAnnotated() { - assertThat(getSubscriber().neitherOverriddenNorAnnotatedEvents).isEmpty(); - } - - public void testOverriddenInSubclassNowhereAnnotated() { - assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class DeepInterfaceTest - extends AbstractEventBusTest<DeepInterfaceTest.SubscriberClass> { - interface Interface1 { - @Subscribe - void annotatedIn1(Object o); - - @Subscribe - void annotatedIn1And2(Object o); - - @Subscribe - void annotatedIn1And2AndClass(Object o); - - void declaredIn1AnnotatedIn2(Object o); - - void declaredIn1AnnotatedInClass(Object o); - - void nowhereAnnotated(Object o); - } - - interface Interface2 extends Interface1 { - @Override - @Subscribe - void declaredIn1AnnotatedIn2(Object o); - - @Override - @Subscribe - void annotatedIn1And2(Object o); - - @Override - @Subscribe - void annotatedIn1And2AndClass(Object o); - - void declaredIn2AnnotatedInClass(Object o); - - @Subscribe - void annotatedIn2(Object o); - } - - static class SubscriberClass implements Interface2 { - final List<Object> annotatedIn1Events = Lists.newArrayList(); - final List<Object> annotatedIn1And2Events = Lists.newArrayList(); - final List<Object> annotatedIn1And2AndClassEvents = Lists.newArrayList(); - final List<Object> declaredIn1AnnotatedIn2Events = Lists.newArrayList(); - final List<Object> declaredIn1AnnotatedInClassEvents = Lists.newArrayList(); - final List<Object> declaredIn2AnnotatedInClassEvents = Lists.newArrayList(); - final List<Object> annotatedIn2Events = Lists.newArrayList(); - final List<Object> nowhereAnnotatedEvents = Lists.newArrayList(); - - @Override - public void annotatedIn1(Object o) { - annotatedIn1Events.add(o); - } - - @Subscribe - @Override - public void declaredIn1AnnotatedInClass(Object o) { - declaredIn1AnnotatedInClassEvents.add(o); - } - - @Override - public void declaredIn1AnnotatedIn2(Object o) { - declaredIn1AnnotatedIn2Events.add(o); - } - - @Override - public void annotatedIn1And2(Object o) { - annotatedIn1And2Events.add(o); - } - - @Subscribe - @Override - public void annotatedIn1And2AndClass(Object o) { - annotatedIn1And2AndClassEvents.add(o); - } - - @Subscribe - @Override - public void declaredIn2AnnotatedInClass(Object o) { - declaredIn2AnnotatedInClassEvents.add(o); - } - - @Override - public void annotatedIn2(Object o) { - annotatedIn2Events.add(o); - } - - @Override - public void nowhereAnnotated(Object o) { - nowhereAnnotatedEvents.add(o); - } - } - - public void testAnnotatedIn1() { - assertThat(getSubscriber().annotatedIn1Events).contains(EVENT); - } - - public void testAnnotatedIn2() { - assertThat(getSubscriber().annotatedIn2Events).contains(EVENT); - } - - public void testAnnotatedIn1And2() { - assertThat(getSubscriber().annotatedIn1And2Events).contains(EVENT); - } - - public void testAnnotatedIn1And2AndClass() { - assertThat(getSubscriber().annotatedIn1And2AndClassEvents).contains(EVENT); - } - - public void testDeclaredIn1AnnotatedIn2() { - assertThat(getSubscriber().declaredIn1AnnotatedIn2Events).contains(EVENT); - } - - public void testDeclaredIn1AnnotatedInClass() { - assertThat(getSubscriber().declaredIn1AnnotatedInClassEvents).contains(EVENT); - } - - public void testDeclaredIn2AnnotatedInClass() { - assertThat(getSubscriber().declaredIn2AnnotatedInClassEvents).contains(EVENT); - } - - public void testNowhereAnnotated() { - assertThat(getSubscriber().nowhereAnnotatedEvents).isEmpty(); - } - - @Override - SubscriberClass createSubscriber() { - return new SubscriberClass(); - } - } -} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java new file mode 100644 index 000000000..461fb795b --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.BaseSubscriberFinderTest.Subscriber; +import java.util.List; + +public class BaseSubscriberFinderTest extends AbstractEventBusTest<Subscriber> { + static class Subscriber { + final List<Object> nonSubscriberEvents = Lists.newArrayList(); + final List<Object> subscriberEvents = Lists.newArrayList(); + + public void notASubscriber(Object o) { + nonSubscriberEvents.add(o); + } + + @Subscribe + public void subscriber(Object o) { + subscriberEvents.add(o); + } + } + + public void testNonSubscriber() { + assertThat(getSubscriber().nonSubscriberEvents).isEmpty(); + } + + public void testSubscriber() { + assertThat(getSubscriber().subscriberEvents).contains(EVENT); + } + + @Override + Subscriber createSubscriber() { + return new Subscriber(); + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java new file mode 100644 index 000000000..4fefbc12a --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.DeepInterfaceTest.SubscriberClass; +import java.util.List; + +public class DeepInterfaceTest extends AbstractEventBusTest<SubscriberClass> { + interface Interface1 { + @Subscribe + void annotatedIn1(Object o); + + @Subscribe + void annotatedIn1And2(Object o); + + @Subscribe + void annotatedIn1And2AndClass(Object o); + + void declaredIn1AnnotatedIn2(Object o); + + void declaredIn1AnnotatedInClass(Object o); + + void nowhereAnnotated(Object o); + } + + interface Interface2 extends Interface1 { + @Override + @Subscribe + void declaredIn1AnnotatedIn2(Object o); + + @Override + @Subscribe + void annotatedIn1And2(Object o); + + @Override + @Subscribe + void annotatedIn1And2AndClass(Object o); + + void declaredIn2AnnotatedInClass(Object o); + + @Subscribe + void annotatedIn2(Object o); + } + + static class SubscriberClass implements Interface2 { + final List<Object> annotatedIn1Events = Lists.newArrayList(); + final List<Object> annotatedIn1And2Events = Lists.newArrayList(); + final List<Object> annotatedIn1And2AndClassEvents = Lists.newArrayList(); + final List<Object> declaredIn1AnnotatedIn2Events = Lists.newArrayList(); + final List<Object> declaredIn1AnnotatedInClassEvents = Lists.newArrayList(); + final List<Object> declaredIn2AnnotatedInClassEvents = Lists.newArrayList(); + final List<Object> annotatedIn2Events = Lists.newArrayList(); + final List<Object> nowhereAnnotatedEvents = Lists.newArrayList(); + + @Override + public void annotatedIn1(Object o) { + annotatedIn1Events.add(o); + } + + @Subscribe + @Override + public void declaredIn1AnnotatedInClass(Object o) { + declaredIn1AnnotatedInClassEvents.add(o); + } + + @Override + public void declaredIn1AnnotatedIn2(Object o) { + declaredIn1AnnotatedIn2Events.add(o); + } + + @Override + public void annotatedIn1And2(Object o) { + annotatedIn1And2Events.add(o); + } + + @Subscribe + @Override + public void annotatedIn1And2AndClass(Object o) { + annotatedIn1And2AndClassEvents.add(o); + } + + @Subscribe + @Override + public void declaredIn2AnnotatedInClass(Object o) { + declaredIn2AnnotatedInClassEvents.add(o); + } + + @Override + public void annotatedIn2(Object o) { + annotatedIn2Events.add(o); + } + + @Override + public void nowhereAnnotated(Object o) { + nowhereAnnotatedEvents.add(o); + } + } + + public void testAnnotatedIn1() { + assertThat(getSubscriber().annotatedIn1Events).contains(EVENT); + } + + public void testAnnotatedIn2() { + assertThat(getSubscriber().annotatedIn2Events).contains(EVENT); + } + + public void testAnnotatedIn1And2() { + assertThat(getSubscriber().annotatedIn1And2Events).contains(EVENT); + } + + public void testAnnotatedIn1And2AndClass() { + assertThat(getSubscriber().annotatedIn1And2AndClassEvents).contains(EVENT); + } + + public void testDeclaredIn1AnnotatedIn2() { + assertThat(getSubscriber().declaredIn1AnnotatedIn2Events).contains(EVENT); + } + + public void testDeclaredIn1AnnotatedInClass() { + assertThat(getSubscriber().declaredIn1AnnotatedInClassEvents).contains(EVENT); + } + + public void testDeclaredIn2AnnotatedInClass() { + assertThat(getSubscriber().declaredIn2AnnotatedInClassEvents).contains(EVENT); + } + + public void testNowhereAnnotated() { + assertThat(getSubscriber().nowhereAnnotatedEvents).isEmpty(); + } + + @Override + SubscriberClass createSubscriber() { + return new SubscriberClass(); + } +} diff --git a/android/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java b/android/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java new file mode 100644 index 000000000..a2aca555b --- /dev/null +++ b/android/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.NeitherAbstractNorAnnotatedInSuperclassTest.SubClass; +import java.util.List; + +public class NeitherAbstractNorAnnotatedInSuperclassTest extends AbstractEventBusTest<SubClass> { + static class SuperClass { + final List<Object> neitherOverriddenNorAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + + public void neitherOverriddenNorAnnotated(Object o) { + neitherOverriddenNorAnnotatedEvents.add(o); + } + + public void overriddenInSubclassNowhereAnnotated(Object o) { + overriddenInSubclassNowhereAnnotatedEvents.add(o); + } + + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + } + + static class SubClass extends SuperClass { + @Override + public void overriddenInSubclassNowhereAnnotated(Object o) { + super.overriddenInSubclassNowhereAnnotated(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + super.overriddenAndAnnotatedInSubclass(o); + } + } + + public void testNeitherOverriddenNorAnnotated() { + assertThat(getSubscriber().neitherOverriddenNorAnnotatedEvents).isEmpty(); + } + + public void testOverriddenInSubclassNowhereAnnotated() { + assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/android/guava-tests/test/com/google/common/hash/BloomFilterTest.java b/android/guava-tests/test/com/google/common/hash/BloomFilterTest.java index f69b57853..d99be0902 100644 --- a/android/guava-tests/test/com/google/common/hash/BloomFilterTest.java +++ b/android/guava-tests/test/com/google/common/hash/BloomFilterTest.java @@ -36,8 +36,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for SimpleGenericBloomFilter and derived BloomFilter views. @@ -408,7 +408,7 @@ public class BloomFilterTest extends TestCase { } @Override - public boolean equals(@NullableDecl Object object) { + public boolean equals(@CheckForNull Object object) { return (object instanceof CustomFunnel); } @@ -506,7 +506,10 @@ public class BloomFilterTest extends TestCase { ByteArrayOutputStream out = new ByteArrayOutputStream(); bf.writeTo(out); - assertEquals(bf, BloomFilter.readFrom(new ByteArrayInputStream(out.toByteArray()), funnel)); + BloomFilter<byte[]> read = + BloomFilter.readFrom(new ByteArrayInputStream(out.toByteArray()), funnel); + assertThat(read).isEqualTo(bf); + assertThat(read.expectedFpp()).isGreaterThan(0); } /** diff --git a/android/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java b/android/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java new file mode 100644 index 000000000..effa63291 --- /dev/null +++ b/android/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java @@ -0,0 +1,233 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +package com.google.common.hash; + +import static com.google.common.base.Charsets.ISO_8859_1; +import static com.google.common.base.Charsets.UTF_8; +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableSortedMap; +import com.google.common.collect.Ordering; +import com.google.common.primitives.UnsignedLong; +import java.util.Arrays; +import junit.framework.TestCase; + +/** + * Unit test for Fingerprint2011. + * + * @author kylemaddison@google.com (Kyle Maddison) + */ +public class Fingerprint2011Test extends TestCase { + + // Length of the sample string to produce + private static final int MAX_BYTES = 1000; + + // Map from sample string lengths to the fingerprint + private static final ImmutableSortedMap<Integer, Long> LENGTH_FINGERPRINTS = + new ImmutableSortedMap.Builder<Integer, Long>(Ordering.natural()) + .put(1000, 0x433109b33e13e6edL) + .put(800, 0x5f2f123bfc815f81L) + .put(640, 0x6396fc6a67293cf4L) + .put(512, 0x45c01b4934ddbbbeL) + .put(409, 0xfcd19b617551db45L) + .put(327, 0x4eee69e12854871eL) + .put(261, 0xab753446a3bbd532L) + .put(208, 0x54242fe06a291c3fL) + .put(166, 0x4f7acff7703a635bL) + .put(132, 0xa784bd0a1f22cc7fL) + .put(105, 0xf19118e187456638L) + .put(84, 0x3e2e58f9196abfe5L) + .put(67, 0xd38ae3dec0107aeaL) + .put(53, 0xea3033885868e10eL) + .put(42, 0x1394a146d0d7e04bL) + .put(33, 0x9962499315d2e8daL) + .put(26, 0x0849f5cfa85489b5L) + .put(20, 0x83b395ff19bf2171L) + .put(16, 0x9d33dd141bd55d9aL) + .put(12, 0x196248eb0b02466aL) + .put(9, 0x1cf73a50ff120336L) + .put(7, 0xb451c339457dbf51L) + .put(5, 0x681982c5e7b74064L) + .put(4, 0xc5ce47450ca6c021L) + .put(3, 0x9fcc3c3fde4d5ff7L) + .put(2, 0x090966a836e5fa4bL) + .put(1, 0x8199675ecaa6fe64L) + .put(0, 0x23ad7c904aa665e3L) + .build(); + private static final HashFunction HASH_FN = Hashing.fingerprint2011(); + + // If this test fails, all bets are off + public void testReallySimpleFingerprints() { + assertEquals(8473225671271759044L, fingerprint("test".getBytes(UTF_8))); + // 32 characters long + assertEquals(7345148637025587076L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8))); + // 256 characters long + assertEquals(4904844928629814570L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8))); + } + + public void testStringsConsistency() { + for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) { + assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s)); + } + } + + public void testUtf8() { + char[] charsA = new char[128]; + char[] charsB = new char[128]; + + for (int i = 0; i < charsA.length; i++) { + if (i < 100) { + charsA[i] = 'a'; + charsB[i] = 'a'; + } else { + // Both two-byte characters, but must be different + charsA[i] = (char) (0x0180 + i); + charsB[i] = (char) (0x0280 + i); + } + } + + String stringA = new String(charsA); + String stringB = new String(charsB); + assertThat(stringA).isNotEqualTo(stringB); + assertThat(HASH_FN.hashUnencodedChars(stringA)) + .isNotEqualTo(HASH_FN.hashUnencodedChars(stringB)); + assertThat(fingerprint(stringA.getBytes(UTF_8))) + .isNotEqualTo(fingerprint(stringB.getBytes(UTF_8))); + + // ISO 8859-1 only has 0-255 (ubyte) representation so throws away UTF-8 characters + // greater than 127 (ie with their top bit set). + // Don't attempt to do this in real code. + assertEquals( + fingerprint(stringA.getBytes(ISO_8859_1)), fingerprint(stringB.getBytes(ISO_8859_1))); + } + + public void testMumurHash64() { + byte[] bytes = "test".getBytes(UTF_8); + assertEquals( + 1618900948208871284L, Fingerprint2011.murmurHash64WithSeed(bytes, 0, bytes.length, 1)); + + bytes = "test test test".getBytes(UTF_8); + assertEquals( + UnsignedLong.valueOf("12313169684067793560").longValue(), + Fingerprint2011.murmurHash64WithSeed(bytes, 0, bytes.length, 1)); + } + + public void testPutNonChars() { + Hasher hasher = HASH_FN.newHasher(); + // Expected data is 0x0100010100000000 + hasher + .putBoolean(true) + .putBoolean(true) + .putBoolean(false) + .putBoolean(true) + .putBoolean(false) + .putBoolean(false) + .putBoolean(false) + .putBoolean(false); + final long hashCode = hasher.hash().asLong(); + + hasher = HASH_FN.newHasher(); + hasher + .putByte((byte) 0x01) + .putByte((byte) 0x01) + .putByte((byte) 0x00) + .putByte((byte) 0x01) + .putByte((byte) 0x00) + .putByte((byte) 0x00) + .putByte((byte) 0x00) + .putByte((byte) 0x00); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher + .putChar((char) 0x0101) + .putChar((char) 0x0100) + .putChar((char) 0x0000) + .putChar((char) 0x0000); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putBytes(new byte[] {0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putLong(0x0000000001000101L); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher + .putShort((short) 0x0101) + .putShort((short) 0x0100) + .putShort((short) 0x0000) + .putShort((short) 0x0000); + assertEquals(hashCode, hasher.hash().asLong()); + } + + public void testHashFloatIsStable() { + // This is about the best we can do for floating-point + Hasher hasher = HASH_FN.newHasher(); + hasher.putFloat(0x01000101f).putFloat(0f); + assertEquals(0x96a4f8cc6ecbf16L, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putDouble(0x0000000001000101d); + assertEquals(0xcf54171253fdc198L, hasher.hash().asLong()); + } + + /** Convenience method to compute a fingerprint on a full bytes array. */ + private static long fingerprint(byte[] bytes) { + return fingerprint(bytes, bytes.length); + } + + /** Convenience method to compute a fingerprint on a subset of a byte array. */ + private static long fingerprint(byte[] bytes, int length) { + return HASH_FN.hashBytes(bytes, 0, length).asLong(); + } + + /** + * Tests that the Java port of Fingerprint2011 provides the same results on buffers up to 800 + * bytes long as the original implementation in C++. See http://cl/106539598 + */ + public void testMultipleLengths() { + int iterations = 800; + byte[] buf = new byte[iterations * 4]; + int bufLen = 0; + long h = 0; + for (int i = 0; i < iterations; ++i) { + h ^= fingerprint(buf, i); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, i * i % bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, i * i * i % bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + int x0 = buf[bufLen - 1] & 0xff; + int x1 = buf[bufLen - 2] & 0xff; + int x2 = buf[bufLen - 3] & 0xff; + int x3 = buf[bufLen / 2] & 0xff; + buf[((x0 << 16) + (x1 << 8) + x2) % bufLen] ^= x3; + buf[((x1 << 16) + (x2 << 8) + x3) % bufLen] ^= i % 256; + } + assertEquals(0xeaa3b1c985261632L, h); + } + + private static long remix(long h) { + h ^= h >>> 41; + h *= 949921979; + return h; + } + + private static byte getChar(long h) { + return (byte) ('a' + ((h & 0xfffff) % 26)); + } +} diff --git a/android/guava-tests/test/com/google/common/hash/HashingTest.java b/android/guava-tests/test/com/google/common/hash/HashingTest.java index bc3db34f0..aff5c254f 100644 --- a/android/guava-tests/test/com/google/common/hash/HashingTest.java +++ b/android/guava-tests/test/com/google/common/hash/HashingTest.java @@ -125,6 +125,15 @@ public class HashingTest extends TestCase { Hashing.sipHash24().toString()); } + public void testFingerprint2011() { + HashTestUtils.check2BitAvalanche(Hashing.fingerprint2011(), 100, 0.4); + HashTestUtils.checkAvalanche(Hashing.fingerprint2011(), 100, 0.4); + HashTestUtils.checkNo2BitCharacteristics(Hashing.fingerprint2011()); + HashTestUtils.checkNoFunnels(Hashing.fingerprint2011()); + HashTestUtils.assertInvariants(Hashing.fingerprint2011()); + assertEquals("Hashing.fingerprint2011()", Hashing.fingerprint2011().toString()); + } + @AndroidIncompatible // slow TODO(cpovirk): Maybe just reduce iterations under Android. public void testGoodFastHash() { for (int i = 1; i < 200; i += 17) { @@ -492,6 +501,9 @@ public class HashingTest extends TestCase { .put(Hashing.farmHashFingerprint64(), EMPTY_STRING, "4f40902f3b6ae19a") .put(Hashing.farmHashFingerprint64(), TQBFJOTLD, "34511b3bf383beab") .put(Hashing.farmHashFingerprint64(), TQBFJOTLDP, "737d7e5f8660653e") + .put(Hashing.fingerprint2011(), EMPTY_STRING, "e365a64a907cad23") + .put(Hashing.fingerprint2011(), TQBFJOTLD, "c9688c84e813b089") + .put(Hashing.fingerprint2011(), TQBFJOTLDP, "a714d70f1d569cd0") .build(); public void testAllHashFunctionsHaveKnownHashes() throws Exception { diff --git a/android/guava-tests/test/com/google/common/io/BaseEncodingTest.java b/android/guava-tests/test/com/google/common/io/BaseEncodingTest.java index 832fb0713..c2fdf0257 100644 --- a/android/guava-tests/test/com/google/common/io/BaseEncodingTest.java +++ b/android/guava-tests/test/com/google/common/io/BaseEncodingTest.java @@ -35,8 +35,8 @@ import java.io.OutputStream; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@code BaseEncoding}. @@ -405,7 +405,7 @@ public class BaseEncodingTest extends TestCase { } private static void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage) { + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage) { // We use this somewhat weird pattern with an enum for each assertion we want to make as a way // of dealing with the fact that one of the assertions is @GwtIncompatible but we don't want to // have to have duplicate @GwtIncompatible test methods just to make that assertion. @@ -419,7 +419,7 @@ public class BaseEncodingTest extends TestCase { DECODING_STREAM { @Override void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage) { + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage) { // Regression test for case where DecodingException was swallowed by default implementation // of // InputStream.read(byte[], int, int) @@ -440,14 +440,14 @@ public class BaseEncodingTest extends TestCase { CAN_DECODE { @Override void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage) { + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage) { assertFalse(encoding.canDecode(cannotDecode)); } }, DECODE { @Override void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage) { + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage) { try { encoding.decode(cannotDecode); fail("Expected IllegalArgumentException"); @@ -461,7 +461,7 @@ public class BaseEncodingTest extends TestCase { DECODE_CHECKED { @Override void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage) { + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage) { try { encoding.decodeChecked(cannotDecode); fail("Expected DecodingException"); @@ -474,7 +474,7 @@ public class BaseEncodingTest extends TestCase { }; abstract void assertFailsToDecode( - BaseEncoding encoding, String cannotDecode, @NullableDecl String expectedMessage); + BaseEncoding encoding, String cannotDecode, @CheckForNull String expectedMessage); } @GwtIncompatible // Reader/Writer diff --git a/android/guava-tests/test/com/google/common/io/ByteStreamsTest.java b/android/guava-tests/test/com/google/common/io/ByteStreamsTest.java index 3ae2c2559..dddae1ffc 100644 --- a/android/guava-tests/test/com/google/common/io/ByteStreamsTest.java +++ b/android/guava-tests/test/com/google/common/io/ByteStreamsTest.java @@ -562,12 +562,49 @@ public class ByteStreamsTest extends IoTestCase { // write to the output stream nos.write('n'); String test = "Test string for NullOutputStream"; - nos.write(test.getBytes()); - nos.write(test.getBytes(), 2, 10); + byte[] bytes = test.getBytes(Charsets.US_ASCII); + nos.write(bytes); + nos.write(bytes, 2, 10); + nos.write(bytes, bytes.length - 5, 5); // nothing really to assert? assertSame(ByteStreams.nullOutputStream(), ByteStreams.nullOutputStream()); } + public void testNullOutputStream_exceptions() throws Exception { + OutputStream nos = ByteStreams.nullOutputStream(); + try { + nos.write(null); + fail(); + } catch (NullPointerException expected) { + } + try { + nos.write(null, 0, 1); + fail(); + } catch (NullPointerException expected) { + } + byte[] tenBytes = new byte[10]; + try { + nos.write(tenBytes, -1, 1); + fail("Expected exception from negative offset"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 1, -1); + fail("Expected exception from negative length"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 9, 2); + fail("Expected exception from offset+length > array size"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 9, 100); + fail("Expected exception from offset+length > array size"); + } catch (IndexOutOfBoundsException expected) { + } + } + public void testLimit() throws Exception { byte[] big = newPreFilledByteArray(5); InputStream bin = new ByteArrayInputStream(big); diff --git a/android/guava-tests/test/com/google/common/io/CloserTest.java b/android/guava-tests/test/com/google/common/io/CloserTest.java index 23037f252..38ff700c8 100644 --- a/android/guava-tests/test/com/google/common/io/CloserTest.java +++ b/android/guava-tests/test/com/google/common/io/CloserTest.java @@ -31,8 +31,8 @@ import java.io.IOException; import java.lang.reflect.Method; import java.util.List; import java.util.logging.LogRecord; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@link Closer}. @@ -435,7 +435,7 @@ public class CloserTest extends TestCase { throw new IOException(); } - private TestCloseable(@NullableDecl Throwable throwOnClose) { + private TestCloseable(@CheckForNull Throwable throwOnClose) { this.throwOnClose = throwOnClose; } diff --git a/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java b/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java index f8e40df25..160df410b 100644 --- a/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java +++ b/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java @@ -92,6 +92,7 @@ public class LittleEndianDataInputStreamTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testReadLine() throws IOException { DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data)); try { diff --git a/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java b/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java index cf3fad41e..e70370e1d 100644 --- a/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java +++ b/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java @@ -37,7 +37,7 @@ import java.io.Writer; import java.nio.CharBuffer; import java.util.Arrays; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * {@link SourceSinkFactory} implementations. @@ -305,7 +305,7 @@ public class SourceSinkFactories { private final byte[] initialBytes; - private FileByteSinkFactory(@NullableDecl byte[] initialBytes) { + private FileByteSinkFactory(@CheckForNull byte[] initialBytes) { this.initialBytes = initialBytes; } @@ -375,7 +375,7 @@ public class SourceSinkFactories { private final String initialString; - private FileCharSinkFactory(@NullableDecl String initialString) { + private FileCharSinkFactory(@CheckForNull String initialString) { this.initialString = initialString; } diff --git a/android/guava-tests/test/com/google/common/io/SourceSinkTester.java b/android/guava-tests/test/com/google/common/io/SourceSinkTester.java index 9b07355a6..55a302f85 100644 --- a/android/guava-tests/test/com/google/common/io/SourceSinkTester.java +++ b/android/guava-tests/test/com/google/common/io/SourceSinkTester.java @@ -69,7 +69,7 @@ public class SourceSinkTester<S, T, F extends SourceSinkFactory<S, T>> extends T .put("\\n at EOF", "hello\nworld\n") .put("\\r at EOF", "hello\nworld\r") .put("lorem ipsum", LOREM_IPSUM) - .build(); + .buildOrThrow(); protected final F factory; protected final T data; diff --git a/android/guava-tests/test/com/google/common/math/IntMathTest.java b/android/guava-tests/test/com/google/common/math/IntMathTest.java index 12b23e214..4db13adbd 100644 --- a/android/guava-tests/test/com/google/common/math/IntMathTest.java +++ b/android/guava-tests/test/com/google/common/math/IntMathTest.java @@ -137,10 +137,11 @@ public class IntMathTest extends TestCase { @GwtIncompatible // BigIntegerMath // TODO(cpovirk): GWT-enable BigIntegerMath public void testConstantsHalfPowersOf10() { for (int i = 0; i < IntMath.halfPowersOf10.length; i++) { - assert IntMath.halfPowersOf10[i] - == Math.min( + assertEquals( + IntMath.halfPowersOf10[i], + Math.min( Integer.MAX_VALUE, - BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * i + 1), FLOOR).longValue()); + BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * i + 1), FLOOR).longValue())); } } diff --git a/android/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java b/android/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java index 54d310f0d..ddb2064e2 100644 --- a/android/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java +++ b/android/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java @@ -53,7 +53,7 @@ enum QuantilesAlgorithm { for (int index : indexes) { builder.put(index, singleQuantileFromSorted(index, scale, dataset)); } - return builder.build(); + return builder.buildOrThrow(); } private double singleQuantileFromSorted(int index, int scale, double[] dataset) { @@ -97,7 +97,7 @@ enum QuantilesAlgorithm { for (int index : indexes) { builder.put(index, singleQuantile(index, scale, dataset)); } - return builder.build(); + return builder.buildOrThrow(); } }, diff --git a/android/guava-tests/test/com/google/common/math/QuantilesTest.java b/android/guava-tests/test/com/google/common/math/QuantilesTest.java index 5ac5f6e30..77c70207c 100644 --- a/android/guava-tests/test/com/google/common/math/QuantilesTest.java +++ b/android/guava-tests/test/com/google/common/math/QuantilesTest.java @@ -41,8 +41,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Tests for {@link Quantiles}. @@ -92,7 +92,7 @@ public class QuantilesTest extends TestCase { Correspondence.from( new BinaryPredicate<Double, Double>() { @Override - public boolean apply(@NullableDecl Double actual, @NullableDecl Double expected) { + public boolean apply(@CheckForNull Double actual, @CheckForNull Double expected) { // Test for equality to allow non-finite values to match; otherwise, use the finite // test. return actual.equals(expected) @@ -557,7 +557,7 @@ public class QuantilesTest extends TestCase { } assertThat(percentiles().indexes(index1, index2).compute(PSEUDORANDOM_DATASET)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); } } } @@ -573,7 +573,7 @@ public class QuantilesTest extends TestCase { Collections.shuffle(indexes, random); assertThat(percentiles().indexes(Ints.toArray(indexes)).compute(PSEUDORANDOM_DATASET)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); } @AndroidIncompatible // slow @@ -589,7 +589,7 @@ public class QuantilesTest extends TestCase { Collections.shuffle(indexes, random); assertThat(percentiles().indexes(Ints.toArray(indexes)).computeInPlace(dataset)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); assertThat(dataset).usingExactEquality().containsExactlyElementsIn(PSEUDORANDOM_DATASET); } diff --git a/android/guava-tests/test/com/google/common/net/HostSpecifierTest.java b/android/guava-tests/test/com/google/common/net/HostSpecifierTest.java index fadeff7aa..8112879a8 100644 --- a/android/guava-tests/test/com/google/common/net/HostSpecifierTest.java +++ b/android/guava-tests/test/com/google/common/net/HostSpecifierTest.java @@ -92,8 +92,9 @@ public final class HostSpecifierTest extends TestCase { } private void assertGood(String spec) throws ParseException { - HostSpecifier.fromValid(spec); // Throws exception if not working correctly - HostSpecifier.from(spec); + // Throws exception if not working correctly + HostSpecifier unused = HostSpecifier.fromValid(spec); + unused = HostSpecifier.from(spec); assertTrue(HostSpecifier.isValid(spec)); } diff --git a/android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java b/android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java index 7113fb457..c440ee53f 100644 --- a/android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java +++ b/android/guava-tests/test/com/google/common/net/InternetDomainNameTest.java @@ -232,7 +232,7 @@ public final class InternetDomainNameTest extends TestCase { public void testValid() { for (String name : VALID_NAME) { - InternetDomainName.from(name); + InternetDomainName unused = InternetDomainName.from(name); } } @@ -392,7 +392,7 @@ public final class InternetDomainNameTest extends TestCase { // These would throw an exception if leniency were not preserved during parent() and child() // calls. InternetDomainName child = parent.child(LOTS_OF_DELTAS); - child.child(LOTS_OF_DELTAS); + InternetDomainName unused = child.child(LOTS_OF_DELTAS); } public void testValidTopPrivateDomain() { diff --git a/android/guava-tests/test/com/google/common/net/PercentEscaperTest.java b/android/guava-tests/test/com/google/common/net/PercentEscaperTest.java index 8443680e7..e600e4c7c 100644 --- a/android/guava-tests/test/com/google/common/net/PercentEscaperTest.java +++ b/android/guava-tests/test/com/google/common/net/PercentEscaperTest.java @@ -120,16 +120,11 @@ public class PercentEscaperTest extends TestCase { } } - /** - * Tests that if space is a safe character you cannot also specify 'plusForSpace' (throws {@link - * IllegalArgumentException}). - */ public void testBadArguments_plusforspace() { - try { - new PercentEscaper(" ", false); - } catch (IllegalArgumentException e) { - fail("Space can be a 'safe' character if plusForSpace is false"); - } + // space can be a safe char if plusForSpace is false + PercentEscaper unused = new PercentEscaper(" ", false); + + // space cannot be a safe char is plusForSpace is true String msg = "plusForSpace cannot be specified when space is a 'safe' character"; try { new PercentEscaper(" ", true); diff --git a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java index 560c33700..43ec04c4a 100644 --- a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java @@ -299,7 +299,8 @@ public class BooleansTest extends TestCase { assertEquals(1, Booleans.asList(ARRAY_FALSE_TRUE).lastIndexOf(true)); List<Boolean> reference = Booleans.asList(ARRAY_FALSE); assertEquals(Booleans.asList(ARRAY_FALSE), reference); - assertEquals(reference, reference); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(reference.equals(reference)); } public void testAsListHashcode() { diff --git a/android/guava-tests/test/com/google/common/reflect/InvokableTest.java b/android/guava-tests/test/com/google/common/reflect/InvokableTest.java index f116ee2c0..e545bdd1b 100644 --- a/android/guava-tests/test/com/google/common/reflect/InvokableTest.java +++ b/android/guava-tests/test/com/google/common/reflect/InvokableTest.java @@ -32,8 +32,8 @@ import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; import java.lang.reflect.TypeVariable; import java.util.Collections; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit tests for {@link Invokable}. @@ -520,7 +520,7 @@ public class InvokableTest extends TestCase { private class InnerWithAnnotatedConstructorParameter { @SuppressWarnings("unused") // called by reflection - InnerWithAnnotatedConstructorParameter(@NullableDecl String s) {} + InnerWithAnnotatedConstructorParameter(@CheckForNull String s) {} } public void testInnerClassWithAnnotatedConstructorParameter() { @@ -601,7 +601,7 @@ public class InvokableTest extends TestCase { } public void testAnonymousClassInConstructor() { - new AnonymousClassInConstructor(); + AnonymousClassInConstructor unused = new AnonymousClassInConstructor(); } private static class AnonymousClassInConstructor { @@ -621,7 +621,7 @@ public class InvokableTest extends TestCase { } public void testLocalClassInInstanceInitializer() { - new LocalClassInInstanceInitializer(); + LocalClassInInstanceInitializer unused = new LocalClassInInstanceInitializer(); } private static class LocalClassInInstanceInitializer { @@ -633,7 +633,7 @@ public class InvokableTest extends TestCase { } public void testLocalClassInStaticInitializer() { - new LocalClassInStaticInitializer(); + LocalClassInStaticInitializer unused = new LocalClassInStaticInitializer(); } private static class LocalClassInStaticInitializer { @@ -645,7 +645,8 @@ public class InvokableTest extends TestCase { } public void testLocalClassWithSeeminglyHiddenThisInStaticInitializer_BUG() { - new LocalClassWithSeeminglyHiddenThisInStaticInitializer(); + LocalClassWithSeeminglyHiddenThisInStaticInitializer unused = + new LocalClassWithSeeminglyHiddenThisInStaticInitializer(); } /** @@ -683,7 +684,7 @@ public class InvokableTest extends TestCase { public void testLocalClassWithAnnotatedConstructorParameter() throws Exception { class LocalWithAnnotatedConstructorParameter { @SuppressWarnings("unused") // called by reflection - LocalWithAnnotatedConstructorParameter(@NullableDecl String s) {} + LocalWithAnnotatedConstructorParameter(@CheckForNull String s) {} } Constructor<?> constructor = LocalWithAnnotatedConstructorParameter.class.getDeclaredConstructors()[0]; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java index f49b96245..991cada29 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java @@ -359,7 +359,6 @@ abstract class AbstractAbstractFutureTest extends TestCase { } @GwtIncompatible // threads - public void testOverflowTimeout() throws Exception { // First, sanity check that naive multiplication would really overflow to a negative number: long nanosPerSecond = NANOSECONDS.convert(1, SECONDS); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java index f5f12db82..8f0fde236 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java @@ -81,7 +81,7 @@ import org.mockito.Mockito; * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)} paths to complete a * {@link ClosingFuture} pipeline. */ -public abstract class ClosingFutureTest extends TestCase { +public abstract class AbstractClosingFutureTest extends TestCase { // TODO(dpb): Use Expect once that supports JUnit 3, or we can use JUnit 4. final List<AssertionError> failures = new ArrayList<>(); final StandardSubjectBuilder expect = @@ -1616,7 +1616,7 @@ public abstract class ClosingFutureTest extends TestCase { /** * Marks the given step final and waits for it to fail. Expects the failure exception to match - * {@link ClosingFutureTest#exception}. + * {@link AbstractClosingFutureTest#exception}. */ abstract void assertFinallyFailsWithException(ClosingFuture<?> closingFuture); @@ -1628,191 +1628,6 @@ public abstract class ClosingFutureTest extends TestCase { assertTrue(awaitUninterruptibly(closingFuture.whenClosedCountDown(), 1, SECONDS)); } - /** Tests for {@link ClosingFuture} that exercise {@link ClosingFuture#finishToFuture()}. */ - - public static class FinishToFutureTest extends ClosingFutureTest { - - public void testFinishToFuture_throwsIfCalledTwice() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - try { - FluentFuture<Closeable> unused2 = closingFuture.finishToFuture(); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToFuture_throwsAfterCallingFinishToValueAndCloser() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - closingFuture.finishToValueAndCloser(new NoOpValueAndCloserConsumer<>(), directExecutor()); - try { - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToFuture_preventsFurtherDerivation() { - ClosingFuture<String> closingFuture = ClosingFuture.from(immediateFuture("value1")); - FluentFuture<String> unused = closingFuture.finishToFuture(); - assertDerivingThrowsIllegalStateException(closingFuture); - } - - @Override - <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { - return getUninterruptibly(closingFuture.finishToFuture()); - } - - @Override - void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { - assertThatFutureFailsWithException(closingFuture.finishToFuture()); - } - - @Override - void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { - assertThatFutureBecomesCancelled(closingFuture.finishToFuture()); - } - - @Override - void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { - assertThat(closingFuture.finishToFuture().cancel(false)).isTrue(); - waitUntilClosed(closingFuture); - futureCancelled.countDown(); - } - } - - /** - * Tests for {@link ClosingFuture} that exercise {@link - * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)}. - */ - - public static class FinishToValueAndCloserTest extends ClosingFutureTest { - - private final ExecutorService finishToValueAndCloserExecutor = newSingleThreadExecutor(); - private volatile ValueAndCloser<?> valueAndCloser; - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - assertWithMessage("finishToValueAndCloserExecutor was shut down") - .that(shutdownAndAwaitTermination(finishToValueAndCloserExecutor, 10, SECONDS)) - .isTrue(); - } - - public void testFinishToValueAndCloser_throwsIfCalledTwice() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - try { - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToValueAndCloser_throwsAfterCallingFinishToFuture() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - try { - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - @Override - <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { - return finishToValueAndCloser(closingFuture).get(); - } - - @Override - void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { - assertThatFutureFailsWithException(closingFuture.statusFuture()); - ValueAndCloser<?> valueAndCloser = finishToValueAndCloser(closingFuture); - try { - valueAndCloser.get(); - fail(); - } catch (ExecutionException expected) { - assertThat(expected).hasCauseThat().isSameInstanceAs(exception); - } - valueAndCloser.closeAsync(); - } - - @Override - void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { - assertThatFutureBecomesCancelled(closingFuture.statusFuture()); - } - - @Override - void waitUntilClosed(ClosingFuture<?> closingFuture) { - if (valueAndCloser != null) { - valueAndCloser.closeAsync(); - } - super.waitUntilClosed(closingFuture); - } - - @Override - void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { - assertThat(closingFuture.cancel(false)).isTrue(); - ValueAndCloser<?> unused = finishToValueAndCloser(closingFuture); - waitUntilClosed(closingFuture); - futureCancelled.countDown(); - } - - private <V> ValueAndCloser<V> finishToValueAndCloser(ClosingFuture<V> closingFuture) { - final CountDownLatch valueAndCloserSet = new CountDownLatch(1); - closingFuture.finishToValueAndCloser( - new ValueAndCloserConsumer<V>() { - @Override - public void accept(ValueAndCloser<V> valueAndCloser) { - FinishToValueAndCloserTest.this.valueAndCloser = valueAndCloser; - valueAndCloserSet.countDown(); - } - }, - finishToValueAndCloserExecutor); - assertWithMessage("valueAndCloser was set") - .that(awaitUninterruptibly(valueAndCloserSet, 10, SECONDS)) - .isTrue(); - @SuppressWarnings("unchecked") - ValueAndCloser<V> valueAndCloserWithType = (ValueAndCloser<V>) valueAndCloser; - return valueAndCloserWithType; - } - } - void assertThatFutureFailsWithException(Future<?> future) { try { getUninterruptibly(future); @@ -1822,7 +1637,7 @@ public abstract class ClosingFutureTest extends TestCase { } } - private static void assertThatFutureBecomesCancelled(Future<?> future) throws ExecutionException { + static void assertThatFutureBecomesCancelled(Future<?> future) throws ExecutionException { try { getUninterruptibly(future); fail("Expected future to be canceled: " + future); @@ -1989,7 +1804,7 @@ public abstract class ClosingFutureTest extends TestCase { } } - private static final class NoOpValueAndCloserConsumer<V> implements ValueAndCloserConsumer<V> { + static final class NoOpValueAndCloserConsumer<V> implements ValueAndCloserConsumer<V> { @Override public void accept(ValueAndCloser<V> valueAndCloser) {} } diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java index 557fc0b5f..9b3f0f867 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java @@ -68,7 +68,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { thrownByExecutionThread); } - public void testServiceStartStop() throws Exception { WaitOnRunService service = new WaitOnRunService(); assertFalse(service.startUpCalled); @@ -85,7 +84,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { executionThread.join(); } - public void testServiceStopIdempotence() throws Exception { WaitOnRunService service = new WaitOnRunService(); @@ -102,7 +100,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { executionThread.join(); } - public void testServiceExitingOnItsOwn() throws Exception { WaitOnRunService service = new WaitOnRunService(); service.expectedShutdownState = Service.State.RUNNING; @@ -173,7 +170,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnStartUp() throws Exception { ThrowOnStartUpService service = new ThrowOnStartUpService(); assertFalse(service.startUpCalled); @@ -212,7 +208,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnRun() throws Exception { ThrowOnRunService service = new ThrowOnRunService(); @@ -229,7 +224,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { assertEquals(Service.State.FAILED, service.state()); } - public void testServiceThrowOnRunAndThenAgainOnShutDown() throws Exception { ThrowOnRunService service = new ThrowOnRunService(); service.throwOnShutDown = true; @@ -271,7 +265,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnShutDown() throws Exception { ThrowOnShutDown service = new ThrowOnShutDown(); @@ -331,7 +324,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { protected void run() throws Exception {} } - public void testStopWhileStarting_runNotCalled() throws Exception { final CountDownLatch started = new CountDownLatch(1); FakeService service = @@ -361,7 +353,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { assertEquals(0, service.shutdownCalled); } - public void testDefaultService() throws InterruptedException { WaitOnRunService service = new WaitOnRunService(); service.startAsync().awaitRunning(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureBenchmarks.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureBenchmarks.java index bf70aac25..ed5e6a96d 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureBenchmarks.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureBenchmarks.java @@ -25,7 +25,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.locks.AbstractQueuedSynchronizer; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** Utilities for the AbstractFutureBenchmarks */ final class AbstractFutureBenchmarks { @@ -218,7 +218,7 @@ final class AbstractFutureBenchmarks { * @return true if the state was successfully changed. */ @CanIgnoreReturnValue - protected boolean set(@NullableDecl V value) { + protected boolean set(@CheckForNull V value) { boolean result = sync.set(value); if (result) { executionList.execute(); @@ -360,7 +360,7 @@ final class AbstractFutureBenchmarks { } /** Transition to the COMPLETED state and set the value. */ - boolean set(@NullableDecl V v) { + boolean set(@CheckForNull V v) { return complete(v, null, COMPLETED); } @@ -384,7 +384,7 @@ final class AbstractFutureBenchmarks { * @param t the exception to set as the result of the computation. * @param finalState the state to transition to. */ - private boolean complete(@NullableDecl V v, @NullableDecl Throwable t, int finalState) { + private boolean complete(@CheckForNull V v, @CheckForNull Throwable t, int finalState) { boolean doCompletion = compareAndSetState(RUNNING, COMPLETING); if (doCompletion) { // If this thread successfully transitioned to COMPLETING, set the value @@ -406,7 +406,7 @@ final class AbstractFutureBenchmarks { } static final CancellationException cancellationExceptionWithCause( - @NullableDecl String message, @NullableDecl Throwable cause) { + @CheckForNull String message, @CheckForNull Throwable cause) { CancellationException exception = new CancellationException(message); exception.initCause(cause); return exception; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java index 6c921b5b6..9aee78029 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java @@ -30,6 +30,7 @@ import javax.annotation.concurrent.GuardedBy; import junit.framework.TestCase; /** Tests for {@link AbstractFuture} with the cancellation cause system property set */ +@AndroidIncompatible // custom classloading public class AbstractFutureCancellationCauseTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java index e55a31e72..dc020fb20 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java @@ -52,7 +52,6 @@ import junit.framework.TestCase; * * @author Brian Stoler */ - public class AbstractFutureTest extends TestCase { public void testSuccess() throws ExecutionException, InterruptedException { final Object value = new Object(); @@ -292,6 +291,7 @@ public class AbstractFutureTest extends TestCase { * derived from observing how much time actually passed for various operations. */ @SuppressWarnings({"DeprecatedThreadMethods", "ThreadPriorityCheck"}) + @AndroidIncompatible // Thread.suspend public void testToString_delayedTimeout() throws Exception { TimedWaiterThread thread = new TimedWaiterThread(new AbstractFuture<Object>() {}, 2, TimeUnit.SECONDS); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java index 7cad8b0fa..2df5a4f3a 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java @@ -36,7 +36,6 @@ public class AbstractIdleServiceTest extends TestCase { // Functional tests using real thread. We only verify publicly visible state. // Interaction assertions are done by the single-threaded unit tests. - public static class FunctionalTest extends TestCase { private static class DefaultService extends AbstractIdleService { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java index a2411ad50..a05a83869 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java @@ -19,6 +19,8 @@ package com.google.common.util.concurrent; import static com.google.common.truth.Truth.assertThat; import static com.google.common.util.concurrent.AbstractScheduledService.Scheduler.newFixedDelaySchedule; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.util.concurrent.AbstractScheduledService.Cancellable; @@ -47,10 +49,9 @@ import junit.framework.TestCase; * * @author Luke Sandberg */ - public class AbstractScheduledServiceTest extends TestCase { - volatile Scheduler configuration = newFixedDelaySchedule(0, 10, TimeUnit.MILLISECONDS); + volatile Scheduler configuration = newFixedDelaySchedule(0, 10, MILLISECONDS); volatile ScheduledFuture<?> future = null; volatile boolean atFixedRateCalled = false; @@ -113,7 +114,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.startAsync().awaitRunning(); fail(); } catch (IllegalStateException e) { - assertEquals(service.startUpException, e.getCause()); + assertThat(e).hasCauseThat().isEqualTo(service.startUpException); } assertEquals(0, service.numberOfTimesRunCalled.get()); assertEquals(Service.State.FAILED, service.state()); @@ -156,7 +157,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); fail(); } catch (IllegalStateException e) { - assertEquals(service.shutDownException, e.getCause()); + assertThat(e).hasCauseThat().isEqualTo(service.shutDownException); } assertEquals(Service.State.FAILED, service.state()); } @@ -208,7 +209,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override protected Scheduler scheduler() { - return newFixedDelaySchedule(0, 1, TimeUnit.MILLISECONDS); + return newFixedDelaySchedule(0, 1, MILLISECONDS); } }; @@ -217,7 +218,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitRunning(); service.stopAsync(); service.awaitTerminated(); - assertTrue(executor.get().awaitTermination(100, TimeUnit.MILLISECONDS)); + assertTrue(executor.get().awaitTermination(100, MILLISECONDS)); } public void testDefaultExecutorIsShutdownWhenServiceFails() throws Exception { @@ -240,7 +241,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override protected Scheduler scheduler() { - return newFixedDelaySchedule(0, 1, TimeUnit.MILLISECONDS); + return newFixedDelaySchedule(0, 1, MILLISECONDS); } }; @@ -250,7 +251,7 @@ public class AbstractScheduledServiceTest extends TestCase { } catch (IllegalStateException expected) { } - assertTrue(executor.get().awaitTermination(100, TimeUnit.MILLISECONDS)); + assertTrue(executor.get().awaitTermination(100, MILLISECONDS)); } public void testSchedulerOnlyCalledOnce() throws Exception { @@ -277,7 +278,7 @@ public class AbstractScheduledServiceTest extends TestCase { new AbstractScheduledService() { @Override protected Scheduler scheduler() { - return Scheduler.newFixedDelaySchedule(0, 1, TimeUnit.NANOSECONDS); + return Scheduler.newFixedDelaySchedule(0, 1, NANOSECONDS); } @Override @@ -294,7 +295,7 @@ public class AbstractScheduledServiceTest extends TestCase { } }; try { - service.startAsync().awaitRunning(1, TimeUnit.MILLISECONDS); + service.startAsync().awaitRunning(1, MILLISECONDS); fail("Expected timeout"); } catch (TimeoutException e) { assertThat(e) @@ -366,9 +367,9 @@ public class AbstractScheduledServiceTest extends TestCase { public static class SchedulerTest extends TestCase { // These constants are arbitrary and just used to make sure that the correct method is called // with the correct parameters. - private static final int initialDelay = 10; - private static final int delay = 20; - private static final TimeUnit unit = TimeUnit.MILLISECONDS; + private static final int INITIAL_DELAY = 10; + private static final int DELAY = 20; + private static final TimeUnit UNIT = MILLISECONDS; // Unique runnable object used for comparison. final Runnable testRunnable = @@ -382,14 +383,14 @@ public class AbstractScheduledServiceTest extends TestCase { Runnable command, long initialDelay, long delay, TimeUnit unit) { assertFalse(called); // only called once. called = true; - assertEquals(SchedulerTest.initialDelay, initialDelay); - assertEquals(SchedulerTest.delay, delay); - assertEquals(SchedulerTest.unit, unit); + assertEquals(INITIAL_DELAY, initialDelay); + assertEquals(DELAY, delay); + assertEquals(UNIT, unit); assertEquals(testRunnable, command); } public void testFixedRateSchedule() { - Scheduler schedule = Scheduler.newFixedRateSchedule(initialDelay, delay, unit); + Scheduler schedule = Scheduler.newFixedRateSchedule(INITIAL_DELAY, DELAY, UNIT); Cancellable unused = schedule.schedule( null, @@ -397,7 +398,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override public ScheduledFuture<?> scheduleAtFixedRate( Runnable command, long initialDelay, long period, TimeUnit unit) { - assertSingleCallWithCorrectParameters(command, initialDelay, delay, unit); + assertSingleCallWithCorrectParameters(command, initialDelay, period, unit); return new ThrowingScheduledFuture<>(); } }, @@ -406,7 +407,7 @@ public class AbstractScheduledServiceTest extends TestCase { } public void testFixedDelaySchedule() { - Scheduler schedule = newFixedDelaySchedule(initialDelay, delay, unit); + Scheduler schedule = newFixedDelaySchedule(INITIAL_DELAY, DELAY, UNIT); Cancellable unused = schedule.schedule( null, @@ -440,7 +441,6 @@ public class AbstractScheduledServiceTest extends TestCase { } } - public void testFixedDelayScheduleFarFuturePotentiallyOverflowingScheduleIsNeverReached() throws Exception { TestAbstractScheduledCustomService service = @@ -461,7 +461,6 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); } - public void testCustomSchedulerFarFuturePotentiallyOverflowingScheduleIsNeverReached() throws Exception { TestAbstractScheduledCustomService service = @@ -487,17 +486,16 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); } - private class TestCustomScheduler extends AbstractScheduledService.CustomScheduler { + private static class TestCustomScheduler extends AbstractScheduledService.CustomScheduler { public AtomicInteger scheduleCounter = new AtomicInteger(0); @Override protected Schedule getNextSchedule() throws Exception { scheduleCounter.incrementAndGet(); - return new Schedule(0, TimeUnit.SECONDS); + return new Schedule(0, SECONDS); } } - public void testCustomSchedule_startStop() throws Exception { final CyclicBarrier firstBarrier = new CyclicBarrier(2); final CyclicBarrier secondBarrier = new CyclicBarrier(2); @@ -528,7 +526,6 @@ public class AbstractScheduledServiceTest extends TestCase { future.cancel(false); } - public void testCustomSchedulerServiceStop() throws Exception { TestAbstractScheduledCustomService service = new TestAbstractScheduledCustomService(); service.startAsync().awaitRunning(); @@ -538,11 +535,10 @@ public class AbstractScheduledServiceTest extends TestCase { service.secondBarrier.await(); service.awaitTerminated(); // Sleep for a while just to ensure that our task wasn't called again. - Thread.sleep(unit.toMillis(3 * delay)); + Thread.sleep(UNIT.toMillis(3 * DELAY)); assertEquals(1, service.numIterations.get()); } - public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException { final CyclicBarrier inGetNextSchedule = new CyclicBarrier(2); // This will flakily deadlock, so run it multiple times to increase the flake likelihood @@ -562,7 +558,7 @@ public class AbstractScheduledServiceTest extends TestCase { Thread.yield(); throw new RuntimeException("boom"); } - return new Schedule(0, TimeUnit.NANOSECONDS); + return new Schedule(0, NANOSECONDS); } }; } @@ -573,7 +569,6 @@ public class AbstractScheduledServiceTest extends TestCase { } } - public void testBig() throws Exception { TestAbstractScheduledCustomService service = new TestAbstractScheduledCustomService() { @@ -584,7 +579,7 @@ public class AbstractScheduledServiceTest extends TestCase { protected Schedule getNextSchedule() throws Exception { // Explicitly yield to increase the probability of a pathological scheduling. Thread.yield(); - return new Schedule(0, TimeUnit.SECONDS); + return new Schedule(0, SECONDS); } }; } @@ -627,13 +622,12 @@ public class AbstractScheduledServiceTest extends TestCase { return new CustomScheduler() { @Override protected Schedule getNextSchedule() throws Exception { - return new Schedule(delay, unit); + return new Schedule(DELAY, UNIT); } }; } } - public void testCustomSchedulerFailure() throws Exception { TestFailingCustomScheduledService service = new TestFailingCustomScheduledService(); service.startAsync().awaitRunning(); @@ -644,7 +638,7 @@ public class AbstractScheduledServiceTest extends TestCase { } Thread.sleep(1000); try { - service.stopAsync().awaitTerminated(100, TimeUnit.SECONDS); + service.stopAsync().awaitTerminated(100, SECONDS); fail(); } catch (IllegalStateException e) { assertEquals(State.FAILED, service.state()); @@ -677,7 +671,7 @@ public class AbstractScheduledServiceTest extends TestCase { if (numIterations.get() > 2) { throw new IllegalStateException("Failed"); } - return new Schedule(delay, unit); + return new Schedule(DELAY, UNIT); } }; } diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java index e3c22a867..5f4210621 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java @@ -330,7 +330,6 @@ public class AbstractServiceTest extends TestCase { } } - public void testAwaitTerminated() throws Exception { final NoOpService service = new NoOpService(); Thread waiter = @@ -348,7 +347,6 @@ public class AbstractServiceTest extends TestCase { assertFalse(waiter.isAlive()); } - public void testAwaitTerminated_FailedService() throws Exception { final ManualSwitchedService service = new ManualSwitchedService(); final AtomicReference<Throwable> exception = Atomics.newReference(); @@ -376,7 +374,6 @@ public class AbstractServiceTest extends TestCase { assertThat(exception.get()).hasCauseThat().isEqualTo(EXCEPTION); } - public void testThreadedServiceStartAndWaitStopAndWait() throws Throwable { ThreadedService service = new ThreadedService(); RecordingListener listener = RecordingListener.record(service); @@ -394,7 +391,6 @@ public class AbstractServiceTest extends TestCase { listener.getStateHistory()); } - public void testThreadedServiceStopIdempotence() throws Throwable { ThreadedService service = new ThreadedService(); @@ -410,7 +406,6 @@ public class AbstractServiceTest extends TestCase { throwIfSet(thrownByExecutionThread); } - public void testThreadedServiceStopIdempotenceAfterWait() throws Throwable { ThreadedService service = new ThreadedService(); @@ -428,7 +423,6 @@ public class AbstractServiceTest extends TestCase { throwIfSet(thrownByExecutionThread); } - public void testThreadedServiceStopIdempotenceDoubleWait() throws Throwable { ThreadedService service = new ThreadedService(); @@ -661,7 +655,6 @@ public class AbstractServiceTest extends TestCase { } } - public void testAddListenerAfterFailureDoesntCauseDeadlock() throws InterruptedException { final StartFailingService service = new StartFailingService(); service.startAsync(); @@ -681,7 +674,6 @@ public class AbstractServiceTest extends TestCase { assertFalse(thread + " is deadlocked", thread.isAlive()); } - public void testListenerDoesntDeadlockOnStartAndWaitFromRunning() throws Exception { final NoOpThreadedService service = new NoOpThreadedService(); service.addListener( @@ -696,7 +688,6 @@ public class AbstractServiceTest extends TestCase { service.stopAsync(); } - public void testListenerDoesntDeadlockOnStopAndWaitFromTerminated() throws Exception { final NoOpThreadedService service = new NoOpThreadedService(); service.addListener( diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java index 70c186d34..5bb1cb74e 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java @@ -181,7 +181,6 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { } /** compareAndSet in one thread enables another waiting for value to succeed */ - public void testCompareAndSetInMultipleThreads() throws InterruptedException { final AtomicDoubleArray a = new AtomicDoubleArray(1); a.set(0, 1.0); @@ -294,7 +293,6 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { * Multiple threads using same array of counters successfully update a number of times equal to * total count */ - public void testCountingInMultipleThreads() throws InterruptedException { final AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); for (int i = 0; i < SIZE; i++) { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java index fe68e0099..fc06fd433 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java @@ -13,7 +13,6 @@ package com.google.common.util.concurrent; - /** Unit test for {@link AtomicDouble}. */ public class AtomicDoubleTest extends JSR166TestCase { @@ -97,7 +96,6 @@ public class AtomicDoubleTest extends JSR166TestCase { } /** compareAndSet in one thread enables another waiting for value to succeed */ - public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicDouble at = new AtomicDouble(1.0); Thread t = diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java index 476582585..b1e741a68 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java @@ -16,13 +16,15 @@ package com.google.common.util.concurrent; +import static java.util.concurrent.TimeUnit.SECONDS; + import com.google.common.annotations.GwtIncompatible; +import java.util.ArrayList; import java.util.Random; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; import junit.framework.TestCase; /** @@ -31,29 +33,27 @@ import junit.framework.TestCase; * @author mike nonemacher */ @GwtIncompatible // threads - public class AtomicLongMapBasherTest extends TestCase { private final Random random = new Random(301); - public void testModify_basher() throws InterruptedException { + public void testModify_basher() throws Exception { int nTasks = 3000; int nThreads = 100; final int getsPerTask = 1000; final int deltaRange = 10000; final String key = "key"; - final AtomicLong sum = new AtomicLong(); final AtomicLongMap<String> map = AtomicLongMap.create(); ExecutorService threadPool = Executors.newFixedThreadPool(nThreads); + ArrayList<Future<Long>> futures = new ArrayList<>(); for (int i = 0; i < nTasks; i++) { - @SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored - Future<?> possiblyIgnoredError = + futures.add( threadPool.submit( - new Runnable() { + new Callable<Long>() { @Override - public void run() { - int threadSum = 0; + public Long call() { + long threadSum = 0; for (int j = 0; j < getsPerTask; j++) { long delta = random.nextInt(deltaRange); int behavior = random.nextInt(10); @@ -106,14 +106,16 @@ public class AtomicLongMapBasherTest extends TestCase { throw new AssertionError(); } } - sum.addAndGet(threadSum); + return threadSum; } - }); + })); } - threadPool.shutdown(); - assertTrue(threadPool.awaitTermination(300, TimeUnit.SECONDS)); - - assertEquals(sum.get(), map.get(key)); + assertTrue(threadPool.awaitTermination(300, SECONDS)); + long sum = 0; + for (Future<Long> f : futures) { + sum += f.get(); + } + assertEquals(sum, map.get(key)); } } diff --git a/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java b/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java index 587a4ec21..878ea5ec8 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java @@ -52,7 +52,7 @@ public class AtomicLongMapTest extends TestCase { Map<String, Long> in = ImmutableMap.of("1", 1L, "2", 2L, "3", 3L); AtomicLongMap<String> map = AtomicLongMap.create(in); assertFalse(map.isEmpty()); - assertSame(3, map.size()); + assertEquals(3, map.size()); assertTrue(map.containsKey("1")); assertTrue(map.containsKey("2")); assertTrue(map.containsKey("3")); @@ -302,7 +302,7 @@ public class AtomicLongMapTest extends TestCase { Map<String, Long> in = ImmutableMap.of("1", 1L, "2", 2L, "3", 3L); AtomicLongMap<String> map = AtomicLongMap.create(); assertTrue(map.isEmpty()); - assertSame(0, map.size()); + assertEquals(0, map.size()); assertFalse(map.containsKey("1")); assertFalse(map.containsKey("2")); assertFalse(map.containsKey("3")); @@ -312,7 +312,7 @@ public class AtomicLongMapTest extends TestCase { map.putAll(in); assertFalse(map.isEmpty()); - assertSame(3, map.size()); + assertEquals(3, map.size()); assertTrue(map.containsKey("1")); assertTrue(map.containsKey("2")); assertTrue(map.containsKey("3")); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java new file mode 100644 index 000000000..79288eb2a --- /dev/null +++ b/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2017 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.util.concurrent; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.util.concurrent.Futures.immediateFuture; +import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly; + +import com.google.common.util.concurrent.ClosingFuture.ClosingCallable; +import com.google.common.util.concurrent.ClosingFuture.DeferredCloser; +import java.io.Closeable; +import java.util.concurrent.ExecutionException; + +/** Tests for {@link ClosingFuture} that exercise {@link ClosingFuture#finishToFuture()}. */ +public class ClosingFutureFinishToFutureTest extends AbstractClosingFutureTest { + public void testFinishToFuture_throwsIfCalledTwice() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + try { + FluentFuture<Closeable> unused2 = closingFuture.finishToFuture(); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToFuture_throwsAfterCallingFinishToValueAndCloser() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + closingFuture.finishToValueAndCloser(new NoOpValueAndCloserConsumer<>(), directExecutor()); + try { + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToFuture_preventsFurtherDerivation() { + ClosingFuture<String> closingFuture = ClosingFuture.from(immediateFuture("value1")); + FluentFuture<String> unused = closingFuture.finishToFuture(); + assertDerivingThrowsIllegalStateException(closingFuture); + } + + @Override + <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { + return getUninterruptibly(closingFuture.finishToFuture()); + } + + @Override + void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { + assertThatFutureFailsWithException(closingFuture.finishToFuture()); + } + + @Override + void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { + assertThatFutureBecomesCancelled(closingFuture.finishToFuture()); + } + + @Override + void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { + assertThat(closingFuture.finishToFuture().cancel(false)).isTrue(); + waitUntilClosed(closingFuture); + futureCancelled.countDown(); + } +} diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java new file mode 100644 index 000000000..ac3cf5569 --- /dev/null +++ b/android/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2017 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.util.concurrent; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; +import static com.google.common.util.concurrent.MoreExecutors.shutdownAndAwaitTermination; +import static com.google.common.util.concurrent.Uninterruptibles.awaitUninterruptibly; +import static java.util.concurrent.Executors.newSingleThreadExecutor; +import static java.util.concurrent.TimeUnit.SECONDS; + +import com.google.common.util.concurrent.ClosingFuture.ClosingCallable; +import com.google.common.util.concurrent.ClosingFuture.DeferredCloser; +import com.google.common.util.concurrent.ClosingFuture.ValueAndCloser; +import com.google.common.util.concurrent.ClosingFuture.ValueAndCloserConsumer; +import java.io.Closeable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; + +/** + * Tests for {@link ClosingFuture} that exercise {@link + * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)}. + */ +public class ClosingFutureFinishToValueAndCloserTest extends AbstractClosingFutureTest { + private final ExecutorService finishToValueAndCloserExecutor = newSingleThreadExecutor(); + private volatile ValueAndCloser<?> valueAndCloser; + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + assertWithMessage("finishToValueAndCloserExecutor was shut down") + .that(shutdownAndAwaitTermination(finishToValueAndCloserExecutor, 10, SECONDS)) + .isTrue(); + } + + public void testFinishToValueAndCloser_throwsIfCalledTwice() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + try { + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToValueAndCloser_throwsAfterCallingFinishToFuture() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + try { + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + @Override + <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { + return finishToValueAndCloser(closingFuture).get(); + } + + @Override + void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { + assertThatFutureFailsWithException(closingFuture.statusFuture()); + ValueAndCloser<?> valueAndCloser = finishToValueAndCloser(closingFuture); + try { + valueAndCloser.get(); + fail(); + } catch (ExecutionException expected) { + assertThat(expected).hasCauseThat().isSameInstanceAs(exception); + } + valueAndCloser.closeAsync(); + } + + @Override + void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { + assertThatFutureBecomesCancelled(closingFuture.statusFuture()); + } + + @Override + void waitUntilClosed(ClosingFuture<?> closingFuture) { + if (valueAndCloser != null) { + valueAndCloser.closeAsync(); + } + super.waitUntilClosed(closingFuture); + } + + @Override + void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { + assertThat(closingFuture.cancel(false)).isTrue(); + ValueAndCloser<?> unused = finishToValueAndCloser(closingFuture); + waitUntilClosed(closingFuture); + futureCancelled.countDown(); + } + + private <V> ValueAndCloser<V> finishToValueAndCloser(ClosingFuture<V> closingFuture) { + final CountDownLatch valueAndCloserSet = new CountDownLatch(1); + closingFuture.finishToValueAndCloser( + new ValueAndCloserConsumer<V>() { + @Override + public void accept(ValueAndCloser<V> valueAndCloser) { + ClosingFutureFinishToValueAndCloserTest.this.valueAndCloser = valueAndCloser; + valueAndCloserSet.countDown(); + } + }, + finishToValueAndCloserExecutor); + assertWithMessage("valueAndCloser was set") + .that(awaitUninterruptibly(valueAndCloserSet, 10, SECONDS)) + .isTrue(); + @SuppressWarnings("unchecked") + ValueAndCloser<V> valueAndCloserWithType = (ValueAndCloser<V>) valueAndCloser; + return valueAndCloserWithType; + } +} diff --git a/android/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java b/android/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java index 18e69b10e..2b1dd2fa0 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java @@ -442,7 +442,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { lockD.lock(); } - public void testReentrantLock_tryLock() throws Exception { LockingThread thread = new LockingThread(lockA); thread.start(); @@ -454,7 +453,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { assertTrue(lockA.tryLock()); } - public void testReentrantWriteLock_tryLock() throws Exception { LockingThread thread = new LockingThread(writeLockA); thread.start(); @@ -468,7 +466,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { assertTrue(readLockA.tryLock()); } - public void testReentrantReadLock_tryLock() throws Exception { LockingThread thread = new LockingThread(readLockA); thread.start(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java index 5bd3cf7f4..34678ed25 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java @@ -36,7 +36,6 @@ public class ExecutionListTest extends TestCase { private final ExecutionList list = new ExecutionList(); - public void testRunOnPopulatedList() throws Exception { Executor exec = Executors.newCachedThreadPool(); CountDownLatch countDownLatch = new CountDownLatch(3); @@ -67,7 +66,6 @@ public class ExecutionListTest extends TestCase { assertEquals(1, runCalled.get()); } - public void testExecute_idempotentConcurrently() throws InterruptedException { final CountDownLatch okayToRun = new CountDownLatch(1); final AtomicInteger runCalled = new AtomicInteger(); @@ -103,7 +101,6 @@ public class ExecutionListTest extends TestCase { assertEquals(1, runCalled.get()); } - public void testAddAfterRun() throws Exception { // Run the previous test testRunOnPopulatedList(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java index 1c03f5ac4..068287c19 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java @@ -88,7 +88,6 @@ public class ExecutionSequencerTest extends TestCase { assertThat(thirdCallable.called).isTrue(); } - public void testCancellationMultipleThreads() throws Exception { final BlockingCallable blockingCallable = new BlockingCallable(); ListenableFuture<Void> unused = serializer.submit(blockingCallable, executor); @@ -116,7 +115,6 @@ public class ExecutionSequencerTest extends TestCase { assertThat(getDone(future2)).isFalse(); } - public void testSecondTaskWaitsForFirstEvenIfCancelled() throws Exception { final BlockingCallable blockingCallable = new BlockingCallable(); ListenableFuture<Void> future1 = serializer.submit(blockingCallable, executor); @@ -327,7 +325,6 @@ public class ExecutionSequencerTest extends TestCase { private static final int DIRECT_EXECUTIONS_PER_THREAD = 100; @GwtIncompatible // threads - public void testAvoidsStackOverflow_multipleThreads() throws Exception { final LongHolder holder = new LongHolder(); final ArrayList<ListenableFuture<Integer>> lengthChecks = new ArrayList<>(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index cc4751d0f..ab53f5383 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -132,7 +132,6 @@ public class FluentFutureTest extends TestCase { assertThat(f.get()).isEqualTo(2); } - @GwtIncompatible // withTimeout public void testWithTimeout() throws Exception { ScheduledExecutorService executor = newScheduledThreadPool(1); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FutureCallbackTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FutureCallbackTest.java index 4febc5a8d..5a1464d05 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FutureCallbackTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FutureCallbackTest.java @@ -24,8 +24,8 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import java.util.concurrent.CancellationException; import java.util.concurrent.Executor; +import javax.annotation.CheckForNull; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; import org.mockito.Mockito; /** @@ -157,8 +157,8 @@ public class FutureCallbackTest extends TestCase { } private final class MockCallback implements FutureCallback<String> { - @NullableDecl private String value = null; - @NullableDecl private Throwable failure = null; + @CheckForNull private String value = null; + @CheckForNull private Throwable failure = null; private boolean wasCalled = false; MockCallback(String expectedValue) { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java index 3bc69bd32..666a18929 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java @@ -353,7 +353,7 @@ public class FuturesGetCheckedTest extends TestCase { public static final class WillBeUnloadedException extends Exception {} - + @AndroidIncompatible // "Parent ClassLoader may not be null"; maybe avoidable if we try? public void testGetChecked_classUnloading() throws Exception { WeakReference<?> classUsedByGetChecked = doTestClassUnloading(); GcFinalization.awaitClear(classUsedByGetChecked); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index fa3b14a26..6fa2a32df 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java @@ -53,6 +53,7 @@ import static java.util.Arrays.asList; import static java.util.concurrent.Executors.newSingleThreadExecutor; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.annotations.GwtCompatible; @@ -87,9 +88,9 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.LogRecord; import java.util.logging.Logger; +import javax.annotation.CheckForNull; import junit.framework.AssertionFailedError; import junit.framework.TestCase; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * Unit tests for {@link Futures}. @@ -410,7 +411,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_interruptPropagatesToTransformingThread() throws Exception { SettableFuture<String> input = SettableFuture.create(); final CountDownLatch inFunction = new CountDownLatch(1); @@ -803,7 +803,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // Threads - public void testTransformAsync_functionToString() throws Exception { final CountDownLatch functionCalled = new CountDownLatch(1); final CountDownLatch functionBlocking = new CountDownLatch(1); @@ -1132,7 +1131,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testCatchingAsync_interruptPropagatesToTransformingThread() throws Exception { SettableFuture<String> input = SettableFuture.create(); final CountDownLatch inFunction = new CountDownLatch(1); @@ -1172,7 +1170,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // Threads - public void testCatchingAsync_functionToString() throws Exception { final CountDownLatch functionCalled = new CountDownLatch(1); final CountDownLatch functionBlocking = new CountDownLatch(1); @@ -1749,7 +1746,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_asyncFunction_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -1784,7 +1780,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_asyncFunction_cancelledBeforeApplyingFunction() throws InterruptedException { final AtomicBoolean functionCalled = new AtomicBoolean(); @@ -1858,7 +1853,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -1892,7 +1886,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_cancelledBeforeApplyingFunction() throws InterruptedException { final AtomicBoolean callableCalled = new AtomicBoolean(); @@ -1926,7 +1919,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_returnsInterruptedFuture() throws InterruptedException { assertThat(Thread.interrupted()).isFalse(); SettableFuture<Integer> cancelledFuture = SettableFuture.create(); @@ -2015,7 +2007,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_error() throws InterruptedException { final Error error = new Error("deliberate"); AsyncCallable<Integer> callable = @@ -2037,14 +2028,10 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_nullInsteadOfFuture() throws Exception { ListenableFuture<?> chainedFuture = scheduleAsync( - constantAsyncCallable(null), - 1, - TimeUnit.NANOSECONDS, - newSingleThreadScheduledExecutor()); + constantAsyncCallable(null), 1, NANOSECONDS, newSingleThreadScheduledExecutor()); try { chainedFuture.get(); fail(); @@ -2059,7 +2046,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -2075,7 +2061,7 @@ public class FuturesTest extends TestCase { } }; ListenableFuture<Integer> future = - scheduleAsync(callable, 1, TimeUnit.NANOSECONDS, newSingleThreadScheduledExecutor()); + scheduleAsync(callable, 1, NANOSECONDS, newSingleThreadScheduledExecutor()); inFunction.await(); future.cancel(false); callableDone.countDown(); @@ -2092,7 +2078,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_cancelledBeforeCallingFunction() throws InterruptedException { final AtomicBoolean callableCalled = new AtomicBoolean(); @@ -2114,7 +2099,7 @@ public class FuturesTest extends TestCase { awaitUninterruptibly(beforeFunction); } }); - ListenableFuture<Integer> future = scheduleAsync(callable, 1, TimeUnit.NANOSECONDS, executor); + ListenableFuture<Integer> future = scheduleAsync(callable, 1, NANOSECONDS, executor); future.cancel(false); // Unpause the executor. @@ -2547,7 +2532,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_noLeakInterruption() throws Exception { final SettableFuture<String> stringFuture = SettableFuture.create(); AsyncCallable<String> combiner = @@ -2591,7 +2575,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_asyncResult() throws Exception { SettableFuture<Integer> futureInteger = SettableFuture.create(); SettableFuture<Boolean> futureBoolean = SettableFuture.create(); @@ -2683,7 +2666,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_cancelledNotInterrupted() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); SettableFuture<Boolean> booleanFuture = SettableFuture.create(); @@ -2722,7 +2704,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_interrupted() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); SettableFuture<Boolean> booleanFuture = SettableFuture.create(); @@ -2815,7 +2796,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllCompleteRunnable_resultCanceledWithoutInterrupt_doesNotInterruptRunnable() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); @@ -2856,7 +2836,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllCompleteRunnable_resultCanceledWithInterrupt_InterruptsRunnable() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); @@ -3375,13 +3354,11 @@ public class FuturesTest extends TestCase { : pseudoTimedGetUninterruptibly(future, 2500, MILLISECONDS); } - @GwtIncompatible // threads public void testAllAsList_extensive() throws InterruptedException { runExtensiveMergerTest(Merger.allMerger); } - @GwtIncompatible // threads public void testSuccessfulAsList_extensive() throws InterruptedException { runExtensiveMergerTest(Merger.successMerger); @@ -3700,7 +3677,7 @@ public class FuturesTest extends TestCase { @GwtIncompatible // used only in GwtIncompatible tests private static class TestException extends Exception { - TestException(@NullableDecl Throwable cause) { + TestException(@CheckForNull Throwable cause) { super(cause); } } diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java index d0fcee238..24990200d 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java @@ -131,7 +131,6 @@ public class FuturesTransformAsyncTest extends AbstractChainedListenableFutureTe } } - public void testFutureCancellableBeforeFunctionCompletion() throws Exception { // Set the result in a separate thread since this test runs the function // (which will block) in the same thread. diff --git a/android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java b/android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java index 872197be8..adeb2d1aa 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java @@ -43,7 +43,6 @@ import junit.framework.TestSuite; * * @author Justin T. Sampson */ - public class GeneratedMonitorTest extends TestCase { public static TestSuite suite() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java b/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java index 4d7a45f9c..bb3b43b9d 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java @@ -22,7 +22,6 @@ package com.google.common.util.concurrent; * * @author Justin T. Sampson */ - public class InterruptibleMonitorTest extends MonitorTestCase { public InterruptibleMonitorTest() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java index afa7eae81..fcfe744e0 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java @@ -25,7 +25,6 @@ import java.util.concurrent.locks.AbstractOwnableSynchronizer; import java.util.concurrent.locks.LockSupport; import junit.framework.TestCase; - public final class InterruptibleTaskTest extends TestCase { // Regression test for a deadlock where a task could be stuck busy waiting for the task to @@ -91,6 +90,14 @@ public final class InterruptibleTaskTest extends TestCase { * protect ourselves from that we want to make sure that tasks don't spin too much waiting for the * interrupting thread to complete the protocol. */ + /* + * This test hangs (or maybe is just *very* slow) under Android. + * + * TODO(b/218700094): Ideally, get this to pass under Android. Failing that, convince ourselves + * that the test isn't exposing a real problem with InterruptibleTask, one that could matter in + * prod. + */ + @AndroidIncompatible public void testInterruptIsSlow() throws Exception { final CountDownLatch isInterruptibleRegistered = new CountDownLatch(1); final SlowChannel slowChannel = new SlowChannel(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java b/android/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java index 3bb819a34..741ff45de 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java @@ -100,7 +100,6 @@ public class JdkFutureAdaptersTest extends TestCase { assertTrue(listenableFuture.isDone()); } - public void testListenInPoolThreadUsesGivenExecutor() throws Exception { ExecutorService executorService = newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).build()); @@ -125,7 +124,6 @@ public class JdkFutureAdaptersTest extends TestCase { assertTrue(listenableFuture.isDone()); } - public void testListenInPoolThreadCustomExecutorInterrupted() throws Exception { final CountDownLatch submitSuccessful = new CountDownLatch(1); ExecutorService executorService = @@ -235,7 +233,6 @@ public class JdkFutureAdaptersTest extends TestCase { } } - @SuppressWarnings("IsInstanceIncompatibleType") // intentional. public void testListenInPoolThreadRunsListenerAfterRuntimeException() throws Exception { RuntimeExceptionThrowingFuture<String> input = new RuntimeExceptionThrowingFuture<>(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java index 8969a7574..fd51a7329 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java @@ -80,7 +80,6 @@ public class ListenableFutureTaskTest extends TestCase { super.tearDown(); } - public void testListenerDoesNotRunUntilTaskCompletes() throws Exception { // Test default state of not started. @@ -106,7 +105,6 @@ public class ListenableFutureTaskTest extends TestCase { assertFalse(task.isCancelled()); } - public void testListenerCalledOnException() throws Exception { throwException = true; @@ -142,7 +140,6 @@ public class ListenableFutureTaskTest extends TestCase { assertEquals(1, runLatch.getCount()); } - public void testListenerCalledOnCancelFromRunning() throws Exception { exec.execute(task); runLatch.await(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTester.java b/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTester.java index 2dcccdb18..575ed0656 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTester.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTester.java @@ -29,7 +29,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Used to test listenable future implementations. @@ -67,7 +67,7 @@ public class ListenableFutureTester { exec.shutdown(); } - public void testCompletedFuture(@NullableDecl Object expectedValue) + public void testCompletedFuture(@CheckForNull Object expectedValue) throws InterruptedException, ExecutionException { assertTrue(future.isDone()); assertFalse(future.isCancelled()); @@ -94,7 +94,7 @@ public class ListenableFutureTester { } } - public void testFailedFuture(@NullableDecl String message) throws InterruptedException { + public void testFailedFuture(@CheckForNull String message) throws InterruptedException { assertTrue(future.isDone()); assertFalse(future.isCancelled()); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java index 5fd9b9508..e0eb32e6a 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java @@ -129,7 +129,6 @@ public class ListenerCallQueueTest extends TestCase { logHandler.getStoredLogRecords().get(0).getMessage()); } - public void testEnqueueAndDispatch_multithreaded() throws InterruptedException { Object listener = new Object(); ExecutorService service = Executors.newFixedThreadPool(4); @@ -153,7 +152,6 @@ public class ListenerCallQueueTest extends TestCase { } } - public void testEnqueueAndDispatch_multithreaded_withThrowingRunnable() throws InterruptedException { Object listener = new Object(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java b/android/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java index 6d620ffc2..e355d35d7 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java @@ -26,7 +26,6 @@ import junit.framework.TestCase; * * @author Justin T. Sampson */ - public abstract class MonitorTestCase extends TestCase { public class TestGuard extends Monitor.Guard { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java b/android/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java index fe4e7f540..aac61735e 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java @@ -88,7 +88,6 @@ public class MoreExecutorsTest extends JSR166TestCase { public void run() {} }; - public void testDirectExecutorServiceServiceInThreadExecution() throws Exception { final ListeningExecutorService executor = newDirectExecutorService(); final ThreadLocal<Integer> threadLocalCount = @@ -168,7 +167,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(10, threadLocalCount.get().intValue()); } - public void testDirectExecutorServiceServiceTermination() throws Exception { final ExecutorService executor = newDirectExecutorService(); final CyclicBarrier barrier = new CyclicBarrier(2); @@ -259,7 +257,6 @@ public class MoreExecutorsTest extends JSR166TestCase { * Test for a bug where threads weren't getting signaled when shutdown was called, only when tasks * completed. */ - public void testDirectExecutorService_awaitTermination_missedSignal() { final ExecutorService service = MoreExecutors.newDirectExecutorService(); Thread waiter = @@ -342,6 +339,7 @@ public class MoreExecutorsTest extends JSR166TestCase { */ } + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testListeningDecorator_noWrapExecuteTask() { ExecutorService delegate = mock(ExecutorService.class); ListeningExecutorService service = listeningDecorator(delegate); @@ -354,7 +352,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(delegate).execute(task); } - public void testListeningDecorator_scheduleSuccess() throws Exception { final CountDownLatch completed = new CountDownLatch(1); ScheduledThreadPoolExecutor delegate = @@ -380,7 +377,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_scheduleFailure() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); ListeningScheduledExecutorService service = listeningDecorator(delegate); @@ -391,7 +387,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_schedulePeriodic() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); ListeningScheduledExecutorService service = listeningDecorator(delegate); @@ -412,7 +407,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_cancelled() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); BlockingQueue<?> delegateQueue = delegate.getQueue(); @@ -566,7 +560,7 @@ public class MoreExecutorsTest extends JSR166TestCase { } } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testAddDelayedShutdownHook_success() throws InterruptedException { TestApplication application = new TestApplication(); ExecutorService service = mock(ExecutorService.class); @@ -578,7 +572,7 @@ public class MoreExecutorsTest extends JSR166TestCase { shutdownFirst.verify(service).awaitTermination(2, TimeUnit.SECONDS); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testAddDelayedShutdownHook_interrupted() throws InterruptedException { TestApplication application = new TestApplication(); ExecutorService service = mock(ExecutorService.class); @@ -588,7 +582,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdown(); } - public void testGetExitingExecutorService_executorSetToUseDaemonThreads() { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = @@ -597,7 +590,7 @@ public class MoreExecutorsTest extends JSR166TestCase { assertTrue(executor.getThreadFactory().newThread(EMPTY_RUNNABLE).isDaemon()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingExecutorService_executorDelegatesToOriginal() { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = mock(ThreadPoolExecutor.class); @@ -607,7 +600,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).execute(EMPTY_RUNNABLE); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingExecutorService_shutdownHookRegistered() throws InterruptedException { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = mock(ThreadPoolExecutor.class); @@ -618,7 +611,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).shutdown(); } - public void testGetExitingScheduledExecutorService_executorSetToUseDaemonThreads() { TestApplication application = new TestApplication(); ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); @@ -626,7 +618,7 @@ public class MoreExecutorsTest extends JSR166TestCase { assertTrue(executor.getThreadFactory().newThread(EMPTY_RUNNABLE).isDaemon()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingScheduledExecutorService_executorDelegatesToOriginal() { TestApplication application = new TestApplication(); ScheduledThreadPoolExecutor executor = mock(ScheduledThreadPoolExecutor.class); @@ -636,7 +628,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).execute(EMPTY_RUNNABLE); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetScheduledExitingExecutorService_shutdownHookRegistered() throws InterruptedException { TestApplication application = new TestApplication(); @@ -669,7 +661,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(oldName, Thread.currentThread().getName()); } - public void testExecutors_nullCheck() throws Exception { new ClassSanityTester() .setDefault(RateLimiter.class, RateLimiter.create(1.0)) @@ -699,14 +690,13 @@ public class MoreExecutorsTest extends JSR166TestCase { /* Half of a 1-second timeout in nanoseconds */ private static final long HALF_SECOND_NANOS = NANOSECONDS.convert(1L, SECONDS) / 2; - public void testShutdownAndAwaitTermination_immediateShutdown() throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); assertTrue(shutdownAndAwaitTermination(service, 1L, SECONDS)); assertTrue(service.isTerminated()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_immediateShutdownInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)).thenReturn(true); @@ -716,7 +706,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).awaitTermination(HALF_SECOND_NANOS, NANOSECONDS); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_forcedShutDownInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) @@ -729,7 +719,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdownNow(); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_nonTerminationInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) @@ -741,7 +731,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdownNow(); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_interruptedInternal() throws Exception { final ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) diff --git a/android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java b/android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java index 20209e8b8..80e7ab2e1 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java @@ -274,7 +274,14 @@ public class SequentialExecutorTest extends TestCase { assertEquals(1, numCalls.get()); } - + /* + * Under Android, MyError propagates up and fails the test? + * + * TODO(b/218700094): Does this matter to prod users, or is it just a feature of our testing + * environment? If the latter, maybe write a custom Executor that avoids failing the test when it + * sees an Error? + */ + @AndroidIncompatible public void testTaskThrowsError() throws Exception { class MyError extends Error {} final CyclicBarrier barrier = new CyclicBarrier(2); @@ -313,7 +320,6 @@ public class SequentialExecutorTest extends TestCase { } } - public void testRejectedExecutionThrownWithMultipleCalls() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final SettableFuture<?> future = SettableFuture.create(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java index 20ed3dea5..7db6b06ae 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java @@ -119,7 +119,6 @@ public class ServiceManagerTest extends TestCase { } } - public void testServiceStartupTimes() { Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); @@ -131,7 +130,6 @@ public class ServiceManagerTest extends TestCase { assertThat(startupTimes.get(b)).isAtLeast(353); } - public void testServiceStartupTimes_selfStartingServices() { // This tests to ensure that: // 1. service times are accurate when the service is started by the manager @@ -166,7 +164,6 @@ public class ServiceManagerTest extends TestCase { assertThat(startupTimes.get(b)).isNotNull(); } - public void testServiceStartStop() { Service a = new NoOpService(); Service b = new NoOpService(); @@ -188,7 +185,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.failedServices.isEmpty()); } - public void testFailStart() throws Exception { Service a = new NoOpService(); Service b = new FailStartService(); @@ -216,7 +212,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.stoppedCalled); } - public void testFailRun() throws Exception { Service a = new NoOpService(); Service b = new FailRunService(); @@ -239,7 +234,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.stoppedCalled); } - public void testFailStop() throws Exception { Service a = new NoOpService(); Service b = new FailStopService(); @@ -268,7 +262,6 @@ public class ServiceManagerTest extends TestCase { assertThat(toString).contains("FailStartService"); } - public void testTimeouts() throws Exception { Service a = new NoOpDelayedService(50); ServiceManager manager = new ServiceManager(asList(a)); @@ -445,7 +438,6 @@ public class ServiceManagerTest extends TestCase { * Tests that a ServiceManager can be fully shut down if one of its failure listeners is slow or * even permanently blocked. */ - public void testListenerDeadlock() throws InterruptedException { final CountDownLatch failEnter = new CountDownLatch(1); final CountDownLatch failLeave = new CountDownLatch(1); @@ -606,7 +598,6 @@ public class ServiceManagerTest extends TestCase { * * <p>Before the bug was fixed this test would fail at least 30% of the time. */ - public void testTransitionRace() throws TimeoutException { for (int k = 0; k < 1000; k++) { List<Service> services = Lists.newArrayList(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java index 9b8b88f27..105e8de04 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java @@ -51,19 +51,16 @@ public class SettableFutureTest extends TestCase { } } - public void testSetValue() throws Exception { assertTrue(future.set("value")); tester.testCompletedFuture("value"); } - public void testSetFailure() throws Exception { assertTrue(future.setException(new Exception("failure"))); tester.testFailedFuture("failure"); } - public void testSetFailureNull() throws Exception { try { future.setException(null); @@ -75,7 +72,6 @@ public class SettableFutureTest extends TestCase { tester.testFailedFuture("failure"); } - public void testCancel() throws Exception { assertTrue(future.cancel(true)); tester.testCancelledFuture(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java b/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java index 04b824f82..35406864d 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java @@ -34,7 +34,6 @@ import junit.framework.TestCase; * @author kevinb * @author Jens Nyman */ - public class SimpleTimeLimiterTest extends TestCase { private static final long DELAY_MS = 50; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/StripedTest.java b/android/guava-tests/test/com/google/common/util/concurrent/StripedTest.java index fa9d87f75..688d6fd34 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/StripedTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/StripedTest.java @@ -129,7 +129,7 @@ public class StripedTest extends TestCase { assertTrue(Striped.lazyWeakLock(256).size() == 256); } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testWeakImplementations() { for (Striped<?> striped : weakImplementations()) { WeakReference<Object> weakRef = new WeakReference<>(striped.get(new Object())); @@ -137,7 +137,7 @@ public class StripedTest extends TestCase { } } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testWeakReadWrite() { Striped<ReadWriteLock> striped = Striped.lazyWeakReadWriteLock(1000); Object key = new Object(); @@ -150,7 +150,7 @@ public class StripedTest extends TestCase { readLock.unlock(); } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testStrongImplementations() { for (Striped<?> striped : strongImplementations()) { WeakReference<Object> weakRef = new WeakReference<>(striped.get(new Object())); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java b/android/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java index 8a52ffeed..5b77f9a59 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java @@ -33,7 +33,6 @@ import junit.framework.TestCase; * * @author Justin T. Sampson */ - public class SupplementalMonitorTest extends TestCase { public void testLeaveWithoutEnterThrowsIMSE() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/TestThread.java b/android/guava-tests/test/com/google/common/util/concurrent/TestThread.java index 1c3c88818..f85d3134d 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/TestThread.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/TestThread.java @@ -28,8 +28,8 @@ import java.lang.reflect.Method; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import javax.annotation.CheckForNull; import junit.framework.AssertionFailedError; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; /** * A helper for concurrency testing. One or more {@code TestThread} instances are instantiated in a @@ -168,7 +168,7 @@ public final class TestThread<L> extends Thread implements TearDown { * Asserts that a prior call that had caused this thread to block or wait has since returned * normally. */ - public void assertPriorCallReturns(@NullableDecl String methodName) throws Exception { + public void assertPriorCallReturns(@CheckForNull String methodName) throws Exception { assertEquals(null, getResponse(methodName).getResult()); } @@ -176,7 +176,7 @@ public final class TestThread<L> extends Thread implements TearDown { * Asserts that a prior call that had caused this thread to block or wait has since returned the * expected boolean value. */ - public void assertPriorCallReturns(boolean expected, @NullableDecl String methodName) + public void assertPriorCallReturns(boolean expected, @CheckForNull String methodName) throws Exception { assertEquals(expected, getResponse(methodName).getResult()); } diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java index 7684b9633..a3a7b8e79 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java @@ -56,7 +56,6 @@ public class ThreadFactoryBuilderTest extends TestCase { builder = new ThreadFactoryBuilder(); } - public void testThreadFactoryBuilder_defaults() throws InterruptedException { ThreadFactory threadFactory = builder.build(); Thread thread = threadFactory.newThread(monitoredRunnable); @@ -93,7 +92,6 @@ public class ThreadFactoryBuilderTest extends TestCase { assertThat(thread.getName()).matches("^pool-\\d+-thread-" + threadId + "$"); } - public void testNameFormatWithPercentS_custom() { String format = "super-duper-thread-%s"; ThreadFactory factory = builder.setNameFormat(format).build(); @@ -102,7 +100,6 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testNameFormatWithPercentD_custom() { String format = "super-duper-thread-%d"; ThreadFactory factory = builder.setNameFormat(format).build(); @@ -111,21 +108,18 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testDaemon_false() { ThreadFactory factory = builder.setDaemon(false).build(); Thread thread = factory.newThread(monitoredRunnable); assertFalse(thread.isDaemon()); } - public void testDaemon_true() { ThreadFactory factory = builder.setDaemon(true).build(); Thread thread = factory.newThread(monitoredRunnable); assertTrue(thread.isDaemon()); } - public void testPriority_custom() { for (int i = Thread.MIN_PRIORITY; i <= Thread.MAX_PRIORITY; i++) { ThreadFactory factory = builder.setPriority(i).build(); @@ -150,7 +144,6 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testUncaughtExceptionHandler_custom() { assertEquals( UNCAUGHT_EXCEPTION_HANDLER, @@ -161,7 +154,6 @@ public class ThreadFactoryBuilderTest extends TestCase { .getUncaughtExceptionHandler()); } - public void testBuildMutateBuild() { ThreadFactory factory1 = builder.setPriority(1).build(); assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); @@ -177,7 +169,6 @@ public class ThreadFactoryBuilderTest extends TestCase { unused = builder.build(); // this is *also* allowed } - public void testBuildMutate() { ThreadFactory factory1 = builder.setPriority(1).build(); assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); @@ -186,7 +177,6 @@ public class ThreadFactoryBuilderTest extends TestCase { assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); } - public void testThreadFactory() throws InterruptedException { final String THREAD_NAME = "ludicrous speed"; final int THREAD_PRIORITY = 1; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 157afa79d..e735ae02a 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java @@ -84,7 +84,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testCancel_interrupted() throws Exception { final AtomicBoolean interruptedExceptionThrown = new AtomicBoolean(); final CountDownLatch enterLatch = new CountDownLatch(1); @@ -135,7 +134,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testRunIdempotency() throws Exception { final int numThreads = 10; final ExecutorService executor = Executors.newFixedThreadPool(numThreads); @@ -171,7 +169,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testToString() throws Exception { final CountDownLatch enterLatch = new CountDownLatch(1); final CountDownLatch exitLatch = new CountDownLatch(1); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java b/android/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java index eb8455b18..4a26b4976 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java @@ -23,7 +23,6 @@ import com.google.common.util.concurrent.UncaughtExceptionHandlers.Exiter; import junit.framework.TestCase; /** @author Gregory Kick */ - public class UncaughtExceptionHandlersTest extends TestCase { private Runtime runtimeMock; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java index 0d2426607..3f91b8123 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java @@ -77,7 +77,6 @@ public class UninterruptibleFutureTest extends TestCase { * This first test doesn't test anything in Uninterruptibles, just demonstrates some normal * behavior of futures so that you can contrast the next test with it. */ - public void testRegularFutureInterrupted() throws ExecutionException { /* @@ -116,7 +115,6 @@ public class UninterruptibleFutureTest extends TestCase { assertTrue(sleeper.completed); } - public void testMakeUninterruptible_timeoutPreservedThroughInterruption() throws ExecutionException { @@ -155,32 +153,26 @@ public class UninterruptibleFutureTest extends TestCase { } } - public void testMakeUninterruptible_untimed_uninterrupted() throws Exception { runUntimedInterruptsTest(0); } - public void testMakeUninterruptible_untimed_interrupted() throws Exception { runUntimedInterruptsTest(1); } - public void testMakeUninterruptible_untimed_multiplyInterrupted() throws Exception { runUntimedInterruptsTest(38); } - public void testMakeUninterruptible_timed_uninterrupted() throws Exception { runTimedInterruptsTest(0); } - public void testMakeUninterruptible_timed_interrupted() throws Exception { runTimedInterruptsTest(1); } - public void testMakeUninterruptible_timed_multiplyInterrupted() throws Exception { runTimedInterruptsTest(38); } @@ -218,7 +210,6 @@ public class UninterruptibleFutureTest extends TestCase { /** * Confirms that the test code triggers {@link InterruptedException} in a standard {@link Future}. */ - public void testMakeUninterruptible_plainFutureSanityCheck() throws Exception { SettableFuture<String> future = SettableFuture.create(); FutureTask<Boolean> wasInterrupted = untimedInterruptReporter(future, true); @@ -235,7 +226,6 @@ public class UninterruptibleFutureTest extends TestCase { } } - public void testMakeUninterruptible_timedGetZeroTimeoutAttempted() throws TimeoutException, ExecutionException { SettableFuture<String> future = SettableFuture.create(); @@ -248,7 +238,6 @@ public class UninterruptibleFutureTest extends TestCase { assertEquals(RESULT, getUninterruptibly(future, 0, SECONDS)); } - public void testMakeUninterruptible_timedGetNegativeTimeoutAttempted() throws TimeoutException, ExecutionException { SettableFuture<String> future = SettableFuture.create(); diff --git a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java index 59bf80878..3e775bab5 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java @@ -22,7 +22,6 @@ package com.google.common.util.concurrent; * * @author Justin T. Sampson */ - public class UninterruptibleMonitorTest extends MonitorTestCase { public UninterruptibleMonitorTest() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java index e58cf6a60..ab8d5b0a8 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java @@ -54,7 +54,6 @@ import junit.framework.TestCase; * * @author Anthony Zana */ - public class UninterruptiblesTest extends TestCase { private static final String EXPECTED_TAKE = "expectedTake"; diff --git a/android/guava/pom.xml b/android/guava/pom.xml index e9154c7a6..39611d4c9 100644 --- a/android/guava/pom.xml +++ b/android/guava/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-android</version> + <version>31.1-android</version> </parent> <artifactId>guava</artifactId> <packaging>bundle</packaging> @@ -36,10 +36,6 @@ <artifactId>checker-qual</artifactId> </dependency> <dependency> - <groupId>org.checkerframework</groupId> - <artifactId>checker-compat-qual</artifactId> - </dependency> - <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> </dependency> @@ -120,12 +116,6 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> - <configuration> - <ignores> - <!-- Allow requireNonNull: Android desugaring rewrites it (so it's safe for us to use), and it's useful for null checks. Note that this line allows *all* methods from java.util.Objects. That's the best that we can do with the configuration options that Animal Sniffer offers. --> - <ignore>java.util.Objects</ignore> - </ignores> - </configuration> </plugin> <plugin> <artifactId>maven-javadoc-plugin</artifactId> @@ -139,7 +129,7 @@ <!-- excludePackageNames requires specification of packages separately from "all subpackages". https://issues.apache.org/jira/browse/MJAVADOC-584 --> <excludePackageNames> - com.google.common.base.internal,com.google.common.base.internal.*,com.google.thirdparty.publicsuffix,com.google.thirdparty.publicsuffix.*,com.oracle.*,com.sun.*,java.*,javax.*,jdk,jdk.*,org.*,sun.* + com.azul.tooling.in,com.google.common.base.internal,com.google.common.base.internal.*,com.google.thirdparty.publicsuffix,com.google.thirdparty.publicsuffix.*,com.oracle.*,com.sun.*,java.*,javax.*,jdk,jdk.*,org.*,sun.* </excludePackageNames> <!-- Ignore some tags that are found in Java 11 sources but not recognized... under -source 8, I think it was? I can no longer reproduce the failure. --> <tags> diff --git a/android/guava/src/com/google/common/base/CharMatcher.java b/android/guava/src/com/google/common/base/CharMatcher.java index 7941883ec..2a2a89447 100644 --- a/android/guava/src/com/google/common/base/CharMatcher.java +++ b/android/guava/src/com/google/common/base/CharMatcher.java @@ -1461,10 +1461,10 @@ public abstract class CharMatcher implements Predicate<Character> { // [[[:Zs:][:Zl:][:Zp:][:Cc:][:Cf:][:Cs:][:Co:]]&[\u0000-\uFFFF]] // with the "Abbreviate" option, and get the ranges from there. private static final String RANGE_STARTS = - "\u0000\u007f\u00ad\u0600\u061c\u06dd\u070f\u08e2\u1680\u180e\u2000\u2028\u205f\u2066" + "\u0000\u007f\u00ad\u0600\u061c\u06dd\u070f\u0890\u08e2\u1680\u180e\u2000\u2028\u205f\u2066" + "\u3000\ud800\ufeff\ufff9"; private static final String RANGE_ENDS = // inclusive ends - "\u0020\u00a0\u00ad\u0605\u061c\u06dd\u070f\u08e2\u1680\u180e\u200f\u202f\u2064\u206f" + "\u0020\u00a0\u00ad\u0605\u061c\u06dd\u070f\u0891\u08e2\u1680\u180e\u200f\u202f\u2064\u206f" + "\u3000\uf8ff\ufeff\ufffb"; static final Invisible INSTANCE = new Invisible(); diff --git a/android/guava/src/com/google/common/base/Converter.java b/android/guava/src/com/google/common/base/Converter.java index 208a0324e..422480d16 100644 --- a/android/guava/src/com/google/common/base/Converter.java +++ b/android/guava/src/com/google/common/base/Converter.java @@ -19,7 +19,9 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.errorprone.annotations.CheckReturnValue; import com.google.errorprone.annotations.ForOverride; +import com.google.errorprone.annotations.InlineMe; import com.google.errorprone.annotations.concurrent.LazyInit; import com.google.j2objc.annotations.RetainedWith; import java.io.Serializable; @@ -270,7 +272,7 @@ public abstract class Converter<A, B> implements Function<A, B> { * both use cases by using @PolyNull. (By contrast, we can't use @PolyNull for our superinterface * (`implements Function<@PolyNull A, @PolyNull B>`), at least as far as I know.) */ - public Iterable<B> convertAll(final Iterable<? extends A> fromIterable) { + public Iterable<B> convertAll(Iterable<? extends A> fromIterable) { checkNotNull(fromIterable, "fromIterable"); return new Iterable<B>() { @Override @@ -307,7 +309,7 @@ public abstract class Converter<A, B> implements Function<A, B> { * * <p><b>Note:</b> you should not override this method. It is non-final for legacy reasons. */ - @CanIgnoreReturnValue + @CheckReturnValue public Converter<B, A> reverse() { Converter<B, A> result = reverse; return (result == null) ? reverse = new ReverseConverter<>(this) : result; @@ -492,6 +494,7 @@ public abstract class Converter<A, B> implements Function<A, B> { */ @SuppressWarnings("nullness") @CheckForNull + @InlineMe(replacement = "this.convert(a)") public final B apply(@CheckForNull A a) { return convert(a); } diff --git a/android/guava/src/com/google/common/base/Enums.java b/android/guava/src/com/google/common/base/Enums.java index 449b7e3a9..5c55b6594 100644 --- a/android/guava/src/com/google/common/base/Enums.java +++ b/android/guava/src/com/google/common/base/Enums.java @@ -105,8 +105,8 @@ public final class Enums { * * @since 16.0 */ - public static <T extends Enum<T>> Converter<String, T> stringConverter(final Class<T> enumClass) { - return new StringConverter<T>(enumClass); + public static <T extends Enum<T>> Converter<String, T> stringConverter(Class<T> enumClass) { + return new StringConverter<>(enumClass); } private static final class StringConverter<T extends Enum<T>> extends Converter<String, T> diff --git a/android/guava/src/com/google/common/base/Equivalence.java b/android/guava/src/com/google/common/base/Equivalence.java index 0ce901feb..1bf7f9899 100644 --- a/android/guava/src/com/google/common/base/Equivalence.java +++ b/android/guava/src/com/google/common/base/Equivalence.java @@ -153,7 +153,43 @@ public abstract class Equivalence<T> { * @since 10.0 */ public final <S extends @Nullable T> Wrapper<S> wrap(@ParametricNullness S reference) { - return new Wrapper<S>(this, reference); + /* + * I'm pretty sure that this warning "makes sense" but doesn't indicate a real problem. + * + * Why it "makes sense": If we pass a `@Nullable Foo`, then we should also pass an + * `Equivalence<? super @Nullable Foo>`. And there's no such thing because Equivalence doesn't + * permit nullable type arguments. + * + * Why there's no real problem: Every Equivalence can handle null. + * + * We could work around this by giving Wrapper 2 type parameters. In the terms of this method, + * that would be both the T parameter (from the class) and the S parameter (from this method). + * However, such a change would be source-incompatible. (Plus, there's no reason for the S + * parameter from the user's perspective, so it would be a wart.) + * + * We could probably also work around this by making Wrapper non-final and putting the + * implementation into a subclass with those 2 type parameters. But we like `final`, if only to + * deter users from using mocking frameworks to construct instances. (And could also complicate + * serialization, which is discussed more in the next paragraph.) + * + * We could probably also work around this by having Wrapper accept an instance of a new + * WrapperGuts class, which would then be the class that would declare the 2 type parameters. + * But that would break deserialization of previously serialized Wrapper instances. And while we + * specifically say not to rely on serialization across Guava versions, users sometimes do. So + * we'd rather not break them without a good enough reason. + * + * (We could work around the serialization problem by writing custom serialization code. But + * even that helps only the case of serializing with an old version and deserializing with a + * new, not vice versa -- unless we introduce WrapperGuts and the logic to handle it today, wait + * until "everyone" has picked up a version of Guava with that code, and *then* change to use + * WrapperGuts.) + * + * Anyway, a suppression isn't really a big deal. But I have tried to do some due diligence on + * avoiding it :) + */ + @SuppressWarnings("nullness") + Wrapper<S> w = new Wrapper<>(this, reference); + return w; } /** diff --git a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java index 5ce1d3103..7447b8051 100644 --- a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -156,7 +156,7 @@ public class FinalizableReferenceQueue implements Closeable { public FinalizableReferenceQueue() { // We could start the finalizer lazily, but I'd rather it blow up early. queue = new ReferenceQueue<>(); - frqRef = new PhantomReference<Object>(this, queue); + frqRef = new PhantomReference<>(this, queue); boolean threadStarted = false; try { startFinalizer.invoke(null, FinalizableReference.class, queue, frqRef); diff --git a/android/guava/src/com/google/common/base/FunctionalEquivalence.java b/android/guava/src/com/google/common/base/FunctionalEquivalence.java index 8bb67be28..4383f4f36 100644 --- a/android/guava/src/com/google/common/base/FunctionalEquivalence.java +++ b/android/guava/src/com/google/common/base/FunctionalEquivalence.java @@ -20,6 +20,7 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import javax.annotation.CheckForNull; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Equivalence applied on functional result. @@ -34,11 +35,11 @@ final class FunctionalEquivalence<F, T> extends Equivalence<F> implements Serial private static final long serialVersionUID = 0; - private final Function<? super F, ? extends T> function; + private final Function<? super F, ? extends @Nullable T> function; private final Equivalence<T> resultEquivalence; FunctionalEquivalence( - Function<? super F, ? extends T> function, Equivalence<T> resultEquivalence) { + Function<? super F, ? extends @Nullable T> function, Equivalence<T> resultEquivalence) { this.function = checkNotNull(function); this.resultEquivalence = checkNotNull(resultEquivalence); } diff --git a/android/guava/src/com/google/common/base/Functions.java b/android/guava/src/com/google/common/base/Functions.java index 5337d0e36..78785047e 100644 --- a/android/guava/src/com/google/common/base/Functions.java +++ b/android/guava/src/com/google/common/base/Functions.java @@ -288,7 +288,7 @@ public final class Functions { */ public static <T extends @Nullable Object> Function<T, Boolean> forPredicate( Predicate<T> predicate) { - return new PredicateFunction<T>(predicate); + return new PredicateFunction<>(predicate); } /** @see Functions#forPredicate */ diff --git a/android/guava/src/com/google/common/base/Joiner.java b/android/guava/src/com/google/common/base/Joiner.java index 0f3d6e4b6..8b29f68f8 100644 --- a/android/guava/src/com/google/common/base/Joiner.java +++ b/android/guava/src/com/google/common/base/Joiner.java @@ -236,7 +236,7 @@ public class Joiner { * Returns a joiner with the same behavior as this one, except automatically substituting {@code * nullText} for any provided null elements. */ - public Joiner useForNull(final String nullText) { + public Joiner useForNull(String nullText) { checkNotNull(nullText); return new Joiner(this) { @Override @@ -493,9 +493,7 @@ public class Joiner { } private static Iterable<@Nullable Object> iterable( - @CheckForNull final Object first, - @CheckForNull final Object second, - final @Nullable Object[] rest) { + @CheckForNull Object first, @CheckForNull Object second, @Nullable Object[] rest) { checkNotNull(rest); return new AbstractList<@Nullable Object>() { @Override diff --git a/android/guava/src/com/google/common/base/ParametricNullness.java b/android/guava/src/com/google/common/base/ParametricNullness.java index c73605548..5b595adb3 100644 --- a/android/guava/src/com/google/common/base/ParametricNullness.java +++ b/android/guava/src/com/google/common/base/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/base/Predicates.java b/android/guava/src/com/google/common/base/Predicates.java index c3b556265..dc487fc56 100644 --- a/android/guava/src/com/google/common/base/Predicates.java +++ b/android/guava/src/com/google/common/base/Predicates.java @@ -82,7 +82,7 @@ public final class Predicates { * false}. */ public static <T extends @Nullable Object> Predicate<T> not(Predicate<T> predicate) { - return new NotPredicate<T>(predicate); + return new NotPredicate<>(predicate); } /** @@ -94,7 +94,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> and( Iterable<? extends Predicate<? super T>> components) { - return new AndPredicate<T>(defensiveCopy(components)); + return new AndPredicate<>(defensiveCopy(components)); } /** @@ -116,7 +116,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> and( Predicate<? super T> first, Predicate<? super T> second) { - return new AndPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); + return new AndPredicate<>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); } /** @@ -128,7 +128,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> or( Iterable<? extends Predicate<? super T>> components) { - return new OrPredicate<T>(defensiveCopy(components)); + return new OrPredicate<>(defensiveCopy(components)); } /** @@ -150,7 +150,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> or( Predicate<? super T> first, Predicate<? super T> second) { - return new OrPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); + return new OrPredicate<>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); } /** @@ -213,7 +213,7 @@ public final class Predicates { * @param target the collection that may contain the function input */ public static <T extends @Nullable Object> Predicate<T> in(Collection<? extends T> target) { - return new InPredicate<T>(target); + return new InPredicate<>(target); } /** @@ -713,7 +713,7 @@ public final class Predicates { } static <T> List<T> defensiveCopy(Iterable<T> iterable) { - ArrayList<T> list = new ArrayList<T>(); + ArrayList<T> list = new ArrayList<>(); for (T element : iterable) { list.add(checkNotNull(element)); } diff --git a/android/guava/src/com/google/common/base/Present.java b/android/guava/src/com/google/common/base/Present.java index 59efebc10..4e62da29e 100644 --- a/android/guava/src/com/google/common/base/Present.java +++ b/android/guava/src/com/google/common/base/Present.java @@ -71,7 +71,7 @@ final class Present<T> extends Optional<T> { @Override public <V> Optional<V> transform(Function<? super T, V> function) { - return new Present<V>( + return new Present<>( checkNotNull( function.apply(reference), "the Function passed to Optional.transform() must not return null.")); diff --git a/android/guava/src/com/google/common/base/Suppliers.java b/android/guava/src/com/google/common/base/Suppliers.java index 57d3486b2..6ced905b9 100644 --- a/android/guava/src/com/google/common/base/Suppliers.java +++ b/android/guava/src/com/google/common/base/Suppliers.java @@ -226,7 +226,7 @@ public final class Suppliers { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public static <T extends @Nullable Object> Supplier<T> memoizeWithExpiration( Supplier<T> delegate, long duration, TimeUnit unit) { - return new ExpiringMemoizingSupplier<T>(delegate, duration, unit); + return new ExpiringMemoizingSupplier<>(delegate, duration, unit); } @VisibleForTesting @@ -286,7 +286,7 @@ public final class Suppliers { /** Returns a supplier that always supplies {@code instance}. */ public static <T extends @Nullable Object> Supplier<T> ofInstance( @ParametricNullness T instance) { - return new SupplierOfInstance<T>(instance); + return new SupplierOfInstance<>(instance); } private static class SupplierOfInstance<T extends @Nullable Object> @@ -331,7 +331,7 @@ public final class Suppliers { */ public static <T extends @Nullable Object> Supplier<T> synchronizedSupplier( Supplier<T> delegate) { - return new ThreadSafeSupplier<T>(delegate); + return new ThreadSafeSupplier<>(delegate); } private static class ThreadSafeSupplier<T extends @Nullable Object> diff --git a/android/guava/src/com/google/common/base/Throwables.java b/android/guava/src/com/google/common/base/Throwables.java index 7832d186a..e45ce800c 100644 --- a/android/guava/src/com/google/common/base/Throwables.java +++ b/android/guava/src/com/google/common/base/Throwables.java @@ -19,7 +19,6 @@ import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.VisibleForTesting; @@ -290,7 +289,6 @@ public final class Throwables { * @return an unmodifiable list containing the cause chain starting with {@code throwable} * @throws IllegalArgumentException if there is a loop in the causal chain */ - @Beta // TODO(kevinb): decide best return type public static List<Throwable> getCausalChain(Throwable throwable) { checkNotNull(throwable); List<Throwable> causes = new ArrayList<>(4); @@ -330,7 +328,6 @@ public final class Throwables { * ClassCastException}'s cause is {@code throwable}. * @since 22.0 */ - @Beta @GwtIncompatible // Class.cast(Object) @CheckForNull public static <X extends Throwable> X getCauseAs( @@ -382,11 +379,12 @@ public final class Throwables { * exception's creation. * * @since 19.0 + * @deprecated This method is equivalent to {@link Throwable#getStackTrace()} on JDK versions past + * JDK 8 and on all Android versions. Use {@link Throwable#getStackTrace()} directly, or where + * possible use the {@code java.lang.StackWalker.walk} method introduced in JDK 9. */ - // TODO(cpovirk): Say something about the possibility that List access could fail at runtime? - @Beta + @Deprecated @GwtIncompatible // lazyStackTraceIsLazy, jlaStackTrace - // TODO(cpovirk): Consider making this available under GWT (slow implementation only). public static List<StackTraceElement> lazyStackTrace(Throwable throwable) { return lazyStackTraceIsLazy() ? jlaStackTrace(throwable) @@ -398,15 +396,17 @@ public final class Throwables { * documentation. * * @since 19.0 + * @deprecated This method always returns false on JDK versions past JDK 8 and on all Android + * versions. */ - @Beta + @Deprecated @GwtIncompatible // getStackTraceElementMethod public static boolean lazyStackTraceIsLazy() { return getStackTraceElementMethod != null && getStackTraceDepthMethod != null; } @GwtIncompatible // invokeAccessibleNonThrowingMethod - private static List<StackTraceElement> jlaStackTrace(final Throwable t) { + private static List<StackTraceElement> jlaStackTrace(Throwable t) { checkNotNull(t); /* * TODO(cpovirk): Consider optimizing iterator() to catch IOOBE instead of doing bounds checks. diff --git a/android/guava/src/com/google/common/base/internal/Finalizer.java b/android/guava/src/com/google/common/base/internal/Finalizer.java index 0da22069e..b45ec1578 100644 --- a/android/guava/src/com/google/common/base/internal/Finalizer.java +++ b/android/guava/src/com/google/common/base/internal/Finalizer.java @@ -23,7 +23,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * Thread that finalizes referents. All references should implement {@code @@ -43,6 +43,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableDecl; * collected, and this class can detect when the main class loader has been garbage collected and * stop itself. */ +// no @ElementTypesAreNonNullByDefault for the reasons discussed above public class Finalizer implements Runnable { private static final Logger logger = Logger.getLogger(Finalizer.class.getName()); @@ -116,10 +117,10 @@ public class Finalizer implements Runnable { // By preference, we will use the Thread constructor that has an `inheritThreadLocals` parameter. // But before Java 9, our only way not to inherit ThreadLocals is to zap them after the thread // is created, by accessing a private field. - @NullableDecl + @CheckForNull private static final Constructor<Thread> bigThreadConstructor = getBigThreadConstructor(); - @NullableDecl + @CheckForNull private static final Field inheritableThreadLocals = (bigThreadConstructor == null) ? getInheritableThreadLocalsField() : null; @@ -130,8 +131,7 @@ public class Finalizer implements Runnable { PhantomReference<Object> frqReference) { this.queue = queue; - this.finalizableReferenceClassReference = - new WeakReference<Class<?>>(finalizableReferenceClass); + this.finalizableReferenceClassReference = new WeakReference<>(finalizableReferenceClass); // Keep track of the FRQ that started us so we know when to stop. this.frqReference = frqReference; @@ -192,7 +192,7 @@ public class Finalizer implements Runnable { } /** Looks up FinalizableReference.finalizeReferent() method. */ - @NullableDecl + @CheckForNull private Method getFinalizeReferentMethod() { Class<?> finalizableReferenceClass = finalizableReferenceClassReference.get(); if (finalizableReferenceClass == null) { @@ -211,7 +211,7 @@ public class Finalizer implements Runnable { } } - @NullableDecl + @CheckForNull private static Field getInheritableThreadLocalsField() { try { Field inheritableThreadLocals = Thread.class.getDeclaredField("inheritableThreadLocals"); @@ -226,7 +226,7 @@ public class Finalizer implements Runnable { } } - @NullableDecl + @CheckForNull private static Constructor<Thread> getBigThreadConstructor() { try { return Thread.class.getConstructor( diff --git a/android/guava/src/com/google/common/cache/CacheBuilder.java b/android/guava/src/com/google/common/cache/CacheBuilder.java index 227b2c22d..b690973b2 100644 --- a/android/guava/src/com/google/common/cache/CacheBuilder.java +++ b/android/guava/src/com/google/common/cache/CacheBuilder.java @@ -49,8 +49,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * <p>The successor to Guava's caching API is <a * href="https://github.com/ben-manes/caffeine/wiki">Caffeine</a>. Its API is designed to make it a - * nearly drop-in replacement -- though it requires Java 8 APIs and is not available for Android or - * GWT/j2cl. Its equivalent to {@code CacheBuilder} is its <a + * nearly drop-in replacement -- though it requires Java 8 APIs, is not available for Android or + * GWT/j2cl, and may have <a href="https://github.com/ben-manes/caffeine/wiki/Guava">different + * (usually better) behavior</a> when multiple threads attempt concurrent mutations. Its equivalent + * to {@code CacheBuilder} is its <a * href="https://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/latest/com.github.benmanes.caffeine/com/github/benmanes/caffeine/cache/Caffeine.html">{@code * Caffeine}</a> class. Caffeine offers better performance, more features (including asynchronous * loading), and fewer <a diff --git a/android/guava/src/com/google/common/cache/CacheBuilderSpec.java b/android/guava/src/com/google/common/cache/CacheBuilderSpec.java index 64b5ad261..7757f3bc4 100644 --- a/android/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/android/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -108,7 +108,7 @@ public final class CacheBuilderSpec { .put("expireAfterWrite", new WriteDurationParser()) .put("refreshAfterWrite", new RefreshDurationParser()) .put("refreshInterval", new RefreshDurationParser()) - .build(); + .buildOrThrow(); @VisibleForTesting @CheckForNull Integer initialCapacity; @VisibleForTesting @CheckForNull Long maximumSize; diff --git a/android/guava/src/com/google/common/cache/LocalCache.java b/android/guava/src/com/google/common/cache/LocalCache.java index f61f68ec0..f3744e59c 100644 --- a/android/guava/src/com/google/common/cache/LocalCache.java +++ b/android/guava/src/com/google/common/cache/LocalCache.java @@ -21,6 +21,7 @@ import static com.google.common.cache.CacheBuilder.UNSET_INT; import static com.google.common.util.concurrent.Futures.transform; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly; +import static java.util.Collections.unmodifiableSet; import static java.util.concurrent.TimeUnit.NANOSECONDS; import com.google.common.annotations.GwtCompatible; @@ -36,6 +37,7 @@ import com.google.common.cache.CacheBuilder.NullListener; import com.google.common.cache.CacheBuilder.OneWeigher; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; import com.google.common.cache.CacheLoader.UnsupportedLoadingOperationException; +import com.google.common.cache.LocalCache.AbstractCacheSet; import com.google.common.collect.AbstractSequentialIterator; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -81,7 +83,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * The concurrent hash map implementation built by {@link CacheBuilder}. @@ -230,13 +232,13 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> final StatsCounter globalStatsCounter; /** The default cache loader to use on loading operations. */ - @NullableDecl final CacheLoader<? super K, V> defaultLoader; + @CheckForNull final CacheLoader<? super K, V> defaultLoader; /** * Creates a new, empty map with the specified strategy, initial capacity and concurrency level. */ LocalCache( - CacheBuilder<? super K, ? super V> builder, @NullableDecl CacheLoader<? super K, V> loader) { + CacheBuilder<? super K, ? super V> builder, @CheckForNull CacheLoader<? super K, V> loader) { concurrencyLevel = Math.min(builder.getConcurrencyLevel(), MAX_SEGMENTS); keyStrength = builder.getKeyStrength(); @@ -440,14 +442,14 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> STRONG { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new StrongEntry<>(key, hash, next); } }, STRONG_ACCESS { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new StrongAccessEntry<>(key, hash, next); } @@ -462,7 +464,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> STRONG_WRITE { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new StrongWriteEntry<>(key, hash, next); } @@ -477,7 +479,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> STRONG_ACCESS_WRITE { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new StrongAccessWriteEntry<>(key, hash, next); } @@ -493,14 +495,14 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> WEAK { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new WeakEntry<>(segment.keyReferenceQueue, key, hash, next); } }, WEAK_ACCESS { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new WeakAccessEntry<>(segment.keyReferenceQueue, key, hash, next); } @@ -515,7 +517,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> WEAK_WRITE { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new WeakWriteEntry<>(segment.keyReferenceQueue, key, hash, next); } @@ -530,7 +532,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> WEAK_ACCESS_WRITE { @Override <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return new WeakAccessWriteEntry<>(segment.keyReferenceQueue, key, hash, next); } @@ -580,7 +582,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * @param next entry in the same bucket */ abstract <K, V> ReferenceEntry<K, V> newEntry( - Segment<K, V> segment, K key, int hash, @NullableDecl ReferenceEntry<K, V> next); + Segment<K, V> segment, K key, int hash, @CheckForNull ReferenceEntry<K, V> next); /** * Copies an entry, assigning it a new {@code next} entry. @@ -622,7 +624,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> /** A reference to a value. */ interface ValueReference<K, V> { /** Returns the value. Does not block or throw exceptions. */ - @NullableDecl + @CheckForNull V get(); /** @@ -641,7 +643,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * Returns the entry associated with this value reference, or {@code null} if this value * reference is independent of any entry. */ - @NullableDecl + @CheckForNull ReferenceEntry<K, V> getEntry(); /** @@ -650,13 +652,13 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * <p>{@code value} may be null only for a loading reference. */ ValueReference<K, V> copyFor( - ReferenceQueue<V> queue, @NullableDecl V value, ReferenceEntry<K, V> entry); + ReferenceQueue<V> queue, @CheckForNull V value, ReferenceEntry<K, V> entry); /** * Notify pending loads that a new value was set. This is only relevant to loading value * references. */ - void notifyNewValue(@NullableDecl V newValue); + void notifyNewValue(@CheckForNull V newValue); /** * Returns true if a new value is currently loading, regardless of whether or not there is an @@ -696,7 +698,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> @Override public ValueReference<Object, Object> copyFor( ReferenceQueue<Object> queue, - @NullableDecl Object value, + @CheckForNull Object value, ReferenceEntry<Object, Object> entry) { return this; } @@ -939,7 +941,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> static class StrongEntry<K, V> extends AbstractReferenceEntry<K, V> { final K key; - StrongEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + StrongEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { this.key = key; this.hash = hash; this.next = next; @@ -953,7 +955,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> // The code below is exactly the same for each entry type. final int hash; - @NullableDecl final ReferenceEntry<K, V> next; + @CheckForNull final ReferenceEntry<K, V> next; volatile ValueReference<K, V> valueReference = unset(); @Override @@ -978,7 +980,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } static final class StrongAccessEntry<K, V> extends StrongEntry<K, V> { - StrongAccessEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + StrongAccessEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(key, hash, next); } @@ -1024,7 +1026,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } static final class StrongWriteEntry<K, V> extends StrongEntry<K, V> { - StrongWriteEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + StrongWriteEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(key, hash, next); } @@ -1070,7 +1072,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } static final class StrongAccessWriteEntry<K, V> extends StrongEntry<K, V> { - StrongAccessWriteEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + StrongAccessWriteEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(key, hash, next); } @@ -1157,7 +1159,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> /** Used for weakly-referenced keys. */ static class WeakEntry<K, V> extends WeakReference<K> implements ReferenceEntry<K, V> { - WeakEntry(ReferenceQueue<K> queue, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + WeakEntry(ReferenceQueue<K> queue, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(key, queue); this.hash = hash; this.next = next; @@ -1240,7 +1242,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> // The code below is exactly the same for each entry type. final int hash; - @NullableDecl final ReferenceEntry<K, V> next; + @CheckForNull final ReferenceEntry<K, V> next; volatile ValueReference<K, V> valueReference = unset(); @Override @@ -1266,7 +1268,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> static final class WeakAccessEntry<K, V> extends WeakEntry<K, V> { WeakAccessEntry( - ReferenceQueue<K> queue, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + ReferenceQueue<K> queue, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(queue, key, hash, next); } @@ -1313,7 +1315,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> static final class WeakWriteEntry<K, V> extends WeakEntry<K, V> { WeakWriteEntry( - ReferenceQueue<K> queue, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + ReferenceQueue<K> queue, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(queue, key, hash, next); } @@ -1360,7 +1362,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> static final class WeakAccessWriteEntry<K, V> extends WeakEntry<K, V> { WeakAccessWriteEntry( - ReferenceQueue<K> queue, K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + ReferenceQueue<K> queue, K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { super(queue, key, hash, next); } @@ -1664,7 +1666,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * This method is a convenience for testing. Code should call {@link Segment#newEntry} directly. */ @VisibleForTesting - ReferenceEntry<K, V> newEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + ReferenceEntry<K, V> newEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { Segment<K, V> segment = segmentFor(hash); segment.lock(); try { @@ -1695,7 +1697,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return valueStrength.referenceValue(segmentFor(hash), entry, checkNotNull(value), weight); } - int hash(@NullableDecl Object key) { + int hash(@CheckForNull Object key) { int h = keyEquivalence.hash(key); return rehash(h); } @@ -1742,7 +1744,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * cleanup stale entries. As such it should only be called outside of a segment context, such as * during iteration. */ - @NullableDecl + @CheckForNull V getLiveValue(ReferenceEntry<K, V> entry, long now) { if (entry.getKey() == null) { return null; @@ -1887,7 +1889,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> int threshold; /** The per-segment table. */ - @NullableDecl volatile AtomicReferenceArray<ReferenceEntry<K, V>> table; + @CheckForNull volatile AtomicReferenceArray<ReferenceEntry<K, V>> table; /** The maximum weight of this segment. UNSET_INT if there is no maximum. */ final long maxSegmentWeight; @@ -1896,13 +1898,13 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * The key reference queue contains entries whose keys have been garbage collected, and which * need to be cleaned up internally. */ - @NullableDecl final ReferenceQueue<K> keyReferenceQueue; + @CheckForNull final ReferenceQueue<K> keyReferenceQueue; /** * The value reference queue contains value references whose values have been garbage collected, * and which need to be cleaned up internally. */ - @NullableDecl final ReferenceQueue<V> valueReferenceQueue; + @CheckForNull final ReferenceQueue<V> valueReferenceQueue; /** * The recency queue is used to record which entries were accessed for updating the access @@ -1978,7 +1980,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @GuardedBy("this") - ReferenceEntry<K, V> newEntry(K key, int hash, @NullableDecl ReferenceEntry<K, V> next) { + ReferenceEntry<K, V> newEntry(K key, int hash, @CheckForNull ReferenceEntry<K, V> next) { return map.entryFactory.newEntry(this, checkNotNull(key), hash, next); } @@ -2058,7 +2060,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - @NullableDecl + @CheckForNull V get(Object key, int hash) { try { if (count != 0) { // read-volatile @@ -2269,7 +2271,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * {@code null} if another thread is performing the refresh or if an error occurs during * refresh. */ - @NullableDecl + @CheckForNull V refresh(K key, int hash, CacheLoader<? super K, V> loader, boolean checkTime) { final LoadingValueReference<K, V> loadingValueReference = insertLoadingValueReference(key, hash, checkTime); @@ -2292,7 +2294,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * Returns a newly inserted {@code LoadingValueReference}, or null if the live value reference * is already loading. */ - @NullableDecl + @CheckForNull LoadingValueReference<K, V> insertLoadingValueReference( final K key, final int hash, boolean checkTime) { ReferenceEntry<K, V> e = null; @@ -2522,7 +2524,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> @GuardedBy("this") void enqueueNotification( - @NullableDecl K key, int hash, @NullableDecl V value, int weight, RemovalCause cause) { + @CheckForNull K key, int hash, @CheckForNull V value, int weight, RemovalCause cause) { totalWeight -= weight; if (cause.wasEvicted()) { statsCounter.recordEviction(); @@ -2584,7 +2586,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> // Specialized implementations of map methods - @NullableDecl + @CheckForNull ReferenceEntry<K, V> getEntry(Object key, int hash) { for (ReferenceEntry<K, V> e = getFirst(hash); e != null; e = e.getNext()) { if (e.getHash() != hash) { @@ -2605,7 +2607,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return null; } - @NullableDecl + @CheckForNull ReferenceEntry<K, V> getLiveEntry(Object key, int hash, long now) { ReferenceEntry<K, V> e = getEntry(key, hash); if (e == null) { @@ -2686,7 +2688,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - @NullableDecl + @CheckForNull V put(K key, int hash, V value, boolean onlyIfAbsent) { lock(); try { @@ -2892,7 +2894,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - @NullableDecl + @CheckForNull V replace(K key, int hash, V newValue) { lock(); try { @@ -2947,7 +2949,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - @NullableDecl + @CheckForNull V remove(Object key, int hash) { lock(); try { @@ -3139,11 +3141,11 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @GuardedBy("this") - @NullableDecl + @CheckForNull ReferenceEntry<K, V> removeValueFromChain( ReferenceEntry<K, V> first, ReferenceEntry<K, V> entry, - @NullableDecl K key, + @CheckForNull K key, int hash, V value, ValueReference<K, V> valueReference, @@ -3161,7 +3163,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @GuardedBy("this") - @NullableDecl + @CheckForNull ReferenceEntry<K, V> removeEntryFromChain( ReferenceEntry<K, V> first, ReferenceEntry<K, V> entry) { int newCount = count; @@ -3415,7 +3417,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return oldValue.getWeight(); } - public boolean set(@NullableDecl V newValue) { + public boolean set(@CheckForNull V newValue) { return futureValue.set(newValue); } @@ -3428,7 +3430,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public void notifyNewValue(@NullableDecl V newValue) { + public void notifyNewValue(@CheckForNull V newValue) { if (newValue != null) { // The pending load was clobbered by a manual write. // Unblock all pending gets, and have them return the new value. @@ -3499,7 +3501,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> @Override public ValueReference<K, V> copyFor( - ReferenceQueue<V> queue, @NullableDecl V value, ReferenceEntry<K, V> entry) { + ReferenceQueue<V> queue, @CheckForNull V value, ReferenceEntry<K, V> entry) { return this; } } @@ -3839,8 +3841,8 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - @NullableDecl - public V get(@NullableDecl Object key) { + @CheckForNull + public V get(@CheckForNull Object key) { if (key == null) { return null; } @@ -3853,7 +3855,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return segmentFor(hash).get(key, hash, loader); } - @NullableDecl + @CheckForNull public V getIfPresent(Object key) { int hash = hash(checkNotNull(key)); V value = segmentFor(hash).get(key, hash); @@ -3866,8 +3868,8 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @SuppressWarnings("MissingOverride") // Supermethod will not exist if we build with --release 7. - @NullableDecl - public V getOrDefault(@NullableDecl Object key, @NullableDecl V defaultValue) { + @CheckForNull + public V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) { V result = get(key); return (result != null) ? result : defaultValue; } @@ -3880,7 +3882,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> int hits = 0; int misses = 0; - Map<K, V> result = Maps.newLinkedHashMap(); + ImmutableMap.Builder<K, V> result = ImmutableMap.builder(); for (Object key : keys) { V value = get(key); if (value == null) { @@ -3895,7 +3897,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } globalStatsCounter.recordHits(hits); globalStatsCounter.recordMisses(misses); - return ImmutableMap.copyOf(result); + return result.buildKeepingLast(); } ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException { @@ -3920,7 +3922,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> try { if (!keysToLoad.isEmpty()) { try { - Map<K, V> newEntries = loadAll(keysToLoad, defaultLoader); + Map<K, V> newEntries = loadAll(unmodifiableSet(keysToLoad), defaultLoader); for (K key : keysToLoad) { V value = newEntries.get(key); if (value == null) { @@ -3947,7 +3949,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * Returns the result of calling {@link CacheLoader#loadAll}, or null if {@code loader} doesn't * implement {@code loadAll}. */ - @NullableDecl + @CheckForNull Map<K, V> loadAll(Set<? extends K> keys, CacheLoader<? super K, V> loader) throws ExecutionException { checkNotNull(loader); @@ -4011,7 +4013,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> * Returns the internal entry for the specified key. The entry may be loading, expired, or * partially collected. */ - ReferenceEntry<K, V> getEntry(@NullableDecl Object key) { + ReferenceEntry<K, V> getEntry(@CheckForNull Object key) { // does not impact recency ordering if (key == null) { return null; @@ -4026,7 +4028,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public boolean containsKey(@NullableDecl Object key) { + public boolean containsKey(@CheckForNull Object key) { // does not impact recency ordering if (key == null) { return false; @@ -4036,7 +4038,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public boolean containsValue(@NullableDecl Object value) { + public boolean containsValue(@CheckForNull Object value) { // does not impact recency ordering if (value == null) { return false; @@ -4099,7 +4101,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public V remove(@NullableDecl Object key) { + public V remove(@CheckForNull Object key) { if (key == null) { return null; } @@ -4108,7 +4110,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public boolean remove(@NullableDecl Object key, @NullableDecl Object value) { + public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { if (key == null || value == null) { return false; } @@ -4117,7 +4119,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public boolean replace(K key, @NullableDecl V oldValue, V newValue) { + public boolean replace(K key, @CheckForNull V oldValue, V newValue) { checkNotNull(key); checkNotNull(newValue); if (oldValue == null) { @@ -4149,7 +4151,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - @RetainedWith @NullableDecl Set<K> keySet; + @RetainedWith @CheckForNull Set<K> keySet; @Override public Set<K> keySet() { @@ -4158,7 +4160,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return (ks != null) ? ks : (keySet = new KeySet()); } - @RetainedWith @NullableDecl Collection<V> values; + @RetainedWith @CheckForNull Collection<V> values; @Override public Collection<V> values() { @@ -4167,7 +4169,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> return (vs != null) ? vs : (values = new Values()); } - @RetainedWith @NullableDecl Set<Entry<K, V>> entrySet; + @RetainedWith @CheckForNull Set<Entry<K, V>> entrySet; @Override @GwtIncompatible // Not supported. @@ -4183,11 +4185,11 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> int nextSegmentIndex; int nextTableIndex; - @NullableDecl Segment<K, V> currentSegment; - @NullableDecl AtomicReferenceArray<ReferenceEntry<K, V>> currentTable; - @NullableDecl ReferenceEntry<K, V> nextEntry; - @NullableDecl WriteThroughEntry nextExternal; - @NullableDecl WriteThroughEntry lastReturned; + @CheckForNull Segment<K, V> currentSegment; + @CheckForNull AtomicReferenceArray<ReferenceEntry<K, V>> currentTable; + @CheckForNull ReferenceEntry<K, V> nextEntry; + @CheckForNull WriteThroughEntry nextExternal; + @CheckForNull WriteThroughEntry lastReturned; HashIterator() { nextSegmentIndex = segments.length - 1; @@ -4328,7 +4330,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public boolean equals(@NullableDecl Object object) { + public boolean equals(@CheckForNull Object object) { // Cannot use key and value equivalence if (object instanceof Entry) { Entry<?, ?> that = (Entry<?, ?>) object; @@ -4516,10 +4518,10 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> final Weigher<K, V> weigher; final int concurrencyLevel; final RemovalListener<? super K, ? super V> removalListener; - @NullableDecl final Ticker ticker; + @CheckForNull final Ticker ticker; final CacheLoader<? super K, V> loader; - @NullableDecl transient Cache<K, V> delegate; + @CheckForNull transient Cache<K, V> delegate; ManualSerializationProxy(LocalCache<K, V> cache) { this( @@ -4624,7 +4626,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> implements LoadingCache<K, V>, Serializable { private static final long serialVersionUID = 1; - @NullableDecl transient LoadingCache<K, V> autoDelegate; + @CheckForNull transient LoadingCache<K, V> autoDelegate; LoadingSerializationProxy(LocalCache<K, V> cache) { super(cache); @@ -4680,7 +4682,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> // Cache methods @Override - @NullableDecl + @CheckForNull public V getIfPresent(Object key) { return localCache.getIfPresent(key); } diff --git a/android/guava/src/com/google/common/cache/LongAddables.java b/android/guava/src/com/google/common/cache/LongAddables.java index b0f9e2b21..249c6e149 100644 --- a/android/guava/src/com/google/common/cache/LongAddables.java +++ b/android/guava/src/com/google/common/cache/LongAddables.java @@ -31,7 +31,8 @@ final class LongAddables { static { Supplier<LongAddable> supplier; try { - new LongAdder(); // trigger static initialization of the LongAdder class, which may fail + // trigger static initialization of the LongAdder class, which may fail + LongAdder unused = new LongAdder(); supplier = new Supplier<LongAddable>() { @Override diff --git a/android/guava/src/com/google/common/cache/ParametricNullness.java b/android/guava/src/com/google/common/cache/ParametricNullness.java index 19305a6f9..64682de55 100644 --- a/android/guava/src/com/google/common/cache/ParametricNullness.java +++ b/android/guava/src/com/google/common/cache/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/cache/RemovalListeners.java b/android/guava/src/com/google/common/cache/RemovalListeners.java index d0623e7e3..38edf3528 100644 --- a/android/guava/src/com/google/common/cache/RemovalListeners.java +++ b/android/guava/src/com/google/common/cache/RemovalListeners.java @@ -39,20 +39,10 @@ public final class RemovalListeners { * @param executor the executor with which removal notifications are asynchronously executed */ public static <K, V> RemovalListener<K, V> asynchronous( - final RemovalListener<K, V> listener, final Executor executor) { + RemovalListener<K, V> listener, Executor executor) { checkNotNull(listener); checkNotNull(executor); - return new RemovalListener<K, V>() { - @Override - public void onRemoval(final RemovalNotification<K, V> notification) { - executor.execute( - new Runnable() { - @Override - public void run() { - listener.onRemoval(notification); - } - }); - } - }; + return (RemovalNotification<K, V> notification) -> + executor.execute(() -> listener.onRemoval(notification)); } } diff --git a/android/guava/src/com/google/common/cache/RemovalNotification.java b/android/guava/src/com/google/common/cache/RemovalNotification.java index dab7fe533..b96fc5709 100644 --- a/android/guava/src/com/google/common/cache/RemovalNotification.java +++ b/android/guava/src/com/google/common/cache/RemovalNotification.java @@ -47,7 +47,7 @@ public final class RemovalNotification<K, V> */ public static <K, V> RemovalNotification<K, V> create( @CheckForNull K key, @CheckForNull V value, RemovalCause cause) { - return new RemovalNotification(key, value, cause); + return new RemovalNotification<>(key, value, cause); } private RemovalNotification(@CheckForNull K key, @CheckForNull V value, RemovalCause cause) { diff --git a/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java index fd4fce202..621e8f98a 100644 --- a/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java @@ -56,7 +56,7 @@ abstract class AbstractSortedMultiset<E extends @Nullable Object> extends Abstra @Override NavigableSet<E> createElementSet() { - return new SortedMultisets.NavigableElementSet<E>(this); + return new SortedMultisets.NavigableElementSet<>(this); } @Override diff --git a/android/guava/src/com/google/common/collect/ArrayListMultimap.java b/android/guava/src/com/google/common/collect/ArrayListMultimap.java index 33f4c7539..349f40770 100644 --- a/android/guava/src/com/google/common/collect/ArrayListMultimap.java +++ b/android/guava/src/com/google/common/collect/ArrayListMultimap.java @@ -53,8 +53,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedListMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/ArrayTable.java b/android/guava/src/com/google/common/collect/ArrayTable.java index ebc9fa06a..aa042877c 100644 --- a/android/guava/src/com/google/common/collect/ArrayTable.java +++ b/android/guava/src/com/google/common/collect/ArrayTable.java @@ -83,7 +83,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * thread that reads from another. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @since 10.0 diff --git a/android/guava/src/com/google/common/collect/CartesianList.java b/android/guava/src/com/google/common/collect/CartesianList.java index 475b3f2ec..4c31b1299 100644 --- a/android/guava/src/com/google/common/collect/CartesianList.java +++ b/android/guava/src/com/google/common/collect/CartesianList.java @@ -45,7 +45,7 @@ final class CartesianList<E> extends AbstractList<List<E>> implements RandomAcce } axesBuilder.add(copy); } - return new CartesianList<E>(axesBuilder.build()); + return new CartesianList<>(axesBuilder.build()); } CartesianList(ImmutableList<List<E>> axes) { @@ -112,7 +112,7 @@ final class CartesianList<E> extends AbstractList<List<E>> implements RandomAcce } @Override - public ImmutableList<E> get(final int index) { + public ImmutableList<E> get(int index) { checkElementIndex(index, size()); return new ImmutableList<E>() { diff --git a/android/guava/src/com/google/common/collect/Collections2.java b/android/guava/src/com/google/common/collect/Collections2.java index 1e651b50a..8d799d593 100644 --- a/android/guava/src/com/google/common/collect/Collections2.java +++ b/android/guava/src/com/google/common/collect/Collections2.java @@ -695,7 +695,8 @@ public final class Collections2 { return true; } - private static <E> ObjectCountHashMap<E> counts(Collection<E> collection) { + private static <E extends @Nullable Object> ObjectCountHashMap<E> counts( + Collection<E> collection) { ObjectCountHashMap<E> map = new ObjectCountHashMap<>(); for (E e : collection) { map.put(e, map.get(e) + 1); diff --git a/android/guava/src/com/google/common/collect/Comparators.java b/android/guava/src/com/google/common/collect/Comparators.java index 6a5670c7f..0c79a8c29 100644 --- a/android/guava/src/com/google/common/collect/Comparators.java +++ b/android/guava/src/com/google/common/collect/Comparators.java @@ -18,7 +18,6 @@ package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Comparator; import java.util.Iterator; @@ -39,7 +38,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @since 21.0 * @author Louis Wasserman */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class Comparators { @@ -121,7 +119,6 @@ public final class Comparators { * @throws ClassCastException if the parameters are not <i>mutually comparable</i>. * @since 30.0 */ - @Beta public static <T extends Comparable<? super T>> T min(T a, T b) { return (a.compareTo(b) <= 0) ? a : b; } @@ -141,7 +138,6 @@ public final class Comparators { * comparator. * @since 30.0 */ - @Beta @ParametricNullness public static <T extends @Nullable Object> T min( @ParametricNullness T a, @ParametricNullness T b, Comparator<T> comparator) { @@ -161,7 +157,6 @@ public final class Comparators { * @throws ClassCastException if the parameters are not <i>mutually comparable</i>. * @since 30.0 */ - @Beta public static <T extends Comparable<? super T>> T max(T a, T b) { return (a.compareTo(b) >= 0) ? a : b; } @@ -181,7 +176,6 @@ public final class Comparators { * comparator. * @since 30.0 */ - @Beta @ParametricNullness public static <T extends @Nullable Object> T max( @ParametricNullness T a, @ParametricNullness T b, Comparator<T> comparator) { diff --git a/android/guava/src/com/google/common/collect/ComparisonChain.java b/android/guava/src/com/google/common/collect/ComparisonChain.java index 32aeb4d4b..9c05205ec 100644 --- a/android/guava/src/com/google/common/collect/ComparisonChain.java +++ b/android/guava/src/com/google/common/collect/ComparisonChain.java @@ -49,7 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * the presence of expensive {@code compareTo} and {@code compare} implementations. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CommonObjectUtilitiesExplained#comparecompareto"> {@code + * "https://github.com/google/guava/wiki/CommonObjectUtilitiesExplained#comparecompareto">{@code * ComparisonChain}</a>. * * @author Mark Davis diff --git a/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index ab03eadd3..47248412b 100644 --- a/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -49,8 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@code Multiset} operations (exceptions where noted). Null elements are not supported. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Cliff L. Biffle * @author mike nonemacher @@ -88,7 +87,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme // TODO(schmoe): provide a way to use this class with other (possibly arbitrary) // ConcurrentMap implementors. One possibility is to extract most of this class into // an AbstractConcurrentMapMultiset. - return new ConcurrentHashMultiset<E>(new ConcurrentHashMap<E, AtomicInteger>()); + return new ConcurrentHashMultiset<>(new ConcurrentHashMap<E, AtomicInteger>()); } /** @@ -121,7 +120,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme */ @Beta public static <E> ConcurrentHashMultiset<E> create(ConcurrentMap<E, AtomicInteger> countMap) { - return new ConcurrentHashMultiset<E>(countMap); + return new ConcurrentHashMultiset<>(countMap); } @VisibleForTesting @@ -449,7 +448,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme @Override Set<E> createElementSet() { - final Set<E> delegate = countMap.keySet(); + Set<E> delegate = countMap.keySet(); return new ForwardingSet<E>() { @Override protected Set<E> delegate() { @@ -504,7 +503,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme Iterator<Entry<E>> entryIterator() { // AbstractIterator makes this fairly clean, but it doesn't support remove(). To support // remove(), we create an AbstractIterator, and then use ForwardingIterator to delegate to it. - final Iterator<Entry<E>> readOnlyIterator = + Iterator<Entry<E>> readOnlyIterator = new AbstractIterator<Entry<E>>() { private final Iterator<Map.Entry<E, AtomicInteger>> mapEntries = countMap.entrySet().iterator(); diff --git a/android/guava/src/com/google/common/collect/ContiguousSet.java b/android/guava/src/com/google/common/collect/ContiguousSet.java index cd7704261..b3e4889d7 100644 --- a/android/guava/src/com/google/common/collect/ContiguousSet.java +++ b/android/guava/src/com/google/common/collect/ContiguousSet.java @@ -242,7 +242,7 @@ public abstract class ContiguousSet<C extends Comparable> extends ImmutableSorte @Override @GwtIncompatible // NavigableSet ImmutableSortedSet<C> createDescendingSet() { - return new DescendingImmutableSortedSet<C>(this); + return new DescendingImmutableSortedSet<>(this); } /** Returns a short-hand representation of the contents such as {@code "[1..100]"}. */ diff --git a/android/guava/src/com/google/common/collect/Cut.java b/android/guava/src/com/google/common/collect/Cut.java index 4a8d4c7fc..21fe5ff2d 100644 --- a/android/guava/src/com/google/common/collect/Cut.java +++ b/android/guava/src/com/google/common/collect/Cut.java @@ -308,7 +308,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ } static <C extends Comparable> Cut<C> belowValue(C endpoint) { - return new BelowValue<C>(endpoint); + return new BelowValue<>(endpoint); } private static final class BelowValue<C extends Comparable> extends Cut<C> { @@ -392,7 +392,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ } static <C extends Comparable> Cut<C> aboveValue(C endpoint) { - return new AboveValue<C>(endpoint); + return new AboveValue<>(endpoint); } private static final class AboveValue<C extends Comparable> extends Cut<C> { diff --git a/android/guava/src/com/google/common/collect/DescendingMultiset.java b/android/guava/src/com/google/common/collect/DescendingMultiset.java index ec5a1d0e3..7db0fbbd4 100644 --- a/android/guava/src/com/google/common/collect/DescendingMultiset.java +++ b/android/guava/src/com/google/common/collect/DescendingMultiset.java @@ -54,7 +54,7 @@ abstract class DescendingMultiset<E extends @Nullable Object> extends Forwarding public NavigableSet<E> elementSet() { NavigableSet<E> result = elementSet; if (result == null) { - return elementSet = new SortedMultisets.NavigableElementSet<E>(this); + return elementSet = new SortedMultisets.NavigableElementSet<>(this); } return result; } diff --git a/android/guava/src/com/google/common/collect/DiscreteDomain.java b/android/guava/src/com/google/common/collect/DiscreteDomain.java index bce706222..222ebe528 100644 --- a/android/guava/src/com/google/common/collect/DiscreteDomain.java +++ b/android/guava/src/com/google/common/collect/DiscreteDomain.java @@ -37,7 +37,7 @@ import javax.annotation.CheckForNull; * represent partial domains such as "prime integers" or "strings of length 5." * * <p>See the Guava User Guide section on <a href= - * "https://github.com/google/guava/wiki/RangesExplained#discrete-domains"> {@code + * "https://github.com/google/guava/wiki/RangesExplained#discrete-domains">{@code * DiscreteDomain}</a>. * * @author Kevin Bourrillion diff --git a/android/guava/src/com/google/common/collect/EmptyContiguousSet.java b/android/guava/src/com/google/common/collect/EmptyContiguousSet.java index f4fe33cca..50d7b126a 100644 --- a/android/guava/src/com/google/common/collect/EmptyContiguousSet.java +++ b/android/guava/src/com/google/common/collect/EmptyContiguousSet.java @@ -150,7 +150,7 @@ final class EmptyContiguousSet<C extends Comparable> extends ContiguousSet<C> { } private Object readResolve() { - return new EmptyContiguousSet<C>(domain); + return new EmptyContiguousSet<>(domain); } private static final long serialVersionUID = 0; @@ -159,7 +159,7 @@ final class EmptyContiguousSet<C extends Comparable> extends ContiguousSet<C> { @GwtIncompatible // serialization @Override Object writeReplace() { - return new SerializedForm<C>(domain); + return new SerializedForm<>(domain); } @GwtIncompatible // NavigableSet diff --git a/android/guava/src/com/google/common/collect/EnumBiMap.java b/android/guava/src/com/google/common/collect/EnumBiMap.java index 82aa052d6..97d3c2e7c 100644 --- a/android/guava/src/com/google/common/collect/EnumBiMap.java +++ b/android/guava/src/com/google/common/collect/EnumBiMap.java @@ -32,7 +32,7 @@ import java.util.Map; * An {@code EnumBiMap} and its inverse are both serializable. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/EnumHashBiMap.java b/android/guava/src/com/google/common/collect/EnumHashBiMap.java index f68bc4c20..5fbbb70c6 100644 --- a/android/guava/src/com/google/common/collect/EnumHashBiMap.java +++ b/android/guava/src/com/google/common/collect/EnumHashBiMap.java @@ -36,7 +36,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * EnumHashBiMap} and its inverse are both serializable. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/EnumMultiset.java b/android/guava/src/com/google/common/collect/EnumMultiset.java index 0fed4ad06..57a3a873e 100644 --- a/android/guava/src/com/google/common/collect/EnumMultiset.java +++ b/android/guava/src/com/google/common/collect/EnumMultiset.java @@ -37,8 +37,7 @@ import javax.annotation.CheckForNull; * in O(1). * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/EvictingQueue.java b/android/guava/src/com/google/common/collect/EvictingQueue.java index 45f59f367..5667dfa8c 100644 --- a/android/guava/src/com/google/common/collect/EvictingQueue.java +++ b/android/guava/src/com/google/common/collect/EvictingQueue.java @@ -54,7 +54,7 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial private EvictingQueue(int maxSize) { checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize); - this.delegate = new ArrayDeque<E>(maxSize); + this.delegate = new ArrayDeque<>(maxSize); this.maxSize = maxSize; } @@ -65,7 +65,7 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial * queue. */ public static <E> EvictingQueue<E> create(int maxSize) { - return new EvictingQueue<E>(maxSize); + return new EvictingQueue<>(maxSize); } /** diff --git a/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java index 3ff00b71b..de946a215 100644 --- a/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java @@ -118,7 +118,7 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje } @Override - public Collection<V> get(@ParametricNullness final K key) { + public Collection<V> get(@ParametricNullness K key) { return filterCollection(unfiltered.get(key), new ValuePredicate(key)); } @@ -396,15 +396,11 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje return FilteredEntryMultimap.this.keySet().size(); } - private boolean removeEntriesIf(final Predicate<? super Multiset.Entry<K>> predicate) { + private boolean removeEntriesIf(Predicate<? super Multiset.Entry<K>> predicate) { return FilteredEntryMultimap.this.removeEntriesIf( - new Predicate<Map.Entry<K, Collection<V>>>() { - @Override - public boolean apply(Map.Entry<K, Collection<V>> entry) { - return predicate.apply( - Multisets.immutableEntry(entry.getKey(), entry.getValue().size())); - } - }); + (Map.Entry<K, Collection<V>> entry) -> + predicate.apply( + Multisets.immutableEntry(entry.getKey(), entry.getValue().size()))); } @Override diff --git a/android/guava/src/com/google/common/collect/GeneralRange.java b/android/guava/src/com/google/common/collect/GeneralRange.java index 20cf4fbfc..3d7256ff8 100644 --- a/android/guava/src/com/google/common/collect/GeneralRange.java +++ b/android/guava/src/com/google/common/collect/GeneralRange.java @@ -46,7 +46,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { T upperEndpoint = range.hasUpperBound() ? range.upperEndpoint() : null; BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : OPEN; - return new GeneralRange<T>( + return new GeneralRange<>( Ordering.natural(), range.hasLowerBound(), lowerEndpoint, @@ -58,7 +58,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { /** Returns the whole range relative to the specified comparator. */ static <T extends @Nullable Object> GeneralRange<T> all(Comparator<? super T> comparator) { - return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN); + return new GeneralRange<>(comparator, false, null, OPEN, false, null, OPEN); } /** @@ -67,7 +67,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { */ static <T extends @Nullable Object> GeneralRange<T> downTo( Comparator<? super T> comparator, @ParametricNullness T endpoint, BoundType boundType) { - return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN); + return new GeneralRange<>(comparator, true, endpoint, boundType, false, null, OPEN); } /** @@ -76,7 +76,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { */ static <T extends @Nullable Object> GeneralRange<T> upTo( Comparator<? super T> comparator, @ParametricNullness T endpoint, BoundType boundType) { - return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType); + return new GeneralRange<>(comparator, false, null, OPEN, true, endpoint, boundType); } /** @@ -89,7 +89,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { BoundType lowerType, @ParametricNullness T upper, BoundType upperType) { - return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType); + return new GeneralRange<>(comparator, true, lower, lowerType, true, upper, upperType); } private final Comparator<? super T> comparator; @@ -138,7 +138,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { checkArgument( cmp <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", lowerEndpoint, upperEndpoint); if (cmp == 0) { - checkArgument(lowerBoundType != OPEN | upperBoundType != OPEN); + checkArgument(lowerBoundType != OPEN || upperBoundType != OPEN); } } } @@ -233,7 +233,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { } } - return new GeneralRange<T>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType); + return new GeneralRange<>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType); } @Override @@ -268,7 +268,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { GeneralRange<T> result = reverse; if (result == null) { result = - new GeneralRange<T>( + new GeneralRange<>( Ordering.from(comparator).reverse(), hasUpperBound, getUpperEndpoint(), diff --git a/android/guava/src/com/google/common/collect/HashBasedTable.java b/android/guava/src/com/google/common/collect/HashBasedTable.java index c8ba50fd1..21882e62d 100644 --- a/android/guava/src/com/google/common/collect/HashBasedTable.java +++ b/android/guava/src/com/google/common/collect/HashBasedTable.java @@ -41,7 +41,7 @@ import java.util.Map; * concurrently and one of the threads modifies the table, it must be synchronized externally. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @since 7.0 diff --git a/android/guava/src/com/google/common/collect/HashBiMap.java b/android/guava/src/com/google/common/collect/HashBiMap.java index 010f73cb3..8639cb071 100644 --- a/android/guava/src/com/google/common/collect/HashBiMap.java +++ b/android/guava/src/com/google/common/collect/HashBiMap.java @@ -46,7 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * <p>This implementation guarantees insertion-based iteration order of its keys. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap} </a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap} </a>. * * @author Louis Wasserman * @author Mike Bostock diff --git a/android/guava/src/com/google/common/collect/ImmutableBiMap.java b/android/guava/src/com/google/common/collect/ImmutableBiMap.java index bbae03613..1de5bd10f 100644 --- a/android/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -448,10 +448,30 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableMap<K, V> implements if (size == 0) { return of(); } - sortEntries(); + if (valueComparator != null) { + if (entriesUsed) { + alternatingKeysAndValues = Arrays.copyOf(alternatingKeysAndValues, 2 * size); + } + sortEntries(alternatingKeysAndValues, size, valueComparator); + } entriesUsed = true; return new RegularImmutableBiMap<K, V>(alternatingKeysAndValues, size); } + + /** + * Throws {@link UnsupportedOperationException}. This method is inherited from {@link + * ImmutableMap.Builder}, but it does not make sense for bimaps. + * + * @throws UnsupportedOperationException always + * @deprecated This method does not make sense for bimaps and should not be called. + * @since 31.1 + */ + @DoNotCall + @Deprecated + @Override + public ImmutableBiMap<K, V> buildKeepingLast() { + throw new UnsupportedOperationException("Not supported for bimaps"); + } } /** diff --git a/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index aeabe5d3a..c59e9fdab 100644 --- a/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -62,7 +62,7 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? */ public static <B, T extends B> ImmutableClassToInstanceMap<B> of(Class<T> type, T value) { ImmutableMap<Class<? extends B>, B> map = ImmutableMap.<Class<? extends B>, B>of(type, value); - return new ImmutableClassToInstanceMap<B>(map); + return new ImmutableClassToInstanceMap<>(map); } /** @@ -70,7 +70,7 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? * Builder} constructor. */ public static <B> Builder<B> builder() { - return new Builder<B>(); + return new Builder<>(); } /** @@ -131,11 +131,11 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? * @throws IllegalArgumentException if duplicate keys were added */ public ImmutableClassToInstanceMap<B> build() { - ImmutableMap<Class<? extends B>, B> map = mapBuilder.build(); + ImmutableMap<Class<? extends B>, B> map = mapBuilder.buildOrThrow(); if (map.isEmpty()) { return of(); } else { - return new ImmutableClassToInstanceMap<B>(map); + return new ImmutableClassToInstanceMap<>(map); } } } diff --git a/android/guava/src/com/google/common/collect/ImmutableCollection.java b/android/guava/src/com/google/common/collect/ImmutableCollection.java index b5ac2a14c..d5420e040 100644 --- a/android/guava/src/com/google/common/collect/ImmutableCollection.java +++ b/android/guava/src/com/google/common/collect/ImmutableCollection.java @@ -156,7 +156,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * <h3>See also</h3> * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @since 2.0 */ diff --git a/android/guava/src/com/google/common/collect/ImmutableList.java b/android/guava/src/com/google/common/collect/ImmutableList.java index 6ebd7335a..e336424f6 100644 --- a/android/guava/src/com/google/common/collect/ImmutableList.java +++ b/android/guava/src/com/google/common/collect/ImmutableList.java @@ -48,7 +48,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @see ImmutableMap * @see ImmutableSet diff --git a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java index cc0a91005..20408db80 100644 --- a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -39,7 +39,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * detailed at {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @since 2.0 @@ -301,7 +301,7 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> } } - return new ImmutableListMultimap<>(builder.build(), size); + return new ImmutableListMultimap<>(builder.buildOrThrow(), size); } ImmutableListMultimap(ImmutableMap<K, ImmutableList<V>> map, int size) { @@ -414,7 +414,7 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> ImmutableMap<Object, ImmutableList<Object>> tmpMap; try { - tmpMap = builder.build(); + tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { throw (InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e); } diff --git a/android/guava/src/com/google/common/collect/ImmutableMap.java b/android/guava/src/com/google/common/collect/ImmutableMap.java index fd87e0b0d..1746ae0b4 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMap.java @@ -33,12 +33,15 @@ import com.google.j2objc.annotations.WeakOuter; import java.io.Serializable; import java.util.AbstractMap; import java.util.Arrays; +import java.util.BitSet; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.SortedMap; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -48,7 +51,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jesse Wilson * @author Kevin Bourrillion @@ -337,7 +340,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } static void checkNoConflict( - boolean safe, String conflictDescription, Entry<?, ?> entry1, Entry<?, ?> entry2) { + boolean safe, String conflictDescription, Object entry1, Object entry2) { if (!safe) { throw conflictException(conflictDescription, entry1, entry2); } @@ -384,6 +387,11 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { @Nullable Object[] alternatingKeysAndValues; int size; boolean entriesUsed; + /** + * If non-null, a duplicate key we found in a previous buildKeepingLast() or buildOrThrow() + * call. A later buildOrThrow() can simply report this duplicate immediately. + */ + @Nullable DuplicateKey duplicateKey; /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link @@ -412,8 +420,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, - * and will cause {@link #build} to fail. + * Associates {@code key} with {@code value} in the built map. If the same key is put more than + * once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep the last + * value put for that key. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { @@ -426,8 +435,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Adds the given {@code entry} to the map, making it immutable if necessary. Duplicate keys are - * not allowed, and will cause {@link #build} to fail. + * Adds the given {@code entry} to the map, making it immutable if necessary. If the same key is + * put more than once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will + * keep the last value put for that key. * * @since 11.0 */ @@ -437,8 +447,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Associates all of the given map's keys and values in the built map. Duplicate keys are not - * allowed, and will cause {@link #build} to fail. + * Associates all of the given map's keys and values in the built map. If the same key is put + * more than once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep + * the last value put for that key. * * @throws NullPointerException if any key or value in {@code map} is null */ @@ -448,8 +459,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Adds all of the given entries to the built map. Duplicate keys are not allowed, and will - * cause {@link #build} to fail. + * Adds all of the given entries to the built map. If the same key is put more than once, {@link + * #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep the last value put for + * that key. * * @throws NullPointerException if any key, value, or entry is null * @since 19.0 @@ -498,10 +510,46 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { return this; } - /* - * TODO(kevinb): Should build() and the ImmutableBiMap & ImmutableSortedMap - * versions throw an IllegalStateException instead? - */ + private ImmutableMap<K, V> build(boolean throwIfDuplicateKeys) { + if (throwIfDuplicateKeys && duplicateKey != null) { + throw duplicateKey.exception(); + } + /* + * If entries is full, then this implementation may end up using the entries array + * directly and writing over the entry objects with non-terminal entries, but this is + * safe; if this Builder is used further, it will grow the entries array (so it can't + * affect the original array), and future build() calls will always copy any entry + * objects that cannot be safely reused. + */ + // localAlternatingKeysAndValues is an alias for the alternatingKeysAndValues field, except if + // we end up removing duplicates in a copy of the array. + @Nullable Object[] localAlternatingKeysAndValues; + int localSize = size; + if (valueComparator == null) { + localAlternatingKeysAndValues = alternatingKeysAndValues; + } else { + if (entriesUsed) { + alternatingKeysAndValues = Arrays.copyOf(alternatingKeysAndValues, 2 * size); + } + localAlternatingKeysAndValues = alternatingKeysAndValues; + if (!throwIfDuplicateKeys) { + // We want to retain only the last-put value for any given key, before sorting. + // This could be improved, but orderEntriesByValue is rather rarely used anyway. + localAlternatingKeysAndValues = lastEntryForEachKey(localAlternatingKeysAndValues, size); + if (localAlternatingKeysAndValues.length < alternatingKeysAndValues.length) { + localSize = localAlternatingKeysAndValues.length >>> 1; + } + } + sortEntries(localAlternatingKeysAndValues, localSize, valueComparator); + } + entriesUsed = true; + ImmutableMap<K, V> map = + RegularImmutableMap.create(localSize, localAlternatingKeysAndValues, this); + if (throwIfDuplicateKeys && duplicateKey != null) { + throw duplicateKey.exception(); + } + return map; + } /** * Returns a newly-created immutable map. The iteration order of the returned map is the order @@ -527,40 +575,92 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { * @throws IllegalArgumentException if duplicate keys were added * @since 31.0 */ - @SuppressWarnings("unchecked") public ImmutableMap<K, V> buildOrThrow() { - /* - * If entries is full, then this implementation may end up using the entries array - * directly and writing over the entry objects with non-terminal entries, but this is - * safe; if this Builder is used further, it will grow the entries array (so it can't - * affect the original array), and future build() calls will always copy any entry - * objects that cannot be safely reused. - */ - sortEntries(); - entriesUsed = true; - return RegularImmutableMap.create(size, alternatingKeysAndValues); + return build(true); } - void sortEntries() { - if (valueComparator != null) { - if (entriesUsed) { - alternatingKeysAndValues = Arrays.copyOf(alternatingKeysAndValues, 2 * size); - } - Entry<K, V>[] entries = new Entry[size]; - for (int i = 0; i < size; i++) { - // requireNonNull is safe because the first `2*size` elements have been filled in. - entries[i] = - new AbstractMap.SimpleImmutableEntry<K, V>( - (K) requireNonNull(alternatingKeysAndValues[2 * i]), - (V) requireNonNull(alternatingKeysAndValues[2 * i + 1])); + /** + * Returns a newly-created immutable map, using the last value for any key that was added more + * than once. The iteration order of the returned map is the order in which entries were + * inserted into the builder, unless {@link #orderEntriesByValue} was called, in which case + * entries are sorted by value. If a key was added more than once, it appears in iteration order + * based on the first time it was added, again unless {@link #orderEntriesByValue} was called. + * + * <p>In the current implementation, all values associated with a given key are stored in the + * {@code Builder} object, even though only one of them will be used in the built map. If there + * can be many repeated keys, it may be more space-efficient to use a {@link + * java.util.LinkedHashMap LinkedHashMap} and {@link ImmutableMap#copyOf(Map)} rather than + * {@code ImmutableMap.Builder}. + * + * @since 31.1 + */ + public ImmutableMap<K, V> buildKeepingLast() { + return build(false); + } + + static <V> void sortEntries( + @Nullable Object[] alternatingKeysAndValues, + int size, + Comparator<? super V> valueComparator) { + @SuppressWarnings({"rawtypes", "unchecked"}) + Entry<Object, V>[] entries = new Entry[size]; + for (int i = 0; i < size; i++) { + // requireNonNull is safe because the first `2*size` elements have been filled in. + Object key = requireNonNull(alternatingKeysAndValues[2 * i]); + @SuppressWarnings("unchecked") + V value = (V) requireNonNull(alternatingKeysAndValues[2 * i + 1]); + entries[i] = new AbstractMap.SimpleImmutableEntry<Object, V>(key, value); + } + Arrays.sort( + entries, 0, size, Ordering.from(valueComparator).onResultOf(Maps.<V>valueFunction())); + for (int i = 0; i < size; i++) { + alternatingKeysAndValues[2 * i] = entries[i].getKey(); + alternatingKeysAndValues[2 * i + 1] = entries[i].getValue(); + } + } + + private @Nullable Object[] lastEntryForEachKey( + @Nullable Object[] localAlternatingKeysAndValues, int size) { + Set<Object> seenKeys = new HashSet<>(); + BitSet dups = new BitSet(); // slots that are overridden by a later duplicate key + for (int i = size - 1; i >= 0; i--) { + Object key = requireNonNull(localAlternatingKeysAndValues[2 * i]); + if (!seenKeys.add(key)) { + dups.set(i); } - Arrays.sort( - entries, 0, size, Ordering.from(valueComparator).onResultOf(Maps.<V>valueFunction())); - for (int i = 0; i < size; i++) { - alternatingKeysAndValues[2 * i] = entries[i].getKey(); - alternatingKeysAndValues[2 * i + 1] = entries[i].getValue(); + } + if (dups.isEmpty()) { + return localAlternatingKeysAndValues; + } + Object[] newAlternatingKeysAndValues = new Object[(size - dups.cardinality()) * 2]; + for (int inI = 0, outI = 0; inI < size * 2; ) { + if (dups.get(inI >>> 1)) { + inI += 2; + } else { + newAlternatingKeysAndValues[outI++] = + requireNonNull(localAlternatingKeysAndValues[inI++]); + newAlternatingKeysAndValues[outI++] = + requireNonNull(localAlternatingKeysAndValues[inI++]); } } + return newAlternatingKeysAndValues; + } + + static final class DuplicateKey { + private final Object key; + private final Object value1; + private final Object value2; + + DuplicateKey(Object key, Object value1, Object value2) { + this.key = key; + this.value1 = value1; + this.value2 = value2; + } + + IllegalArgumentException exception() { + return new IllegalArgumentException( + "Multiple entries with same key: " + key + "=" + value1 + " and " + key + "=" + value2); + } } } @@ -730,6 +830,31 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { // @Override under Java 8 / API Level 24 @CheckForNull public final V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) { + /* + * Even though it's weird to pass a defaultValue that is null, some callers do so. Those who + * pass a literal "null" should probably just use `get`, but I would expect other callers to + * pass an expression that *might* be null. This could happen with: + * + * - a `getFooOrDefault(@CheckForNull Foo defaultValue)` method that returns + * `map.getOrDefault(FOO_KEY, defaultValue)` + * + * - a call that consults a chain of maps, as in `mapA.getOrDefault(key, mapB.getOrDefault(key, + * ...))` + * + * So it makes sense for the parameter (and thus the return type) to be @CheckForNull. + * + * Two other points: + * + * 1. We'll want to use something like @PolyNull once we can make that work for the various + * platforms we target. + * + * 2. Kotlin's Map type has a getOrDefault method that accepts and returns a "plain V," in + * contrast to the "V?" type that we're using. As a result, Kotlin sees a conflict between the + * nullness annotations in ImmutableMap and those in its own Map type. In response, it considers + * the parameter and return type both to be platform types. As a result, Kotlin permits calls + * that can lead to NullPointerException. That's unfortunate. But hopefully most Kotlin callers + * use `get(key) ?: defaultValue` instead of this method, anyway. + */ V result = get(key); // TODO(b/192579700): Use a ternary once it no longer confuses our nullness checker. if (result != null) { @@ -969,7 +1094,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { builder.put(keyIter.next(), valueIter.next()); } - return builder.build(); + return builder.buildOrThrow(); } @SuppressWarnings("unchecked") @@ -982,7 +1107,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { for (int i = 0; i < keys.length; i++) { builder.put(keys[i], values[i]); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/android/guava/src/com/google/common/collect/ImmutableMultimap.java b/android/guava/src/com/google/common/collect/ImmutableMultimap.java index 04a6c4a41..fa1f3a4c2 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultimap.java @@ -62,7 +62,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * immediately after the last entry having that key. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/ImmutableMultiset.java b/android/guava/src/com/google/common/collect/ImmutableMultiset.java index d7febe2c6..ab281d4b3 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -31,6 +31,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.Set; import javax.annotation.CheckForNull; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A {@link Multiset} whose contents will never change, with many other important properties @@ -41,7 +42,7 @@ import javax.annotation.CheckForNull; * element when the multiset was created. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman @@ -282,7 +283,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa @GwtIncompatible // not present in emulated superclass @Override - int copyIntoArray(Object[] dst, int offset) { + int copyIntoArray(@Nullable Object[] dst, int offset) { for (Multiset.Entry<E> entry : entrySet()) { Arrays.fill(dst, offset, offset + entry.getCount(), entry.getElement()); offset += entry.getCount(); diff --git a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 18cb2efa3..1f655e27a 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -47,7 +47,7 @@ import javax.annotation.CheckForNull; * Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Mike Ward * @since 2.0 @@ -343,7 +343,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> } } - return new ImmutableSetMultimap<>(builder.build(), size, valueComparator); + return new ImmutableSetMultimap<>(builder.buildOrThrow(), size, valueComparator); } /** @@ -549,7 +549,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> ImmutableMap<Object, ImmutableSet<Object>> tmpMap; try { - tmpMap = builder.build(); + tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { throw (InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e); } diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java index ac5f0bcef..709504eb2 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -47,7 +47,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman @@ -742,6 +742,24 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride ImmutableList.<V>asImmutableList(sortedValues)); } } + + /** + * Throws UnsupportedOperationException. A future version may support this operation. Then the + * value for any given key will be the one that was last supplied in a {@code put} operation for + * that key. + * + * @throws UnsupportedOperationException always + * @since 31.1 + * @deprecated This method is not currently implemented, and may never be. + */ + @DoNotCall + @Deprecated + @Override + public final ImmutableSortedMap<K, V> buildKeepingLast() { + // TODO(emcmanus): implement + throw new UnsupportedOperationException( + "ImmutableSortedMap.Builder does not yet implement buildKeepingLast()"); + } } private final transient RegularImmutableSortedSet<K> keySet; diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index 5a7529e6c..2889a50cc 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -43,7 +43,7 @@ import javax.annotation.CheckForNull; * collection will not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Louis Wasserman * @since 12.0 diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java index fabf599f1..a21227deb 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -49,7 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * collection will not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/android/guava/src/com/google/common/collect/ImmutableTable.java b/android/guava/src/com/google/common/collect/ImmutableTable.java index 9dcb50c85..224df09c5 100644 --- a/android/guava/src/com/google/common/collect/ImmutableTable.java +++ b/android/guava/src/com/google/common/collect/ImmutableTable.java @@ -35,7 +35,7 @@ import javax.annotation.CheckForNull; * at {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Gregory Kick * @since 11.0 diff --git a/android/guava/src/com/google/common/collect/Interners.java b/android/guava/src/com/google/common/collect/Interners.java index a3ae37496..10ae27463 100644 --- a/android/guava/src/com/google/common/collect/Interners.java +++ b/android/guava/src/com/google/common/collect/Interners.java @@ -81,7 +81,7 @@ public final class Interners { if (!strong) { mapMaker.weakKeys(); } - return new InternerImpl<E>(mapMaker); + return new InternerImpl<>(mapMaker); } } @@ -158,7 +158,7 @@ public final class Interners { * @since 8.0 */ public static <E> Function<E, E> asFunction(Interner<E> interner) { - return new InternerFunction<E>(checkNotNull(interner)); + return new InternerFunction<>(checkNotNull(interner)); } private static class InternerFunction<E> implements Function<E, E> { diff --git a/android/guava/src/com/google/common/collect/Iterables.java b/android/guava/src/com/google/common/collect/Iterables.java index 2b4edb246..08f8d45a1 100644 --- a/android/guava/src/com/google/common/collect/Iterables.java +++ b/android/guava/src/com/google/common/collect/Iterables.java @@ -54,7 +54,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * absolutely necessary. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables">{@code * Iterables}</a>. * * @author Kevin Bourrillion @@ -549,6 +549,10 @@ public final class Iterables { * <p>Iterators returned by the returned iterable do not support the {@link Iterator#remove()} * method. The returned lists implement {@link RandomAccess}, whether or not the input list does. * + * <p><b>Note:</b> The current implementation eagerly allocates storage for {@code size} elements. + * As a consequence, passing values like {@code Integer.MAX_VALUE} can lead to {@link + * OutOfMemoryError}. + * * <p><b>Note:</b> if {@code iterable} is a {@link List}, use {@link Lists#partition(List, int)} * instead. * diff --git a/android/guava/src/com/google/common/collect/Iterators.java b/android/guava/src/com/google/common/collect/Iterators.java index 5ea2da9da..2f9fd3b4a 100644 --- a/android/guava/src/com/google/common/collect/Iterators.java +++ b/android/guava/src/com/google/common/collect/Iterators.java @@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * necessary. * * <p>See the Guava User Guide section on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables">{@code * Iterators}</a>. * * @author Kevin Bourrillion @@ -127,7 +127,7 @@ public final class Iterators { /** Returns an unmodifiable view of {@code iterator}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> unmodifiableIterator( - final Iterator<? extends T> iterator) { + Iterator<? extends T> iterator) { checkNotNull(iterator); if (iterator instanceof UnmodifiableIterator) { @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe @@ -397,7 +397,7 @@ public final class Iterators { * should use an explicit {@code break} or be certain that you will eventually remove all the * elements. */ - public static <T extends @Nullable Object> Iterator<T> cycle(final Iterable<T> iterable) { + public static <T extends @Nullable Object> Iterator<T> cycle(Iterable<T> iterable) { checkNotNull(iterable); return new Iterator<T>() { Iterator<T> iterator = emptyModifiableIterator(); @@ -462,8 +462,7 @@ public final class Iterators { * * <p>This is mainly just to avoid the intermediate ArrayDeque in ConsumingQueueIterator. */ - private static <I extends Iterator<?>> Iterator<I> consumingForArray( - final @Nullable I... elements) { + private static <I extends Iterator<?>> Iterator<I> consumingForArray(@Nullable I... elements) { return new UnmodifiableIterator<I>() { int index = 0; @@ -566,7 +565,7 @@ public final class Iterators { */ public static <T extends @Nullable Object> Iterator<T> concat( Iterator<? extends Iterator<? extends T>> inputs) { - return new ConcatenatedIterator<T>(inputs); + return new ConcatenatedIterator<>(inputs); } /** Concats a varargs array of iterators without making a defensive copy of the array. */ @@ -586,6 +585,10 @@ public final class Iterators { * * <p>The returned lists implement {@link java.util.RandomAccess}. * + * <p><b>Note:</b> The current implementation eagerly allocates storage for {@code size} elements. + * As a consequence, passing values like {@code Integer.MAX_VALUE} can lead to {@link + * OutOfMemoryError}. + * * @param iterator the iterator to return a partitioned view of * @param size the desired size of each partition (the last may be smaller) * @return an iterator of immutable lists containing the elements of {@code iterator} divided into @@ -617,7 +620,7 @@ public final class Iterators { } private static <T extends @Nullable Object> UnmodifiableIterator<List<@Nullable T>> partitionImpl( - final Iterator<T> iterator, final int size, final boolean pad) { + Iterator<T> iterator, int size, boolean pad) { checkNotNull(iterator); checkArgument(size > 0); return new UnmodifiableIterator<List<@Nullable T>>() { @@ -658,7 +661,7 @@ public final class Iterators { * {@code retainIfTrue}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> filter( - final Iterator<T> unfiltered, final Predicate<? super T> retainIfTrue) { + Iterator<T> unfiltered, Predicate<? super T> retainIfTrue) { checkNotNull(unfiltered); checkNotNull(retainIfTrue); return new AbstractIterator<T>() { @@ -817,7 +820,7 @@ public final class Iterators { * element. */ public static <F extends @Nullable Object, T extends @Nullable Object> Iterator<T> transform( - final Iterator<F> fromIterator, final Function<? super F, ? extends T> function) { + Iterator<F> fromIterator, Function<? super F, ? extends T> function) { checkNotNull(function); return new TransformedIterator<F, T>(fromIterator) { @ParametricNullness @@ -952,7 +955,7 @@ public final class Iterators { * @since 3.0 */ public static <T extends @Nullable Object> Iterator<T> limit( - final Iterator<T> iterator, final int limitSize) { + Iterator<T> iterator, int limitSize) { checkNotNull(iterator); checkArgument(limitSize >= 0, "limit is negative"); return new Iterator<T>() { @@ -991,8 +994,7 @@ public final class Iterators { * @return an iterator that removes and returns elements from the supplied iterator * @since 2.0 */ - public static <T extends @Nullable Object> Iterator<T> consumingIterator( - final Iterator<T> iterator) { + public static <T extends @Nullable Object> Iterator<T> consumingIterator(Iterator<T> iterator) { checkNotNull(iterator); return new UnmodifiableIterator<T>() { @Override @@ -1052,7 +1054,7 @@ public final class Iterators { * {@link ImmutableList#copyOf(Object[])}}, or {@link ImmutableList#of}. */ @SafeVarargs - public static <T extends @Nullable Object> UnmodifiableIterator<T> forArray(final T... array) { + public static <T extends @Nullable Object> UnmodifiableIterator<T> forArray(T... array) { return forArray(array, 0, array.length, 0); } @@ -1064,7 +1066,7 @@ public final class Iterators { * Arrays.asList(array).subList(offset, offset + length).listIterator(index)}. */ static <T extends @Nullable Object> UnmodifiableListIterator<T> forArray( - final T[] array, final int offset, int length, int index) { + T[] array, int offset, int length, int index) { checkArgument(length >= 0); int end = offset + length; @@ -1074,7 +1076,7 @@ public final class Iterators { if (length == 0) { return emptyListIterator(); } - return new ArrayItr<T>(array, offset, length, index); + return new ArrayItr<>(array, offset, length, index); } private static final class ArrayItr<T extends @Nullable Object> @@ -1103,7 +1105,7 @@ public final class Iterators { * <p>The {@link Iterable} equivalent of this method is {@link Collections#singleton}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> singletonIterator( - @ParametricNullness final T value) { + @ParametricNullness T value) { return new UnmodifiableIterator<T>() { boolean done; @@ -1135,7 +1137,7 @@ public final class Iterators { * return an {@code UnmodifiableIterator} instead of a plain {@code Iterator}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> forEnumeration( - final Enumeration<T> enumeration) { + Enumeration<T> enumeration) { checkNotNull(enumeration); return new UnmodifiableIterator<T>() { @Override @@ -1157,8 +1159,7 @@ public final class Iterators { * <p>The {@code Iterable} equivalent of this method is either {@link Collections#enumeration} (if * you have a {@link Collection}), or {@code Iterators.asEnumeration(collection.iterator())}. */ - public static <T extends @Nullable Object> Enumeration<T> asEnumeration( - final Iterator<T> iterator) { + public static <T extends @Nullable Object> Enumeration<T> asEnumeration(Iterator<T> iterator) { checkNotNull(iterator); return new Enumeration<T>() { @Override @@ -1266,7 +1267,7 @@ public final class Iterators { PeekingImpl<T> peeking = (PeekingImpl<T>) iterator; return peeking; } - return new PeekingImpl<T>(iterator); + return new PeekingImpl<>(iterator); } /** @@ -1299,7 +1300,7 @@ public final class Iterators { checkNotNull(iterators, "iterators"); checkNotNull(comparator, "comparator"); - return new MergingIterator<T>(iterators, comparator); + return new MergingIterator<>(iterators, comparator); } /** @@ -1315,17 +1316,12 @@ public final class Iterators { final Queue<PeekingIterator<T>> queue; public MergingIterator( - Iterable<? extends Iterator<? extends T>> iterators, - final Comparator<? super T> itemComparator) { + Iterable<? extends Iterator<? extends T>> iterators, Comparator<? super T> itemComparator) { // A comparator that's used by the heap, allowing the heap // to be sorted based on the top of each iterator. Comparator<PeekingIterator<T>> heapComparator = - new Comparator<PeekingIterator<T>>() { - @Override - public int compare(PeekingIterator<T> o1, PeekingIterator<T> o2) { - return itemComparator.compare(o1.peek(), o2.peek()); - } - }; + (PeekingIterator<T> o1, PeekingIterator<T> o2) -> + itemComparator.compare(o1.peek(), o2.peek()); queue = new PriorityQueue<>(2, heapComparator); diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultimap.java b/android/guava/src/com/google/common/collect/LinkedHashMultimap.java index b0f1302f6..11cddc383 100644 --- a/android/guava/src/com/google/common/collect/LinkedHashMultimap.java +++ b/android/guava/src/com/google/common/collect/LinkedHashMultimap.java @@ -72,8 +72,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java index 963078680..97595a9e0 100644 --- a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java +++ b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java @@ -27,8 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * element will appear at the end of the iteration. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Kevin Bourrillion * @author Jared Levy diff --git a/android/guava/src/com/google/common/collect/LinkedListMultimap.java b/android/guava/src/com/google/common/collect/LinkedListMultimap.java index 31874b2d3..338c54742 100644 --- a/android/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/android/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -88,8 +88,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedListMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/ListMultimap.java b/android/guava/src/com/google/common/collect/ListMultimap.java index 168606840..29e58077c 100644 --- a/android/guava/src/com/google/common/collect/ListMultimap.java +++ b/android/guava/src/com/google/common/collect/ListMultimap.java @@ -34,8 +34,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link #asMap} has {@code List} values. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/Lists.java b/android/guava/src/com/google/common/collect/Lists.java index a5839505c..34fc2258c 100644 --- a/android/guava/src/com/google/common/collect/Lists.java +++ b/android/guava/src/com/google/common/collect/Lists.java @@ -56,7 +56,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link Sets}, {@link Maps} and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#lists"> {@code Lists}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#lists">{@code Lists}</a>. * * @author Kevin Bourrillion * @author Mike Bostock @@ -75,9 +75,9 @@ public final class Lists { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableList#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code ArrayList} {@linkplain ArrayList#ArrayList() constructor} - * directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code ArrayList} {@linkplain ArrayList#ArrayList() constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> ArrayList<E> newArrayList() { @@ -117,10 +117,9 @@ public final class Lists { * ImmutableList#copyOf(Iterable)} instead. (Or, change {@code elements} to be a {@link * FluentIterable} and call {@code elements.toList()}.) * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Use the {@code ArrayList} {@linkplain ArrayList#ArrayList(Collection) - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. Use + * the {@code ArrayList} {@linkplain ArrayList#ArrayList(Collection) constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> ArrayList<E> newArrayList( @@ -159,11 +158,11 @@ public final class Lists { * Creates an {@code ArrayList} instance backed by an array with the specified initial size; * simply delegates to {@link ArrayList#ArrayList(int)}. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use {@code new }{@link ArrayList#ArrayList(int) ArrayList}{@code <>(int)} - * directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. - * (Unlike here, there is no risk of overload ambiguity, since the {@code ArrayList} constructors - * very wisely did not accept varargs.) + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use {@code new }{@link ArrayList#ArrayList(int) ArrayList}{@code <>(int)} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. (Unlike here, there is no risk + * of overload ambiguity, since the {@code ArrayList} constructors very wisely did not accept + * varargs.) * * @param initialArraySize the exact size of the initial backing array for the returned array list * ({@code ArrayList} documentation calls this value the "capacity") @@ -209,10 +208,9 @@ public final class Lists { * outperform {@code LinkedList} except in certain rare and specific situations. Unless you have * spent a lot of time benchmarking your specific needs, use one of those instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedList} {@linkplain LinkedList#LinkedList() - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedList} {@linkplain LinkedList#LinkedList() constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> LinkedList<E> newLinkedList() { @@ -231,10 +229,9 @@ public final class Lists { * outperform {@code LinkedList} except in certain rare and specific situations. Unless you have * spent a lot of time benchmarking your specific needs, use one of those instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Use the {@code LinkedList} {@linkplain LinkedList#LinkedList(Collection) - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. Use + * the {@code LinkedList} {@linkplain LinkedList#LinkedList(Collection) constructor} directly, + * taking advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> LinkedList<E> newLinkedList( diff --git a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java index 4e66a84e0..bdef10ebc 100644 --- a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java +++ b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java @@ -47,7 +47,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReentrantLock; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * The concurrent hash map implementation built by {@link MapMaker}. @@ -295,13 +295,13 @@ class MapMakerInternalMap< /** * Returns a freshly created entry, typed at the {@code E} type, for the given {@code segment}. */ - E newEntry(S segment, K key, int hash, @NullableDecl E next); + E newEntry(S segment, K key, int hash, @CheckForNull E next); /** * Returns a freshly created entry, typed at the {@code E} type, for the given {@code segment}, * that is a copy of the given {@code entry}. */ - E copy(S segment, E entry, @NullableDecl E newNext); + E copy(S segment, E entry, @CheckForNull E newNext); /** * Sets the value of the given {@code entry} in the given {@code segment} to be the given {@code @@ -343,9 +343,9 @@ class MapMakerInternalMap< implements InternalEntry<K, V, E> { final K key; final int hash; - @NullableDecl final E next; + @CheckForNull final E next; - AbstractStrongKeyEntry(K key, int hash, @NullableDecl E next) { + AbstractStrongKeyEntry(K key, int hash, @CheckForNull E next) { this.key = key; this.hash = hash; this.next = next; @@ -393,14 +393,14 @@ class MapMakerInternalMap< static final class StrongKeyStrongValueEntry<K, V> extends AbstractStrongKeyEntry<K, V, StrongKeyStrongValueEntry<K, V>> implements StrongValueEntry<K, V, StrongKeyStrongValueEntry<K, V>> { - @NullableDecl private volatile V value = null; + @CheckForNull private volatile V value = null; - StrongKeyStrongValueEntry(K key, int hash, @NullableDecl StrongKeyStrongValueEntry<K, V> next) { + StrongKeyStrongValueEntry(K key, int hash, @CheckForNull StrongKeyStrongValueEntry<K, V> next) { super(key, hash, next); } @Override - @NullableDecl + @CheckForNull public V getValue() { return value; } @@ -451,7 +451,7 @@ class MapMakerInternalMap< public StrongKeyStrongValueEntry<K, V> copy( StrongKeyStrongValueSegment<K, V> segment, StrongKeyStrongValueEntry<K, V> entry, - @NullableDecl StrongKeyStrongValueEntry<K, V> newNext) { + @CheckForNull StrongKeyStrongValueEntry<K, V> newNext) { return entry.copy(newNext); } @@ -468,7 +468,7 @@ class MapMakerInternalMap< StrongKeyStrongValueSegment<K, V> segment, K key, int hash, - @NullableDecl StrongKeyStrongValueEntry<K, V> next) { + @CheckForNull StrongKeyStrongValueEntry<K, V> next) { return new StrongKeyStrongValueEntry<>(key, hash, next); } } @@ -481,7 +481,7 @@ class MapMakerInternalMap< private volatile WeakValueReference<K, V, StrongKeyWeakValueEntry<K, V>> valueReference = unsetWeakValueReference(); - StrongKeyWeakValueEntry(K key, int hash, @NullableDecl StrongKeyWeakValueEntry<K, V> next) { + StrongKeyWeakValueEntry(K key, int hash, @CheckForNull StrongKeyWeakValueEntry<K, V> next) { super(key, hash, next); } @@ -547,7 +547,7 @@ class MapMakerInternalMap< public StrongKeyWeakValueEntry<K, V> copy( StrongKeyWeakValueSegment<K, V> segment, StrongKeyWeakValueEntry<K, V> entry, - @NullableDecl StrongKeyWeakValueEntry<K, V> newNext) { + @CheckForNull StrongKeyWeakValueEntry<K, V> newNext) { if (Segment.isCollected(entry)) { return null; } @@ -565,7 +565,7 @@ class MapMakerInternalMap< StrongKeyWeakValueSegment<K, V> segment, K key, int hash, - @NullableDecl StrongKeyWeakValueEntry<K, V> next) { + @CheckForNull StrongKeyWeakValueEntry<K, V> next) { return new StrongKeyWeakValueEntry<>(key, hash, next); } } @@ -575,7 +575,7 @@ class MapMakerInternalMap< static final class StrongKeyDummyValueEntry<K> extends AbstractStrongKeyEntry<K, Dummy, StrongKeyDummyValueEntry<K>> implements StrongValueEntry<K, Dummy, StrongKeyDummyValueEntry<K>> { - StrongKeyDummyValueEntry(K key, int hash, @NullableDecl StrongKeyDummyValueEntry<K> next) { + StrongKeyDummyValueEntry(K key, int hash, @CheckForNull StrongKeyDummyValueEntry<K> next) { super(key, hash, next); } @@ -627,7 +627,7 @@ class MapMakerInternalMap< public StrongKeyDummyValueEntry<K> copy( StrongKeyDummyValueSegment<K> segment, StrongKeyDummyValueEntry<K> entry, - @NullableDecl StrongKeyDummyValueEntry<K> newNext) { + @CheckForNull StrongKeyDummyValueEntry<K> newNext) { return entry.copy(newNext); } @@ -640,7 +640,7 @@ class MapMakerInternalMap< StrongKeyDummyValueSegment<K> segment, K key, int hash, - @NullableDecl StrongKeyDummyValueEntry<K> next) { + @CheckForNull StrongKeyDummyValueEntry<K> next) { return new StrongKeyDummyValueEntry<K>(key, hash, next); } } @@ -650,9 +650,9 @@ class MapMakerInternalMap< abstract static class AbstractWeakKeyEntry<K, V, E extends InternalEntry<K, V, E>> extends WeakReference<K> implements InternalEntry<K, V, E> { final int hash; - @NullableDecl final E next; + @CheckForNull final E next; - AbstractWeakKeyEntry(ReferenceQueue<K> queue, K key, int hash, @NullableDecl E next) { + AbstractWeakKeyEntry(ReferenceQueue<K> queue, K key, int hash, @CheckForNull E next) { super(key, queue); this.hash = hash; this.next = next; @@ -679,7 +679,7 @@ class MapMakerInternalMap< extends AbstractWeakKeyEntry<K, Dummy, WeakKeyDummyValueEntry<K>> implements StrongValueEntry<K, Dummy, WeakKeyDummyValueEntry<K>> { WeakKeyDummyValueEntry( - ReferenceQueue<K> queue, K key, int hash, @NullableDecl WeakKeyDummyValueEntry<K> next) { + ReferenceQueue<K> queue, K key, int hash, @CheckForNull WeakKeyDummyValueEntry<K> next) { super(queue, key, hash, next); } @@ -731,7 +731,7 @@ class MapMakerInternalMap< public WeakKeyDummyValueEntry<K> copy( WeakKeyDummyValueSegment<K> segment, WeakKeyDummyValueEntry<K> entry, - @NullableDecl WeakKeyDummyValueEntry<K> newNext) { + @CheckForNull WeakKeyDummyValueEntry<K> newNext) { if (entry.getKey() == null) { // key collected return null; @@ -748,7 +748,7 @@ class MapMakerInternalMap< WeakKeyDummyValueSegment<K> segment, K key, int hash, - @NullableDecl WeakKeyDummyValueEntry<K> next) { + @CheckForNull WeakKeyDummyValueEntry<K> next) { return new WeakKeyDummyValueEntry<K>(segment.queueForKeys, key, hash, next); } } @@ -758,18 +758,18 @@ class MapMakerInternalMap< static final class WeakKeyStrongValueEntry<K, V> extends AbstractWeakKeyEntry<K, V, WeakKeyStrongValueEntry<K, V>> implements StrongValueEntry<K, V, WeakKeyStrongValueEntry<K, V>> { - @NullableDecl private volatile V value = null; + @CheckForNull private volatile V value = null; WeakKeyStrongValueEntry( ReferenceQueue<K> queue, K key, int hash, - @NullableDecl WeakKeyStrongValueEntry<K, V> next) { + @CheckForNull WeakKeyStrongValueEntry<K, V> next) { super(queue, key, hash, next); } @Override - @NullableDecl + @CheckForNull public V getValue() { return value; } @@ -820,7 +820,7 @@ class MapMakerInternalMap< public WeakKeyStrongValueEntry<K, V> copy( WeakKeyStrongValueSegment<K, V> segment, WeakKeyStrongValueEntry<K, V> entry, - @NullableDecl WeakKeyStrongValueEntry<K, V> newNext) { + @CheckForNull WeakKeyStrongValueEntry<K, V> newNext) { if (entry.getKey() == null) { // key collected return null; @@ -839,7 +839,7 @@ class MapMakerInternalMap< WeakKeyStrongValueSegment<K, V> segment, K key, int hash, - @NullableDecl WeakKeyStrongValueEntry<K, V> next) { + @CheckForNull WeakKeyStrongValueEntry<K, V> next) { return new WeakKeyStrongValueEntry<>(segment.queueForKeys, key, hash, next); } } @@ -853,7 +853,7 @@ class MapMakerInternalMap< unsetWeakValueReference(); WeakKeyWeakValueEntry( - ReferenceQueue<K> queue, K key, int hash, @NullableDecl WeakKeyWeakValueEntry<K, V> next) { + ReferenceQueue<K> queue, K key, int hash, @CheckForNull WeakKeyWeakValueEntry<K, V> next) { super(queue, key, hash, next); } @@ -921,7 +921,7 @@ class MapMakerInternalMap< public WeakKeyWeakValueEntry<K, V> copy( WeakKeyWeakValueSegment<K, V> segment, WeakKeyWeakValueEntry<K, V> entry, - @NullableDecl WeakKeyWeakValueEntry<K, V> newNext) { + @CheckForNull WeakKeyWeakValueEntry<K, V> newNext) { if (entry.getKey() == null) { // key collected return null; @@ -943,7 +943,7 @@ class MapMakerInternalMap< WeakKeyWeakValueSegment<K, V> segment, K key, int hash, - @NullableDecl WeakKeyWeakValueEntry<K, V> next) { + @CheckForNull WeakKeyWeakValueEntry<K, V> next) { return new WeakKeyWeakValueEntry<>(segment.queueForKeys, key, hash, next); } } @@ -955,7 +955,7 @@ class MapMakerInternalMap< * Returns the current value being referenced, or {@code null} if there is none (e.g. because * either it got collected, or {@link #clear} was called, or it wasn't set in the first place). */ - @NullableDecl + @CheckForNull V get(); /** Returns the entry which contains this {@link WeakValueReference}. */ @@ -1197,7 +1197,7 @@ class MapMakerInternalMap< int threshold; /** The per-segment table. */ - @NullableDecl volatile AtomicReferenceArray<E> table; + @CheckForNull volatile AtomicReferenceArray<E> table; /** The maximum size of this map. MapMaker.UNSET_INT if there is no maximum. */ final int maxSegmentSize; @@ -1305,7 +1305,7 @@ class MapMakerInternalMap< } /** Unsafely returns a copy of the given entry. */ - E copyForTesting(InternalEntry<K, V, ?> entry, @NullableDecl InternalEntry<K, V, ?> newNext) { + E copyForTesting(InternalEntry<K, V, ?> entry, @CheckForNull InternalEntry<K, V, ?> newNext) { return this.map.entryHelper.copy(self(), castForTesting(entry), castForTesting(newNext)); } @@ -1315,7 +1315,7 @@ class MapMakerInternalMap< } /** Unsafely returns a fresh entry. */ - E newEntryForTesting(K key, int hash, @NullableDecl InternalEntry<K, V, ?> next) { + E newEntryForTesting(K key, int hash, @CheckForNull InternalEntry<K, V, ?> next) { return this.map.entryHelper.newEntry(self(), key, hash, castForTesting(next)); } @@ -1333,7 +1333,7 @@ class MapMakerInternalMap< /** * Unsafely returns the value of the given entry if it's still live, or {@code null} otherwise. */ - @NullableDecl + @CheckForNull V getLiveValueForTesting(InternalEntry<K, V, ?> entry) { return getLiveValue(castForTesting(entry)); } @@ -1948,7 +1948,7 @@ class MapMakerInternalMap< * Gets the value from an entry. Returns {@code null} if the entry is invalid or * partially-collected. */ - @NullableDecl + @CheckForNull V getLiveValue(E entry) { if (entry.getKey() == null) { tryDrainReferenceQueues(); @@ -2339,7 +2339,7 @@ class MapMakerInternalMap< } @Override - public V get(@NullableDecl Object key) { + public V get(@CheckForNull Object key) { if (key == null) { return null; } @@ -2351,7 +2351,7 @@ class MapMakerInternalMap< * Returns the internal entry for the specified key. The entry may be computing or partially * collected. Does not impact recency ordering. */ - E getEntry(@NullableDecl Object key) { + E getEntry(@CheckForNull Object key) { if (key == null) { return null; } @@ -2360,7 +2360,7 @@ class MapMakerInternalMap< } @Override - public boolean containsKey(@NullableDecl Object key) { + public boolean containsKey(@CheckForNull Object key) { if (key == null) { return false; } @@ -2369,7 +2369,7 @@ class MapMakerInternalMap< } @Override - public boolean containsValue(@NullableDecl Object value) { + public boolean containsValue(@CheckForNull Object value) { if (value == null) { return false; } @@ -2433,7 +2433,7 @@ class MapMakerInternalMap< @CanIgnoreReturnValue @Override - public V remove(@NullableDecl Object key) { + public V remove(@CheckForNull Object key) { if (key == null) { return null; } @@ -2443,7 +2443,7 @@ class MapMakerInternalMap< @CanIgnoreReturnValue @Override - public boolean remove(@NullableDecl Object key, @NullableDecl Object value) { + public boolean remove(@CheckForNull Object key, @CheckForNull Object value) { if (key == null || value == null) { return false; } @@ -2453,7 +2453,7 @@ class MapMakerInternalMap< @CanIgnoreReturnValue @Override - public boolean replace(K key, @NullableDecl V oldValue, V newValue) { + public boolean replace(K key, @CheckForNull V oldValue, V newValue) { checkNotNull(key); checkNotNull(newValue); if (oldValue == null) { @@ -2479,7 +2479,7 @@ class MapMakerInternalMap< } } - @NullableDecl transient Set<K> keySet; + @CheckForNull transient Set<K> keySet; @Override public Set<K> keySet() { @@ -2487,7 +2487,7 @@ class MapMakerInternalMap< return (ks != null) ? ks : (keySet = new KeySet()); } - @NullableDecl transient Collection<V> values; + @CheckForNull transient Collection<V> values; @Override public Collection<V> values() { @@ -2495,7 +2495,7 @@ class MapMakerInternalMap< return (vs != null) ? vs : (values = new Values()); } - @NullableDecl transient Set<Entry<K, V>> entrySet; + @CheckForNull transient Set<Entry<K, V>> entrySet; @Override public Set<Entry<K, V>> entrySet() { @@ -2509,11 +2509,11 @@ class MapMakerInternalMap< int nextSegmentIndex; int nextTableIndex; - @NullableDecl Segment<K, V, E, S> currentSegment; - @NullableDecl AtomicReferenceArray<E> currentTable; - @NullableDecl E nextEntry; - @NullableDecl WriteThroughEntry nextExternal; - @NullableDecl WriteThroughEntry lastReturned; + @CheckForNull Segment<K, V, E, S> currentSegment; + @CheckForNull AtomicReferenceArray<E> currentTable; + @CheckForNull E nextEntry; + @CheckForNull WriteThroughEntry nextExternal; + @CheckForNull WriteThroughEntry lastReturned; HashIterator() { nextSegmentIndex = segments.length - 1; @@ -2653,7 +2653,7 @@ class MapMakerInternalMap< } @Override - public boolean equals(@NullableDecl Object object) { + public boolean equals(@CheckForNull Object object) { // Cannot use key and value equivalence if (object instanceof Entry) { Entry<?, ?> that = (Entry<?, ?>) object; diff --git a/android/guava/src/com/google/common/collect/Maps.java b/android/guava/src/com/google/common/collect/Maps.java index b415f25ed..76e69abb7 100644 --- a/android/guava/src/com/google/common/collect/Maps.java +++ b/android/guava/src/com/google/common/collect/Maps.java @@ -72,7 +72,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#maps"> {@code Maps}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#maps">{@code Maps}</a>. * * @author Kevin Bourrillion * @author Mike Bostock @@ -181,9 +181,9 @@ public final class Maps { * * <p><b>Note:</b> if {@code K} is an {@code enum} type, use {@link #newEnumMap} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code HashMap} */ @@ -199,9 +199,9 @@ public final class Maps { * * <p><b>Note:</b> if {@code K} is an {@link Enum} type, use {@link #newEnumMap} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the mappings to be placed in the new map * @return a new {@code HashMap} initialized with the mappings from {@code map} @@ -250,9 +250,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableMap#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code LinkedHashMap} */ @@ -267,9 +267,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableMap#copyOf(Map)} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the mappings to be placed in the new map * @return a new, {@code LinkedHashMap} initialized with the mappings from {@code map} @@ -311,9 +311,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedMap#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code TreeMap} */ @@ -328,9 +328,9 @@ public final class Maps { * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableSortedMap#copyOfSorted(SortedMap)} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the sorted map whose mappings are to be placed in the new map and whose comparator * is to be used to sort the new map @@ -348,9 +348,9 @@ public final class Maps { * <p><b>Note:</b> if mutability is not required, use {@code * ImmutableSortedMap.orderedBy(comparator).build()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param comparator the comparator to sort the keys with * @return a new, empty {@code TreeMap} @@ -379,9 +379,9 @@ public final class Maps { /** * Creates an {@code EnumMap} with the same mappings as the specified map. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code EnumMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code EnumMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the map from which to initialize this {@code EnumMap} * @return a new {@code EnumMap} initialized with the mappings from {@code map} @@ -396,9 +396,9 @@ public final class Maps { /** * Creates an {@code IdentityHashMap} instance. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code IdentityHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code IdentityHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code IdentityHashMap} */ @@ -528,7 +528,20 @@ public final class Maps { onlyOnRight.putAll(right); // will whittle it down SortedMap<K, V> onBoth = Maps.newTreeMap(comparator); SortedMap<K, MapDifference.ValueDifference<V>> differences = Maps.newTreeMap(comparator); - doDifference(left, right, Equivalence.equals(), onlyOnLeft, onlyOnRight, onBoth, differences); + + /* + * V is a possibly nullable type, but we decided to declare Equivalence with a type parameter + * that is restricted to non-nullable types. Still, this code is safe: We made that decision + * about Equivalence not because Equivalence is null-hostile but because *every* Equivalence can + * handle null inputs -- and thus it would be meaningless for the type system to distinguish + * between "an Equivalence for nullable Foo" and "an Equivalence for non-nullable Foo." + * + * (And the unchecked cast is safe because Equivalence is contravariant.) + */ + @SuppressWarnings({"nullness", "unchecked"}) + Equivalence<V> equalsEquivalence = (Equivalence<V>) Equivalence.equals(); + + doDifference(left, right, equalsEquivalence, onlyOnLeft, onlyOnRight, onBoth, differences); return new SortedMapDifferenceImpl<>(onlyOnLeft, onlyOnRight, onBoth, differences); } @@ -1220,13 +1233,13 @@ public final class Maps { public static <K, V> ImmutableMap<K, V> toMap( Iterator<K> keys, Function<? super K, V> valueFunction) { checkNotNull(valueFunction); - // Using LHM instead of a builder so as not to fail on duplicate keys - Map<K, V> builder = newLinkedHashMap(); + ImmutableMap.Builder<K, V> builder = ImmutableMap.builder(); while (keys.hasNext()) { K key = keys.next(); builder.put(key, valueFunction.apply(key)); } - return ImmutableMap.copyOf(builder); + // Using buildKeepingLast() so as not to fail on duplicate keys + return builder.buildKeepingLast(); } /** @@ -1303,7 +1316,7 @@ public final class Maps { builder.put(keyFunction.apply(value), value); } try { - return builder.build(); + return builder.buildOrThrow(); } catch (IllegalArgumentException duplicateKeys) { throw new IllegalArgumentException( duplicateKeys.getMessage() @@ -1356,7 +1369,7 @@ public final class Maps { builder.put(key, requireNonNull(properties.getProperty(key))); } - return builder.build(); + return builder.buildOrThrow(); } /** @@ -4337,7 +4350,7 @@ public final class Maps { for (E e : list) { builder.put(e, i++); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index cd01279f4..181b3fbb5 100644 --- a/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -131,7 +131,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { * instead. */ public static <B> Builder<B> orderedBy(Comparator<B> comparator) { - return new Builder<B>(comparator); + return new Builder<>(comparator); } /** @@ -216,7 +216,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { */ public <T extends B> MinMaxPriorityQueue<T> create(Iterable<? extends T> initialContents) { MinMaxPriorityQueue<T> queue = - new MinMaxPriorityQueue<T>( + new MinMaxPriorityQueue<>( this, initialQueueSize(expectedSize, maximumSize, initialContents)); for (T element : initialContents) { queue.offer(element); @@ -436,11 +436,11 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { // Last element is moved to before index, swapped with trickled element. if (changes == null) { // The trickled element is still after index. - return new MoveDesc<E>(actualLastElement, toTrickle); + return new MoveDesc<>(actualLastElement, toTrickle); } else { // The trickled element is back before index, but the replaced element // has now been moved after index. - return new MoveDesc<E>(actualLastElement, changes.replaced); + return new MoveDesc<>(actualLastElement, changes.replaced); } } // Trickled element was after index to begin with, no adjustment needed. @@ -560,7 +560,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { } // bubble it up the opposite heap if (otherHeap.bubbleUpAlternatingLevels(crossOver, toTrickle) < removeIndex) { - return new MoveDesc<E>(toTrickle, parent); + return new MoveDesc<>(toTrickle, parent); } else { return null; } @@ -815,8 +815,8 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { if (moved != null) { // Either both are null or neither is, but we check both to satisfy the nullness checker. if (forgetMeNot == null || skipMe == null) { - forgetMeNot = new ArrayDeque<E>(); - skipMe = new ArrayList<E>(3); + forgetMeNot = new ArrayDeque<>(); + skipMe = new ArrayList<>(3); } if (!foundAndRemovedExactReference(skipMe, moved.toTrickle)) { forgetMeNot.add(moved.toTrickle); diff --git a/android/guava/src/com/google/common/collect/Multimap.java b/android/guava/src/com/google/common/collect/Multimap.java index 09aa2875b..41aed97f1 100644 --- a/android/guava/src/com/google/common/collect/Multimap.java +++ b/android/guava/src/com/google/common/collect/Multimap.java @@ -151,8 +151,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link UnsupportedOperationException}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/MultimapBuilder.java b/android/guava/src/com/google/common/collect/MultimapBuilder.java index dddae2864..3d6278aae 100644 --- a/android/guava/src/com/google/common/collect/MultimapBuilder.java +++ b/android/guava/src/com/google/common/collect/MultimapBuilder.java @@ -84,7 +84,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedKeys < 0} */ - public static MultimapBuilderWithKeys<@Nullable Object> hashKeys(final int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable Object> hashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); return new MultimapBuilderWithKeys<@Nullable Object>() { @Override @@ -115,7 +115,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * multimap, save that if all values associated with a key are removed and then the key is added * back into the multimap, that key will come last in the key iteration order. */ - public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys(final int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); return new MultimapBuilderWithKeys<@Nullable Object>() { @Override @@ -154,7 +154,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * is not serializable. */ public static <K0 extends @Nullable Object> MultimapBuilderWithKeys<K0> treeKeys( - final Comparator<K0> comparator) { + Comparator<K0> comparator) { checkNotNull(comparator); return new MultimapBuilderWithKeys<K0>() { @Override @@ -169,8 +169,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @since 16.0 */ - public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys( - final Class<K0> keyClass) { + public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys(Class<K0> keyClass) { checkNotNull(keyClass); return new MultimapBuilderWithKeys<K0>() { @SuppressWarnings("unchecked") @@ -193,7 +192,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N @Override public List<V> get() { - return new ArrayList<V>(expectedValuesPerKey); + return new ArrayList<>(expectedValuesPerKey); } } @@ -251,7 +250,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N @Override public SortedSet<V> get() { - return new TreeSet<V>(comparator); + return new TreeSet<>(comparator); } } @@ -295,8 +294,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public ListMultimapBuilder<K0, @Nullable Object> arrayListValues( - final int expectedValuesPerKey) { + public ListMultimapBuilder<K0, @Nullable Object> arrayListValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new ListMultimapBuilder<K0, @Nullable Object>() { @Override @@ -330,7 +328,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public SetMultimapBuilder<K0, @Nullable Object> hashSetValues(final int expectedValuesPerKey) { + public SetMultimapBuilder<K0, @Nullable Object> hashSetValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new SetMultimapBuilder<K0, @Nullable Object>() { @Override @@ -353,8 +351,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public SetMultimapBuilder<K0, @Nullable Object> linkedHashSetValues( - final int expectedValuesPerKey) { + public SetMultimapBuilder<K0, @Nullable Object> linkedHashSetValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new SetMultimapBuilder<K0, @Nullable Object>() { @Override @@ -379,7 +376,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * comparator} is not serializable. */ public <V0 extends @Nullable Object> SortedSetMultimapBuilder<K0, V0> treeSetValues( - final Comparator<V0> comparator) { + Comparator<V0> comparator) { checkNotNull(comparator, "comparator"); return new SortedSetMultimapBuilder<K0, V0>() { @Override @@ -391,8 +388,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N } /** Uses an {@link EnumSet} to store value collections. */ - public <V0 extends Enum<V0>> SetMultimapBuilder<K0, V0> enumSetValues( - final Class<V0> valueClass) { + public <V0 extends Enum<V0>> SetMultimapBuilder<K0, V0> enumSetValues(Class<V0> valueClass) { checkNotNull(valueClass, "valueClass"); return new SetMultimapBuilder<K0, V0>() { @Override diff --git a/android/guava/src/com/google/common/collect/Multimaps.java b/android/guava/src/com/google/common/collect/Multimaps.java index b0577eab1..9976b4a66 100644 --- a/android/guava/src/com/google/common/collect/Multimaps.java +++ b/android/guava/src/com/google/common/collect/Multimaps.java @@ -58,7 +58,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static methods acting on or generating a {@code Multimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multimaps"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multimaps">{@code * Multimaps}</a>. * * @author Jared Levy diff --git a/android/guava/src/com/google/common/collect/Multiset.java b/android/guava/src/com/google/common/collect/Multiset.java index 8dfb1af24..f60046fa4 100644 --- a/android/guava/src/com/google/common/collect/Multiset.java +++ b/android/guava/src/com/google/common/collect/Multiset.java @@ -74,8 +74,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@code Multiset}, {@code AtomicLongMap} does not automatically remove zeros. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Kevin Bourrillion * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/Multisets.java b/android/guava/src/com/google/common/collect/Multisets.java index 02febcac7..a9bcb0428 100644 --- a/android/guava/src/com/google/common/collect/Multisets.java +++ b/android/guava/src/com/google/common/collect/Multisets.java @@ -46,7 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static utility methods for creating and working with {@link Multiset} instances. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multisets"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multisets">{@code * Multisets}</a>. * * @author Kevin Bourrillion diff --git a/android/guava/src/com/google/common/collect/NullnessCasts.java b/android/guava/src/com/google/common/collect/NullnessCasts.java index 6ceeda75f..4f894dbd3 100644 --- a/android/guava/src/com/google/common/collect/NullnessCasts.java +++ b/android/guava/src/com/google/common/collect/NullnessCasts.java @@ -57,7 +57,7 @@ final class NullnessCasts { } /** Returns {@code null} as any type, even one that does not include {@code null}. */ - @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals"}) + @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"}) // The warnings are legitimate. Each time we use this method, we document why. @ParametricNullness static <T extends @Nullable Object> T unsafeNull() { diff --git a/android/guava/src/com/google/common/collect/ParametricNullness.java b/android/guava/src/com/google/common/collect/ParametricNullness.java index b1cda482c..94b1bcd3a 100644 --- a/android/guava/src/com/google/common/collect/ParametricNullness.java +++ b/android/guava/src/com/google/common/collect/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/collect/PeekingIterator.java b/android/guava/src/com/google/common/collect/PeekingIterator.java index a274fe454..8524ed751 100644 --- a/android/guava/src/com/google/common/collect/PeekingIterator.java +++ b/android/guava/src/com/google/common/collect/PeekingIterator.java @@ -27,7 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * An iterator that supports a one-element lookahead while iterating. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionHelpersExplained#peekingiterator"> {@code + * "https://github.com/google/guava/wiki/CollectionHelpersExplained#peekingiterator">{@code * PeekingIterator}</a>. * * @author Mick Killianey diff --git a/android/guava/src/com/google/common/collect/Range.java b/android/guava/src/com/google/common/collect/Range.java index ab5c07793..2a5d464dc 100644 --- a/android/guava/src/com/google/common/collect/Range.java +++ b/android/guava/src/com/google/common/collect/Range.java @@ -16,6 +16,7 @@ package com.google.common.collect; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; @@ -154,7 +155,7 @@ public final class Range<C extends Comparable> extends RangeGwtSerializationDepe } static <C extends Comparable<?>> Range<C> create(Cut<C> lowerBound, Cut<C> upperBound) { - return new Range<C>(lowerBound, upperBound); + return new Range<>(lowerBound, upperBound); } /** @@ -556,6 +557,15 @@ public final class Range<C extends Comparable> extends RangeGwtSerializationDepe } else { Cut<C> newLower = (lowerCmp >= 0) ? lowerBound : connectedRange.lowerBound; Cut<C> newUpper = (upperCmp <= 0) ? upperBound : connectedRange.upperBound; + + // create() would catch this, but give a confusing error message + checkArgument( + newLower.compareTo(newUpper) <= 0, + "intersection is undefined for disconnected ranges %s and %s", + this, + connectedRange); + + // TODO(kevinb): all the precondition checks in the constructor are redundant... return create(newLower, newUpper); } } diff --git a/android/guava/src/com/google/common/collect/RangeSet.java b/android/guava/src/com/google/common/collect/RangeSet.java index edb0f792a..8d61cf351 100644 --- a/android/guava/src/com/google/common/collect/RangeSet.java +++ b/android/guava/src/com/google/common/collect/RangeSet.java @@ -43,7 +43,7 @@ import javax.annotation.CheckForNull; * <p>For a {@link Set} whose contents are specified by a {@link Range}, see {@link ContiguousSet}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#rangeset"> RangeSets</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#rangeset">RangeSets</a>. * * @author Kevin Bourrillion * @author Louis Wasserman diff --git a/android/guava/src/com/google/common/collect/RegularContiguousSet.java b/android/guava/src/com/google/common/collect/RegularContiguousSet.java index 913e2d7d3..787606eb1 100644 --- a/android/guava/src/com/google/common/collect/RegularContiguousSet.java +++ b/android/guava/src/com/google/common/collect/RegularContiguousSet.java @@ -58,7 +58,7 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> C fromElement, boolean fromInclusive, C toElement, boolean toInclusive) { if (fromElement.compareTo(toElement) == 0 && !fromInclusive && !toInclusive) { // Range would reject our attempt to create (x, x). - return new EmptyContiguousSet<C>(domain); + return new EmptyContiguousSet<>(domain); } return intersectionInCurrentDomain( Range.range( @@ -231,14 +231,14 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> } private Object readResolve() { - return new RegularContiguousSet<C>(range, domain); + return new RegularContiguousSet<>(range, domain); } } @GwtIncompatible // serialization @Override Object writeReplace() { - return new SerializedForm<C>(range, domain); + return new SerializedForm<>(range, domain); } private static final long serialVersionUID = 0; diff --git a/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java index 460747747..2ee752ceb 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -55,9 +55,9 @@ final class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> { this.keyOffset = 0; int tableSize = (size >= 2) ? ImmutableSet.chooseTableSize(size) : 0; this.keyHashTable = - RegularImmutableMap.createHashTable(alternatingKeysAndValues, size, tableSize, 0); + RegularImmutableMap.createHashTableOrThrow(alternatingKeysAndValues, size, tableSize, 0); Object valueHashTable = - RegularImmutableMap.createHashTable(alternatingKeysAndValues, size, tableSize, 1); + RegularImmutableMap.createHashTableOrThrow(alternatingKeysAndValues, size, tableSize, 1); this.inverse = new RegularImmutableBiMap<V, K>(valueHashTable, alternatingKeysAndValues, size, this); } diff --git a/android/guava/src/com/google/common/collect/RegularImmutableMap.java b/android/guava/src/com/google/common/collect/RegularImmutableMap.java index d8f9f3b27..fc8082c7b 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -71,11 +71,38 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { @VisibleForTesting final transient @Nullable Object[] alternatingKeysAndValues; private final transient int size; - @SuppressWarnings("unchecked") + /* + * We have some considerable complexity in these create methods because of + * Builder.buildKeepingLast(). The same Builder might be called with buildKeepingLast() and then + * buildOrThrow(), or vice versa. So in particular, if we modify alternatingKeysAndValues to + * eliminate duplicate keys (for buildKeepingLast()) then we have to ensure that a later call to + * buildOrThrow() will still throw as if the duplicates had not been eliminated. And the exception + * message must mention two values that were associated with the duplicate key in two different + * calls to Builder.put (though we don't really care *which* two values if there were more than + * two). These considerations lead us to have a field of type DuplicateKey in the Builder, which + * will remember the first duplicate key we encountered. All later calls to buildOrThrow() can + * mention that key with its values. Further duplicates might be added in the meantime but since + * builders only ever accumulate entries it will always be valid to throw from buildOrThrow() with + * the first duplicate. + */ + + // This entry point is for callers other than ImmutableMap.Builder. static <K, V> RegularImmutableMap<K, V> create( int n, @Nullable Object[] alternatingKeysAndValues) { + return create(n, alternatingKeysAndValues, /* builder= */ null); + } + + // This entry point is used by the other create method but also directly by + // ImmutableMap.Builder, so that it can remember any DuplicateKey encountered and produce an + // exception for a later buildOrThrow(). If builder is null that means that a duplicate + // key will lead to an immediate exception. If it is not null then a duplicate key will instead be + // stored in the builder, which may use it to throw an exception later. + static <K, V> RegularImmutableMap<K, V> create( + int n, @Nullable Object[] alternatingKeysAndValues, @Nullable Builder<K, V> builder) { if (n == 0) { - return (RegularImmutableMap<K, V>) EMPTY; + @SuppressWarnings("unchecked") + RegularImmutableMap<K, V> empty = (RegularImmutableMap<K, V>) EMPTY; + return empty; } else if (n == 1) { // requireNonNull is safe because the first `2*n` elements have been filled in. checkEntryNotNull( @@ -84,16 +111,44 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { } checkPositionIndex(n, alternatingKeysAndValues.length >> 1); int tableSize = ImmutableSet.chooseTableSize(n); - Object hashTable = createHashTable(alternatingKeysAndValues, n, tableSize, 0); + // If there are no duplicate keys, hashTablePlus is the final hashTable value. If there *are* + // duplicate keys, hashTablePlus consists of 3 elements: [0] the hashTable; [1] the number of + // entries in alternatingKeysAndValues that are still valid after rewriting to remove + // duplicates; [2] a Builder.DuplicateKey that records the first duplicate key we encountered + // for possible later use in exceptions, perhaps straight away. + Object hashTablePlus = createHashTable(alternatingKeysAndValues, n, tableSize, 0); + Object hashTable; + if (hashTablePlus instanceof Object[]) { + Object[] hashTableAndSizeAndDuplicate = (Object[]) hashTablePlus; + Builder.DuplicateKey duplicateKey = (Builder.DuplicateKey) hashTableAndSizeAndDuplicate[2]; + if (builder == null) { + throw duplicateKey.exception(); + } + builder.duplicateKey = duplicateKey; + hashTable = hashTableAndSizeAndDuplicate[0]; + n = (Integer) hashTableAndSizeAndDuplicate[1]; + alternatingKeysAndValues = Arrays.copyOf(alternatingKeysAndValues, n * 2); + } else { + hashTable = hashTablePlus; + } return new RegularImmutableMap<K, V>(hashTable, alternatingKeysAndValues, n); } /** * Returns a hash table for the specified keys and values, and ensures that neither keys nor - * values are null. + * values are null. This method may update {@code alternatingKeysAndValues} if there are duplicate + * keys. If so, the return value will indicate how many entries are still valid, and will also + * include a {@link Builder.DuplicateKey} in case duplicate keys are not allowed now or will not + * be allowed on a later {@link Builder#buildOrThrow()} call. + * + * @param keyOffset 1 if this is the reverse direction of a BiMap, 0 otherwise. + * @return an {@code Object} that is a {@code byte[]}, {@code short[]}, or {@code int[]}, the + * smallest possible to fit {@code tableSize}; or an {@code Object[]} where [0] is one of + * these; [1] indicates how many element pairs in {@code alternatingKeysAndValues} are valid; + * and [2] is a {@link Builder.DuplicateKey} for the first duplicate key encountered. */ @CheckForNull - static Object createHashTable( + private static Object createHashTable( @Nullable Object[] alternatingKeysAndValues, int n, int tableSize, int keyOffset) { if (n == 1) { // for n=1 we don't create a hash table, but we need to do the checkEntryNotNull check! @@ -104,6 +159,7 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { return null; } int mask = tableSize - 1; + Builder.DuplicateKey duplicateKey = null; if (tableSize <= BYTE_MAX_SIZE) { /* * Use 8 bits per entry. The value is unsigned to allow use up to a size of 2^8. @@ -114,8 +170,11 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { byte[] hashTable = new byte[tableSize]; Arrays.fill(hashTable, ABSENT); + int outI = 0; + entries: for (int i = 0; i < n; i++) { int keyIndex = 2 * i + keyOffset; + int outKeyIndex = 2 * outI + keyOffset; // requireNonNull is safe because the first `2*n` elements have been filled in. Object key = requireNonNull(alternatingKeysAndValues[keyIndex]); Object value = requireNonNull(alternatingKeysAndValues[keyIndex ^ 1]); @@ -124,14 +183,23 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { h &= mask; int previousKeyIndex = hashTable[h] & BYTE_MASK; // unsigned read if (previousKeyIndex == BYTE_MASK) { // -1 signed becomes 255 unsigned - hashTable[h] = (byte) keyIndex; + hashTable[h] = (byte) outKeyIndex; break; } else if (key.equals(alternatingKeysAndValues[previousKeyIndex])) { - throw duplicateKeyException(key, value, alternatingKeysAndValues, previousKeyIndex); + duplicateKey = + new Builder.DuplicateKey( + key, value, requireNonNull(alternatingKeysAndValues[previousKeyIndex ^ 1])); + alternatingKeysAndValues[previousKeyIndex ^ 1] = value; + continue entries; } } + if (outI < i) { // if outI == i don't bother writing the values back where they came from + alternatingKeysAndValues[outKeyIndex] = key; + alternatingKeysAndValues[outKeyIndex ^ 1] = value; + } + outI++; } - return hashTable; + return outI == n ? hashTable : new Object[] {hashTable, outI, duplicateKey}; } else if (tableSize <= SHORT_MAX_SIZE) { /* * Use 16 bits per entry. The value is unsigned to allow use up to a size of 2^16. @@ -142,8 +210,11 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { short[] hashTable = new short[tableSize]; Arrays.fill(hashTable, ABSENT); + int outI = 0; + entries: for (int i = 0; i < n; i++) { int keyIndex = 2 * i + keyOffset; + int outKeyIndex = 2 * outI + keyOffset; // requireNonNull is safe because the first `2*n` elements have been filled in. Object key = requireNonNull(alternatingKeysAndValues[keyIndex]); Object value = requireNonNull(alternatingKeysAndValues[keyIndex ^ 1]); @@ -152,14 +223,23 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { h &= mask; int previousKeyIndex = hashTable[h] & SHORT_MASK; // unsigned read if (previousKeyIndex == SHORT_MASK) { // -1 signed becomes 65_535 unsigned - hashTable[h] = (short) keyIndex; + hashTable[h] = (short) outKeyIndex; break; } else if (key.equals(alternatingKeysAndValues[previousKeyIndex])) { - throw duplicateKeyException(key, value, alternatingKeysAndValues, previousKeyIndex); + duplicateKey = + new Builder.DuplicateKey( + key, value, requireNonNull(alternatingKeysAndValues[previousKeyIndex ^ 1])); + alternatingKeysAndValues[previousKeyIndex ^ 1] = value; + continue entries; } } + if (outI < i) { // if outI == i don't bother writing the values back where they came from + alternatingKeysAndValues[outKeyIndex] = key; + alternatingKeysAndValues[outKeyIndex ^ 1] = value; + } + outI++; } - return hashTable; + return outI == n ? hashTable : new Object[] {hashTable, outI, duplicateKey}; } else { /* * Use 32 bits per entry. @@ -167,8 +247,11 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { int[] hashTable = new int[tableSize]; Arrays.fill(hashTable, ABSENT); + int outI = 0; + entries: for (int i = 0; i < n; i++) { int keyIndex = 2 * i + keyOffset; + int outKeyIndex = 2 * outI + keyOffset; // requireNonNull is safe because the first `2*n` elements have been filled in. Object key = requireNonNull(alternatingKeysAndValues[keyIndex]); Object value = requireNonNull(alternatingKeysAndValues[keyIndex ^ 1]); @@ -177,28 +260,36 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { h &= mask; int previousKeyIndex = hashTable[h]; if (previousKeyIndex == ABSENT) { - hashTable[h] = keyIndex; + hashTable[h] = outKeyIndex; break; } else if (key.equals(alternatingKeysAndValues[previousKeyIndex])) { - throw duplicateKeyException(key, value, alternatingKeysAndValues, previousKeyIndex); + duplicateKey = + new Builder.DuplicateKey( + key, value, requireNonNull(alternatingKeysAndValues[previousKeyIndex ^ 1])); + alternatingKeysAndValues[previousKeyIndex ^ 1] = value; + continue entries; } } + if (outI < i) { // if outI == i don't bother writing the values back where they came from + alternatingKeysAndValues[outKeyIndex] = key; + alternatingKeysAndValues[outKeyIndex ^ 1] = value; + } + outI++; } - return hashTable; + return outI == n ? hashTable : new Object[] {hashTable, outI, duplicateKey}; } } - private static IllegalArgumentException duplicateKeyException( - Object key, Object value, @Nullable Object[] alternatingKeysAndValues, int previousKeyIndex) { - return new IllegalArgumentException( - "Multiple entries with same key: " - + key - + "=" - + value - + " and " - + alternatingKeysAndValues[previousKeyIndex] - + "=" - + alternatingKeysAndValues[previousKeyIndex ^ 1]); + @CheckForNull + static Object createHashTableOrThrow( + @Nullable Object[] alternatingKeysAndValues, int n, int tableSize, int keyOffset) { + Object hashTablePlus = createHashTable(alternatingKeysAndValues, n, tableSize, keyOffset); + if (hashTablePlus instanceof Object[]) { + Object[] hashTableAndSizeAndDuplicate = (Object[]) hashTablePlus; + Builder.DuplicateKey duplicateKey = (Builder.DuplicateKey) hashTableAndSizeAndDuplicate[2]; + throw duplicateKey.exception(); + } + return hashTablePlus; } private RegularImmutableMap( diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java index dd987988b..ef0fbb378 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java @@ -155,7 +155,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> { } @Override - int copyIntoArray(Object[] dst, int offset) { + int copyIntoArray(@Nullable Object[] dst, int offset) { return elements.copyIntoArray(dst, offset); } diff --git a/android/guava/src/com/google/common/collect/RegularImmutableTable.java b/android/guava/src/com/google/common/collect/RegularImmutableTable.java index 24434c5a1..337f123b6 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -98,8 +98,8 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> { static <R, C, V> RegularImmutableTable<R, C, V> forCells( List<Cell<R, C, V>> cells, - @CheckForNull final Comparator<? super R> rowComparator, - @CheckForNull final Comparator<? super C> columnComparator) { + @CheckForNull Comparator<? super R> rowComparator, + @CheckForNull Comparator<? super C> columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* @@ -110,20 +110,17 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> { * column, the rows in the second column, etc. */ Comparator<Cell<R, C, V>> comparator = - new Comparator<Cell<R, C, V>>() { - @Override - public int compare(Cell<R, C, V> cell1, Cell<R, C, V> cell2) { - int rowCompare = - (rowComparator == null) - ? 0 - : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); - if (rowCompare != 0) { - return rowCompare; - } - return (columnComparator == null) - ? 0 - : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); + (Cell<R, C, V> cell1, Cell<R, C, V> cell2) -> { + int rowCompare = + (rowComparator == null) + ? 0 + : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); + if (rowCompare != 0) { + return rowCompare; } + return (columnComparator == null) + ? 0 + : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); }; Collections.sort(cells, comparator); } diff --git a/android/guava/src/com/google/common/collect/Serialization.java b/android/guava/src/com/google/common/collect/Serialization.java index 5e8806764..4ab53f2d7 100644 --- a/android/guava/src/com/google/common/collect/Serialization.java +++ b/android/guava/src/com/google/common/collect/Serialization.java @@ -187,10 +187,10 @@ final class Serialization { } // Secret sauce for setting final fields; don't make it public. - static <T> FieldSetter<T> getFieldSetter(final Class<T> clazz, String fieldName) { + static <T> FieldSetter<T> getFieldSetter(Class<T> clazz, String fieldName) { try { Field field = clazz.getDeclaredField(fieldName); - return new FieldSetter<T>(field); + return new FieldSetter<>(field); } catch (NoSuchFieldException e) { throw new AssertionError(e); // programmer error } diff --git a/android/guava/src/com/google/common/collect/SetMultimap.java b/android/guava/src/com/google/common/collect/SetMultimap.java index 216533ea2..b7a54570a 100644 --- a/android/guava/src/com/google/common/collect/SetMultimap.java +++ b/android/guava/src/com/google/common/collect/SetMultimap.java @@ -46,8 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * that affects its {@link Object#equals} behavior. Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/Sets.java b/android/guava/src/com/google/common/collect/Sets.java index dde21cb37..994863099 100644 --- a/android/guava/src/com/google/common/collect/Sets.java +++ b/android/guava/src/com/google/common/collect/Sets.java @@ -57,7 +57,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link Lists}, {@link Maps} and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#sets"> {@code Sets}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#sets">{@code Sets}</a>. * * @author Kevin Bourrillion * @author Jared Levy @@ -159,9 +159,9 @@ public final class Sets { * using a {@code LinkedHashSet} instead, at the cost of increased memory footprint, to get * deterministic iteration behavior. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ public static <E extends @Nullable Object> HashSet<E> newHashSet() { return new HashSet<E>(); @@ -198,9 +198,9 @@ public final class Sets { * <p><b>Note:</b> if {@code E} is an {@link Enum} type, use {@link #newEnumSet(Iterable, Class)} * instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Instead, use the {@code HashSet} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. + * Instead, use the {@code HashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>Overall, this method is not very useful and will likely be deprecated in the future. */ @@ -285,9 +285,9 @@ public final class Sets { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSet#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code LinkedHashSet} */ @@ -301,9 +301,9 @@ public final class Sets { * <p><b>Note:</b> if mutability is not required and the elements are non-null, use {@link * ImmutableSet#copyOf(Iterable)} instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Instead, use the {@code LinkedHashSet} constructor directly, taking advantage - * of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. + * Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>Overall, this method is not very useful and will likely be deprecated in the future. * @@ -345,9 +345,9 @@ public final class Sets { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedSet#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code TreeSet} */ @@ -366,9 +366,9 @@ public final class Sets { * method has different behavior than {@link TreeSet#TreeSet(SortedSet)}, which returns a {@code * TreeSet} with that comparator. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>This method is just a small convenience for creating an empty set and then calling {@link * Iterables#addAll}. This method is not very useful and will likely be deprecated in the future. @@ -388,11 +388,11 @@ public final class Sets { * <p><b>Note:</b> if mutability is not required, use {@code * ImmutableSortedSet.orderedBy(comparator).build()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. One caveat to this is that the {@code - * TreeSet} constructor uses a null {@code Comparator} to mean "natural ordering," whereas this - * factory rejects null. Clean your code accordingly. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. One caveat to this is that the {@code TreeSet} + * constructor uses a null {@code Comparator} to mean "natural ordering," whereas this factory + * rejects null. Clean your code accordingly. * * @param comparator the comparator to use to sort the set * @return a new, empty {@code TreeSet} diff --git a/android/guava/src/com/google/common/collect/SortedMultiset.java b/android/guava/src/com/google/common/collect/SortedMultiset.java index 68932f585..7cc512d8e 100644 --- a/android/guava/src/com/google/common/collect/SortedMultiset.java +++ b/android/guava/src/com/google/common/collect/SortedMultiset.java @@ -37,8 +37,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Collection} contract, which is specified in terms of {@link Object#equals}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Louis Wasserman * @since 11.0 diff --git a/android/guava/src/com/google/common/collect/SortedMultisets.java b/android/guava/src/com/google/common/collect/SortedMultisets.java index 1d1940c9a..f602a42a1 100644 --- a/android/guava/src/com/google/common/collect/SortedMultisets.java +++ b/android/guava/src/com/google/common/collect/SortedMultisets.java @@ -128,7 +128,7 @@ final class SortedMultisets { @Override public NavigableSet<E> descendingSet() { - return new NavigableElementSet<E>(multiset().descendingMultiset()); + return new NavigableElementSet<>(multiset().descendingMultiset()); } @Override @@ -154,7 +154,7 @@ final class SortedMultisets { boolean fromInclusive, @ParametricNullness E toElement, boolean toInclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset() .subMultiset( fromElement, BoundType.forBoolean(fromInclusive), @@ -163,13 +163,13 @@ final class SortedMultisets { @Override public NavigableSet<E> headSet(@ParametricNullness E toElement, boolean inclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset().headMultiset(toElement, BoundType.forBoolean(inclusive))); } @Override public NavigableSet<E> tailSet(@ParametricNullness E fromElement, boolean inclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset().tailMultiset(fromElement, BoundType.forBoolean(inclusive))); } } diff --git a/android/guava/src/com/google/common/collect/SortedSetMultimap.java b/android/guava/src/com/google/common/collect/SortedSetMultimap.java index 844901467..8454aeccb 100644 --- a/android/guava/src/com/google/common/collect/SortedSetMultimap.java +++ b/android/guava/src/com/google/common/collect/SortedSetMultimap.java @@ -43,8 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * position in the order of the values). Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/android/guava/src/com/google/common/collect/SparseImmutableTable.java b/android/guava/src/com/google/common/collect/SparseImmutableTable.java index b314f7bb3..44881fde7 100644 --- a/android/guava/src/com/google/common/collect/SparseImmutableTable.java +++ b/android/guava/src/com/google/common/collect/SparseImmutableTable.java @@ -82,14 +82,14 @@ final class SparseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V> for (Entry<R, Map<C, V>> row : rows.entrySet()) { rowBuilder.put(row.getKey(), ImmutableMap.copyOf(row.getValue())); } - this.rowMap = rowBuilder.build(); + this.rowMap = rowBuilder.buildOrThrow(); ImmutableMap.Builder<C, ImmutableMap<R, V>> columnBuilder = new ImmutableMap.Builder<>(columns.size()); for (Entry<C, Map<R, V>> col : columns.entrySet()) { columnBuilder.put(col.getKey(), ImmutableMap.copyOf(col.getValue())); } - this.columnMap = columnBuilder.build(); + this.columnMap = columnBuilder.buildOrThrow(); } @Override diff --git a/android/guava/src/com/google/common/collect/Table.java b/android/guava/src/com/google/common/collect/Table.java index 97d3f7027..3c9e7ec7a 100644 --- a/android/guava/src/com/google/common/collect/Table.java +++ b/android/guava/src/com/google/common/collect/Table.java @@ -46,7 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * UnsupportedOperationException}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @param <R> the type of the table row keys diff --git a/android/guava/src/com/google/common/collect/Tables.java b/android/guava/src/com/google/common/collect/Tables.java index 772a75de7..ab67fae9f 100644 --- a/android/guava/src/com/google/common/collect/Tables.java +++ b/android/guava/src/com/google/common/collect/Tables.java @@ -41,7 +41,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static methods that involve a {@code Table}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#tables"> {@code Tables}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#tables">{@code Tables}</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/android/guava/src/com/google/common/collect/TopKSelector.java b/android/guava/src/com/google/common/collect/TopKSelector.java index f8cca0dea..32959630b 100644 --- a/android/guava/src/com/google/common/collect/TopKSelector.java +++ b/android/guava/src/com/google/common/collect/TopKSelector.java @@ -184,8 +184,10 @@ final class TopKSelector< } iterations++; if (iterations >= maxIterations) { + @SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts + T[] castBuffer = (T[]) buffer; // We've already taken O(k log k), let's make sure we don't take longer than O(k log k). - Arrays.sort(buffer, left, right + 1, comparator); + Arrays.sort(castBuffer, left, right + 1, comparator); break; } } @@ -263,7 +265,9 @@ final class TopKSelector< * this {@code TopKSelector}. This method returns in O(k log k) time. */ public List<T> topK() { - Arrays.sort(buffer, 0, bufferSize, comparator); + @SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts + T[] castBuffer = (T[]) buffer; + Arrays.sort(castBuffer, 0, bufferSize, comparator); if (bufferSize > k) { Arrays.fill(buffer, k, buffer.length, null); bufferSize = k; diff --git a/android/guava/src/com/google/common/collect/TreeBasedTable.java b/android/guava/src/com/google/common/collect/TreeBasedTable.java index 315404aaf..9ef210a54 100644 --- a/android/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/android/guava/src/com/google/common/collect/TreeBasedTable.java @@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Objects.requireNonNull; import com.google.common.annotations.GwtCompatible; -import com.google.common.base.Function; import com.google.common.base.Supplier; import java.io.Serializable; import java.util.Comparator; @@ -60,7 +59,7 @@ import javax.annotation.CheckForNull; * concurrently and one of the threads modifies the table, it must be synchronized externally. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @author Louis Wasserman @@ -313,18 +312,12 @@ public class TreeBasedTable<R, C, V> extends StandardRowSortedTable<R, C, V> { /** Overridden column iterator to return columns values in globally sorted order. */ @Override Iterator<C> createColumnKeyIterator() { - final Comparator<? super C> comparator = columnComparator(); + Comparator<? super C> comparator = columnComparator(); - final Iterator<C> merged = + Iterator<C> merged = Iterators.mergeSorted( Iterables.transform( - backingMap.values(), - new Function<Map<C, V>, Iterator<C>>() { - @Override - public Iterator<C> apply(Map<C, V> input) { - return input.keySet().iterator(); - } - }), + backingMap.values(), (Map<C, V> input) -> input.keySet().iterator()), comparator); return new AbstractIterator<C>() { diff --git a/android/guava/src/com/google/common/collect/TreeMultimap.java b/android/guava/src/com/google/common/collect/TreeMultimap.java index 04ae2074a..dd0c2f833 100644 --- a/android/guava/src/com/google/common/collect/TreeMultimap.java +++ b/android/guava/src/com/google/common/collect/TreeMultimap.java @@ -64,8 +64,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedSortedSetMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @author Louis Wasserman @@ -136,7 +135,7 @@ public class TreeMultimap<K extends @Nullable Object, V extends @Nullable Object */ @Override SortedSet<V> createCollection() { - return new TreeSet<V>(valueComparator); + return new TreeSet<>(valueComparator); } @Override diff --git a/android/guava/src/com/google/common/collect/TreeMultiset.java b/android/guava/src/com/google/common/collect/TreeMultiset.java index c64c35a6a..bcaa10881 100644 --- a/android/guava/src/com/google/common/collect/TreeMultiset.java +++ b/android/guava/src/com/google/common/collect/TreeMultiset.java @@ -49,8 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * java.util.Collection} contract, which is specified in terms of {@link Object#equals}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Louis Wasserman * @author Jared Levy diff --git a/android/guava/src/com/google/common/collect/TreeRangeSet.java b/android/guava/src/com/google/common/collect/TreeRangeSet.java index 8308880a5..7ba71139e 100644 --- a/android/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/android/guava/src/com/google/common/collect/TreeRangeSet.java @@ -48,7 +48,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> /** Creates an empty {@code TreeRangeSet} instance. */ public static <C extends Comparable<?>> TreeRangeSet<C> create() { - return new TreeRangeSet<C>(new TreeMap<Cut<C>, Range<C>>()); + return new TreeRangeSet<>(new TreeMap<Cut<C>, Range<C>>()); } /** Returns a {@code TreeRangeSet} initialized with the ranges in the specified range set. */ @@ -306,7 +306,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> window) { if (window.isConnected(upperBoundWindow)) { - return new RangesByUpperBound<C>(rangesByLowerBound, window.intersection(upperBoundWindow)); + return new RangesByUpperBound<>(rangesByLowerBound, window.intersection(upperBoundWindow)); } else { return ImmutableSortedMap.of(); } @@ -368,7 +368,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> * We want to start the iteration at the first range where the upper bound is in * upperBoundWindow. */ - final Iterator<Range<C>> backingItr; + Iterator<Range<C>> backingItr; if (!upperBoundWindow.hasLowerBound()) { backingItr = rangesByLowerBound.values().iterator(); } else { @@ -415,7 +415,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { candidates = rangesByLowerBound.descendingMap().values(); } - final PeekingIterator<Range<C>> backingItr = Iterators.peekingIterator(candidates.iterator()); + PeekingIterator<Range<C>> backingItr = Iterators.peekingIterator(candidates.iterator()); if (backingItr.hasNext() && upperBoundWindow.upperBound.isLessThan(backingItr.peek().upperBound)) { backingItr.next(); @@ -470,7 +470,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> private ComplementRangesByLowerBound( NavigableMap<Cut<C>, Range<C>> positiveRangesByLowerBound, Range<Cut<C>> window) { this.positiveRangesByLowerBound = positiveRangesByLowerBound; - this.positiveRangesByUpperBound = new RangesByUpperBound<C>(positiveRangesByLowerBound); + this.positiveRangesByUpperBound = new RangesByUpperBound<>(positiveRangesByLowerBound); this.complementLowerBoundWindow = window; } @@ -479,7 +479,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> return ImmutableSortedMap.of(); } else { subWindow = subWindow.intersection(complementLowerBoundWindow); - return new ComplementRangesByLowerBound<C>(positiveRangesByLowerBound, subWindow); + return new ComplementRangesByLowerBound<>(positiveRangesByLowerBound, subWindow); } } @@ -529,9 +529,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { positiveRanges = positiveRangesByUpperBound.values(); } - final PeekingIterator<Range<C>> positiveItr = - Iterators.peekingIterator(positiveRanges.iterator()); - final Cut<C> firstComplementRangeLowerBound; + PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator(positiveRanges.iterator()); + Cut<C> firstComplementRangeLowerBound; if (complementLowerBoundWindow.contains(Cut.<C>belowAll()) && (!positiveItr.hasNext() || positiveItr.peek().lowerBound != Cut.<C>belowAll())) { firstComplementRangeLowerBound = Cut.belowAll(); @@ -581,7 +580,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> boolean inclusive = complementLowerBoundWindow.hasUpperBound() && complementLowerBoundWindow.upperBoundType() == BoundType.CLOSED; - final PeekingIterator<Range<C>> positiveItr = + PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator( positiveRangesByUpperBound .headMap(startingPoint, inclusive) @@ -600,8 +599,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { cut = positiveRangesByLowerBound.higherKey(Cut.<C>belowAll()); } - final Cut<C> firstComplementRangeUpperBound = - MoreObjects.firstNonNull(cut, Cut.<C>aboveAll()); + Cut<C> firstComplementRangeUpperBound = MoreObjects.firstNonNull(cut, Cut.<C>aboveAll()); return new AbstractIterator<Entry<Cut<C>, Range<C>>>() { Cut<C> nextComplementRangeUpperBound = firstComplementRangeUpperBound; @@ -708,14 +706,14 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> this.lowerBoundWindow = checkNotNull(lowerBoundWindow); this.restriction = checkNotNull(restriction); this.rangesByLowerBound = checkNotNull(rangesByLowerBound); - this.rangesByUpperBound = new RangesByUpperBound<C>(rangesByLowerBound); + this.rangesByUpperBound = new RangesByUpperBound<>(rangesByLowerBound); } private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> window) { if (!window.isConnected(lowerBoundWindow)) { return ImmutableSortedMap.of(); } else { - return new SubRangeSetRangesByLowerBound<C>( + return new SubRangeSetRangesByLowerBound<>( lowerBoundWindow.intersection(window), restriction, rangesByLowerBound); } } @@ -786,7 +784,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> if (restriction.isEmpty()) { return Iterators.emptyIterator(); } - final Iterator<Range<C>> completeRangeItr; + Iterator<Range<C>> completeRangeItr; if (lowerBoundWindow.upperBound.isLessThan(restriction.lowerBound)) { return Iterators.emptyIterator(); } else if (lowerBoundWindow.lowerBound.isLessThan(restriction.lowerBound)) { @@ -803,7 +801,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> .values() .iterator(); } - final Cut<Cut<C>> upperBoundOnLowerBounds = + Cut<Cut<C>> upperBoundOnLowerBounds = Ordering.natural() .min(lowerBoundWindow.upperBound, Cut.belowValue(restriction.upperBound)); return new AbstractIterator<Entry<Cut<C>, Range<C>>>() { @@ -832,7 +830,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> Cut<Cut<C>> upperBoundOnLowerBounds = Ordering.natural() .min(lowerBoundWindow.upperBound, Cut.belowValue(restriction.upperBound)); - final Iterator<Range<C>> completeRangeItr = + Iterator<Range<C>> completeRangeItr = rangesByLowerBound .headMap( upperBoundOnLowerBounds.endpoint(), diff --git a/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java index 59bd2ce31..31f3c7197 100644 --- a/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -64,7 +64,7 @@ final class UnmodifiableSortedMultiset<E extends @Nullable Object> extends Unmod public SortedMultiset<E> descendingMultiset() { UnmodifiableSortedMultiset<E> result = descendingMultiset; if (result == null) { - result = new UnmodifiableSortedMultiset<E>(delegate().descendingMultiset()); + result = new UnmodifiableSortedMultiset<>(delegate().descendingMultiset()); result.descendingMultiset = this; return descendingMultiset = result; } diff --git a/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java b/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java index 20e856348..dbe6e3568 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Map; import javax.annotation.CheckForNull; @@ -41,7 +40,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class ArrayBasedCharEscaper extends CharEscaper { diff --git a/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java b/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java index a0883fea2..efc77d058 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.VisibleForTesting; import java.util.Collections; @@ -36,7 +35,6 @@ import java.util.Map; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class ArrayBasedEscaperMap { diff --git a/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java index 5ea780712..355faaa10 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Map; import javax.annotation.CheckForNull; @@ -41,7 +40,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class ArrayBasedUnicodeEscaper extends UnicodeEscaper { diff --git a/android/guava/src/com/google/common/escape/CharEscaper.java b/android/guava/src/com/google/common/escape/CharEscaper.java index 55090f698..136240ec6 100644 --- a/android/guava/src/com/google/common/escape/CharEscaper.java +++ b/android/guava/src/com/google/common/escape/CharEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; @@ -40,7 +39,6 @@ import javax.annotation.CheckForNull; * @author Sven Mawson * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class CharEscaper extends Escaper { diff --git a/android/guava/src/com/google/common/escape/CharEscaperBuilder.java b/android/guava/src/com/google/common/escape/CharEscaperBuilder.java index cbe6958f3..97528cb56 100644 --- a/android/guava/src/com/google/common/escape/CharEscaperBuilder.java +++ b/android/guava/src/com/google/common/escape/CharEscaperBuilder.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.HashMap; @@ -34,7 +33,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Sven Mawson * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class CharEscaperBuilder { diff --git a/android/guava/src/com/google/common/escape/Escaper.java b/android/guava/src/com/google/common/escape/Escaper.java index cdfe4e92a..31b7df0e6 100644 --- a/android/guava/src/com/google/common/escape/Escaper.java +++ b/android/guava/src/com/google/common/escape/Escaper.java @@ -85,13 +85,7 @@ public abstract class Escaper { */ public abstract String escape(String string); - private final Function<String, String> asFunction = - new Function<String, String>() { - @Override - public String apply(String from) { - return escape(from); - } - }; + private final Function<String, String> asFunction = this::escape; /** Returns a {@link Function} that invokes {@link #escape(String)} on this escaper. */ public final Function<String, String> asFunction() { diff --git a/android/guava/src/com/google/common/escape/Escapers.java b/android/guava/src/com/google/common/escape/Escapers.java index 41af6688e..acfb82ce2 100644 --- a/android/guava/src/com/google/common/escape/Escapers.java +++ b/android/guava/src/com/google/common/escape/Escapers.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.HashMap; @@ -31,7 +30,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class Escapers { @@ -93,7 +91,6 @@ public final class Escapers { * @author David Beaumont * @since 15.0 */ - @Beta public static final class Builder { private final Map<Character, String> replacementMap = new HashMap<>(); private char safeMin = Character.MIN_VALUE; @@ -228,7 +225,7 @@ public final class Escapers { } /** Private helper to wrap a CharEscaper as a UnicodeEscaper. */ - private static UnicodeEscaper wrap(final CharEscaper escaper) { + private static UnicodeEscaper wrap(CharEscaper escaper) { return new UnicodeEscaper() { @Override @CheckForNull diff --git a/android/guava/src/com/google/common/escape/ParametricNullness.java b/android/guava/src/com/google/common/escape/ParametricNullness.java index 2f03d59f3..d9412065f 100644 --- a/android/guava/src/com/google/common/escape/ParametricNullness.java +++ b/android/guava/src/com/google/common/escape/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/escape/UnicodeEscaper.java b/android/guava/src/com/google/common/escape/UnicodeEscaper.java index c10ae34cd..280915c75 100644 --- a/android/guava/src/com/google/common/escape/UnicodeEscaper.java +++ b/android/guava/src/com/google/common/escape/UnicodeEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; @@ -50,7 +49,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class UnicodeEscaper extends Escaper { diff --git a/android/guava/src/com/google/common/eventbus/ParametricNullness.java b/android/guava/src/com/google/common/eventbus/ParametricNullness.java index fc5bb175f..ac91392f7 100644 --- a/android/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/android/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/eventbus/Subscriber.java b/android/guava/src/com/google/common/eventbus/Subscriber.java index 73e7f420a..71ee197c9 100644 --- a/android/guava/src/com/google/common/eventbus/Subscriber.java +++ b/android/guava/src/com/google/common/eventbus/Subscriber.java @@ -64,16 +64,13 @@ class Subscriber { } /** Dispatches {@code event} to this subscriber using the proper executor. */ - final void dispatchEvent(final Object event) { + final void dispatchEvent(Object event) { executor.execute( - new Runnable() { - @Override - public void run() { - try { - invokeSubscriberMethod(event); - } catch (InvocationTargetException e) { - bus.handleSubscriberException(e.getCause(), context(event)); - } + () -> { + try { + invokeSubscriberMethod(event); + } catch (InvocationTargetException e) { + bus.handleSubscriberException(e.getCause(), context(event)); } }); } diff --git a/android/guava/src/com/google/common/graph/AbstractBaseGraph.java b/android/guava/src/com/google/common/graph/AbstractBaseGraph.java index c4be6b631..797468b7a 100644 --- a/android/guava/src/com/google/common/graph/AbstractBaseGraph.java +++ b/android/guava/src/com/google/common/graph/AbstractBaseGraph.java @@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static com.google.common.graph.GraphConstants.ENDPOINTS_MISMATCH; -import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; import com.google.common.collect.Sets; @@ -115,31 +114,16 @@ abstract class AbstractBaseGraph<N> implements BaseGraph<N> { Iterators.concat( Iterators.transform( graph.predecessors(node).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N predecessor) { - return EndpointPair.ordered(predecessor, node); - } - }), + (N predecessor) -> EndpointPair.ordered(predecessor, node)), Iterators.transform( // filter out 'node' from successors (already covered by predecessors, above) Sets.difference(graph.successors(node), ImmutableSet.of(node)).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N successor) { - return EndpointPair.ordered(node, successor); - } - }))); + (N successor) -> EndpointPair.ordered(node, successor)))); } else { return Iterators.unmodifiableIterator( Iterators.transform( graph.adjacentNodes(node).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N adjacentNode) { - return EndpointPair.unordered(node, adjacentNode); - } - })); + (N adjacentNode) -> EndpointPair.unordered(node, adjacentNode))); } } }; diff --git a/android/guava/src/com/google/common/graph/DirectedGraphConnections.java b/android/guava/src/com/google/common/graph/DirectedGraphConnections.java index 23083da32..0feb973f3 100644 --- a/android/guava/src/com/google/common/graph/DirectedGraphConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedGraphConnections.java @@ -163,13 +163,13 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { orderedNodeConnections = null; break; case STABLE: - orderedNodeConnections = new ArrayList<NodeConnection<N>>(); + orderedNodeConnections = new ArrayList<>(); break; default: throw new AssertionError(incidentEdgeOrder.type()); } - return new DirectedGraphConnections<N, V>( + return new DirectedGraphConnections<>( /* adjacentNodeValues = */ new HashMap<N, Object>(initialCapacity, INNER_LOAD_FACTOR), orderedNodeConnections, /* predecessorCount = */ 0, @@ -239,8 +239,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { return new AbstractSet<N>() { @Override public UnmodifiableIterator<N> iterator() { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); - final Set<N> seenNodes = new HashSet<>(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Set<N> seenNodes = new HashSet<>(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -276,7 +276,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { @Override public UnmodifiableIterator<N> iterator() { if (orderedNodeConnections == null) { - final Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); + Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -291,7 +291,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } }; } else { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -326,7 +326,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { @Override public UnmodifiableIterator<N> iterator() { if (orderedNodeConnections == null) { - final Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); + Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -341,7 +341,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } }; } else { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -371,46 +371,33 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } @Override - public Iterator<EndpointPair<N>> incidentEdgeIterator(final N thisNode) { + public Iterator<EndpointPair<N>> incidentEdgeIterator(N thisNode) { checkNotNull(thisNode); - final Iterator<EndpointPair<N>> resultWithDoubleSelfLoop; + Iterator<EndpointPair<N>> resultWithDoubleSelfLoop; if (orderedNodeConnections == null) { resultWithDoubleSelfLoop = Iterators.concat( Iterators.transform( predecessors().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N predecessor) { - return EndpointPair.ordered(predecessor, thisNode); - } - }), + (N predecessor) -> EndpointPair.ordered(predecessor, thisNode)), Iterators.transform( successors().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N successor) { - return EndpointPair.ordered(thisNode, successor); - } - })); + (N successor) -> EndpointPair.ordered(thisNode, successor))); } else { resultWithDoubleSelfLoop = Iterators.transform( orderedNodeConnections.iterator(), - new Function<NodeConnection<N>, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(NodeConnection<N> connection) { - if (connection instanceof NodeConnection.Succ) { - return EndpointPair.ordered(thisNode, connection.node); - } else { - return EndpointPair.ordered(connection.node, thisNode); - } + (NodeConnection<N> connection) -> { + if (connection instanceof NodeConnection.Succ) { + return EndpointPair.ordered(thisNode, connection.node); + } else { + return EndpointPair.ordered(connection.node, thisNode); } }); } - final AtomicBoolean alreadySeenSelfLoop = new AtomicBoolean(false); + AtomicBoolean alreadySeenSelfLoop = new AtomicBoolean(false); return new AbstractIterator<EndpointPair<N>>() { @Override @CheckForNull diff --git a/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index 05f40c290..bd0e546f2 100644 --- a/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -93,7 +93,7 @@ final class DirectedMultiNetworkConnections<N, E> extends AbstractDirectedNetwor } @Override - public Set<E> edgesConnecting(final N node) { + public Set<E> edgesConnecting(N node) { return new MultiEdgesConnecting<E>(outEdgeMap, node) { @Override public int size() { diff --git a/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java index c2a25a5ad..e1db65708 100644 --- a/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java @@ -62,6 +62,6 @@ final class DirectedNetworkConnections<N, E> extends AbstractDirectedNetworkConn @Override public Set<E> edgesConnecting(N node) { - return new EdgesConnecting<E>(((BiMap<E, N>) outEdgeMap).inverse(), node); + return new EdgesConnecting<>(((BiMap<E, N>) outEdgeMap).inverse(), node); } } diff --git a/android/guava/src/com/google/common/graph/ElementOrder.java b/android/guava/src/com/google/common/graph/ElementOrder.java index ea13674c6..b5985a280 100644 --- a/android/guava/src/com/google/common/graph/ElementOrder.java +++ b/android/guava/src/com/google/common/graph/ElementOrder.java @@ -80,7 +80,7 @@ public final class ElementOrder<T> { /** Returns an instance which specifies that no ordering is guaranteed. */ public static <S> ElementOrder<S> unordered() { - return new ElementOrder<S>(Type.UNORDERED, null); + return new ElementOrder<>(Type.UNORDERED, null); } /** @@ -120,19 +120,19 @@ public final class ElementOrder<T> { * @since 29.0 */ public static <S> ElementOrder<S> stable() { - return new ElementOrder<S>(Type.STABLE, null); + return new ElementOrder<>(Type.STABLE, null); } /** Returns an instance which specifies that insertion ordering is guaranteed. */ public static <S> ElementOrder<S> insertion() { - return new ElementOrder<S>(Type.INSERTION, null); + return new ElementOrder<>(Type.INSERTION, null); } /** * Returns an instance which specifies that the natural ordering of the elements is guaranteed. */ public static <S extends Comparable<? super S>> ElementOrder<S> natural() { - return new ElementOrder<S>(Type.SORTED, Ordering.<S>natural()); + return new ElementOrder<>(Type.SORTED, Ordering.<S>natural()); } /** @@ -140,7 +140,7 @@ public final class ElementOrder<T> { * determined by {@code comparator}. */ public static <S> ElementOrder<S> sorted(Comparator<S> comparator) { - return new ElementOrder<S>(Type.SORTED, checkNotNull(comparator)); + return new ElementOrder<>(Type.SORTED, checkNotNull(comparator)); } /** Returns the type of ordering used. */ diff --git a/android/guava/src/com/google/common/graph/EndpointPair.java b/android/guava/src/com/google/common/graph/EndpointPair.java index 7aa38606d..fe2397c6b 100644 --- a/android/guava/src/com/google/common/graph/EndpointPair.java +++ b/android/guava/src/com/google/common/graph/EndpointPair.java @@ -51,13 +51,13 @@ public abstract class EndpointPair<N> implements Iterable<N> { /** Returns an {@link EndpointPair} representing the endpoints of a directed edge. */ public static <N> EndpointPair<N> ordered(N source, N target) { - return new Ordered<N>(source, target); + return new Ordered<>(source, target); } /** Returns an {@link EndpointPair} representing the endpoints of an undirected edge. */ public static <N> EndpointPair<N> unordered(N nodeU, N nodeV) { // Swap nodes on purpose to prevent callers from relying on the "ordering" of an unordered pair. - return new Unordered<N>(nodeV, nodeU); + return new Unordered<>(nodeV, nodeU); } /** Returns an {@link EndpointPair} representing the endpoints of an edge in {@code graph}. */ diff --git a/android/guava/src/com/google/common/graph/GraphBuilder.java b/android/guava/src/com/google/common/graph/GraphBuilder.java index d57ed3771..8c0871b46 100644 --- a/android/guava/src/com/google/common/graph/GraphBuilder.java +++ b/android/guava/src/com/google/common/graph/GraphBuilder.java @@ -171,7 +171,7 @@ public final class GraphBuilder<N> extends AbstractGraphBuilder<N> { /** Returns an empty {@link MutableGraph} with the properties of this {@link GraphBuilder}. */ public <N1 extends N> MutableGraph<N1> build() { - return new StandardMutableGraph<N1>(this); + return new StandardMutableGraph<>(this); } GraphBuilder<N> copy() { diff --git a/android/guava/src/com/google/common/graph/ImmutableGraph.java b/android/guava/src/com/google/common/graph/ImmutableGraph.java index afad211a1..f829e9699 100644 --- a/android/guava/src/com/google/common/graph/ImmutableGraph.java +++ b/android/guava/src/com/google/common/graph/ImmutableGraph.java @@ -87,7 +87,7 @@ public class ImmutableGraph<N> extends ForwardingGraph<N> { for (N node : graph.nodes()) { nodeConnections.put(node, connectionsOf(graph, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } @SuppressWarnings("unchecked") diff --git a/android/guava/src/com/google/common/graph/ImmutableNetwork.java b/android/guava/src/com/google/common/graph/ImmutableNetwork.java index cb636aa28..c29f8a392 100644 --- a/android/guava/src/com/google/common/graph/ImmutableNetwork.java +++ b/android/guava/src/com/google/common/graph/ImmutableNetwork.java @@ -73,7 +73,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { @Override public ImmutableGraph<N> asGraph() { - return new ImmutableGraph<N>(super.asGraph()); // safe because the view is effectively immutable + return new ImmutableGraph<>(super.asGraph()); // safe because the view is effectively immutable } private static <N, E> Map<N, NetworkConnections<N, E>> getNodeConnections(Network<N, E> network) { @@ -84,7 +84,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { for (N node : network.nodes()) { nodeConnections.put(node, connectionsOf(network, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } private static <N, E> Map<E, N> getEdgeToReferenceNode(Network<N, E> network) { @@ -95,7 +95,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { for (E edge : network.edges()) { edgeToReferenceNode.put(edge, network.incidentNodes(edge).nodeU()); } - return edgeToReferenceNode.build(); + return edgeToReferenceNode.buildOrThrow(); } private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) { @@ -115,31 +115,16 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { } } - private static <N, E> Function<E, N> sourceNodeFn(final Network<N, E> network) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).source(); - } - }; + private static <N, E> Function<E, N> sourceNodeFn(Network<N, E> network) { + return (E edge) -> network.incidentNodes(edge).source(); } - private static <N, E> Function<E, N> targetNodeFn(final Network<N, E> network) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).target(); - } - }; + private static <N, E> Function<E, N> targetNodeFn(Network<N, E> network) { + return (E edge) -> network.incidentNodes(edge).target(); } - private static <N, E> Function<E, N> adjacentNodeFn(final Network<N, E> network, final N node) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).adjacentNode(node); - } - }; + private static <N, E> Function<E, N> adjacentNodeFn(Network<N, E> network, N node) { + return (E edge) -> network.incidentNodes(edge).adjacentNode(node); } /** diff --git a/android/guava/src/com/google/common/graph/ImmutableValueGraph.java b/android/guava/src/com/google/common/graph/ImmutableValueGraph.java index a1567dacb..eb17067fc 100644 --- a/android/guava/src/com/google/common/graph/ImmutableValueGraph.java +++ b/android/guava/src/com/google/common/graph/ImmutableValueGraph.java @@ -75,7 +75,7 @@ public final class ImmutableValueGraph<N, V> extends StandardValueGraph<N, V> { @Override public ImmutableGraph<N> asGraph() { - return new ImmutableGraph<N>(this); // safe because the view is effectively immutable + return new ImmutableGraph<>(this); // safe because the view is effectively immutable } private static <N, V> ImmutableMap<N, GraphConnections<N, V>> getNodeConnections( @@ -87,19 +87,14 @@ public final class ImmutableValueGraph<N, V> extends StandardValueGraph<N, V> { for (N node : graph.nodes()) { nodeConnections.put(node, connectionsOf(graph, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } - private static <N, V> GraphConnections<N, V> connectionsOf( - final ValueGraph<N, V> graph, final N node) { + private static <N, V> GraphConnections<N, V> connectionsOf(ValueGraph<N, V> graph, N node) { Function<N, V> successorNodeToValueFn = - new Function<N, V>() { - @Override - public V apply(N successorNode) { + (N successorNode) -> // requireNonNull is safe because the endpoint pair comes from the graph. - return requireNonNull(graph.edgeValueOrDefault(node, successorNode, null)); - } - }; + requireNonNull(graph.edgeValueOrDefault(node, successorNode, null)); return graph.isDirected() ? DirectedGraphConnections.ofImmutable( node, graph.incidentEdges(node), successorNodeToValueFn) diff --git a/android/guava/src/com/google/common/graph/MapIteratorCache.java b/android/guava/src/com/google/common/graph/MapIteratorCache.java index aae91874c..05cdde8c3 100644 --- a/android/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/android/guava/src/com/google/common/graph/MapIteratorCache.java @@ -108,7 +108,7 @@ class MapIteratorCache<K, V> { return new AbstractSet<K>() { @Override public UnmodifiableIterator<K> iterator() { - final Iterator<Entry<K, V>> entryIterator = backingMap.entrySet().iterator(); + Iterator<Entry<K, V>> entryIterator = backingMap.entrySet().iterator(); return new UnmodifiableIterator<K>() { @Override diff --git a/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java index 8a4250e6b..620f986a5 100644 --- a/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java +++ b/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java @@ -48,7 +48,7 @@ abstract class MultiEdgesConnecting<E> extends AbstractSet<E> { @Override public UnmodifiableIterator<E> iterator() { - final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator(); + Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator(); return new AbstractIterator<E>() { @Override @CheckForNull diff --git a/android/guava/src/com/google/common/graph/ParametricNullness.java b/android/guava/src/com/google/common/graph/ParametricNullness.java index 62534eb4c..87ff930a4 100644 --- a/android/guava/src/com/google/common/graph/ParametricNullness.java +++ b/android/guava/src/com/google/common/graph/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/graph/StandardValueGraph.java b/android/guava/src/com/google/common/graph/StandardValueGraph.java index f2c71bc22..ab3ae582b 100644 --- a/android/guava/src/com/google/common/graph/StandardValueGraph.java +++ b/android/guava/src/com/google/common/graph/StandardValueGraph.java @@ -118,7 +118,7 @@ class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> { @Override public Set<EndpointPair<N>> incidentEdges(N node) { - final GraphConnections<N, V> connections = checkedConnections(node); + GraphConnections<N, V> connections = checkedConnections(node); return new IncidentEdgeSet<N>(this, node) { @Override diff --git a/android/guava/src/com/google/common/graph/Traverser.java b/android/guava/src/com/google/common/graph/Traverser.java index 5a36f9f89..fb594b440 100644 --- a/android/guava/src/com/google/common/graph/Traverser.java +++ b/android/guava/src/com/google/common/graph/Traverser.java @@ -96,7 +96,7 @@ public abstract class Traverser<N> { * * @param graph {@link SuccessorsFunction} representing a general graph that may have cycles. */ - public static <N> Traverser<N> forGraph(final SuccessorsFunction<N> graph) { + public static <N> Traverser<N> forGraph(SuccessorsFunction<N> graph) { return new Traverser<N>(graph) { @Override Traversal<N> newTraversal() { @@ -178,7 +178,7 @@ public abstract class Traverser<N> { * @param tree {@link SuccessorsFunction} representing a directed acyclic graph that has at most * one path between any two nodes */ - public static <N> Traverser<N> forTree(final SuccessorsFunction<N> tree) { + public static <N> Traverser<N> forTree(SuccessorsFunction<N> tree) { if (tree instanceof BaseGraph) { checkArgument(((BaseGraph<?>) tree).isDirected(), "Undirected graphs can never be trees."); } @@ -239,7 +239,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> breadthFirst(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -294,7 +294,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> depthFirstPreOrder(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -349,7 +349,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> depthFirstPostOrder(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -382,7 +382,7 @@ public abstract class Traverser<N> { } static <N> Traversal<N> inGraph(SuccessorsFunction<N> graph) { - final Set<N> visited = new HashSet<>(); + Set<N> visited = new HashSet<>(); return new Traversal<N>(graph) { @Override @CheckForNull @@ -438,8 +438,8 @@ public abstract class Traverser<N> { * determined by the {@code InsertionOrder} parameter: nieces are placed at the FRONT before * aunts for pre-order; while in BFS they are placed at the BACK after aunts. */ - private Iterator<N> topDown(Iterator<? extends N> startNodes, final InsertionOrder order) { - final Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); + private Iterator<N> topDown(Iterator<? extends N> startNodes, InsertionOrder order) { + Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); horizon.add(startNodes); return new AbstractIterator<N>() { @Override @@ -463,8 +463,8 @@ public abstract class Traverser<N> { } final Iterator<N> postOrder(Iterator<? extends N> startNodes) { - final Deque<N> ancestorStack = new ArrayDeque<>(); - final Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); + Deque<N> ancestorStack = new ArrayDeque<>(); + Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); horizon.add(startNodes); return new AbstractIterator<N>() { @Override diff --git a/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java index 085e3a74a..4eeb2328f 100644 --- a/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.graph.GraphConstants.INNER_CAPACITY; import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR; -import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import java.util.Collections; @@ -79,15 +78,10 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> { } @Override - public Iterator<EndpointPair<N>> incidentEdgeIterator(final N thisNode) { + public Iterator<EndpointPair<N>> incidentEdgeIterator(N thisNode) { return Iterators.transform( adjacentNodeValues.keySet().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N incidentNode) { - return EndpointPair.unordered(thisNode, incidentNode); - } - }); + (N incidentNode) -> EndpointPair.unordered(thisNode, incidentNode)); } @Override diff --git a/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index a5c45ca11..6caac3b71 100644 --- a/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -73,7 +73,7 @@ final class UndirectedMultiNetworkConnections<N, E> } @Override - public Set<E> edgesConnecting(final N node) { + public Set<E> edgesConnecting(N node) { return new MultiEdgesConnecting<E>(incidentEdgeMap, node) { @Override public int size() { diff --git a/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java index 38cb7639e..190897f88 100644 --- a/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java @@ -54,6 +54,6 @@ final class UndirectedNetworkConnections<N, E> extends AbstractUndirectedNetwork @Override public Set<E> edgesConnecting(N node) { - return new EdgesConnecting<E>(((BiMap<E, N>) incidentEdgeMap).inverse(), node); + return new EdgesConnecting<>(((BiMap<E, N>) incidentEdgeMap).inverse(), node); } } diff --git a/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java b/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java index 4b69bb721..820fe963b 100644 --- a/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java +++ b/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java @@ -70,7 +70,7 @@ abstract class AbstractCompositeHashFunction extends AbstractHashFunction { return fromHashers(hashers); } - private Hasher fromHashers(final Hasher[] hashers) { + private Hasher fromHashers(Hasher[] hashers) { return new Hasher() { @Override public Hasher putByte(byte b) { diff --git a/android/guava/src/com/google/common/hash/BloomFilter.java b/android/guava/src/com/google/common/hash/BloomFilter.java index 6ffe583f8..331d160dc 100644 --- a/android/guava/src/com/google/common/hash/BloomFilter.java +++ b/android/guava/src/com/google/common/hash/BloomFilter.java @@ -23,6 +23,7 @@ import com.google.common.base.Objects; import com.google.common.base.Predicate; import com.google.common.hash.BloomFilterStrategies.LockFreeBitArray; import com.google.common.math.DoubleMath; +import com.google.common.math.LongMath; import com.google.common.primitives.SignedBytes; import com.google.common.primitives.UnsignedBytes; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -540,11 +541,13 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate< dataLength = din.readInt(); Strategy strategy = BloomFilterStrategies.values()[strategyOrdinal]; - long[] data = new long[dataLength]; - for (int i = 0; i < data.length; i++) { - data[i] = din.readLong(); + + LockFreeBitArray dataArray = new LockFreeBitArray(LongMath.checkedMultiply(dataLength, 64L)); + for (int i = 0; i < dataLength; i++) { + dataArray.putData(i, din.readLong()); } - return new BloomFilter<T>(new LockFreeBitArray(data), numHashFunctions, funnel, strategy); + + return new BloomFilter<T>(dataArray, numHashFunctions, funnel, strategy); } catch (RuntimeException e) { String message = "Unable to deserialize BloomFilter from InputStream." diff --git a/android/guava/src/com/google/common/hash/BloomFilterStrategies.java b/android/guava/src/com/google/common/hash/BloomFilterStrategies.java index 3a012f358..876269e9c 100644 --- a/android/guava/src/com/google/common/hash/BloomFilterStrategies.java +++ b/android/guava/src/com/google/common/hash/BloomFilterStrategies.java @@ -263,27 +263,38 @@ enum BloomFilterStrategies implements BloomFilter.Strategy { data.length(), other.data.length()); for (int i = 0; i < data.length(); i++) { - long otherLong = other.data.get(i); - - long ourLongOld; - long ourLongNew; - boolean changedAnyBits = true; - do { - ourLongOld = data.get(i); - ourLongNew = ourLongOld | otherLong; - if (ourLongOld == ourLongNew) { - changedAnyBits = false; - break; - } - } while (!data.compareAndSet(i, ourLongOld, ourLongNew)); + putData(i, other.data.get(i)); + } + } - if (changedAnyBits) { - int bitsAdded = Long.bitCount(ourLongNew) - Long.bitCount(ourLongOld); - bitCount.add(bitsAdded); + /** + * ORs the bits encoded in the {@code i}th {@code long} in the underlying {@link + * AtomicLongArray} with the given value. + */ + void putData(int i, long longValue) { + long ourLongOld; + long ourLongNew; + boolean changedAnyBits = true; + do { + ourLongOld = data.get(i); + ourLongNew = ourLongOld | longValue; + if (ourLongOld == ourLongNew) { + changedAnyBits = false; + break; } + } while (!data.compareAndSet(i, ourLongOld, ourLongNew)); + + if (changedAnyBits) { + int bitsAdded = Long.bitCount(ourLongNew) - Long.bitCount(ourLongOld); + bitCount.add(bitsAdded); } } + /** Returns the number of {@code long}s in the underlying {@link AtomicLongArray}. */ + int dataLength() { + return data.length(); + } + @Override public boolean equals(@CheckForNull Object o) { if (o instanceof LockFreeBitArray) { diff --git a/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java b/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java index 7d6a3981d..3437b00a2 100644 --- a/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java +++ b/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java @@ -170,7 +170,7 @@ final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction { * Compute an 8-byte hash of a byte array of length greater than 64 bytes. */ private static long hashLength65Plus(byte[] bytes, int offset, int length) { - final int seed = 81; + int seed = 81; // For strings over 64 bytes we loop. Internal state consists of 56 bytes: v, w, x, y, and z. long x = seed; @SuppressWarnings("ConstantOverflow") diff --git a/android/guava/src/com/google/common/hash/Fingerprint2011.java b/android/guava/src/com/google/common/hash/Fingerprint2011.java new file mode 100644 index 000000000..1b01e0092 --- /dev/null +++ b/android/guava/src/com/google/common/hash/Fingerprint2011.java @@ -0,0 +1,198 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +package com.google.common.hash; + +import static com.google.common.base.Preconditions.checkPositionIndexes; +import static com.google.common.hash.LittleEndianByteArray.load64; +import static com.google.common.hash.LittleEndianByteArray.load64Safely; +import static java.lang.Long.rotateRight; + +import com.google.common.annotations.VisibleForTesting; + +/** + * Implementation of Geoff Pike's fingerprint2011 hash function. See {@link Hashing#fingerprint2011} + * for information on the behaviour of the algorithm. + * + * <p>On Intel Core2 2.66, on 1000 bytes, fingerprint2011 takes 0.9 microseconds compared to + * fingerprint at 4.0 microseconds and md5 at 4.5 microseconds. + * + * <p>Note to maintainers: This implementation relies on signed arithmetic being bit-wise equivalent + * to unsigned arithmetic in all cases except: + * + * <ul> + * <li>comparisons (signed values can be negative) + * <li>division (avoided here) + * <li>shifting (right shift must be unsigned) + * </ul> + * + * @author kylemaddison@google.com (Kyle Maddison) + * @author gpike@google.com (Geoff Pike) + */ +@ElementTypesAreNonnullByDefault +final class Fingerprint2011 extends AbstractNonStreamingHashFunction { + static final HashFunction FINGERPRINT_2011 = new Fingerprint2011(); + + // Some primes between 2^63 and 2^64 for various uses. + private static final long K0 = 0xa5b85c5e198ed849L; + private static final long K1 = 0x8d58ac26afe12e47L; + private static final long K2 = 0xc47b6e9e3a970ed3L; + private static final long K3 = 0xc6a4a7935bd1e995L; + + @Override + public HashCode hashBytes(byte[] input, int off, int len) { + checkPositionIndexes(off, off + len, input.length); + return HashCode.fromLong(fingerprint(input, off, len)); + } + + @Override + public int bits() { + return 64; + } + + @Override + public String toString() { + return "Hashing.fingerprint2011()"; + } + + // End of public functions. + + @VisibleForTesting + static long fingerprint(byte[] bytes, int offset, int length) { + long result; + + if (length <= 32) { + result = murmurHash64WithSeed(bytes, offset, length, K0 ^ K1 ^ K2); + } else if (length <= 64) { + result = hashLength33To64(bytes, offset, length); + } else { + result = fullFingerprint(bytes, offset, length); + } + + long u = length >= 8 ? load64(bytes, offset) : K0; + long v = length >= 9 ? load64(bytes, offset + length - 8) : K0; + result = hash128to64(result + v, u); + return result == 0 || result == 1 ? result + ~1 : result; + } + + private static long shiftMix(long val) { + return val ^ (val >>> 47); + } + + /** Implementation of Hash128to64 from util/hash/hash128to64.h */ + @VisibleForTesting + static long hash128to64(long high, long low) { + long a = (low ^ high) * K3; + a ^= (a >>> 47); + long b = (high ^ a) * K3; + b ^= (b >>> 47); + b *= K3; + return b; + } + + /** + * Computes intermediate hash of 32 bytes of byte array from the given offset. Results are + * returned in the output array - this is 12% faster than allocating new arrays every time. + */ + private static void weakHashLength32WithSeeds( + byte[] bytes, int offset, long seedA, long seedB, long[] output) { + long part1 = load64(bytes, offset); + long part2 = load64(bytes, offset + 8); + long part3 = load64(bytes, offset + 16); + long part4 = load64(bytes, offset + 24); + + seedA += part1; + seedB = rotateRight(seedB + seedA + part4, 51); + long c = seedA; + seedA += part2; + seedA += part3; + seedB += rotateRight(seedA, 23); + output[0] = seedA + part4; + output[1] = seedB + c; + } + + /* + * Compute an 8-byte hash of a byte array of length greater than 64 bytes. + */ + private static long fullFingerprint(byte[] bytes, int offset, int length) { + // For lengths over 64 bytes we hash the end first, and then as we + // loop we keep 56 bytes of state: v, w, x, y, and z. + long x = load64(bytes, offset); + long y = load64(bytes, offset + length - 16) ^ K1; + long z = load64(bytes, offset + length - 56) ^ K0; + long[] v = new long[2]; + long[] w = new long[2]; + weakHashLength32WithSeeds(bytes, offset + length - 64, length, y, v); + weakHashLength32WithSeeds(bytes, offset + length - 32, length * K1, K0, w); + z += shiftMix(v[1]) * K1; + x = rotateRight(z + x, 39) * K1; + y = rotateRight(y, 33) * K1; + + // Decrease length to the nearest multiple of 64, and operate on 64-byte chunks. + length = (length - 1) & ~63; + do { + x = rotateRight(x + y + v[0] + load64(bytes, offset + 16), 37) * K1; + y = rotateRight(y + v[1] + load64(bytes, offset + 48), 42) * K1; + x ^= w[1]; + y ^= v[0]; + z = rotateRight(z ^ w[0], 33); + weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v); + weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y, w); + long tmp = z; + z = x; + x = tmp; + offset += 64; + length -= 64; + } while (length != 0); + return hash128to64(hash128to64(v[0], w[0]) + shiftMix(y) * K1 + z, hash128to64(v[1], w[1]) + x); + } + + private static long hashLength33To64(byte[] bytes, int offset, int length) { + long z = load64(bytes, offset + 24); + long a = load64(bytes, offset) + (length + load64(bytes, offset + length - 16)) * K0; + long b = rotateRight(a + z, 52); + long c = rotateRight(a, 37); + a += load64(bytes, offset + 8); + c += rotateRight(a, 7); + a += load64(bytes, offset + 16); + long vf = a + z; + long vs = b + rotateRight(a, 31) + c; + a = load64(bytes, offset + 16) + load64(bytes, offset + length - 32); + z = load64(bytes, offset + length - 8); + b = rotateRight(a + z, 52); + c = rotateRight(a, 37); + a += load64(bytes, offset + length - 24); + c += rotateRight(a, 7); + a += load64(bytes, offset + length - 16); + long wf = a + z; + long ws = b + rotateRight(a, 31) + c; + long r = shiftMix((vf + ws) * K2 + (wf + vs) * K0); + return shiftMix(r * K0 + vs) * K2; + } + + @VisibleForTesting + static long murmurHash64WithSeed(byte[] bytes, int offset, int length, long seed) { + long mul = K3; + int topBit = 0x7; + + int lengthAligned = length & ~topBit; + int lengthRemainder = length & topBit; + long hash = seed ^ (length * mul); + + for (int i = 0; i < lengthAligned; i += 8) { + long loaded = load64(bytes, offset + i); + long data = shiftMix(loaded * mul) * mul; + hash ^= data; + hash *= mul; + } + + if (lengthRemainder != 0) { + long data = load64Safely(bytes, offset + lengthAligned, lengthRemainder); + hash ^= data; + hash *= mul; + } + + hash = shiftMix(hash) * mul; + hash = shiftMix(hash); + return hash; + } +} diff --git a/android/guava/src/com/google/common/hash/Funnels.java b/android/guava/src/com/google/common/hash/Funnels.java index 66738361c..b8e63d504 100644 --- a/android/guava/src/com/google/common/hash/Funnels.java +++ b/android/guava/src/com/google/common/hash/Funnels.java @@ -168,7 +168,7 @@ public final class Funnels { */ public static <E extends @Nullable Object> Funnel<Iterable<? extends E>> sequentialFunnel( Funnel<E> elementFunnel) { - return new SequentialFunnel<E>(elementFunnel); + return new SequentialFunnel<>(elementFunnel); } private static class SequentialFunnel<E extends @Nullable Object> diff --git a/android/guava/src/com/google/common/hash/Hashing.java b/android/guava/src/com/google/common/hash/Hashing.java index dd6536773..afff20c74 100644 --- a/android/guava/src/com/google/common/hash/Hashing.java +++ b/android/guava/src/com/google/common/hash/Hashing.java @@ -17,11 +17,11 @@ package com.google.common.hash; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.errorprone.annotations.Immutable; import java.security.Key; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.zip.Adler32; @@ -42,7 +42,6 @@ import javax.crypto.spec.SecretKeySpec; * @author Kurt Alfred Kluever * @since 11.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class Hashing { /** @@ -470,6 +469,30 @@ public final class Hashing { } /** + * Returns a hash function implementing the Fingerprint2011 hashing function (64 hash bits). + * + * <p>This is designed for generating persistent fingerprints of strings. It isn't + * cryptographically secure, but it produces a high-quality hash with few collisions. Fingerprints + * generated using this are byte-wise identical to those created using the C++ version, but note + * that this uses unsigned integers (see {@link com.google.common.primitives.UnsignedInts}). + * Comparisons between the two should take this into account. + * + * <p>Fingerprint2011() is a form of Murmur2 on strings up to 32 bytes and a form of CityHash for + * longer strings. It could have been one or the other throughout. The main advantage of the + * combination is that CityHash has a bunch of special cases for short strings that don't need to + * be replicated here. The result will never be 0 or 1. + * + * <p>This function is best understood as a <a + * href="https://en.wikipedia.org/wiki/Fingerprint_(computing)">fingerprint</a> rather than a true + * <a href="https://en.wikipedia.org/wiki/Hash_function">hash function</a>. + * + * @since 31.1 + */ + public static HashFunction fingerprint2011() { + return Fingerprint2011.FINGERPRINT_2011; + } + + /** * Assigns to {@code hashCode} a "bucket" in the range {@code [0, buckets)}, in a uniform manner * that minimizes the need for remapping as {@code buckets} grows. That is, {@code * consistentHash(h, n)} equals: @@ -621,7 +644,7 @@ public final class Hashing { List<HashFunction> list = new ArrayList<>(); list.add(first); list.add(second); - list.addAll(Arrays.asList(rest)); + Collections.addAll(list, rest); return new ConcatenatedHashFunction(list.toArray(new HashFunction[0])); } @@ -642,7 +665,7 @@ public final class Hashing { for (HashFunction hashFunction : hashFunctions) { list.add(hashFunction); } - checkArgument(list.size() > 0, "number of hash functions (%s) must be > 0", list.size()); + checkArgument(!list.isEmpty(), "number of hash functions (%s) must be > 0", list.size()); return new ConcatenatedHashFunction(list.toArray(new HashFunction[0])); } diff --git a/android/guava/src/com/google/common/hash/LittleEndianByteArray.java b/android/guava/src/com/google/common/hash/LittleEndianByteArray.java index 15d8b2cfb..625201547 100644 --- a/android/guava/src/com/google/common/hash/LittleEndianByteArray.java +++ b/android/guava/src/com/google/common/hash/LittleEndianByteArray.java @@ -243,7 +243,7 @@ final class LittleEndianByteArray { * which will have an efficient native implementation in JDK 9. * */ - final String arch = System.getProperty("os.arch"); + String arch = System.getProperty("os.arch"); if ("amd64".equals(arch)) { theGetter = ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN) diff --git a/android/guava/src/com/google/common/hash/LongAddables.java b/android/guava/src/com/google/common/hash/LongAddables.java index 370030dab..7c371ec88 100644 --- a/android/guava/src/com/google/common/hash/LongAddables.java +++ b/android/guava/src/com/google/common/hash/LongAddables.java @@ -29,7 +29,8 @@ final class LongAddables { static { Supplier<LongAddable> supplier; try { - new LongAdder(); // trigger static initialization of the LongAdder class, which may fail + // trigger static initialization of the LongAdder class, which may fail + LongAdder unused = new LongAdder(); supplier = new Supplier<LongAddable>() { @Override diff --git a/android/guava/src/com/google/common/hash/MacHashFunction.java b/android/guava/src/com/google/common/hash/MacHashFunction.java index 031b1c017..6d53a54c3 100644 --- a/android/guava/src/com/google/common/hash/MacHashFunction.java +++ b/android/guava/src/com/google/common/hash/MacHashFunction.java @@ -58,7 +58,7 @@ final class MacHashFunction extends AbstractHashFunction { private static boolean supportsClone(Mac mac) { try { - mac.clone(); + Object unused = mac.clone(); return true; } catch (CloneNotSupportedException e) { return false; diff --git a/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java b/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java index 48b47b0f0..43fc087f2 100644 --- a/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java +++ b/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java @@ -61,7 +61,7 @@ final class MessageDigestHashFunction extends AbstractHashFunction implements Se private static boolean supportsClone(MessageDigest digest) { try { - digest.clone(); + Object unused = digest.clone(); return true; } catch (CloneNotSupportedException e) { return false; diff --git a/android/guava/src/com/google/common/hash/ParametricNullness.java b/android/guava/src/com/google/common/hash/ParametricNullness.java index 2ae8d4200..460106c09 100644 --- a/android/guava/src/com/google/common/hash/ParametricNullness.java +++ b/android/guava/src/com/google/common/hash/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/html/ParametricNullness.java b/android/guava/src/com/google/common/html/ParametricNullness.java index 9a62c35ba..61b446164 100644 --- a/android/guava/src/com/google/common/html/ParametricNullness.java +++ b/android/guava/src/com/google/common/html/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/io/BaseEncoding.java b/android/guava/src/com/google/common/io/BaseEncoding.java index f42857c35..0d6f2e068 100644 --- a/android/guava/src/com/google/common/io/BaseEncoding.java +++ b/android/guava/src/com/google/common/io/BaseEncoding.java @@ -176,7 +176,7 @@ public abstract class BaseEncoding { * Returns a {@code ByteSink} that writes base-encoded bytes to the specified {@code CharSink}. */ @GwtIncompatible // ByteSink,CharSink - public final ByteSink encodingSink(final CharSink encodedSink) { + public final ByteSink encodingSink(CharSink encodedSink) { checkNotNull(encodedSink); return new ByteSink() { @Override @@ -247,7 +247,7 @@ public abstract class BaseEncoding { * CharSource}. */ @GwtIncompatible // ByteSource,CharSource - public final ByteSource decodingSource(final CharSource encodedSource) { + public final ByteSource decodingSource(CharSource encodedSource) { checkNotNull(encodedSource); return new ByteSource() { @Override @@ -588,7 +588,7 @@ public abstract class BaseEncoding { @GwtIncompatible // Writer,OutputStream @Override - public OutputStream encodingStream(final Writer out) { + public OutputStream encodingStream(Writer out) { checkNotNull(out); return new OutputStream() { int bitBuffer = 0; @@ -650,7 +650,7 @@ public abstract class BaseEncoding { bitBuffer <<= 8; // Add additional zero byte in the end. } // Position of first character is length of bitBuffer minus bitsPerChar. - final int bitOffset = (len + 1) * 8 - alphabet.bitsPerChar; + int bitOffset = (len + 1) * 8 - alphabet.bitsPerChar; int bitsProcessed = 0; while (bitsProcessed < len * 8) { int charIndex = (int) (bitBuffer >>> (bitOffset - bitsProcessed)) & alphabet.mask; @@ -718,7 +718,7 @@ public abstract class BaseEncoding { chunk |= alphabet.decode(chars.charAt(charIdx + charsProcessed++)); } } - final int minOffset = alphabet.bytesPerChunk * 8 - charsProcessed * alphabet.bitsPerChar; + int minOffset = alphabet.bytesPerChunk * 8 - charsProcessed * alphabet.bitsPerChar; for (int offset = (alphabet.bytesPerChunk - 1) * 8; offset >= minOffset; offset -= 8) { target[bytesWritten++] = (byte) ((chunk >>> offset) & 0xFF); } @@ -728,7 +728,7 @@ public abstract class BaseEncoding { @Override @GwtIncompatible // Reader,InputStream - public InputStream decodingStream(final Reader reader) { + public InputStream decodingStream(Reader reader) { checkNotNull(reader); return new InputStream() { int bitBuffer = 0; @@ -992,7 +992,7 @@ public abstract class BaseEncoding { } @GwtIncompatible - static Reader ignoringReader(final Reader delegate, final String toIgnore) { + static Reader ignoringReader(Reader delegate, String toIgnore) { checkNotNull(delegate); checkNotNull(toIgnore); return new Reader() { @@ -1018,7 +1018,7 @@ public abstract class BaseEncoding { } static Appendable separatingAppendable( - final Appendable delegate, final String separator, final int afterEveryChars) { + Appendable delegate, String separator, int afterEveryChars) { checkNotNull(delegate); checkNotNull(separator); checkArgument(afterEveryChars > 0); @@ -1049,10 +1049,8 @@ public abstract class BaseEncoding { } @GwtIncompatible // Writer - static Writer separatingWriter( - final Writer delegate, final String separator, final int afterEveryChars) { - final Appendable separatingAppendable = - separatingAppendable(delegate, separator, afterEveryChars); + static Writer separatingWriter(Writer delegate, String separator, int afterEveryChars) { + Appendable separatingAppendable = separatingAppendable(delegate, separator, afterEveryChars); return new Writer() { @Override public void write(int c) throws IOException { @@ -1103,7 +1101,7 @@ public abstract class BaseEncoding { @GwtIncompatible // Writer,OutputStream @Override - public OutputStream encodingStream(final Writer output) { + public OutputStream encodingStream(Writer output) { return delegate.encodingStream(separatingWriter(output, separator, afterEveryChars)); } @@ -1143,7 +1141,7 @@ public abstract class BaseEncoding { @Override @GwtIncompatible // Reader,InputStream - public InputStream decodingStream(final Reader reader) { + public InputStream decodingStream(Reader reader) { return delegate.decodingStream(ignoringReader(reader, separator)); } diff --git a/android/guava/src/com/google/common/io/ByteStreams.java b/android/guava/src/com/google/common/io/ByteStreams.java index 2f1f6690e..99213bf16 100644 --- a/android/guava/src/com/google/common/io/ByteStreams.java +++ b/android/guava/src/com/google/common/io/ByteStreams.java @@ -18,6 +18,8 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkPositionIndex; import static com.google.common.base.Preconditions.checkPositionIndexes; +import static java.lang.Math.max; +import static java.lang.Math.min; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; @@ -170,13 +172,18 @@ public final class ByteStreams { */ private static byte[] toByteArrayInternal(InputStream in, Queue<byte[]> bufs, int totalLen) throws IOException { - // Starting with an 8k buffer, double the size of each successive buffer. Buffers are retained - // in a deque so that there's no copying between buffers while reading and so all of the bytes - // in each new allocated buffer are available for reading from the stream. - for (int bufSize = BUFFER_SIZE; + // Roughly size to match what has been read already. Some file systems, such as procfs, return 0 + // as their length. These files are very small, so it's wasteful to allocate an 8KB buffer. + int initialBufferSize = min(BUFFER_SIZE, max(128, Integer.highestOneBit(totalLen) * 2)); + // Starting with an 8k buffer, double the size of each successive buffer. Smaller buffers + // quadruple in size until they reach 8k, to minimize the number of small reads for longer + // streams. Buffers are retained in a deque so that there's no copying between buffers while + // reading and so all of the bytes in each new allocated buffer are available for reading from + // the stream. + for (int bufSize = initialBufferSize; totalLen < MAX_ARRAY_LEN; - bufSize = IntMath.saturatedMultiply(bufSize, 2)) { - byte[] buf = new byte[Math.min(bufSize, MAX_ARRAY_LEN - totalLen)]; + bufSize = IntMath.saturatedMultiply(bufSize, bufSize < 4096 ? 4 : 2)) { + byte[] buf = new byte[min(bufSize, MAX_ARRAY_LEN - totalLen)]; bufs.add(buf); int off = 0; while (off < buf.length) { @@ -200,11 +207,18 @@ public final class ByteStreams { } private static byte[] combineBuffers(Queue<byte[]> bufs, int totalLen) { - byte[] result = new byte[totalLen]; - int remaining = totalLen; + if (bufs.isEmpty()) { + return new byte[0]; + } + byte[] result = bufs.remove(); + if (result.length == totalLen) { + return result; + } + int remaining = totalLen - result.length; + result = Arrays.copyOf(result, totalLen); while (remaining > 0) { byte[] buf = bufs.remove(); - int bytesToCopy = Math.min(remaining, buf.length); + int bytesToCopy = min(remaining, buf.length); int resultOffset = totalLen - remaining; System.arraycopy(buf, 0, result, resultOffset, bytesToCopy); remaining -= bytesToCopy; @@ -256,7 +270,7 @@ public final class ByteStreams { } // the stream was longer, so read the rest normally - Queue<byte[]> bufs = new ArrayDeque<byte[]>(TO_BYTE_ARRAY_DEQUE_SIZE + 2); + Queue<byte[]> bufs = new ArrayDeque<>(TO_BYTE_ARRAY_DEQUE_SIZE + 2); bufs.add(bytes); bufs.add(new byte[] {(byte) b}); return toByteArrayInternal(in, bufs, bytes.length + 1); @@ -657,6 +671,7 @@ public final class ByteStreams { @Override public void write(byte[] b, int off, int len) { checkNotNull(b); + checkPositionIndexes(off, off + len, b.length); } @Override @@ -819,7 +834,7 @@ public final class ByteStreams { * either the full amount has been skipped or until the end of the stream is reached, whichever * happens first. Returns the total number of bytes skipped. */ - static long skipUpTo(InputStream in, final long n) throws IOException { + static long skipUpTo(InputStream in, long n) throws IOException { long totalSkipped = 0; // A buffer is allocated if skipSafely does not skip any bytes. byte[] buf = null; diff --git a/android/guava/src/com/google/common/io/CharStreams.java b/android/guava/src/com/google/common/io/CharStreams.java index c41419423..d36f9a3c5 100644 --- a/android/guava/src/com/google/common/io/CharStreams.java +++ b/android/guava/src/com/google/common/io/CharStreams.java @@ -34,8 +34,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Provides utility methods for working with character streams. * - * <p>All method parameters must be non-null unless documented otherwise. - * * <p>Some of the methods in this class take arguments with a generic type of {@code Readable & * Closeable}. A {@link java.io.Reader} implements both of those interfaces. Similarly for {@code * Appendable & Closeable} and {@link java.io.Writer}. diff --git a/android/guava/src/com/google/common/io/Files.java b/android/guava/src/com/google/common/io/Files.java index bf6289e90..ba5528ff8 100644 --- a/android/guava/src/com/google/common/io/Files.java +++ b/android/guava/src/com/google/common/io/Files.java @@ -32,6 +32,7 @@ import com.google.common.graph.Traverser; import com.google.common.hash.HashCode; import com.google.common.hash.HashFunction; import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.errorprone.annotations.InlineMe; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -85,7 +86,6 @@ public final class Files { * helpful predefined constants * @return the buffered reader */ - @Beta public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); @@ -104,7 +104,6 @@ public final class Files { * helpful predefined constants * @return the buffered writer */ - @Beta public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); @@ -235,7 +234,6 @@ public final class Files { * (2^31 - 1) * @throws IOException if an I/O error occurs */ - @Beta public static byte[] toByteArray(File file) throws IOException { return asByteSource(file).read(); } @@ -248,11 +246,12 @@ public final class Files { * helpful predefined constants * @return a string containing all the characters from the file * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).read()}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).read()}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).read()", + imports = "com.google.common.io.Files") public static String toString(File file, Charset charset) throws IOException { return asCharSource(file, charset).read(); } @@ -267,7 +266,6 @@ public final class Files { * @param to the destination file * @throws IOException if an I/O error occurs */ - @Beta public static void write(byte[] from, File to) throws IOException { asByteSink(to).write(from); } @@ -280,11 +278,12 @@ public final class Files { * @param charset the charset used to encode the output stream; see {@link StandardCharsets} for * helpful predefined constants * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSink(to, charset).write(from)}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asCharSink(to, charset).write(from)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSink(to, charset).write(from)", + imports = "com.google.common.io.Files") public static void write(CharSequence from, File to, Charset charset) throws IOException { asCharSink(to, charset).write(from); } @@ -299,7 +298,6 @@ public final class Files { * @param to the output stream * @throws IOException if an I/O error occurs */ - @Beta public static void copy(File from, OutputStream to) throws IOException { asByteSource(from).copyTo(to); } @@ -323,7 +321,6 @@ public final class Files { * @throws IOException if an I/O error occurs * @throws IllegalArgumentException if {@code from.equals(to)} */ - @Beta public static void copy(File from, File to) throws IOException { checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to); asByteSource(from).copyTo(asByteSink(to)); @@ -337,11 +334,12 @@ public final class Files { * helpful predefined constants * @param to the appendable object * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(from, charset).copyTo(to)}. This method is scheduled to - * be removed in October 2019. + * @deprecated Prefer {@code asCharSource(from, charset).copyTo(to)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(from, charset).copyTo(to)", + imports = "com.google.common.io.Files") public static void copy(File from, Charset charset, Appendable to) throws IOException { asCharSource(from, charset).copyTo(to); @@ -358,8 +356,10 @@ public final class Files { * @deprecated Prefer {@code asCharSink(to, charset, FileWriteMode.APPEND).write(from)}. This * method is scheduled to be removed in October 2019. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSink(to, charset, FileWriteMode.APPEND).write(from)", + imports = {"com.google.common.io.FileWriteMode", "com.google.common.io.Files"}) public static void append(CharSequence from, File to, Charset charset) throws IOException { asCharSink(to, charset, FileWriteMode.APPEND).write(from); @@ -370,7 +370,6 @@ public final class Files { * * @throws IOException if an I/O error occurs */ - @Beta public static boolean equal(File file1, File file2) throws IOException { checkNotNull(file1); checkNotNull(file2); @@ -452,7 +451,6 @@ public final class Files { * @param file the file to create or update * @throws IOException if an I/O error occurs */ - @Beta @SuppressWarnings("GoodTime") // reading system time without TimeSource public static void touch(File file) throws IOException { checkNotNull(file); @@ -470,7 +468,6 @@ public final class Files { * directories of the specified file could not be created. * @since 4.0 */ - @Beta public static void createParentDirs(File file) throws IOException { checkNotNull(file); File parent = file.getCanonicalFile().getParentFile(); @@ -501,7 +498,6 @@ public final class Files { * @throws IOException if an I/O error occurs * @throws IllegalArgumentException if {@code from.equals(to)} */ - @Beta public static void move(File from, File to) throws IOException { checkNotNull(from); checkNotNull(to); @@ -527,11 +523,12 @@ public final class Files { * helpful predefined constants * @return the first line, or null if the file is empty * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).readFirstLine()}. This method is - * scheduled to be removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).readFirstLine()}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).readFirstLine()", + imports = "com.google.common.io.Files") @CheckForNull public static String readFirstLine(File file, Charset charset) throws IOException { @@ -554,7 +551,6 @@ public final class Files { * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ - @Beta public static List<String> readLines(File file, Charset charset) throws IOException { // don't use asCharSource(file, charset).readLines() because that returns // an immutable list, which would change the behavior of this method @@ -586,11 +582,12 @@ public final class Files { * @param callback the {@link LineProcessor} to use to handle the lines * @return the output of processing the lines * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).readLines(callback)}. This method is - * scheduled to be removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).readLines(callback)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).readLines(callback)", + imports = "com.google.common.io.Files") @CanIgnoreReturnValue // some processors won't return a useful result @ParametricNullness public @@ -608,11 +605,12 @@ public final class Files { * @param processor the object to which the bytes of the file are passed. * @return the result of the byte processor * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asByteSource(file).read(processor)}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asByteSource(file).read(processor)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asByteSource(file).read(processor)", + imports = "com.google.common.io.Files") @CanIgnoreReturnValue // some processors won't return a useful result @ParametricNullness public @@ -629,11 +627,12 @@ public final class Files { * @return the {@link HashCode} of all of the bytes in the file * @throws IOException if an I/O error occurs * @since 12.0 - * @deprecated Prefer {@code asByteSource(file).hash(hashFunction)}. This method is scheduled to - * be removed in October 2019. + * @deprecated Prefer {@code asByteSource(file).hash(hashFunction)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asByteSource(file).hash(hashFunction)", + imports = "com.google.common.io.Files") public static HashCode hash(File file, HashFunction hashFunction) throws IOException { return asByteSource(file).hash(hashFunction); @@ -654,7 +653,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file) throws IOException { checkNotNull(file); return map(file, MapMode.READ_ONLY); @@ -677,7 +675,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file, MapMode mode) throws IOException { return mapInternal(file, mode, -1); } @@ -701,7 +698,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file, MapMode mode, long size) throws IOException { checkArgument(size >= 0, "size (%s) may not be negative", size); return mapInternal(file, mode, size); @@ -745,7 +741,6 @@ public final class Files { * * @since 11.0 */ - @Beta public static String simplifyPath(String pathname) { checkNotNull(pathname); if (pathname.length() == 0) { @@ -806,7 +801,6 @@ public final class Files { * * @since 11.0 */ - @Beta public static String getFileExtension(String fullName) { checkNotNull(fullName); String fileName = new File(fullName).getName(); @@ -824,7 +818,6 @@ public final class Files { * @return The file name without its path or extension. * @since 14.0 */ - @Beta public static String getNameWithoutExtension(String file) { checkNotNull(file); String fileName = new File(file).getName(); @@ -880,7 +873,6 @@ public final class Files { * * @since 15.0 */ - @Beta public static Predicate<File> isDirectory() { return FilePredicate.IS_DIRECTORY; } @@ -890,7 +882,6 @@ public final class Files { * * @since 15.0 */ - @Beta public static Predicate<File> isFile() { return FilePredicate.IS_FILE; } diff --git a/android/guava/src/com/google/common/io/ParametricNullness.java b/android/guava/src/com/google/common/io/ParametricNullness.java index afa0db1f5..98da76585 100644 --- a/android/guava/src/com/google/common/io/ParametricNullness.java +++ b/android/guava/src/com/google/common/io/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/io/Resources.java b/android/guava/src/com/google/common/io/Resources.java index cc595fcee..d1e37070a 100644 --- a/android/guava/src/com/google/common/io/Resources.java +++ b/android/guava/src/com/google/common/io/Resources.java @@ -17,7 +17,6 @@ package com.google.common.io; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Charsets; import com.google.common.base.MoreObjects; @@ -36,14 +35,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; * methods use {@link URL} parameters, they are usually not appropriate for HTTP or other * non-classpath resources. * - * <p>All method parameters must be non-null unless documented otherwise. - * * @author Chris Nokleberg * @author Ben Yu * @author Colin Decker * @since 1.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class Resources { diff --git a/android/guava/src/com/google/common/math/LongMath.java b/android/guava/src/com/google/common/math/LongMath.java index 1e67812b7..dd5ff0694 100644 --- a/android/guava/src/com/google/common/math/LongMath.java +++ b/android/guava/src/com/google/common/math/LongMath.java @@ -425,7 +425,7 @@ public final class LongMath { // subtracting two nonnegative longs can't overflow // cmpRemToHalfDivisor has the same sign as compare(abs(rem), abs(q) / 2). if (cmpRemToHalfDivisor == 0) { // exactly on the half mark - increment = (mode == HALF_UP | (mode == HALF_EVEN & (div & 1) != 0)); + increment = (mode == HALF_UP || (mode == HALF_EVEN && (div & 1) != 0)); } else { increment = cmpRemToHalfDivisor > 0; // closer to the UP value } diff --git a/android/guava/src/com/google/common/math/ParametricNullness.java b/android/guava/src/com/google/common/math/ParametricNullness.java index c079b9781..8e57826e4 100644 --- a/android/guava/src/com/google/common/math/ParametricNullness.java +++ b/android/guava/src/com/google/common/math/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/net/HostAndPort.java b/android/guava/src/com/google/common/net/HostAndPort.java index 19e6b6729..a27eb65ff 100644 --- a/android/guava/src/com/google/common/net/HostAndPort.java +++ b/android/guava/src/com/google/common/net/HostAndPort.java @@ -18,11 +18,11 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.CharMatcher; import com.google.common.base.Objects; import com.google.common.base.Strings; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import java.io.Serializable; import javax.annotation.CheckForNull; @@ -60,7 +60,6 @@ import javax.annotation.CheckForNull; * @author Paul Marks * @since 10.0 */ -@Beta @Immutable @GwtCompatible @ElementTypesAreNonnullByDefault @@ -164,6 +163,7 @@ public final class HostAndPort implements Serializable { * @return if parsing was successful, a populated HostAndPort object. * @throws IllegalArgumentException if nothing meaningful could be parsed. */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static HostAndPort fromString(String hostPortString) { checkNotNull(hostPortString); String host; @@ -274,6 +274,7 @@ public final class HostAndPort implements Serializable { * @return {@code this}, to enable chaining of calls. * @throws IllegalArgumentException if bracketless IPv6 is detected. */ + @CanIgnoreReturnValue public HostAndPort requireBracketsForIPv6() { checkArgument(!hasBracketlessColons, "Possible bracketless IPv6 literal: %s", host); return this; diff --git a/android/guava/src/com/google/common/net/HostSpecifier.java b/android/guava/src/com/google/common/net/HostSpecifier.java index 7448944ab..c57f3d975 100644 --- a/android/guava/src/com/google/common/net/HostSpecifier.java +++ b/android/guava/src/com/google/common/net/HostSpecifier.java @@ -14,9 +14,9 @@ package com.google.common.net; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Preconditions; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.net.InetAddress; import java.text.ParseException; import javax.annotation.CheckForNull; @@ -41,7 +41,6 @@ import javax.annotation.CheckForNull; * @author Craig Berry * @since 5.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class HostSpecifier { @@ -71,9 +70,9 @@ public final class HostSpecifier { public static HostSpecifier fromValid(String specifier) { // Verify that no port was specified, and strip optional brackets from // IPv6 literals. - final HostAndPort parsedHost = HostAndPort.fromString(specifier); + HostAndPort parsedHost = HostAndPort.fromString(specifier); Preconditions.checkArgument(!parsedHost.hasPort()); - final String host = parsedHost.getHost(); + String host = parsedHost.getHost(); // Try to interpret the specifier as an IP address. Note we build // the address rather than using the .is* methods because we want to @@ -93,7 +92,7 @@ public final class HostSpecifier { // It is not any kind of IP address; must be a domain name or invalid. // TODO(user): different versions of this for different factories? - final InternetDomainName domain = InternetDomainName.from(host); + InternetDomainName domain = InternetDomainName.from(host); if (domain.hasPublicSuffix()) { return new HostSpecifier(domain.toString()); @@ -110,6 +109,7 @@ public final class HostSpecifier { * * @throws ParseException if the specifier is not valid. */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static HostSpecifier from(String specifier) throws ParseException { try { return fromValid(specifier); @@ -130,7 +130,7 @@ public final class HostSpecifier { */ public static boolean isValid(String specifier) { try { - fromValid(specifier); + HostSpecifier unused = fromValid(specifier); return true; } catch (IllegalArgumentException e) { return false; @@ -144,7 +144,7 @@ public final class HostSpecifier { } if (other instanceof HostSpecifier) { - final HostSpecifier that = (HostSpecifier) other; + HostSpecifier that = (HostSpecifier) other; return this.canonicalForm.equals(that.canonicalForm); } diff --git a/android/guava/src/com/google/common/net/HttpHeaders.java b/android/guava/src/com/google/common/net/HttpHeaders.java index f318da151..2ecbfaa8c 100644 --- a/android/guava/src/com/google/common/net/HttpHeaders.java +++ b/android/guava/src/com/google/common/net/HttpHeaders.java @@ -14,7 +14,6 @@ package com.google.common.net; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; /** @@ -102,7 +101,6 @@ public final class HttpHeaders { * * @since 17.0 */ - @Beta public static final String FOLLOW_ONLY_WHEN_PRERENDER_SHOWN = "Follow-Only-When-Prerender-Shown"; /** The HTTP {@code Host} header field name. */ public static final String HOST = "Host"; @@ -201,6 +199,14 @@ public final class HttpHeaders { public static final String ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; /** The HTTP {@code Access-Control-Allow-Origin} header field name. */ public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; + /** + * The HTTP <a href="https://wicg.github.io/private-network-access/#headers">{@code + * Access-Control-Allow-Private-Network}</a> header field name. + * + * @since 31.1 + */ + public static final String ACCESS_CONTROL_ALLOW_PRIVATE_NETWORK = + "Access-Control-Allow-Private-Network"; /** The HTTP {@code Access-Control-Allow-Credentials} header field name. */ public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; /** The HTTP {@code Access-Control-Expose-Headers} header field name. */ @@ -357,7 +363,7 @@ public final class HttpHeaders { * * @since 27.1 */ - @Beta public static final String SOURCE_MAP = "SourceMap"; + public static final String SOURCE_MAP = "SourceMap"; /** * The HTTP <a href="http://tools.ietf.org/html/rfc6797#section-6.1">{@code @@ -455,14 +461,14 @@ public final class HttpHeaders { * * @since 15.0 */ - @Beta public static final String PUBLIC_KEY_PINS = "Public-Key-Pins"; + public static final String PUBLIC_KEY_PINS = "Public-Key-Pins"; /** * The HTTP <a href="http://tools.ietf.org/html/draft-evans-palmer-key-pinning">{@code * Public-Key-Pins-Report-Only}</a> header field name. * * @since 15.0 */ - @Beta public static final String PUBLIC_KEY_PINS_REPORT_ONLY = "Public-Key-Pins-Report-Only"; + public static final String PUBLIC_KEY_PINS_REPORT_ONLY = "Public-Key-Pins-Report-Only"; /** * The HTTP {@code X-Request-ID} header field name. * @@ -482,7 +488,7 @@ public final class HttpHeaders { * * @since 24.1 */ - @Beta public static final String X_DOWNLOAD_OPTIONS = "X-Download-Options"; + public static final String X_DOWNLOAD_OPTIONS = "X-Download-Options"; /** The HTTP {@code X-XSS-Protection} header field name. */ public static final String X_XSS_PROTECTION = "X-XSS-Protection"; /** @@ -665,9 +671,17 @@ public final class HttpHeaders { * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-full-version">{@code * Sec-CH-UA-Full-Version}</a> header field name. * + * @deprecated Prefer {@link SEC_CH_UA_FULL_VERSION_LIST}. * @since 30.0 */ - public static final String SEC_CH_UA_FULL_VERSION = "Sec-CH-UA-Full-Version"; + @Deprecated public static final String SEC_CH_UA_FULL_VERSION = "Sec-CH-UA-Full-Version"; + /** + * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-full-version-list">{@code + * Sec-CH-UA-Full-Version}</a> header field name. + * + * @since 31.1 + */ + public static final String SEC_CH_UA_FULL_VERSION_LIST = "Sec-CH-UA-Full-Version-List"; /** * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-mobile">{@code * Sec-CH-UA-Mobile}</a> header field name. diff --git a/android/guava/src/com/google/common/net/InetAddresses.java b/android/guava/src/com/google/common/net/InetAddresses.java index 4e2aa6995..d3e68db8a 100644 --- a/android/guava/src/com/google/common/net/InetAddresses.java +++ b/android/guava/src/com/google/common/net/InetAddresses.java @@ -17,13 +17,13 @@ package com.google.common.net; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.CharMatcher; import com.google.common.base.MoreObjects; import com.google.common.hash.Hashing; import com.google.common.io.ByteStreams; import com.google.common.primitives.Ints; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.math.BigInteger; import java.net.Inet4Address; import java.net.Inet6Address; @@ -95,7 +95,6 @@ import javax.annotation.CheckForNull; * @author Erik Kline * @since 5.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class InetAddresses { @@ -144,6 +143,7 @@ public final class InetAddresses { * @return {@link InetAddress} representing the argument * @throws IllegalArgumentException if the argument is not a valid IP string literal */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static InetAddress forString(String ipString) { byte[] addr = ipStringToBytes(ipString); @@ -667,7 +667,6 @@ public final class InetAddresses { * * @since 5.0 */ - @Beta public static final class TeredoInfo { private final Inet4Address server; private final Inet4Address client; diff --git a/android/guava/src/com/google/common/net/InternetDomainName.java b/android/guava/src/com/google/common/net/InternetDomainName.java index 58734497d..d71a9d5c3 100644 --- a/android/guava/src/com/google/common/net/InternetDomainName.java +++ b/android/guava/src/com/google/common/net/InternetDomainName.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ascii; import com.google.common.base.CharMatcher; @@ -26,6 +25,7 @@ import com.google.common.base.Joiner; import com.google.common.base.Optional; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import com.google.thirdparty.publicsuffix.PublicSuffixPatterns; import com.google.thirdparty.publicsuffix.PublicSuffixType; @@ -71,7 +71,6 @@ import javax.annotation.CheckForNull; * @author Catherine Berry * @since 5.0 */ -@Beta @GwtCompatible(emulated = true) @Immutable @ElementTypesAreNonnullByDefault @@ -163,7 +162,7 @@ public final class InternetDomainName { * Otherwise, it finds the first suffix of any type. */ private int findSuffixOfType(Optional<PublicSuffixType> desiredType) { - final int partsSize = parts.size(); + int partsSize = parts.size(); for (int i = 0; i < partsSize; i++) { String ancestorName = DOT_JOINER.join(parts.subList(i, partsSize)); @@ -206,6 +205,7 @@ public final class InternetDomainName { * {@link #isValid} * @since 10.0 (previously named {@code fromLenient}) */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static InternetDomainName from(String domain) { return new InternetDomainName(checkNotNull(domain)); } @@ -217,7 +217,7 @@ public final class InternetDomainName { * @return Is the domain name syntactically valid? */ private static boolean validateSyntax(List<String> parts) { - final int lastIndex = parts.size() - 1; + int lastIndex = parts.size() - 1; // Validate the last part specially, as it has different syntax rules. @@ -584,7 +584,7 @@ public final class InternetDomainName { */ public static boolean isValid(String name) { try { - from(name); + InternetDomainName unused = from(name); return true; } catch (IllegalArgumentException e) { return false; diff --git a/android/guava/src/com/google/common/net/MediaType.java b/android/guava/src/com/google/common/net/MediaType.java index ca471616a..a713d0b17 100644 --- a/android/guava/src/com/google/common/net/MediaType.java +++ b/android/guava/src/com/google/common/net/MediaType.java @@ -21,11 +21,9 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ascii; import com.google.common.base.CharMatcher; -import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Joiner.MapJoiner; import com.google.common.base.MoreObjects; @@ -37,12 +35,12 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import com.google.errorprone.annotations.concurrent.LazyInit; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; -import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import javax.annotation.CheckForNull; @@ -72,7 +70,6 @@ import javax.annotation.CheckForNull; * @since 12.0 * @author Gregory Kick */ -@Beta @GwtCompatible @Immutable @ElementTypesAreNonnullByDefault @@ -792,14 +789,7 @@ public final class MediaType { } private Map<String, ImmutableMultiset<String>> parametersAsMap() { - return Maps.transformValues( - parameters.asMap(), - new Function<Collection<String>, ImmutableMultiset<String>>() { - @Override - public ImmutableMultiset<String> apply(Collection<String> input) { - return ImmutableMultiset.copyOf(input); - } - }); + return Maps.transformValues(parameters.asMap(), ImmutableMultiset::copyOf); } /** @@ -1049,6 +1039,7 @@ public final class MediaType { * * @throws IllegalArgumentException if the input is not parsable */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static MediaType parse(String input) { checkNotNull(input); Tokenizer tokenizer = new Tokenizer(input); @@ -1063,7 +1054,7 @@ public final class MediaType { tokenizer.consumeTokenIfPresent(LINEAR_WHITE_SPACE); String attribute = tokenizer.consumeToken(TOKEN_MATCHER); tokenizer.consumeCharacter('='); - final String value; + String value; if ('"' == tokenizer.previewChar()) { tokenizer.consumeCharacter('"'); StringBuilder valueBuilder = new StringBuilder(); @@ -1096,6 +1087,7 @@ public final class MediaType { this.input = input; } + @CanIgnoreReturnValue String consumeTokenIfPresent(CharMatcher matcher) { checkState(hasMore()); int startPosition = position; @@ -1118,6 +1110,7 @@ public final class MediaType { return c; } + @CanIgnoreReturnValue char consumeCharacter(char c) { checkState(hasMore()); checkState(previewChar() == c); @@ -1185,14 +1178,10 @@ public final class MediaType { Multimap<String, String> quotedParameters = Multimaps.transformValues( parameters, - new Function<String, String>() { - @Override - public String apply(String value) { - return (TOKEN_MATCHER.matchesAllOf(value) && !value.isEmpty()) + (String value) -> + (TOKEN_MATCHER.matchesAllOf(value) && !value.isEmpty()) ? value - : escapeAndQuote(value); - } - }); + : escapeAndQuote(value)); PARAMETER_JOINER.appendTo(builder, quotedParameters.entries()); } return builder.toString(); diff --git a/android/guava/src/com/google/common/net/ParametricNullness.java b/android/guava/src/com/google/common/net/ParametricNullness.java index acc3eab57..1ad2e27c0 100644 --- a/android/guava/src/com/google/common/net/ParametricNullness.java +++ b/android/guava/src/com/google/common/net/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/net/PercentEscaper.java b/android/guava/src/com/google/common/net/PercentEscaper.java index 7c7de9bb3..929014731 100644 --- a/android/guava/src/com/google/common/net/PercentEscaper.java +++ b/android/guava/src/com/google/common/net/PercentEscaper.java @@ -16,7 +16,6 @@ package com.google.common.net; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.UnicodeEscaper; import javax.annotation.CheckForNull; @@ -50,7 +49,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class PercentEscaper extends UnicodeEscaper { diff --git a/android/guava/src/com/google/common/net/package-info.java b/android/guava/src/com/google/common/net/package-info.java index d9db26637..d55642d94 100644 --- a/android/guava/src/com/google/common/net/package-info.java +++ b/android/guava/src/com/google/common/net/package-info.java @@ -21,7 +21,9 @@ * * @author Craig Berry */ +@CheckReturnValue @ParametersAreNonnullByDefault package com.google.common.net; +import com.google.errorprone.annotations.CheckReturnValue; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/primitives/ParametricNullness.java b/android/guava/src/com/google/common/primitives/ParametricNullness.java index 17d606c2c..4289b9b16 100644 --- a/android/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/android/guava/src/com/google/common/primitives/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/primitives/UnsignedBytes.java b/android/guava/src/com/google/common/primitives/UnsignedBytes.java index bf9a3066a..db4f489e4 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedBytes.java +++ b/android/guava/src/com/google/common/primitives/UnsignedBytes.java @@ -365,7 +365,7 @@ public final class UnsignedBytes { @Override public int compare(byte[] left, byte[] right) { - final int stride = 8; + int stride = 8; int minLength = Math.min(left.length, right.length); int strideLimit = minLength & ~(stride - 1); int i; diff --git a/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java index 4666f992c..ff921959d 100644 --- a/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java +++ b/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java @@ -14,7 +14,6 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -39,7 +38,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Ben Yu * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault public abstract class AbstractInvocationHandler implements InvocationHandler { diff --git a/android/guava/src/com/google/common/reflect/ClassPath.java b/android/guava/src/com/google/common/reflect/ClassPath.java index de693da5f..d15bb5055 100644 --- a/android/guava/src/com/google/common/reflect/ClassPath.java +++ b/android/guava/src/com/google/common/reflect/ClassPath.java @@ -20,10 +20,8 @@ import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_PATH; import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR; import static java.util.logging.Level.WARNING; -import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.CharMatcher; -import com.google.common.base.Predicate; import com.google.common.base.Splitter; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; @@ -92,7 +90,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 14.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class ClassPath { private static final Logger logger = Logger.getLogger(ClassPath.class.getName()); @@ -167,13 +164,7 @@ public final class ClassPath { public ImmutableSet<ClassInfo> getTopLevelClasses() { return FluentIterable.from(resources) .filter(ClassInfo.class) - .filter( - new Predicate<ClassInfo>() { - @Override - public boolean apply(ClassInfo info) { - return info.isTopLevel(); - } - }) + .filter(ClassInfo::isTopLevel) .toSet(); } @@ -211,7 +202,6 @@ public final class ClassPath { * * @since 14.0 */ - @Beta public static class ResourceInfo { private final File file; private final String resourceName; @@ -307,7 +297,6 @@ public final class ClassPath { * * @since 14.0 */ - @Beta public static final class ClassInfo extends ResourceInfo { private final String className; diff --git a/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java index 7fad5ded3..6273704a1 100644 --- a/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java @@ -14,12 +14,12 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import com.google.common.collect.ForwardingMap; import com.google.common.collect.ImmutableMap; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.DoNotCall; import java.util.Map; +import javax.annotation.CheckForNull; /** * A type-to-instance map backed by an {@link ImmutableMap}. See also {@link @@ -28,18 +28,18 @@ import java.util.Map; * @author Ben Yu * @since 13.0 */ -@Beta +@ElementTypesAreNonnullByDefault public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B> implements TypeToInstanceMap<B> { /** Returns an empty type to instance map. */ public static <B> ImmutableTypeToInstanceMap<B> of() { - return new ImmutableTypeToInstanceMap<B>(ImmutableMap.<TypeToken<? extends B>, B>of()); + return new ImmutableTypeToInstanceMap<>(ImmutableMap.<TypeToken<? extends B>, B>of()); } /** Returns a new builder. */ public static <B> Builder<B> builder() { - return new Builder<B>(); + return new Builder<>(); } /** @@ -58,7 +58,6 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken * * @since 13.0 */ - @Beta public static final class Builder<B> { private final ImmutableMap.Builder<TypeToken<? extends B>, B> mapBuilder = ImmutableMap.builder(); @@ -91,7 +90,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken * @throws IllegalArgumentException if duplicate keys were added */ public ImmutableTypeToInstanceMap<B> build() { - return new ImmutableTypeToInstanceMap<B>(mapBuilder.build()); + return new ImmutableTypeToInstanceMap<>(mapBuilder.buildOrThrow()); } } @@ -102,11 +101,13 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken } @Override + @CheckForNull public <T extends B> T getInstance(TypeToken<T> type) { return trustedGet(type.rejectTypeVariables()); } @Override + @CheckForNull public <T extends B> T getInstance(Class<T> type) { return trustedGet(TypeToken.of(type)); } @@ -121,6 +122,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public <T extends B> T putInstance(TypeToken<T> type, T value) { throw new UnsupportedOperationException(); } @@ -135,6 +137,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public <T extends B> T putInstance(Class<T> type, T value) { throw new UnsupportedOperationException(); } @@ -149,6 +152,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public B put(TypeToken<? extends B> key, B value) { throw new UnsupportedOperationException(); } @@ -172,6 +176,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken } @SuppressWarnings("unchecked") // value could not get in if not a T + @CheckForNull private <T extends B> T trustedGet(TypeToken<T> type) { return (T) delegate.get(type); } diff --git a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index dccd2983b..9542e0a7e 100644 --- a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -16,8 +16,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; -import com.google.common.base.Function; import com.google.common.collect.ForwardingMap; import com.google.common.collect.ForwardingMapEntry; import com.google.common.collect.ForwardingSet; @@ -28,43 +26,47 @@ import com.google.errorprone.annotations.DoNotCall; import java.util.Iterator; import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A mutable type-to-instance map. See also {@link ImmutableTypeToInstanceMap}. * + * <p>This implementation <i>does</i> support null values, despite how it is annotated; see + * discussion at {@link TypeToInstanceMap}. + * * @author Ben Yu * @since 13.0 */ -@Beta +@ElementTypesAreNonnullByDefault public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B> implements TypeToInstanceMap<B> { private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap(); @Override - @NullableDecl + @CheckForNull public <T extends B> T getInstance(Class<T> type) { return trustedGet(TypeToken.of(type)); } @Override - @NullableDecl + @CheckForNull public <T extends B> T getInstance(TypeToken<T> type) { return trustedGet(type.rejectTypeVariables()); } @Override @CanIgnoreReturnValue - @NullableDecl - public <T extends B> T putInstance(Class<T> type, @NullableDecl T value) { + @CheckForNull + public <T extends B> T putInstance(Class<T> type, T value) { return trustedPut(TypeToken.of(type), value); } @Override @CanIgnoreReturnValue - @NullableDecl - public <T extends B> T putInstance(TypeToken<T> type, @NullableDecl T value) { + @CheckForNull + public <T extends B> T putInstance(TypeToken<T> type, T value) { return trustedPut(type.rejectTypeVariables(), value); } @@ -78,6 +80,7 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public B put(TypeToken<? extends B> key, B value) { throw new UnsupportedOperationException("Please use putInstance() instead."); } @@ -106,13 +109,13 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? } @SuppressWarnings("unchecked") // value could not get in if not a T - @NullableDecl - private <T extends B> T trustedPut(TypeToken<T> type, @NullableDecl T value) { + @CheckForNull + private <T extends B> T trustedPut(TypeToken<T> type, T value) { return (T) backingMap.put(type, value); } @SuppressWarnings("unchecked") // value could not get in if not a T - @NullableDecl + @CheckForNull private <T extends B> T trustedGet(TypeToken<T> type) { return (T) backingMap.get(type); } @@ -121,7 +124,7 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? private final Entry<K, V> delegate; - static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) { + static <K, V> Set<Entry<K, V>> transformEntries(Set<Entry<K, V>> entries) { return new ForwardingSet<Map.Entry<K, V>>() { @Override protected Set<Entry<K, V>> delegate() { @@ -135,25 +138,27 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? @Override public Object[] toArray() { - return standardToArray(); + /* + * standardToArray returns `@Nullable Object[]` rather than `Object[]` but only because it + * can be used with collections that may contain null. This collection is a collection of + * non-null Entry objects (Entry objects that might contain null values but are not + * themselves null), so we can treat it as a plain `Object[]`. + */ + @SuppressWarnings("nullness") + Object[] result = standardToArray(); + return result; } @Override - public <T> T[] toArray(T[] array) { + @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations + public <T extends @Nullable Object> T[] toArray(T[] array) { return standardToArray(array); } }; } private static <K, V> Iterator<Entry<K, V>> transformEntries(Iterator<Entry<K, V>> entries) { - return Iterators.transform( - entries, - new Function<Entry<K, V>, Entry<K, V>>() { - @Override - public Entry<K, V> apply(Entry<K, V> entry) { - return new UnmodifiableEntry<>(entry); - } - }); + return Iterators.transform(entries, UnmodifiableEntry::new); } private UnmodifiableEntry(java.util.Map.Entry<K, V> delegate) { diff --git a/android/guava/src/com/google/common/reflect/Parameter.java b/android/guava/src/com/google/common/reflect/Parameter.java index a55734a2c..a5be09d41 100644 --- a/android/guava/src/com/google/common/reflect/Parameter.java +++ b/android/guava/src/com/google/common/reflect/Parameter.java @@ -27,6 +27,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Represents a method or constructor parameter. * + * <p><b>Note:</b> Since Java 8 introduced {@link java.lang.reflect.Parameter} to represent method + * and constructor parameters, this class is no longer necessary. We intend to deprecate it in a + * future version. + * * @author Ben Yu * @since 14.0 */ diff --git a/android/guava/src/com/google/common/reflect/ParametricNullness.java b/android/guava/src/com/google/common/reflect/ParametricNullness.java index 588aa5f59..b6331ac26 100644 --- a/android/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/android/guava/src/com/google/common/reflect/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/reflect/Reflection.java b/android/guava/src/com/google/common/reflect/Reflection.java index fa35f7f2d..954496348 100644 --- a/android/guava/src/com/google/common/reflect/Reflection.java +++ b/android/guava/src/com/google/common/reflect/Reflection.java @@ -17,7 +17,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; @@ -26,7 +25,6 @@ import java.lang.reflect.Proxy; * * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class Reflection { diff --git a/android/guava/src/com/google/common/reflect/TypeParameter.java b/android/guava/src/com/google/common/reflect/TypeParameter.java index 9c64abb72..69cd8291a 100644 --- a/android/guava/src/com/google/common/reflect/TypeParameter.java +++ b/android/guava/src/com/google/common/reflect/TypeParameter.java @@ -16,7 +16,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import javax.annotation.CheckForNull; @@ -34,7 +33,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault /* * A nullable bound would let users create a TypeParameter instance for a parameter with a nullable diff --git a/android/guava/src/com/google/common/reflect/TypeResolver.java b/android/guava/src/com/google/common/reflect/TypeResolver.java index fbe48c1e8..32517eb87 100644 --- a/android/guava/src/com/google/common/reflect/TypeResolver.java +++ b/android/guava/src/com/google/common/reflect/TypeResolver.java @@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.util.Arrays.asList; -import com.google.common.annotations.Beta; import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.collect.ImmutableMap; @@ -51,7 +50,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 15.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class TypeResolver { @@ -123,7 +121,7 @@ public final class TypeResolver { } private static void populateTypeMappings( - final Map<TypeVariableKey, Type> mappings, final Type from, final Type to) { + Map<TypeVariableKey, Type> mappings, Type from, Type to) { if (from.equals(to)) { return; } @@ -296,11 +294,11 @@ public final class TypeResolver { checkArgument(!variable.equalsType(type), "Type variable %s bound to itself", variable); builder.put(variable, type); } - return new TypeTable(builder.build()); + return new TypeTable(builder.buildOrThrow()); } - final Type resolve(final TypeVariable<?> var) { - final TypeTable unguarded = this; + final Type resolve(TypeVariable<?> var) { + TypeTable unguarded = this; TypeTable guarded = new TypeTable() { @Override @@ -414,7 +412,7 @@ public final class TypeResolver { visit(t.getUpperBounds()); } - private void map(final TypeVariableKey var, final Type arg) { + private void map(TypeVariableKey var, Type arg) { if (mappings.containsKey(var)) { // Mapping already established // This is possible when following both superClass -> enclosingClass @@ -504,7 +502,7 @@ public final class TypeResolver { return Types.newArtificialTypeVariable(WildcardCapturer.class, name, upperBounds); } - private WildcardCapturer forTypeVariable(final TypeVariable<?> typeParam) { + private WildcardCapturer forTypeVariable(TypeVariable<?> typeParam) { return new WildcardCapturer(id) { @Override TypeVariable<?> captureAsTypeVariable(Type[] upperBounds) { diff --git a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java index 80396bc78..8a418df2a 100644 --- a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -14,11 +14,10 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.DoNotMock; import java.util.Map; -import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import javax.annotation.CheckForNull; /** * A map, each entry of which maps a {@link TypeToken} to an instance of that type. In addition to @@ -35,12 +34,15 @@ import org.checkerframework.checker.nullness.compatqual.NullableDecl; * <p>Like any other {@code Map<Class, Object>}, this map may contain entries for primitive types, * and a primitive type and its corresponding wrapper type may map to different values. * + * <p>This class's support for {@code null} requires some explanation. For details, see {@link + * ClassToInstanceMap}. Its explanation applies equally well to {@code TypeToInstanceMap}. + * * @param <B> the common supertype that all entries must share; often this is simply {@link Object} * @author Ben Yu * @since 13.0 */ -@Beta @DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap") +@ElementTypesAreNonnullByDefault public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { /** @@ -51,7 +53,7 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * <p>{@code getInstance(Foo.class)} is equivalent to {@code * getInstance(TypeToken.of(Foo.class))}. */ - @NullableDecl + @CheckForNull <T extends B> T getInstance(Class<T> type); /** @@ -59,7 +61,7 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * present. This will only return a value that was bound to this specific type, not a value that * may have been bound to a subtype. */ - @NullableDecl + @CheckForNull <T extends B> T getInstance(TypeToken<T> type); /** @@ -73,8 +75,8 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * null} if there was no previous entry. */ @CanIgnoreReturnValue - @NullableDecl - <T extends B> T putInstance(Class<T> type, @NullableDecl T value); + @CheckForNull + <T extends B> T putInstance(Class<T> type, T value); /** * Maps the specified type to the specified value. Does <i>not</i> associate this value with any @@ -84,6 +86,6 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * if there was no previous entry. */ @CanIgnoreReturnValue - @NullableDecl - <T extends B> T putInstance(TypeToken<T> type, @NullableDecl T value); + @CheckForNull + <T extends B> T putInstance(TypeToken<T> type, T value); } diff --git a/android/guava/src/com/google/common/reflect/TypeToken.java b/android/guava/src/com/google/common/reflect/TypeToken.java index f107b7081..fea1d53a2 100644 --- a/android/guava/src/com/google/common/reflect/TypeToken.java +++ b/android/guava/src/com/google/common/reflect/TypeToken.java @@ -97,7 +97,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 12.0 */ -@Beta @SuppressWarnings("serial") // SimpleTypeToken is the serialized form. @ElementTypesAreNonnullByDefault public abstract class TypeToken<T> extends TypeCapture<T> implements Serializable { @@ -168,7 +167,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl /** Returns an instance of type token that wraps {@code type}. */ public static <T> TypeToken<T> of(Class<T> type) { - return new SimpleTypeToken<T>(type); + return new SimpleTypeToken<>(type); } /** Returns an instance of type token that wraps {@code type}. */ @@ -240,7 +239,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl ImmutableMap.of( new TypeResolver.TypeVariableKey(typeParam.typeVariable), typeArg.runtimeType)); // If there's any type error, we'd report now rather than later. - return new SimpleTypeToken<T>(resolver.resolveType(runtimeType)); + return new SimpleTypeToken<>(resolver.resolveType(runtimeType)); } /** @@ -591,6 +590,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl * * @since 14.0 */ + @Beta public final Invokable<T, Object> method(Method method) { checkArgument( this.someRawTypeIsSubclassOf(method.getDeclaringClass()), @@ -630,6 +630,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl * * @since 14.0 */ + @Beta public final Invokable<T, T> constructor(Constructor<?> constructor) { checkArgument( constructor.getDeclaringClass() == getRawType(), @@ -746,15 +747,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl @SuppressWarnings({"unchecked", "rawtypes"}) ImmutableList<Class<? super T>> collectedTypes = (ImmutableList) TypeCollector.FOR_RAW_TYPE.collectTypes(getRawTypes()); - return FluentIterable.from(collectedTypes) - .filter( - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> type) { - return type.isInterface(); - } - }) - .toSet(); + return FluentIterable.from(collectedTypes).filter(Class::isInterface).toSet(); } @Override @@ -1103,7 +1096,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl } private ImmutableSet<Class<? super T>> getRawTypes() { - final ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder(); + ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder(); new TypeVisitor() { @Override void visitTypeVariable(TypeVariable<?> t) { @@ -1428,7 +1421,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl } private static <K, V> ImmutableList<K> sortKeysByValue( - final Map<K, V> map, final Comparator<? super V> valueComparator) { + Map<K, V> map, Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override diff --git a/android/guava/src/com/google/common/reflect/Types.java b/android/guava/src/com/google/common/reflect/Types.java index 0dc327d3d..e69b42a8e 100644 --- a/android/guava/src/com/google/common/reflect/Types.java +++ b/android/guava/src/com/google/common/reflect/Types.java @@ -20,7 +20,6 @@ import static com.google.common.collect.Iterables.transform; import static java.util.Objects.requireNonNull; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.base.Predicates; @@ -57,14 +56,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; final class Types { /** Class#toString without the "class " and "interface " prefixes */ - private static final Function<Type, String> TYPE_NAME = - new Function<Type, String>() { - @Override - public String apply(Type from) { - return JavaVersion.CURRENT.typeName(from); - } - }; - private static final Joiner COMMA_JOINER = Joiner.on(", ").useForNull("null"); /** Returns the array type of {@code componentType}. */ @@ -180,7 +171,7 @@ final class Types { @CheckForNull static Type getComponentType(Type type) { checkNotNull(type); - final AtomicReference<@Nullable Type> result = new AtomicReference<>(); + AtomicReference<@Nullable Type> result = new AtomicReference<>(); new TypeVisitor() { @Override void visitTypeVariable(TypeVariable<?> t) { @@ -303,7 +294,7 @@ final class Types { return builder .append(rawType.getName()) .append('<') - .append(COMMA_JOINER.join(transform(argumentsList, TYPE_NAME))) + .append(COMMA_JOINER.join(transform(argumentsList, JavaVersion.CURRENT::typeName))) .append('>') .toString(); } @@ -331,8 +322,7 @@ final class Types { private static <D extends GenericDeclaration> TypeVariable<D> newTypeVariableImpl( D genericDeclaration, String name, Type[] bounds) { - TypeVariableImpl<D> typeVariableImpl = - new TypeVariableImpl<D>(genericDeclaration, name, bounds); + TypeVariableImpl<D> typeVariableImpl = new TypeVariableImpl<>(genericDeclaration, name, bounds); @SuppressWarnings("unchecked") TypeVariable<D> typeVariable = Reflection.newProxy( @@ -382,7 +372,7 @@ final class Types { builder.put(method.getName(), method); } } - typeVariableMethods = builder.build(); + typeVariableMethods = builder.buildKeepingLast(); } private final TypeVariableImpl<?> typeVariableImpl; diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java index 624caa993..3e08045d9 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -78,7 +78,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna implements ListenableFuture<V> { // NOTE: Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || - private static final boolean GENERATE_CANCELLATION_CAUSES; + static final boolean GENERATE_CANCELLATION_CAUSES; static { // System.getProperty may throw if the security policy does not permit access. @@ -1084,7 +1084,6 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna * method returns @Nullable, too. However, we're not sure if we want to make any changes to that * class, since it's in a separate artifact that we planned to release only a single version of. */ - @SuppressWarnings("nullness") @CheckForNull protected final Throwable tryInternalFastPathGetFailure() { if (this instanceof Trusted) { @@ -1108,10 +1107,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna /** Releases all threads in the {@link #waiters} list, and clears the list. */ private void releaseWaiters() { - Waiter head; - do { - head = waiters; - } while (!ATOMIC_HELPER.casWaiters(this, head, Waiter.TOMBSTONE)); + Waiter head = ATOMIC_HELPER.gasWaiters(this, Waiter.TOMBSTONE); for (Waiter currentWaiter = head; currentWaiter != null; currentWaiter = currentWaiter.next) { currentWaiter.unpark(); } @@ -1129,10 +1125,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna // 2. reverse the linked list, because despite our rather clear contract, people depend on us // executing listeners in the order they were added // 3. push all the items onto 'onto' and return the new head of the stack - Listener head; - do { - head = listeners; - } while (!ATOMIC_HELPER.casListeners(this, head, Listener.TOMBSTONE)); + Listener head = ATOMIC_HELPER.gasListeners(this, Listener.TOMBSTONE); Listener reversedList = onto; while (head != null) { Listener tmp = head; @@ -1301,6 +1294,12 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna abstract boolean casListeners( AbstractFuture<?> future, @CheckForNull Listener expect, Listener update); + /** Performs a GAS operation on the {@link #waiters} field. */ + abstract Waiter gasWaiters(AbstractFuture<?> future, Waiter update); + + /** Performs a GAS operation on the {@link #listeners} field. */ + abstract Listener gasListeners(AbstractFuture<?> future, Listener update); + /** Performs a CAS operation on the {@link #value} field. */ abstract boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update); } @@ -1383,6 +1382,34 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna return UNSAFE.compareAndSwapObject(future, LISTENERS_OFFSET, expect, update); } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + while (true) { + Listener listener = future.listeners; + if (update == listener) { + return listener; + } + if (casListeners(future, listener, update)) { + return listener; + } + } + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + while (true) { + Waiter waiter = future.waiters; + if (update == waiter) { + return waiter; + } + if (casWaiters(future, waiter, update)) { + return waiter; + } + } + } + /** Performs a CAS operation on the {@link #value} field. */ @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { @@ -1433,6 +1460,18 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna return listenersUpdater.compareAndSet(future, expect, update); } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + return listenersUpdater.getAndSet(future, update); + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + return waitersUpdater.getAndSet(future, update); + } + @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { return valueUpdater.compareAndSet(future, expect, update); @@ -1479,6 +1518,30 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna } } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + synchronized (future) { + Listener old = future.listeners; + if (old != update) { + future.listeners = update; + } + return old; + } + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + synchronized (future) { + Waiter old = future.waiters; + if (old != update) { + future.waiters = update; + } + return old; + } + } + @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { synchronized (future) { diff --git a/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java index a32e76cdc..6d2ed9c8e 100644 --- a/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java @@ -135,29 +135,26 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends // This is not actually a problem, since the foreach only needs this.futures to be non-null // at the beginning of the loop. int i = 0; - for (final ListenableFuture<? extends InputT> future : futures) { - final int index = i++; + for (ListenableFuture<? extends InputT> future : futures) { + int index = i++; future.addListener( - new Runnable() { - @Override - public void run() { - try { - if (future.isCancelled()) { - // Clear futures prior to cancelling children. This sets our own state but lets - // the input futures keep running, as some of them may be used elsewhere. - futures = null; - cancel(false); - } else { - collectValueFromNonCancelledFuture(index, future); - } - } finally { - /* - * "null" means: There is no need to access `futures` again during - * `processCompleted` because we're reading each value during a call to - * handleOneInputDone. - */ - decrementCountAndMaybeComplete(null); + () -> { + try { + if (future.isCancelled()) { + // Clear futures prior to cancelling children. This sets our own state but lets + // the input futures keep running, as some of them may be used elsewhere. + futures = null; + cancel(false); + } else { + collectValueFromNonCancelledFuture(index, future); } + } finally { + /* + * "null" means: There is no need to access `futures` again during + * `processCompleted` because we're reading each value during a call to + * handleOneInputDone. + */ + decrementCountAndMaybeComplete(null); } }, directExecutor()); @@ -179,15 +176,9 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends * could actually hurt in some cases, as it forces us to keep all inputs in memory until the * final input completes. */ - final ImmutableCollection<? extends Future<? extends InputT>> localFutures = + ImmutableCollection<? extends Future<? extends InputT>> localFutures = collectsValues ? futures : null; - Runnable listener = - new Runnable() { - @Override - public void run() { - decrementCountAndMaybeComplete(localFutures); - } - }; + Runnable listener = () -> decrementCountAndMaybeComplete(localFutures); for (ListenableFuture<? extends InputT> future : futures) { future.addListener(listener, directExecutor()); } @@ -247,8 +238,18 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends checkNotNull(seen); if (!isCancelled()) { /* - * requireNonNull is safe because this is a TrustedFuture, and we're calling this method only - * if it has failed. + * requireNonNull is safe because: + * + * - This is a TrustedFuture, so tryInternalFastPathGetFailure will in fact return the failure + * cause if this Future has failed. + * + * - And this future *has* failed: This method is called only from handleException (through + * getOrInitSeenExceptions). handleException tried to call setException and failed, so + * either this Future was cancelled (which we ruled out with the isCancelled check above), + * or it had already failed. (It couldn't have completed *successfully* or even had + * setFuture called on it: Neither of those can happen until we've finished processing all + * the completed inputs. And we're still processing at least one input, the one that + * triggered handleException.) * * TODO(cpovirk): Think about whether we could/should use Verify to check the return value of * addCausalChain. diff --git a/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java b/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java index 7ee831e95..99167db07 100644 --- a/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java +++ b/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java @@ -14,7 +14,6 @@ package com.google.common.util.concurrent; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.concurrent.Future; import org.checkerframework.checker.nullness.qual.Nullable; @@ -28,7 +27,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 20.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public interface AsyncCallable<V extends @Nullable Object> { diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java b/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java index 161fca83a..0da3715be 100644 --- a/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java +++ b/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java @@ -164,6 +164,7 @@ public class AtomicDouble extends Number implements java.io.Serializable { * * @param delta the value to add * @return the updated value + * @since 31.1 */ @CanIgnoreReturnValue public final double addAndGet(double delta) { diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java b/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java index 58407f5d5..fc8deed3b 100644 --- a/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java +++ b/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java @@ -69,7 +69,7 @@ public class AtomicDoubleArray implements java.io.Serializable { * @throws NullPointerException if array is null */ public AtomicDoubleArray(double[] array) { - final int len = array.length; + int len = array.length; long[] longArray = new long[len]; for (int i = 0; i < len; i++) { longArray[i] = doubleToRawLongBits(array[i]); @@ -188,6 +188,7 @@ public class AtomicDoubleArray implements java.io.Serializable { * @param i the index * @param delta the value to add * @return the updated value + * @since 31.1 */ @CanIgnoreReturnValue public double addAndGet(int i, double delta) { diff --git a/android/guava/src/com/google/common/util/concurrent/Callables.java b/android/guava/src/com/google/common/util/concurrent/Callables.java index 47b52643d..3b52c2e98 100644 --- a/android/guava/src/com/google/common/util/concurrent/Callables.java +++ b/android/guava/src/com/google/common/util/concurrent/Callables.java @@ -35,15 +35,8 @@ public final class Callables { private Callables() {} /** Creates a {@code Callable} which immediately returns a preset value each time it is called. */ - public static <T extends @Nullable Object> Callable<T> returning( - @ParametricNullness final T value) { - return new Callable<T>() { - @Override - @ParametricNullness - public T call() { - return value; - } - }; + public static <T extends @Nullable Object> Callable<T> returning(@ParametricNullness T value) { + return () -> value; } /** @@ -57,15 +50,10 @@ public final class Callables { @Beta @GwtIncompatible public static <T extends @Nullable Object> AsyncCallable<T> asAsyncCallable( - final Callable<T> callable, final ListeningExecutorService listeningExecutorService) { + Callable<T> callable, ListeningExecutorService listeningExecutorService) { checkNotNull(callable); checkNotNull(listeningExecutorService); - return new AsyncCallable<T>() { - @Override - public ListenableFuture<T> call() throws Exception { - return listeningExecutorService.submit(callable); - } - }; + return () -> listeningExecutorService.submit(callable); } /** @@ -78,22 +66,18 @@ public final class Callables { */ @GwtIncompatible // threads static <T extends @Nullable Object> Callable<T> threadRenaming( - final Callable<T> callable, final Supplier<String> nameSupplier) { + Callable<T> callable, Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(callable); - return new Callable<T>() { - @Override - @ParametricNullness - public T call() throws Exception { - Thread currentThread = Thread.currentThread(); - String oldName = currentThread.getName(); - boolean restoreName = trySetName(nameSupplier.get(), currentThread); - try { - return callable.call(); - } finally { - if (restoreName) { - boolean unused = trySetName(oldName, currentThread); - } + return () -> { + Thread currentThread = Thread.currentThread(); + String oldName = currentThread.getName(); + boolean restoreName = trySetName(nameSupplier.get(), currentThread); + try { + return callable.call(); + } finally { + if (restoreName) { + boolean unused = trySetName(oldName, currentThread); } } }; @@ -108,21 +92,18 @@ public final class Callables { * for each invocation of the wrapped callable. */ @GwtIncompatible // threads - static Runnable threadRenaming(final Runnable task, final Supplier<String> nameSupplier) { + static Runnable threadRenaming(Runnable task, Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(task); - return new Runnable() { - @Override - public void run() { - Thread currentThread = Thread.currentThread(); - String oldName = currentThread.getName(); - boolean restoreName = trySetName(nameSupplier.get(), currentThread); - try { - task.run(); - } finally { - if (restoreName) { - boolean unused = trySetName(oldName, currentThread); - } + return () -> { + Thread currentThread = Thread.currentThread(); + String oldName = currentThread.getName(); + boolean restoreName = trySetName(nameSupplier.get(), currentThread); + try { + task.run(); + } finally { + if (restoreName) { + boolean unused = trySetName(oldName, currentThread); } } }; @@ -130,7 +111,7 @@ public final class Callables { /** Tries to set name of the given {@link Thread}, returns true if successful. */ @GwtIncompatible // threads - private static boolean trySetName(final String threadName, Thread currentThread) { + private static boolean trySetName(String threadName, Thread currentThread) { /* * setName should usually succeed, but the security manager can prohibit it. Is there a way to * see if we have the modifyThread permission without catching an exception? diff --git a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java index c5ce0c45e..b8aec0337 100644 --- a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java @@ -36,7 +36,6 @@ import static java.util.logging.Level.FINER; import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.WARNING; -import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.collect.FluentIterable; @@ -191,7 +190,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @since 30.0 */ // TODO(dpb): Consider reusing one CloseableList for the entire pipeline, modulo combinations. -@Beta // @Beta for one release. @DoNotMock("Use ClosingFuture.from(Futures.immediate*Future)") @ElementTypesAreNonnullByDefault // TODO(dpb): GWT compatibility. diff --git a/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index b6b161d1a..decb5f1b1 100644 --- a/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -283,7 +283,7 @@ public class CycleDetectingLockFactory { checkNotNull(policy); @SuppressWarnings("unchecked") Map<E, LockGraphNode> lockGraphNodes = (Map<E, LockGraphNode>) getOrCreateNodes(enumClass); - return new WithExplicitOrdering<E>(policy, lockGraphNodes); + return new WithExplicitOrdering<>(policy, lockGraphNodes); } @SuppressWarnings("unchecked") @@ -308,7 +308,7 @@ public class CycleDetectingLockFactory { static <E extends Enum<E>> Map<E, LockGraphNode> createNodes(Class<E> clazz) { EnumMap<E, LockGraphNode> map = Maps.newEnumMap(clazz); E[] keys = clazz.getEnumConstants(); - final int numKeys = keys.length; + int numKeys = keys.length; ArrayList<LockGraphNode> nodes = Lists.newArrayListWithCapacity(numKeys); // Create a LockGraphNode for each enum value. for (E key : keys) { diff --git a/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java index 148f50b8f..80c777934 100644 --- a/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java +++ b/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java @@ -25,7 +25,6 @@ import static com.google.common.util.concurrent.Futures.immediateVoidFuture; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.Objects.requireNonNull; -import com.google.common.annotations.Beta; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; @@ -39,7 +38,14 @@ import org.checkerframework.checker.nullness.qual.Nullable; * until the {@code Future} it returned is {@linkplain Future#isDone done} (successful, failed, or * cancelled). * - * <p>This class has limited support for cancellation and other "early completion": + * <p>This class serializes execution of <i>submitted</i> tasks but not any <i>listeners</i> of + * those tasks. + * + * <p>Submitted tasks have a happens-before order as defined in the Java Language Specification. + * Tasks execute with the same happens-before order that the function calls to {@link #submit} and + * {@link #submitAsync} that submitted those tasks had. + * + * <p>This class has limited support for cancellation and other "early completions": * * <ul> * <li>While calls to {@code submit} and {@code submitAsync} return a {@code Future} that can be @@ -60,9 +66,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * safe for the next task to start.</i> * </ul> * - * <p>An additional limitation: this class serializes execution of <i>tasks</i> but not any - * <i>listeners</i> of those tasks. - * * <p>This class is similar to {@link MoreExecutors#newSequentialExecutor}. This class is different * in a few ways: * @@ -80,7 +83,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 26.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class ExecutionSequencer { @@ -141,7 +143,7 @@ public final class ExecutionSequencer { * {@link Callable#call()} will not be invoked. */ public <T extends @Nullable Object> ListenableFuture<T> submit( - final Callable<T> callable, Executor executor) { + Callable<T> callable, Executor executor) { checkNotNull(callable); checkNotNull(executor); return submitAsync( @@ -167,11 +169,11 @@ public final class ExecutionSequencer { * {@link AsyncCallable#call()} is invoked, {@link AsyncCallable#call()} will not be invoked. */ public <T extends @Nullable Object> ListenableFuture<T> submitAsync( - final AsyncCallable<T> callable, final Executor executor) { + AsyncCallable<T> callable, Executor executor) { checkNotNull(callable); checkNotNull(executor); - final TaskNonReentrantExecutor taskExecutor = new TaskNonReentrantExecutor(executor, this); - final AsyncCallable<T> task = + TaskNonReentrantExecutor taskExecutor = new TaskNonReentrantExecutor(executor, this); + AsyncCallable<T> task = new AsyncCallable<T>() { @Override public ListenableFuture<T> call() throws Exception { @@ -197,58 +199,55 @@ public final class ExecutionSequencer { * have completed - namely after oldFuture is done, and taskFuture has either completed or been * cancelled before the callable started execution. */ - final SettableFuture<@Nullable Void> newFuture = SettableFuture.create(); + SettableFuture<@Nullable Void> newFuture = SettableFuture.create(); - final ListenableFuture<@Nullable Void> oldFuture = ref.getAndSet(newFuture); + ListenableFuture<@Nullable Void> oldFuture = ref.getAndSet(newFuture); // Invoke our task once the previous future completes. - final TrustedListenableFutureTask<T> taskFuture = TrustedListenableFutureTask.create(task); + TrustedListenableFutureTask<T> taskFuture = TrustedListenableFutureTask.create(task); oldFuture.addListener(taskFuture, taskExecutor); - final ListenableFuture<T> outputFuture = Futures.nonCancellationPropagating(taskFuture); + ListenableFuture<T> outputFuture = Futures.nonCancellationPropagating(taskFuture); // newFuture's lifetime is determined by taskFuture, which can't complete before oldFuture // unless taskFuture is cancelled, in which case it falls back to oldFuture. This ensures that // if the future we return is cancelled, we don't begin execution of the next task until after // oldFuture completes. Runnable listener = - new Runnable() { - @Override - public void run() { - if (taskFuture.isDone()) { - // Since the value of oldFuture can only ever be immediateFuture(null) or setFuture of - // a future that eventually came from immediateFuture(null), this doesn't leak - // throwables or completion values. - newFuture.setFuture(oldFuture); - } else if (outputFuture.isCancelled() && taskExecutor.trySetCancelled()) { - // If this CAS succeeds, we know that the provided callable will never be invoked, - // so when oldFuture completes it is safe to allow the next submitted task to - // proceed. Doing this immediately here lets the next task run without waiting for - // the cancelled task's executor to run the noop AsyncCallable. - // - // --- - // - // If the CAS fails, the provided callable already started running (or it is about - // to). Our contract promises: - // - // 1. not to execute a new callable until the old one has returned - // - // If we were to cancel taskFuture, that would let the next task start while the old - // one is still running. - // - // Now, maybe we could tweak our implementation to not start the next task until the - // callable actually completes. (We could detect completion in our wrapper - // `AsyncCallable task`.) However, our contract also promises: - // - // 2. not to cancel any Future the user returned from an AsyncCallable - // - // We promise this because, once we cancel that Future, we would no longer be able to - // tell when any underlying work it is doing is done. Thus, we might start a new task - // while that underlying work is still running. - // - // So that is why we cancel only in the case of CAS success. - taskFuture.cancel(false); - } + () -> { + if (taskFuture.isDone()) { + // Since the value of oldFuture can only ever be immediateFuture(null) or setFuture of + // a future that eventually came from immediateFuture(null), this doesn't leak + // throwables or completion values. + newFuture.setFuture(oldFuture); + } else if (outputFuture.isCancelled() && taskExecutor.trySetCancelled()) { + // If this CAS succeeds, we know that the provided callable will never be invoked, + // so when oldFuture completes it is safe to allow the next submitted task to + // proceed. Doing this immediately here lets the next task run without waiting for + // the cancelled task's executor to run the noop AsyncCallable. + // + // --- + // + // If the CAS fails, the provided callable already started running (or it is about + // to). Our contract promises: + // + // 1. not to execute a new callable until the old one has returned + // + // If we were to cancel taskFuture, that would let the next task start while the old + // one is still running. + // + // Now, maybe we could tweak our implementation to not start the next task until the + // callable actually completes. (We could detect completion in our wrapper + // `AsyncCallable task`.) However, our contract also promises: + // + // 2. not to cancel any Future the user returned from an AsyncCallable + // + // We promise this because, once we cancel that Future, we would no longer be able to + // tell when any underlying work it is doing is done. Thus, we might start a new task + // while that underlying work is still running. + // + // So that is why we cancel only in the case of CAS success. + taskFuture.cancel(false); } }; // Adding the listener to both futures guarantees that newFuture will aways be set. Adding to @@ -422,7 +421,7 @@ public final class ExecutionSequencer { Executor queuedExecutor; // Intentionally using non-short-circuit operator while ((queuedTask = executingTaskQueue.nextTask) != null - & (queuedExecutor = executingTaskQueue.nextExecutor) != null) { + && (queuedExecutor = executingTaskQueue.nextExecutor) != null) { executingTaskQueue.nextTask = null; executingTaskQueue.nextExecutor = null; queuedExecutor.execute(queuedTask); diff --git a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java index 2b6ef9f55..683944c9e 100644 --- a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -70,7 +70,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 23.0 */ -@Beta @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault @@ -184,6 +183,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final <X extends Throwable> FluentFuture<V> catching( Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) { return (FluentFuture<V>) Futures.catching(this, exceptionType, fallback, executor); @@ -248,6 +248,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final <X extends Throwable> FluentFuture<V> catchingAsync( Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) { return (FluentFuture<V>) Futures.catchingAsync(this, exceptionType, fallback, executor); @@ -265,6 +266,7 @@ public abstract class FluentFuture<V extends @Nullable Object> */ @GwtIncompatible // ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + @Beta public final FluentFuture<V> withTimeout( long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) { return (FluentFuture<V>) Futures.withTimeout(this, timeout, unit, scheduledExecutor); @@ -309,6 +311,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @return A future that holds result of the function (if the input succeeded) or the original * input's failure (if not) */ + @Beta public final <T extends @Nullable Object> FluentFuture<T> transformAsync( AsyncFunction<? super V, T> function, Executor executor) { return (FluentFuture<T>) Futures.transformAsync(this, function, executor); @@ -346,6 +349,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor Executor to run the function in. * @return A future that holds result of the transformation. */ + @Beta public final <T extends @Nullable Object> FluentFuture<T> transform( Function<? super V, T> function, Executor executor) { return (FluentFuture<T>) Futures.transform(this, function, executor); diff --git a/android/guava/src/com/google/common/util/concurrent/Futures.java b/android/guava/src/com/google/common/util/concurrent/Futures.java index e6bf7a7c1..6bd68b4b5 100644 --- a/android/guava/src/com/google/common/util/concurrent/Futures.java +++ b/android/guava/src/com/google/common/util/concurrent/Futures.java @@ -170,7 +170,11 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @since 14.0 */ public static <V extends @Nullable Object> ListenableFuture<V> immediateCancelledFuture() { - return new ImmediateCancelledFuture<V>(); + ListenableFuture<Object> instance = ImmediateCancelledFuture.INSTANCE; + if (instance != null) { + return (ListenableFuture<V>) instance; + } + return new ImmediateCancelledFuture<>(); } /** @@ -179,7 +183,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 28.2 */ - @Beta public static <O extends @Nullable Object> ListenableFuture<O> submit( Callable<O> callable, Executor executor) { TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable); @@ -194,7 +197,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 28.2 */ - @Beta public static ListenableFuture<@Nullable Void> submit(Runnable runnable, Executor executor) { TrustedListenableFutureTask<@Nullable Void> task = TrustedListenableFutureTask.create(runnable, null); @@ -208,7 +210,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 23.0 */ - @Beta public static <O extends @Nullable Object> ListenableFuture<O> submitAsync( AsyncCallable<O> callable, Executor executor) { TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable); @@ -222,9 +223,9 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 23.0 */ - @Beta @GwtIncompatible // java.util.concurrent.ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + // TODO(cpovirk): Return ListenableScheduledFuture? public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync( AsyncCallable<O> callable, long delay, @@ -743,7 +744,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * * @since 15.0 */ - @Beta public static <V extends @Nullable Object> ListenableFuture<V> nonCancellationPropagating( ListenableFuture<V> future) { if (future.isDone()) { @@ -807,22 +807,22 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @return a future that provides a list of the results of the component futures * @since 10.0 */ - /* - * Another way to express this signature would be to bound <V> by @NonNull and accept LF<? extends - * @Nullable V>. That might be better: There's currently no difference between the outputs users - * get when calling this with <Foo> and calling it with <@Nullable Foo>. The only difference is - * that calling it with <Foo> won't work when an input Future has a @Nullable type. So why even - * make that error possible by giving callers the choice? - * - * On the other hand, the current signature is consistent with the similar allAsList method. And - * eventually this method may go away entirely in favor of an API like - * whenAllComplete().collectSuccesses(). That API would have a signature more like the current - * one. - */ @Beta @SafeVarargs public static <V extends @Nullable Object> ListenableFuture<List<@Nullable V>> successfulAsList( ListenableFuture<? extends V>... futures) { + /* + * Another way to express this signature would be to bound <V> by @NonNull and accept + * LF<? extends @Nullable V>. That might be better: There's currently no difference between the + * outputs users get when calling this with <Foo> and calling it with <@Nullable Foo>. The only + * difference is that calling it with <Foo> won't work when an input Future has a @Nullable + * type. So why even make that error possible by giving callers the choice? + * + * On the other hand, the current signature is consistent with the similar allAsList method. And + * eventually this method may go away entirely in favor of an API like + * whenAllComplete().collectSuccesses(). That API would have a signature more like the current + * one. + */ return new ListFuture<V>(ImmutableList.copyOf(futures), false); } @@ -871,7 +871,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * * @since 17.0 */ - @Beta public static <T extends @Nullable Object> ImmutableList<ListenableFuture<T>> inCompletionOrder( Iterable<? extends ListenableFuture<? extends T>> futures) { ListenableFuture<? extends T>[] copy = gwtCompatibleToArray(futures); diff --git a/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java b/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java index 81912f5d8..8b1c17ae4 100644 --- a/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java @@ -98,6 +98,9 @@ class ImmediateFuture<V extends @Nullable Object> implements ListenableFuture<V> } static final class ImmediateCancelledFuture<V extends @Nullable Object> extends TrustedFuture<V> { + static final @Nullable ImmediateCancelledFuture<Object> INSTANCE = + AbstractFuture.GENERATE_CANCELLATION_CAUSES ? null : new ImmediateCancelledFuture<>(); + ImmediateCancelledFuture() { cancel(false); } diff --git a/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java b/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java index 168adf24b..bcec00730 100644 --- a/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java +++ b/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java @@ -240,7 +240,7 @@ abstract class InterruptibleTask<T extends @Nullable Object> @Override public final String toString() { Runnable state = get(); - final String result; + String result; if (state == DONE) { result = "running=[DONE]"; } else if (state instanceof Blocker) { diff --git a/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java b/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java index 82f8d950d..0b0db4573 100644 --- a/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java +++ b/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java @@ -56,7 +56,7 @@ public final class JdkFutureAdapters { if (future instanceof ListenableFuture) { return (ListenableFuture<V>) future; } - return new ListenableFutureAdapter<V>(future); + return new ListenableFutureAdapter<>(future); } /** @@ -85,7 +85,7 @@ public final class JdkFutureAdapters { if (future instanceof ListenableFuture) { return (ListenableFuture<V>) future; } - return new ListenableFutureAdapter<V>(future, executor); + return new ListenableFutureAdapter<>(future, executor); } /** @@ -150,22 +150,19 @@ public final class JdkFutureAdapters { // TODO(lukes): handle RejectedExecutionException adapterExecutor.execute( - new Runnable() { - @Override - public void run() { - try { - /* - * Threads from our private pool are never interrupted. Threads from a - * user-supplied executor might be, but... what can we do? This is another reason - * to return a proper ListenableFuture instead of using listenInPoolThread. - */ - getUninterruptibly(delegate); - } catch (Throwable e) { - // ExecutionException / CancellationException / RuntimeException / Error - // The task is presumably done, run the listeners. - } - executionList.execute(); + () -> { + try { + /* + * Threads from our private pool are never interrupted. Threads from a + * user-supplied executor might be, but... what can we do? This is another reason + * to return a proper ListenableFuture instead of using listenInPoolThread. + */ + getUninterruptibly(delegate); + } catch (Throwable e) { + // ExecutionException / CancellationException / RuntimeException / Error + // The task is presumably done, run the listeners. } + executionList.execute(); }); } } diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java b/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java index cf0199ade..a8d9dd4de 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -116,15 +116,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -/* - * It would make sense to also annotate this class with @ElementTypesAreNonnullByDefault. However, - * it makes no difference because this class is already covered by the package-level - * @ParametersAreNonnullByDefault, and this class declares only parameters, not return types or - * fields. (Not to mention that we'll be removing all @*AreNonnullByDefault annotations after tools - * understand .) And it's fortunate that the annotation makes no difference, because - * we're seeing a breakage internally when we add that annotation :) - * - */ +@ElementTypesAreNonnullByDefault public interface ListenableFuture<V extends @Nullable Object> extends Future<V> { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java b/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java index 9fdcc53ed..678a6c671 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java @@ -59,7 +59,7 @@ public class ListenableFutureTask<V extends @Nullable Object> extends FutureTask * @since 10.0 */ public static <V extends @Nullable Object> ListenableFutureTask<V> create(Callable<V> callable) { - return new ListenableFutureTask<V>(callable); + return new ListenableFutureTask<>(callable); } /** @@ -74,7 +74,7 @@ public class ListenableFutureTask<V extends @Nullable Object> extends FutureTask */ public static <V extends @Nullable Object> ListenableFutureTask<V> create( Runnable runnable, @ParametricNullness V result) { - return new ListenableFutureTask<V>(runnable, result); + return new ListenableFutureTask<>(runnable, result); } ListenableFutureTask(Callable<V> callable) { diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java b/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java index e5aa5e302..f6e5d9f9e 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java @@ -14,7 +14,6 @@ package com.google.common.util.concurrent; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.concurrent.ScheduledFuture; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +24,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Anthony Zana * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public interface ListenableScheduledFuture<V extends @Nullable Object> diff --git a/android/guava/src/com/google/common/util/concurrent/Monitor.java b/android/guava/src/com/google/common/util/concurrent/Monitor.java index d88a8bcb2..d8da62de2 100644 --- a/android/guava/src/com/google/common/util/concurrent/Monitor.java +++ b/android/guava/src/com/google/common/util/concurrent/Monitor.java @@ -16,7 +16,6 @@ package com.google.common.util.concurrent; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.primitives.Longs; import com.google.errorprone.annotations.concurrent.GuardedBy; @@ -197,7 +196,6 @@ import javax.annotation.CheckForNull; * @author Martin Buchholz * @since 10.0 */ -@Beta @GwtIncompatible @SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress. @ElementTypesAreNonnullByDefault @@ -301,7 +299,6 @@ public final class Monitor { * * @since 10.0 */ - @Beta public abstract static class Guard { @Weak final Monitor monitor; @@ -735,7 +732,7 @@ public final class Monitor { * @throws InterruptedException if interrupted while waiting */ public void waitFor(Guard guard) throws InterruptedException { - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (!guard.isSatisfied()) { @@ -753,7 +750,7 @@ public final class Monitor { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException { final long timeoutNanos = toSafeNanos(time, unit); - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { @@ -770,7 +767,7 @@ public final class Monitor { * currently occupying this monitor. */ public void waitForUninterruptibly(Guard guard) { - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (!guard.isSatisfied()) { @@ -787,7 +784,7 @@ public final class Monitor { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public boolean waitForUninterruptibly(Guard guard, long time, TimeUnit unit) { final long timeoutNanos = toSafeNanos(time, unit); - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { diff --git a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java index eaf6501e9..791a417c6 100644 --- a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java +++ b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java @@ -379,14 +379,22 @@ public final class MoreExecutors { * difficult to reproduce because they depend on timing. For example: * * <ul> - * <li>A call like {@code future.transform(function, directExecutor())} may execute the function - * immediately in the thread that is calling {@code transform}. (This specific case happens - * if the future is already completed.) If {@code transform} call was made from a UI thread - * or other latency-sensitive thread, a heavyweight function can harm responsiveness. - * <li>If the task will be executed later, consider which thread will trigger the execution -- - * since that thread will execute the task inline. If the thread is a shared system thread - * like an RPC network thread, a heavyweight task can stall progress of the whole system or - * even deadlock it. + * <li>When a {@code ListenableFuture} listener is registered to run under {@code + * directExecutor}, the listener can execute in any of three possible threads: + * <ol> + * <li>When a thread attaches a listener to a {@code ListenableFuture} that's already + * complete, the listener runs immediately in that thread. + * <li>When a thread attaches a listener to a {@code ListenableFuture} that's + * <em>in</em>complete and the {@code ListenableFuture} later completes normally, the + * listener runs in the the thread that completes the {@code ListenableFuture}. + * <li>When a listener is attached to a {@code ListenableFuture} and the {@code + * ListenableFuture} gets cancelled, the listener runs immediately in the the thread + * that cancelled the {@code Future}. + * </ol> + * Given all these possibilities, it is frequently possible for listeners to execute in UI + * threads, RPC network threads, or other latency-sensitive threads. In those cases, slow + * listeners can harm responsiveness, slow the system as a whole, or worse. (See also the + * note about locking below.) * <li>If many tasks will be triggered by the same event, one heavyweight task may delay other * tasks -- even tasks that are not themselves {@code directExecutor} tasks. * <li>If many such tasks are chained together (such as with {@code @@ -402,9 +410,11 @@ public final class MoreExecutors { * terminate whichever thread happens to trigger the execution. * </ul> * - * Additionally, beware of executing tasks with {@code directExecutor} while holding a lock. Since - * the task you submit to the executor (or any other arbitrary work the executor does) may do slow - * work or acquire other locks, you risk deadlocks. + * A specific warning about locking: Code that executes user-supplied tasks, such as {@code + * ListenableFuture} listeners, should take care not to do so while holding a lock. Additionally, + * as a further line of defense, prefer not to perform any locking inside a task that will be run + * under {@code directExecutor}: Not only might the wait for a lock be long, but if the running + * thread was holding a lock, the listener may deadlock or break lock isolation. * * <p>This instance is equivalent to: * @@ -427,8 +437,11 @@ public final class MoreExecutors { /** * Returns an {@link Executor} that runs each task executed sequentially, such that no two tasks - * are running concurrently. Submitted tasks have a happens-before order as defined in the Java - * Language Specification. + * are running concurrently. + * + * <p>{@linkplain Executor#execute executed} tasks have a happens-before order as defined in the + * Java Language Specification. Tasks execute with the same happens-before order that the function + * calls to {@link Executor#execute `execute()`} that submitted those tasks had. * * <p>The executor uses {@code delegate} in order to {@link Executor#execute execute} each task in * turn, and does not create any threads of its own. @@ -466,7 +479,6 @@ public final class MoreExecutors { * * @since 23.3 (since 23.1 as {@code sequentialExecutor}) */ - @Beta @GwtIncompatible public static Executor newSequentialExecutor(Executor delegate) { return new SequentialExecutor(delegate); diff --git a/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java b/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java index 0a0d719ef..a3a914e89 100644 --- a/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java +++ b/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java @@ -65,7 +65,8 @@ final class NullnessCasts { * return to a caller, the code needs to a way to return {@code null} from a method that returns * "plain {@code T}." This API provides that. */ - @SuppressWarnings("nullness") + @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"}) + // The warnings are legitimate. Each time we use this method, we document why. @ParametricNullness static <T extends @Nullable Object> T uncheckedNull() { return null; diff --git a/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java index ebc5928cf..a745bf7bb 100644 --- a/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java index 052c7e012..d0b600be8 100644 --- a/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java +++ b/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java @@ -96,10 +96,10 @@ final class SequentialExecutor implements Executor { * execution of tasks will stop until a call to this method is made. */ @Override - public void execute(final Runnable task) { + public void execute(Runnable task) { checkNotNull(task); - final Runnable submittedTask; - final long oldRunCount; + Runnable submittedTask; + long oldRunCount; synchronized (queue) { // If the worker is already running (or execute() on the delegate returned successfully, and // the worker has yet to start) then we don't need to start the worker. diff --git a/android/guava/src/com/google/common/util/concurrent/ServiceManager.java b/android/guava/src/com/google/common/util/concurrent/ServiceManager.java index 2e1c21a1f..5177b5ac0 100644 --- a/android/guava/src/com/google/common/util/concurrent/ServiceManager.java +++ b/android/guava/src/com/google/common/util/concurrent/ServiceManager.java @@ -262,8 +262,7 @@ public final class ServiceManager implements ServiceManagerBridge { @CanIgnoreReturnValue public ServiceManager startAsync() { for (Service service : services) { - State state = service.state(); - checkState(state == NEW, "Service %s is %s, cannot start it.", service, state); + checkState(service.state() == NEW, "Not all services are NEW, cannot start %s", this); } for (Service service : services) { try { diff --git a/android/guava/src/com/google/common/util/concurrent/SettableFuture.java b/android/guava/src/com/google/common/util/concurrent/SettableFuture.java index 893161e27..0a9e19465 100644 --- a/android/guava/src/com/google/common/util/concurrent/SettableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/SettableFuture.java @@ -40,7 +40,7 @@ public final class SettableFuture<V extends @Nullable Object> * Creates a new {@code SettableFuture} that can be completed or cancelled by a later method call. */ public static <V extends @Nullable Object> SettableFuture<V> create() { - return new SettableFuture<V>(); + return new SettableFuture<>(); } @CanIgnoreReturnValue diff --git a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 5a1969e01..c6ade6a3a 100644 --- a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -73,35 +73,27 @@ public final class SimpleTimeLimiter implements TimeLimiter { @Override public <T> T newProxy( - final T target, - Class<T> interfaceType, - final long timeoutDuration, - final TimeUnit timeoutUnit) { + T target, Class<T> interfaceType, long timeoutDuration, TimeUnit timeoutUnit) { checkNotNull(target); checkNotNull(interfaceType); checkNotNull(timeoutUnit); checkPositiveTimeout(timeoutDuration); checkArgument(interfaceType.isInterface(), "interfaceType must be an interface type"); - final Set<Method> interruptibleMethods = findInterruptibleMethods(interfaceType); + Set<Method> interruptibleMethods = findInterruptibleMethods(interfaceType); InvocationHandler handler = new InvocationHandler() { @Override @CheckForNull - public Object invoke( - Object obj, final Method method, @CheckForNull final @Nullable Object[] args) + public Object invoke(Object obj, Method method, @CheckForNull @Nullable Object[] args) throws Throwable { Callable<@Nullable Object> callable = - new Callable<@Nullable Object>() { - @Override - @CheckForNull - public Object call() throws Exception { - try { - return method.invoke(target, args); - } catch (InvocationTargetException e) { - throw throwCause(e, false /* combineStackTraces */); - } + () -> { + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + throw throwCause(e, false /* combineStackTraces */); } }; return callWithTimeout( diff --git a/android/guava/src/com/google/common/util/concurrent/Striped.java b/android/guava/src/com/google/common/util/concurrent/Striped.java index fc8bcd8f3..2ea61cb32 100644 --- a/android/guava/src/com/google/common/util/concurrent/Striped.java +++ b/android/guava/src/com/google/common/util/concurrent/Striped.java @@ -206,14 +206,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<Lock>} */ public static Striped<Lock> lock(int stripes) { - return custom( - stripes, - new Supplier<Lock>() { - @Override - public Lock get() { - return new PaddedLock(); - } - }); + return custom(stripes, PaddedLock::new); } /** @@ -224,14 +217,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<Lock>} */ public static Striped<Lock> lazyWeakLock(int stripes) { - return lazy( - stripes, - new Supplier<Lock>() { - @Override - public Lock get() { - return new ReentrantLock(false); - } - }); + return lazy(stripes, () -> new ReentrantLock(false)); } private static <L> Striped<L> lazy(int stripes, Supplier<L> supplier) { @@ -248,15 +234,8 @@ public abstract class Striped<L> { * @param permits the number of permits in each semaphore * @return a new {@code Striped<Semaphore>} */ - public static Striped<Semaphore> semaphore(int stripes, final int permits) { - return custom( - stripes, - new Supplier<Semaphore>() { - @Override - public Semaphore get() { - return new PaddedSemaphore(permits); - } - }); + public static Striped<Semaphore> semaphore(int stripes, int permits) { + return custom(stripes, () -> new PaddedSemaphore(permits)); } /** @@ -267,15 +246,8 @@ public abstract class Striped<L> { * @param permits the number of permits in each semaphore * @return a new {@code Striped<Semaphore>} */ - public static Striped<Semaphore> lazyWeakSemaphore(int stripes, final int permits) { - return lazy( - stripes, - new Supplier<Semaphore>() { - @Override - public Semaphore get() { - return new Semaphore(permits, false); - } - }); + public static Striped<Semaphore> lazyWeakSemaphore(int stripes, int permits) { + return lazy(stripes, () -> new Semaphore(permits, false)); } /** @@ -286,7 +258,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<ReadWriteLock>} */ public static Striped<ReadWriteLock> readWriteLock(int stripes) { - return custom(stripes, READ_WRITE_LOCK_SUPPLIER); + return custom(stripes, ReentrantReadWriteLock::new); } /** @@ -297,25 +269,8 @@ public abstract class Striped<L> { * @return a new {@code Striped<ReadWriteLock>} */ public static Striped<ReadWriteLock> lazyWeakReadWriteLock(int stripes) { - return lazy(stripes, WEAK_SAFE_READ_WRITE_LOCK_SUPPLIER); + return lazy(stripes, WeakSafeReadWriteLock::new); } - - private static final Supplier<ReadWriteLock> READ_WRITE_LOCK_SUPPLIER = - new Supplier<ReadWriteLock>() { - @Override - public ReadWriteLock get() { - return new ReentrantReadWriteLock(); - } - }; - - private static final Supplier<ReadWriteLock> WEAK_SAFE_READ_WRITE_LOCK_SUPPLIER = - new Supplier<ReadWriteLock>() { - @Override - public ReadWriteLock get() { - return new WeakSafeReadWriteLock(); - } - }; - /** * ReadWriteLock implementation whose read and write locks retain a reference back to this lock. * Otherwise, a reference to just the read lock or just the write lock would not suffice to ensure @@ -441,7 +396,7 @@ public abstract class Striped<L> { final AtomicReferenceArray<@Nullable ArrayReference<? extends L>> locks; final Supplier<L> supplier; final int size; - final ReferenceQueue<L> queue = new ReferenceQueue<L>(); + final ReferenceQueue<L> queue = new ReferenceQueue<>(); SmallLazyStriped(int stripes, Supplier<L> supplier) { super(stripes); @@ -461,7 +416,7 @@ public abstract class Striped<L> { return existing; } L created = supplier.get(); - ArrayReference<L> newRef = new ArrayReference<L>(created, index, queue); + ArrayReference<L> newRef = new ArrayReference<>(created, index, queue); while (!locks.compareAndSet(index, existingRef, newRef)) { // we raced, we need to re-read and try again existingRef = locks.get(index); diff --git a/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java b/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java index 1027f3c83..091f56e79 100644 --- a/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java +++ b/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java @@ -151,15 +151,15 @@ public final class ThreadFactoryBuilder { // Split out so that the anonymous ThreadFactory can't contain a reference back to the builder. // At least, I assume that's why. TODO(cpovirk): Check, and maybe add a test for this. private static ThreadFactory doBuild(ThreadFactoryBuilder builder) { - final String nameFormat = builder.nameFormat; - final Boolean daemon = builder.daemon; - final Integer priority = builder.priority; - final UncaughtExceptionHandler uncaughtExceptionHandler = builder.uncaughtExceptionHandler; - final ThreadFactory backingThreadFactory = + String nameFormat = builder.nameFormat; + Boolean daemon = builder.daemon; + Integer priority = builder.priority; + UncaughtExceptionHandler uncaughtExceptionHandler = builder.uncaughtExceptionHandler; + ThreadFactory backingThreadFactory = (builder.backingThreadFactory != null) ? builder.backingThreadFactory : Executors.defaultThreadFactory(); - final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; + AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; return new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { diff --git a/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java index 219a0981a..ed8a7bfdb 100644 --- a/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java @@ -161,7 +161,7 @@ final class TimeoutFuture<V extends @Nullable Object> extends FluentFuture.Trust if (localInputFuture != null) { String message = "inputFuture=[" + localInputFuture + "]"; if (localTimer != null) { - final long delay = localTimer.getDelay(TimeUnit.MILLISECONDS); + long delay = localTimer.getDelay(TimeUnit.MILLISECONDS); // Negative delays look confusing in an error message if (delay > 0) { message += ", remaining delay=[" + delay + " ms]"; diff --git a/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java b/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java index a2c2115c3..929c9fb1e 100644 --- a/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java +++ b/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java @@ -37,11 +37,11 @@ class TrustedListenableFutureTask<V extends @Nullable Object> extends FluentFutu static <V extends @Nullable Object> TrustedListenableFutureTask<V> create( AsyncCallable<V> callable) { - return new TrustedListenableFutureTask<V>(callable); + return new TrustedListenableFutureTask<>(callable); } static <V extends @Nullable Object> TrustedListenableFutureTask<V> create(Callable<V> callable) { - return new TrustedListenableFutureTask<V>(callable); + return new TrustedListenableFutureTask<>(callable); } /** @@ -55,7 +55,7 @@ class TrustedListenableFutureTask<V extends @Nullable Object> extends FluentFutu */ static <V extends @Nullable Object> TrustedListenableFutureTask<V> create( Runnable runnable, @ParametricNullness V result) { - return new TrustedListenableFutureTask<V>(Executors.callable(runnable, result)); + return new TrustedListenableFutureTask<>(Executors.callable(runnable, result)); } /* diff --git a/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java index a33ba8286..c2c6f7ca8 100644 --- a/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java +++ b/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java @@ -17,7 +17,6 @@ package com.google.common.util.concurrent; import static com.google.common.base.Verify.verify; import static java.util.concurrent.TimeUnit.NANOSECONDS; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Preconditions; @@ -410,7 +409,6 @@ public final class Uninterruptibles { * * @since 30.0 */ - @Beta @GwtIncompatible // concurrency public static void awaitTerminationUninterruptibly(ExecutorService executor) { // TODO(cpovirk): We could optimize this to avoid calling nanoTime() at all. @@ -423,7 +421,6 @@ public final class Uninterruptibles { * * @since 30.0 */ - @Beta @GwtIncompatible // concurrency @SuppressWarnings("GoodTime") public static boolean awaitTerminationUninterruptibly( diff --git a/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java b/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java index 03c08cc2f..5a3c3927a 100644 --- a/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java @@ -62,16 +62,13 @@ abstract class WrappingExecutorService implements ExecutorService { * delegates to {@link #wrapTask(Callable)}. */ protected Runnable wrapTask(Runnable command) { - final Callable<Object> wrapped = wrapTask(Executors.callable(command, null)); - return new Runnable() { - @Override - public void run() { - try { - wrapped.call(); - } catch (Exception e) { - throwIfUnchecked(e); - throw new RuntimeException(e); - } + Callable<Object> wrapped = wrapTask(Executors.callable(command, null)); + return () -> { + try { + wrapped.call(); + } catch (Exception e) { + throwIfUnchecked(e); + throw new RuntimeException(e); } }; } diff --git a/android/guava/src/com/google/common/xml/ParametricNullness.java b/android/guava/src/com/google/common/xml/ParametricNullness.java index a476558fb..e4e5d12f0 100644 --- a/android/guava/src/com/google/common/xml/ParametricNullness.java +++ b/android/guava/src/com/google/common/xml/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/android/guava/src/com/google/common/xml/XmlEscapers.java b/android/guava/src/com/google/common/xml/XmlEscapers.java index a1c637c35..33241f3f3 100644 --- a/android/guava/src/com/google/common/xml/XmlEscapers.java +++ b/android/guava/src/com/google/common/xml/XmlEscapers.java @@ -14,7 +14,6 @@ package com.google.common.xml; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.Escaper; import com.google.common.escape.Escapers; @@ -38,7 +37,6 @@ import com.google.common.escape.Escapers; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public class XmlEscapers { diff --git a/android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java b/android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java index 9e5f17366..c987065e4 100644 --- a/android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java +++ b/android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java @@ -42,7 +42,7 @@ public final class PublicSuffixPatterns { /** If a hostname is contained as a key in this map, it is a public suffix. */ public static final ImmutableMap<String, PublicSuffixType> EXACT = TrieParser.parseTrie( - "a&0&0trk9--nx?27qjf--nx?e9ebgn--nx?nbb0c7abgm--nx??1&2oa08--nx?apg6qpcbgm--nx?hbbgm--nx?rdceqa08--nx??2&8ugbgm--nx?eyh3la2ckx--nx?qbd9--nx??3&2wqq1--nx?60a0y8--nx??4x1d77xrck--nx?6&1f4a3abgm--nx?2yqyn--nx?3np8lv81qo3--nx?5b06t--nx?axq--nx?ec7q--nx?lbgw--nx??883xnn--nx?9d2c24--nx?a&a?it??b!.&gro?lim?moc?sr,t&en?opsgolb,?ude?vog??abila?c?ihsot?m?n??c!.&b&a?m?n??c&b?g?q??ep?fn?k&s?y??ln?no?oc,p&i-on,ohsdaerpsym,?sn?t&n?opsgolb,?un?ysrab,?i&ma?r&emarp?fa??sroc??naiva?s??d&ats?n&eit?oh??om?sa?tl??eg?f&c?ob??g!emo?naripi?oy??hskihs?i&cnal?dem?hs?k!on??sa!.snduolc,??jnin?k&aso?dov?ede?usto??l!.&c,gro?moc?ofni?r&ep?nb,?t&en?ni??ude?vog??irgnahs?le&nisiuc?rbmuder???m!.&ca?gro?oc?sserp?ten?vog??ahokoy?e00sf7vqn--nx?m??n!.&ac?cc?eman?gro?ibom?loohcs?moc?ni?o&c?fni?rp??r&d?o??s&u?w??vt?xm??av?is?olecrab?tea??p!.&bog?ca?d&em?ls??g&ni?ro??mo&c?n??oba?ten?ude??c?g7hyabgm--nx?ra!.&461e?6pi?iru?nru?rdda-ni?siri???s??q!.&eman?gro?hcs?lim?moc?t&en?opsgolb,?ude?vog???r&az?emac?f4a3abgm--nx?n!d5uhf8le58r4w--nx??u&kas?tan???s!.&bup?dem?gro?hcs?moc?ten?ude?vog??ac!.uban.iu,?iv??t&ad?elhta?led?oyot??u!.&a&cinniv?emirc?i&hzhziropaz?stynniv??s&edo?sedo??tlay?vatlop??bs?cc,d&argovorik?o!roghzu??tl,?e&hzhziropaz?nvir?t??f&i?ni,?g&l?ro??hk?i&stvinrehc?ykstynlemhk??k&c?m?s&nagul?t&enod?ul??v&iknarf-onavi?orteporp&end?ind?????l&iponret?opotsa&bes?ves??p??m&k?oc?s?yrk??n&c?d?i?osrehk?v?ylov??o&c,nvor??p&d?p,z??r&c?imotihz?k?ymotyhz??sk?t&en?l?z??ude?v:c?e&alokin?ik??i&alokym?hinrehc?krahk?vl?yk??k?l?o&g!inrehc??krahk??r?,xc,y&ikstinlemhk?mus?s&akrehc?sakrehc?tvonrehc???z&ib,u????v!aj?bb?et?iv??waniko?x&a?iacal??yogan?z&.&bew?c&a?i&n?rga???gro?l&im?oohcs??m&on?t??o&c!.topsgolb,?gn??radnorg?sin?t&en?la??ude?vog?wal??zip???b&00ave5a9iabgm--nx?1&25qhx--nx?68quv--nx?e2kc1--nx??2xtbgm--nx?3&b2kcc--nx?jca1d--nx??4&6&1rfz--nx?qif--nx??96rzc--nx??7w9u16qlj--nx?88uvor--nx?a&0dc4xbgm--nx?c?her?n?ra?t??b!.&erots?gro?moc?o&c?fni??ten?ude?v&og?t??zib??a??c&j?s??d&hesa08--nx?mi??g?l!.&gro?moc?ten?ude?vog??m??s!.&gro?moc?ten?ude?vog???tc-retarebsnegmrev--nx?u&lc!.&elej,snduolc,y&nop,srab,??smas??p!.ysrab,??wp-gnutarebsnegmrev--nx??c&1&1q54--nx?hbgw--nx??2e9c2czf--nx?4&4ub1km--nx?a1e--nx?byj9q--nx?erd5a9b1kcb--nx??8&4xx2g--nx?c9jrb2h--nx??9jr&b&2h--nx?54--nx?9s--nx??c&eg--nx?h3--nx?s2--nx???a!.&gro?lim?moc?rrd,ten?ude?vog??3a09--nx!.&ca1o--nx?gva1c--nx?h&ca1o--nx?za09--nx??ta1d--nx?ua08--nx???da??b&a?b?ci?f76a0c7ylqbgm--nx?sh??c!.&eugaelysatnaf,gnipparcs,liamwt,revres-emag,s&nduolc,otohpym,seccaptf,?xsc,?0atf7b45--nx?a1l--nx??e!.&21k?bog?dem?gro?lim?moc?nif?o&fni?rp??ten?ude?vog??beuq?n?smoc??fdh?i&l&buperananab?ohtac??n&agro?ilc?osanap??sum?tic??l!.&gro?moc?oc?ten?ude?vog?yo,?l??m!.&mt?ossa??p1akcq--nx??n!.&mon?ossa??i?p??relcel?s!.&gro?moc?ten?ude?vog??c??t!.&e&m,w,?hc,?s?w??v!.&e0,gro?lim?moc?ten?ude?v&g:.d,,og???q??wp?yn??d&2urzc--nx?3&1wrpk--nx?c&4b11--nx?9jrcpf--nx???5xq55--nx?697uto--nx?75yrpk--nx?9ctdvkce--nx?a!.mon?d?er?olnwod??b2babgm--nx?c!.vog?g9a2g2b0ae0chclc--nx??e&m!bulc??r!k??sopxe?timil?w??fc?g!.&ude?vog???h&d3tbgm--nx?p?t??i!.&ased?bew?ca?etrof,golbw,hcs?lim?o&c!.topsgolb,?g??palf,r&egolb,o??sepnop?ten?ym?zib??ar?b?ordna?p?rdam??l&iub?og?row??m!.&ed,ot,pj,t&a,opsgolb,???n&a&b?l!.citats:.&setis,ved,?,raas???ob?uf??o&of?rp??r&a&c&tiderc?yalcrab??ugnav??ef506w4b--nx?k!.&oc,ude,?jh3a1habgm--nx??of??s!.&dem?gro?moc?ofni?ten?ude?v&og?t???m!kcrem???t!.topsgolb,excwkcc--nx?l??uolc!.&a&bura-vnej.&1ti,abura.rue.1ti,?tcepsrep,xo:.&ku,nt,?,?bewilek:.sc,,citsalej.piv,drayknil,elej,gnitsohdnert.&ed,hc,?letemirp:.ku,,m&edaid,ialcer.&ac,ku,su,??n&evueluk,woru,?r&epolroov,o&pav,tnemele,??tenraxa.1-se,ululetoj,xelpciffart,??za5cbgn--nx??e&1&53wlf--nx?7a1hbbgm--nx?ta3kg--nx??2a6a1b6b1i--nx?3ma0e1cvr--nx?418txh--nx?707b0e3--nx?a!.&ca?gro?hcs?lim?oc?t&en?opsgolb,?vog??09--nx??b!.&ca?gnitsohbew,nevueluk.yxorpze,pohsdaerpsym,snoitulostsohretni.duolc,topsgolb,?ortal?ut!uoy???c&0krbd4--nx?a&lp!.oc,?ps!.&lla4sx,rebu,tsafym,?artxe??sla??i!ffo??n&a&d?iler?nif?rusni!efil?srelevart???eics!.oby,??rofria??d!.&1sndnyd,42pi-nyd,7erauqs,amil4,b&ow-nrefeilgitsng--nx,rb-ni,vz-nelletsebgitsng--nx,?decalpb,e&daregtmueart,mohsnd,nihcamyek,?hcierebsnoissuksid,keegnietsi,lsd-ni,moc,n&-i-g-o-l,aw-ym,e&lletsebgitsnüg,sgnutiel,?i&emtsi,lreb-n&i,yd,??oitatsksid-ygolonys,pv&-n&i,yd,?nyd,?refeilgitsnüg,?orp-ytinummoc,p&h21,iog:ol,,ohsdaerpsym,?r&e&ntrapdeeps.remotsuc,su&-lautriv,lautriv,?t&adpusnd,tub-ni,uor-ym,?vres&-e&bucl,mohym,?bew-emoh:.nyd,,luhcs,??ogiv-&niem,ym,??s&d-&onys,ygolonys,?nd&-&dd,nufiat,sehcsimanyd,tenretni,yard,?isoc.nyd,ps,yard,?oper-&nvs,tig,?sndd:.&nyd,sndnyd,?,?topsgolb,vresi-&niem,tset,?xi2,y&awetag-&llawerif,ym,?srab,tic-amil,?zten&mitbel,sadtretteuf,??a&lg?rt!.oby,??i&sdoow?ug??nil?on--nx??e!.&bil?dem?eif?gro?irp?kiir?moc!.topsgolb,?pia?ude?vog??ei?ffoc?gg?r&f?ged???f&a&c?s??il??g!.&gro?lim?moc?t&en?vp??ude?vog??a&f?gtrom?p!.&3xlh,kselp,sndp,tengam,xlh,ycvrp,??rots?yov??elloc?na&hcxe?ro??roeg?ug??i!.&pohsdaerpsym,topsgolb,vog??tilop?v&bba?om???j!.&fo,gro?oc?ten???k!.&c&a?s??e&m?n??ibom?o&c!.topsgolb,?fni?g??ro??i&b?l?n???l&a&dmrif?s!.rof,rof???b&a?i&b?dua???c&aro?ric??dnik?g!oog??i&bom?ms??l&asal?erauqa??ppa?uhcs?yts!efil???m!.&4&32i,pct,?66c,ailisarb,b&dnevar,g-raegelif,?ca?duolcsd,e&d-raegelif,i&-raegelif,lpad:.tsohlacol,,?pcm,?g&ro?s-raegelif,?hctilg,k&catsegde,uoc,?noitatsksid,o&bmoy,c!ku,?t&nigol,poh,??p&ion,j-raegelif,ohbew,?qbw,r&aegelif,idcm,ofsnd,?s&dym,ndd,ti!bt,?umhol,?t&en?s&acdnuos,ohon,??u&a-raegelif,de?tcn,?v&irp?og??y&golonys,olpedew,srab,??a&g?n!.&reh.togrof,sih.togrof,???em?i&rp?twohs??orhc?w??n!goloc?i&lno!.&egats-oree,oree,ysrab,??w??o!.&derno:.gnigats,,ecivres,knilemoh,r&ednu,of,??hp?latipac?ts&der?e&gdirb?rif???z!.&66duolc,amil,sh,???ruoblem??om?p!.&bog?gro?lim?mo&c?n??t&en?opsgolb,?ude??irg?yks??r!.&mo&c?n??ossa?topsgolb,?a&c!htlaeh??pmoc?wtfos??bc?eh?if?ots!.&e&rawpohs,saberots,?yflles,??taeht?u&ces?sni?t&inruf?necca??za???s!.&a!bap.us,?b!ibnal?rofmok??c!a??d!b?n&arb?ubroflanummok???e?f!noc,?g!ro??h!f??i!trap??k!shf??l?m!oc,t??n!mygskurbrutan??o?p!ohsdaerpsym,p??r!owebdluocti,?s!serp?yspoi,?t!opsgolb,?u?vhf?w?x!uvmok??y?z??a&c?el?hc??i&er?urc??nesemoh?roh?uoh??t&a&d?ts&e!laer??lla???is!.&areduolc,e&lej,nilnigol,r&etnim,ocevon,?winmo,?k&rowtenoilof,wnf,?laicosnepo,n&eyb,oyc,?spvtsaf,thrs,xulel,ysrab,?bew??ov?ra?t&ioled?ol??utitsni??u&lb?qi&nilc?tuob???v!.&21e?b&ew?og??ce&r?t??erots?gro?lim?m&oc?rif??o&c?fni??stra?t&en?ni??ude?vog??as?e3gerb2h--nx?i&l!.xlh,?rd?ssergorp??ol??w&kct--nx?r??xul?y!.&gro?lim?moc?ten?ude?vog????f&0f3rkcg--nx?198xim--nx?280xim--nx?7vqn--nx?a!.&gro?moc?ten?ude?vog???b!.vog?wa9bgm--nx??c!.topsgolb,a1p--nx!.&a14--nx,b8lea1j--nx,c&avc0aaa08--nx,ma09--nx,?f&a1a09--nx,ea1j--nx,?gva1c--nx,nha1h--nx,pda1j--nx,zila1h--nx,??ns??ea1j--nx?fo?g?iam?l&a1d--nx?og??n!.&bew?cer?erots?m&oc?rif??ofni?re&hto?p??stra?ten???orp?p!.&gro?moc?ude???rus?t!w??vd7ckaabgm--nx?w??g&2&4wq55--nx?8zrf6--nx??3&44sd3--nx?91w6j--nx!.&a5wqmg--nx?d&22svcw--nx?5xq55--nx??gla0do--nx?m1qtxm--nx?vta0cu--nx????455ses--nx?5mzt5--nx?69vqhr--nx?7&8a4d5a4prebgm--nx?rb2c--nx??a!.&gro?mo&c?n??oc?ten??vd??b!.&0?1?2?3?4?5?6?7?8?9?a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t!opsgolb,?u?v?w?x?y!srab,?z???c!b?za9a0cbgm--nx??e!.&eman?gro?ics?lim?moc!.topsgolb,?nue?ten?ude?vog??a??g!.&ayc,gro?lenap:.nomead,,oc?saak,ten???i&a?v??k!.&g&olb,ro??ku,lim?moc?oi,pj,su,ten?ude?v&og?t,???m!.&drp?gro?lim?m&o&c?n??t??oc?ude?vog??pk??n!.&dtl,eman?gro?hcs?i!bom??l&im?oc,?m&oc!.topsgolb,?rif,?neg,ogn,ten?ude?vog??aw?i!b!mulp??car?d&art?dew??h&sif?tolc??k&iv?oo&b?c???ls?n&aelc?iart??p!pohs??re&enigne?tac??t&ad?ekram!.&htiw,morf,??hgil?lusnoc?neg?ov?soh!.tfarcnepo,??vi&g?l???o!s??u&rehcisrev?smas?tarebsnegömrev???o&d?lb?og!.&duolc,etalsnart,???r&2n084qlj--nx?ebmoolb?o!.&77ndc.c:sr,,a&remacytirucesym,t&neimip,sivretla,?z,?bew-llams,d&ab-yrev-si,e&sufnocsim,vas-si,?nuof-si,oog-yrev-si,uolc&arfniarodef,mw,??e&a,cin-yrev-si,grof&loot,peh,?l&as-4-ffuts,poeparodef,?m&-morf,agevres,ohruoyslles,?n&ozdop,uma.elet,?r&ehwongniogyldlob,iwym,uces-77ndc.nigiro.lss,?t&adidnac-a-si,is&-ybboh,golb,???fehc-a-si,golbymdaer,k&eeg-a&-si,si,?h,nut,?l&i&amwt,ve-yrev-si,?lawerif&-ym,ym,?sd-ni,?m&acssecca,edom-elbac,?n&af&blm,cfu,egelloc,lfn,s&citlec-a-si,niurb-a-si,tap-a-si,?xos-a-si,?ibptth,o&itatsksid,rviop,?pv-ni,?o&jodsnd,tp&az,oh,??p&i&-on,fles,?o&hbew,tksedeerf,?tf&e&moh,vres,?ym,??r&e&gatop,ppepteews,su-xunil-a-si,?gmtrec,vdmac,?s&a&ila&nyd,snd,?nymsd,?b&alfmw,bevres,?dylimaf,eirfotatophcuoc,j,koob-daer,ltbup,nd&-won,deerf,emoh,golb,kcud,mood,nyd:.&emoh,og,?,ps,rvd,tog,uolc,?s&a-skcik,ndd,?tnemhcattaomb,u,?t&ce&jorparodef.&duolc,gts.so.ppa,so.ppa,?riderbew,?e&ews-yrev-si,nretni&ehtfodne,fodne,??hgink-a-si,igude,oi-allizom,s&ixetn&od,seod,?o&h-emag,l-si,?rifyam,??ue:.&a&-q,c,?cm,dc,e&b,d,e,i,m,s,?g&b,n,?hc,i&f,s,?k&d,m,s,u,?l&a,i,n,p,?n&c,i,?o&n,r,ssa,?pj,r&f,g,h,k,t,?s&e,i:rap,,u,?t&a,en,i,l,m,ni,p,?u&a,de,h,l,r,?vl,y&c,m,?z&c,n,??,vresnyd,x&inuemoh,unilemoh,?y&limafxut,srab,???ub&mah?oj???s!.&delacsne,gro?moc?rep?t&en?opsgolb,?ude?vog??gb639j43us5--nx??t?u!.&c&a?s??en?gro?moc?o&c?g??ro?topsgolb,??v!.ta,a1c--nx??wsa08--nx??h&0ee5a3ld2ckx--nx?4wc3o--nx!.&a&2xyc3o--nx?3j0hc3m--nx?ve4b3c0oc21--nx??id1kzuc3h--nx?l8bxi8ifc21--nx?rb0ef1c21--nx???8&8yvfe--nx?a7maabgm--nx??b!.&gro?moc?ten?ude?vog??mg??c!.&7erauqs,amil4,duolc-drayknil,gniksnd,p&h21,ohsdaerpsym,?sndtog,topsgolb,wolf.e&a.1pla,nigneppa,?xi2,ytic-amil,?aoc?et?ir!euz??r&aes!errecnac??uhc??sob?taw!s???d0sbgp--nx?f&2lpbgm--nx?k??g!.&gro?lim?moc?ude?vog???m!a1j--nx??ocir?p!.&gro?i?lim?moc?ogn?ten?ude?vog???s!.&g&nabhsah,ro??l&im?xv,?m&oc?roftalp.&cb,su,tne,ue,??pib,ten?vog?won,yolpedew,?a&c?nom??i&d?f?ri???t!.&ca?enilno,im?ni?o&c?g??pohs,ro?ten??iaf!.oby,?laeh!.arh,?orxer?ra&ba?e???vo!.lopdren,?zb??i&3tupk--nx?7a0oi--nx?a!.&ffo?gro?moc?ten?uwu,?1p--nx?bud?dnuyh?tnihc??b!.&gro?moc?oc?ro?ude??ahduba?o!m!.&duolcsd,ysrab,???s??c!.&ayb-tropora--nx?ca?d&e?m??esserp?gro?ln,moc?nif,o&c?g?ssa??ro?t&en?ni?roporéa??ude?vuog??cug?t??d&dk?ua??e&bhf--nx?piat??f!.&aw5-nenikkh--nx,dnala?iki,mroftalpduolc.if,nenikkäh,pohsdaerpsym,retnecatad.&omed,saap,?topsgolb,yd,?onas??g!.&d&om?tl??gro?moc?ude?vog???h&c&atih?ra??s&abodoy?ibustim???juohs?k!.&gro?moc?ofni?ten?ude?vog?zib??b4gc--nx?iw?nisleh?s?uzus??l!.&aac,topsgolb,?drahcir?iamsi??maim?n!.&b&ew?og??ca?gro?lim?mo&c?n??ni?o&c?fni??pp?t&en?ni??ude?zib??airpic?i&hgrobmal?m??re??om?rarref?s!.&egaptig,ppatig,topsgolb,?ed??t&aresam?i&c?nifni??rahb?tagub??ut?v!.&21k?gro?moc?oc?ten???wik?xa&rp?t??yf??j&6pqgza9iabgm--nx?8da1tabbgl--nx?b!.&ossa?topsgolb,uaerrab?vuog???d?f!.&ca?eman?gro?lim?moc?o&fni?rp??ten?vog?zib???nj?s?t!.&bew?c&a?in??eman?gro?lim?moc?o&c?g??t&en?ni?set??ude?vog?zib???yqx94qit--nx??k&8uxp3--nx?924tcf--nx?arfel?c&a&bdeef?lb??ebdnul?ilc?reme?ud??d!.&erots,ger,mrif,oc,pohsdaerpsym,topsgolb,zib,?t??e&es?samet??h!.&a&4ya0cu--nx?5wqmg--nx??b3qa0do--nx?cni,d&2&2svcw--nx?3rvcl--nx??5xq55--nx?tl,?g&a0nt--nx?la0do--nx?ro??i&050qmg--nx?7a0oi--nx?xa0km--nx??m&1qtxm--nx?oc??npqic--nx?saaces,t&en?opsgolb,?ude?v&di?og?ta0cu--nx??xva0fz--nx?人&个?個?箇??司公?府政?絡&網?网??織&組?组??织&組?组??络&網?网??育&敎?教???n??i&tsob?vdnas??l!.&bew?c&a?os??dtl?gro?hcs?letoh?moc?nssa?ogn?prg?t&en?ni??ude?vog??at?cd?is??m!.&eman?fni?gro?moc?t&en?opsgolb,?ude?vog???n&ab!cfdh?etats?mmoc?t&en?fos??u??i!l!.&noyc,pepym,??p???oob?p!.&b&ew?og??gro?kog?m&af?oc??nog?ofni?pog?sog?ten?ude?vog?zib???row!.&morf,ot,?ten!.&htumiza,nolt,o&c,vra,??doof???s!.topsgolb,?t?u!.&c&a?lp??d&om?tl??e&cilop?m??gro!.&gul:g,,sgul,??nnoc,o&c!.&bunsorter.tsuc,e&lddiwg,n&ilnoysrab,ozgniebllew,??krametyb.&hd,mv,?omida,p&i-on,ohsdaerpsym,?t&fihsreyal.j,opsgolb,?vres-hn,ysrab,??rpoc,?psoh,shn?t&en?nmyp,?vog!.eci&ffoemoh,vres,??ysrab,???l&04sr4w--nx?a!.&gro?lim?moc?t&en?opsgolb,?ude?vog??bolg?c?ed?g!el??i&c&nanif!.oc,lpl??os??romem?tnedurp??n&if?oitanretni??t&i&gid!.sppaduolc:.nodnol,,?p&ac?soh???ned?ot??utum!nretsewhtron???c!.&bog?lim?oc?topsgolb,vog???dil?e&datic?n&ahc?nahc!gnikooc?levart?rehtaew???t!ria?tam??vart??f&8f&pbgo--nx?tbgm--nx??a?n??g!.&gro?moc?oc?ten?ude?xx,zib,??h&d?op??i!.&21k?ca?fdi?gro?inum?oc!.&egapvar,topsgolb,??ten?vog??a&f?m&e?g?toh???m?r?xil??l&a&b&esab?t&eksab!.&sua,zn,??oof???c?mt??e&d?hs??ihmailliw?j??m!.&esserp?gro?moc?ten?ude?v&og?uog????n!.&n&iemodleeutriv,o&med,rtsic,??oc,pohsdaerpsym,retsulc-gnitsoh,topsgolb,wsma,yalphk,?o??o&a?btuf?l!.gmo,?o&c!.&ed,rotnemele,??hcs??rit?u??p!.&a&cin&diws?gel??d&g,ortso?urawon??i&dem?mraw?nydg,?k&elo&guld?rtso??slopolam?tsu?ytsyrut??l&ip?o&kzs?w&-awolats?oksnok????n&erapohs,img?zcel,?rog&-ai&bab?nelej??j?z??syn?tsaim?w&a&l&eib?i?o??zsraw??o&namil?tainop,??z&eiwolaib?mol???c&e&iw&alselob?o&nsos?rtso???le&im?zrogz???orw,p??d&em,ia?ragrats?uolc&inu,sds,??e&c&i&lrog?w&ilg,o&hc&arats?orp??klop?tak????yzreibok??i&csjuoniws?ksromop?saldop??l&ahdop?opo??napokaz,tatselaer?z&romop?swozam???g&alble?ezrbo&lok?nrat??ro??hcyzrblaw?i&csomohcurein?grat?klawus??k&e&rut?walcolw??in&byr?diws,sark,?le?o&nas?tsylaib??rob&el?lam??s&als?jazel?nadg,puls?rowezrp???l&colw?e&r?vart??i&am?m???m&o&c?dar?n?tyb??s&g?iruot??t!a???n&a&gaz?nzop,?i&bul?cezczs?lbul,molow?nok?zd&eb?obeiws???uleiw?y&tzslo?z&rtek?seic????o&c,fni?k&celo?zdolk??lkan?n&leim?pek?t&uk?yzczs??z&copo?eing?rowaj???rga?tua?w&ejarg?ogarm???p&e&eb,lks??klwwortso?ohs!daerpsym,??romophcaz?sos?t&aiwop?en?opos,ra,sezc??ude?v&irp?og!.&a&p?s!w???bni&p?w??ci?dtiw?essp?fiw?g&imu?u??hiiw?m&igu?rio?u!o???nds?o&ks?p!pu??s?wtsorats??p&a?sp!mk?pk?wk??u&m?p??wk?z??r&ksw?s??s&i?oiw?u?zu??talusnok?w&gzr?i&p?rg?w??m?opu?u!imzw???zouw????w&a&l&corw?sizdow??w??o&golg?k&ark,ul?zsurp??r&az?gew??t&rabul,sugua??z&coks?sezr????xes?y&buzsak?d&azczseib?ikseb??hcyt?n&jes?lod-zreimizak??pal?r&ogt?uzam??walup?zutrak??z&am-awar?c&aprak?iwol?zsogdyb??dalezc?ib?s&i&lak?p??uklo????l??r&as?f?s??s!.&gro?moc?ten?ude?vog???t!.vog??ubnatsi?x3b689qq6--nx?yc5rb54--nx??m&00tsb3--nx?1qtxm--nx?981rvj--nx?a!.&aayn,enummoc?gro?moc?o&c?idar,ken,?t&en?opsgolb,??c!bew??dretsma?e&rts?t!.&citsalej,esruocsid,???fma?xq--nx??b!.&gro?moc?ten?ude?vog??i??c!.&moc?oc?ten?vog???d!.&gro?moc?ten?ude?vog???f!.&gro?moc?oidar,ten?ude??i??g!vu96d8syzf--nx??h?i!.&ca?gro?moc?o&c!.&clp?dtl???r,?t&en?t??vt??k?rbg4--nx??k!.&drp?e&rianiretev?sserp??gro?lim?m&o&c?n??t??nicedem?ossa?pooc?s&eriaton?neicamrahp?sa??ude?v&og?uog????l&if?ohkcots??o!.&dem?gro?m&oc?uesum??o&c?rp??ten?ude?vog??b?c!.&2aq,3pmevres,5sndd,a&c&-morf,ir&bafno,fa,??g&-morf,oy-sehcaet,?i-morf,m&-morf,all&-a-si,amai,??p&-morf,c-a-si,?r&emacytirucesym,odih,?s,tadtsudgniht,v-morf,w-morf,z,?b&dnevarym,ew&-sndnyd,draiw.segap,ottad,?g,ildts.ipa,?c&amytirucesemoh,d-morf,esyrcs,itsalej.omed,n&-morf,vym,?p&kroweht,ytirucesemoh,?q,rievres,s-morf,?d&aerotffuts,e&calpb,ifitrec-&si,ton-si,?llortnocduolc,rewopenignepw:.sj,,tsohecapsppa,?i&-morf,rgevissam.saap,?m-morf,n&-morf,abeht-htiw-si,?s-morf,uolc&-noitatsyalp,hr,iafaw.&d&ej,yr,?nol,?meaeboda,panqym:-&ahpla,ved,?,smetsystuo,tekcilc,ved&j,pw,??vreser,wetomer,?e&butuoyhtiw,ciffo-sndnyd,d:-morf,o&celgoog,n&il.srebmem,neve.&1-&su,ue,?2-&su,ue,?3-&su,ue,?4-&su,ue,????,erf&-sndnyd,sndd,?filflahevres,gnahcxeevres,i&hcet-a-si,p-sekil,?k&auqevres,irtsretnuocevres,?l&bitpa-no,googhtiw,?m&agevres,ina-otni-si,oh-&sndnyd,ta-sndnyd,??n&-morf,ilno&-evreser,ysrab,?og-si,?r&alfduolcyrt,ehwynanohtyp:.ue,,ihcec,?srun-a-si,t&i&nuarepo,s&-ybboh,aloy,tipohs,xiw,??omer-sndnyd,upmocsma,ysgolb,?v&als-elcibuc-a-si,i&lsndd,tavresnoc-a-si,??z&amkcar,eelg,iig,??fehc-a-si,g&ni&gats-&raeghtua,swennwot,?ksndd,robsikrow,?o&fgp,lb&-sndnyd,pawodni,sihtsetirw,???h&n-morf,o-morf,?i&fiwehtno,h-morf,kiw-sndnyd,m-morf,pdetsoh,r-morf,w-morf,z&ihcppa,nilppa,??jn-morf,k&a&-morf,erfocsic,?cils-si,eeg&-a&-si,si,?sndd,?h,latsnaebcitsale:.&1-&htuos-pa,lartnec-&ac,ue,?ts&ae&-&as,su,?ht&ron-pa,uos-pa,??ew-&su,ue,vog-su,???2-ts&ae&-su,ht&ron-pa,uos-pa,??ew-&su,ue,??3-ts&aehtron-pa,ew-ue,??,o-morf,r&adhtiwtliub,ow&-&sndnyd,ta-sndnyd,?ten-orehkcats,??u,?l&a&-morf,colottad,rebil-a-si,?f-morf,i&-morf,am&-sndnyd,detsohpw,??l&ecelffaw,uf-ytnuob:.a&hpla,teb,?,?ppmswa,ru-&elpmis,taen,?ssukoreh,xegap,?m&n-morf,pml.ppa,rofererac-htlaeh,sacrasevres,uirarret-yltsaf,?n&a&cilbuper-a-si,f&-sllub-a-si,racsan-a-si,?i&cisum-a-si,ratrebil-a-si,??c,dc&hsums,umpw,xirtrepmi,?eerg-a-si,i-morf,m-morf,o&ehtnaptog,isam-al-a-tse,r&italik,tap-el-tse,?s&iam-al-a-tse,replausunu,??pj,t-morf,?o&bordym,c,hce-namtsop,jodsnd,m&-morf,ed-baltlow,?n:iloxip,,ttadym,?p&2pevres,aelutym,i&-sndnyd,fles,ogol,ruoy&esol,hctid,?ym&eerf,teg,??ohsdaerpsym,pa&-rettalp,anis:piv,,esaberif,k1,lortnocduolc,oifilauq,r&aegyks,oetem:.ue,,?tnorfegap,ukoreh,?t&fevres,thevres,??r&a:-morf,tskcor-a-si,,b,e&d&iv&erp-yb-detsoh.saap,orpnwo,?ner&.ppa,no,??e&bevres,nigne-na-si,?ggolb&-a-si,ndi,?h&caet-a-si,pargotohp-a-si,?krow-drah-a-si,n&gised-a-si,ia&rtlanosrep-a-si,tretne-na-si,??p&acsdnal-a-si,eekkoob-a-si,?retac-a-si,subq,tn&ecysrab,iap-a-si,uh-a-si,?vres&-&ki.&cpj-rev-duolcj,duolcj,?s&ndnyd,pvtsaf,??inim,nmad,sak,?y&alp-a-si,wal-a-si,?zilibomdeepsegap,?g,ituob,k,mgrp.nex,o&-morf,sivdalaicnanif-a-si,t&areleccalabolgswa,c&a-na-si,od-a-si,?susaym,??p-morf,u&as-o-nyd,e&tsoh.&duolc-gar,hc-duolc-gar,?ugolb-nom-tse,?omuhevres,??s&a&apod,ila&nyd,snd,?nymsd,vnacremarf,?bbevres,ci&p&-sndnyd,evres,?tcatytiruces,?dylimaf,e&cived-anelab,itilitu3,lahw-eht-sevas,mag-otni-si,t&isro,yskciuq,??i&ht2tniop,pa&elgoog,tneltneg,??jfac,k&-morf,aerf-ten,colb&egrof,pohsym,??m&-morf,cxolb,?n&d&-pmet,dyard,golb,mood,tog,?kselp,nyd,ootrac-otni-si,?o&-xobeerf,xobeerf,?ppa&raeghtua,tneg,?r&ac-otni-si,e&ntrap-paelut,tsohmaerd,??s&e&l-rof-slles,rtca-na-si,?ibodym,?tsaeb-cihtym.&a&llicno,zno,?ilay,lacarac,re&gitnef,motsuc,?sv,toleco,x:n&ihps,yl,?,?u,wanozama.&1-&htuos-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??la&nretxe-3s,rtnec-&ac&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????ts&ae&-&as&-&3s,etisbew-3s,?.kcatslaud.3s,?su:-etisbew-3s,.kcatslaud.3s,,?ht&ron-pa&-&3s,etisbew-3s,?.kcatslaud.3s,?uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-&3s,etisbew-3s,?.kcatslaud.3s,?vog-su-&3s,spif-3s,????2-ts&ae&-su&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ht&ron-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????3&-tsew-ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,??s,???t&arcomed-a-si,c&-morf,etedatad.&ecnatsni,omed,??eel&-si,rebu-si,?hgilfhtiwletoh,m-morf,n&atnuocca-na-si,e&duts-a-si,r-ot-ecaps,tnocresu&buhtig,e&capsppa,lbavresbo.citats,?pl,???ops&edoc,golb,ppa,?s&i&hcrana-&a-si,na-si,?laicos-a-si,pareht-a-si,tra-na-si,xetn&od,seod,??oh&piym,sfn,??u&-morf,nyekcoh-asi,?v-morf,?u&-rof-slles,4,e,h,oynahtretramssi,r:ug-a-si,,?v&n-morf,w-morf,?w&o&lpwons-yrt,zok,?ww100,?x&bsbf.sppa,em,i&nuemoh,rtrepmi,?obaniateb,t-morf,unilemoh,?y&a&bnx:.&2u,lacol-2u,?,l&erottad,pezam,?wetag-llawerif,?dnacsekil,fipohsym,k&-morf,niksisnd,?rotceridevitcaym,u:goo,,w-morf,x&alagkeeg,orphsilbup,???inu??m!.&dna,rof,??or?tsla??p!.nwo,?raf!.jrots,etats??s?t!.&gro?lim?mo&c?n??oc?ten?ude?vog???u&esum!.&a&92chg-seacinumocelet-e-soierroc--nx?atnav?c&i&aduj?rfatsae??rollam??d&anac?enomaledasac?irolf??e&raaihpledalihp?srednu??g&hannavas?oonattahc??hamo?i&auhsu?bmuloc!hsitirb??dem?groeg?hpledalihp?l&artsua?etalif??n&igriv?rofilac??ssur?tsonod??ksa&la?rben??l&lojal?q-snl--nx?uossim!trof???m&a&bala?nap??enic?o&m?r???n&a&cirema?idni??edasap?ilorachtuos?olecrab??r&abrabatnas?ezzivs??su?t&nalta?osennim??zalp??c&dnotgnihsaw?ebeuq?i&depolcycne?ficap?hpargonaeco?lbup?sum?t&carporihc?lec?naltadim??vu??yn??d&a&dhgab?etsmraf?m?orliar??i&rdam?ulegnedleeb??leif?n&a!l&gne?nif?ragyduj?t&ocs?rop??yram???u&brofsdgybmeh?osdnaegami???r&augria?ofxo???e&c&a&l&ap?phtrib??ps??n&a&lubma?tsiser??e&fedlatsaoc?gilletni?ics!foyrotsih????pein?rof??d&nukneklov?revasem??e&rt?tsurt??f&atnas?ildliw??g&a&lliv?tireh!lanoitan???dirbmac?rog??i&cnum?nollaw??koorbrehs?l&ab?bib?cycrotom?i&ssim?txet??oks?tsac??m&affollah?it!iram??utsoc??n&golos?ilno?recul??r&a&uqs?waled!foetats???i&hs&acnal?kroy?pmahwen??otsih??omitlab?ut&an?cetihcra?inruf?luc!irga?su???vuol??s&abatad?iacnarf?sius?uoh!lum???t&a&locohc?rak?ts!e!yrtnuoc!su?????imesoy?tevroc??u&qihpargonaeco?velleb??vit&caretni?omotua???f&iuj?ohgrub??g&n&i&dliub?ginerevmuesum?kiv?lahw?nim?peekemit?vil??ulmmastsnuk??orf?r&ebnrats?u&b&ierf?le?m&ah?uan??ram?s&mailliw!lainoloc??naitsirhc?retepts??zlas??ob&irf?mexul?????h&atu?c&raeser?sirotsih?uot??g&ea1h--nx?rubsttip??si&tirb?wej??t&laeh?ro&n?wtrof??uo&mnom?y????i&d6glbhbd9--nx?iawah?k&nisleh?s??lad!rodavlas??sissa?tannicnic??k&c&nivleeg?olc!-dna-hctaw?dnahctaw???fj?inebis?l&is?ofron??na&rfenna?t??oorbnarc?r&am&ned?reiets??oy!wen????l&a&ci&dem?golo&eahcra?meg?oz??natob?rotsih??ertnom?iromem?noita&cude?n??oc?rutluc?trop?utriv?van??e&nurb?s&ab?surb??utriv??i&artnogero?sarb??l&a&besab?hsnoegrus??e&hs?rdnevle??i&b?m!dniw????o&bup?ohcs?tsirb???m&a&dretsma?ets?h&netlehc?rud???ct?elas!urej??l&if?ohkcots?u??raf?silanruoj?u&esumyrotsihlarutan?ira&tenalp?uqa??terobra???n&a&c!irema!evitan???gihcim?i&dni?tpyge??mfoelsi?wehctaksas??e&d&alokohcs?ews?rag!cinatob?lacinatob?s&nerdlihc?u????gahnepoc?hcneum?laftsew?ppahcsnetewruutan?r&dlihc?ednaalv?hu!dnutamieh???sseig??gised!dn&atra?utsnuk???h&ab!nesie??ojts??i&lreb?tsua??l&eok?ocnil??n&ob?urbneohcs??o&dnol?gero?i&s&iv&dnadnuos?elet??nam??t&a&c&inummoc?ude!tra???dnuof?erc?i&cossa?va??kinummokelet?nissassa?r&belectsevrah?oproc?tsulli??silivic?t&nalp?s??vres&erp?noclatnemnorivne??zilivic??c&elloc?if-ecneics??ibihxe???ri?s&dnah?imaj?reffej?sral??t&erbepac?nilc?sob???r&e&b?dom?tsew?uab?zul??obredap??vahnebeok?wot??o&2a6v-seacinumoc--nx?ablib?c&edtra?ixemwen?sicnarfnas??elap?g&a&cihc?to??eidnas??i&cadnuf?diserp?ratno??llecitnom?mitiram?nirot?r&htna?ienajedoir???pohskrow?qari?r&aw!dloc?livic??dd?e&b&ma?yc??irrac?llimsiwel?naksiznarf?papswen?t&aeht?exe?nec!ecneics?larutluc?muesum?tra??s&ehc&nam?or??neum??upmoc???ia!nepo??obal?u&asonid?obal?takirak???s&a&l&g?l&ad?eh???xet??di&k?pardnarg??e&cneics!larutan??dnal?hcsi&deuj?rotsih!nizidem?rutan??selhcs??itinamuh?l&aw?egnasol?l&e&rutansecneics?xurb??iasrev???r&e&em?ugif??tsac??suohcirotsih?u&en?q&adac?itna!nacirema?su????õçacinumoc!elet-e-soierroc???gnirpsmlap?htab?i&lopanaidni?rap?uoltnias?xa??l&essurb?lod??mraeriflanoitan?n&a&blats?l??erdlihc?oi&snam?tacinummoc!elet-dna-stsop???äl??re&dnalf?lttes?mraf?nim?tnececneics??s&alg?erp??t&farc!dnastra??nalp?olip?ra!e&nif?vitaroced!su???su?xuaeb???u&b!muloc??cric???t&agilltrop?cejorp?dats?e&esum?kramnaidni??iorted?ne&m&elttes?norivne?piuqemraf??vnoc??oped?r&a!drib?enif?gttuts?hsiwej?kcor?n&acirema?ootrac??tamsa?yraropmetnoc??op&aes?snart?wen??ufknarf??s&a&cdaorb?octsae??ewhtuos?ilayol?nuk?r&ohnemled?uhlyram??urt???u&a&bgreb?etalpodaroloc??rmyc??w&ocsom?rn??x&esse?ineohp?nam?tas??y&a&bekaepasehc?w&etag?liar???camrahp?doc?e&hsub?l&ekreb?l&av!eniwydnarb??ort???n&dys?om??rrus?s&nreug?rejwen???golo&e&ahcra?g??motne?nh&cet?te??oz?po&rhtna?t??roh??hpargotohp?l&etalihp?imaf??m&edaca?onortsa??n&atob?yn??ps?r&a&ropmetnoc?tilim??e&diorbme?llag!tra??vocsid??lewej?nosameerf?otsih!dnaecneics?ecneics?gnivil!su??la&col?rutan??retupmoc?su??tsudnidnaecneics??spelipe?t&eicos!lacirotsih??i&nummoc?srevinu??nuoc???z&arg?iewhcs?nil?ojadab?urcatnas??моки?םילשורי???rof??z!.&ca?gro?hcs?lim?moc?o&c?fni??ten?ude?vog?zib????n&315rmi--nx?a&brud?cilbuper?f?grompj?hkaga?idraug?m?ol?ssin?u&hix?qna??varac?yalo??b!.&gro?moc?oc,ten?ude?vog??c??c!.&ah?bh?c&a?s??d&5xq55--nx?g?s?uolctnatsni,?eh?g&la0do--nx?ro??h&a?q?s??i&7a0oi--nx?h??j&b?f?t?x?z??kh?l&h?im?j??m&n?oc!.swanozama.&1-htron-nc.3s,be.1-&htron-nc,tsewhtron-nc,????n&h?l?s?y??om?qc?s&g?j??ten?ude?vog?wt?x&g?j?n?s??z&g?x??司公?絡網?络网??b??d&g!.ypnc,?ka??e&drag?erg?fuak?gawsklov?hctik?i&libommi?w??m!.r&iaper,of,??po?r!ednaalv??sier?ves??g!.&ca?gro?moc?ten?ude?vog??is&ed!.ssb,?irev???h!.&bog?cc,gro?lim?moc?ten?ude???i!.&bew,c&a?in??dni?esabapus,gro?lim?mrif?neg?oc?s&er?nduolc,?t&en?opsgolb,?ude?vog?ysrab,?elknivlac?griv?ks?lreb?p?v?w!.taht,?x??k!.&gro?ten?ude?vog???l&eok?ocnil??m!.&cyn,gro?ude?vog???o&dnol!.&fo,ni,??i&hsaf!.fo,?n&o?utiderc??siv!orue??t&a&cude!.oc,?dnuof?tsyalp??c&etorp?u&a?rtsnoc?????kin?las?mrom?nac?p&q?uoc??s&iam?nhojcs?pe?scire??t&ron?sob??zama??p!.&gro?oc?ten?ude?vog??k??r&e&c?yab??op!.eidni,??s!.&gro?moc?osrep?t&opsgolb,ra??ude?v&inu?uog????t!.&d&ni?uolcegnaro,?esnefed?gro?ltni?m&oc!nim??siruot??n&erut?if??o&fni?srep??sn&e?r??t&an?en!irga?ude??rnr??unr?vog??m??u&f?r!.&bdnevar,lper,sh,tnempoleved,??stad?xamay?y??v!.&ca?eman?gro?htlaeh?moc?o&fni?rp??t&en?ni?opsgolb,?ude?vog?zib???wo&rc?t!epac????o&76i4orfy--nx?a!.&bp?de?go?oc?ti?vg??boat??b!.&a&ci&sum?tilop??i&c&arcomed?neic??golo&ce?ncet??m&edaca?onoce??rt&ap?sudni??vilob??n&egidni?icidem??serpme?tsiver?vitarepooc??b&ew?og??dulas?e&rbmon?tr&a?op&ed?snart????g&olb?ro??ikiw?l&a&noi&canirulp?seforp??rutan??im??moc?o&fni?lbeup?rga?tneimivom??saiciton?t&askt?en?ni??ude?vt??h?iew?olg??c!.&bew?cer?dr&c,rac,?esabapus,gro?ipym,l&im?per:.di,,?m&o&c!.topsgolb,?n??rif?udon,?ofni?s&egap&dael,l,?tra??t&4n,en?ni??ude?vog??a?e?in?mara?s&edarb?ic???d!.&b&ew?og??dls?gro?lim?moc?t&en?ra??ude?vog??agoba?if?zd7acbgm--nx??e&c?d&iv?or??morafla??f!ni!.&e&g&delwonk-fo-l&errab,lerrab,?ellocevoli,?ht-skorg,rom-rof-ereh,tadpusn:d,,?llatiswonk,macrvd,ofni-v,p&i&-on,fles,?ohbew,?ruo-rof,s&iht-skorg,nd&-cimanyd,nyd,uolc,??tsrifyam,ysrab,zmurof,???g&el?n!am?ib???hwsohw?i!.&35nyd,8302,a&minifed,tad-b,?b&altig,uhtig,?c&inone:.remotsuc,,zh,?d&in,u&olc&iaznab.ppa,ropav,?rd,??e&c&apsinu.1rf-duolc,ivedniser,?donppad.sndnyd,egipa,lej,nilnigol,sufxob,t&i&beulb,snoehtnap,?newtu,ybeeb.saap,??gni&gatsniser.secived,tsohytsoh,?k&coregrof.di,orgn,ramytefasresworb,?m&oc?udon,?n&mtsp:.kcom,,yded,?ot&oq,pyrctfihs,?p&opilol,pa&-arusah,e&nalpkcab,tybeeb.1dkes,???r&e&tsneum-hf,vres&cisab,lautriv,??ial.sppa,?s&codehtdaer,gnihtbew,nemeis-om,pparevelc,tacdnas,?t&e&kcubtib,notorp,?i&belet,detfihs,kecaps,?raedon.egats,s&ohg,udgniht.&cersid.&dvreser,tsuc,?dorp.tsuc,gnitset.&dvreser,tsuc,?ved.&dvreser,tsuc,????vgib.0ku,whs,x&bslprbv.g,cq,rotide,?y&olpedew,srab,??b?d&ar?u&a?ts???j?r?syhp??j!.&eman?gro?hcs?lim?moc?ten?ude?vog???ll&ag?o??m!.&gro?moc?ten?ude?vog??g?il?mi?orp??n!.&a&0&b-ekhgnark--nx?c-iehsrgev--nx?g-lksedlig--nx?k-negnanvk--nx??1&p-nedragy--nx?q-&asierrs--nx?grebsnt--nx?lado-rs--nx?n&egnidl--nx?orf-rs--nx??regnayh--nx?ssofenh--nx??r-datsgrt--nx?s-ladrjts--nx?v-y&senner--nx?vrejks--nx???3g-datsobegh--nx?4&5-&dnaleprj--nx?goksnerl--nx?tednalyh--nx??6-neladnjm--nx?s-&antouvachb--nx?impouvtalm--nx??y-&agrjnevvad--nx?ikhvlaraeb--nx???7k-antouvacchb--nx?8&k-rekie-erv--nx?l-ladrua-rs--nx?m-darehsdrk--nx??a!.sg??bct-eimeuvejsemn--nx?d&do?iisevvad?lov?narts?uas??f&1-&l--nx?s--nx??2-h--nx??g&10aq0-ineve--nx?av?ev?lot?r&ajn&evvad?u??ájn&evvad?u????h?iz-lf--nx?j&ddadab?sel??k&el?hoj&sarak?šárák??iiv&ag&na&el?g??ŋ&ael?ág???ran???l&f?lahrevo?o&ms?s??sennev?t-&ilm--nx?tom--nx??u&-edr--nx?s??øms??muar?n&0-tsr--nx?2-dob--nx?5-&asir--nx?tals--nx??a&r!-i-om?f?t??t??douvsatvid?kiv?m&os?øs??n&od?ød??ra?sen?t&aouvatheig?ouv&a&c&ch&ab?áb??h&ab?áb???n??i&ag?ág??sa&mo?ttvid??án???z-rey--nx?ær&f?t???o&p-&ladr--nx?sens--nx??q-nagv--nx?r-asns--nx?s-kjks--nx?v-murb--nx?w-&anr&f--nx?t--nx??ublk--nx???ppol?q&0-t&baol--nx?soum--nx?veib--nx??x-&ipphl--nx?r&embh--nx?imph--nx???y-tinks--nx??r&f-atsr--nx?g-&an&ms--nx?nd--nx??e&drf--nx?ngs--nx??murs--nx?netl--nx?olmb--nx?sorr--nx??h-&a&lms--nx?yrf--nx??emjt--nx??i&-&lboh--nx?rsir--nx?y&d&ar--nx?na--nx??ksa--nx?lem--nx?r&ul--nx?yd--nx????stu??j-&drav--nx?rolf--nx?sdav--nx??kua?l-&drojf--nx?lares--nx??m-tlohr--nx?n-esans--nx?olf?p-sdnil--nx?s-ladrl--nx?tih?v-rvsyt--nx??s&a&ns?ons??i&ar?er&dron?r&os?øs???ár??la&g?h??mor!t??sir?uf?åns??t&koulo&nka?ŋká??la?p-raddjb--nx?r-agrjnu--nx?s&aefr&ammah?ámmáh??orf?r&o?ø???u-vreiks--nx??u&h-dnusel--nx?i-&drojfk--nx?vleslm--nx??j-ekerom--nx?k-rekrem--nx?u-&dnalr--nx?goksr--nx?sensk--nx??v-nekyr--nx?w-&k&abrd--nx?ivjg--nx??oryso--nx??y-y&dnas--nx?mrak--nx?n&art--nx?nif--nx??reva--nx??z-smort--nx??v!.sg?ledatskork?reiks??wh-antouvn--nx?x&9-dlofts--nx.aoq-relv--nx?d-nmaherk--nx?f-dnalnks--nx?h-neltloh--nx?i-drgeppo--nx?j-gve&gnal--nx?lreb--nx??m-negnilr--nx?n-drojfvk--nx??y&7-ujdaehal--nx?8-antouvig--nx?b-&dlofrs--nx?goksmr--nx?kivryr--nx?retslj--nx??e-nejsom--nx?f-y&krajb--nx?re&dni--nx?tso--nx??stivk--nx??g-regark--nx?orf?ørf??z9-drojfstb--nx??b&25-akiivagael--nx?53ay7-olousech--nx?a&iy-gv--nx?le-tl&b--nx?s--nx??n0-ydr--nx??c&0-dnal-erdns--nx?z-netot-erts--nx??g&g-regnarav-rs--nx?o-nejssendnas--nx??ju-erdils-ertsy--nx?nj-dnalh-goksrua--nx?q&q-ladsmor-go-erm--nx.&ari-yreh--nx?ednas??s-neslahsladrjts--nx???ca&4s-atsaefrmmh--nx?8m-dnusynnrb--nx?il-tl--nx?le-slg--nx?n5-rdib--nx?op-drgl--nx?uw-ynnrb--nx??d&a&qx-tggrv--nx?reh!nnivk?sd&ork?ørk??uas??ts&e&bi?kkar?llyh?nnan??g&ort?ørt??k&alf?irderf??levev?mirg?obeg&ah?æh??r&ah?ejg????barm-jdddb--nx?ie!rah?s&etivk?ladman???lof&r&os?øs??ts&ev.ednas?o.relav?ø.relåv???n&a&l&-erd&n&os?øs??ron??adroh.so?dron.&a&g5-b--nx?ri-yreh--nx??ob?y&oreh?øreh??øb??e&m!lejh??pr&oj?øj??vi??gyb?n&aks?åks??o&h-goksrua?rf??r&o?ua?ø??tros?øh-goksrua??rts!e&devt?lab?mloh???s&ellil?naitsirk?rof???u&l!os??s!d&im?lejt??e&guah?l&a?å???kkoh?lavk?naitsirk?r&af?eg&e?ie???tef?y&onnorb?ønnørb?????r&a&blavs!.sg??g&eppo?la???o&j&f&a!dniv?k?vk??die?e&dnas?kkelf??llins?r&iel?ots??s&lab?t&ab?åb??yt??å!k??ævk??les??ts??åg&eppo?lå???ureksub.sen??e&ayb-yrettn--nx?d&ar?lom?r&of?øf??år??g&gyr?nats??i&meuv&ejsem&aan?åån??sekaal??rjea??j&d&ef?oks??les??k&er&aom?åom??hgna&ark?årk??iregnir?kot!s??s&ig?uaf???l&bmab?kyb?l&av?ehtats??oh??m&it?ojt?øjt??n&arg?g&os?øs??meh?reil?te?ummok?yrb??r&dils-erts&ev?y&o?ø???ua?vod??sa&ans?åns??t&robraa?spaav??urg??f&62ats-ugsrop--nx?a&10-ujvrekkhr--nx?7k-tajjrv-attm--nx??o!.sg?h??s!.sg??v!.sg???g&5aly-yr&n--nx?v--nx??a&llor?ve&gnal?lreb???n&av!snellu??org??oks&die?m&or?ør??ner&ol?øl??r&o?ø???r&eb!adnar?edyps?s&die?elf?gnok?n&ot?øt????obspras??uahatsla?åve&gnal?lreb???h&0alu-ysm--nx?7&4ay8-akiivagg--nx?5ay7-atkoulok--nx??a!.sg???i&e&hsr&agev?ågev??rf??k&h&avlaraeb?ávlaraeb??s??lm&a?å??mpouvtal&am?ám??pph&al?ál??rrounaddleid?ssaneve?ššáneve??j&0aoq-ysgv--nx?94bawh-akhojrk--nx??k&a&b&ord?ørd??jks?lleis??iv!aklejps?l&am?evs?u??mag?nel?ojg?r&a&l?n??epok?iel?y&or?ør???s&ah?kel?om??øjg??kabene?ojsarak?ram&deh.&aoq-relv--nx?rel&av?åv??so??e&let.&ag5-b--nx?ob?øb??ra???åjks??l&a!d&anrus?d&numurb?ron??e&gnard?nte?s&meh?sin??ttin??g&is?nyl??kro?l&em?l&ejfttah?of??u&ag-ertdim?s???n&am?era?gos?i&b?nroh?r??kos?nus?oj??o-&dron?r&os?øs???ppo?r&a!l?nram??e&gne?l?v??is?o&jts?ts??u&a-&dron?r&os?øs???h??å?æl?øjts??s&e&jg?nivk?ryf??kav?mor-go-er&om.&ednas?yoreh??øm.&ednas?yøreh???uag??t&las?rajh?suan??v&l&a?e-rots??u-go-eron??yt??ksedlig?res&a?å???bib&eklof?seklyf??es!dah??h!.sg??i&m?syrt??l&ejf?ov&etsua?gnit?ksa?sdie???n!.sg??o!.sg?boh?g?h??r!.sg??å!ksedlig??øboh??m&a&rah?vk??f!.sg??h!.sg??i&e&h&dnort?rtsua?ssej??rkrejb??ksa??ol?t!.sg??u&dom?esum?r&ab?drejg?evle?os?uh?æb?øs??ttals???n&a&g&av?okssman?åv??jlis?or?r&g?rev???e&d&do&sen?ton??lah?r&agy&o?ø??ojfsam???g&iets?n&a&l&as?lab??n&avk?ævk??t&arg?ddosen??v&al?essov???i&d&ol?øl??l&ar?ær???yl??reb??iks?k&srot?y&or?ør???l&a&d&gnos?n&er?ojm?øjm??om??tloh??ug?åtloh??mmard?ojs&om?sendnas??ppolg?s&lahsladr&ojts?øjts??o??t&o&l?t-erts&ev?o?ø???roh?øl??vly&kkys?nav??yam-naj!.sg??øjs&om?sendnas???g&orf?ujb??i&dnaort?vnarg??kob?ladendua?maherk&a?å??n&it?urgsrop??orf-&dron?r&os?øs???r&aieb?evats??sfev?uaks?yrts??o&6axi-ygvtsev--nx?c,d&ob?rav??ievs?kssouf?l&m&ob?øb??ous&adna?ech&ac?áč???so!.sg???msdeks?niekotuak?r&egark?olf?y&oso?øso???s&dav?mort???p&ed?ohsdaerpsym,p&akdron?elk???r&a&d&dj&ab?áb??iab??jtif?luag?mah?vsyt??e&gn&a&k&iel?ro??merb?n&at?mas??rav-r&os?øs??srop?talf?v&ats?el??y&oh?øh???ivsgnok??il?jkniets?k&a&nvej?rem?s&gnir?nellu???ie-er&den?v&o?ø???ram?sa?årem??la&jf?vh??m&b&ah?áh??mahellil??nnul?ts&l&oj?øj??ul??y&o?ø???imp&ah?áh??m!.sg??osir?t!.sg??ádiáb?ævsyt?øsir??s&adnil?en&dnas?e&dga?k&ri&b?k??som??ve??me&h?jg??nroh-go-ejve?s&a?ednil?k&o?ø??of?yt?å??tsev??gv?hf?igaval?o&r&or?ør??sman??so&fen&oh?øh??m?v??uh&lem?sreka.sen??å!dnil???t&a&baol?g&aov?grav??jjr&av-attam?áv-attám??l&a&b?s??ás??soum?ts?v&eib?our???e&dnaly&oh?øh??f?s&nyt?rokomsdeks?sen??vtpiks??in&aks?áks??loh&ar?år??n!.sg??o&m&a?å??psgolb,?s!.sg?efremmah?or?ør??terdi?á&baol?ggráv?lá&b?s??soum?veib???u&b!.sg?alk?e&dna?gnir?nner??les?ælk??dra&b?eb??g&nasrop?vi?ŋásrop??j&daehal&a?á??jedub?v&arekkhar?árekkhár???ksiouf?n&diaegadvoug?taed???v&irp?lesl&am?åm???y&b&essen?nart?sebel?tsev??o&d&ar?na!s??or??gavtsev?k&rajb?sa??lem?mrak?n&art?n&if?orb???r&a&mah?n?v??e&dni?t&so?ton??va??ul?yd??s&am?enner?gav?lrak?tivk??vrejks??ø&d&ar?na!s??ør??gåvtsev?k&rajb?sa??lem?mrak?n&art?n&if?ørb???r&e&dni?t&so?tøn??va??ul?yd?æ&n?v???s&enner?gåv?tivk?åm??vrejks???á&slág?tlá?vreiks??å&gåv?h?jddådåb?lf??ø&d&ob?rav??r&egark?olf??s&dav?mort????aki?i&sac?tal??u??o&b?f?g?hay?o?ttat??r!.&cer?erots?gro?m&o&c?n??rif?t??o&c,fni??pohs,stra?t&n?opsgolb,?www??e&a!.&a&ac?cgd?idem??bulc!orea??ci&ffartria?taborea??e&cn&a&l&lievrus-ria?ubma??netniam?rusni??erefnoc??gnahcxe?mordorea?ni&gne?lria?zagam??rawtfos??gni&d&art?ilg!arap?gnah???l&dnahdnuorg?ledom??noollab?retac?sael?t&lusnoc?uhcarap??vidyks??hcraeser?l&anruoj?euf?icnuoc?ortnoc!-ciffart-ria???n&gised?oi&nu?t&a&cifitrec?ercer?gi&tsevni-tnedicca?van??i&cossa!-regnessap??valivic??redef??cudorp?neverp-tnedicca????ograc?p&ihsnoipmahc?uorg!gnikrow???r&e&dart?enigne?korb?niart?trahc??o&htua?tacude???s&citsigol?e&civres?r??krow?serp!xe??tnega??t&farcr&ia?otor??hgil&f?orcim??liubemoh?n&atlusnoc?e&duts?m&esuma?n&iatretne?revog??piuqe????olip?ropria?si&lanruoj?tneics???w&erc?ohs??y&cnegreme?dobper?tefas????rref?z??p!.&a&aa?ca?pc??dem?ecartsnd.icb,gne?r&ab?uj??snduolc,t&acova?cca?hcer??wal?ysrab,???s!.&em?gro?hcs,moc?ten?ude?vog???t!.&116,ayo,gro?lim?moc?nayn,sulpnpv,t&cennockciuq.tcerid,en??ude?v&dr,og???o&hp?m?v?yk??tol?ua??v&iv?lov??xas?ykot??p&a&ehc?g?m?s??eej?g!.&gro?ibom?moc?ossa?ppa,ten?ude???i&r!.nalc,?v?z??j!.&a&3&5xq6f--nx?xqi0ostn--nx??5wtb6--nx?85uwuu--nx?9xtlk--nx?bihc!.&a&bihciakoy?don?ma&him?ye&ragan?tat???r&a&bom?gan?hihci??u&agedos?kas?ustak???s&os?ufomihs??t&amihcay?iran??w&a&g&im&anah?o??omak??kihci?zustum??ihsak??y&agamak?imonihci???e&akas?nagot??i&azni?esohc?h&asa?s&abanuf?ohc???ka&to?zok??musi?orihs?r&akihabihsokoy?o&dim?tak??ukujuk??usihs??nano&hc?yk??o&d&iakustoy?ustam??hsonhot?k&a&rihs?t??iba??nihsaran?sobimanim?tas&arihsimao?imot??uhc?yihcay??u&kujno?s&ayaru?t&imik?tuf???zarasik????g&as!.&a&gas?m&a&tamah?yik??ihsak??rat?t&a&gatik?hatik??ira!ihsin????e&kaira?nimimak??i&akneg?g&aruyk?o??h&c&amo?uo??siorihs??kaznak?modukuf?ra&gonihsoy?mi???nezih?u&k&at?ohuok??s&ot?tarak?????ihs!.&a&kok?m&a&hagan?yirom??ihsakat??rabiam?wagoton??e&miharot?nokih??houyr?i&azaihsin?esok?kustakat?moihsagih??na&mihcahimo?nok??o&hsia?mag?t&asoyot?ok?tir???us&ay?t&asuk?o??????k&aso!.&a&d&awihsik?eki??k&a&noyot?s&akaayahihc?oihsagih???oadat?uziak??m&ayas!akaso??odak??r&a&bustam?wihsak??ediijuf??t&akarih?i&k?us???wag&ayen?odoyihsagih???e&son?tawanojihs??honim?i&akas?h&cugirom?s&ayabadnot?i&a&kat?t??n??oyimusihsagih???k&a&rabi?sim??ustakat??muzi?r&ijat?otamuk???nan&ak?n&ah?es???o&ay?n&a&ganihcawak?simuzi?tak??eba?ikibah?oyot??t&anim?iad?omamihs??uhc??ust&oimuzi?tes????ou&kuf!.&a&d&amay?eos??g&no?ok?usak??hiku?k&awayim?uzii??ma&kan?y&asih?im???rawak?t&a&gon?ka&h?num?t???umo??wa&g&a&kan?nay?t??ias??ko!rih???y&ihsa?usak???e&m&ay?uruk??taruk?us??i&a&nohs?raihcat??goruk?h&cukuf?s&a&gih?hukuy??in???k&a&gako?muzim??iust?o?ustani??m&anim?otihsoynihs?u??r&ogo?ugasas??usu??ne&siek?zu&b?kihc???o&gukihc?h&ak?ot?ukihc??j&ono?ukihc??kayim?nihsukihc?to?uhc??u&fiazad?gnihs?stoyot????zihs!.&a&bmetog?d&amihs?eijuf?ihsoy?omihs??kouzihs?mihsim?ra&biah?honikam??tawi?wa&g&ekak?ukik??kijuf??yimonijuf??i&a&ra?sok??hcamirom?juf?kaz&eamo?ustam??ma&nnak?ta??nukonuzi?orukuf??nohenawak?o&nosus?ti??u&stamamah?z&a&mun?wak??i!ay?i&hs&agih?in??manim??mihs????????m&a&tias!.&a&d&ihsoy?ot?usah??k&a&dih?sa??o&arihs?s???m&a&tias?y&as?o&rom?tah??ustamihsagih???i&hsagurust?jawak??uri??ni?wa&g&e&ko?man??ikot?o??k&ara?i&hsoy?mak???ru?zorokot??y&a&g&amuk?ihsok?otah??kuf??imo??ziin??e&bakusak?ogawak?sogo?ttas?zokoy??i&baraw?h&cugawak?s&oyim?ubustam???iroy?k&ato?ihs?u&k?stawi???m&akoyr?i&hsoy?juf??uziimak???naznar?o&dakas?ihsay?jnoh?n&a&go?nim??imijuf?nah?oy??r&ihsayim?otagan??t&asim!ak??igus?omatik??zak??u&bihcihc!ihsagih??sonuok?ynah????y&ak&aw!.&a&d&ira?notimak??kadih?ma&h&arihs?im??y&a&kaw?tik??oduk???ru&ustakihcan?y??sauy?wa&g&a&dira?zok??orih??konik??yok?zok??e&banat?dawi??i&garustak?jiat?mani??naniak?o&bog?nimik?t&asim?omihs&ah?uk????ugnihs???o!.&a&jos?koasak?m&ay&ako?ust??ihsayah??r&abi?ukawaihsin??wi&aka?nam???e&gakay?kaw??i&gan?h&cu&kasa?otes??sahakat??k&asim?ihsaruk??miin??n&anemuk?ezib??o&hsotas?jnihs?n&amat?imagak??ohs?uhcibik?????ot!.&a&damay?got?koakat?may&etat?ot??nahoj?riat?waki&inakan?reman???eb&ayo?oruk??i&h&asa?ciimak?sahanuf??kuzanu?m&an&i?ot??ih???nezuyn?otnan?u&hcuf?stimukuf?z&imi?ou???????ihs&o&gak!.&a&m&ayuok?ihsogak??si?yonak??e&banawak?n&at&akan?imanim??uka??tomoonihsin??i&adnesamustas?k&azarukam?oih??m&ama?uzi??usuy??nesi?o&knik?os?tomustam??uzimurat???rih!.&a&ka&n?s??m&ayukuf?i&hsorihihsagih?j&ate?imakikaso????r&a&bohs?h&ekat?im???es??tiak?wiad??e&kato?ruk??i&h&ci&akustah?mono?nihs??s&inares?oyim???manimasa?uk??negokikesnij?o&gnoh?namuk??uhcuf????uk&ot!.&a&bihci?mi&hsu&kot?stamok??m??wagakan??egihsustam?i&gum?h&coganas?soyim??kijaw?m&anim?uzia??ukihsihs??nan&a?iak??o&nati?turan????uf!.&a&batuf?m&a&to?y&enak?irok???ihs&im?ukuf??os?uko??r&aboihsatik?uganat??ta&katik?mawak?rih??w&a&g&akus?emas?uy??k&a&mat?rihs?sa??ihsi??nah??ohs???e&gnabuzia?iman?ta&d?tii???i&adnab?enet?hs&agih?iimagak??k&a&wi?zimuzi??ubay??minuk?r&ook?ustamay???nihsiat?o&g&etomo?ihsin?nan?omihs??no!duruf?rih??rihsawani?ta&may?simuzia???u&rahim?stamakawuzia?zia&ihsin?nay???????nug!.&a&bawak?doyihc?k&anna?oi&hsoy?juf?mot???m&ayakat?ustagaihsagih??n&ihsatak?nak??r&ahonagan?nak?o?u&kati?mamat???t&amun?inomihs?o??w&akubihs?iem?ohs???i&hsa&beam?yabetat??kas&akat?esi??m&akanim?uzio??ogamust?rodim??o&jonakan?n&eu?oyikust??tnihs??u&komnan?stasuk?yrik?????ran!.&a&bihsak?d&akatotamay?u!o???guraki?m&ay&atik&imak?omihs??irokotamay??oki??ra&hihsak?n??wa&geson?knet???e&kayim?ozamay?sog?ustim??i&a&rukas?wak??garustak?h&ciomihs?sinawak??jo?ka&mnak?toruk??makawak?nos?r&net?otakat?ugeh???o&d&na?oyo??gnas?jnihs?nihsoy!ihsagih??tomarawat?yrok????t&ag&amay!.&a&dihsio?k&atarihs?ourust??may&a&kan?rum??enak?onimak??rukho?ta&ga&may?nuf??hakat?kas??wa&g&ekas?orumam??ki&hsin?m??z&anabo?enoy?ot???zuy??e&agas?bonamay?dii?nihsagih?o??i&a&gan?nohs??h&asa?sinawak??nugo??o&dnet?jnihs?ynan??ukohak???iin!.&a&ga?k&ium?oagan??munou!imanim??t&a&bihs?giin??ioy??w&a&gioti?kikes?zuy??irak??yijo??e&kustim?mabust??i&aniat?hcamakot?kaz&awihsak?omuzi??m&a&gat?karum??o???n&anust?esog??o&das?ihcot?jnas?k&ihay?oym??mak?naga?ries??u&ories?steoj?????i&ka!.&a&go?k&asok?oimak??t&ago!rihcah??ika!atik???w&aki?oyk???e&mojog?natim?suranihsagih?t&ado?okoy???i&hsoyirom?magatak?naokimak??nesiad?o&hakin?jnoh!iruy??nuzak?rihson?tasi&juf?m??yjnoh??u&kobmes?oppah????o!.&a&dakatognub?m&asah?ihsemih??su?t&ekat?i&h?o????e&onokok?ustimak??i&jih?k&asinuk?ias?usu??mukust??onoognub?u&fuy?juk?ppeb?suk??????wa&ga&k!.&a&mihsoan?rihotok?waga&kihsagih?ya???emaguram?i&j&nonak?ustnez??kunas?monihcu??o&hsonot?nnam?yotim??u&st&amakat?odat??zatu????nak!.&a&dustam?kus&okoy?tarih??maz?nibe?r&a&gihsaimanim?h&esi?imagas??wa&do?guy???u&im?kamak???tikamay?wa&k&ia?oyik?umas??sijuf??yimonin??e&nokah?saya??i&akan?esiak?gusta?hsuz?kasagihc?o?ukust??o&nadah?sio?tamay?????kihsi!.&a&danihcu?gak?kihs?mijaw?t&abust?ikawak??wazanak??i&gurust?hcionon?mon?ukah??nasukah?o&anan?ton!akan???u&kohak?stamok?z&imana?us?????niko!.&a&han?m&arat?ijemuk?uru??n&e&dak?zi??no??ra&hihsin?rih??wa&kihsi?niko??yehi?zonig??e&osaru?seay??i&hsagih?jomihs?k&a&gihsi?not??ihsakot??m&a&ginuk?kihsug?maz??igo?otekat??nuga!noy???n&a&moti?timoy?wonig??i&jikan?k???o&gan?jnan?tiad&atik?imanim???u&botom?kusug&akan!atik??imot??rab&anoy?eah???????c&204ugv--nx?462a0t7--nx?678z7vq5d--nx?94ptr5--nx?a??d&17sql1--nx?3thr--nx?5&20xbz--nx?40sj5--nx??7&87tlk--nx?ptlk--nx??861ti4--nx?a?e??e&16thr--nx?5&1a4m2--nx?9ny7k--nx??im!.&a&bot?k&asustam?uzus??m&a&him?y&emak?im???ihs??nawuk?wi&em?k???e&bani?ogawak?si!imanim???i&arataw?gusim?h&asa?ciakkoy??k&a&mat?sosik?t??iat??raban??o&dat?hik?n&amuk?ihseru?o&du?mok????ust???mihe!.&a&m&a&h&ataway?iin??yustam??ij&awu?imak???taki!man???ebot?i&anoh?kasam?rabami??n&ania?egokamuk?oot??o&jias?kihcu?nustam?uhcukokihs?yi!es???u&kohik?zo????n!.&nriheg,teniesa.resu,?amihs!.&a&d&amah?ho?usam??kustay?m&a?ihsoni&hsin?ko???wakih??e&namihs?ustam??i&g&aka?usay??konikak?mikih??nannu?o&mu&kay?zi!ihsagih?uko???nawust?tasim??u&stog?yamat?????tawi!.&a&bahay?d&amay?on??koirom?t&a&honat?katnezukir??imus??w&as&ijuf?uzim??ihs???e&hon&i&hci?n??uk??tawi??i&a&duf?murak?wak??h&custo?si&amak?ukuzihs???j&oboj?uk??k&a&m&anah?uzuk??sagenak??esonihci??m&akatik?uzia&rih?wi????o&kayim?no&rih?t??tanufo??uhso????g&3zsiu--nx?71qstn--nx?l??h&03pv23--nx?13ynr--nx?22tsiu--nx?61qqle--nx??i&54urkm--nx?g&ayim!.&a&dukak?m&a&goihs?kihs??ihsustam!ihsagih??unawi??r&awago?iho??ta&bihs?rum??w&a&gano?kuruf??iat??y&imot?ukaw???e&mot?nimes??i&hsiorihs?ka&monihsi?s&awak?o???mak?r&ataw?o&muram?tan????o&az?jagat?t&asim?omamay???u&fir?k&irnasimanim?uhsakihcihs?????ihcot!.&a&g&a&h?kihsa??ust??kom?m&ay&o?usarak??unak??r&a&boihsusan?watho??iho?ukas??t&akihsin?iay??wa&konimak?zenakat??y&imonustu?oihs???e&iiju?kustomihs?nufawi??i&akihci?g&etom?ihcot?on???o&k&ihsam?kin??nas?sioruk?tab??u&bim?san?????h&c&ia!.&a&dnah?m&a!h&akat?im??yuni??ihs&ibot?ust???r&a&hat?tihs??ik?u&ihsagih?kawi???t&ihc?o&k?yot???wa&koyot?zani??yi&monihci?rak???e&inak?k&aoyot?usa??manokot?noyot??i&a&gusak?kot?sia??eot?h&asairawo?cugo?s&ahoyot?oyim???k&a&mok?zako??ihssi??motay?rogamag??n&an&ikeh?ok??ihssin??o&got?ihsin?jna?rihsnihs?suf?tes??u&bo?raho?s&oyik?takihs??yrihc?zah????ok!.&a&dusay?kadih?mayotom?r&ah&im?usuy??umakan??sot!ihsin??wa&g&atik?odoyin??k&as?o????i&esieg?hco!k??jamu?k&a!sus??usto??ma&gak?k??rahan??o&mukus?n&i?ust!ihsagih???torum?yot!o???u&koknan?zimihsasot????ugamay!.&a&m&ayukot?ihso??toyot??e&bu?subat??i&gah?kesonomihs?nukawi?rakih??nanuhs?otagan?u&ba?foh?otim?stamaduk?uy?????sanamay!.&a&dihsoyijuf?mayabat?r&ahoneu?ustakihsin??w&a&k&ayah?ijuf??suran??ohs???egusok?i&ak?h&cimakan?s&anamay?od???k&asarin?u&feuf?sto????o&k&akanamay?ihcugawakijuf??nihso?t&asimawakihci?ukoh??uhc??spla-imanim?u&b&nan?onim??fok?hsok?rust?????ka&rabi!.&a&bukust?gok?kan!ihcatih??m&a&sak?timo?wi??ihsak?ustomihs??ni?r&a&hihcu?way??u&agimusak?ihcust???t&ag&amay?eman??oihcatih??w&ag&arukas?o??os??yi&moihcatih?rom???e&bomot?dirot?not?tadomihs??i&a&k&as?ot??rao??esukihc?gahakat?h&asa?catih??k&a&rabi?saguyr??ihsani?uy??ma?rukustamat??o&dnab?giad?him?kati?rihsijuf?soj?t&asorihs?im??yihcay??u&fius?kihsu?simak????sagan!.&a&m&abo?ihsust??natawak?r&abamihs?u&mo?ustam???wijihc?yahasi??i&akias?hies?k&asagan?i??masah??neznu?o&besas?darih?t&eso?og!imaknihs????ust&igot?onihcuk?uf????zayim!.&a&biihs?guyh?k&oebon?ustorom??mihsuk?r&emihsin?uatik??ta&katik?mim??wag&atik?odak??ya??e&banakat?sakog??i&hsayabok?kaza&kat?yim??m&animawak?ot&inuk?nihs????nanihcin?o&j&ik?onokayim??n&ibe?ust??tias??urahakat????ro&moa!.&a&dawot?turust?wasim??e&hon&ihc&ah?ihs??nas?og?ukor??sario??i&anarih?ganayati?hsioruk?jehon?kasorih?makihsah?nawo?r&amodakan?omoa???o&gnihs?kkat??u&ragust?stum????ttot!.&a&r&ahawak?uotok??sa&kaw?sim???egok?irottot?nanihcin?o&ganoy?nih?tanimiakas??u&bnan?z&ay?ihc??????ukuf!.&a&deki?gurust?ma&bo?h&akat?im??yustak??sakaw??eabas?i&akas?ho?jiehie?ukuf??nezihce!imanim??ono????k&26rtl8--nx?4&3qtr5--nx?ytjd--nx??522tin--nx?797ti4--nx??l33ussp--nx?m&11tqqq--nx?41s3c--nx??n&30sql1--nx?65zqhe--nx?n7p7qrt0--nx??o&131rot--nx?7qrbk--nx?c?diakkoh!.&a&deki?gakihset?hcebihs?k&adih?u&fib?narihs???m&ayiruk?hot?ihs&orihatik?ukuf??oras?usta??r&ib&a!ka??o?uruf??ozo?u&gakihsagih?oyot???sakim?ta&gikust?mun??w&a&ga&k&an?uf??nus!imak???k&aru?i&h&asa?sagih??kat?mak??omihs?um??zimawi??ine?oyk??yot??e&a&mustam?nan??b&a&kihs?yak??o&noroh?to???ian?k&ihsam?ufoto??nakami?ppoko!ihsin??sotihc?tad!okah??uonikat??i&a&bib?mokamot?n&a&k&kaw?oroh??wi??eomak?ihsatu?okik?usta&moruk?sakan????eib?h&c&ioy?u&bmek?irihs???s&ase?ekka?oknar?uesom???jufirihsir?k&amamihs?i&at?n???m&atik?otoyot??oa&kihs?rihs??r&a&hs?kihsi?mot??ihs&aba?ir??otarib???n&a&hctuk?rorum?se?tokahs??uber??o&kayot?m&ire?ukay??naruf!ima&k?nim???orih?r&ih&ibo?suk??o&bah?h&i&b?hsimak??sa??pnan?yan??umen??t&asoyik?eko?ukoh???u&bassa?kotnihs?m&assaw?uo??pp&akiin?en&ioto?nuk??ip??rato?s&akat?t&eb&e?i&a?hs!a??robon??m&e?o&m?takan???no&h?tamah??o&mik?s?t??u&kir?ppihc?st???onihsnihs?ufuras??uaru??yru!koh??zimihs!ok?????g!oyh!.&a&bmat?dnas?gusak?k&at?o&oyot?y??uzarakat??m&ayasas?irah??wa&g&ani?okak??k&i&hci?mak??oy???yi&hsa?monihsin???i&asak?hs&aka?i&at?nawak???j&awa!imanim??emih??k&a&goa?s&agama?ukuf??wihsin??i&hsog?m???mati?oia?rogimak??n&annas?esnonihs??o&gasa!kat??ka?n&ikat?o?ustat??rihsay?sihs?tomus?yas??u&bay?gnihs?????nagan!.&a&bukah?d&a&w?yim??e&ki?u??ii??k&a&s&ay?uki??zus??ihsoo?ousay??m&ay&akat?ii??i&hsukufosik?jii??ukihc??n&i!hsetat??uzii??r&ah?ugot??saim?t&agamay?oyim??w&a&g&a&kan?n??o??kustam?ziurak??onim!imanim??u&koo?s!omihs????ya&ko?rih???e&akas?nagamok?subo??i&gakat?h&asa?c&a!mo!nanihs???uonamay??sukagot??k&a&kas?mimanim?to??ia&atik?imanim??oa?uzihcom??m&akawak?ijuf?o!t???r&ato?ijoihs?omakat???n&ana?esnoawazon??o&hukas?n&a&gan?kan??i&hc?muza??ustat??romok?si&gan?k??tomustam??u&k&as?ohukihc??stamega????to&mamuk!.&a&gamay?rahihsin?sukama!imak??tamanim??enufim?i&hcukik?k&ihsam?u??nugo!imanim??romakat??o&ara?rihsustay?sa?t&amay?om&amuk?us??u!koyg???yohc??u&sagan?zo????yk!.&a&bmatoyk?k&ies?oemak?uzaw??mayi&h&cukuf?sagih??muk??nihsamay?rawatiju?t&away?ik???e&ba&nat!oyk??ya??di?ni??i&ju?kazamayo?manim??natnan?o&gnatoyk?kum?mak?rihsamayimanim?y&gakan?ka&koagan?s??oj???u&ruziam?z&ayim?ik??????wtc1--nx?ykot!.&a&d&i&hcam?mus??oyihc??k&atim?ihsustak??m&a&t!uko??yarumihsa&gih?sum???i&hs&agoa?ika?o!t??uzuok??ren???r&a&honih?wasago??iadok?umah??ssuf?t&ik?o??wa&g&anihs?ode??k&ara?ihcat???y&agates?ubihs???e&amok?donih?m&o?urukihsagih??soyik??i&enagok?gani?h&ca&da?tinuk??sabati??j&nubukok?oihcah??manigus??o&huzim?jihcah?n&akan?ih!sasum??urika??rugem?t&a&mayihsagih?nim??iat?ok??uhc?yknub??u&fohc?hcuf?kujnihs?????r&2xro6--nx?g?o??s&9nvfe--nx?xvp4--nx??t&netnocresu,opsgolb,?u&4rvp8--nx?fig!.&a&d&eki?ih??kimot?m&ayakat?ihsah??ne?raha&gi&kes?makak??sak??taga&may?tik??wa&g&ibi?ustakan??karihs!ihsagih????e&katim?uawak??i&gohakas?hc&apna?uonaw??k&ago?es?ot??m&anuzim?ijat??nak?urat??nanig?o&dog?jug?makonim?nim?roy?sihcih??u&fig?s&otom?t&amasak?oay???????x5ytlk--nx?yu6d27srjd--nx?z72thr--nx?井福?京東?分大?取鳥?口山?城&宮?茨??媛愛?山&富?岡?歌和??岡&福?静??島&児鹿?広?徳?福??崎&宮?長??川&奈神?石?香??庫兵?形山?手岩?木栃?本熊?根島?梨山?森青?潟新?玉埼?田秋?知&愛?高??縄沖?良奈?葉千?賀&佐?滋??道海北?都京?重三?野長?阜岐?阪大?馬群???k!.&art?gro?moc?per?ude?vog???l&eh?l??m!.uj,ac?j??nd?o&g?h&pih?s!.ysrab,??lnud?oc?t!.&lldtn,snd-won,???pa!.&0mroftalp,arusah,bew:erif,,e&niln&igol,okoob,?tupmocegde,?lecrev,n&aecolatigidno,ur:.a,,?poon,remarf,t&ibelet,xenw,?yfilten,??ra&a?hs??u&ekam?llag?org!.esruocsid,cts?kouk?nayalo???vsr?xece4ibgm--nx??q&a!3a9y--nx??g?i!.&gro?lim?moc?ten?ude?vog???m?se??r&a!.&acisum?bog?gro?lim?moc!.topsgolb,?rut?t&en?ni??ude?vog??4d5a4prebgm--nx?b?c?eydoog?los?t&at?s!uen???ugaj??b!.&21g?a&b&a&coros?iuc??itiruc??cnogoas?dicerapa?gniram?i&naiog?ramatnas??n&erom?irdnol??op?p&acam?irolf?ma&j?s???rief?tsivaob??b!aj?ib?mi?sb??c&ba?e&r?t??js?sp?t!e???d&em?mb?n&f?i??rt??e&dnarganipmac?ficer?ht?llivnioj?rdnaotnas??f&dj?ed?gg?n&e?i???g&e&l!.&a&b,m,p,?bp,c&a,s,?e&c,p,s,?fd,gm,ip,jr,la,ma,nr,o&g,r,t,?p&a,s,?r&p,r,?s&e,m,r,?tm,??s??l&s?z??n&c?e?o??ol!b?f?v??pp?ro??hvp?i&du?kiw?nana?oretin?r&c?eurab??sp?te?xat??l&at&an?rof??el?im?sq??m&a?da?e&gatnoc?leb??f?ic?oc!.&duolclautriv.elacs.sresu,topsgolb,???nce?o&ariebir?c&e?narboir?saso??d&o?ranreboas??e&g?t??i&b?dar?ecam?r??rp?t&a?erpoir???p&er?m!e?t??ooc?pa?se??qra?r&af?ga?o&davlas?j??tn?ut??s&a&ixac?mlap?nipmac??ed?u&anam?j?m???t&am?e&d?n?v??nc?o&f?n??ra?sf??u&caug9?de?ja?rg??v&da?ed?og!.&a&b?m?p??bp?c&a?s??e&c?p?s??fd?gm?ip?jr?la?ma?nr?o&g?r?t??p&a?s??r&p?r??s&e?m?r??tm???rs?t??xiv?z&hb?ls?o&c?f?????c!.&as?ca?de?if?o&c?g??ro???e&bew?ccos?dnik?e&b?n&igne?oip??rac??gni&arg?rheob??h&cor?sok?t&aew?orb???itnorf?k&col?o&p?rb???l&aed?ffeahcs??mal?nes?pinuj?t&a&eht?rebsnegömrev??law?nec?s&acnal?nom?ubkcolb??upmoc??v&o&c&sid?tfiws??rdnal??resbo??wulksretlow?ywal?zifp??f!.&aterg?bew-no,drp?e&c&itsuj-reissiuh?narf-ne-setsitned-sneigrurihc,?lipuog,rianiretev??hny,i&cc?rgabmahc??m&o&c?n??t??n&eicamrahp?icedem??ossa?pohsdaerpsym,s&e&lbatpmoc-strepxe?riaton?tsitned-sneigrurihc?uova??o&-x&bf,obeerf,?x&bf,obeerf,???t&acova?o&or-ne,psgolb,?r&epxe-ertemoeg?op!orea????vuog??avc7ylqbgm--nx?s??g!.&gro?moc?t&en?opsgolb,?ude?vog???h!.&e&erf,man??mo&c?rf??topsgolb,zi??ur??i!.&a&61f4a3abgm--nx?rf4a3abgm--nx??ca?di?gro?hcs?oc?ten?vog?نار&يا?یا???a&h?per??ew?lf??k!.&c&a?s??e&n?p?r??gk?iggnoeyg?kub&gn&oeyg?uhc??noej??l&im?uoes??man&gn&oeyg?uhc??noej??n&as&lu?ub??o&e&hcni?jead??wgnag???o&c?g??ro?s&e?h?m??topsgolb,u&gead?j&ej?gnawg????cilf??l!.&gro?moc?ten?ude?vog???m!.&topsgolb,vog???n!.&gro?moc?ofni?ten?ude?vog?zib???o&htua?odtnorf?t&c&a?od??laer???p!.&alsi?ca?eman?forp?gro?moc?o&fni?rp??t&en?se??ude?vog?zib???s?t!.&21k?bew?cn!.vog??eman?gro?kst?l&e&b?t??im?op??moc!.topsgolb,?neg?ofni?pek?rd?sbb?ten?ude?v&a?og?t??zib??f?m??ubad?vd??s&8sqif--nx?9zqif--nx?a!.vog?birappnb?gev?lliv?mtsirhc?s??b!.&ew,gro?moc?ten?ude?vog??c?oj?s?u??c&i&hparg?p?t&sigolyrrek?ylana???od??d&a?d?l?n&iwriaf?omaid??oogemoh?rac??e!.&bog?gro?mo&c!.topsgolb,?n??pohsdaerpsym,ude??civres!.enilnigol,?d&d2bgm--nx?oc??h&ctaw?guh??i&lppus?rtsudni?treporp!yrrek???jaiv?l&aw?cycrotom?etoh?gnis?pats??m&ag?oh?reh??nut?ohs?picer?r&it?ut&cip!.7331,?nev???s!i&rpretne?urc??ruoc??taicossa?vig??g!nidloh??h5c822qif--nx?i!.&ekacpuc,gro?moc?t&en?ni?opsgolb,?ude?vog??a09--nx?nnet?rap?targ??k&c&or!.&ecapsbew,snddym,ytic-amil,??us??hxda08--nx?row??l!.&c&a?s??ed,gro?o&c?fni??ten?ude?vog?zib??a&ed?tner??e&ssurb?toh!yrrek???lahsram?m?oot??m!.&bal,etisinim,gro?moc?ten?ude?vog??b?etsys!.tniopthgink,?ialc??n&a&f?gorf?ol??egassap?i&a&grab?mod??giro??o&it&acav?cudorp?ulos??puoc???o&dnoc?geuj?leuv?ppaz?t&ohp?ua???p!.&ces?gro?moc?olp?ten?ude?vog??i&hsralohcs?lihp?t??u??r!.&au,ca?gro?ni?oc?topsgolb,ude?vog?xo,yldnerb.pohs,?a&c?p?tiug??c?e&dliub!.etisduolc,?erac?gor?levart?mraf?n&niw?trap??wolf??ot&cartnoc?omatat??pj?uot??s!.&em?gro?hcs?moc?ten?ude?vog?zib??alg?e&n&isub!.oc,?tif??rp!xe!nacirema???xnal??iws??t&a&e&b?ytic??ob??ek&cit?ram??fig?h&cay?gilf??n&atnuocca?e&mt&rapa?sevni??ve!.oc,???rap??u!.&a&c!.&21k?bil?cc???g!.&21k?bil?cc???i!.&21k?bil?cc???l!.&21k?bil?cc???m!.&21k!.&hcorap?rthc?tvp???bil?cc???p!.&21k?bil?cc???si?v!.&21k?bil?cc???w!.&21k?bil?cc????c&d!.&21k?bil?cc???n!.&21k?bil?cc???s!.&21k?bil?cc????d&e&f?lacsne.xhp,?i!.&21k?bil?cc???m!.&21k?bil?cc???n!.&bil?cc???s!.&bil?cc???u&olcrim,rd,??e&d!.&21k?bil,cc???las-4-&dnal,ffuts,?m!.&21k?bil?cc???n!.&21k?bil?cc????h&n!.&21k?bil?cc???o!.&21k?bil?cc????i&h!.&bil?cc???m!.&21k?bil?c&c?et??goc?n&eg?otae??robra-nna?sum?tsd?wanethsaw???nd?r!.&bil?cc???v!.&21k?bil?cc???w!.&21k?bil?cc????jn!.&21k?bil?cc???k&a!.&21k?bil?cc???o!.&21k?bil?cc????l&a!.&21k?bil?cc???f!.&21k?bil?cc???i!.&21k?bil?cc????mn!.&21k?bil?cc???n&afflog,i!.&21k?bil?cc???m!.&21k?bil?cc???sn?t!.&21k?bil?cc????o&c!.&21k?bil?cc???m!.&21k?bil?cc???ttniop,?p&ion,rettalp,?r&a!.&21k?bil?cc???o!.&21k?bil?cc???p!.&21k?bil?cc????s&a!.&21k?bil?cc???dik?k!.&21k?bil?cc???m!.&21k?bil?cc???nd&deerf,uolc,??t&c!.&21k?bil?cc???m!.&21k?bil?cc???u!.&21k?bil?cc???v!.&21k?bil?cc????ug!.&21k?bil?cc???v&n!.&21k?bil?cc???w!.cc???x&ohparg,t!.&21k?bil?cc????y&b-si,k!.&21k?bil?cc???n!.&21k?bil?cc???w!.&21k?bil?cc????za!.&21k?bil?cc????ah!uab??bria?col?e!.ytrap.resu,?ineserf?lp?xe&l?n???vt?w!.&66duolc,gro?moc?s&ndnyd,tepym,?ten?ude?vog??a?e&iver?n!.elbaeciton,??odniw??y&alcrab?cam?ot???t&0srzc--nx?a!.&amil4,ca!.hts??gni&liamerutuf,tsoherutuf,?o&c!.topsgolb,?fni,?p&h21,ohsdaerpsym,?r&euefknuf.neiw,o??v&g?irp,?xi2,ytic-amil,zib,?c?e!s??hc?if?l!asite??mami?rcomed??b!.&gro?moc?ten?ude?vog??b?gl??c&atnoc?e&les?rid!txen????dimhcs?e!.&eman?gro?moc?ofni?ten?ude?vog?zib??b?em?grat?id?k&circ?ram??n!.&0&002cilc,rab,?1rab,2rab,5inu,6vnyd,7&7ndc.r,erauqs,?a&l&-morf,moob,?minifed,remacytirucesym,tadsyawla,z,?b&boi,g,lyltsaf:.pam,,?c&inagro-gnitae,paidemym,?d&ecalpb,irgevissam.saap.&1-&gs,nol,rf,yn,?2-&nol,yn,??nab-eht-ni,uolc&meaeboda,nievas.c&di-etsedron,itsalej,?xednay:.e&garots,tisbew,?,??e&c&narusnihtlaehezitavirp,rofelacs.j,?gdirbtib,ht-no-eciffo,l&acsnoom,ibom-eruza,?m&ecnuob,ohtanyd,tcerider,?n&ilno-evreser,ozdop,?rehurht,s:abapus,,tis-repparcs,zamkcar,?f&aeletis,crs.&cos,resu,?ehc-a-si,?g&ni&reesnes,sirkcilc,tsohnnylf,?olb&evres,tsaf,??k&catsvano,eeg-a&-si,si,?u,?l&acolottad,iamwt,s&d-ni,s-77ndc,??m&ac&asac,ih,?urofniem,?n&a&f&agp,lhn,?i&bed,llerk,??dcduabkcalb,i,pv-ni,?o&c-morf,duppa,jodsnd,rp-ytinummoc,ttadym,?p&i&-&etsef,on,?emoh,fles,nwo,?j,mac-dnab-ta,o&-oidar-mah,h&bew,sdaerpsym,??pa&duolc,egde,?tfe&moh,vres,?usnd,?r&e&tsulcyduolc,vres-xnk,?vdslennahc:.u,,?s&a&ila&nyd,snd,?nymsd,?bbevres,dylimaf,e&gde-ndc,suohsyub,t&isbeweruza,ys,??k&catstsaf,ekokohcs,?n&d&-won,d,golb,npv,?oitcnufduolc,?ppacitatseruza:.&2suts&ae,ew,?aisatsae,eporuetsew,sulartnec,?,s&a-skcik,ecca&-citats,duolc,???t&adies,ce&ffeym,jorprot:.segap,,?e&nretnifodne,smem,?farcenimevres,i-&ekorb,s&eod,lles,teg,??n&essidym,orfduolc,?r0p3l3t,s&ixetnod,oh&-spv:.citsalej.&cir,lta,sjn,?,gnik,???u&h,nyd,r:eakust.citsalej,,?ved-naissalta.dorp.ndc,x&inuemoh,spym,tsale.&1ots-slj,2ots-slj,3ots-slj,?unilemoh,?y&awetag-llawerif,ffijduolc:.&ed-1arf,su-1tsew,?,ltsaf.&dorp.&a,labolg,?lss.&a,b,labolg,?pam,slteerf,?n&-morf,ofipi,?srab,?z&a-morf,tirfym,???p?tcip?v??f&ig?o&l?sorcim???g!.&bog?dni?ed,g&olb,ro??lim?moc?ot,ten?ude???h!.&dem?gro?l&er?op??m&oc?rif??o&fni?rp?s&rep?sa???po&hs?oc??t&en?luda?ra??ude?vuog???i!.&a&2n-loritds--nx?7e-etsoaellav--nx?8&c-aneseclrof--nx?i-lrofanesec--nx??at?b?c!cul??dv?i&blo&-oipmet?oipmet??cserb?drabmol?g&gof?urep??l&gup?i&cis?me&-oigger?oigger???uig&-&aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf???aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf????n&a&brev?cul?pmac?tac??idras?obrac&-saiselgi?saiselgi??resi??otsip?r&b&alac!-oigger?oigger??mu??dna&-&attelrab-inart?inart-attelrab??attelrabinart?inartattelrab?ssela??epmi?ugil??tnelav&-obiv?obiv??vap?z&e&nev?ps&-al?al???irog???l&iuqa!l??leib??m&or?rap??n!acsot?e&dom?is?sec&-&ilrof?ìlrof??ilrof?ìlrof???g&amor&-ailime?ailime??edras?olob??i&ssem?tal??ne!var??o&cna?merc?rev?vas???oneg?p?r!a&csep?rr&ac&-assam?assam??ef??von??etam?tsailgo!-lled?lled???s!ip?sam&-ararrac?ararrac??u&caris?gar???t!a&cilisab?recam??resac?soa!-&d&-&ellav?lav??ellav?lav??ellav??d&-&ellav?lav??ellav?lav??ellav??te&lrab&-&airdna-inart?inart-airdna??airdnainart?inartairdna??ssinatlac???udap?v!o&dap?neg?tnam???zn&airb&-a&lled-e-aznom?znom??a&lledeaznom?znom??eaznom??e&c&aip?iv??soc?top??om???b&-&23,46,61,?3c-lorit-ds-onitnert--nx?be-etsoa&-ellav--nx?dellav--nx??c!f-anesec-lrof--nx?m-lrof-anesec--nx??he-etsoa-d-ellav--nx?m!u??o2-loritds-nezob--nx?sn-loritds&-nasl&ab--nx?ub--nx??nitnert--nx??v!6-lorit-dsnitnert--nx?7-loritds&-nitnert--nx?onitnert--nx???z&r-lorit-ds&-nitnert--nx?onitnert--nx??s-loritds-onitnert--nx???c&f?is?l?m?p?r?v??d&p?u!olcnys,??e&c!cel?inev?nerolf??f?g!ida&-&a&-onitnert?onitnert??otla!-onitnert?onitnert???a&-onitnert?onitnert??otla!-on&azlob?itnert??onitnert????hcram?l?m!or??n&idu?o&n&edrop?isorf??torc???p?r?s&erav?ilom??t!nomeip?s&eirt?oa!-&d-e&ellav?éllav??e&ellav?éllav???de&ellav?éllav??e&ellav?éllav?????v?znerif??g&a?b?f?il?o?p?r?up?vf??hc?i&b?c?dol?f?l!lecrev?opan?rof&-anesec?anesec???m?n&a&part?rt&-attelrab-airdna?attelrabairdna???imir?ret??p?r!a&b?ilgac?ssas???s!idnirb??t&ei&hc?r??sa??v??l&a!c??b?c?o&m?rit&-&d&eus&-&nitnert?onitnert??nitnert?onitnert??us&-&nitnert?onitnert??nitnert?onitnert??üs&-&nitnert?onitnert??nitnert?onitnert???s&-onitnert?onitnert???d&eus!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??us&-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??üs!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert???s&-onitnert?onitnert?????m&ac?f?i!t.nepo.citsalej.duolc,?ol?r??n&a!lim?sl&ab?ub???b?c?e!en.cj,v?zob??irut?m!p??p?r?t??o&a!v??b!retiv??c!cel??enuc?g!ivor??i&dem&-onadipmac?onadipmac??pmet&-aiblo?aiblo??rdnos?zal??l?m!a&greb?ret??oc?re&f?lap???n!a&dipmac&-oidem?oidem??lim?tsiro?zlob??ecip&-ilocsa?ilocsa??i&bru&-orasep?orasep??lleva?rot?tnert??r&elas?ovil??ulleb??p?r!a&sep&-onibru?onibru??znatac??oun??s!ivert?sabopmac??t!arp?e&nev?ssorg??n&arat?e&girga?rt?veneb????zz&era?urba???p&a?ohsdaerpsym,s?t??qa?r&a!m?s??b!a??c?f?g?k?me?o?p?s?t?v??s&a&b?iselgi&-ainobrac?ainobrac???b?c?elpan?i?m?ot?s?t?v??t&a?b?c?l?m?nomdeip?o!psgolb,?p?v??u&de?l?n?p??v&a?og?p?s?t?v??y&drabmol?ellav&-atsoa?atsoa??licis?nacsut??z&al?b?c?p??ìlrof&-anesec?anesec???derc?er?f?m!r??utni??je3a3abgm--nx?kh?l!.&topsgolb,vog??uda??m!.&gro?moc!.topsgolb,?ten?ude???n&a&morockivdnas?ruatser?tnuocca??e&g?m&eganam!.retuor,?piuqe??r??i!.ue?m?opdlog??opud?uocsid??o&b?cs!.&ude,vog:.ecivres,,??d?g?h?j?oferab?p&edemoh?s???p!.&emon?gro?lbup?moc?t&en?ni?opsgolb,?ude?vog???r&a!m&law?s???epxe?op&er?pus!.ysrab,?s???s!.&adaxiabme?e&motoas?picnirp?rots??gro?lim?moc?o&c?dalusnoc?hon,?ten?ude??a&cmoc?f??e&b?padub?r?uq??i!rolf?tned??o&h!.&duolc&p,rim,?e&lej,tiseerf,?flah,lrupmet,s&pvtsaf,seccaduolc,?tsafym,vedumpw,??p!sua???urt??t!.&eman?gro?ibom?levart?m&oc?uesum??o&c?fni?r&ea?p???pooc?sboj?t&en?ni??ude?vog?zib??ayh?n?o!bba?irram???uognah?xen?y!.gro,?ztej??u&2&5te9--nx?yssp--nx??a!.&a&s?w??civ?d&i?lq??fnoc?gro?moc!.&pohsdaerpsym,stelduolc.lem,topsgolb,??nsa?ofni?sat?t&ca?en?n??ude!.&a&s?w??ci&lohtac?v??dlq?sat?t&ca?n??wsn!.sloohcs????vog!.&a&s?w??civ?dlq?sat???wsn?zo??ti??c!.&fni?gro?moc?ten?ude?vog??i??d&e!.tir.segap-tig,?iab??e!.&dcym,enozgniebllew,noitatsksid,odagod.citsalej,snd&ps,uolc,?ysrab,??g!.&bew?gro?m&aug?oc??ofni?ten?ude?vog???h!.&0002?a&citore?idem?kitore??edszot?gro?ilus?letoh?m&alker?lif?t?urof??naltagni?o&c?ediv?fni?levynok?nisac??pohs?rarga?s&a&kal?zatu??emag?wen??t&lob?opsgolb,rops??virp?xe&s?zs??ytic?zsagoj??os?sut??l!.topsgolb,?m!.&ca?gro?moc?oc?ro?ten?vog???n!.&duolcesirpretne,eni&esrem,m,?tenkcahs,?em!.ysrab,??o&ggnaw?y!c???r!.&3kl,a&i&kymlak,rikhsab,vodrom,?yegyda,?bps,ca,duolcrim,e&niram,rpcm,?g&bc,nitsohurger.citsalej,ro,?ianatsuk,k&ihclan,s&m,rogitayp,??li&amdlc.bh,m,?moc,natsegad,onijym,pp,ri&b,d&cm:.spv,,orue,?midalv,?s&ar,itym,?t&en,ni,opsgolb,set,?u&4an,de,?vo&g,n,?ynzorg,zakvakidalv,?myc?p?ug??s!.&a&d&golov,nagarak,?gulak,i&groeg,kymlak,lerak,nemra,rikhsab,ssakahk,vodrom,zahkba,?lut,rahkub,vut,yegyda,znep,?bps,da&baghsa,rgonilest,?gunel,i&anatsuk,hcos,ovan,ttailgot,?k&alhsygnam,ihclan,s&legnahkra,m,n&a&mrum,yrb,?i&buytka,nbo,??tiort,vorkop,??l&ocarak,ybmaj,?na&gruk,jiabreza,ts&egad,hkazak-&htron,tsae,???ovonavi,r&adonsark,imidalv,?t&enxe,nek&hsat,mihc,??vo&hsalab,n,?ynzorg,z&akvakidalv,emret,??t&amok?i&juf?masih????v!.&em,g&olb,ro??moc?nc,ten?ude?ved,??ykuyr??v&b?c!.topsgolb,?ed!.&enilnigol,gnigats-oned,hcetaidem,lecrev,o&ned,tpyrctfihs,?ppa-rettalp,s&egap,rekrow,?vr&esi,uc,?weiverpbuhtig,ylf,??ih?l!.&di?fnoc?gro?lim?moc?nsa?ten?ude?vog???m!.&eman?gro?lim?m&oc?uesum??o&fni?r&ea?p???pooc?t&en?ni??ude?vog?zib???o&g?m??rt?s!.&bog?der?gro?moc?ude???t!.&bew-eht-no,naht-&esrow,retteb,?sndnyd,?d?gh?i?won??uqhv--nx??w&a!.moc?hs?l??b!.&gro?oc???c!.&gro?moc?ten?ude??cp??e&iver!.oby,?n?s??g?k!.&bme?dni?gro?moc?ten?ude?vog???m!.&ca?gro?m&oc?uesum??oc?pooc?t&en?ni??ude?vog?zib??b??o&csom?h!s??n?w??p!.&344x,de?en?o&c?g??ro?snduolc,ualeb???r!.&ca?gro?lim?oc?pooc?ten?vog??n??t!.&a46oa0fz--nx?b&82wrzc--nx?ulc??emag?gro?l&im?ru,?moc!.reliamym,?t&en?opsgolb,?ude?v&di?og?ta0cu--nx??zibe?業商?織組?路網???z!.&ca?gro?lim?oc?vog????x&a!.&cm,eb,gg,s&e,u,?tac,ue,yx,?t??c!.&hta,ofni,vog???e&d&ef?nay??ma!nab??rof?s??ilften?jt?m!.&bog?gro?moc?t&en?opsgolb,?ude??g?ma2ibgy--nx??o&b!x??f?rex??rbgn--nx?s!.vog??x&am&jt?kt??x???y&4punu--nx?7rr03--nx?a&d!i&loh?rfkcalb??ot??g?lp?p!ila??rot?ssin?wdaorb??b!.&duolcym,fo?hcetaidem,lim?moc!.topsgolb,?vog??ab?gur??c!.&ca?dtl?eman?gro?m&oc!.&ecrofelacs.j,topsgolb,??t??orp?s&egolke?serp??t&en?nemailrap??vog?zib??amrahp?nega??d&dadog?uts??e&kcoh?ltneb?n&dys?om?rotta??snikcm??g!.&eb,gro?moc?oc?ten?ude?vog??olonhcet!.oc,?rene??hpargotohp?id?k!.&gro?moc?ten?ude?vog??s??l!.&clp?d&em?i??gro?hcs?moc?ten?ude?vog??f?imaf!nacirema??l&a?il??ppus??m!.&eman?gro?lim?moc?t&en?opsgolb,?ude?vog?zib??edaca!.laiciffo,?ra??n&a&ffit?pmoc!ylimafa???os??o&j?s??p!.&gro?lim?moc?pooc?ten?ude?vog???r&e&corg?grus?llag?viled??lewej?otcerid?tnuoc?uxul??s!.&gro?lim?moc?ten?ude?vog??pil??t&efas?i&c?ledif?n&ifx?ummoc!.&bdnevar,gon,murofym,???r&ahc?uces??srevinu??laer?r&ap!.oby,?eporp??uaeb??u!.&bug?gro?lim?moc!.topsgolb,?ten?ude??b!tseb???van!dlo??xes??z&a!.&eman?gro?lim?moc?o&fni?rp??pp?t&en?ni??ude?vog?zib???b!.&az,gro?jsg,moc?ten?ude?vog???c!.&4e,inum.duolc.&rsu,tlf,?m&laer,urtnecatem.motsuc,?oc,topsgolb,??d!.&cos?gro?lop?m&oc?t??ossa?t&en?ra??ude?vog???ib!.&duolcsd,e&ht-rof,mos-rof,rom-rof,?izoj,nafamm,p&i&-on,fles,?ohbew,tfym,?retteb-rof,snd&nyd,uolc,?xro,?g??k!.&duolcj,gro?lim?moc?t&en?ropeletzak.saapu,?ude?vog???m!.&ca?gro?lim?oc?ten?ude?v&da?og????n!.&asq-irom--nx?ca?gro?htlaeh?i&r&c?o&am?ām???wi!k???keeg?l&im?oohcs??neg?oc!.topsgolb,?t&en?nemailrap?vog???a!niflla???rawhcs?s!.&ca?gro?oc???t!.&c&a?s??e&m?n??ibom?l&etoh?im??o&c?fni?g??ro?vt???u!.&gro?moc?oc?ten??rwon??yx!.&e&nozlacol,tisgolb,?gnitfarc,otpaz,??zub??λε?υε?авксом?брс!.&гро?до?ка?р&бо?п!у?????г&б?ро??дкм?зақ?итед?килотак?леб?мок?н&йално?ом??рку?сур!.&арамас,бпс,гро,зиб,ичос,ксм,м&ок,ырк,?рим,я,??тйас?фр?юе?յահ?לארשי?םוק?اي&روس?سيلم?ناتيروم??بر&ع?غملا??ة&كبش?ي&دوعسلا?روس??یدوعسلا??ت&ا&راما?لاصتا??را&ب?ڀ?ھب???ر&ئازجلا?ازاب?صم?طق??سنوت?عقوم?قارع?ك&تيب?يلوثاك??موك?ن&ا&تس&كاپ?کاپ??دوس?ر&يا?یا??مع?يلعلا??درالا?ميلا?ي&رحبلا?طسلف???ه&ارمه?يدوعسلا??وكمارا?يبظوبا?ۃیدوعسلا?टेन?त&राभ?ोराभ??नठगंस?मॉक?्मतराभ?ত&রাভ?ৰাভ??ালংাব?ਤਰਾਭ?તરાભ?ତରାଭ?ாயித்நஇ?ைக்ஙலஇ?்ரூப்பக்ஙிச?్తరాభ?ತರಾಭ?ംതരാഭ?ාකංල?มอค?ยทไ!.&จิกรุธ?ต็นเ?ร&ก์คงอ?าหท??ลาบฐัร?าษกึศ???ວາລ?ეგ?なんみ?アトス?トンイポ?ドウラク?ムコ?ル&グーグ?ーセ??ン&ゾマア?ョシッァフ??业企?东广?乐娱?亚基诺?你爱我?信中?务政?动移?博微?卦八?厅餐?司公?品食?善慈?团集?国中?國中?址网?坡加新?城商?尚时?山佛?店&商?网?酒大里嘉??府政?康健?息信?戏游?拉里格香?拿大?教主天?机手?构机!织组??标商?歌谷?浦利飞?港香!.&人個?司公?府政?絡網?織組?育教???湾台?灣&台?臺??物购?界世?益公?看点?科盈訊電?站网?籍書?线在?络网?网文中?聘招?販通?车汽众大?逊马亚?通联?里嘉?锡马淡?門澳?门澳?闻新?電家?국한?넷닷?성삼?컴닷??"); + "a&0&0trk9--nx?27qjf--nx?e9ebgn--nx?nbb0c7abgm--nx??1&2oa08--nx?apg6qpcbgm--nx?hbbgm--nx?rdceqa08--nx??2&8ugbgm--nx?eyh3la2ckx--nx?qbd9--nx??3&2wqq1--nx?60a0y8--nx??4x1d77xrck--nx?6&1f4a3abgm--nx?2yqyn--nx?5b06t--nx?axq--nx?ec7q--nx?lbgw--nx??883xnn--nx?9d2c24--nx?a&a?it??b!.&gro?lim?moc?sr,t&en?opsgolb,?ude?vog??abila?c?ihsot?m?n??c!.&b&a?m?n??c&b?g?q??ep?fn?k&s?y??ln?no?oc,p&i-on,ohsdaerpsym,?sn?t&n?opsgolb,?un?ysrab,?i&ma?r&emarp?fa??sroc??naiva?s??d&ats?n&eit?oh??om?sa?tl??eg?f&c?ob??g!emo?naripi?oy??hskihs?i&cnal?dem?hs?k!on??sa!.snduolc,??jnin?k&aso?dov?ede?usto??l!.&c,gro?moc?ofni?r&ep?nb,?t&en?ni??ude?vog??irgnahs?le&nisiuc?rbmuder???m!.&ca?gro?oc?sserp?ten?vog??ahokoy?e00sf7vqn--nx?m??n!.&ac?cc?eman?gro?ibom?loohcs?moc?ni?o&c?fni?rp??r&d?o??s&u?w??vt?xm??av?is?olecrab?tea??p!.&bog?ca?d&em?ls??g&ni?ro??mo&c?n??oba?ten?ude??c?g7hyabgm--nx?ra!.&461e?6pi?iru?nru?rdda-ni?siri???s??q!.&eman?gro?hcs?lim?moc?t&en?opsgolb,?ude?vog???r&az?emac?f4a3abgm--nx?n!d5uhf8le58r4w--nx??u&kas?tan???s!.&bup?dem?gro?hcs?moc?ten?ude?vog??ac!.uban.iu,?iv??t&ad?elhta?led?oyot??u!.&a&cinniv?emirc?i&hzhziropaz?stynniv??s&edo?sedo??tlay?vatlop??bs?cc,d&argovorik?o!roghzu??tl,?e&hzhziropaz?nvir?t??f&i?ni,?g&l?ro??hk?i&stvinrehc?ykstynlemhk??k&c?m?s&nagul?t&enod?ul??v&iknarf-onavi?orteporp&end?ind?????l&iponret?opotsa&bes?ves??p??m&k?oc?s?yrk??n&c?d?i?osrehk?v?ylov??o&c,nvor??p&d?p,z??r&c?imotihz?k?ymotyhz??sk?t&en?l?z??ude?v:c?e&alokin?ik??i&alokym?hinrehc?krahk?vl?yk??k?l?o&g!inrehc??krahk??r?,xc,y&ikstinlemhk?mus?s&akrehc?sakrehc?tvonrehc???z&ib,u????v!aj?bb?et?iv??waniko?x&a?iacal??yogan?z&.&bew?c&a?i&n?rga???gro?l&im?oohcs??m&on?t??o&c!.topsgolb,?gn??radnorg?sin?t&en?la??ude?vog?wal??zip???b&00ave5a9iabgm--nx?1&25qhx--nx?68quv--nx?e2kc1--nx??2xtbgm--nx?3&b2kcc--nx?jca1d--nx??4&6&1rfz--nx?qif--nx??96rzc--nx??7w9u16qlj--nx?88uvor--nx?a&0dc4xbgm--nx?c?her?n?ra?t??b!.&erots?gro?moc?o&c?fni??ten?ude?v&og?t??zib??a??c&j?s??d&hesa08--nx?mi??g?l!.&gro?moc?ten?ude?vog??m??s!.&gro?moc?ten?ude?vog???tc-retarebsnegmrev--nx?u&lc!.&elej,snduolc,y&nop,srab,??smas??p!.ysrab,??wp-gnutarebsnegmrev--nx??c&1&1q54--nx?hbgw--nx??2e9c2czf--nx?4&4ub1km--nx?a1e--nx?byj9q--nx?erd5a9b1kcb--nx??8&4xx2g--nx?c9jrb2h--nx??9jr&b&2h--nx?54--nx?9s--nx??c&eg--nx?h3--nx?s2--nx???a!.&gro?lim?moc?rrd,ten?ude?vog??3a09--nx!.&ca1o--nx?gva1c--nx?h&ca1o--nx?za09--nx??ta1d--nx?ua08--nx???da??b&a?b?ci?f76a0c7ylqbgm--nx?sh??c!.&eugaelysatnaf,gnipparcs,liamwt,nwaps.secnatsni,revres-emag,s&nduolc,otohpym,seccaptf,?xsc,?0atf7b45--nx?a1l--nx??e!.&21k?bog?dem?esab,gro?l&aiciffo,im??moc?nif?o&fni?rp??ten?ude?vog??beuq?n?smoc??fdh?i&l&buperananab?ohtac??n&agro?ilc?osanap??sum?tic??l!.&gro?moc?oc?ten?ude?vog?yo,?l??m!.&mt?ossa??p1akcq--nx??n!.&mon?ossa??i?p??relcel?s!.&gro?moc?ten?ude?vog???t!.&e&m,w,?hc,?s?w??v!.&e0,gro?lim?moc?ten?ude?v&g:.d,,og????wp?yn??d&2urzc--nx?3&1wrpk--nx?c&4b11--nx?9jrcpf--nx???5xq55--nx?697uto--nx?75yrpk--nx?9ctdvkce--nx?a!.mon?d?er?olnwod??b2babgm--nx?c!.vog?g9a2g2b0ae0chclc--nx??e&m!bulc??r!k??sopxe?timil?w??fc?g!.&ude?vog???h&d3tbgm--nx?p?t??i!.&ased?bew?ca?etrof,golbw,hcs?lim?o&c!.topsgolb,?g??palf,r&egolb,o??sepnop?ten?ym?zib??b?ordna?p?rdam??l&iub?og?row??m!.&ed,ot,pj,t&a,opsgolb,???n&a&b?l!.citats:.&setis,ved,?,raas???ob?uf??o&of?rp??r&a&c&tiderc?yalcrab??ugnav??ef506w4b--nx?k!.&oc,ude,?jh3a1habgm--nx??of??s!.&dem?gro?moc?ofni?ten?ude?v&og?t???m!kcrem???t!.topsgolb,excwkcc--nx?l??uolc!.&a&bura-vnej.&1ti,abura.rue.1ti,?tcepsrep,xo:.&ku,nt,?,?b&dnevar,ewilek:.sc,,?citsalej.piv,drayknil,elej,gnitsohdnert.&ed,hc,?letemirp:.ku,,m&edaid,ialcer.&ac,ku,su,??n&evueluk,woru,?r&epolroov,o&pav,tnemele,??tenraxa.1-se,ululetoj,xelpciffart,yawocne.ue,??za5cbgn--nx??e&1&53wlf--nx?7a1hbbgm--nx?ta3kg--nx??2a6a1b6b1i--nx?3ma0e1cvr--nx?418txh--nx?707b0e3--nx?a!.&ca?gro?hcs?lim?oc?t&en?opsgolb,?vog??09--nx??b!.&ca?gnitsohbew,nevueluk.yxorpze,pohsdaerpsym,snoitulostsohretni.duolc,topsgolb,?ortal?ut!uoy???c&0krbd4--nx?a&lp!.oc,?ps!.&lla4sx,rebu,tsafym,?artxe??sla??i!ffo??n&a&d?iler?nif?rusni!efil?srelevart???eics!.oby,??rofria??d!.&1sndnyd,42pi-nyd,7erauqs,amil4,b&ow-nrefeilgitsng--nx,rb-ni,vz-nelletsebgitsng--nx,?decalpb,e&daregtmueart,mohsnd,nihcamyek,?hcierebsnoissuksid,keegnietsi,lsd-ni,moc,n&-i-g-o-l,aw-ym,e&lletsebgitsnüg,sgnutiel,?i&emtsi,lreb-n&i,yd,??norblieh-sh.ti.segap,oitatsksid-ygolonys,pv&-n&i,yd,?nyd,?refeilgitsnüg,?orp-ytinummoc,p&h21,iog:ol,,ohsdaerpsym,?r&e&ntrapdeeps.remotsuc,su&-lautriv,lautriv,?t&adpusnd,tub-ni,uor-ym,?vres&-e&bucl,mohym,?bew-emoh:.nyd,,luhcs,??ogiv-&niem,ym,??s&d-&onys,ygolonys,?nd&-&dd,nufiat,sehcsimanyd,tenretni,yard,?isoc.nyd,ps,yard,?oper-&nvs,tig,?sndd:.&nyd,sndnyd,?,?topsgolb,vresi-&niem,tset,?xi2,y&awetag-&llawerif,ym,?srab,tic-amil,?zten&mitbel,sadtretteuf,??art!.oby,?i&sdoow?ug??nil?on--nx??e!.&bil?dem?eif?gro?irp?kiir?moc!.topsgolb,?pia?ude?vog??ei?ffoc?gg?r&f?ged???f&a&c?s??il??g!.&gro?lim?moc?t&en?vp??ude?vog??a&f?gtrom?p!.&3xlh,detalsnart,grebedoc,kselp,sndp,tengam,xlh,y&cvrp,kcor,???rots?yov??elloc?na&hcxe?ro??roeg?ug??i!.&pohsdaerpsym,topsgolb,vog??tilop?v&bba?om???j!.&fo,gro?oc?ten???k!.&c&a?s??e&m?n??ibom?o&c!.topsgolb,?fni?g??ro??i&b?l?n???l&a&dmrif?s!.rof,rof???b&a?i&b?dua???c&aro?ric??dnik?g!oog??i&bom?ms??l&asal?erauqa??ppa?uhcs?yts!efil???m!.&4&32i,p&ct,v,??66c,ailisarb,b&dnevar,g-raegelif,?ca?duolcsd,e&d-raegelif,i&-raegelif,lpad:.tsohlacol,,?pcm,?g&ro?s-raegelif,?hctilg,k&catsegde,uoc,?noitatsksid,o&bmoy,c!ku,?t&nigol,poh,??p&ion,j-raegelif,ohbew,?qbw,r&aegelif,idcm,ofsnd,?s&dym,ndd,ti!bt,?umhol,?t&en?s&acdnuos,ohon,??u&a-raegelif,de??v&irp?og??y&golonys,olpedew,srab,??a&g?n!.&reh.togrof,sih.togrof,???em?i&rp?twohs??orhc?w??n!goloc?i&lno!.&egats-oree,oree,ysrab,??w??o!.&derno:.gnigats,,ecivres,knilemoh,r&ednu,of,??hp?latipac?ts&der?e&gdirb?rif???z!.&66duolc,amil,sh,???ruoblem??om?p!.&bog?gro?lim?mo&c?n??t&en?opsgolb,?ude??irg?yks??r!.&mo&c?n??ossa?topsgolb,?a&c!htlaeh??pmoc?wtfos??bc?eh?if?ots!.&e&rawpohs,saberots,?yflles,??taeht?u&ces?sni?t&inruf?necca??za???s!.&a!bap.us,?b!ibnal?rofmok??c!a??d!b?n&arb?ubroflanummok???e?f!noc,?g!ro??h!f??i!trap??k!shf??l?m!oc,t??n!mygskurbrutan??o?p!ohsdaerpsym,p??r!owebdluocti,?s!serp?yspoi,?t!opsgolb,?u?vhf?w?x!uvmok??y?z??a&c?el?hc??i&er?urc??nesemoh?roh?uoh??t&a&d?ts&e!laer??lla???is!.&e&lej,nilnigol,r&etnim,ocevon,?winmo,?k&rowtenoilof,wnf,?laicosnepo,n&eyb,oyc,?spvtsaf,thrs,xulel,ysrab,?bew??ov?ra?t&ioled?ol??utitsni??u&lb?qi&nilc?tuob???v!.&21e?b&ew?ib?og??ce&r?t??erots?gro?lim?m&o&c?n??rif??o&c?fni??rar?stra?t&en?ni??ude?vog??as?e3gerb2h--nx?i&l!.xlh,?rd?ssergorp??ol??w&kct--nx?r??xul?y!.&gro?lim?moc?ten?ude?vog????f&0f3rkcg--nx?198xim--nx?280xim--nx?7vqn--nx?a!.&gro?moc?ten?ude?vog???b!.vog?wa9bgm--nx??c!.topsgolb,a1p--nx!.&a14--nx,b8lea1j--nx,c&avc0aaa08--nx,ma09--nx,?f&a1a09--nx,ea1j--nx,?gva1c--nx,nha1h--nx,pda1j--nx,zila1h--nx,??ns??ea1j--nx?g?iam?l&a1d--nx?og??n!.&bew?cer?erots?m&oc?rif??ofni?re&hto?p??stra?ten???orp?p!.&gro?moc?ude???rus?t!w??vd7ckaabgm--nx?w??g&2&4wq55--nx?8zrf6--nx??3&44sd3--nx?91w6j--nx!.&a5wqmg--nx?d&22svcw--nx?5xq55--nx??gla0do--nx?m1qtxm--nx?vta0cu--nx????455ses--nx?5mzt5--nx?69vqhr--nx?7&8a4d5a4prebgm--nx?rb2c--nx??a!.&gro?mo&c?n??oc?ten??vd??b!.&0?1?2?3?4?5?6?7?8?9?a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t!opsgolb,?u?v?w?x?y!srab,?z???c!b?za9a0cbgm--nx??e!.&eman?gro?ics?lim?moc!.topsgolb,?nue?ten?ude?vog??a??g!.&ayc,gro?lenap:.nomead,,oc?saak,ten???i&a?v??k!.&g&olb,ro??ku,lim?moc?oi,pj,su,ten?ude?v&og?t,???m!.&drp?gro?lim?m&o&c?n??t??oc?ude?vog??pk??n!.&dtl,eman?gro?hcs?i!bom??l&im?oc,?m&oc!.topsgolb,?rif,?neg,ogn,ten?ude?vog??aw?i!b!mulp??car?d&art?dew??h&sif?tolc??k&iv?oo&b?c???ls?n&aelc?iart??p!pohs??re&enigne?tac??t&ad?ekram!.&htiw,morf,??hgil?lusnoc?neg?ov?soh!.tfarcnepo,??vi&g?l???o!s??u&rehcisrev?smas?tarebsnegömrev???o&d?lb?og!.&duolc,etalsnart,???r&2n084qlj--nx?ebmoolb?o!.&77ndc.c:sr,,a&remacytirucesym,t&neimip,sivretla,?z,?bew-llams,d&ab-yrev-si,e&sufnocsim,vas-si,?nuof-si,oog-yrev-si,uolc&arfniarodef,mw,??e&a,cin-yrev-si,grof&loot,peh,?l&as-4-ffuts,poeparodef,?m&-morf,agevres,ohruoyslles,?n&ozdop,uma.elet,?r&ehwongniogyldlob,iwym,uces-77ndc.nigiro.lss,?t&adidnac-a-si,is&-ybboh,golb,???fehc-a-si,golbymdaer,k&eeg-a&-si,si,?h,nut,?l&i&amwt,ve-yrev-si,?lawerif&-ym,ym,?sd-ni,?m&acssecca,edom-elbac,?n&af&blm,cfu,egelloc,lfn,s&citlec-a-si,niurb-a-si,tap-a-si,?xos-a-si,?ibptth,o&itatsksid,rviop,?pv-ni,?o&jodsnd,tp&az,oh,??p&i&-on,fles,?o&hbew,tksedeerf,?tf&e&moh,vres,?ym,??r&e&gatop,ppepteews,su-xunil-a-si,?gmtrec,vdmac,?s&a&ila&nyd,snd,?nymsd,?b&alfmw,bevres,?d&ikcet.3s,ylimaf,?eirfotatophcuoc,j,koob-daer,ltbup,nd&-won,deerf,emoh,golb,kcud,mood,nyd:.&emoh,og,?,ps,rvd,tog,uolc,?s&a-skcik,ndd,?tnemhcattaomb,u,?t&ce&jorparodef.&duolc,gts.so.ppa,so.ppa,?riderbew,?e&ews-yrev-si,nretni&ehtfodne,fodne,??hgink-a-si,oi-allizom,s&ixetn&od,seod,?o&h-emag,l-si,?rifyam,??ue:.&a&-q,c,?cm,dc,e&b,d,e,i,m,s,?g&b,n,?hc,i&f,s,?k&d,m,s,u,?l&a,i,n,p,?n&c,i,?o&n,r,ssa,?pj,r&f,g,h,k,t,?s&e,i:rap,,u,?t&a,en,i,l,m,ni,p,?u&a,de,h,l,r,?vl,y&c,m,?z&c,n,??,vresnyd,x&inuemoh,unilemoh,?y&limafxut,srab,???ub&mah?oj???s!.&delacsne,gro?moc?rep?t&en?opsgolb,?ude?vog??gb639j43us5--nx??t?u!.&c&a?s??en?gro?moc?o&c?g??ro?topsgolb,??v!.ta,a1c--nx??wsa08--nx??h&0ee5a3ld2ckx--nx?4wc3o--nx!.&a&2xyc3o--nx?3j0hc3m--nx?ve4b3c0oc21--nx??id1kzuc3h--nx?l8bxi8ifc21--nx?rb0ef1c21--nx???8&8yvfe--nx?a7maabgm--nx??b!.&gro?moc?ten?ude?vog??mg??c!.&7erauqs,amil4,duolc-drayknil,gniksnd,p&h21,ohsdaerpsym,?sndtog,topsgolb,wolf.e&a.1pla,nigneppa,?xi2,ytic-amil,?aoc?et?ir!euz??r&aes!errecnac??uhc??sob?taw!s???d0sbgp--nx?f&2lpbgm--nx?k??g!.&gro?lim?moc?ude?vog???m!a1j--nx??ocir?p!.&gro?i?lim?moc?ogn?ten?ude?vog???s!.&g&nabhsah,ro??l&im?xv,?m&oc?roftalp.&cb,su,tne,ue,??pib,ten?vog?won,yolpedew,?a&c?nom??i&d?f?ri???t!.&ca?enilno,im?ni?o&c?g??pohs,ro?ten??iaf!.oby,?laeh!.arh,?orxer?ra&ba?e???vo!.lopdren,?zb??i&3tupk--nx?7a0oi--nx?a!.&ffo?gro?moc?ten?uwu,?1p--nx?bud?dnuyh?tnihc??b!.&gro?moc?oc?ro?ude??ahduba?o!m!.&duolcsd,ysrab,???s??c!.&ayb-tropora--nx?ca?d&e?m??esserp?gro?ln,moc?nif,o&c?g?ssa??ro?t&en?ni?roporéa??ude?vuog??cug?t??d&dk?ua??e&bhf--nx?piat??f!.&aw5-nenikkh--nx,dnala?i&ki,spak,?mroftalpduolc.if,nenikkäh,pohsdaerpsym,retnecatad.&omed,saap,?topsgolb,yd,?onas??g!.&d&om?tl??gro?moc?ude?vog???h&c&atih?ra??s&abodoy?ibustim???juohs?k!.&gro?moc?ofni?ten?ude?vog?zib??b4gc--nx?iw?nisleh?s?uzus??l!.&aac,topsgolb,?drahcir?iamsi??maim?n!.&b&ew?og??ca?gro?lim?mo&c?n??ni?o&c?fni??pp?t&en?ni??ude?zib??airpic?i&hgrobmal?m??re??om?rarref?s!.&egaptig,ppatig,topsgolb,?ed??t&aresam?i&c?nifni??rahb?tagub??ut?v!.&21k?gro?moc?oc?ten???wik?xa&rp?t??yf??j&6pqgza9iabgm--nx?8da1tabbgl--nx?b!.&ossa?topsgolb,uaerrab?vuog???d?f!.&ca?eman?gro?lim?moc?o&fni?rp??ten?vog?zib???nj?s?t!.&bew?c&a?in??eman?gro?lim?moc?o&c?g??t&en?ni?set??ude?vog?zib???yqx94qit--nx??k&8uxp3--nx?924tcf--nx?arfel?c&a&bdeef?lb??ebdnul?ilc?reme??d!.&erots,ger,mrif,oc,pohsdaerpsym,topsgolb,zib,?t??e&es?samet??h!.&a&4ya0cu--nx?5wqmg--nx??b3qa0do--nx?cni,d&2&2svcw--nx?3rvcl--nx??5xq55--nx?tl,?g&a0nt--nx?la0do--nx?ro??i&050qmg--nx?7a0oi--nx?xa0km--nx??m&1qtxm--nx?oc??npqic--nx?saaces,t&en?opsgolb,?ude?v&di?og?ta0cu--nx??xva0fz--nx?人&个?個?箇??司公?府政?絡&網?网??織&組?组??织&組?组??络&網?网??育&敎?教???n??i&tsob?vdnas??l!.&bew?c&a?os??dtl?gro?hcs?letoh?moc?nssa?ogn?prg?t&en?ni??ude?vog??at?cd?is??m!.&eman?fni?gro?moc?t&en?opsgolb,?ude?vog???n&ab!cfdh?etats?mmoc?t&en?fos??u??i!l!.&noyc,pepym,??p???oob?p!.&b&ew?og??gro?kog?m&af?oc??nog?ofni?pog?sog?ten?ude?vog?zib???row!.&morf,ot,?ten!.&htumiza,nolt,o&c,vra,??doof???s!.topsgolb,?t?u!.&c&a?lp??d&om?tl??e&cilop?m??gro!.&gul:g,,sgul,yr&ettoly&lkeew,tiniffa,?tneelffar,???lenap-tnednepedni,n&noc,oissimmoc-&layor,tnednepedni,??o&c!.&bunsorter.tsuc,e&lddiwg,n&ilnoysrab,ozgniebllew,??krametyb.&hd,mv,?omida,p&i-on,ohsdaerpsym,?t&fihsreyal.j,opsgolb,?vres-hn,ysrab,??rpoc,?psoh,shn?t&en?nmyp,seuqni-tnednepedni,?vog!.&eci&ffoemoh,vres,?ipa,??weiver-tnednepedni,y&riuqni-&cilbup,tnednepedni,?srab,????l&04sr4w--nx?a!.&gro?lim?moc?t&en?opsgolb,?ude?vog??bolg?c?ed?g!el??i&c&nanif!.oc,lpl??os??romem?tnedurp??n&if?oitanretni??t&i&gid!.sppaduolc:.nodnol,,?p&ac?soh???ned?ot??utum!nretsewhtron???c!.&bog?lim?oc?topsgolb,vog???dil?e&datic?n&ahc?nahc!gnikooc?levart?rehtaew???t!ria?tam??vart??f&8f&pbgo--nx?tbgm--nx??a?n??g!.&gro?moc?oc?ten?ude?xx,zib,??h&d?op??i!.&21k?ca?fdi?gro?inum?oc!.&egapvar,redrotibat,topsgolb,??ten?vog??a&f?m&e?g?toh???m?r??l&a&b&esab?t&eksab!.&sua,zn,??oof???c?mt??e&d?hs??ihmailliw?j??m!.&esserp?gro?moc?ten?ude?v&og?uog????n!.&no&med,rtsic,?oc,pohsdaerpsym,retsulc-gnitsoh,topsgolb,yalphk,?o??o&a?btuf?l!.gmo,?o&c!.&ed,rotnemele,??hcs??rit?u??p!.&a&cin&diws?gel??d&g,ortso?urawon??i&dem?mraw?nydg,?k&elo&guld?rtso??slopolam?tsu?ytsyrut??l&ip?o&kzs?w&-awolats?oksnok????n&erapohs,img?zcel,?rog&-ai&bab?nelej??j?z??syn?tsaim?w&a&l&eib?i?o??zsraw??o&namil?tainop,??z&eiwolaib?mol???c&e&iw&alselob?o&nsos?rtso???le&im?zrogz???orw,p??d&em,ia?ragrats?uolc&inu,sds,??e&c&i&lrog?w&ilg,o&hc&arats?orp??klop?tak????yzreibok??i&csjuoniws?ksromop?saldop??l&ahdop?opo??napokaz,tatselaer?z&romop?swozam???g&alble?ezrbo&lok?nrat??ro??hcyzrblaw?i&csomohcurein?grat?klawus??k&e&rut?walcolw??in&byr?diws,sark,?le?o&nas?tsylaib??rob&el?lam??s&als?jazel?nadg,puls?rowezrp???l&colw?e&r?vart??i&am?m???m&o&c?dar?n?tyb??s&g?iruot??t!a???n&a&gaz?nzop,?i&bul?cezczs?lbul,molow?nok?zd&eb?obeiws???uleiw?y&tzslo?z&rtek?seic????o&c,fni?k&celo?zdolk??lkan?n&leim?pek?t&uk?yzczs??z&copo?eing?rowaj???rga?tua?w&ejarg?ogarm???p&e&eb,lks!emoh,??klwwortso?ohs!-ecremmoce,daerpsym,??romophcaz?sos?t&aiwop?en?opos,ra,sezc??ude?v&irp?og!.&a&p?s!w???bni&p?w??ci?dtiw?essp?fiw?g&imu?u??hiiw?m&igu?rio?u!o???nds?o&ks?p!pu??s?wtsorats??p&a?sp!mk?pk?wk??u&m?p??wk?z??r&ksw?s??s&i?oiw?u?zu??talusnok?w&gzr?i&p?rg?w??m?opu?u!imzw???zouw????w&a&l&corw?sizdow??w??o&golg?k&ark,ul?zsurp??r&az?gew??t&rabul,sugua??z&coks?sezr????xes?y&buzsak?d&azczseib?ikseb??hcyt?n&jes?lod-zreimizak??pal?r&ogt?uzam??walup?zutrak??z&am-awar?c&aprak?iwol?zsogdyb??dalezc?ib?s&i&lak?p??uklo????l??r&as?f?s??s!.&gro?moc?ten?ude?vog???t!.vog??ubnatsi?x3b689qq6--nx?yc5rb54--nx??m&00tsb3--nx?1qtxm--nx?981rvj--nx?a!.&aayn,enummoc?gro?moc?o&c?idar,ken,?t&en?opsgolb,??c!bew??dretsma?e&rts?t!.&citsalej,esruocsid,???fma?xq--nx??b!.&gro?moc?ten?ude?vog??i??c!.&moc?oc?ten?vog???d!.&gro?moc?ten?ude?vog???f!.&gro?moc?oidar,ten?ude??i??g!vu96d8syzf--nx??h?i!.&ca?gro?moc?o&c!.&clp?dtl???r,?t&en?t??vt??k?rbg4--nx??k!.&drp?e&rianiretev?sserp??gro?lim?m&o&c?n??t??nicedem?ossa?pooc?s&eriaton?neicamrahp?sa??ude?v&og?uog????l&if?ohkcots??o!.&dem?gro?m&oc?uesum??o&c?rp??ten?ude?vog??b?c!.&2aq,3pmevres,5sndd,a&c&-morf,ir&bafno,fa,??g&-morf,oy-sehcaet,?i-morf,m&-morf,all&-a-si,amai,??p&-morf,c-a-si,?r&emacytirucesym,odih,?s,tadtsudgniht,v-morf,w-morf,z,?b&dnevarym,ew&-sndnyd,draiw.segap,ottad,?ildts.ipa,?c&amytirucesemoh,d-morf,esyrcs,itsalej.omed,n&-morf,vym,?p&kroweht,ytirucesemoh,?q,rievres,s-morf,?d&aerotffuts,e&calpb,ifitrec-&si,ton-si,?llortnocduolc,rewopenignepw:.sj,,tsohecapsppa,?i&-morf,rgevissam.saap,?m-morf,n&-morf,abeht-htiw-si,?s-morf,uolc&-noitatsyalp,hr,iafaw.&d&ej,yr,?nol,?meaeboda,panqym:-&ahpla,ved,?,smetsystuo,tekcilc,ved&j,pw,??vreser,wetomer,?e&butuoyhtiw,ciffo-sndnyd,d:-morf,o&celgoog,n&il.srebmem,neve.&1-&su,ue,?2-&su,ue,?3-&su,ue,?4-&su,ue,????,erf&-sndnyd,sndd,?filflahevres,gnahcxeevres,i&hcet-a-si,p-sekil,?k&auqevres,irtsretnuocevres,?l&bitpa-no,googhtiw,?m&agevres,ina-otni-si,oh-&sndnyd,ta-sndnyd,??n&-morf,ilno&-evreser,ysrab,?og-si,?r&alfduolcyrt,ehwynanohtyp:.ue,,ihcec,?srun-a-si,t&i&nuarepo,s&-ybboh,aloy,tipohs,xiw,??omer-sndnyd,upmocsma,ysgolb,?v&als-elcibuc-a-si,i&lsndd,tavresnoc-a-si,??z&amkcar,eelg,iig,??fehc-a-si,g&ni&gats-&raeghtua,swennwot,?ksndd,robsikrow,tsoh-bt.etis,?o&fgp,lb&-sndnyd,pawodni,sihtsetirw,???h&n-morf,o-morf,?i&fiwehtno,h-morf,kiw-sndnyd,m-morf,pdetsoh,r-morf,w-morf,z&ihcppa,nilppa,??jn-morf,k&a&-morf,erfocsic,?cils-si,eeg&-a&-si,si,?sndd,?h,latsnaebcitsale:.&1-&htuos-pa,lartnec-&ac,ue,?ts&ae&-&as,su,?ht&ron-pa,uos-pa,??ew-&su,ue,vog-su,???2-ts&ae&-su,ht&ron-pa,uos-pa,??ew-&su,ue,??3-ts&aehtron-pa,ew-ue,??,o-morf,r&adhtiwtliub,ow&-&sndnyd,ta-sndnyd,?ten-orehkcats,??u,?l&a&-morf,colottad,rebil-a-si,?f-morf,i&-morf,am&-sndnyd,detsohpw,??l&ecelffaw,uf-ytnuob:.a&hpla,teb,?,?ppmswa,ru-&elpmis,taen,?ssukoreh,xegap,?m&n-morf,pml.ppa,rofe&pyt.orp,rerac-htlaeh,?sacrasevres,uirarret-yltsaf,?n&a&cilbuper-a-si,f&-sllub-a-si,racsan-a-si,?i&cisum-a-si,ratrebil-a-si,??c,dc&hsums,umpw,xirtrepmi,?eerg-a-si,i-morf,m-morf,o&ehtnaptog,isam-al-a-tse,r&italik,tap-el-tse,?s&iam-al-a-tse,replausunu,??pj,t-morf,?o&bordym,c,hce-namtsop,jodsnd,m&-morf,ed-baltlow,?n:iloxip,,ttadym,?p&2pevres,aelutym,i&-sndnyd,fles,ogol,ruoy&esol,hctid,?ym&eerf,teg,??ohsdaerpsym,pa&-rettalp,anis:piv,,esaberif,k1,lortnocduolc,oifilauq,r&aegyks,oetem:.ue,,?tnorfegap,ukoreh,?t&fevres,thevres,??r&a:-morf,tskcor-a-si,,b,e&d&iv&erp-yb-detsoh.saap,orpnwo,?ner&.ppa,no,??e&bevres,nigne-na-si,?ggolb&-a-si,ndi,?h&caet-a-si,pargotohp-a-si,?krow-drah-a-si,n&gised-a-si,ia&rtlanosrep-a-si,tretne-na-si,??p&acsdnal-a-si,eekkoob-a-si,?retac-a-si,subq,tn&ecysrab,iap-a-si,uh-a-si,?vres&-&ki.&cpj-rev-duolcj,duolcj,?s&ndnyd,pvtsaf,??inim,nmad,sak,?y&alp-a-si,wal-a-si,?zilibomdeepsegap,?g,ituob,k,mgrp.nex,o&-morf,sivdalaicnanif-a-si,t&areleccalabolgswa,c&a-na-si,od-a-si,?susaym,??p-morf,u&as-o-nyd,e&tsoh.&duolc-gar,hc-duolc-gar,?ugolb-nom-tse,?omuhevres,??s&a&apod,ila&nyd,snd,?nymsd,vnacremarf,?bbevres,ci&p&-sndnyd,evres,?tcatytiruces,?dylimaf,e&cived-anelab,itilitu3,lahw-eht-sevas,mag-otni-si,t&i&iis,sro,?yskciuq,??i&ht2tniop,pa&elgoog,tneltneg,??jfac,k&-morf,aerf-ten,colb&egrof,pohsym,??m&-morf,cxolb,?n&d&-pmet,dyard,golb,htiwssem,mood,tog,?kselp,nyd,ootrac-otni-si,?o&-xobeerf,xobeerf,?ppa&raeghtua,tneg,?r&ac-otni-si,e&ntrap-paelut,tsohmaerd,??s&e&l-rof-slles,rtca-na-si,?ibodym,?tsaeb-cihtym.&a&llicno,zno,?ilay,lacarac,re&gitnef,motsuc,?sv,toleco,x:n&ihps,yl,?,?u,wanozama.&1-&htuos-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??la&nretxe-3s,rtnec-&ac&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????ts&ae&-&as&-&3s,etisbew-3s,?.kcatslaud.3s,?su:-etisbew-3s,.kcatslaud.3s,,?ht&ron-pa&-&3s,etisbew-3s,?.kcatslaud.3s,?uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-&3s,etisbew-3s,?.kcatslaud.3s,?vog-su-&3s,spif-3s,????2-ts&ae&-su&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ht&ron-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????3&-tsew-ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,??s,??yasdrocsid,?t&arcomed-a-si,c&-morf,etedatad.&ecnatsni,omed,??eel&-si,rebu-si,?hgilfhtiwletoh,m-morf,n&atnuocca-na-si,e&duts-a-si,r-ot-ecaps,tnocresu&buhtig,e&capsppa,donil.pi,lbavresbo.citats,?pl,???ops&edoc,golb,ppa,?s&i&hcrana-&a-si,na-si,?laicos-a-si,pareht-a-si,tra-na-si,xetn&od,seod,??oh&piym,sfn,??u&-morf,nyekcoh-asi,?v-morf,?u&-rof-slles,4,e,h,oynahtretramssi,r:ug-a-si,,?v&n-morf,rdlf,w-morf,?w&o&lpwons-yrt,zok,?ww100,?x&bsbf.sppa,em,i&nuemoh,rtrepmi,?obaniateb,t-morf,unilemoh,?y&a&bnx:.&2u,lacol-2u,?,l&erottad,pezam,?wetag-llawerif,?dnacsekil,fipohsym,k&-morf,niksisnd,?rotceridevitcaym,u:goo,,w-morf,x&alagkeeg,orp&hsilbup,mapson.duolc,???zesdrocsid,?inu??m!.&dna,rof,??or?tsla??p!.nwo,?raf!.jrots,etats??s?t!.&gro?lim?mo&c?n??oc?ten?ude?vog???u&esum!.&a&92chg-seacinumocelet-e-soierroc--nx?atnav?c&i&aduj?rfatsae??rollam??d&anac?enomaledasac?irolf??e&raaihpledalihp?srednu??g&hannavas?oonattahc??hamo?i&auhsu?bmuloc!hsitirb??dem?groeg?hpledalihp?l&artsua?etalif??n&igriv?rofilac??ssur?tsonod??ksa&la?rben??l&lojal?q-snl--nx?uossim!trof???m&a&bala?nap??enic?o&m?r???n&a&cirema?idni??edasap?ilorachtuos?olecrab??r&abrabatnas?ezzivs??su?t&nalta?osennim??zalp??c&dnotgnihsaw?ebeuq?i&depolcycne?ficap?hpargonaeco?lbup?sum?t&carporihc?lec?naltadim??vu??yn??d&a&dhgab?etsmraf?m?orliar??i&rdam?ulegnedleeb??leif?n&a!l&gne?nif?ragyduj?t&ocs?rop??yram???u&brofsdgybmeh?osdnaegami???r&augria?ofxo???e&c&a&l&ap?phtrib??ps??n&a&lubma?tsiser??e&fedlatsaoc?gilletni?ics!foyrotsih????pein?rof??d&nukneklov?revasem??e&rt?tsurt??f&atnas?ildliw??g&a&lliv?tireh!lanoitan???dirbmac?rog??i&cnum?nollaw??koorbrehs?l&ab?bib?cycrotom?i&ssim?txet??oks?tsac??m&affollah?it!iram??utsoc??n&golos?ilno?recul??r&a&uqs?waled!foetats???i&hs&acnal?kroy?pmahwen??otsih??omitlab?ut&an?cetihcra?inruf?luc!irga?su???vuol??s&abatad?iacnarf?sius?uoh!lum???t&a&locohc?rak?ts!e!yrtnuoc!su?????imesoy?tevroc??u&qihpargonaeco?velleb??vit&caretni?omotua???f&iuj?ohgrub??g&n&i&dliub?ginerevmuesum?kiv?lahw?nim?peekemit?vil??ulmmastsnuk??orf?r&ebnrats?u&b&ierf?le?m&ah?uan??ram?s&mailliw!lainoloc??naitsirhc?retepts??zlas??ob&irf?mexul?????h&atu?c&raeser?sirotsih?uot??g&ea1h--nx?rubsttip??si&tirb?wej??t&laeh?ro&n?wtrof??uo&mnom?y????i&d6glbhbd9--nx?iawah?k&nisleh?s??lad!rodavlas??sissa?tannicnic??k&c&nivleeg?olc!-dna-hctaw?dnahctaw???fj?inebis?l&is?ofron??na&rfenna?t??oorbnarc?r&am&ned?reiets??oy!wen????l&a&ci&dem?golo&eahcra?meg?oz??natob?rotsih??ertnom?iromem?noita&cude?n??oc?rutluc?trop?utriv?van??e&nurb?s&ab?surb??utriv??i&artnogero?sarb??l&a&besab?hsnoegrus??e&hs?rdnevle??i&b?m!dniw????o&bup?ohcs?tsirb???m&a&dretsma?ets?h&netlehc?rud???ct?elas!urej??l&if?ohkcots?u??raf?silanruoj?u&esumyrotsihlarutan?ira&tenalp?uqa??terobra???n&a&c!irema!evitan???gihcim?i&dni?tpyge??mfoelsi?wehctaksas??e&d&alokohcs?ews?rag!cinatob?lacinatob?s&nerdlihc?u????gahnepoc?hcneum?laftsew?ppahcsnetewruutan?r&dlihc?ednaalv?hu!dnutamieh???sseig??gised!dn&atra?utsnuk???h&ab!nesie??ojts??i&lreb?tsua??l&eok?ocnil??n&ob?urbneohcs??o&dnol?gero?i&s&iv&dnadnuos?elet??nam??t&a&c&inummoc?ude!tra???dnuof?erc?i&cossa?va??kinummokelet?nissassa?r&belectsevrah?oproc?tsulli??silivic?t&nalp?s??vres&erp?noclatnemnorivne??zilivic??c&elloc?if-ecneics??ibihxe???ri?s&dnah?imaj?reffej?sral??t&erbepac?nilc?sob???r&e&b?dom?tsew?uab?zul??obredap??vahnebeok?wot??o&2a6v-seacinumoc--nx?ablib?c&edtra?ixemwen?sicnarfnas??elap?g&a&cihc?to??eidnas??i&cadnuf?diserp?ratno??llecitnom?mitiram?nirot?r&htna?ienajedoir???pohskrow?qari?r&aw!dloc?livic??dd?e&b&ma?yc??irrac?llimsiwel?naksiznarf?papswen?t&aeht?exe?nec!ecneics?larutluc?muesum?tra??s&ehc&nam?or??neum??upmoc???ia!nepo??obal?u&asonid?obal?takirak???s&a&l&g?l&ad?eh???xet??di&k?pardnarg??e&cneics!larutan??dnal?hcsi&deuj?rotsih!nizidem?rutan??selhcs??itinamuh?l&aw?egnasol?l&e&rutansecneics?xurb??iasrev???r&e&em?ugif??tsac??suohcirotsih?u&en?q&adac?itna!nacirema?su????õçacinumoc!elet-e-soierroc???gnirpsmlap?htab?i&lopanaidni?rap?uoltnias?xa??l&essurb?lod??mraeriflanoitan?n&a&blats?l??erdlihc?oi&snam?tacinummoc!elet-dna-stsop???äl??re&dnalf?lttes?mraf?nim?tnececneics??s&alg?erp??t&farc!dnastra??nalp?olip?ra!e&nif?vitaroced!su???su?xuaeb???u&b!muloc??cric???t&agilltrop?cejorp?dats?e&esum?kramnaidni??iorted?ne&m&elttes?norivne?piuqemraf??vnoc??oped?r&a!drib?enif?gttuts?hsiwej?kcor?n&acirema?ootrac??tamsa?yraropmetnoc??op&aes?snart?wen??ufknarf??s&a&cdaorb?octsae??ewhtuos?ilayol?nuk?r&ohnemled?uhlyram??urt???u&a&bgreb?etalpodaroloc??rmyc??w&ocsom?rn??x&esse?ineohp?nam?tas??y&a&bekaepasehc?w&etag?liar???camrahp?doc?e&hsub?l&ekreb?l&av!eniwydnarb??ort???n&dys?om??rrus?s&nreug?rejwen???golo&e&ahcra?g??motne?nh&cet?te??oz?po&rhtna?t??roh??hpargotohp?l&etalihp?imaf??m&edaca?onortsa??n&atob?yn??ps?r&a&ropmetnoc?tilim??e&diorbme?llag!tra??vocsid??lewej?nosameerf?otsih!dnaecneics?ecneics?gnivil!su??la&col?rutan??retupmoc?su??tsudnidnaecneics??spelipe?t&eicos!lacirotsih??i&nummoc?srevinu??nuoc???z&arg?iewhcs?nil?ojadab?urcatnas??моки?םילשורי???rof??z!.&ca?gro?hcs?lim?moc?o&c?fni??ten?ude?vog?zib????n&315rmi--nx?a&brud?cilbuper?f?grompj?hkaga?idraug?m?ol?ssin?u&hix?qna??varac?yalo??b!.&gro?moc?oc,ten?ude?vog??c??c!.&ah?bh?c&a?s??d&5xq55--nx?g?s?uolctnatsni,?eh?g&la0do--nx?ro??h&a?q?s??i&7a0oi--nx?h??j&b?f?t?x?z??kh?l&h?im?j??m&n?oc!.swanozama.&1-htron-nc.3s,be.1-&htron-nc,tsewhtron-nc,????n&h?l?s?y??om?qc?s&g?j??ten?ude?vog?wt?x&g?j?n?s??z&g?x??司公?絡網?络网??b??d&g!.ypnc,?ka??e&drag?erg?fuak?gawsklov?hctik?i&libommi?w??m!.r&iaper,of,??po?r!ednaalv??sier?ves??g!.&ca?gro?moc?ten?ude?vog??is&ed!.ssb,?irev???h!.&bog?cc,gro?lim?moc?ten?ude???i!.&bew,c&a?in??dni?esabapus,gro?lim?mrif?neg?oc?s&er?nduolc,?t&en?opsgolb,?ude?vog?ysrab,?elknivlac?griv?ks?lreb?p?v?w!.taht,?x??k!.&gro?ten?ude?vog???l&eok?ocnil??m!.&cyn,gro?ude?vog???o&dnol!.&fo,ni,??i&hsaf!.fo,?n&o?utiderc??siv!orue??t&a&cude!.oc,?dnuof?tsyalp??c&etorp?u&a?rtsnoc?????kin?las?mrom?nac?p&q?uoc??s&iam?pe?scire??t&ron?sob??zama??p!.&gro?oc?ten?ude?vog??k??r&e&c?yab??op!.eidni,??s!.&gro?moc?osrep?t&opsgolb,ra??ude?v&inu?uog????t!.&d&ni?uolcegnaro,?gro?ltni?m&oc!nim??siruot??nif?o&fni?srep??sne?t&an?en??vog??m??u&f?r!.&bdnevar,lper,retropno,s&h,revres,?tnempoleved,??stad?xamay?y??v!.&ca?eman?gro?htlaeh?moc?o&fni?rp??t&en?ni?opsgolb,?ude?vog?zib???wo&rc?t!epac????o&76i4orfy--nx?a!.&bp?de?go?oc?ti?vg??boat??b!.&a&ci&sum?tilop??i&c&arcomed?neic??golo&ce?ncet??m&edaca?onoce??rt&ap?sudni??vilob??n&egidni?icidem??serpme?tsiver?vitarepooc??b&ew?og??dulas?e&rbmon?tr&a?op&ed?snart????g&olb?ro??ikiw?l&a&noi&canirulp?seforp??rutan??im??moc?o&fni?lbeup?rga?tneimivom??saiciton?t&askt?en?ni??ude?vt??h?iew?olg??c!.&bew?cer?dr&c,rac,?esabapus,gro?ipym,l&im?per:.di,,?m&o&c!.topsgolb,?n??rif??ofni?s&egap&dael,l,?tra??t&4n,en?ni??ude?vog??a?e?in?mara?s&edarb?ic???d!.&b&ew?og??dls?gro?lim?moc?t&en?ra??ude?vog??agoba?if?zd7acbgm--nx??e&c?d&iv?or??morafla??f!ni!.&e&g&delwonk-fo-l&errab,lerrab,?ellocevoli,?ht-skorg,rom-rof-ereh,tadpusn:d,,?llatiswonk,macrvd,ofni-v,p&i&-on,fles,?ohbew,?ruo-rof,s&iht-skorg,nd&-cimanyd,nyd,uolc,??tsrifyam,ysrab,zmurof,???g&el?n!am?ib???hwsohw?i!.&35nyd,8302,a&minifed,tad-b,?b&altig,uhtig,?czh,d&in,u&olc&iaznab.ppa,ropav,?rd,??e&c&apsinu.1rf-duolc,ivedniser,?donppad.sndnyd,egipa,lej,nilnigol,sufxob,t&i&beulb,snoehtnap,?newtu,ybeeb.saap,??gni&gatsniser.secived,tsohytsoh,?ilpu,k&coregrof.di,orgn,ramytefasresworb,?moc?n&mtsp:.kcom,,yded,?ot&oq,pyrctfihs,?p&opilol,pa&-arusah,e&nalpkcab,tybeeb.1dkes,???r&e&tsneum-hf,vres&cisab,lautriv,??ial.sppa,?s&codehtdaer,gnihtbew,nemeis-om,pparevelc,t&acdnas,ekcit,??t&e&kcubtib,notorp,?i&belet,detfihs,gude,kecaps,?raedon.egats,s&ohg,udgniht.&cersid.&dvreser,tsuc,?dorp.tsuc,gnitset.&dvreser,tsuc,?ved.&dvreser,tsuc,????vgib.0ku,whs,x&bslprbv.g,cq,rotide,?y&olpedew,srab,??b?d&ar?u&a?ts???j?r?syhp??j!.&eman?gro?hcs?lim?moc?ten?ude?vog???ll&ag?o??m!.&gro?moc?ten?ude?vog??g?il?mi?orp??n!.&a&0&b-ekhgnark--nx?c-iehsrgev--nx?g-lksedlig--nx?k-negnanvk--nx??1&p-nedragy--nx?q-&asierrs--nx?grebsnt--nx?lado-rs--nx?n&egnidl--nx?orf-rs--nx??regnayh--nx?ssofenh--nx??r-datsgrt--nx?s-ladrjts--nx?v-y&senner--nx?vrejks--nx???3g-datsobegh--nx?4&5-&dnaleprj--nx?goksnerl--nx?tednalyh--nx??6-neladnjm--nx?s-&antouvachb--nx?impouvtalm--nx??y-&agrjnevvad--nx?ikhvlaraeb--nx???7k-antouvacchb--nx?8&k-rekie-erv--nx?l-ladrua-rs--nx?m-darehsdrk--nx??a!.sg??bct-eimeuvejsemn--nx?d&do?iisevvad?lov?narts?uas??f&1-&l--nx?s--nx??2-h--nx??g&10aq0-ineve--nx?av?ev?lot?r&ajn&evvad?u??ájn&evvad?u????h?iz-lf--nx?j&ddadab?sel??k&el?hoj&sarak?šárák??iiv&ag&na&el?g??ŋ&ael?ág???ran???l&f?lahrevo?o&ms?s??sennev?t-&ilm--nx?tom--nx??u&-edr--nx?s??øms??muar?n&0-tsr--nx?2-dob--nx?5-&asir--nx?tals--nx??a&r!-i-om?f?t??t??douvsatvid?kiv?m&os?øs??n&od?ød??ra?sen?t&aouvatheig?ouv&a&c&ch&ab?áb??h&ab?áb???n??i&ag?ág??sa&mo?ttvid??án???z-rey--nx?ær&f?t???o&p-&ladr--nx?sens--nx??q-nagv--nx?r-asns--nx?s-kjks--nx?v-murb--nx?w-&anr&f--nx?t--nx??ublk--nx???ppol?q&0-t&baol--nx?soum--nx?veib--nx??x-&ipphl--nx?r&embh--nx?imph--nx???y-tinks--nx??r&f-atsr--nx?g-&an&ms--nx?nd--nx??e&drf--nx?ngs--nx??murs--nx?netl--nx?olmb--nx?sorr--nx??h-&a&lms--nx?yrf--nx??emjt--nx??i&-&lboh--nx?rsir--nx?y&d&ar--nx?na--nx??ksa--nx?lem--nx?r&ul--nx?yd--nx????stu??j-&drav--nx?rolf--nx?sdav--nx??kua?l-&drojf--nx?lares--nx??m-tlohr--nx?n-esans--nx?olf?p-sdnil--nx?s-ladrl--nx?tih?v-rvsyt--nx??s&a&ns?ons??i&ar?er&dron?r&os?øs???ár??la&g?h??mor!t??sir?uf?åns??t&koulo&nka?ŋká??la?p-raddjb--nx?r-agrjnu--nx?s&aefr&ammah?ámmáh??orf?r&o?ø???u-vreiks--nx??u&h-dnusel--nx?i-&drojfk--nx?vleslm--nx??j-ekerom--nx?k-rekrem--nx?u-&dnalr--nx?goksr--nx?sensk--nx??v-nekyr--nx?w-&k&abrd--nx?ivjg--nx??oryso--nx??y-y&dnas--nx?mrak--nx?n&art--nx?nif--nx??reva--nx??z-smort--nx??v!.sg?ledatskork?reiks??wh-antouvn--nx?x&9-dlofts--nx.aoq-relv--nx?d-nmaherk--nx?f-dnalnks--nx?h-neltloh--nx?i-drgeppo--nx?j-gve&gnal--nx?lreb--nx??m-negnilr--nx?n-drojfvk--nx??y&7-ujdaehal--nx?8-antouvig--nx?b-&dlofrs--nx?goksmr--nx?kivryr--nx?retslj--nx??e-nejsom--nx?f-y&krajb--nx?re&dni--nx?tso--nx??stivk--nx??g-regark--nx?orf?ørf??z9-drojfstb--nx??b&25-akiivagael--nx?53ay7-olousech--nx?a&iy-gv--nx?le-tl&b--nx?s--nx??n0-ydr--nx??c&0-dnal-erdns--nx?z-netot-erts--nx??g&g-regnarav-rs--nx?o-nejssendnas--nx??ju-erdils-ertsy--nx?nj-dnalh-goksrua--nx?q&q-ladsmor-go-erm--nx.&ari-yreh--nx?ednas??s-neslahsladrjts--nx???ca&4s-atsaefrmmh--nx?8m-dnusynnrb--nx?il-tl--nx?le-slg--nx?n5-rdib--nx?op-drgl--nx?uw-ynnrb--nx??d&a&qx-tggrv--nx?reh!nnivk?sd&ork?ørk??uas??ts&e&bi?kkar?llyh?nnan??g&ort?ørt??k&alf?irderf??levev?mirg?obeg&ah?æh??r&ah?ejg????barm-jdddb--nx?ie!rah?s&etivk?ladman???lof&r&os?øs??ts&ev.ednas?o.relav?ø.relåv???n&a&l&-erd&n&os?øs??ron??adroh.so?dron.&a&g5-b--nx?ri-yreh--nx??ob?y&oreh?øreh??øb??e&m!lejh??pr&oj?øj??vi??gyb?n&aks?åks??o&h-goksrua?rf??r&o?ua?ø??tros?øh-goksrua??rts!e&devt?lab?mloh???s&ellil?naitsirk?rof???u&l!os??s!d&im?lejt??e&guah?l&a?å???kkoh?lavk?naitsirk?r&af?eg&e?ie???tef?y&onnorb?ønnørb?????r&a&blavs!.sg??g&eppo?la???o&j&f&a!dniv?k?vk??die?e&dnas?kkelf??llins?r&iel?ots??s&lab?t&ab?åb??yt??å!k??ævk??les??ts??åg&eppo?lå???ureksub.sen??e&ayb-yrettn--nx?d&ar?lom?r&of?øf??år??g&gyr?nats??i&meuv&ejsem&aan?åån??sekaal??rjea??j&d&ef?oks??les??k&er&aom?åom??hgna&ark?årk??iregnir?kot!s??s&ig?uaf???l&bmab?kyb?l&av?ehtats??oh??m&it?ojt?øjt??n&arg?g&os?øs??meh?reil?te?ummok?yrb??r&dils-erts&ev?y&o?ø???ua?vod??sa&ans?åns??t&robraa?spaav??urg??f&62ats-ugsrop--nx?a&10-ujvrekkhr--nx?7k-tajjrv-attm--nx??o!.sg?h??s!.sg??v!.sg???g&5aly-yr&n--nx?v--nx??a&llor?ve&gnal?lreb???n&av!snellu??org??oks&die?m&or?ør??ner&ol?øl??r&o?ø???r&eb!adnar?edyps?s&die?elf?gnok?n&ot?øt????obspras??uahatsla?åve&gnal?lreb???h&0alu-ysm--nx?7&4ay8-akiivagg--nx?5ay7-atkoulok--nx??a!.sg???i&e&hsr&agev?ågev??rf??k&h&avlaraeb?ávlaraeb??s??lm&a?å??mpouvtal&am?ám??pph&al?ál??rrounaddleid?ssaneve?ššáneve??j&0aoq-ysgv--nx?94bawh-akhojrk--nx??k&a&b&ord?ørd??jks?lleis??iv!aklejps?l&am?evs?u??mag?nel?ojg?r&a&l?n??epok?iel?y&or?ør???s&ah?kel?om??øjg??kabene?ojsarak?ram&deh.&aoq-relv--nx?rel&av?åv??so??e&let.&ag5-b--nx?ob?øb??ra???åjks??l&a!d&anrus?d&numurb?ron??e&gnard?nte?s&meh?sin??ttin??g&is?nyl??kro?l&em?l&ejfttah?of??u&ag-ertdim?s???n&am?era?gos?i&b?nroh?r??kos?nus?oj??o-&dron?r&os?øs???ppo?r&a!l?nram??e&gne?l?v??is?o&jts?ts??u&a-&dron?r&os?øs???h??å?æl?øjts??s&e&jg?nivk?ryf??kav?mor-go-er&om.&ednas?yoreh??øm.&ednas?yøreh???uag??t&las?rajh?suan??v&l&a?e-rots??u-go-eron??yt??ksedlig?res&a?å???bib&eklof?seklyf??es!dah??h!.sg??i&m?syrt??l&ejf?ov&etsua?gnit?ksa?sdie???n!.sg??o!.sg?boh?g?h??r!.sg??å!ksedlig??øboh??m&a&rah?vk??f!.sg??h!.sg??i&e&h&dnort?rtsua?ssej??rkrejb??ksa??ol?t!.sg??u&dom?esum?r&ab?drejg?evle?os?uh?æb?øs??ttals???n&a&g&av?okssman?åv??jlis?or?r&g?rev???e&d&do&sen?ton??lah?r&agy&o?ø??ojfsam???g&iets?n&a&l&as?lab??n&avk?ævk??t&arg?ddosen??v&al?essov???i&d&ol?øl??l&ar?ær???yl??reb??iks?k&srot?y&or?ør???l&a&d&gnos?n&er?ojm?øjm??om??tloh??ug?åtloh??mmard?ojs&om?sendnas??ppolg?s&lahsladr&ojts?øjts??o??t&o&l?t-erts&ev?o?ø???roh?øl??vly&kkys?nav??yam-naj!.sg??øjs&om?sendnas???g&orf?ujb??i&dnaort?vnarg??kob?ladendua?maherk&a?å??n&it?urgsrop??orf-&dron?r&os?øs???r&aieb?evats??sfev?uaks?yrts??o&6axi-ygvtsev--nx?c,d&ob?rav??ievs?kssouf?l&m&ob?øb??ous&adna?ech&ac?áč???so!.sg???msdeks?niekotuak?r&egark?olf?y&oso?øso???s&dav?mort???p&ed?ohsdaerpsym,p&akdron?elk???r&a&d&dj&ab?áb??iab??jtif?luag?mah?vsyt??e&gn&a&k&iel?ro??merb?n&at?mas??rav-r&os?øs??srop?talf?v&ats?el??y&oh?øh???ivsgnok??il?jkniets?k&a&nvej?rem?s&gnir?nellu???ie-er&den?v&o?ø???ram?sa?årem??la&jf?vh??m&b&ah?áh??mahellil??nnul?ts&l&oj?øj??ul??y&o?ø???imp&ah?áh??m!.sg??osir?t!.sg??ádiáb?ævsyt?øsir??s&adnil?en&dnas?e&dga?k&ri&b?k??som??ve??me&h?jg??nroh-go-ejve?s&a?ednil?k&o?ø??of?yt?å??tsev??gv?hf?igaval?o&r&or?ør??sman??so&fen&oh?øh??m?v??uh&lem?sreka.sen??å!dnil???t&a&baol?g&aov?grav??jjr&av-attam?áv-attám??l&a&b?s??ás??soum?ts?v&eib?our???e&dnaly&oh?øh??f?s&nyt?rokomsdeks?sen??vtpiks??in&aks?áks??loh&ar?år??n!.sg??o&m&a?å??psgolb,?s!.sg?efremmah?or?ør??terdi?á&baol?ggráv?lá&b?s??soum?veib???u&b!.sg?alk?e&dna?gnir?nner??les?ælk??dra&b?eb??g&nasrop?vi?ŋásrop??j&daehal&a?á??jedub?v&arekkhar?árekkhár???ksiouf?n&diaegadvoug?taed???v&irp?lesl&am?åm???y&b&essen?nart?sebel?tsev??o&d&ar?na!s??or??gavtsev?k&rajb?sa??lem?mrak?n&art?n&if?orb???r&a&mah?n?v??e&dni?t&so?ton??va??ul?yd??s&am?enner?gav?lrak?tivk??vrejks??ø&d&ar?na!s??ør??gåvtsev?k&rajb?sa??lem?mrak?n&art?n&if?ørb???r&e&dni?t&so?tøn??va??ul?yd?æ&n?v???s&enner?gåv?tivk?åm??vrejks???á&slág?tlá?vreiks??å&gåv?h?jddådåb?lf??ø&d&ob?rav??r&egark?olf??s&dav?mort????aki?i&sac?tal??u??o&b?f?g?hay?o?ttat??r!.&cer?erots?gro?m&o&c?n??rif?t??o&c,fni??pohs,stra?t&n?opsgolb,?www?ysrab,?e&a!.&a&ac?cgd?idem??bulc!orea??ci&ffartria?taborea??e&cn&a&l&lievrus-ria?ubma??netniam?rusni??erefnoc??gnahcxe?mordorea?ni&gne?lria?zagam??rawtfos??gni&d&art?ilg!arap?gnah???l&dnahdnuorg?ledom??noollab?retac?sael?t&lusnoc?uhcarap??vidyks??hcraeser?l&anruoj?euf?icnuoc?ortnoc!-ciffart-ria???n&gised?oi&nu?t&a&cifitrec?ercer?gi&tsevni-tnedicca?van??i&cossa!-regnessap??valivic??redef??cudorp?neverp-tnedicca????ograc?p&ihsnoipmahc?uorg!gnikrow???r&e&dart?enigne?korb?niart?trahc??o&htua?tacude???s&citsigol?e&civres?r??krow?serp!xe??tnega??t&farcr&ia?otor??hgil&f?orcim??liubemoh?n&atlusnoc?e&duts?m&esuma?n&iatretne?revog??piuqe????olip?ropria?si&lanruoj?tneics???w&erc?ohs??y&cnegreme?dobper?tefas????rref?z??p!.&a&aa?ca?pc??dem?ecartsnd.icb,gne?r&ab?uj??snduolc,t&acova?cca?hcer??wal?ysrab,???s!.&em?gro?hcs,moc?ten?ude?vog???t!.&116,ayo,gro?lim?moc?nayn,sulpnpv,t&cennockciuq.tcerid,en??ude?v&dr,og???o&hp?m?v?yk??tol?ua??v&iv?lov??xas?ykot??p&a&ehc?g?m?s??eej?g!.&gro?ibom?moc?ossa?ppa,ten?ude???i&r!.nalc,?v?z??j!.&a&3&5xq6f--nx?xqi0ostn--nx??5wtb6--nx?85uwuu--nx?9xtlk--nx?bihc!.&a&bihciakoy?don?ma&him?ye&ragan?tat???r&a&bom?gan?hihci??u&agedos?kas?ustak???s&os?ufomihs??t&amihcay?iran??w&a&g&im&anah?o??omak??kihci?zustum??ihsak??y&agamak?imonihci???e&akas?nagot??i&azni?esohc?h&asa?s&abanuf?ohc???ka&to?zok??musi?orihs?r&akihabihsokoy?o&dim?tak??ukujuk??usihs??nano&hc?yk??o&d&iakustoy?ustam??hsonhot?k&a&rihs?t??iba??nihsaran?sobimanim?tas&arihsimao?imot??uhc?yihcay??u&kujno?s&ayaru?t&imik?tuf???zarasik????g&as!.&a&gas?m&a&tamah?yik??ihsak??rat?t&a&gatik?hatik??ira!ihsin????e&kaira?nimimak??i&akneg?g&aruyk?o??h&c&amo?uo??siorihs??kaznak?modukuf?ra&gonihsoy?mi???nezih?u&k&at?ohuok??s&ot?tarak?????ihs!.&a&kok?m&a&hagan?yirom??ihsakat??rabiam?wagoton??e&miharot?nokih??houyr?i&azaihsin?esok?kustakat?moihsagih??na&mihcahimo?nok??o&hsia?mag?t&asoyot?ok?tir???us&ay?t&asuk?o??????k&aso!.&a&d&awihsik?eki??k&a&noyot?s&akaayahihc?oihsagih???oadat?uziak??m&ayas!akaso??odak??r&a&bustam?wihsak??ediijuf??t&akarih?i&k?us???wag&ayen?odoyihsagih???e&son?tawanojihs??honim?i&akas?h&cugirom?s&ayabadnot?i&a&kat?t??n??oyimusihsagih???k&a&rabi?sim??ustakat??muzi?r&ijat?otamuk???nan&ak?n&ah?es???o&ay?n&a&ganihcawak?simuzi?tak??eba?ikibah?oyot??t&anim?iad?omamihs??uhc??ust&oimuzi?tes????ou&kuf!.&a&d&amay?eos??g&no?ok?usak??hiku?k&awayim?uzii??ma&kan?y&asih?im???rawak?t&a&gon?ka&h?num?t???umo??wa&g&a&kan?nay?t??ias??ko!rih???y&ihsa?usak???e&m&ay?uruk??taruk?us??i&a&nohs?raihcat??goruk?h&cukuf?s&a&gih?hukuy??in???k&a&gako?muzim??iust?o?ustani??m&anim?otihsoynihs?u??r&ogo?ugasas??usu??ne&siek?zu&b?kihc???o&gukihc?h&ak?ot?ukihc??j&ono?ukihc??kayim?nihsukihc?to?uhc??u&fiazad?gnihs?stoyot????zihs!.&a&bmetog?d&amihs?eijuf?ihsoy?omihs??kouzihs?mihsim?ra&biah?honikam??tawi?wa&g&ekak?ukik??kijuf??yimonijuf??i&a&ra?sok??hcamirom?juf?kaz&eamo?ustam??ma&nnak?ta??nukonuzi?orukuf??nohenawak?o&nosus?ti??u&stamamah?z&a&mun?wak??i!ay?i&hs&agih?in??manim??mihs????????m&a&tias!.&a&d&ihsoy?ot?usah??k&a&dih?sa??o&arihs?s???m&a&tias?y&as?o&rom?tah??ustamihsagih???i&hsagurust?jawak??uri??ni?wa&g&e&ko?man??ikot?o??k&ara?i&hsoy?mak???ru?zorokot??y&a&g&amuk?ihsok?otah??kuf??imo??ziin??e&bakusak?ogawak?sogo?ttas?zokoy??i&baraw?h&cugawak?s&oyim?ubustam???iroy?k&ato?ihs?u&k?stawi???m&akoyr?i&hsoy?juf??uziimak???naznar?o&dakas?ihsay?jnoh?n&a&go?nim??imijuf?nah?oy??r&ihsayim?otagan??t&asim!ak??igus?omatik??zak??u&bihcihc!ihsagih??sonuok?ynah????y&ak&aw!.&a&d&ira?notimak??kadih?ma&h&arihs?im??y&a&kaw?tik??oduk???ru&ustakihcan?y??sauy?wa&g&a&dira?zok??orih??konik??yok?zok??e&banat?dawi??i&garustak?jiat?mani??naniak?o&bog?nimik?t&asim?omihs&ah?uk????ugnihs???o!.&a&jos?koasak?m&ay&ako?ust??ihsayah??r&abi?ukawaihsin??wi&aka?nam???e&gakay?kaw??i&gan?h&cu&kasa?otes??sahakat??k&asim?ihsaruk??miin??n&anemuk?ezib??o&hsotas?jnihs?n&amat?imagak??ohs?uhcibik?????ot!.&a&damay?got?koakat?may&etat?ot??nahoj?riat?waki&inakan?reman???eb&ayo?oruk??i&h&asa?ciimak?sahanuf??kuzanu?m&an&i?ot??ih???nezuyn?otnan?u&hcuf?stimukuf?z&imi?ou???????ihs&o&gak!.&a&m&ayuok?ihsogak??si?yonak??e&banawak?n&at&akan?imanim??uka??tomoonihsin??i&adnesamustas?k&azarukam?oih??m&ama?uzi??usuy??nesi?o&knik?os?tomustam??uzimurat???rih!.&a&ka&n?s??m&ayukuf?i&hsorihihsagih?j&ate?imakikaso????r&a&bohs?h&ekat?im???es??tiak?wiad??e&kato?ruk??i&h&ci&akustah?mono?nihs??s&inares?oyim???manimasa?uk??negokikesnij?o&gnoh?namuk??uhcuf????uk&ot!.&a&bihci?mi&hsu&kot?stamok??m??wagakan??egihsustam?i&gum?h&coganas?soyim??kijaw?m&anim?uzia??ukihsihs??nan&a?iak??o&nati?turan????uf!.&a&batuf?m&a&to?y&enak?irok???ihs&im?ukuf??os?uko??r&aboihsatik?uganat??ta&katik?mawak?rih??w&a&g&akus?emas?uy??k&a&mat?rihs?sa??ihsi??nah??ohs???e&gnabuzia?iman?ta&d?tii???i&adnab?enet?hs&agih?iimagak??k&a&wi?zimuzi??ubay??minuk?r&ook?ustamay???nihsiat?o&g&etomo?ihsin?nan?omihs??no!duruf?rih??rihsawani?ta&may?simuzia???u&rahim?stamakawuzia?zia&ihsin?nay???????nug!.&a&bawak?doyihc?k&anna?oi&hsoy?juf?mot???m&ayakat?ustagaihsagih??n&ihsatak?nak??r&ahonagan?nak?o?u&kati?mamat???t&amun?inomihs?o??w&akubihs?iem?ohs???i&hsa&beam?yabetat??kas&akat?esi??m&akanim?uzio??ogamust?rodim??o&jonakan?n&eu?oyikust??tnihs??u&komnan?stasuk?yrik?????ran!.&a&bihsak?d&akatotamay?u!o???guraki?m&ay&atik&imak?omihs??irokotamay??oki??ra&hihsak?n??wa&geson?knet???e&kayim?ozamay?sog?ustim??i&a&rukas?wak??garustak?h&ciomihs?sinawak??jo?ka&mnak?toruk??makawak?nos?r&net?otakat?ugeh???o&d&na?oyo??gnas?jnihs?nihsoy!ihsagih??tomarawat?yrok????t&ag&amay!.&a&dihsio?k&atarihs?ourust??may&a&kan?rum??enak?onimak??rukho?ta&ga&may?nuf??hakat?kas??wa&g&ekas?orumam??ki&hsin?m??z&anabo?enoy?ot???zuy??e&agas?bonamay?dii?nihsagih?o??i&a&gan?nohs??h&asa?sinawak??nugo??o&dnet?jnihs?ynan??ukohak???iin!.&a&ga?k&ium?oagan??munou!imanim??t&a&bihs?giin??ioy??w&a&gioti?kikes?zuy??irak??yijo??e&kustim?mabust??i&aniat?hcamakot?kaz&awihsak?omuzi??m&a&gat?karum??o???n&anust?esog??o&das?ihcot?jnas?k&ihay?oym??mak?naga?ries??u&ories?steoj?????i&ka!.&a&go?k&asok?oimak??t&ago!rihcah??ika!atik???w&aki?oyk???e&mojog?natim?suranihsagih?t&ado?okoy???i&hsoyirom?magatak?naokimak??nesiad?o&hakin?jnoh!iruy??nuzak?rihson?tasi&juf?m??yjnoh??u&kobmes?oppah????o!.&a&dakatognub?m&asah?ihsemih??su?t&ekat?i&h?o????e&onokok?ustimak??i&jih?k&asinuk?ias?usu??mukust??onoognub?u&fuy?juk?ppeb?suk??????wa&ga&k!.&a&mihsoan?rihotok?waga&kihsagih?ya???emaguram?i&j&nonak?ustnez??kunas?monihcu??o&hsonot?nnam?yotim??u&st&amakat?odat??zatu????nak!.&a&dustam?kus&okoy?tarih??maz?nibe?r&a&gihsaimanim?h&esi?imagas??wa&do?guy???u&im?kamak???tikamay?wa&k&ia?oyik?umas??sijuf??yimonin??e&nokah?saya??i&akan?esiak?gusta?hsuz?kasagihc?o?ukust??o&nadah?sio?tamay?????kihsi!.&a&danihcu?gak?kihs?mijaw?t&abust?ikawak??wazanak??i&gurust?hcionon?mon?ukah??nasukah?o&anan?ton!akan???u&kohak?stamok?z&imana?us?????niko!.&a&han?m&arat?ijemuk?uru??n&e&dak?zi??no??ra&hihsin?rih??wa&kihsi?niko??yehi?zonig??e&osaru?seay??i&hsagih?jomihs?k&a&gihsi?not??ihsakot??m&a&ginuk?kihsug?maz??igo?otekat??nuga!noy???n&a&moti?timoy?wonig??i&jikan?k???o&gan?jnan?tiad&atik?imanim???u&botom?kusug&akan!atik??imot??rab&anoy?eah???????c&204ugv--nx?462a0t7--nx?678z7vq5d--nx?94ptr5--nx?a??d&17sql1--nx?3thr--nx?5&20xbz--nx?40sj5--nx??7&87tlk--nx?ptlk--nx??861ti4--nx?a?e!tfarcdnah,??e&16thr--nx?5&1a4m2--nx?9ny7k--nx??im!.&a&bot?k&asustam?uzus??m&a&him?y&emak?im???ihs??nawuk?wi&em?k???e&bani?ogawak?si!imanim???i&arataw?gusim?h&asa?ciakkoy??k&a&mat?sosik?t??iat??raban??o&dat?hik?n&amuk?ihseru?o&du?mok????ust???lasrepus,mihe!.&a&m&a&h&ataway?iin??yustam??ij&awu?imak???taki!man???ebot?i&anoh?kasam?rabami??n&ania?egokamuk?oot??o&jias?kihcu?nustam?uhcukokihs?yi!es???u&kohik?zo????n!.&nriheg,teniesa.resu,?amihs!.&a&d&amah?ho?usam??kustay?m&a?ihsoni&hsin?ko???wakih??e&namihs?ustam??i&g&aka?usay??konikak?mikih??nannu?o&mu&kay?zi!ihsagih?uko???nawust?tasim??u&stog?yamat?????rotsnoihsaf,tawi!.&a&bahay?d&amay?on??koirom?t&a&honat?katnezukir??imus??w&as&ijuf?uzim??ihs???e&hon&i&hci?n??uk??tawi??i&a&duf?murak?wak??h&custo?si&amak?ukuzihs???j&oboj?uk??k&a&m&anah?uzuk??sagenak??esonihci??m&akatik?uzia&rih?wi????o&kayim?no&rih?t??tanufo??uhso????g&3zsiu--nx?71qstn--nx?l??h&03pv23--nx?13ynr--nx?22tsiu--nx?61qqle--nx??i&54urkm--nx?g&ayim!.&a&dukak?m&a&goihs?kihs??ihsustam!ihsagih??unawi??r&awago?iho??ta&bihs?rum??w&a&gano?kuruf??iat??y&imot?ukaw???e&mot?nimes??i&hsiorihs?ka&monihsi?s&awak?o???mak?r&ataw?o&muram?tan????o&az?jagat?t&asim?omamay???u&fir?k&irnasimanim?uhsakihcihs?????ihcot!.&a&g&a&h?kihsa??ust??kom?m&ay&o?usarak??unak??r&a&boihsusan?watho??iho?ukas??t&akihsin?iay??wa&konimak?zenakat??y&imonustu?oihs???e&iiju?kustomihs?nufawi??i&akihci?g&etom?ihcot?on???o&k&ihsam?kin??nas?sioruk?tab??u&bim?san?????h&c&ia!.&a&dnah?m&a!h&akat?im??yuni??ihs&ibot?ust???r&a&hat?tihs??ik?u&ihsagih?kawi???t&ihc?o&k?yot???wa&koyot?zani??yi&monihci?rak???e&inak?k&aoyot?usa??manokot?noyot??i&a&gusak?kot?sia??eot?h&asairawo?cugo?s&ahoyot?oyim???k&a&mok?zako??ihssi??motay?rogamag??n&an&ikeh?ok??ihssin??o&got?ihsin?jna?rihsnihs?suf?tes??u&bo?raho?s&oyik?takihs??yrihc?zah????ok!.&a&dusay?kadih?mayotom?r&ah&im?usuy??umakan??sot!ihsin??wa&g&atik?odoyin??k&as?o????i&esieg?hco!k??jamu?k&a!sus??usto??ma&gak?k??rahan??o&mukus?n&i?ust!ihsagih???torum?yot!o???u&koknan?zimihsasot????ugamay!.&a&m&ayukot?ihso??toyot??e&bu?subat??i&gah?kesonomihs?nukawi?rakih??nanuhs?otagan?u&ba?foh?otim?stamaduk?uy?????sanamay!.&a&dihsoyijuf?mayabat?r&ahoneu?ustakihsin??w&a&k&ayah?ijuf??suran??ohs???egusok?i&ak?h&cimakan?s&anamay?od???k&asarin?u&feuf?sto????o&k&akanamay?ihcugawakijuf??nihso?t&asimawakihci?ukoh??uhc??spla-imanim?u&b&nan?onim??fok?hsok?rust?????ka&rabi!.&a&bukust?gok?kan!ihcatih??m&a&sak?timo?wi??ihsak?ustomihs??ni?r&a&hihcu?way??u&agimusak?ihcust???t&ag&amay?eman??oihcatih??w&ag&arukas?o??os??yi&moihcatih?rom???e&bomot?dirot?not?tadomihs??i&a&k&as?ot??rao??esukihc?gahakat?h&asa?catih??k&a&rabi?saguyr??ihsani?uy??ma?rukustamat??o&dnab?giad?him?kati?rihsijuf?soj?t&asorihs?im??yihcay??u&fius?kihsu?simak????sagan!.&a&m&abo?ihsust??natawak?r&abamihs?u&mo?ustam???wijihc?yahasi??i&akias?hies?k&asagan?i??masah??neznu?o&besas?darih?t&eso?og!imaknihs????ust&igot?onihcuk?uf????zayim!.&a&biihs?guyh?k&oebon?ustorom??mihsuk?r&emihsin?uatik??ta&katik?mim??wag&atik?odak??ya??e&banakat?sakog??i&hsayabok?kaza&kat?yim??m&animawak?ot&inuk?nihs????nanihcin?o&j&ik?onokayim??n&ibe?ust??tias??urahakat????ro&moa!.&a&dawot?turust?wasim??e&hon&ihc&ah?ihs??nas?og?ukor??sario??i&anarih?ganayati?hsioruk?jehon?kasorih?makihsah?nawo?r&amodakan?omoa???o&gnihs?kkat??u&ragust?stum????ttot!.&a&r&ahawak?uotok??sa&kaw?sim???egok?irottot?nanihcin?o&ganoy?nih?tanimiakas??u&bnan?z&ay?ihc??????ukuf!.&a&deki?gurust?ma&bo?h&akat?im??yustak??sakaw??eabas?i&akas?ho?jiehie?ukuf??nezihce!imanim??ono????k&26rtl8--nx?4&3qtr5--nx?ytjd--nx??522tin--nx?797ti4--nx??l33ussp--nx?m&11tqqq--nx?41s3c--nx??n&30sql1--nx?65zqhe--nx?n7p7qrt0--nx??o&131rot--nx?7qrbk--nx?c?diakkoh!.&a&deki?gakihset?hcebihs?k&adih?u&fib?narihs???m&ayiruk?hot?ihs&orihatik?ukuf??oras?usta??r&ib&a!ka??o?uruf??ozo?u&gakihsagih?oyot???sakim?ta&gikust?mun??w&a&ga&k&an?uf??nus!imak???k&aru?i&h&asa?sagih??kat?mak??omihs?um??zimawi??ine?oyk??yot??e&a&mustam?nan??b&a&kihs?yak??o&noroh?to???ian?k&ihsam?ufoto??nakami?ppoko!ihsin??sotihc?tad!okah??uonikat??i&a&bib?mokamot?n&a&k&kaw?oroh??wi??eomak?ihsatu?okik?usta&moruk?sakan????eib?h&c&ioy?u&bmek?irihs???s&ase?ekka?oknar?uesom???jufirihsir?k&amamihs?i&at?n???m&atik?otoyot??oa&kihs?rihs??r&a&hs?kihsi?mot??ihs&aba?ir??otarib???n&a&hctuk?rorum?se?tokahs??uber??o&kayot?m&ire?ukay??naruf!ima&k?nim???orih?r&ih&ibo?suk??o&bah?h&i&b?hsimak??sa??pnan?yan??umen??t&asoyik?eko?ukoh???u&bassa?kotnihs?m&assaw?uo??pp&akiin?en&ioto?nuk??ip??rato?s&akat?t&eb&e?i&a?hs!a??robon??m&e?o&m?takan???no&h?tamah??o&mik?s?t??u&kir?ppihc?st???onihsnihs?ufuras??uaru??yru!koh??zimihs!ok?????g!oyh!.&a&bmat?dnas?gusak?k&at?o&oyot?y??uzarakat??m&ayasas?irah??wa&g&ani?okak??k&i&hci?mak??oy???yi&hsa?monihsin???i&asak?hs&aka?i&at?nawak???j&awa!imanim??emih??k&a&goa?s&agama?ukuf??wihsin??i&hsog?m???mati?oia?rogimak??n&annas?esnonihs??o&gasa!kat??ka?n&ikat?o?ustat??rihsay?sihs?tomus?yas??u&bay?gnihs?????nagan!.&a&bukah?d&a&w?yim??e&ki?u??ii??k&a&s&ay?uki??zus??ihsoo?ousay??m&ay&akat?ii??i&hsukufosik?jii??ukihc??n&i!hsetat??uzii??r&ah?ugot??saim?t&agamay?oyim??w&a&g&a&kan?n??o??kustam?ziurak??onim!imanim??u&koo?s!omihs????ya&ko?rih???e&akas?nagamok?subo??i&gakat?h&asa?c&a!mo!nanihs???uonamay??sukagot??k&a&kas?mimanim?to??ia&atik?imanim??oa?uzihcom??m&akawak?ijuf?o!t???r&ato?ijoihs?omakat???n&ana?esnoawazon??o&hukas?n&a&gan?kan??i&hc?muza??ustat??romok?si&gan?k??tomustam??u&k&as?ohukihc??stamega????to&mamuk!.&a&gamay?rahihsin?sukama!imak??tamanim??enufim?i&hcukik?k&ihsam?u??nugo!imanim??romakat??o&ara?rihsustay?sa?t&amay?om&amuk?us??u!koyg???yohc??u&sagan?zo????yk!.&a&bmatoyk?k&ies?oemak?uzaw??mayi&h&cukuf?sagih??muk??nihsamay?rawatiju?t&away?ik???e&ba&nat!oyk??ya??di?ni??i&ju?kazamayo?manim??natnan?o&gnatoyk?kum?mak?rihsamayimanim?y&gakan?ka&koagan?s??oj???u&ruziam?z&ayim?ik??????wtc1--nx?ykot!.&a&d&i&hcam?mus??oyihc??k&atim?ihsustak??m&a&t!uko??yarumihsa&gih?sum???i&hs&agoa?ika?o!t??uzuok??ren???r&a&honih?wasago??iadok?umah??ssuf?t&ik?o??wa&g&anihs?ode??k&ara?ihcat???y&agates?ubihs???e&amok?donih?m&o?urukihsagih??soyik??i&enagok?gani?h&ca&da?tinuk??sabati??j&nubukok?oihcah??manigus??o&huzim?jihcah?n&akan?ih!sasum??urika??rugem?t&a&mayihsagih?nim??iat?ok??uhc?yknub??u&fohc?hcuf?kujnihs?????pohs&eht,iiawak,yub,?r&2xro6--nx?g?o??s&9nvfe--nx?xvp4--nx??t&netnocresu,opsgolb,?u&4rvp8--nx?fig!.&a&d&eki?ih??kimot?m&ayakat?ihsah??ne?raha&gi&kes?makak??sak??taga&may?tik??wa&g&ibi?ustakan??karihs!ihsagih????e&katim?uawak??i&gohakas?hc&apna?uonaw??k&ago?es?ot??m&anuzim?ijat??nak?urat??nanig?o&dog?jug?makonim?nim?roy?sihcih??u&fig?s&otom?t&amasak?oay???????x5ytlk--nx?yu6d27srjd--nx?z72thr--nx?井福?京東?分大?取鳥?口山?城&宮?茨??媛愛?山&富?岡?歌和??岡&福?静??島&児鹿?広?徳?福??崎&宮?長??川&奈神?石?香??庫兵?形山?手岩?木栃?本熊?根島?梨山?森青?潟新?玉埼?田秋?知&愛?高??縄沖?良奈?葉千?賀&佐?滋??道海北?都京?重三?野長?阜岐?阪大?馬群???k!.&art?gro?moc?per?ude?vog???l&eh?l??m!.uj,ac?j??nd?o&g?h&pih?s!.&esab,xilpoh,ysrab,???lnud?oc?t!.&lldtn,snd-won,???pa!.&0mroftalp,arusah,bew:erif,,e&gatskrelc,niln&igol,okoob,?tupmocegde,virdhsalfno,?krelc,lecrev,n&aecolatigidno,ur:.a,,?poon,remarf,t&ibelet,xenw,?yfilten,??ra&a?hs??u&ekam?llag?org!.esruocsid,cts?kouk?nayalo???vsr?xece4ibgm--nx??q&a!3a9y--nx??g?i!.&gro?lim?moc?ten?ude?vog???m?se??r&a!.&a&cisum?sanes??bog?gro?l&autum?im??moc!.topsgolb,?pooc?rut?t&e&b?n??ni??ude?vog??4d5a4prebgm--nx?b?c?eydoog?los?t&at?s!uen???ugaj??b!.&21g?a&b&a&coros?iuc??itiruc??cnogoas?dicerapa?gniram?i&naiog?ramatnas??n&erom?irdnol??op?p&acam?irolf?ma&j?s???rief?tsivaob??b!aj?ib?mi?sb??c&ba?e&r?t??js?sp?t!e???d&em?mb?n&f?i??rt??e&dnarganipmac?ficer?ht?llivnioj?rdnaotnas??f&dj?ed?gg?n&e?i???g&e&l!.&a&b,m,p,?bp,c&a,s,?e&c,p,s,?fd,gm,ip,jr,la,ma,nr,o&g,r,t,?p&a,s,?r&p,r,?s&e,m,r,?tm,??s??l&s?z??n&c?e?o??ol!b?f?v??pp?ro??hvp?i&du?kiw?nana?oretin?r&c?eurab??sp?te?xat??l&at&an?rof??el?im?sq??m&a?da?e&gatnoc?leb??f?ic?oc!.&duolclautriv.elacs.sresu,topsgolb,???nce?o&ariebir?c&e?narboir?saso??d&o?ranreboas??e&g?t??i&b?dar?ecam?r??rp?t&a?erpoir???p&er?m!e?t??ooc?pa?se??qra?r&af?ga?o&davlas?j??tn?ut??s&a&ixac?mlap?nipmac??ed?u&anam?j?m???t&am?e&d?n?v??nc?o&f?n??ra?sf??u&caug9?de?ja?rg??v&da?ed?og!.&a&b?m?p??bp?c&a?s??e&c?p?s??fd?gm?ip?jr?la?ma?nr?o&g?r?t??p&a?s??r&p?r??s&e?m?r??tm???rs?t??xiv?z&hb?ls?o&c?f?????c!.&as?ca?de?if?o&c?g??ro???e&bew?ccos?dnik?e&b?n&igne?oip??rac??gni&arg?rheob??h&cor?sok?t&aew?orb???itnorf?k&col?o&p?rb???l&aed?ffeahcs??mal?nes?pinuj?t&a&eht?rebsnegömrev??law?nec?s&acnal?nom?ubkcolb??upmoc??v&o&csid?rdnal??resbo??wulksretlow?ywal?zifp??f!.&aterg?bew-no,drp?e&c&itsuj-reissiuh?narf-ne-setsitned-sneigrurihc,?lipuog,rianiretev??hny,i&cc?rgabmahc??m&o&c?n??t??n&eicamrahp?icedem??ossa?pohsdaerpsym,s&e&lbatpmoc-strepxe?riaton?tsitned-sneigrurihc?uova??o&-x&bf,obeerf,?x&bf,obeerf,???t&acova?o&or-ne,psgolb,?r&epxe-ertemoeg?op!orea????vuog??avc7ylqbgm--nx?s??g!.&gro?moc?t&en?opsgolb,?ude?vog???h!.&e&erf,man??mo&c?rf??topsgolb,zi??ur??i!.&a&61f4a3abgm--nx?rf4a3abgm--nx??ca?di?gro?hcs?oc?ten?vog?نار&يا?یا???a&h?per??ew?lf??k!.&c&a?s??e&n?p?r??gk?iggnoeyg?kub&gn&oeyg?uhc??noej??l&im?uoes??man&gn&oeyg?uhc??noej??n&as&lu?ub??o&e&hcni?jead??wgnag???o&c?g??ro?s&e?h?m??topsgolb,u&gead?j&ej?gnawg????cilf??l!.&gro?moc?ten?ude?vog???m!.&topsgolb,vog???n!.&gro?moc?ofni?ten?ude?vog?zib???o&htua?odtnorf?t&c&a?od??laer???p!.&alsi?ca?eman?forp?gro?moc?o&fni?rp??t&en?se??ude?vog?zib???s?t!.&21k?bew?cn!.vog??eman?gro?kst?l&e&b?t??im?op??moc!.topsgolb,?neg?ofni?pek?rd?sbb?ten?ude?v&a?og?t??zib??f?m??ubad?vd??s&8sqif--nx?9zqif--nx?a!.vog?birappnb?gev?lliv?mtsirhc?s??b!.&ew,gro?moc?ten?ude?vog??c?oj?s?u??c&i&hparg?p?t&sigolyrrek?ylana???od??d&a?d?ik?l?n&iwriaf?omaid??oogemoh?rac??e!.&bog?gro?mo&c!.topsgolb,?n??pohsdaerpsym,ude??civres!.enilnigol,?d&d2bgm--nx?oc??h&ctaw?guh??i&lppus?rtsudni?treporp!yrrek???jaiv?l&aw?cycrotom?etoh?gnis?pats??m&ag?oh?reh??nut?ohs?picer?r&it?ut&cip!.7331,?nev???s!i&rpretne?urc??ruoc??taicossa?vig??g!nidloh??h5c822qif--nx?i!.&ekacpuc,gro?moc?t&en?ni?opsgolb,?ude?vog??a09--nx?nnet?rap?targ??k&c&or!.&ecapsbew,snddym,ytic-amil,??us??hxda08--nx?row??l!.&c&a?s??ed,gro?o&c?fni??ten?ude?vog?zib??a&ed?tner??e&ssurb?toh!yrrek???lahsram?m?oot??m!.&bal,etisinim,gro?moc?ten?ude?vog??b?etsys!.tniopthgink,?ialc??n&a&f?gorf?ol??egassap?i&a&grab?mod??giro??o&it&acav?cudorp?ulos??puoc???o&dnoc?geuj?leuv?ppaz?t&ohp?ua???p!.&ces?gro?moc?olp?ten?ude?vog??i&hsralohcs?lihp?t??u??r!.&au,ca?gro?ni?oc?topsgolb,ude?vog?xo,yldnerb.pohs,?a&c?p?tiug??c?e&dliub!.etisduolc,?erac?gor?levart?mraf?n&niw?trap??wolf??ot&cartnoc?omatat??pj?uot??s!.&em?gro?hcs?moc?ten?ude?vog?zib??alg?e&n&isub!.oc,?tif??rp!xe!nacirema???xnal??iws??t&a&e&b?ytic??ob??ek&cit?ram??fig?h&cay?gilf??n&atnuocca?e&mt&rapa?sevni??ve!.&nibook,oc,????rap??u!.&a&c!.&21k?bil?cc???g!.&21k?bil?cc???i!.&21k?bil?cc???l!.&21k?bil?cc???m!.&21k!.&hcorap?rthc?tvp???bil?cc???p!.&21k?bil?cc???si?v!.&21k?bil?cc???w!.&21k?bil?cc????c&d!.&21k?bil?cc???n!.&21k?bil?cc???s!.&21k?bil?cc????d&e&f?lacsne.xhp,?i!.&21k?bil?cc???m!.&21k?bil?cc???n!.&bil?cc???s!.&bil?cc???u&olcrim,rd,??e&d!.&21k?bil,cc???las-4-&dnal,ffuts,?m!.&21k?bil?cc???n!.&21k?bil?cc????h&n!.&21k?bil?cc???o!.&21k?bil?cc????i&h!.&bil?cc???m!.&21k?bil?c&c?et??goc?n&eg?otae??robra-nna?sum?tsd?wanethsaw???nd?r!.&bil?cc???v!.&21k?bil?cc???w!.&21k?bil?cc????jn!.&21k?bil?cc???k&a!.&21k?bil?cc???o!.&21k?bil?cc????l&a!.&21k?bil?cc???f!.&21k?bil?cc???i!.&21k?bil?cc????mn!.&21k?bil?cc???n&afflog,i!.&21k?bil?cc???m!.&21k?bil?cc???sn?t!.&21k?bil?cc????o&c!.&21k?bil?cc???m!.&21k?bil?cc???ttniop,?p&ion,rettalp,?r&a!.&21k?bil?cc???o!.&21k?bil?cc???p!.&21k?bil?cc????s&a!.&21k?bil?cc???dik?k!.&21k?bil?cc???m!.&21k?bil?cc???nd&deerf,uolc,??t&c!.&21k?bil?cc???m!.&21k?bil?cc???u!.&21k?bil?cc???v!.&21k?bil?cc????ug!.&21k?bil?cc???v&n!.&21k?bil?cc???w!.cc???x&ohparg,t!.&21k?bil?cc????y&b-si,k!.&21k?bil?cc???n!.&21k?bil?cc???w!.&21k?bil?cc????za!.&21k?bil?cc????ah!uab??bria?col?e!.ytrap.resu,?ineserf?lp?xe&l?n???vt?w!.&66duolc,gro?moc?s&ndnyd,tepym,?ten?ude?vog??a?e&iver?n!.elbaeciton,??odniw??y&alcrab?cam?ot???t&0srzc--nx?a!.&amil4,ca!.hts??gni&liamerutuf,tsoherutuf,?o&c!.topsgolb,?fni,?p&h21,ohsdaerpsym,?r&euefknuf.neiw,o??v&g?irp,?xi2,ytic-amil,zib,?c?e!s??hc?if?l!asite??mami?rcomed??b!.&gro?moc?ten?ude?vog??b?gl??c&atnoc?e&les?rid!txen????dimhcs?e!.&eman?gro?moc?ofni?ten?ude?vog?zib??b?em?grat?id?k&circ?ram??n!.&0rab,1rab,2rab,5inu,6vnyd,7&7ndc.r,erauqs,?a&l&-morf,moob,?minifed,remacytirucesym,tadsyawla,z,?b&boi,g,lyltsaf:.pam,,?c&inagro-gnitae,paidemym,?d&ecalpb,irgevissam.saap.&1-&gs,nol,rf,yn,?2-&nol,yn,??nab-eht-ni,uolc&meaeboda,nievas.c&di-etsedron,itsalej,?xednay:.e&garots,tisbew,?,??e&c&narusnihtlaehezitavirp,rofelacs.j,?gdirbtib,ht-no-eciffo,l&acs&liat.ateb,noom,?ibom-eruza,?m&ecnuob,ohtanyd,tcerider,?n&ilno-evreser,ozdop,?rehurht,s:abapus,,tis-repparcs,zamkcar,?f&aeletis,crs.&cos,resu,?ehc-a-si,?g&ni&reesnes,sirkcilc,tsohnnylf,?olb&evres,tsaf,??k&catsvano,eeg-a&-si,si,?u,?l&acolottad,iamwt,s&d-ni,s-77ndc,??m&ac&asac,ih,?urofniem,?n&a&f&agp,lhn,?i&bed,llerk,??dcduabkcalb,i,pv-ni,?o&c-morf,duppa,jodsnd,rp-ytinummoc,ttadym,?p&i&-&etsef,on,?emoh,fles,nwo,?j,mac-dnab-ta,o&-oidar-mah,h&bew,sdaerpsym,??pa&duolc,egde,?tfe&moh,vres,?usnd,?r&e&tsulcyduolc,vres-xnk,?vdslennahc:.u,,?s&a&ila&nyd,snd,?nymsd,?bbevres,dylimaf,e&gde-ndc,suohsyub,t&isbeweruza,ys,??k&catstsaf,ekokohcs,?n&d&-won,d,golb,npv,?oitcnufduolc,?ppacitatseruza:.&2suts&ae,ew,?aisatsae,eporuetsew,sulartnec,?,s&a-skcik,ecca&-citats,duolc,??t,?t&adies,ce&ffeym,jorprot:.segap,,lespohs,?e&nretnifodne,smem,?farcenimevres,i-&ekorb,s&eod,lles,teg,??n&essidym,orfduolc,?r0p3l3t,s&ixetnod,oh&-spv:.citsalej.&cir,lta,sjn,?,gnik,???u&h,nyd,r:eakust.citsalej,,?ved-naissalta.dorp.ndc,x&inuemoh,spym,tsale.&1ots-slj,2ots-slj,3ots-slj,?unilemoh,?y&awetag-llawerif,ffijduolc:.&ed-1arf,su-1tsew,?,ltsaf.&dorp.&a,labolg,?lss.&a,b,labolg,?pam,slteerf,?n&-morf,ofipi,?srab,?z&a-morf,tirfym,???p?tcip?v??f&ig?o&l?sorcim???g!.&bog?dni?ed,g&olb,ro??lim?moc?ot,ten?ude???h!.&dem?gro?l&er?op??m&oc?rif??o&fni?rp?s&rep?sa???po&hs?oc??t&en?luda?ra??ude?vuog???i!.&a&2n-loritds--nx?7e-etsoaellav--nx?8&c-aneseclrof--nx?i-lrofanesec--nx??at?b?c!cul??dv?i&blo&-oipmet?oipmet??cserb?drabmol?g&gof?urep??l&gup?i&cis?me&-oigger?oigger???uig&-&aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf???aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf????n&a&brev?cul?pmac?tac??idras?obrac&-saiselgi?saiselgi??resi??otsip?r&b&alac!-oigger?oigger??mu??dna&-&attelrab-inart?inart-attelrab??attelrabinart?inartattelrab?ssela??epmi?ugil??tnelav&-obiv?obiv??vap?z&e&nev?ps&-al?al???irog???l&iuqa!l??leib??m&or?rap??n!acsot?e&dom?is?sec&-&ilrof?ìlrof??ilrof?ìlrof???g&amor&-ailime?ailime??edras?olob??i&ssem?tal??ne!var??o&cna?merc?rev?vas???oneg?p?r!a&csep?rr&ac&-assam?assam??ef??von??etam?tsailgo!-lled?lled???s!ip?sam&-ararrac?ararrac??u&caris?gar???t!a&cilisab?recam??resac?soa!-&d&-&ellav?lav??ellav?lav??ellav??d&-&ellav?lav??ellav?lav??ellav??te&lrab&-&airdna-inart?inart-airdna??airdnainart?inartairdna??ssinatlac???udap?v!o&dap?neg?tnam???zn&airb&-a&lled-e-aznom?znom??a&lledeaznom?znom??eaznom??e&c&aip?iv??soc?top??om???b&-&23,46,61,?3c-lorit-ds-onitnert--nx?be-etsoa&-ellav--nx?dellav--nx??c!f-anesec-lrof--nx?m-lrof-anesec--nx??he-etsoa-d-ellav--nx?m!u??o2-loritds-nezob--nx?sn-loritds&-nasl&ab--nx?ub--nx??nitnert--nx??v!6-lorit-dsnitnert--nx?7-loritds&-nitnert--nx?onitnert--nx???z&r-lorit-ds&-nitnert--nx?onitnert--nx??s-loritds-onitnert--nx???c&f?is?l?m?p?r?v??d&p?u!olcnys,??e&c!cel?inev?nerolf??f?g!ida&-&a&-onitnert?onitnert??otla!-onitnert?onitnert???a&-onitnert?onitnert??otla!-on&azlob?itnert??onitnert????hcram?l?m!or??n&idu?o&n&edrop?isorf??torc???p?r?s&erav?ilom??t!nomeip?s&eirt?oa!-&d-e&ellav?éllav??e&ellav?éllav???de&ellav?éllav??e&ellav?éllav?????v?znerif??g&a?b?f?il?o?p?r?up?vf??hc?i&b?c?dol?f?l!lecrev?opan?rof&-anesec?anesec???m?n&a&part?rt&-attelrab-airdna?attelrabairdna???imir?ret??p?r!a&b?ilgac?ssas???s!idnirb??t&ei&hc?r??sa??v??l&a!c??b?c?o&m?rit&-&d&eus&-&nitnert?onitnert??nitnert?onitnert??us&-&nitnert?onitnert??nitnert?onitnert??üs&-&nitnert?onitnert??nitnert?onitnert???s&-onitnert?onitnert???d&eus!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??us&-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??üs!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert???s&-onitnert?onitnert?????m&ac?f?i!t.nepo.citsalej.duolc,?ol?r??n&a!lim?sl&ab?ub???b?c?e!en.cj,v?zob??irut?m!p??p?r?t??o&a!v??b!retiv??c!cel??enuc?g!ivor??i&dem&-onadipmac?onadipmac??pmet&-aiblo?aiblo??rdnos?zal??l?m!a&greb?ret??oc?re&f?lap???n!a&dipmac&-oidem?oidem??lim?tsiro?zlob??ecip&-ilocsa?ilocsa??i&bru&-orasep?orasep??lleva?rot?tnert??r&elas?ovil??ulleb??p?r!a&sep&-onibru?onibru??znatac??oun??s!ivert?sabopmac??t!arp?e&nev?ssorg??n&arat?e&girga?rt?veneb????zz&era?urba???p&a?ohsdaerpsym,s?t??qa?r&a!m?s??b!a??c?f?g?k?me?o?p?s?t?v??s&a&b?iselgi&-ainobrac?ainobrac???b?c?elpan?i?m?ot?s?t?v??t&a?b?c?l?m?nomdeip?o!psgolb,?p?v??u&de?l?n?p??v&a?og?p?s?t?v??y&drabmol?ellav&-atsoa?atsoa??licis?nacsut??z&al?b?c?p??ìlrof&-anesec?anesec???derc?er?f?m?utni??je3a3abgm--nx?kh?l!.&topsgolb,vog??uda??m!.&gro?moc!.topsgolb,?ten?ude???n&a&morockivdnas?ruatser?tnuocca??e&g?m&eganam!.retuor,?piuqe??r??i!.ue?m?opdlog??opud?uocsid??o&b?cs!.&ude,vog:.ecivres,,??d?g?h?j?oferab?p&edemoh?s???p!.&emon?gro?lbup?moc?t&en?ni?opsgolb,?ude?vog???r&a!m&law?s???epxe?op&er?pus!.ysrab,?s???s!.&adaxiabme?e&motoas?picnirp?rots??gro?lim?moc?o&c?dalusnoc?hon,?ten?ude??a&cmoc?f??e&b?r?uq??i!rolf?tned??o&h!.&duolc&p,rim,?e&lej,tiseerf,?flah,lrupmet,s&pvtsaf,seccaduolc,?tsafym,vedumpw,??p!sua???urt??t!.&eman?gro?ibom?levart?m&oc?uesum??o&c?fni?r&ea?p???pooc?sboj?t&en?ni??ude?vog?zib??ayh?n?o!bba?irram???uognah?xen?y!.gro,?ztej??u&2&5te9--nx?yssp--nx??a!.&a&s?w??civ?d&i?lq??fnoc?gro?moc!.&pohsdaerpsym,stelduolc.lem,topsgolb,??nsa?ofni?sat?t&ca?en?n??ude!.&a&s?w??ci&lohtac?v??dlq?sat?t&ca?n??wsn!.sloohcs????vog!.&a&s?w??civ?dlq?sat???wsn?zo??ti??c!.&fni?gro?moc?ten?ude?vog??i??d&e!.tir.segap-tig,?iab??e!.&dcym,enozgniebllew,noitatsksid,odagod.citsalej,snd&ps,uolc,?ysrab,??g!.&bew?gro?m&aug?oc??ofni?ten?ude?vog???h!.&0002?a&citore?idem?kitore??edszot?gro?ilus?letoh?m&alker?lif?t?urof??naltagni?o&c?ediv?fni?levynok?nisac??pohs?rarga?s&a&kal?zatu??emag?wen??t&lob?opsgolb,rops??virp?xe&s?zs??ytic?zsagoj??os?sut??l!.topsgolb,?m!.&ca?gro?moc?oc?ro?ten?vog???n!.&duolcesirpretne,eni&esrem,m,?tenkcahs,?em!.ysrab,??o&ggnaw?y!c???r!.&3kl,a&i&kymlak,rikhsab,vodrom,?yegyda,?bps,ca,duolcrim,e&niram,rpcm,?g&bc,nitsohurger.citsalej,ro,?ianatsuk,k&ihclan,s&m,rogitayp,??li&amdlc.bh,m,?moc,natsegad,onijym,pp,ri&b,d&cm:.spv,,orue,?midalv,?s&ar,itym,?t&en,ni,opsgolb,set,?u&4an,de,?vo&g,n,?ynzorg,zakvakidalv,?myc?p?ug??s!.&a&d&golov,nagarak,?gulak,i&groeg,kymlak,lerak,nemra,rikhsab,ssakahk,vodrom,zahkba,?lut,rahkub,vut,yegyda,znep,?bps,da&baghsa,rgonilest,?gunel,i&anatsuk,hcos,ovan,ttailgot,?k&alhsygnam,ihclan,s&legnahkra,m,n&a&mrum,yrb,?i&buytka,nbo,??tiort,vorkop,??l&ocarak,ybmaj,?na&gruk,jiabreza,ts&egad,hkazak-&htron,tsae,???ovonavi,r&adonsark,imidalv,?t&enxe,nek&hsat,mihc,??vo&hsalab,n,?ynzorg,z&akvakidalv,emret,??t&amok?i&juf?masih????v!.&em,g&olb,ro??moc?nc,ten?ude?ved,??ykuyr??v&b?c!.&emon?gro?moc?t&ni?opsgolb,?ude???ed!.&enilnigol,gnigats-oned,hcetaidem,lecrev,o&ned,tpyrctfihs,?ppa-rettalp,s&egap,rekrow,?vr&esi,uc,?weiverpbuhtig,ylf,??ih?l!.&di?fnoc?gro?lim?moc?nsa?ten?ude?vog???m!.&eman?gro?lim?m&oc?uesum??o&fni?r&ea?p???pooc?t&en?ni??ude?vog?zib???o&g?m??rt?s!.&bog?der?gro?moc?ude???t!.&bew-eht-no,naht-&esrow,retteb,?sndnyd,?d?gh?i?won??uqhv--nx??w&a!.moc?hs?l??b!.&gro?oc???c!.&gro?moc?ten?ude??cp??e&iver!.oby,?n?s??g?k!.&bme?dni?gro?moc?ten?ude?vog???m!.&ca?gro?m&oc?uesum??oc?pooc?t&en?ni??ude?vog?zib??b??o&csom?h!s??n?w??p!.&344x,de?en?o&c?g??ro?snduolc,ualeb???r!.&ca?gro?lim?oc?pooc?ten?vog??n??t!.&a46oa0fz--nx?b&82wrzc--nx?ulc??emag?gro?l&im?ru,?moc!.reliamym,?t&en?opsgolb,?ude?v&di?og?ta0cu--nx??zibe?業商?織組?路網???z!.&ca?gro?lim?oc?vog????x&a!.&cm,eb,gg,s&e,u,?tac,ue,yx,?t??c!.&hta,ofni,vog???e&d&ef?nay??ma!nab??rof?s??ilften?jt?m!.&bog?gro?moc?t&en?opsgolb,?ude??g?ma2ibgy--nx??o&b!x??f?rex??rbgn--nx?s!.vog??x&am&jt?kt??x???y&4punu--nx?7rr03--nx?a&d!i&loh?rfkcalb??ot!.emyfilauqerp,??g?lp?p!ila??rot?ssin?wdaorb??b!.&duolcym,fo?hcetaidem,lim?moc!.topsgolb,?vog??ab?gur??c!.&ca?dtl?gro?lim?m&oc!.&ecrofelacs.j,topsgolb,??t??orp?s&egolke?serp??ten?vog?zib??amrahp?nega??d&dadog?uts??e&kcoh?ltneb?n&dys?om?rotta??snikcm??g!.&eb,gro?moc?oc?ten?ude?vog??olonhcet!.oc,?rene??hpargotohp?id?k!.&gro?moc?ten?ude??s??l!.&clp?d&em?i??gro?hcs?moc?ten?ude?vog??f?imaf!nacirema??l&a?il??ppus??m!.&eman?gro?lim?moc?t&en?opsgolb,?ude?vog?zib??edaca!.laiciffo,?ra??n&a&ffit?pmoc??os??o&j?s??p!.&gro?lim?moc?pooc?ten?ude?vog???r&e&corg?grus?llag?viled??lewej?otcerid?tnuoc?uxul??s!.&gro?lim?moc?ten?ude?vog??pil??t&efas?i&c?ledif?n&ifx?ummoc!.&bdnevar,gon,murofym,???r&ahc?uces??srevinu??laer?r&ap!.oby,?eporp??uaeb??u!.&bug?gro?lim?moc!.topsgolb,?ten?ude??b!tseb???van!dlo??xes??z&a!.&eman?gro?lim?moc?o&fni?rp??pp?t&en?ni??ude?vog?zib???b!.&az,gro?jsg,moc?ten?ude?vog???c!.&4e,inum.duolc.&rsu,tlf,?m&laer,urtnecatem.motsuc,?oc,topsgolb,??d!.&cos?gro?lop?m&oc?t??ossa?t&en?ra??ude?vog???ib!.&duolcsd,e&ht-rof,mos-rof,rom-rof,?izoj,nafamm,p&i&-on,fles,?ohbew,tfym,?retteb-rof,snd&nyd,uolc,?xro,?g??k!.&duolcj,gro?lim?moc?t&en?ropeletzak.saapu,?ude?vog???m!.&ca?gro?lim?oc?ten?ude?v&da?og????n!.&asq-irom--nx?ca?gro?htlaeh?i&r&c?o&am?ām???wi!k???keeg?l&im?oohcs??neg?oc!.topsgolb,?t&en?nemailrap?vog???a!niflla???rawhcs?s!.&ca?gro?oc???t!.&c&a?s??e&m?n??ibom?l&etoh?im??o&c?fni?g??ro?vt???u!.&gro?moc?oc?ten??rwon??yx!.&e&nozlacol,tisgolb,?gnitfarc,otpaz,??zub??λε?υε?авксом?брс!.&гро?до?ка?р&бо?п!у?????г&б?ро??дкм?зақ?итед?килотак?леб?мок?н&йално?ом??рку?сур!.&арамас,бпс,гро,зиб,ичос,ксм,м&ок,ырк,?рим,я,??тйас?фр?юе?յահ?לארשי?םוק?اي&روس?سيلم?ناتيروم??بر&ع?غملا??ة&كبش?ي&دوعسلا?روس??یدوعسلا??ت&ا&راما?لاصتا??را&ب?ڀ?ھب???ر&ئازجلا?ازاب?صم?طق??سنوت?عقوم?قارع?ك&تيب?يلوثاك??موك?ن&ا&تس&كاپ?کاپ??دوس?ر&يا?یا??مع?يلعلا??درالا?ميلا?ي&رحبلا?طسلف???ه&ارمه?يدوعسلا??وكمارا?يبظوبا?ۃیدوعسلا?टेन?त&राभ?ोराभ??नठगंस?मॉक?्मतराभ?ত&রাভ?ৰাভ??ালংাব?ਤਰਾਭ?તરાભ?ତରାଭ?ாயித்நஇ?ைக்ஙலஇ?்ரூப்பக்ஙிச?్తరాభ?ತರಾಭ?ംതരാഭ?ාකංල?มอค?ยทไ!.&จิกรุธ?ต็นเ?ร&ก์คงอ?าหท??ลาบฐัร?าษกึศ???ວາລ?ეგ?なんみ?アトス?トンイポ?ドウラク?ムコ?ル&グーグ?ーセ??ン&ゾマア?ョシッァフ??业企?东广?乐娱?亚基诺?你爱我?信中?务政?动移?博微?卦八?厅餐?司公?品食?善慈?团集?国中?國中?址网?坡加新?城商?尚时?山佛?店&商?网?酒大里嘉??府政?康健?息信?戏游?拉里格香?拿大?教主天?机手?构机!织组??标商?歌谷?浦利飞?港香!.&人個?司公?府政?絡網?織組?育教???湾台?灣&台?臺??物购?界世?益公?看点?科盈訊電?站网?籍書?线在?络网?网文中?聘招?販通?逊马亚?通联?里嘉?锡马淡?門澳?门澳?闻新?電家?국한?넷닷?성삼?컴닷??"); /** * If a hostname is not a key in the EXCLUDE map, and if removing its leftmost component results @@ -50,7 +50,7 @@ public final class PublicSuffixPatterns { */ public static final ImmutableMap<String, PublicSuffixType> UNDER = TrieParser.parseTrie( - "ac.vedwa,d&b?uolc.&etiso&isnes,tnegam,?iaznab,rehcnar-no,scitats,??e&b.lrusnart,d.&ecapsrebu,yksurf,?noz.notirt,t&atse.etupmoc,is.&hsmroftalp,tst,???gp?h&c.tenerif:.cvs,,k?trae.sppad:.zzb,,?k&c?f?nil.bewd,rowten.secla,u.hcs??ln.lrusnart,m&j?m?oc.&duolcmeaeboda.ved,edonil.recnalabedon,ico-remotsuc:.&ico,pco,sco,?,lrihwyap,mme0,osseccandcved,s&t&cejboedonil,nemelepiuq,?wanozama.&1-etupmoc,ble,etupmoc,??t&neyoj.snc,opsppa.r,???n&c.moc.swanozama.&ble,etupmoc,?ur.edoc,?o&c.pato,i.&duolciaznab.sdraykcab,elacsnoom,oir-no,reniatnoceruza,s&3k-no,olots,?xcq.sys,y5s,??p&j.&a&mahokoy?yogan??ebok?i&adnes?kasawak??oroppas?uhsuykatik??n?pa.&knalfhtron,repoleved,??r&b.mon?e??s&edoc.owo,w.rosivda,?t&a.&ofnistro.&nednuk,xe,?smcerutuf:.&ni,xe,?,?en.&cimonotpyrc,hvo.&gnitsoh,saapbew,???u&e.lrusnart,r.onijym.&gni&dnal,tsoh,?murtceps,spv,??ved.&e&gats>s,lcl,?rahbew,?gts,lcl,yawetag,?z&c.murtnecatem.duolc,yx.tibelet,??"); + "ac.vedwa,d&b?i.ym.ssr,uolc.&etiso&isnes,tnegam,?iaznab,rehcnar-no,scitats,??e&b.lrusnart,d.&ecapsrebu,yksurf,?noz.notirt,t&atse.etupmoc,is.&areduolc,hsmroftalp,tst,???g&oog.tnetnocresu,p??h&c.tenerif:.cvs,,k?trae.sppad:.zzb,,?k&c?f?nil.bewd,rowten.secla,u.hcs??ln.lrusnart,m&j?m?oc.&duolcmeaeboda.ved,edonil.recnalabedon,ico-remotsuc:.&ico,pco,sco,?,lrihwyap,mme0,osseccandcved,s&ecapsnaecolatigid,t&cejbo&edonil,rtluv,?nemelepiuq,?wanozama.&1-etupmoc,ble,etupmoc,??t&neyoj.snc,opsppa.r,???n&c.moc.swanozama.&ble,etupmoc,?ur.edoc,?o&c.pato,i.&duolciaznab.sdraykcab,elacsnoom,oir-no,reniatnoceruza,s&3k-no,olots,?xcq.sys,y5s,??p&j.&a&mahokoy?yogan??ebok?i&adnes?kasawak??oroppas?uhsuykatik??n?pa.&knalfhtron,repoleved,tegeb,??r&b.mon?e??s&edoc.owo,noitulos.rehid,w.rosivda,?t&a.&ofnistro.&nednuk,xe,?smcerutuf:.&ni,xe,?,?en.&cimonotpyrc,hvo.&gnitsoh,saapbew,???u&e.lrusnart,r.onijym.&gni&dnal,tsoh,?murtceps,spv,??ved.&e&gats>s,lcl,?rahbew,?gts,lcl,yawetag,?z&c.murtnecatem.duolc,yx.tibelet,??"); /** * The elements in this map would pass the UNDER test, but are known not to be public suffixes and diff --git a/android/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java b/android/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java index dd7778040..89cdadd3d 100644 --- a/android/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java +++ b/android/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java @@ -36,7 +36,7 @@ final class TrieParser { while (idx < encodedLen) { idx += doParseTrieToBuilder(Queues.<CharSequence>newArrayDeque(), encoded, idx, builder); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/android/pom.xml b/android/pom.xml index 3620bb345..3784c9f12 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -6,7 +6,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-android</version> + <version>31.1-android</version> <packaging>pom</packaging> <name>Guava Maven Parent</name> <description>Parent for guava artifacts</description> @@ -18,6 +18,8 @@ <checker-framework.version>3.12.0</checker-framework.version> <animal.sniffer.version>1.20</animal.sniffer.version> <maven-javadoc-plugin.version>3.1.0</maven-javadoc-plugin.version> + <!-- Empty for all JDKs but 9-12 --> + <maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions> <maven-source-plugin.version>3.2.1</maven-source-plugin.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -158,6 +160,8 @@ <version>1.10</version> </signature> <ignores> + <!-- Allow requireNonNull: Android desugaring rewrites it (so it's safe for us to use), and it's useful for null checks. Note that this line allows *all* methods from java.util.Objects. That's the best that we can do with the configuration options that Animal Sniffer offers. --> + <ignore>java.util.Objects</ignore> <!-- Unsafe isn't part of the documented Java 6 API, but it is available. And in cases where it's not, we have fallbacks. --> <ignore>sun.misc.Unsafe</ignore> @@ -188,6 +192,7 @@ </additionalOptions> <linksource>true</linksource> <source>8</source> + <additionalJOption>${maven-javadoc-plugin.additionalJOptions}</additionalJOption> </configuration> <executions> <execution> @@ -271,16 +276,10 @@ <version>${checker-framework.version}</version> <classifier>sources</classifier> </dependency> - <!-- TODO(cpovirk): Remove checker-compat-qual after we finish migrating to type annotations. --> - <dependency> - <groupId>org.checkerframework</groupId> - <artifactId>checker-compat-qual</artifactId> - <version>2.5.5</version> - </dependency> <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> - <version>2.7.1</version> + <version>2.11.0</version> </dependency> <dependency> <groupId>com.google.j2objc</groupId> @@ -387,5 +386,23 @@ </plugins> </build> </profile> + <profile> + <!-- + Passes JDK 9-12-specific `no-module-directories` flag to Javadoc tool, + which is required to make symbol search work correctly in the generated + pages. + + This flag does not exist on 8 and 13+ (https://bugs.openjdk.java.net/browse/JDK-8215582). + + Consider removing it once our release and test scripts are migrated to a recent JDK (17+). + --> + <id>javadocs-jdk9-12</id> + <activation> + <jdk>[9,13)</jdk> + </activation> + <properties> + <maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions> + </properties> + </profile> </profiles> </project> diff --git a/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java b/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java index cf0199ade..a8d9dd4de 100644 --- a/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java @@ -116,15 +116,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -/* - * It would make sense to also annotate this class with @ElementTypesAreNonnullByDefault. However, - * it makes no difference because this class is already covered by the package-level - * @ParametersAreNonnullByDefault, and this class declares only parameters, not return types or - * fields. (Not to mention that we'll be removing all @*AreNonnullByDefault annotations after tools - * understand .) And it's fortunate that the annotation makes no difference, because - * we're seeing a breakage internally when we add that annotation :) - * - */ +@ElementTypesAreNonnullByDefault public interface ListenableFuture<V extends @Nullable Object> extends Future<V> { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/guava-bom/pom.xml b/guava-bom/pom.xml index 58c001e61..1a3d98ec4 100644 --- a/guava-bom/pom.xml +++ b/guava-bom/pom.xml @@ -8,7 +8,7 @@ <groupId>com.google.guava</groupId> <artifactId>guava-bom</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> <packaging>pom</packaging> <parent> diff --git a/guava-gwt/pom.xml b/guava-gwt/pom.xml index 310cbdd28..5c93f83d8 100644 --- a/guava-gwt/pom.xml +++ b/guava-gwt/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> </parent> <artifactId>guava-gwt</artifactId> <name>Guava GWT compatible libs</name> diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java index 68cce933d..e3dd7032c 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java @@ -37,12 +37,12 @@ public abstract class ForwardingImmutableMap<K, V> extends ImmutableMap<K, V> { } @SuppressWarnings("unchecked") - ForwardingImmutableMap(Entry<? extends K, ? extends V>... entries) { + ForwardingImmutableMap(boolean throwIfDuplicateKeys, Entry<? extends K, ? extends V>... entries) { Map<K, V> delegate = Maps.newLinkedHashMap(); for (Entry<? extends K, ? extends V> entry : entries) { K key = checkNotNull(entry.getKey()); V previous = delegate.put(key, checkNotNull(entry.getValue())); - if (previous != null) { + if (throwIfDuplicateKeys && previous != null) { throw new IllegalArgumentException("duplicate key: " + key); } } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java index cef789a88..f0b15f6b5 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java @@ -310,12 +310,25 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { return buildOrThrow(); } - public ImmutableMap<K, V> buildOrThrow() { + private ImmutableMap<K, V> build(boolean throwIfDuplicateKeys) { if (valueComparator != null) { Collections.sort( entries, Ordering.from(valueComparator).onResultOf(Maps.<V>valueFunction())); } - return fromEntryList(entries); + return fromEntryList(throwIfDuplicateKeys, entries); + } + + public ImmutableMap<K, V> buildOrThrow() { + return build(/* throwIfDuplicateKeys= */ true); + } + + public ImmutableMap<K, V> buildKeepingLast() { + if (valueComparator != null) { + // Probably not worth supporting this in GWT + throw new UnsupportedOperationException( + "orderEntriesByValue + buildKeepingLast not supported under GWT"); + } + return build(/* throwIfDuplicateKeys= */ false); } ImmutableMap<K, V> buildJdkBacked() { @@ -323,8 +336,13 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } } - static <K, V> ImmutableMap<K, V> fromEntryList( + private static <K, V> ImmutableMap<K, V> fromEntryList( Collection<? extends Entry<? extends K, ? extends V>> entries) { + return fromEntryList(/* throwIfDuplicateKeys= */ true, entries); + } + + private static <K, V> ImmutableMap<K, V> fromEntryList( + boolean throwIfDuplicateKeys, Collection<? extends Entry<? extends K, ? extends V>> entries) { int size = entries.size(); switch (size) { case 0: @@ -335,7 +353,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { default: @SuppressWarnings("unchecked") Entry<K, V>[] entryArray = entries.toArray(new Entry[entries.size()]); - return new RegularImmutableMap<K, V>(entryArray); + return new RegularImmutableMap<K, V>(throwIfDuplicateKeys, entryArray); } } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java index b79ce805e..988537114 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java @@ -30,6 +30,10 @@ final class RegularImmutableMap<K, V> extends ForwardingImmutableMap<K, V> { } RegularImmutableMap(Entry<? extends K, ? extends V>... entries) { - super(entries); + this(/* throwIfDuplicateKeys= */ true, entries); + } + + RegularImmutableMap(boolean throwIfDuplicateKeys, Entry<? extends K, ? extends V>[] entries) { + super(throwIfDuplicateKeys, entries); } } diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java index 0f22cace9..1ecce78ec 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java @@ -40,6 +40,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; public abstract class AbstractFuture<V> extends InternalFutureFailureAccess implements ListenableFuture<V> { + static final boolean GENERATE_CANCELLATION_CAUSES = false; + /** * Tag interface marking trusted subclasses. This enables some optimizations. The implementation * of this interface must also be an AbstractFuture and must not override or expose for overriding diff --git a/guava-gwt/src/com/google/common/annotations/Annotations.gwt.xml b/guava-gwt/src/com/google/common/annotations/Annotations.gwt.xml index a281a1fab..529baf566 100644 --- a/guava-gwt/src/com/google/common/annotations/Annotations.gwt.xml +++ b/guava-gwt/src/com/google/common/annotations/Annotations.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/base/Base.gwt.xml b/guava-gwt/src/com/google/common/base/Base.gwt.xml index b8c044723..22ca5270a 100644 --- a/guava-gwt/src/com/google/common/base/Base.gwt.xml +++ b/guava-gwt/src/com/google/common/base/Base.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/cache/Cache.gwt.xml b/guava-gwt/src/com/google/common/cache/Cache.gwt.xml index fb58b9975..0f46529d3 100644 --- a/guava-gwt/src/com/google/common/cache/Cache.gwt.xml +++ b/guava-gwt/src/com/google/common/cache/Cache.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/collect/Collect.gwt.xml b/guava-gwt/src/com/google/common/collect/Collect.gwt.xml index cb2b654d1..91756f9e8 100644 --- a/guava-gwt/src/com/google/common/collect/Collect.gwt.xml +++ b/guava-gwt/src/com/google/common/collect/Collect.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/escape/Escape.gwt.xml b/guava-gwt/src/com/google/common/escape/Escape.gwt.xml index 573370698..a3ddbba44 100644 --- a/guava-gwt/src/com/google/common/escape/Escape.gwt.xml +++ b/guava-gwt/src/com/google/common/escape/Escape.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/html/Html.gwt.xml b/guava-gwt/src/com/google/common/html/Html.gwt.xml index ca997f09b..de5e7ad51 100644 --- a/guava-gwt/src/com/google/common/html/Html.gwt.xml +++ b/guava-gwt/src/com/google/common/html/Html.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/io/Io.gwt.xml b/guava-gwt/src/com/google/common/io/Io.gwt.xml index cb2b654d1..91756f9e8 100644 --- a/guava-gwt/src/com/google/common/io/Io.gwt.xml +++ b/guava-gwt/src/com/google/common/io/Io.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/math/Math.gwt.xml b/guava-gwt/src/com/google/common/math/Math.gwt.xml index ff56f8edb..6afbe44c1 100644 --- a/guava-gwt/src/com/google/common/math/Math.gwt.xml +++ b/guava-gwt/src/com/google/common/math/Math.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/net/Net.gwt.xml b/guava-gwt/src/com/google/common/net/Net.gwt.xml index 702431215..039f77c1f 100644 --- a/guava-gwt/src/com/google/common/net/Net.gwt.xml +++ b/guava-gwt/src/com/google/common/net/Net.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/primitives/Primitives.gwt.xml b/guava-gwt/src/com/google/common/primitives/Primitives.gwt.xml index 573370698..a3ddbba44 100644 --- a/guava-gwt/src/com/google/common/primitives/Primitives.gwt.xml +++ b/guava-gwt/src/com/google/common/primitives/Primitives.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/util/concurrent/Concurrent.gwt.xml b/guava-gwt/src/com/google/common/util/concurrent/Concurrent.gwt.xml index 92daff3bc..2fdeb6b88 100644 --- a/guava-gwt/src/com/google/common/util/concurrent/Concurrent.gwt.xml +++ b/guava-gwt/src/com/google/common/util/concurrent/Concurrent.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/common/xml/Xml.gwt.xml b/guava-gwt/src/com/google/common/xml/Xml.gwt.xml index 8a9e3b81b..eec7e7bba 100644 --- a/guava-gwt/src/com/google/common/xml/Xml.gwt.xml +++ b/guava-gwt/src/com/google/common/xml/Xml.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.gwt.xml b/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.gwt.xml index be70a5cfb..f35ad8c48 100644 --- a/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.gwt.xml +++ b/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixType.gwt.xml b/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixType.gwt.xml index b8c044723..22ca5270a 100644 --- a/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixType.gwt.xml +++ b/guava-gwt/src/com/google/thirdparty/publicsuffix/PublicSuffixType.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml b/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml index 6d1e97bda..5d17a81f9 100644 --- a/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml +++ b/guava-gwt/test/com/google/common/collect/testing/Testing.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml b/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml index 5e90c3195..54f33bfb0 100644 --- a/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml +++ b/guava-gwt/test/com/google/common/collect/testing/google/Google.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/test/com/google/common/escape/testing/Testing.gwt.xml b/guava-gwt/test/com/google/common/escape/testing/Testing.gwt.xml index c3a1bd4b9..0957af4f3 100644 --- a/guava-gwt/test/com/google/common/escape/testing/Testing.gwt.xml +++ b/guava-gwt/test/com/google/common/escape/testing/Testing.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-gwt/test/com/google/common/testing/Testing.gwt.xml b/guava-gwt/test/com/google/common/testing/Testing.gwt.xml index 0c5856762..72c486dbc 100644 --- a/guava-gwt/test/com/google/common/testing/Testing.gwt.xml +++ b/guava-gwt/test/com/google/common/testing/Testing.gwt.xml @@ -5,19 +5,26 @@ </source> <!-- - We used to set this only for packages that had manual supersource. - That worked everywhere that I know of except for one place: - when running the GWT util.concurrent tests under Guava. - The problem is that GWT responds poorly to two .gwt.xml files in the same Java package: - https://goo.gl/pRV3Yn - The summary is that it ignores one file in favor of the other. - util.concurrent, like nearly all our packages, has two .gwt.xml files: one for prod and one for tests. - util.concurrent, unlike our other packages, has, as of this writing, test supersource but no prod supersource. - GWT happens to use the prod .gwt.xml, so it looks for no supersource for tests, either. - This causes it to fail to find AtomicLongMapTest. - Our workaround is to tell GWT that util.concurrent and all other packages have prod supersource, even if they have none. - GWT is happy to ignore us when we specify a nonexistent path. - (I hope that this workaround does not cause its own problems in the future.) + We used to set this only for packages that had manual supersource. That + worked everywhere that I know of except for one place: when running the GWT + util.concurrent tests under Guava. + + The problem is that GWT responds poorly to two .gwt.xml files in the same + Java package; see https://goo.gl/pRV3Yn for details. + + The summary is that it ignores one file in favor of the other. + util.concurrent, like nearly all our packages, has two .gwt.xml files: one + for prod and one for tests. However, unlike our other packages, as of this + writing it has test supersource but no prod supersource. + + GWT happens to use the prod .gwt.xml, so it looks for no supersource for + tests, either. This causes it to fail to find AtomicLongMapTest. + + Our workaround is to tell GWT that util.concurrent and all other packages + have prod supersource, even if they have none. GWT is happy to ignore us + when we specify a nonexistent path. + + (I hope that this workaround does not cause its own problems in the future.) --> <super-source path="super"/> diff --git a/guava-testlib/README.md b/guava-testlib/README.md index 43689959d..d4810e3a3 100644 --- a/guava-testlib/README.md +++ b/guava-testlib/README.md @@ -13,7 +13,7 @@ To add a dependency on Guava testlib using Maven, use the following: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava-testlib</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> <scope>test</scope> </dependency> ``` @@ -22,7 +22,7 @@ To add a dependency using Gradle: ```gradle dependencies { - test 'com.google.guava:guava-testlib:31.0.1-jre' + test 'com.google.guava:guava-testlib:31.1-jre' } ``` diff --git a/guava-testlib/pom.xml b/guava-testlib/pom.xml index aa812ae77..19ce18a60 100644 --- a/guava-testlib/pom.xml +++ b/guava-testlib/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> </parent> <artifactId>guava-testlib</artifactId> <name>Guava Testing Library</name> diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index a5674d3db..b86ef1750 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -188,7 +188,7 @@ public abstract class AbstractContainerTester<C, E> E[] elements = createSamplesArray(); E duplicate = elements[(elements.length / 2) - 1]; elements[(elements.length / 2) + 1] = duplicate; - return new ArrayWithDuplicate<E>(elements, duplicate); + return new ArrayWithDuplicate<>(elements, duplicate); } // Helper methods to improve readability of derived classes @@ -211,7 +211,7 @@ public abstract class AbstractContainerTester<C, E> * requirement {@link com.google.common.collect.testing.features.CollectionFeature#KNOWN_ORDER}. */ protected List<E> getOrderedElements() { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) { list.add(e); } diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index 090442edc..5e0de3ccc 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -72,8 +72,8 @@ public abstract class AbstractMapTester<K, V> /** @return an array of the proper size with {@code null} as the key of the middle element. */ protected Entry<K, V>[] createArrayWithNullKey() { Entry<K, V>[] array = createSamplesArray(); - final int nullKeyLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullKeyLocation]; + int nullKeyLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullKeyLocation]; array[nullKeyLocation] = entry(null, oldEntry.getValue()); return array; } @@ -97,8 +97,8 @@ public abstract class AbstractMapTester<K, V> /** @return an array of the proper size with {@code null} as the value of the middle element. */ protected Entry<K, V>[] createArrayWithNullValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullValueLocation]; + int nullValueLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullValueLocation]; array[nullValueLocation] = entry(oldEntry.getKey(), null); return array; } diff --git a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 3588e856f..a04d3ffe3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -96,9 +96,9 @@ public final class DerivedCollectionGenerators { public MapKeySetGenerator(OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<K>( + new SampleElements<>( mapSamples.e0().getKey(), mapSamples.e1().getKey(), mapSamples.e2().getKey(), @@ -203,9 +203,9 @@ public final class DerivedCollectionGenerators { public MapValueCollectionGenerator( OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<V>( + new SampleElements<>( mapSamples.e0().getValue(), mapSamples.e1().getValue(), mapSamples.e2().getValue(), @@ -239,14 +239,13 @@ public final class DerivedCollectionGenerators { @Override public V[] createArray(int length) { // noinspection UnnecessaryLocalVariable - final V[] vs = - ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); + V[] vs = ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); return vs; } @Override public Iterable<V> order(List<V> insertionOrder) { - final List<Entry<K, V>> orderedEntries = + List<Entry<K, V>> orderedEntries = castOrCopyToList(mapGenerator.order(castOrCopyToList(mapGenerator.getSampleElements(5)))); sort( insertionOrder, diff --git a/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java index b629fa90f..db086aa30 100644 --- a/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java @@ -185,7 +185,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< TestSuite suite = new TestSuite(name); for (Class<? extends AbstractTester> testerClass : testers) { - final TestSuite testerSuite = + TestSuite testerSuite = makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass); if (testerSuite.countTestCases() > 0) { suite.addTest(testerSuite); @@ -211,7 +211,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< protected abstract List<Class<? extends AbstractTester>> getTesters(); private boolean matches(Test test) { - final Method method; + Method method; try { method = extractMethod(test); } catch (IllegalArgumentException e) { @@ -222,7 +222,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< logger.finer(Platform.format("%s: excluding because it was explicitly suppressed.", test)); return false; } - final TesterRequirements requirements; + TesterRequirements requirements; try { requirements = FeatureUtil.getTesterRequirements(method); } catch (ConflictingRequirementsException e) { @@ -268,8 +268,8 @@ public abstract class FeatureSpecificTestSuiteBuilder< } protected TestSuite makeSuiteForTesterClass(Class<? extends AbstractTester<?>> testerClass) { - final TestSuite candidateTests = new TestSuite(testerClass); - final TestSuite suite = filterSuite(candidateTests); + TestSuite candidateTests = new TestSuite(testerClass); + TestSuite suite = filterSuite(candidateTests); Enumeration<?> allTests = suite.tests(); while (allTests.hasMoreElements()) { @@ -286,7 +286,7 @@ public abstract class FeatureSpecificTestSuiteBuilder< private TestSuite filterSuite(TestSuite suite) { TestSuite filtered = new TestSuite(suite.getName()); - final Enumeration<?> tests = suite.tests(); + Enumeration<?> tests = suite.tests(); while (tests.hasMoreElements()) { Test test = (Test) tests.nextElement(); if (matches(test)) { diff --git a/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/guava-testlib/src/com/google/common/collect/testing/Helpers.java index 8efafc373..aac71cc4e 100644 --- a/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -49,7 +49,7 @@ public class Helpers { // Clone of Lists.newArrayList public static <E> List<E> copyToList(Iterable<? extends E> elements) { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); addAll(list, elements); return list; } @@ -60,7 +60,7 @@ public class Helpers { // Clone of Sets.newLinkedHashSet public static <E> Set<E> copyToSet(Iterable<? extends E> elements) { - Set<E> set = new LinkedHashSet<E>(); + Set<E> set = new LinkedHashSet<>(); addAll(set, elements); return set; } @@ -188,11 +188,11 @@ public class Helpers { return modified; } - static <T> Iterable<T> reverse(final List<T> list) { + static <T> Iterable<T> reverse(List<T> list) { return new Iterable<T>() { @Override public Iterator<T> iterator() { - final ListIterator<T> listIter = list.listIterator(list.size()); + ListIterator<T> listIter = list.listIterator(list.size()); return new Iterator<T>() { @Override public boolean hasNext() { @@ -213,7 +213,7 @@ public class Helpers { }; } - static <T> Iterator<T> cycle(final Iterable<T> iterable) { + static <T> Iterator<T> cycle(Iterable<T> iterable) { return new Iterator<T>() { Iterator<T> iterator = Collections.<T>emptySet().iterator(); @@ -251,7 +251,7 @@ public class Helpers { } public static <K, V> Comparator<Entry<K, V>> entryComparator( - final Comparator<? super K> keyComparator) { + Comparator<? super K> keyComparator) { return new Comparator<Entry<K, V>>() { @Override @SuppressWarnings("unchecked") // no less safe than putting it in the map! @@ -345,7 +345,7 @@ public class Helpers { * @param delta the difference between the true size of the collection and the values returned by * the size method */ - public static <T> Collection<T> misleadingSizeCollection(final int delta) { + public static <T> Collection<T> misleadingSizeCollection(int delta) { // It would be nice to be able to return a real concurrent // collection like ConcurrentLinkedQueue, so that e.g. concurrent // iteration would work, but that would not be GWT-compatible. @@ -363,7 +363,7 @@ public class Helpers { * equals. This is used for testing unmodifiable collections of map entries; for example, it * should not be possible to access the raw (modifiable) map entry via a nefarious equals method. */ - public static <K, V> Entry<K, V> nefariousMapEntry(final K key, final V value) { + public static <K, V> Entry<K, V> nefariousMapEntry(K key, V value) { return new Entry<K, V>() { @Override public K getKey() { @@ -410,7 +410,7 @@ public class Helpers { if (iterable instanceof List) { return (List<E>) iterable; } - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : iterable) { list.add(e); } diff --git a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index b8b5c28fb..484913878 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -149,7 +149,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { for (V value : values) { if (value != null) { try { - value.hashCode(); + int unused = value.hashCode(); } catch (Exception e) { return false; } @@ -265,7 +265,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { protected void assertMoreInvariants(Map<K, V> map) {} public void testClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -286,8 +286,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testContainsKey() { - final Map<K, V> map; - final K unmappedKey; + Map<K, V> map; + K unmappedKey; try { map = makePopulatedMap(); unmappedKey = getKeyNotInPopulatedMap(); @@ -312,8 +312,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testContainsValue() { - final Map<K, V> map; - final V unmappedValue; + Map<K, V> map; + V unmappedValue; try { map = makePopulatedMap(); unmappedValue = getValueNotInPopulatedMap(); @@ -334,8 +334,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySet() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -344,8 +344,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final K unmappedKey; - final V unmappedValue; + K unmappedKey; + V unmappedValue; try { unmappedKey = getKeyNotInPopulatedMap(); unmappedValue = getValueNotInPopulatedMap(); @@ -359,7 +359,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -369,8 +369,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetContainsEntryIncompatibleKey() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -379,7 +379,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -396,8 +396,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!allowsNullKeys || !supportsPut) { return; } - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -406,7 +406,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -420,8 +420,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetContainsEntryNullKeyMissing() { - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -430,7 +430,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -450,7 +450,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetIteratorRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -488,7 +488,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -512,8 +512,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveMissingKey() { - final Map<K, V> map; - final K key; + Map<K, V> map; + K key; try { map = makeEitherMap(); key = getKeyNotInPopulatedMap(); @@ -540,7 +540,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveDifferentValue() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -570,8 +570,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!allowsNullKeys || !supportsPut || !supportsRemove) { return; } - final Map<K, V> map; - final Set<Entry<K, V>> entrySet; + Map<K, V> map; + Set<Entry<K, V>> entrySet; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -580,7 +580,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); entrySet = map.entrySet(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -597,7 +597,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveNullKeyMissing() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -626,7 +626,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -663,7 +663,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -689,7 +689,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -717,7 +717,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -743,7 +743,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -765,10 +765,10 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEntrySetAddAndAddAll() { - final Map<K, V> map = makeEitherMap(); + Map<K, V> map = makeEitherMap(); Set<Entry<K, V>> entrySet = map.entrySet(); - final Entry<K, V> entryToAdd = mapEntry(null, null); + Entry<K, V> entryToAdd = mapEntry(null, null); try { entrySet.add(entryToAdd); fail("Expected UnsupportedOperationException or NullPointerException."); @@ -793,8 +793,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final V valueToSet; + Map<K, V> map; + V valueToSet; try { map = makePopulatedMap(); valueToSet = getValueNotInPopulatedMap(); @@ -804,8 +804,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { Set<Entry<K, V>> entrySet = map.entrySet(); Entry<K, V> entry = entrySet.iterator().next(); - final V oldValue = entry.getValue(); - final V returnedValue = entry.setValue(valueToSet); + V oldValue = entry.getValue(); + V returnedValue = entry.setValue(valueToSet); assertEquals(oldValue, returnedValue); assertTrue(entrySet.contains(mapEntry(entry.getKey(), valueToSet))); assertEquals(valueToSet, map.get(entry.getKey())); @@ -819,7 +819,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -828,8 +828,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { Set<Entry<K, V>> entrySet = map.entrySet(); Entry<K, V> entry = entrySet.iterator().next(); - final V oldValue = entry.getValue(); - final V returnedValue = entry.setValue(oldValue); + V oldValue = entry.getValue(); + V returnedValue = entry.setValue(oldValue); assertEquals(oldValue, returnedValue); assertTrue(entrySet.contains(mapEntry(entry.getKey(), oldValue))); assertEquals(oldValue, map.get(entry.getKey())); @@ -837,15 +837,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEqualsForEqualMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { return; } - assertEquals(map, map); - assertEquals(makePopulatedMap(), map); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(map.equals(map)); + assertTrue(makePopulatedMap().equals(map)); assertFalse(map.equals(Collections.emptyMap())); // no-inspection ObjectEqualsNull assertFalse(map.equals(null)); @@ -856,8 +857,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final Map<K, V> largerMap; + Map<K, V> map; + Map<K, V> largerMap; try { map = makePopulatedMap(); largerMap = makePopulatedMap(); @@ -874,8 +875,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } - final Map<K, V> map; - final Map<K, V> smallerMap; + Map<K, V> map; + Map<K, V> smallerMap; try { map = makePopulatedMap(); smallerMap = makePopulatedMap(); @@ -888,15 +889,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testEqualsForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { return; } - assertEquals(map, map); - assertEquals(makeEmptyMap(), map); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(map.equals(map)); + assertTrue(makeEmptyMap().equals(map)); assertEquals(Collections.emptyMap(), map); assertFalse(map.equals(Collections.emptySet())); // noinspection ObjectEqualsNull @@ -904,7 +906,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testGet() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -925,7 +927,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testGetForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; K unmappedKey = null; try { map = makeEmptyMap(); @@ -954,7 +956,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testHashCode() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -964,7 +966,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testHashCodeForEmptyMap() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -974,9 +976,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutNewKey() { - final Map<K, V> map = makeEitherMap(); - final K keyToPut; - final V valueToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; + V valueToPut; try { keyToPut = getKeyNotInPopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1002,9 +1004,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutExistingKey() { - final Map<K, V> map; - final K keyToPut; - final V valueToPut; + Map<K, V> map; + K keyToPut; + V valueToPut; try { map = makePopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1033,16 +1035,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map = makeEitherMap(); - final V valueToPut; + Map<K, V> map = makeEitherMap(); + V valueToPut; try { valueToPut = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { return; } if (allowsNullKeys) { - final V oldValue = map.get(null); - final V returnedValue = map.put(null, valueToPut); + V oldValue = map.get(null); + V returnedValue = map.put(null, valueToPut); assertEquals(oldValue, returnedValue); assertEquals(valueToPut, map.get(null)); assertTrue(map.containsKey(null)); @@ -1061,8 +1063,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map = makeEitherMap(); - final K keyToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; try { keyToPut = getKeyNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1070,8 +1072,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } if (allowsNullValues) { int initialSize = map.size(); - final V oldValue = map.get(keyToPut); - final V returnedValue = map.put(keyToPut, null); + V oldValue = map.get(keyToPut); + V returnedValue = map.put(keyToPut, null); assertEquals(oldValue, returnedValue); assertNull(map.get(keyToPut)); assertTrue(map.containsKey(keyToPut)); @@ -1091,8 +1093,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { if (!supportsPut) { return; } - final Map<K, V> map; - final K keyToPut; + Map<K, V> map; + K keyToPut; try { map = makePopulatedMap(); keyToPut = map.keySet().iterator().next(); @@ -1101,8 +1103,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } if (allowsNullValues) { int initialSize = map.size(); - final V oldValue = map.get(keyToPut); - final V returnedValue = map.put(keyToPut, null); + V oldValue = map.get(keyToPut); + V returnedValue = map.put(keyToPut, null); assertEquals(oldValue, returnedValue); assertNull(map.get(keyToPut)); assertTrue(map.containsKey(keyToPut)); @@ -1119,16 +1121,16 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutAllNewKey() { - final Map<K, V> map = makeEitherMap(); - final K keyToPut; - final V valueToPut; + Map<K, V> map = makeEitherMap(); + K keyToPut; + V valueToPut; try { keyToPut = getKeyNotInPopulatedMap(); valueToPut = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { return; } - final Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); + Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); if (supportsPut) { int initialSize = map.size(); map.putAll(mapToPut); @@ -1147,9 +1149,9 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testPutAllExistingKey() { - final Map<K, V> map; - final K keyToPut; - final V valueToPut; + Map<K, V> map; + K keyToPut; + V valueToPut; try { map = makePopulatedMap(); valueToPut = getValueNotInPopulatedMap(); @@ -1157,7 +1159,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { return; } keyToPut = map.keySet().iterator().next(); - final Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); + Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut); int initialSize = map.size(); if (supportsPut) { map.putAll(mapToPut); @@ -1176,8 +1178,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testRemove() { - final Map<K, V> map; - final K keyToRemove; + Map<K, V> map; + K keyToRemove; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1202,8 +1204,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testRemoveMissingKey() { - final Map<K, V> map; - final K keyToRemove; + Map<K, V> map; + K keyToRemove; try { map = makePopulatedMap(); keyToRemove = getKeyNotInPopulatedMap(); @@ -1229,7 +1231,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1254,7 +1256,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1279,7 +1281,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1303,7 +1305,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEitherMap(); } catch (UnsupportedOperationException e) { @@ -1325,7 +1327,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1351,7 +1353,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testKeySetRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1377,8 +1379,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValues() { - final Map<K, V> map; - final Collection<V> valueCollection; + Map<K, V> map; + Collection<V> valueCollection; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1387,7 +1389,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { assertInvariants(map); valueCollection = map.values(); - final V unmappedValue; + V unmappedValue; try { unmappedValue = getValueNotInPopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1399,7 +1401,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesIteratorRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1434,7 +1436,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemove() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1460,8 +1462,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveMissing() { - final Map<K, V> map; - final V valueToRemove; + Map<K, V> map; + V valueToRemove; try { map = makeEitherMap(); valueToRemove = getValueNotInPopulatedMap(); @@ -1485,7 +1487,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1513,7 +1515,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRemoveAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1539,7 +1541,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRetainAll() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -1567,7 +1569,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesRetainAllNullFromEmpty() { - final Map<K, V> map; + Map<K, V> map; try { map = makeEmptyMap(); } catch (UnsupportedOperationException e) { @@ -1593,7 +1595,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase { } public void testValuesClear() { - final Map<K, V> map; + Map<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index a6ec93d1e..2adf07251 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -33,12 +33,12 @@ public class MinimalCollection<E> extends AbstractCollection<E> { // TODO: expose allow nulls parameter? public static <E> MinimalCollection<E> of(E... contents) { - return new MinimalCollection<E>(Object.class, true, contents); + return new MinimalCollection<>(Object.class, true, contents); } // TODO: use this public static <E> MinimalCollection<E> ofClassAndContents(Class<? super E> type, E... contents) { - return new MinimalCollection<E>(type, true, contents); + return new MinimalCollection<>(type, true, contents); } private final E[] contents; diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java b/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java index c151c15e1..15d48dbbd 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalIterable.java @@ -51,7 +51,7 @@ public final class MinimalIterable<E> implements Iterable<E> { /** Returns an iterable whose iterator returns the given elements in order. */ public static <E> MinimalIterable<E> of(E... elements) { // Make sure to get an unmodifiable iterator - return new MinimalIterable<E>(Arrays.asList(elements).iterator()); + return new MinimalIterable<>(Arrays.asList(elements).iterator()); } /** @@ -59,7 +59,7 @@ public final class MinimalIterable<E> implements Iterable<E> { * out of the source collection at the time this method is called. */ @SuppressWarnings("unchecked") // Es come in, Es go out - public static <E> MinimalIterable<E> from(final Collection<E> elements) { + public static <E> MinimalIterable<E> from(Collection<E> elements) { return (MinimalIterable) of(elements.toArray()); } diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 988dd3f95..9a87d244d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -45,13 +45,13 @@ public class MinimalSet<E> extends MinimalCollection<E> implements Set<E> { public static <E> MinimalSet<E> ofClassAndContents( Class<? super E> type, E[] emptyArrayForContents, Iterable<? extends E> contents) { - List<E> setContents = new ArrayList<E>(); + List<E> setContents = new ArrayList<>(); for (E e : contents) { if (!setContents.contains(e)) { setContents.add(e); } } - return new MinimalSet<E>(type, setContents.toArray(emptyArrayForContents)); + return new MinimalSet<>(type, setContents.toArray(emptyArrayForContents)); } private MinimalSet(Class<? super E> type, E... contents) { diff --git a/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java index 77a198454..0e1a22920 100644 --- a/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/NavigableMapTestSuiteBuilder.java @@ -116,10 +116,10 @@ public class NavigableMapTestSuiteBuilder<K, V> extends SortedMapTestSuiteBuilde /** Create a suite whose maps are descending views of other maps. */ private TestSuite createDescendingSuite( - final FeatureSpecificTestSuiteBuilder< + FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder) { - final TestSortedMapGenerator<K, V> delegate = + TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); diff --git a/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java index 38eb56e09..4c86ab462 100644 --- a/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java @@ -40,7 +40,7 @@ import junit.framework.TestSuite; @GwtIncompatible public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBuilder<E> { public static <E> NavigableSetTestSuiteBuilder<E> using(TestSortedSetGenerator<E> generator) { - NavigableSetTestSuiteBuilder<E> builder = new NavigableSetTestSuiteBuilder<E>(); + NavigableSetTestSuiteBuilder<E> builder = new NavigableSetTestSuiteBuilder<>(); builder.usingGenerator(generator); return builder; } @@ -99,10 +99,9 @@ public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBui /** Create a suite whose maps are descending views of other maps. */ private TestSuite createDescendingSuite( - final FeatureSpecificTestSuiteBuilder< - ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> + FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) { - final TestSetGenerator<E> delegate = + TestSetGenerator<E> delegate = (TestSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); @@ -124,7 +123,7 @@ public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBui @Override public Iterable<E> order(List<E> insertionOrder) { - List<E> list = new ArrayList<E>(); + List<E> list = new ArrayList<>(); for (E e : delegate.order(insertionOrder)) { list.add(e); } diff --git a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index 1b8924c07..1ff3facc4 100644 --- a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -70,7 +70,7 @@ public final class OneSizeGenerator<T, E> implements OneSizeTestContainerGenerat @SuppressWarnings("unchecked") List<E> allSampleElements = Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4()); - return new ArrayList<E>(allSampleElements.subList(0, howMany)); + return new ArrayList<>(allSampleElements.subList(0, howMany)); } @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java index 28d6f7917..923f56fd4 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/ReserializingTestCollectionGenerator.java @@ -42,7 +42,7 @@ public class ReserializingTestCollectionGenerator<E> implements TestCollectionGe public static <E> ReserializingTestCollectionGenerator<E> newInstance( TestCollectionGenerator<E> delegate) { - return new ReserializingTestCollectionGenerator<E>(delegate); + return new ReserializingTestCollectionGenerator<>(delegate); } @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java index c92a3ff20..555440adc 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/ReserializingTestSetGenerator.java @@ -35,7 +35,7 @@ public class ReserializingTestSetGenerator<E> extends ReserializingTestCollectio } public static <E> TestSetGenerator<E> newInstance(TestSetGenerator<E> delegate) { - return new ReserializingTestSetGenerator<E>(delegate); + return new ReserializingTestSetGenerator<>(delegate); } @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java b/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java index 8ed481073..91d9fd9f7 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java +++ b/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java @@ -117,7 +117,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> descendingSet() { - return new SafeTreeSet<E>(delegate.descendingSet()); + return new SafeTreeSet<>(delegate.descendingSet()); } @Override @@ -137,7 +137,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> headSet(E toElement, boolean inclusive) { - return new SafeTreeSet<E>(delegate.headSet(checkValid(toElement), inclusive)); + return new SafeTreeSet<>(delegate.headSet(checkValid(toElement), inclusive)); } @Override @@ -198,7 +198,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { - return new SafeTreeSet<E>( + return new SafeTreeSet<>( delegate.subSet( checkValid(fromElement), fromInclusive, checkValid(toElement), toInclusive)); } @@ -215,7 +215,7 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> { @Override public NavigableSet<E> tailSet(E fromElement, boolean inclusive) { - return new SafeTreeSet<E>(delegate.tailSet(checkValid(fromElement), inclusive)); + return new SafeTreeSet<>(delegate.tailSet(checkValid(fromElement), inclusive)); } @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java b/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java index 829c4cc27..03266ab47 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java +++ b/guava-testlib/src/com/google/common/collect/testing/SortedMapInterfaceTest.java @@ -56,7 +56,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapWriteThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -82,7 +82,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapRemoveThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { @@ -105,7 +105,7 @@ public abstract class SortedMapInterfaceTest<K, V> extends MapInterfaceTest<K, V } public void testTailMapClearThrough() { - final SortedMap<K, V> map; + SortedMap<K, V> map; try { map = makePopulatedMap(); } catch (UnsupportedOperationException e) { diff --git a/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java index aa1d6d5e4..7944aaa6a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java @@ -105,12 +105,12 @@ public class SortedMapTestSuiteBuilder<K, V> extends MapTestSuiteBuilder<K, V> { * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubmapSuite( - final FeatureSpecificTestSuiteBuilder< + FeatureSpecificTestSuiteBuilder< ?, ? extends OneSizeTestContainerGenerator<Map<K, V>, Entry<K, V>>> parentBuilder, - final Bound from, - final Bound to) { - final TestSortedMapGenerator<K, V> delegate = + Bound from, + Bound to) { + TestSortedMapGenerator<K, V> delegate = (TestSortedMapGenerator<K, V>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(); diff --git a/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java index 509266148..2835769e3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/SortedSetTestSuiteBuilder.java @@ -34,7 +34,7 @@ import junit.framework.TestSuite; @GwtIncompatible public class SortedSetTestSuiteBuilder<E> extends SetTestSuiteBuilder<E> { public static <E> SortedSetTestSuiteBuilder<E> using(TestSortedSetGenerator<E> generator) { - SortedSetTestSuiteBuilder<E> builder = new SortedSetTestSuiteBuilder<E>(); + SortedSetTestSuiteBuilder<E> builder = new SortedSetTestSuiteBuilder<>(); builder.usingGenerator(generator); return builder; } @@ -78,12 +78,11 @@ public class SortedSetTestSuiteBuilder<E> extends SetTestSuiteBuilder<E> { * these extreme values rather than relying on their regular sort ordering. */ final TestSuite createSubsetSuite( - final FeatureSpecificTestSuiteBuilder< - ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> + FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder, - final Bound from, - final Bound to) { - final TestSortedSetGenerator<E> delegate = + Bound from, + Bound to) { + TestSortedSetGenerator<E> delegate = (TestSortedSetGenerator<E>) parentBuilder.getSubjectGenerator().getInnerGenerator(); List<Feature<?>> features = new ArrayList<>(parentBuilder.getFeatures()); diff --git a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java index 08c771e7a..9fad6e398 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.testing.Helpers.assertEqualIgnoringOrder; import static com.google.common.collect.testing.Helpers.assertEqualInOrder; import static com.google.common.collect.testing.Platform.format; +import static java.util.Comparator.naturalOrder; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; @@ -296,7 +297,7 @@ public final class SpliteratorTester<E> { if ((characteristics & Spliterator.SORTED) != 0) { Comparator<? super E> comparator = spliterator.getComparator(); if (comparator == null) { - comparator = (Comparator) Comparator.naturalOrder(); + comparator = (Comparator) naturalOrder(); } assertTrue(Ordering.from(comparator).isOrdered(resultsForStrategy)); } diff --git a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java index 95cbc0b3d..2d11a0863 100644 --- a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java +++ b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java @@ -139,12 +139,12 @@ public class FeatureUtil { */ static TesterRequirements buildTesterRequirements(Class<?> testerClass) throws ConflictingRequirementsException { - final TesterRequirements declaredRequirements = buildDeclaredTesterRequirements(testerClass); + TesterRequirements declaredRequirements = buildDeclaredTesterRequirements(testerClass); Class<?> baseClass = testerClass.getSuperclass(); if (baseClass == null) { return declaredRequirements; } else { - final TesterRequirements clonedBaseRequirements = + TesterRequirements clonedBaseRequirements = new TesterRequirements(getTesterRequirements(baseClass)); return incorporateRequirements(clonedBaseRequirements, declaredRequirements, testerClass); } @@ -176,8 +176,8 @@ public class FeatureUtil { private static TesterRequirements buildTesterRequirements(Annotation testerAnnotation) throws ConflictingRequirementsException { Class<? extends Annotation> annotationClass = testerAnnotation.annotationType(); - final Feature<?>[] presentFeatures; - final Feature<?>[] absentFeatures; + Feature<?>[] presentFeatures; + Feature<?>[] absentFeatures; try { presentFeatures = (Feature[]) annotationClass.getMethod("value").invoke(testerAnnotation); absentFeatures = (Feature[]) annotationClass.getMethod("absent").invoke(testerAnnotation); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index 7b7801db2..7f649e757 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java @@ -48,8 +48,8 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> /** @return an array of the proper size with {@code null} as the key of the middle element. */ protected Entry<K, V>[] createArrayWithNullKey() { Entry<K, V>[] array = createSamplesArray(); - final int nullKeyLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullKeyLocation]; + int nullKeyLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullKeyLocation]; array[nullKeyLocation] = Helpers.mapEntry(null, oldEntry.getValue()); return array; } @@ -57,8 +57,8 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> /** @return an array of the proper size with {@code null} as the value of the middle element. */ protected Entry<K, V>[] createArrayWithNullValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); - final Entry<K, V> oldEntry = array[nullValueLocation]; + int nullValueLocation = getNullLocation(); + Entry<K, V> oldEntry = array[nullValueLocation]; array[nullValueLocation] = Helpers.mapEntry(oldEntry.getKey(), null); return array; } @@ -69,7 +69,7 @@ public abstract class AbstractMultimapTester<K, V, M extends Multimap<K, V>> */ protected Entry<K, V>[] createArrayWithNullKeyAndValue() { Entry<K, V>[] array = createSamplesArray(); - final int nullValueLocation = getNullLocation(); + int nullValueLocation = getNullLocation(); array[nullValueLocation] = Helpers.mapEntry(null, null); return array; } diff --git a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index bbeefd278..35579a01d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java @@ -159,9 +159,9 @@ public final class DerivedGoogleCollectionGenerators { public BiMapValueSetGenerator( OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>> mapGenerator) { this.mapGenerator = mapGenerator; - final SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); + SampleElements<Entry<K, V>> mapSamples = this.mapGenerator.samples(); this.samples = - new SampleElements<V>( + new SampleElements<>( mapSamples.e0().getValue(), mapSamples.e1().getValue(), mapSamples.e2().getValue(), @@ -194,7 +194,7 @@ public final class DerivedGoogleCollectionGenerators { @Override public V[] createArray(int length) { - final V[] vs = + V[] vs = ((TestBiMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length); return vs; } diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index bb84ea15f..35063e815 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java @@ -54,7 +54,7 @@ public class MapGenerators { for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } - return builder.build(); + return builder.buildOrThrow(); } } @@ -86,7 +86,7 @@ public class MapGenerators { for (UnhashableObject value : elements) { builder.put(key++, value); } - return builder.build().values(); + return builder.buildOrThrow().values(); } } @@ -97,7 +97,7 @@ public class MapGenerators { for (int i = 0; i < elements.length; i++) { builder.put(elements[i], i); } - return builder.build().keySet().asList(); + return builder.buildOrThrow().keySet().asList(); } } @@ -108,7 +108,7 @@ public class MapGenerators { for (int i = 0; i < elements.length; i++) { builder.put(i, elements[i]); } - return builder.build().values().asList(); + return builder.buildOrThrow().values().asList(); } } @@ -144,7 +144,7 @@ public class MapGenerators { Entry<String, Integer> entry = (Entry<String, Integer>) o; builder.put(entry); } - return builder.build().entrySet().asList(); + return builder.buildOrThrow().entrySet().asList(); } } @@ -210,7 +210,7 @@ public class MapGenerators { Integer value = Iterables.getOnlyElement(entry.getValue()); builder.put(entry.getKey(), value); } - return builder.build().asMultimap().asMap(); + return builder.buildOrThrow().asMultimap().asMap(); } @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java index b65cd967a..ce8e283a9 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java @@ -82,7 +82,7 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> { @SuppressWarnings("unchecked") // Needed to stop Eclipse whining private void resetWithHole() { - List<E> container = new ArrayList<E>(); + List<E> container = new ArrayList<>(); container.addAll(Collections.nCopies(a.getCount(), a.getElement())); container.addAll(Collections.nCopies(c.getCount(), c.getElement())); super.resetContainer(getSubjectGenerator().create(container.toArray())); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 49187dd1d..6e7995720 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java @@ -58,7 +58,7 @@ public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, S @MapFeature.Require(SUPPORTS_REMOVE) public void testAsMapRemoveImplementsSet() { - List<K> keys = new ArrayList<K>(multimap().keySet()); + List<K> keys = new ArrayList<>(multimap().keySet()); for (K key : keys) { resetCollection(); assertTrue(multimap().asMap().remove(key) instanceof Set); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java index dafd52187..b44494b81 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java @@ -56,7 +56,7 @@ import junit.framework.TestSuite; @GwtIncompatible public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder<E> { public static <E> SortedMultisetTestSuiteBuilder<E> using(TestMultisetGenerator<E> generator) { - SortedMultisetTestSuiteBuilder<E> result = new SortedMultisetTestSuiteBuilder<E>(); + SortedMultisetTestSuiteBuilder<E> result = new SortedMultisetTestSuiteBuilder<>(); result.usingGenerator(generator); return result; } @@ -138,8 +138,8 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createSubMultisetSuite( - SortedMultisetTestSuiteBuilder<E> parentBuilder, final Bound from, final Bound to) { - final TestMultisetGenerator<E> delegate = + SortedMultisetTestSuiteBuilder<E> parentBuilder, Bound from, Bound to) { + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(); @@ -152,15 +152,15 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } SortedMultiset<E> emptyMultiset = (SortedMultiset<E>) delegate.create(); - final Comparator<? super E> comparator = emptyMultiset.comparator(); + Comparator<? super E> comparator = emptyMultiset.comparator(); SampleElements<E> samples = delegate.samples(); @SuppressWarnings("unchecked") List<E> samplesList = Arrays.asList(samples.e0(), samples.e1(), samples.e2(), samples.e3(), samples.e4()); Collections.sort(samplesList, comparator); - final E firstInclusive = samplesList.get(0); - final E lastInclusive = samplesList.get(samplesList.size() - 1); + E firstInclusive = samplesList.get(0); + E lastInclusive = samplesList.get(samplesList.size() - 1); return SortedMultisetTestSuiteBuilder.using( new ForwardingTestMultisetGenerator<E>(delegate) { @@ -187,7 +187,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } // the regular values should be visible after filtering - List<E> allEntries = new ArrayList<E>(); + List<E> allEntries = new ArrayList<>(); allEntries.addAll(extremeValues); allEntries.addAll(normalValues); SortedMultiset<E> multiset = @@ -234,7 +234,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createDescendingSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) { - final TestMultisetGenerator<E> delegate = + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(); @@ -263,7 +263,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder< } private TestSuite createReserializedSuite(SortedMultisetTestSuiteBuilder<E> parentBuilder) { - final TestMultisetGenerator<E> delegate = + TestMultisetGenerator<E> delegate = (TestMultisetGenerator<E>) parentBuilder.getSubjectGenerator(); Set<Feature<?>> features = new HashSet<>(parentBuilder.getFeatures()); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java index 1c00f0970..e95b74f84 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapAsMapTester.java @@ -52,7 +52,7 @@ public class SortedSetMultimapAsMapTester<K, V> @MapFeature.Require(SUPPORTS_REMOVE) public void testAsMapRemoveImplementsSortedSet() { - List<K> keys = new ArrayList<K>(multimap().keySet()); + List<K> keys = new ArrayList<>(multimap().keySet()); for (K key : keys) { resetCollection(); SortedSet<V> valueSet = (SortedSet<V>) multimap().asMap().remove(key); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index 005746f4b..40b2c859d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java @@ -201,7 +201,7 @@ public class UnmodifiableCollectionTests { * @param sampleElement an element of the same type as that contained by {@code multiset}. {@code * multiset} may or may not have {@code sampleElement} as a member. */ - public static <E> void assertMultisetIsUnmodifiable(Multiset<E> multiset, final E sampleElement) { + public static <E> void assertMultisetIsUnmodifiable(Multiset<E> multiset, E sampleElement) { Multiset<E> copy = LinkedHashMultiset.create(multiset); assertCollectionsAreEquivalent(multiset, copy); @@ -264,7 +264,7 @@ public class UnmodifiableCollectionTests { * multimap} may or may not have {@code sampleValue} as a key. */ public static <K, V> void assertMultimapIsUnmodifiable( - Multimap<K, V> multimap, final K sampleKey, final V sampleValue) { + Multimap<K, V> multimap, K sampleKey, V sampleValue) { List<Entry<K, V>> originalEntries = Collections.unmodifiableList(Lists.newArrayList(multimap.entries())); diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionForEachTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionForEachTester.java index d1a36af87..af8490d31 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionForEachTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionForEachTester.java @@ -38,14 +38,14 @@ import org.junit.Ignore; public class CollectionForEachTester<E> extends AbstractCollectionTester<E> { @CollectionFeature.Require(absent = KNOWN_ORDER) public void testForEachUnknownOrder() { - List<E> elements = new ArrayList<E>(); + List<E> elements = new ArrayList<>(); collection.forEach(elements::add); Helpers.assertEqualIgnoringOrder(Arrays.asList(createSamplesArray()), elements); } @CollectionFeature.Require(KNOWN_ORDER) public void testForEachKnownOrder() { - List<E> elements = new ArrayList<E>(); + List<E> elements = new ArrayList<>(); collection.forEach(elements::add); List<E> expected = Helpers.copyToList(getOrderedElements()); assertEquals("Different ordered iteration", expected, elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index b17049709..1699fe19d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java @@ -51,7 +51,7 @@ import org.junit.Ignore; @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { public void testIterator() { - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } @@ -60,7 +60,7 @@ public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { @CollectionFeature.Require(KNOWN_ORDER) public void testIterationOrdering() { - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } @@ -72,7 +72,7 @@ public class CollectionIteratorTester<E> extends AbstractCollectionTester<E> { @CollectionSize.Require(absent = ZERO) public void testIterator_nullElement() { initCollectionWithNullElement(); - List<E> iteratorElements = new ArrayList<E>(); + List<E> iteratorElements = new ArrayList<>(); for (E element : collection) { // uses iterator() iteratorElements.add(element); } diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java index 4808f5427..eb37a6013 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java @@ -42,11 +42,11 @@ import org.junit.Ignore; @Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. public class MapReplaceAllTester<K, V> extends AbstractMapTester<K, V> { private SampleElements<K> keys() { - return new SampleElements<K>(k0(), k1(), k2(), k3(), k4()); + return new SampleElements<>(k0(), k1(), k2(), k3(), k4()); } private SampleElements<V> values() { - return new SampleElements<V>(v0(), v1(), v2(), v3(), v4()); + return new SampleElements<>(v0(), v1(), v2(), v3(), v4()); } @MapFeature.Require(SUPPORTS_PUT) diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java index 39016169d..8b056b4cb 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java @@ -218,7 +218,7 @@ public class NavigableSetNavigationTester<E> extends AbstractSetTester<E> { @CollectionSize.Require(SEVERAL) public void testDescendingNavigation() { - List<E> descending = new ArrayList<E>(); + List<E> descending = new ArrayList<>(); for (Iterator<E> i = navigableSet.descendingIterator(); i.hasNext(); ) { descending.add(i.next()); } diff --git a/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java b/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java index 3920afe4c..31ac2015d 100644 --- a/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java +++ b/guava-testlib/src/com/google/common/escape/testing/EscaperAsserts.java @@ -18,7 +18,6 @@ package com.google.common.escape.testing; import static com.google.common.escape.Escapers.computeReplacement; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.CharEscaper; import com.google.common.escape.Escaper; @@ -32,7 +31,6 @@ import junit.framework.Assert; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible public final class EscaperAsserts { private EscaperAsserts() {} diff --git a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java index 962b15f6d..1e31bbfb4 100644 --- a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java +++ b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java @@ -116,12 +116,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { * @since 19.0 */ public static final Predicate<Class<?>> UNDERSCORE_IN_NAME = - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> c) { - return c.getSimpleName().contains("_"); - } - }; + (Class<?> c) -> c.getSimpleName().contains("_"); /* The names of the expected method that tests null checks. */ private static final ImmutableList<String> NULL_TEST_METHOD_NAMES = @@ -152,12 +147,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { private final ClassSanityTester tester = new ClassSanityTester(); private Visibility visibility = Visibility.PACKAGE; private Predicate<Class<?>> classFilter = - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> cls) { - return visibility.isVisible(cls.getModifiers()); - } - }; + (Class<?> cls) -> visibility.isVisible(cls.getModifiers()); /** * Restricts the sanity tests for public API only. By default, package-private API are also @@ -415,8 +405,8 @@ public abstract class AbstractPackageSanityTests extends TestCase { abstract static class Chopper { - final Chopper or(final Chopper you) { - final Chopper i = this; + final Chopper or(Chopper you) { + Chopper i = this; return new Chopper() { @Override Optional<String> chop(String str) { @@ -427,7 +417,7 @@ public abstract class AbstractPackageSanityTests extends TestCase { abstract Optional<String> chop(String str); - static Chopper suffix(final String suffix) { + static Chopper suffix(String suffix) { return new Chopper() { @Override Optional<String> chop(String str) { diff --git a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index f38c52e08..1325d7f8c 100644 --- a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.CharMatcher; import com.google.common.base.Charsets; @@ -74,6 +73,7 @@ import com.google.common.io.CharSource; import com.google.common.primitives.Primitives; import com.google.common.primitives.UnsignedInteger; import com.google.common.primitives.UnsignedLong; +import com.google.errorprone.annotations.Keep; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; @@ -171,7 +171,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Ben Yu * @since 12.0 */ -@Beta @GwtIncompatible public final class ArbitraryInstances { @@ -439,6 +438,7 @@ public final class ArbitraryInstances { } public static final class DeterministicRandom extends Random { + @Keep public DeterministicRandom() { super(0); } diff --git a/guava-testlib/src/com/google/common/testing/CollectorTester.java b/guava-testlib/src/com/google/common/testing/CollectorTester.java index 9478a1fd2..ab6e544d8 100644 --- a/guava-testlib/src/com/google/common/testing/CollectorTester.java +++ b/guava-testlib/src/com/google/common/testing/CollectorTester.java @@ -19,7 +19,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkNotNull; import static junit.framework.Assert.assertTrue; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.ArrayList; import java.util.Arrays; @@ -46,7 +45,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Louis Wasserman * @since 21.0 */ -@Beta @GwtCompatible public final class CollectorTester<T, A, R> { /** diff --git a/guava-testlib/src/com/google/common/testing/EqualsTester.java b/guava-testlib/src/com/google/common/testing/EqualsTester.java index 2c8e08b87..9c93c9a49 100644 --- a/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Equivalence; import com.google.common.collect.ImmutableList; @@ -74,7 +73,6 @@ import java.util.List; * @author Jige Yu * @since 10.0 */ -@Beta @GwtCompatible public final class EqualsTester { private static final int REPETITIONS = 3; @@ -122,7 +120,7 @@ public final class EqualsTester { assertTrue( item + " must not be Object#equals to an arbitrary object of another class", !item.equals(NotAnInstance.EQUAL_TO_NOTHING)); - assertEquals(item + " must be Object#equals to itself", item, item); + assertTrue(item + " must be Object#equals to itself", item.equals(item)); assertEquals( "the Object#hashCode of " + item + " must be consistent", item.hashCode(), diff --git a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ce1dc98c4..8de2625d0 100644 --- a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Equivalence; import com.google.common.collect.ImmutableList; @@ -49,7 +48,6 @@ import java.util.List; * @author Gregory Kick * @since 10.0 */ -@Beta @GwtCompatible public final class EquivalenceTester<T> { private static final int REPETITIONS = 3; @@ -60,12 +58,11 @@ public final class EquivalenceTester<T> { private EquivalenceTester(Equivalence<? super T> equivalence) { this.equivalence = checkNotNull(equivalence); - this.delegate = - new RelationshipTester<T>(equivalence, "equivalent", "hash", new ItemReporter()); + this.delegate = new RelationshipTester<>(equivalence, "equivalent", "hash", new ItemReporter()); } public static <T> EquivalenceTester<T> of(Equivalence<? super T> equivalence) { - return new EquivalenceTester<T>(equivalence); + return new EquivalenceTester<>(equivalence); } /** diff --git a/guava-testlib/src/com/google/common/testing/FakeTicker.java b/guava-testlib/src/com/google/common/testing/FakeTicker.java index cc18e6501..d18e6bce7 100644 --- a/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Ticker; @@ -36,7 +35,6 @@ import java.util.concurrent.atomic.AtomicLong; * @author Jige Yu * @since 10.0 */ -@Beta @GwtCompatible public class FakeTicker extends Ticker { diff --git a/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 4ee461eb2..605d3a055 100644 --- a/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -22,7 +22,6 @@ import static com.google.common.base.Throwables.throwIfUnchecked; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.fail; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Function; import com.google.common.base.Throwables; @@ -53,7 +52,6 @@ import java.util.concurrent.atomic.AtomicInteger; * @author Ben Yu * @since 14.0 */ -@Beta @GwtIncompatible public final class ForwardingWrapperTester { @@ -129,7 +127,7 @@ public final class ForwardingWrapperTester { private static <T> void testExceptionPropagation( Class<T> interfaceType, Method method, Function<? super T, ? extends T> wrapperFunction) { - final RuntimeException exception = new RuntimeException(); + RuntimeException exception = new RuntimeException(); T proxy = Reflection.newProxy( interfaceType, @@ -175,7 +173,7 @@ public final class ForwardingWrapperTester { private static Object[] getParameterValues(Method method) { FreshValueGenerator paramValues = new FreshValueGenerator(); - final List<Object> passedArgs = Lists.newArrayList(); + List<Object> passedArgs = Lists.newArrayList(); for (Class<?> paramType : method.getParameterTypes()) { passedArgs.add(paramValues.generateFresh(paramType)); } diff --git a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java index e34b3993a..bb51e408b 100644 --- a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java +++ b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java @@ -141,7 +141,7 @@ class FreshValueGenerator { builder.put(method.getReturnType(), method); } } - GENERATORS = builder.build(); + GENERATORS = builder.buildOrThrow(); } private static final ImmutableMap<Class<?>, Method> EMPTY_GENERATORS; @@ -153,7 +153,7 @@ class FreshValueGenerator { builder.put(method.getReturnType(), method); } } - EMPTY_GENERATORS = builder.build(); + EMPTY_GENERATORS = builder.buildOrThrow(); } private final AtomicInteger freshness = new AtomicInteger(1); diff --git a/guava-testlib/src/com/google/common/testing/GcFinalization.java b/guava-testlib/src/com/google/common/testing/GcFinalization.java index 015afea54..da6aa2211 100644 --- a/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -18,7 +18,6 @@ package com.google.common.testing; import static java.util.concurrent.TimeUnit.SECONDS; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.errorprone.annotations.DoNotMock; import com.google.j2objc.annotations.J2ObjCIncompatible; @@ -103,7 +102,6 @@ import java.util.concurrent.TimeoutException; * @author Martin Buchholz * @since 11.0 */ -@Beta @GwtIncompatible @J2ObjCIncompatible // gc public final class GcFinalization { @@ -138,8 +136,8 @@ public final class GcFinalization { if (future.isDone()) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (future.isDone()) { @@ -170,8 +168,8 @@ public final class GcFinalization { if (predicate.isDone()) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (predicate.isDone()) { @@ -198,8 +196,8 @@ public final class GcFinalization { if (latch.getCount() == 0) { return; } - final long timeoutSeconds = timeoutSeconds(); - final long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); + long timeoutSeconds = timeoutSeconds(); + long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds); do { System.runFinalization(); if (latch.getCount() == 0) { @@ -222,13 +220,14 @@ public final class GcFinalization { * Creates a garbage object that counts down the latch in its finalizer. Sequestered into a * separate method to make it somewhat more likely to be unreachable. */ - private static void createUnreachableLatchFinalizer(final CountDownLatch latch) { - new Object() { - @Override - protected void finalize() { - latch.countDown(); - } - }; + private static void createUnreachableLatchFinalizer(CountDownLatch latch) { + Object unused = + new Object() { + @Override + protected void finalize() { + latch.countDown(); + } + }; } /** @@ -263,7 +262,7 @@ public final class GcFinalization { * * @throws RuntimeException if timed out or interrupted while waiting */ - public static void awaitClear(final WeakReference<?> ref) { + public static void awaitClear(WeakReference<?> ref) { awaitDone( new FinalizationPredicate() { @Override @@ -296,9 +295,9 @@ public final class GcFinalization { * @since 12.0 */ public static void awaitFullGc() { - final CountDownLatch finalizerRan = new CountDownLatch(1); + CountDownLatch finalizerRan = new CountDownLatch(1); WeakReference<Object> ref = - new WeakReference<Object>( + new WeakReference<>( new Object() { @Override protected void finalize() { diff --git a/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 8986d15e1..3eb317605 100644 --- a/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -19,7 +19,6 @@ package com.google.common.testing; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Converter; import com.google.common.base.Objects; @@ -68,7 +67,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Kevin Bourrillion * @since 10.0 */ -@Beta @GwtIncompatible public final class NullPointerTester { diff --git a/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/guava-testlib/src/com/google/common/testing/RelationshipTester.java index 5adf01091..d5b9b6a18 100644 --- a/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -147,7 +147,7 @@ final class RelationshipTester<T> { } private Item<T> getItem(int groupNumber, int itemNumber) { - return new Item<T>(groups.get(groupNumber).get(itemNumber), groupNumber, itemNumber); + return new Item<>(groups.get(groupNumber).get(itemNumber), groupNumber, itemNumber); } static final class Item<T> { diff --git a/guava-testlib/src/com/google/common/testing/SerializableTester.java b/guava-testlib/src/com/google/common/testing/SerializableTester.java index 62980764d..c4e6d236e 100644 --- a/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -16,7 +16,6 @@ package com.google.common.testing; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import junit.framework.Assert; import junit.framework.AssertionFailedError; @@ -32,7 +31,6 @@ import junit.framework.AssertionFailedError; * @author Mike Bostock * @since 10.0 */ -@Beta @GwtCompatible // but no-op! public final class SerializableTester { private SerializableTester() {} @@ -52,7 +50,6 @@ public final class SerializableTester { * @throws RuntimeException if the specified object was not successfully serialized or * deserialized */ - @SuppressWarnings("unchecked") public static <T> T reserialize(T object) { return Platform.reserialize(object); } diff --git a/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/guava-testlib/src/com/google/common/testing/TestLogHandler.java index e63d11fa5..41dca2ec8 100644 --- a/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -16,7 +16,6 @@ package com.google.common.testing; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.ArrayList; import java.util.Collections; @@ -52,7 +51,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Kevin Bourrillion * @since 10.0 */ -@Beta @GwtCompatible public class TestLogHandler extends Handler { /** We will keep a private list of all logged records */ diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java b/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java index 2ba751537..b5bec2c09 100644 --- a/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java +++ b/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java @@ -16,6 +16,9 @@ package com.google.common.util.concurrent.testing; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.util.concurrent.ListenableFuture; @@ -68,21 +71,18 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertFalse(future.isDone()); assertFalse(future.isCancelled()); - final CountDownLatch successLatch = new CountDownLatch(1); - final Throwable[] badness = new Throwable[1]; + CountDownLatch successLatch = new CountDownLatch(1); + Throwable[] badness = new Throwable[1]; // Wait on the future in a separate thread. new Thread( - new Runnable() { - @Override - public void run() { - try { - assertSame(Boolean.TRUE, future.get()); - successLatch.countDown(); - } catch (Throwable t) { - t.printStackTrace(); - badness[0] = t; - } + () -> { + try { + assertSame(Boolean.TRUE, future.get()); + successLatch.countDown(); + } catch (Throwable t) { + t.printStackTrace(); + badness[0] = t; } }) .start(); @@ -90,7 +90,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { // Release the future value. latch.countDown(); - assertTrue(successLatch.await(10, TimeUnit.SECONDS)); + assertTrue(successLatch.await(10, SECONDS)); if (badness[0] != null) { throw badness[0]; @@ -105,7 +105,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { // The task thread waits for the latch, so we expect a timeout here. try { - future.get(20, TimeUnit.MILLISECONDS); + future.get(20, MILLISECONDS); fail("Should have timed out trying to get the value."); } catch (TimeoutException expected) { } finally { @@ -123,20 +123,17 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertFalse(future.isDone()); assertFalse(future.isCancelled()); - final CountDownLatch successLatch = new CountDownLatch(1); + CountDownLatch successLatch = new CountDownLatch(1); // Run cancellation in a separate thread as an extra thread-safety test. new Thread( - new Runnable() { - @Override - public void run() { - try { - future.get(); - } catch (CancellationException expected) { - successLatch.countDown(); - } catch (Exception ignored) { - // All other errors are ignored, we expect a cancellation. - } + () -> { + try { + future.get(); + } catch (CancellationException expected) { + successLatch.countDown(); + } catch (Exception ignored) { + // All other errors are ignored, we expect a cancellation. } }) .start(); @@ -149,37 +146,27 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertTrue(future.isDone()); assertTrue(future.isCancelled()); - assertTrue(successLatch.await(200, TimeUnit.MILLISECONDS)); + assertTrue(successLatch.await(200, MILLISECONDS)); latch.countDown(); } public void testListenersNotifiedOnError() throws Exception { - final CountDownLatch successLatch = new CountDownLatch(1); - final CountDownLatch listenerLatch = new CountDownLatch(1); + CountDownLatch successLatch = new CountDownLatch(1); + CountDownLatch listenerLatch = new CountDownLatch(1); ExecutorService exec = Executors.newCachedThreadPool(); - future.addListener( - new Runnable() { - @Override - public void run() { - listenerLatch.countDown(); - } - }, - exec); + future.addListener(listenerLatch::countDown, exec); new Thread( - new Runnable() { - @Override - public void run() { - try { - future.get(); - } catch (CancellationException expected) { - successLatch.countDown(); - } catch (Exception ignored) { - // No success latch count down. - } + () -> { + try { + future.get(); + } catch (CancellationException expected) { + successLatch.countDown(); + } catch (Exception ignored) { + // No success latch count down. } }) .start(); @@ -189,13 +176,13 @@ public abstract class AbstractListenableFutureTest extends TestCase { assertTrue(future.isCancelled()); assertTrue(future.isDone()); - assertTrue(successLatch.await(200, TimeUnit.MILLISECONDS)); - assertTrue(listenerLatch.await(200, TimeUnit.MILLISECONDS)); + assertTrue(successLatch.await(200, MILLISECONDS)); + assertTrue(listenerLatch.await(200, MILLISECONDS)); latch.countDown(); exec.shutdown(); - exec.awaitTermination(100, TimeUnit.MILLISECONDS); + exec.awaitTermination(100, MILLISECONDS); } /** @@ -209,7 +196,7 @@ public abstract class AbstractListenableFutureTest extends TestCase { ExecutorService exec = Executors.newCachedThreadPool(); int listenerCount = 20; - final CountDownLatch listenerLatch = new CountDownLatch(listenerCount); + CountDownLatch listenerLatch = new CountDownLatch(listenerCount); // Test that listeners added both before and after the value is available // get called correctly. @@ -217,31 +204,17 @@ public abstract class AbstractListenableFutureTest extends TestCase { // Right in the middle start up a thread to close the latch. if (i == 10) { - new Thread( - new Runnable() { - @Override - public void run() { - latch.countDown(); - } - }) - .start(); + new Thread(() -> latch.countDown()).start(); } - future.addListener( - new Runnable() { - @Override - public void run() { - listenerLatch.countDown(); - } - }, - exec); + future.addListener(listenerLatch::countDown, exec); } assertSame(Boolean.TRUE, future.get()); // Wait for the listener latch to complete. - listenerLatch.await(500, TimeUnit.MILLISECONDS); + listenerLatch.await(500, MILLISECONDS); exec.shutdown(); - exec.awaitTermination(500, TimeUnit.MILLISECONDS); + exec.awaitTermination(500, MILLISECONDS); } } diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java b/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java index fc3ed21f1..a2fe4f447 100644 --- a/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java +++ b/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java @@ -17,13 +17,13 @@ package com.google.common.util.concurrent.testing; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.util.concurrent.ListenableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; import junit.framework.Assert; /** @@ -59,7 +59,7 @@ public class MockFutureListener implements Runnable { */ public void assertSuccess(Object expectedData) throws Throwable { // Verify that the listener executed in a reasonable amount of time. - Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertTrue(countDownLatch.await(1L, SECONDS)); try { Assert.assertEquals(expectedData, future.get()); @@ -75,7 +75,7 @@ public class MockFutureListener implements Runnable { */ public void assertException(Throwable expectedCause) throws Exception { // Verify that the listener executed in a reasonable amount of time. - Assert.assertTrue(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertTrue(countDownLatch.await(1L, SECONDS)); try { future.get(); @@ -88,6 +88,6 @@ public class MockFutureListener implements Runnable { public void assertTimeout() throws Exception { // Verify that the listener does not get called in a reasonable amount of // time. - Assert.assertFalse(countDownLatch.await(1L, TimeUnit.SECONDS)); + Assert.assertFalse(countDownLatch.await(1L, SECONDS)); } } diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java b/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java index c232218fb..25b7ef791 100644 --- a/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java +++ b/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java @@ -140,11 +140,11 @@ class SameThreadScheduledExecutorService extends AbstractExecutorService @Override public <V> ListenableScheduledFuture<V> schedule( - final Callable<V> callable, long delay, TimeUnit unit) { + Callable<V> callable, long delay, TimeUnit unit) { Preconditions.checkNotNull(callable, "callable must not be null!"); Preconditions.checkNotNull(unit, "unit must not be null!"); ListenableFuture<V> delegateFuture = submit(callable); - return new ImmediateScheduledFuture<V>(delegateFuture); + return new ImmediateScheduledFuture<>(delegateFuture); } private static class ImmediateScheduledFuture<V> extends SimpleForwardingListenableFuture<V> diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java b/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java index 421243043..dc2c40d37 100644 --- a/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java +++ b/guava-testlib/src/com/google/common/util/concurrent/testing/TestingExecutors.java @@ -16,6 +16,8 @@ package com.google.common.util.concurrent.testing; +import static java.util.concurrent.TimeUnit.NANOSECONDS; + import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.ImmutableList; @@ -153,7 +155,7 @@ public final class TestingExecutors { implements ListenableScheduledFuture<V> { static <V> NeverScheduledFuture<V> create() { - return new NeverScheduledFuture<V>(); + return new NeverScheduledFuture<>(); } @Override @@ -163,7 +165,7 @@ public final class TestingExecutors { @Override public int compareTo(Delayed other) { - return Longs.compare(getDelay(TimeUnit.NANOSECONDS), other.getDelay(TimeUnit.NANOSECONDS)); + return Longs.compare(getDelay(NANOSECONDS), other.getDelay(NANOSECONDS)); } } } diff --git a/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java b/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java index dc0fe37b4..4d617d64d 100644 --- a/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java +++ b/guava-testlib/test/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilderTest.java @@ -27,7 +27,7 @@ import org.junit.Ignore; /** @author Max Ross */ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { - static boolean testWasRun; + private static boolean testWasRun; @Override protected void setUp() throws Exception { @@ -52,7 +52,7 @@ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { } public void testLifecycle() { - final boolean setUp[] = {false}; + boolean[] setUp = {false}; Runnable setUpRunnable = new Runnable() { @Override @@ -61,7 +61,7 @@ public class FeatureSpecificTestSuiteBuilderTest extends TestCase { } }; - final boolean tearDown[] = {false}; + boolean[] tearDown = {false}; Runnable tearDownRunnable = new Runnable() { @Override diff --git a/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java b/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java index d612b2c2c..865c198e7 100644 --- a/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java +++ b/guava-testlib/test/com/google/common/testing/EquivalenceTesterTest.java @@ -237,7 +237,7 @@ public class EquivalenceTesterTest extends TestCase { void replay() { checkRecording(); equivalentExpectations = equivalentExpectationsBuilder.build(); - hashExpectations = hashExpectationsBuilder.build(); + hashExpectations = hashExpectationsBuilder.buildOrThrow(); } @Override diff --git a/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java b/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java index f10b94ea6..cd8e24b1e 100644 --- a/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java +++ b/guava-tests/benchmark/com/google/common/collect/MapBenchmark.java @@ -139,7 +139,7 @@ public class MapBenchmark { for (Element element : keys) { builder.put(element, element); } - return builder.build(); + return builder.buildOrThrow(); } }, ImmutableSorted { diff --git a/guava-tests/pom.xml b/guava-tests/pom.xml index a40b092a3..b7728d8b1 100644 --- a/guava-tests/pom.xml +++ b/guava-tests/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> </parent> <artifactId>guava-tests</artifactId> <name>Guava Unit Tests</name> diff --git a/guava-tests/test/com/google/common/base/AbstractIteratorTest.java b/guava-tests/test/com/google/common/base/AbstractIteratorTest.java index da732bf54..ddb7d7097 100644 --- a/guava-tests/test/com/google/common/base/AbstractIteratorTest.java +++ b/guava-tests/test/com/google/common/base/AbstractIteratorTest.java @@ -205,7 +205,7 @@ public class AbstractIteratorTest extends TestCase { // hasNext/next), but we'll cop out for now, knowing that // next() both start by invoking hasNext() anyway. - /** Throws a undeclared checked exception. */ + /** Throws an undeclared checked exception. */ private static void sneakyThrow(Throwable t) { class SneakyThrower<T extends Throwable> { @SuppressWarnings("unchecked") // intentionally unsafe for test diff --git a/guava-tests/test/com/google/common/base/AsciiTest.java b/guava-tests/test/com/google/common/base/AsciiTest.java index d3a1f8f65..9e6b0e41a 100644 --- a/guava-tests/test/com/google/common/base/AsciiTest.java +++ b/guava-tests/test/com/google/common/base/AsciiTest.java @@ -54,8 +54,8 @@ public class AsciiTest extends TestCase { public void testCharsIgnored() { for (char c : IGNORED.toCharArray()) { String str = String.valueOf(c); - assertTrue(str, c == Ascii.toLowerCase(c)); - assertTrue(str, c == Ascii.toUpperCase(c)); + assertEquals(str, c, Ascii.toLowerCase(c)); + assertEquals(str, c, Ascii.toUpperCase(c)); assertFalse(str, Ascii.isLowerCase(c)); assertFalse(str, Ascii.isUpperCase(c)); } @@ -98,27 +98,26 @@ public class AsciiTest extends TestCase { } public void testTruncateIllegalArguments() { - String truncated = null; try { - truncated = Ascii.truncate("foobar", 2, "..."); + Ascii.truncate("foobar", 2, "..."); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", 8, "1234567890"); + Ascii.truncate("foobar", 8, "1234567890"); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", -1, "..."); + Ascii.truncate("foobar", -1, "..."); fail(); } catch (IllegalArgumentException expected) { } try { - truncated = Ascii.truncate("foobar", -1, ""); + Ascii.truncate("foobar", -1, ""); fail(); } catch (IllegalArgumentException expected) { } diff --git a/guava-tests/test/com/google/common/base/CharMatcherTest.java b/guava-tests/test/com/google/common/base/CharMatcherTest.java index 5412882c5..49bdbbaff 100644 --- a/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/guava-tests/test/com/google/common/base/CharMatcherTest.java @@ -386,7 +386,7 @@ public class CharMatcherTest extends TestCase { assertSame(s, matcher.replaceFrom(s, 'z')); assertSame(s, matcher.replaceFrom(s, "ZZ")); assertSame(s, matcher.trimFrom(s)); - assertSame(0, matcher.countIn(s)); + assertEquals(0, matcher.countIn(s)); } private void reallyTestMatchThenNoMatch(CharMatcher matcher, String s) { diff --git a/guava-tests/test/com/google/common/cache/LocalCacheTest.java b/guava-tests/test/com/google/common/cache/LocalCacheTest.java index ceecb5d73..db3b80015 100644 --- a/guava-tests/test/com/google/common/cache/LocalCacheTest.java +++ b/guava-tests/test/com/google/common/cache/LocalCacheTest.java @@ -229,7 +229,7 @@ public class LocalCacheTest extends TestCase { private Throwable popLoggedThrowable() { List<LogRecord> logRecords = logHandler.getStoredLogRecords(); - assertSame(1, logRecords.size()); + assertEquals(1, logRecords.size()); LogRecord logRecord = logRecords.get(0); logHandler.clear(); return logRecord.getThrown(); diff --git a/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 35922105f..a76907cda 100644 --- a/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java @@ -250,6 +250,7 @@ public class AbstractIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testCantRemove() { Iterator<Integer> iter = new AbstractIterator<Integer>() { diff --git a/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index 11c66a702..63c17deda 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java @@ -61,7 +61,8 @@ public class AbstractMapEntryTest extends TestCase { public void testEquals() { Entry<String, Integer> foo1 = entry("foo", 1); - assertEquals(foo1, foo1); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(foo1.equals(foo1)); assertEquals(control("foo", 1), foo1); assertEquals(control("bar", 2), entry("bar", 2)); assertFalse(control("foo", 1).equals(entry("foo", 2))); diff --git a/guava-tests/test/com/google/common/collect/CompactHashMapFloodingTest.java b/guava-tests/test/com/google/common/collect/CompactHashMapFloodingTest.java new file mode 100644 index 000000000..1a03163d2 --- /dev/null +++ b/guava-tests/test/com/google/common/collect/CompactHashMapFloodingTest.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.collect; + +import java.util.Map; + +public class CompactHashMapFloodingTest extends AbstractHashFloodingTest<Map<Object, Object>> { + public CompactHashMapFloodingTest() { + super( + ImmutableList.of(Construction.mapFromKeys(CompactHashMap::create)), + n -> n * Math.log(n), + ImmutableList.of(QueryOp.MAP_GET)); + } +} diff --git a/guava-tests/test/com/google/common/collect/CompactHashMapTest.java b/guava-tests/test/com/google/common/collect/CompactHashMapTest.java index 095b1c92e..8e175b47e 100644 --- a/guava-tests/test/com/google/common/collect/CompactHashMapTest.java +++ b/guava-tests/test/com/google/common/collect/CompactHashMapTest.java @@ -82,7 +82,6 @@ public class CompactHashMapTest extends TestCase { CollectionFeature.SUPPORTS_ITERATOR_REMOVE) .createTestSuite()); suite.addTestSuite(CompactHashMapTest.class); - suite.addTestSuite(FloodingTest.class); return suite; } @@ -141,12 +140,4 @@ public class CompactHashMapTest extends TestCase { } } - public static class FloodingTest extends AbstractHashFloodingTest<Map<Object, Object>> { - public FloodingTest() { - super( - ImmutableList.of(Construction.mapFromKeys(CompactHashMap::create)), - n -> n * Math.log(n), - ImmutableList.of(QueryOp.MAP_GET)); - } - } } diff --git a/guava-tests/test/com/google/common/collect/CompactHashSetFloodingTest.java b/guava-tests/test/com/google/common/collect/CompactHashSetFloodingTest.java new file mode 100644 index 000000000..53e9a6195 --- /dev/null +++ b/guava-tests/test/com/google/common/collect/CompactHashSetFloodingTest.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.collect; + +import java.util.Set; + +public class CompactHashSetFloodingTest extends AbstractHashFloodingTest<Set<Object>> { + public CompactHashSetFloodingTest() { + super( + ImmutableList.of(Construction.setFromElements(CompactHashSet::create)), + n -> n * Math.log(n), + ImmutableList.of(QueryOp.SET_CONTAINS)); + } +} diff --git a/guava-tests/test/com/google/common/collect/CompactHashSetTest.java b/guava-tests/test/com/google/common/collect/CompactHashSetTest.java index 6e2817ba0..f55f8d68a 100644 --- a/guava-tests/test/com/google/common/collect/CompactHashSetTest.java +++ b/guava-tests/test/com/google/common/collect/CompactHashSetTest.java @@ -53,7 +53,6 @@ public class CompactHashSetTest extends TestCase { TestSuite suite = new TestSuite(); suite.addTestSuite(CompactHashSetTest.class); - suite.addTestSuite(FloodingTest.class); suite.addTest( SetTestSuiteBuilder.using( new TestStringSetGenerator() { @@ -124,12 +123,4 @@ public class CompactHashSetTest extends TestCase { } } - public static class FloodingTest extends AbstractHashFloodingTest<Set<Object>> { - public FloodingTest() { - super( - ImmutableList.of(Construction.setFromElements(CompactHashSet::create)), - n -> n * Math.log(n), - ImmutableList.of(QueryOp.SET_CONTAINS)); - } - } } diff --git a/guava-tests/test/com/google/common/collect/CompactLinkedHashMapFloodingTest.java b/guava-tests/test/com/google/common/collect/CompactLinkedHashMapFloodingTest.java new file mode 100644 index 000000000..826fc82b7 --- /dev/null +++ b/guava-tests/test/com/google/common/collect/CompactLinkedHashMapFloodingTest.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.collect; + +import java.util.Map; + +public class CompactLinkedHashMapFloodingTest + extends AbstractHashFloodingTest<Map<Object, Object>> { + public CompactLinkedHashMapFloodingTest() { + super( + ImmutableList.of(Construction.mapFromKeys(CompactLinkedHashMap::create)), + n -> n * Math.log(n), + ImmutableList.of(QueryOp.MAP_GET)); + } +} diff --git a/guava-tests/test/com/google/common/collect/CompactLinkedHashMapTest.java b/guava-tests/test/com/google/common/collect/CompactLinkedHashMapTest.java index e8ba94c71..e2f86113a 100644 --- a/guava-tests/test/com/google/common/collect/CompactLinkedHashMapTest.java +++ b/guava-tests/test/com/google/common/collect/CompactLinkedHashMapTest.java @@ -82,7 +82,6 @@ public class CompactLinkedHashMapTest extends TestCase { CollectionFeature.KNOWN_ORDER) .createTestSuite()); suite.addTestSuite(CompactLinkedHashMapTest.class); - suite.addTestSuite(FloodingTest.class); return suite; } @@ -202,12 +201,4 @@ public class CompactLinkedHashMapTest extends TestCase { } } - public static class FloodingTest extends AbstractHashFloodingTest<Map<Object, Object>> { - public FloodingTest() { - super( - ImmutableList.of(Construction.mapFromKeys(CompactLinkedHashMap::create)), - n -> n * Math.log(n), - ImmutableList.of(QueryOp.MAP_GET)); - } - } } diff --git a/guava-tests/test/com/google/common/collect/CompactLinkedHashSetFloodingTest.java b/guava-tests/test/com/google/common/collect/CompactLinkedHashSetFloodingTest.java new file mode 100644 index 000000000..b8a5d9797 --- /dev/null +++ b/guava-tests/test/com/google/common/collect/CompactLinkedHashSetFloodingTest.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.collect; + +import java.util.Set; + +public class CompactLinkedHashSetFloodingTest extends AbstractHashFloodingTest<Set<Object>> { + public CompactLinkedHashSetFloodingTest() { + super( + ImmutableList.of(Construction.setFromElements(CompactLinkedHashSet::create)), + n -> n * Math.log(n), + ImmutableList.of(QueryOp.SET_CONTAINS)); + } +} diff --git a/guava-tests/test/com/google/common/collect/CompactLinkedHashSetTest.java b/guava-tests/test/com/google/common/collect/CompactLinkedHashSetTest.java index dba9a7312..ee8f40873 100644 --- a/guava-tests/test/com/google/common/collect/CompactLinkedHashSetTest.java +++ b/guava-tests/test/com/google/common/collect/CompactLinkedHashSetTest.java @@ -54,7 +54,6 @@ public class CompactLinkedHashSetTest extends TestCase { TestSuite suite = new TestSuite(); suite.addTestSuite(CompactLinkedHashSetTest.class); - suite.addTestSuite(FloodingTest.class); suite.addTest( SetTestSuiteBuilder.using( new TestStringSetGenerator() { @@ -106,12 +105,4 @@ public class CompactLinkedHashSetTest extends TestCase { } } - public static class FloodingTest extends AbstractHashFloodingTest<Set<Object>> { - public FloodingTest() { - super( - ImmutableList.of(Construction.setFromElements(CompactLinkedHashSet::create)), - n -> n * Math.log(n), - ImmutableList.of(QueryOp.SET_CONTAINS)); - } - } } diff --git a/guava-tests/test/com/google/common/collect/ForwardingMapTest.java b/guava-tests/test/com/google/common/collect/ForwardingMapTest.java index cc5d73967..cf2ed0d3b 100644 --- a/guava-tests/test/com/google/common/collect/ForwardingMapTest.java +++ b/guava-tests/test/com/google/common/collect/ForwardingMapTest.java @@ -170,7 +170,7 @@ public class ForwardingMapTest extends TestCase { for (Entry<String, String> entry : entries) { builder.put(entry.getKey(), entry.getValue()); } - return new StandardImplForwardingMap<>(builder.build()); + return new StandardImplForwardingMap<>(builder.buildOrThrow()); } }) .named("ForwardingMap[ImmutableMap] with standard implementations") diff --git a/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index fa0a7c104..780dc37c0 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java @@ -354,6 +354,7 @@ public class ImmutableBiMapTest extends TestCase { } } + @SuppressWarnings("AlwaysThrows") public void testPuttingTheSameKeyTwiceThrowsOnBuild() { Builder<String, Integer> builder = new Builder<String, Integer>() @@ -587,6 +588,7 @@ public class ImmutableBiMapTest extends TestCase { } } + @SuppressWarnings("AlwaysThrows") public void testOfWithDuplicateKey() { try { ImmutableBiMap.of("one", 1, "one", 1); @@ -671,7 +673,7 @@ public class ImmutableBiMapTest extends TestCase { .put("three", 3) .put("four", 4) .put("five", 5) - .build()); + .buildOrThrow()); assertMapEquals(bimap, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); assertMapEquals(bimap.inverse(), 1, "one", 2, "two", 3, "three", 4, "four", 5, "five"); } @@ -683,13 +685,14 @@ public class ImmutableBiMapTest extends TestCase { .put("two", 2) .put("uno", 1) .put("dos", 2) - .build(); + .buildOrThrow(); try { ImmutableBiMap.copyOf(map); fail(); } catch (IllegalArgumentException expected) { - assertThat(expected.getMessage()).contains("1"); + assertThat(expected.getMessage()).containsMatch("1|2"); + // We don't specify which of the two dups should be reported. } } @@ -721,6 +724,7 @@ public class ImmutableBiMapTest extends TestCase { public static class BiMapSpecificTests extends TestCase { + @SuppressWarnings("DoNotCall") public void testForcePut() { BiMap<String, Integer> bimap = ImmutableBiMap.copyOf(ImmutableMap.of("one", 1, "two", 2)); try { @@ -780,11 +784,11 @@ public class ImmutableBiMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } public static class FloodingTest extends AbstractHashFloodingTest<BiMap<Object, Object>> { diff --git a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index 18a17a00e..63ce08a9c 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -65,6 +65,8 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.Test; @@ -78,6 +80,7 @@ import junit.framework.TestSuite; * @author Jesse Wilson */ @GwtCompatible(emulated = true) +@SuppressWarnings("AlwaysThrows") public class ImmutableMapTest extends TestCase { @GwtIncompatible // suite @@ -208,7 +211,7 @@ public class ImmutableMapTest extends TestCase { throw new UnsupportedOperationException(); } - private static final Joiner joiner = Joiner.on(", "); + private static final Joiner JOINER = Joiner.on(", "); @Override protected void assertMoreInvariants(Map<K, V> map) { @@ -217,10 +220,10 @@ public class ImmutableMapTest extends TestCase { assertEquals(entry.getKey() + "=" + entry.getValue(), entry.toString()); } - assertEquals("{" + joiner.join(map.entrySet()) + "}", map.toString()); - assertEquals("[" + joiner.join(map.entrySet()) + "]", map.entrySet().toString()); - assertEquals("[" + joiner.join(map.keySet()) + "]", map.keySet().toString()); - assertEquals("[" + joiner.join(map.values()) + "]", map.values().toString()); + assertEquals("{" + JOINER.join(map.entrySet()) + "}", map.toString()); + assertEquals("[" + JOINER.join(map.entrySet()) + "]", map.entrySet().toString()); + assertEquals("[" + JOINER.join(map.keySet()) + "]", map.keySet().toString()); + assertEquals("[" + JOINER.join(map.values()) + "]", map.values().toString()); assertEquals(MinimalSet.from(map.entrySet()), map.entrySet()); assertEquals(Sets.newHashSet(map.keySet()), map.keySet()); @@ -348,12 +351,13 @@ public class ImmutableMapTest extends TestCase { public static class CreationTests extends TestCase { public void testEmptyBuilder() { - ImmutableMap<String, Integer> map = new Builder<String, Integer>().build(); + ImmutableMap<String, Integer> map = new Builder<String, Integer>().buildOrThrow(); assertEquals(Collections.<String, Integer>emptyMap(), map); } public void testSingletonBuilder() { - ImmutableMap<String, Integer> map = new Builder<String, Integer>().put("one", 1).build(); + ImmutableMap<String, Integer> map = + new Builder<String, Integer>().put("one", 1).buildOrThrow(); assertMapEquals(map, "one", 1); } @@ -365,7 +369,7 @@ public class ImmutableMapTest extends TestCase { .put("three", 3) .put("four", 4) .put("five", 5) - .build(); + .buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } @@ -378,7 +382,7 @@ public class ImmutableMapTest extends TestCase { } Entry<Integer, Integer>[] builderArrayAfterPuts = builder.entries; RegularImmutableMap<Integer, Integer> map = - (RegularImmutableMap<Integer, Integer>) builder.build(); + (RegularImmutableMap<Integer, Integer>) builder.buildOrThrow(); Entry<Integer, Integer>[] mapInternalArray = map.entries; assertSame(builderArray, builderArrayAfterPuts); assertSame(builderArray, mapInternalArray); @@ -393,16 +397,16 @@ public class ImmutableMapTest extends TestCase { .put("five", 5) .put("four", 4) .put("two", 2) - .build(); + .buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } public void testBuilder_orderEntriesByValueAfterExactSizeBuild() { Builder<String, Integer> builder = new Builder<String, Integer>(2).put("four", 4).put("one", 1); - ImmutableMap<String, Integer> keyOrdered = builder.build(); + ImmutableMap<String, Integer> keyOrdered = builder.buildOrThrow(); ImmutableMap<String, Integer> valueOrdered = - builder.orderEntriesByValue(Ordering.natural()).build(); + builder.orderEntriesByValue(Ordering.natural()).buildOrThrow(); assertMapEquals(keyOrdered, "four", 4, "one", 1); assertMapEquals(valueOrdered, "one", 1, "four", 4); } @@ -417,9 +421,45 @@ public class ImmutableMapTest extends TestCase { } } + @GwtIncompatible // we haven't implemented this + public void testBuilder_orderEntriesByValue_keepingLast() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .orderEntriesByValue(Ordering.natural()) + .put("three", 3) + .put("one", 1) + .put("five", 5) + .put("four", 3) + .put("four", 5) + .put("four", 4) // this should win because it's last + .put("two", 2); + assertMapEquals( + builder.buildKeepingLast(), "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + } + } + + @GwtIncompatible // we haven't implemented this + public void testBuilder_orderEntriesByValue_keepingLast_builderSizeFieldPreserved() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .orderEntriesByValue(Ordering.natural()) + .put("one", 1) + .put("one", 1); + assertMapEquals(builder.buildKeepingLast(), "one", 1); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + } + } + public void testBuilder_withImmutableEntry() { ImmutableMap<String, Integer> map = - new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).build(); + new Builder<String, Integer>().put(Maps.immutableEntry("one", 1)).buildOrThrow(); assertMapEquals(map, "one", 1); } @@ -460,12 +500,14 @@ public class ImmutableMapTest extends TestCase { builder.put(entry); holder.string = "two"; - assertMapEquals(builder.build(), "one", 1); + assertMapEquals(builder.buildOrThrow(), "one", 1); } public void testBuilderPutAllWithEmptyMap() { ImmutableMap<String, Integer> map = - new Builder<String, Integer>().putAll(Collections.<String, Integer>emptyMap()).build(); + new Builder<String, Integer>() + .putAll(Collections.<String, Integer>emptyMap()) + .buildOrThrow(); assertEquals(Collections.<String, Integer>emptyMap(), map); } @@ -479,14 +521,14 @@ public class ImmutableMapTest extends TestCase { moreToPut.put("five", 5); ImmutableMap<String, Integer> map = - new Builder<String, Integer>().putAll(toPut).putAll(moreToPut).build(); + new Builder<String, Integer>().putAll(toPut).putAll(moreToPut).buildOrThrow(); assertMapEquals(map, "one", 1, "two", 2, "three", 3, "four", 4, "five", 5); } public void testBuilderReuse() { Builder<String, Integer> builder = new Builder<>(); - ImmutableMap<String, Integer> mapOne = builder.put("one", 1).put("two", 2).build(); - ImmutableMap<String, Integer> mapTwo = builder.put("three", 3).put("four", 4).build(); + ImmutableMap<String, Integer> mapOne = builder.put("one", 1).put("two", 2).buildOrThrow(); + ImmutableMap<String, Integer> mapTwo = builder.put("three", 3).put("four", 4).buildOrThrow(); assertMapEquals(mapOne, "one", 1, "two", 2); assertMapEquals(mapTwo, "one", 1, "two", 2, "three", 3, "four", 4); @@ -500,7 +542,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } public void testBuilderPutImmutableEntryWithNullKeyFailsAtomically() { @@ -511,7 +553,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } // for GWT compatibility @@ -543,7 +585,7 @@ public class ImmutableMapTest extends TestCase { } catch (NullPointerException expected) { } builder.put("foo", 2); - assertMapEquals(builder.build(), "foo", 2); + assertMapEquals(builder.buildOrThrow(), "foo", 2); } public void testBuilderPutNullKey() { @@ -586,15 +628,154 @@ public class ImmutableMapTest extends TestCase { Builder<String, Integer> builder = new Builder<String, Integer>() .put("one", 1) - .put("one", 1); // throwing on this line would be even better + .put("one", 1); // throwing on this line might be better but it's too late to change try { - builder.build(); + builder.buildOrThrow(); fail(); } catch (IllegalArgumentException expected) { } } + public void testBuildKeepingLast_allowsOverwrite() { + Builder<Integer, String> builder = + new Builder<Integer, String>() + .put(1, "un") + .put(2, "deux") + .put(70, "soixante-dix") + .put(70, "septante") + .put(70, "seventy") + .put(1, "one") + .put(2, "two"); + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertMapEquals(map, 1, "one", 2, "two", 70, "seventy"); + } + + public void testBuildKeepingLast_smallTableSameHash() { + String key1 = "QED"; + String key2 = "R&D"; + assertThat(key1.hashCode()).isEqualTo(key2.hashCode()); + ImmutableMap<String, Integer> map = + ImmutableMap.<String, Integer>builder() + .put(key1, 1) + .put(key2, 2) + .put(key1, 3) + .put(key2, 4) + .buildKeepingLast(); + assertMapEquals(map, key1, 3, key2, 4); + } + + // The java7 branch has different code depending on whether the entry indexes fit in a byte, + // short, or int. The small table in testBuildKeepingLast_allowsOverwrite will test the byte + // case. This method tests the short case. + public void testBuildKeepingLast_shortTable() { + Builder<Integer, String> builder = ImmutableMap.builder(); + Map<Integer, String> expected = new LinkedHashMap<>(); + for (int i = 0; i < 1000; i++) { + // Truncate to even key, so we have put(0, "0") then put(0, "1"). Half the entries are + // duplicates. + Integer key = i & ~1; + String value = String.valueOf(i); + builder.put(key, value); + expected.put(key, value); + } + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertThat(map).hasSize(500); + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); + } + + // This method tests the int case. + public void testBuildKeepingLast_bigTable() { + Builder<Integer, String> builder = ImmutableMap.builder(); + Map<Integer, String> expected = new LinkedHashMap<>(); + for (int i = 0; i < 200_000; i++) { + // Truncate to even key, so we have put(0, "0") then put(0, "1"). Half the entries are + // duplicates. + Integer key = i & ~1; + String value = String.valueOf(i); + builder.put(key, value); + expected.put(key, value); + } + ImmutableMap<Integer, String> map = builder.buildKeepingLast(); + assertThat(map).hasSize(100_000); + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); + } + + private static class ClassWithTerribleHashCode + implements Comparable<ClassWithTerribleHashCode> { + private final int value; + + ClassWithTerribleHashCode(int value) { + this.value = value; + } + + @Override + public int compareTo(ClassWithTerribleHashCode that) { + return Integer.compare(this.value, that.value); + } + + @Override + public boolean equals(Object x) { + return x instanceof ClassWithTerribleHashCode + && ((ClassWithTerribleHashCode) x).value == value; + } + + @Override + public int hashCode() { + return 23; + } + + @Override + public String toString() { + return "ClassWithTerribleHashCode(" + value + ")"; + } + } + + @GwtIncompatible + public void testBuildKeepingLast_collisions() { + Map<ClassWithTerribleHashCode, Integer> expected = new LinkedHashMap<>(); + Builder<ClassWithTerribleHashCode, Integer> builder = new Builder<>(); + int size = RegularImmutableMap.MAX_HASH_BUCKET_LENGTH + 10; + for (int i = 0; i < size; i++) { + ClassWithTerribleHashCode key = new ClassWithTerribleHashCode(i); + builder.put(key, i); + builder.put(key, -i); + expected.put(key, -i); + } + ImmutableMap<ClassWithTerribleHashCode, Integer> map = builder.buildKeepingLast(); + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); + assertThat(map).isInstanceOf(JdkBackedImmutableMap.class); + } + + @GwtIncompatible // Pattern, Matcher + public void testBuilder_keepingLast_thenOrThrow() { + ImmutableMap.Builder<String, Integer> builder = + new Builder<String, Integer>() + .put("three", 3) + .put("one", 1) + .put("five", 5) + .put("four", 3) + .put("four", 5) + .put("four", 4) // this should win because it's last + .put("two", 2); + assertMapEquals( + builder.buildKeepingLast(), "three", 3, "one", 1, "five", 5, "four", 4, "two", 2); + try { + builder.buildOrThrow(); + fail("Expected exception from duplicate keys"); + } catch (IllegalArgumentException expected) { + // We don't really care which values the exception message contains, but they should be + // different from each other. If buildKeepingLast() collapsed duplicates, that might end up + // not being true. + Pattern pattern = + Pattern.compile("Multiple entries with same key: four=(.*) and four=(.*)"); + assertThat(expected).hasMessageThat().matches(pattern); + Matcher matcher = pattern.matcher(expected.getMessage()); + assertThat(matcher.matches()).isTrue(); + assertThat(matcher.group(1)).isNotEqualTo(matcher.group(2)); + } + } + public void testOf() { assertMapEquals(ImmutableMap.of("one", 1), "one", 1); assertMapEquals(ImmutableMap.of("one", 1, "two", 2), "one", 1, "two", 2); @@ -894,12 +1075,11 @@ public class ImmutableMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - assertEquals(map.size(), alternatingKeysAndValues.length / 2); - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } private static class IntHolder implements Serializable { @@ -969,7 +1149,8 @@ public class ImmutableMapTest extends TestCase { Entry<String, NonSerializableClass>[] entries = arrayOf(ImmutableMap.entryOf("one", new NonSerializableClass())); - Map<String, NonSerializableClass> map = JdkBackedImmutableMap.create(1, entries); + ImmutableMap<String, NonSerializableClass> map = + JdkBackedImmutableMap.create(1, entries, /* throwIfDuplicateKeys= */ true); Set<String> set = map.keySet(); LenientSerializableTester.reserializeAndAssertLenient(set); @@ -993,7 +1174,8 @@ public class ImmutableMapTest extends TestCase { Entry<NonSerializableClass, String>[] entries = arrayOf(ImmutableMap.entryOf(new NonSerializableClass(), "value")); - Map<NonSerializableClass, String> map = JdkBackedImmutableMap.create(1, entries); + ImmutableMap<NonSerializableClass, String> map = + JdkBackedImmutableMap.create(1, entries, /* throwIfDuplicateKeys= */ true); Collection<String> collection = map.values(); LenientSerializableTester.reserializeAndAssertElementsEqual(collection); @@ -1041,7 +1223,8 @@ public class ImmutableMapTest extends TestCase { entries[i] = ImmutableMap.entryOf(i, i); } - ImmutableMap<Integer, Integer> map = JdkBackedImmutableMap.create(entries.length, entries); + ImmutableMap<Integer, Integer> map = + JdkBackedImmutableMap.create(entries.length, entries, /* throwIfDuplicateKeys= */ true); Set<Integer> keySet = map.keySet(); Collection<Integer> values = map.values(); @@ -1074,57 +1257,60 @@ public class ImmutableMapTest extends TestCase { .put(4, 4) .put(5, 5) .put(6, 6) - .build(); + .buildOrThrow(); assertNotNull(map.keySet().spliterator().trySplit()); } public void testEquals() { new EqualsTester() .addEqualityGroup( - ImmutableMap.of(), ImmutableMap.builder().build(), ImmutableMap.ofEntries(), map()) + ImmutableMap.of(), + ImmutableMap.builder().buildOrThrow(), + ImmutableMap.ofEntries(), + map()) .addEqualityGroup( ImmutableMap.of(1, 1), - ImmutableMap.builder().put(1, 1).build(), + ImmutableMap.builder().put(1, 1).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1)), map(1, 1)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2), - ImmutableMap.builder().put(1, 1).put(2, 2).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2)), map(1, 1, 2, 2)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3)), map(1, 1, 2, 2, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 4, 2, 2, 3, 3), - ImmutableMap.builder().put(1, 4).put(2, 2).put(3, 3).build(), + ImmutableMap.builder().put(1, 4).put(2, 2).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 4), entry(2, 2), entry(3, 3)), map(1, 4, 2, 2, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 4, 3, 3), - ImmutableMap.builder().put(1, 1).put(2, 4).put(3, 3).build(), + ImmutableMap.builder().put(1, 1).put(2, 4).put(3, 3).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 4), entry(3, 3)), map(1, 1, 2, 4, 3, 3)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 4), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 4).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 4).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 4)), map(1, 1, 2, 2, 3, 4)) .addEqualityGroup( ImmutableMap.of(1, 2, 2, 3, 3, 1), - ImmutableMap.builder().put(1, 2).put(2, 3).put(3, 1).build(), + ImmutableMap.builder().put(1, 2).put(2, 3).put(3, 1).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 2), entry(2, 3), entry(3, 1)), map(1, 2, 2, 3, 3, 1)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3, 4, 4), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3), entry(4, 4)), map(1, 1, 2, 2, 3, 3, 4, 4)) .addEqualityGroup( ImmutableMap.of(1, 1, 2, 2, 3, 3, 4, 4, 5, 5), - ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).put(5, 5).build(), + ImmutableMap.builder().put(1, 1).put(2, 2).put(3, 3).put(4, 4).put(5, 5).buildOrThrow(), ImmutableMap.ofEntries(entry(1, 1), entry(2, 2), entry(3, 3), entry(4, 4), entry(5, 5)), map(1, 1, 2, 2, 3, 3, 4, 4, 5, 5)) .testEquals(); @@ -1176,7 +1362,7 @@ public class ImmutableMapTest extends TestCase { Arrays.asList( new AbstractMap.SimpleEntry<>("a", "1"), new AbstractMap.SimpleEntry<>("b", "2")); ImmutableMap<String, String> map = - ImmutableMap.<String, String>builder().putAll(entryList).build(); + ImmutableMap.<String, String>builder().putAll(entryList).buildOrThrow(); assertThat(map).containsExactly("a", "1", "b", "2").inOrder(); entryList.get(0).setValue("3"); assertThat(map).containsExactly("a", "1", "b", "2").inOrder(); @@ -1229,7 +1415,7 @@ public class ImmutableMapTest extends TestCase { for (Object k : keys) { builder.put(k, "dummy value"); } - return builder.build(); + return builder.buildOrThrow(); } }, BUILDER_PUT_ENTRIES_ONE_BY_ONE { @@ -1239,7 +1425,7 @@ public class ImmutableMapTest extends TestCase { for (Object k : keys) { builder.put(Maps.immutableEntry(k, "dummy value")); } - return builder.build(); + return builder.buildOrThrow(); } }, BUILDER_PUT_ALL_MAP { @@ -1251,7 +1437,7 @@ public class ImmutableMapTest extends TestCase { throw new UnsupportedOperationException("duplicate key"); } } - return ImmutableMap.builder().putAll(sourceMap).build(); + return ImmutableMap.builder().putAll(sourceMap).buildOrThrow(); } }, BUILDER_PUT_ALL_ENTRIES { @@ -1259,7 +1445,7 @@ public class ImmutableMapTest extends TestCase { public Map<Object, Object> create(List<?> keys) { return ImmutableMap.builder() .putAll(Lists.transform(keys, k -> Maps.immutableEntry(k, "dummy value"))) - .build(); + .buildOrThrow(); } }, FORCE_JDK { diff --git a/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java b/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java index 1e365e28e..1fe56c7cc 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableRangeSetTest.java @@ -313,6 +313,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { assertEquals(expectedComplement, rangeSet.complement()); } + @SuppressWarnings("DoNotCall") public void testAddUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -328,6 +329,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testAddAllUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -343,6 +345,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testRemoveUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() @@ -358,6 +361,7 @@ public class ImmutableRangeSetTest extends AbstractRangeSetTest { } } + @SuppressWarnings("DoNotCall") public void testRemoveAllUnsupported() { RangeSet<Integer> rangeSet = ImmutableRangeSet.<Integer>builder() diff --git a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index 2136f2a38..1de9e6972 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -62,6 +62,7 @@ import junit.framework.TestSuite; * @author Jared Levy */ @GwtCompatible(emulated = true) +@SuppressWarnings("AlwaysThrows") public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest @@ -904,12 +905,11 @@ public class ImmutableSortedMapTest extends TestCase { } private static <K, V> void assertMapEquals(Map<K, V> map, Object... alternatingKeysAndValues) { - assertEquals(map.size(), alternatingKeysAndValues.length / 2); - int i = 0; - for (Entry<K, V> entry : map.entrySet()) { - assertEquals(alternatingKeysAndValues[i++], entry.getKey()); - assertEquals(alternatingKeysAndValues[i++], entry.getValue()); + Map<Object, Object> expected = new LinkedHashMap<>(); + for (int i = 0; i < alternatingKeysAndValues.length; i += 2) { + expected.put(alternatingKeysAndValues[i], alternatingKeysAndValues[i + 1]); } + assertThat(map).containsExactlyEntriesIn(expected).inOrder(); } private static class IntHolder implements Serializable { diff --git a/guava-tests/test/com/google/common/collect/IteratorsTest.java b/guava-tests/test/com/google/common/collect/IteratorsTest.java index 15f7ccc20..e71c8bd51 100644 --- a/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/guava-tests/test/com/google/common/collect/IteratorsTest.java @@ -74,6 +74,7 @@ public class IteratorsTest extends TestCase { return suite; } + @SuppressWarnings("DoNotCall") public void testEmptyIterator() { Iterator<String> iterator = Iterators.emptyIterator(); assertFalse(iterator.hasNext()); @@ -89,6 +90,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testEmptyListIterator() { ListIterator<String> iterator = Iterators.emptyListIterator(); assertFalse(iterator.hasNext()); @@ -1119,6 +1121,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testForArrayTypical() { String[] array = {"foo", "bar"}; Iterator<String> iterator = Iterators.forArray(array); @@ -1205,6 +1208,7 @@ public class IteratorsTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testForEnumerationSingleton() { Enumeration<Integer> enumer = enumerate(1); Iterator<Integer> iter = Iterators.forEnumeration(enumer); diff --git a/guava-tests/test/com/google/common/collect/ListsTest.java b/guava-tests/test/com/google/common/collect/ListsTest.java index ef90e5493..33736d6d8 100644 --- a/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/guava-tests/test/com/google/common/collect/ListsTest.java @@ -619,14 +619,14 @@ public class ListsTest extends TestCase { public void testCartesianProduct_indexOf() { List<List<Integer>> actual = Lists.cartesianProduct(list(1, 2), list(3, 4)); - assertEquals(actual.indexOf(list(1, 3)), 0); - assertEquals(actual.indexOf(list(1, 4)), 1); - assertEquals(actual.indexOf(list(2, 3)), 2); - assertEquals(actual.indexOf(list(2, 4)), 3); - assertEquals(actual.indexOf(list(3, 1)), -1); - - assertEquals(actual.indexOf(list(1)), -1); - assertEquals(actual.indexOf(list(1, 1, 1)), -1); + assertEquals(0, actual.indexOf(list(1, 3))); + assertEquals(1, actual.indexOf(list(1, 4))); + assertEquals(2, actual.indexOf(list(2, 3))); + assertEquals(3, actual.indexOf(list(2, 4))); + assertEquals(-1, actual.indexOf(list(3, 1))); + + assertEquals(-1, actual.indexOf(list(1))); + assertEquals(-1, actual.indexOf(list(1, 1, 1))); } public void testCartesianProduct_lastIndexOf() { diff --git a/guava-tests/test/com/google/common/collect/MapMakerTest.java b/guava-tests/test/com/google/common/collect/MapMakerTest.java index 4b54f0dd5..9669ded7c 100644 --- a/guava-tests/test/com/google/common/collect/MapMakerTest.java +++ b/guava-tests/test/com/google/common/collect/MapMakerTest.java @@ -57,31 +57,28 @@ public class MapMakerTest extends TestCase { * anywhere else */ - /** Tests for the builder. */ - public static class MakerTest extends TestCase { - public void testInitialCapacity_negative() { - MapMaker maker = new MapMaker(); - try { - maker.initialCapacity(-1); - fail(); - } catch (IllegalArgumentException expected) { - } + public void testInitialCapacity_negative() { + MapMaker maker = new MapMaker(); + try { + maker.initialCapacity(-1); + fail(); + } catch (IllegalArgumentException expected) { } + } - // TODO(cpovirk): enable when ready - public void xtestInitialCapacity_setTwice() { - MapMaker maker = new MapMaker().initialCapacity(16); - try { - // even to the same value is not allowed - maker.initialCapacity(16); - fail(); - } catch (IllegalArgumentException expected) { - } + // TODO(cpovirk): enable when ready (apparently after a change to our GWT emulation) + public void xtestInitialCapacity_setTwice() { + MapMaker maker = new MapMaker().initialCapacity(16); + try { + // even to the same value is not allowed + maker.initialCapacity(16); + fail(); + } catch (IllegalStateException expected) { } + } - public void testReturnsPlainConcurrentHashMapWhenPossible() { - Map<?, ?> map = new MapMaker().initialCapacity(5).makeMap(); - assertTrue(map instanceof ConcurrentHashMap); - } + public void testReturnsPlainConcurrentHashMapWhenPossible() { + Map<?, ?> map = new MapMaker().initialCapacity(5).makeMap(); + assertTrue(map instanceof ConcurrentHashMap); } } diff --git a/guava-tests/test/com/google/common/collect/MapsTest.java b/guava-tests/test/com/google/common/collect/MapsTest.java index 76394c883..50df8cc5f 100644 --- a/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/guava-tests/test/com/google/common/collect/MapsTest.java @@ -1153,8 +1153,8 @@ public class MapsTest extends TestCase { biMap.put("two", 2); Converter<String, Integer> converter = Maps.asConverter(biMap); - assertSame(1, converter.convert("one")); - assertSame(2, converter.convert("two")); + assertEquals((Integer) 1, converter.convert("one")); + assertEquals((Integer) 2, converter.convert("two")); try { converter.convert("three"); fail(); @@ -1163,9 +1163,9 @@ public class MapsTest extends TestCase { biMap.put("three", 3); - assertSame(1, converter.convert("one")); - assertSame(2, converter.convert("two")); - assertSame(3, converter.convert("three")); + assertEquals((Integer) 1, converter.convert("one")); + assertEquals((Integer) 2, converter.convert("two")); + assertEquals((Integer) 3, converter.convert("three")); } public void testAsConverter_withNullMapping() throws Exception { @@ -1231,6 +1231,51 @@ public class MapsTest extends TestCase { fail("UnsupportedOperationException expected"); } catch (UnsupportedOperationException expected) { } + try { + unmod.replaceAll((k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.putIfAbsent(3, "three"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.replace(3, "three", "four"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.replace(3, "four"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.computeIfAbsent(3, (k) -> k + "three"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.computeIfPresent(4, (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.compute(4, (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.merge(4, "four", (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.clear(); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } /* UnsupportedOperationException on indirect modifications. */ BiMap<String, Number> inverse = unmod.inverse(); @@ -1857,6 +1902,51 @@ public class MapsTest extends TestCase { fail("UnsupportedOperationException expected"); } catch (UnsupportedOperationException expected) { } + try { + unmod.replaceAll((k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.putIfAbsent(3, "three"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.replace(3, "three", "four"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.replace(3, "four"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.computeIfAbsent(3, (k) -> k + "three"); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.computeIfPresent(4, (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.compute(4, (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.merge(4, "four", (k, v) -> v); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } + try { + unmod.clear(); + fail("UnsupportedOperationException expected"); + } catch (UnsupportedOperationException expected) { + } } @GwtIncompatible // NavigableMap diff --git a/guava-tests/test/com/google/common/collect/MultimapsTest.java b/guava-tests/test/com/google/common/collect/MultimapsTest.java index 6fa9c3c8b..738ba10dd 100644 --- a/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -667,7 +667,8 @@ public class MultimapsTest extends TestCase { assertEquals("[3, 1, 4]", ummodifiable.get(Color.BLUE).toString()); Collection<Integer> collection = multimap.get(Color.BLUE); - assertEquals(collection, collection); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(collection.equals(collection)); assertFalse(multimap.keySet() instanceof SortedSet); assertFalse(multimap.asMap() instanceof SortedMap); diff --git a/guava-tests/test/com/google/common/collect/RangeTest.java b/guava-tests/test/com/google/common/collect/RangeTest.java index 9a2cd7416..e8578bfd1 100644 --- a/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/guava-tests/test/com/google/common/collect/RangeTest.java @@ -20,6 +20,7 @@ import static com.google.common.collect.BoundType.CLOSED; import static com.google.common.collect.BoundType.OPEN; import static com.google.common.collect.DiscreteDomain.integers; import static com.google.common.testing.SerializableTester.reserializeAndAssert; +import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; import com.google.common.annotations.GwtCompatible; @@ -349,11 +350,14 @@ public class RangeTest extends TestCase { range.intersection(Range.open(3, 5)); fail(); } catch (IllegalArgumentException expected) { + // TODO(kevinb): convert the rest of this file to Truth someday + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.closed(0, 2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } @@ -368,11 +372,13 @@ public class RangeTest extends TestCase { range.intersection(Range.lessThan(3)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.greaterThan(4)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } range = Range.closed(3, 4); @@ -395,11 +401,13 @@ public class RangeTest extends TestCase { range.intersection(Range.atLeast(4)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } try { range.intersection(Range.atMost(2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } @@ -411,6 +419,7 @@ public class RangeTest extends TestCase { range.intersection(Range.closed(0, 2)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } // adjacent below @@ -451,6 +460,7 @@ public class RangeTest extends TestCase { range.intersection(Range.closed(10, 12)); fail(); } catch (IllegalArgumentException expected) { + assertThat(expected).hasMessageThat().contains("connected"); } } diff --git a/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index b6c2358c5..b0f9e16e4 100644 --- a/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java @@ -30,7 +30,8 @@ public class RegularImmutableAsListTest extends TestCase { */ public void testDoesntCheckForNull() { ImmutableSet<Integer> set = ImmutableSet.of(1, 2, 3); - new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null}); + ImmutableList<Integer> unused = + new RegularImmutableAsList<Integer>(set, new Object[] {null, null, null}); // shouldn't throw! } } diff --git a/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/guava-tests/test/com/google/common/collect/SetOperationsTest.java index 7a1ec3a65..9a26f2945 100644 --- a/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/guava-tests/test/com/google/common/collect/SetOperationsTest.java @@ -291,92 +291,90 @@ public class SetOperationsTest extends TestCase { .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES) .createTestSuite()); - suite.addTestSuite(MoreTests.class); + suite.addTestSuite(SetOperationsTest.class); return suite; } - public static class MoreTests extends TestCase { - Set<String> friends; - Set<String> enemies; - - @Override - public void setUp() { - friends = Sets.newHashSet("Tom", "Joe", "Dave"); - enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - } - - public void testUnion() { - Set<String> all = Sets.union(friends, enemies); - assertEquals(5, all.size()); - - ImmutableSet<String> immut = Sets.union(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.union(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Buck"); - assertEquals(6, all.size()); - assertEquals(5, immut.size()); - assertEquals(5, mut.size()); - } - - public void testIntersection() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> frenemies = Sets.intersection(friends, enemies); - assertEquals(1, frenemies.size()); - - ImmutableSet<String> immut = Sets.intersection(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.intersection(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Joe"); - assertEquals(2, frenemies.size()); - assertEquals(1, immut.size()); - assertEquals(1, mut.size()); - } - - public void testDifference() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> goodFriends = Sets.difference(friends, enemies); - assertEquals(2, goodFriends.size()); - - ImmutableSet<String> immut = Sets.difference(friends, enemies).immutableCopy(); - HashSet<String> mut = Sets.difference(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Dave"); - assertEquals(1, goodFriends.size()); - assertEquals(2, immut.size()); - assertEquals(2, mut.size()); - } - - public void testSymmetricDifference() { - Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); - Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); - - Set<String> symmetricDifferenceFriendsFirst = Sets.symmetricDifference(friends, enemies); - assertEquals(4, symmetricDifferenceFriendsFirst.size()); - - Set<String> symmetricDifferenceEnemiesFirst = Sets.symmetricDifference(enemies, friends); - assertEquals(4, symmetricDifferenceEnemiesFirst.size()); - - assertEquals(symmetricDifferenceFriendsFirst, symmetricDifferenceEnemiesFirst); - - ImmutableSet<String> immut = Sets.symmetricDifference(friends, enemies).immutableCopy(); - HashSet<String> mut = - Sets.symmetricDifference(friends, enemies).copyInto(new HashSet<String>()); - - enemies.add("Dave"); - assertEquals(3, symmetricDifferenceFriendsFirst.size()); - assertEquals(4, immut.size()); - assertEquals(4, mut.size()); - - immut = Sets.symmetricDifference(enemies, friends).immutableCopy(); - mut = Sets.symmetricDifference(enemies, friends).copyInto(new HashSet<String>()); - friends.add("Harry"); - assertEquals(2, symmetricDifferenceEnemiesFirst.size()); - assertEquals(3, immut.size()); - assertEquals(3, mut.size()); - } + Set<String> friends; + Set<String> enemies; + + @Override + public void setUp() { + friends = Sets.newHashSet("Tom", "Joe", "Dave"); + enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + } + + public void testUnion() { + Set<String> all = Sets.union(friends, enemies); + assertEquals(5, all.size()); + + ImmutableSet<String> immut = Sets.union(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.union(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Buck"); + assertEquals(6, all.size()); + assertEquals(5, immut.size()); + assertEquals(5, mut.size()); + } + + public void testIntersection() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> frenemies = Sets.intersection(friends, enemies); + assertEquals(1, frenemies.size()); + + ImmutableSet<String> immut = Sets.intersection(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.intersection(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Joe"); + assertEquals(2, frenemies.size()); + assertEquals(1, immut.size()); + assertEquals(1, mut.size()); + } + + public void testDifference() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> goodFriends = Sets.difference(friends, enemies); + assertEquals(2, goodFriends.size()); + + ImmutableSet<String> immut = Sets.difference(friends, enemies).immutableCopy(); + HashSet<String> mut = Sets.difference(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Dave"); + assertEquals(1, goodFriends.size()); + assertEquals(2, immut.size()); + assertEquals(2, mut.size()); + } + + public void testSymmetricDifference() { + Set<String> friends = Sets.newHashSet("Tom", "Joe", "Dave"); + Set<String> enemies = Sets.newHashSet("Dick", "Harry", "Tom"); + + Set<String> symmetricDifferenceFriendsFirst = Sets.symmetricDifference(friends, enemies); + assertEquals(4, symmetricDifferenceFriendsFirst.size()); + + Set<String> symmetricDifferenceEnemiesFirst = Sets.symmetricDifference(enemies, friends); + assertEquals(4, symmetricDifferenceEnemiesFirst.size()); + + assertEquals(symmetricDifferenceFriendsFirst, symmetricDifferenceEnemiesFirst); + + ImmutableSet<String> immut = Sets.symmetricDifference(friends, enemies).immutableCopy(); + HashSet<String> mut = + Sets.symmetricDifference(friends, enemies).copyInto(new HashSet<String>()); + + enemies.add("Dave"); + assertEquals(3, symmetricDifferenceFriendsFirst.size()); + assertEquals(4, immut.size()); + assertEquals(4, mut.size()); + + immut = Sets.symmetricDifference(enemies, friends).immutableCopy(); + mut = Sets.symmetricDifference(enemies, friends).copyInto(new HashSet<String>()); + friends.add("Harry"); + assertEquals(2, symmetricDifferenceEnemiesFirst.size()); + assertEquals(3, immut.size()); + assertEquals(3, mut.size()); } } diff --git a/guava-tests/test/com/google/common/collect/SetsTest.java b/guava-tests/test/com/google/common/collect/SetsTest.java index 86cb6c89c..72131bfc3 100644 --- a/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/guava-tests/test/com/google/common/collect/SetsTest.java @@ -326,6 +326,7 @@ public class SetsTest extends TestCase { D } + @SuppressWarnings("DoNotCall") public void testImmutableEnumSet() { Set<SomeEnum> units = Sets.immutableEnumSet(SomeEnum.D, SomeEnum.B); diff --git a/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java b/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java index b07802a7b..2e15eda32 100644 --- a/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java +++ b/guava-tests/test/com/google/common/collect/SynchronizedMapTest.java @@ -216,15 +216,15 @@ public class SynchronizedMapTest extends TestCase { } public void testEquals() { - create().equals(new HashMap<String, Integer>()); + boolean unused = create().equals(new HashMap<String, Integer>()); } public void testHashCode() { - create().hashCode(); + int unused = create().hashCode(); } public void testToString() { - create().toString(); + String unused = create().toString(); } public void testSerialization() { diff --git a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java index 98b707498..9a1fe5bc5 100644 --- a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java @@ -31,252 +31,231 @@ import junit.framework.TestCase; /** Unit tests for {@link TableCollectors}. */ @GwtCompatible(emulated = true) -public class TableCollectorsTest { +public class TableCollectorsTest extends TestCase { + public void testToImmutableTable() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); + BiPredicate<ImmutableTable<String, String, Integer>, ImmutableTable<String, String, Integer>> + equivalence = pairwiseOnResultOf(ImmutableTable::cellSet); + CollectorTester.of(collector, equivalence) + .expectCollects( + new ImmutableTable.Builder<String, String, Integer>() + .put("one", "uno", 1) + .put("two", "dos", 2) + .put("three", "tres", 3) + .build(), + immutableCell("one", "uno", 1), + immutableCell("two", "dos", 2), + immutableCell("three", "tres", 3)); + } - public static final class ToImmutableTableTest extends TestCase { - public void testToImmutableTable() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); - BiPredicate<ImmutableTable<String, String, Integer>, ImmutableTable<String, String, Integer>> - equivalence = pairwiseOnResultOf(ImmutableTable::cellSet); - CollectorTester.of(collector, equivalence) - .expectCollects( - new ImmutableTable.Builder<String, String, Integer>() - .put("one", "uno", 1) - .put("two", "dos", 2) - .put("three", "tres", 3) - .build(), - immutableCell("one", "uno", 1), - immutableCell("two", "dos", 2), - immutableCell("three", "tres", 3)); + public void testToImmutableTableConflict() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); + try { + Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)).collect(collector); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException expected) { } + } - public void testToImmutableTableConflict() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); - try { - Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)) - .collect(collector); - fail("Expected IllegalArgumentException"); - } catch (IllegalArgumentException expected) { - } + public void testToImmutableTableNullRowKey() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(t -> null, Cell::getColumnKey, Cell::getValue); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToImmutableTableNullRowKey() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable(t -> null, Cell::getColumnKey, Cell::getValue); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + public void testToImmutableTableNullColumnKey() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(Cell::getRowKey, t -> null, Cell::getValue); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToImmutableTableNullColumnKey() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = TableCollectors.toImmutableTable(Cell::getRowKey, t -> null, Cell::getValue); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + public void testToImmutableTableNullValue() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, t -> null); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } - - public void testToImmutableTableNullValue() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, t -> null); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } - collector = - TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); - try { - Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", (Integer) null)) - .collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + collector = + TableCollectors.toImmutableTable(Cell::getRowKey, Cell::getColumnKey, Cell::getValue); + try { + Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", (Integer) null)) + .collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToImmutableTableMerging() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable( - Cell::getRowKey, Cell::getColumnKey, Cell::getValue, Integer::sum); - BiPredicate<ImmutableTable<String, String, Integer>, ImmutableTable<String, String, Integer>> - equivalence = pairwiseOnResultOf(ImmutableTable::cellSet); - CollectorTester.of(collector, equivalence) - .expectCollects( - new ImmutableTable.Builder<String, String, Integer>() - .put("one", "uno", 1) - .put("two", "dos", 6) - .put("three", "tres", 3) - .build(), - immutableCell("one", "uno", 1), - immutableCell("two", "dos", 2), - immutableCell("three", "tres", 3), - immutableCell("two", "dos", 4)); - } + public void testToImmutableTableMerging() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable( + Cell::getRowKey, Cell::getColumnKey, Cell::getValue, Integer::sum); + BiPredicate<ImmutableTable<String, String, Integer>, ImmutableTable<String, String, Integer>> + equivalence = pairwiseOnResultOf(ImmutableTable::cellSet); + CollectorTester.of(collector, equivalence) + .expectCollects( + new ImmutableTable.Builder<String, String, Integer>() + .put("one", "uno", 1) + .put("two", "dos", 6) + .put("three", "tres", 3) + .build(), + immutableCell("one", "uno", 1), + immutableCell("two", "dos", 2), + immutableCell("three", "tres", 3), + immutableCell("two", "dos", 4)); + } - public void testToImmutableTableMergingNullRowKey() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable( - t -> null, Cell::getColumnKey, Cell::getValue, Integer::sum); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + public void testToImmutableTableMergingNullRowKey() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable( + t -> null, Cell::getColumnKey, Cell::getValue, Integer::sum); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToImmutableTableMergingNullColumnKey() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable( - Cell::getRowKey, t -> null, Cell::getValue, Integer::sum); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + public void testToImmutableTableMergingNullColumnKey() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable(Cell::getRowKey, t -> null, Cell::getValue, Integer::sum); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToImmutableTableMergingNullValue() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable( - Cell::getRowKey, Cell::getColumnKey, t -> null, Integer::sum); - try { - Stream.of(immutableCell("one", "uno", 1)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } - collector = - TableCollectors.toImmutableTable( - Cell::getRowKey, - Cell::getColumnKey, - Cell::getValue, - (i, j) -> MoreObjects.firstNonNull(i, 0) + MoreObjects.firstNonNull(j, 0)); - try { - Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", (Integer) null)) - .collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + public void testToImmutableTableMergingNullValue() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable( + Cell::getRowKey, Cell::getColumnKey, t -> null, Integer::sum); + try { + Stream.of(immutableCell("one", "uno", 1)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } - - public void testToImmutableTableMergingNullMerge() { - Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> - collector = - TableCollectors.toImmutableTable( - Cell::getRowKey, Cell::getColumnKey, Cell::getValue, (v1, v2) -> null); - try { - Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)) - .collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } + collector = + TableCollectors.toImmutableTable( + Cell::getRowKey, + Cell::getColumnKey, + Cell::getValue, + (i, j) -> MoreObjects.firstNonNull(i, 0) + MoreObjects.firstNonNull(j, 0)); + try { + Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", (Integer) null)) + .collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } } - public static final class ToTableTest extends TestCase { - - public void testToTable() { - Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = - TableCollectors.toTable( - Cell::getRowKey, Cell::getColumnKey, Cell::getValue, HashBasedTable::create); - BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = - pairwiseOnResultOf(Table::cellSet); - CollectorTester.of(collector, equivalence) - .expectCollects( - new ImmutableTable.Builder<String, String, Integer>() - .put("one", "uno", 1) - .put("two", "dos", 2) - .put("three", "tres", 3) - .build(), - immutableCell("one", "uno", 1), - immutableCell("two", "dos", 2), - immutableCell("three", "tres", 3)); + public void testToImmutableTableMergingNullMerge() { + Collector<Cell<String, String, Integer>, ?, ImmutableTable<String, String, Integer>> collector = + TableCollectors.toImmutableTable( + Cell::getRowKey, Cell::getColumnKey, Cell::getValue, (v1, v2) -> null); + try { + Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToTableNullMerge() { - Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = - TableCollectors.toTable( - Cell::getRowKey, - Cell::getColumnKey, - Cell::getValue, - (Integer v1, Integer v2) -> null, - HashBasedTable::create); - BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = - pairwiseOnResultOf(Table::cellSet); - CollectorTester.of(collector, equivalence) - .expectCollects( - ImmutableTable.of(), immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)); - } + public void testToTable() { + Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = + TableCollectors.toTable( + Cell::getRowKey, Cell::getColumnKey, Cell::getValue, HashBasedTable::create); + BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = + pairwiseOnResultOf(Table::cellSet); + CollectorTester.of(collector, equivalence) + .expectCollects( + new ImmutableTable.Builder<String, String, Integer>() + .put("one", "uno", 1) + .put("two", "dos", 2) + .put("three", "tres", 3) + .build(), + immutableCell("one", "uno", 1), + immutableCell("two", "dos", 2), + immutableCell("three", "tres", 3)); + } - public void testToTableNullValues() { - Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = - TableCollectors.toTable( - Cell::getRowKey, - Cell::getColumnKey, - Cell::getValue, - () -> ArrayTable.create(ImmutableList.of("one"), ImmutableList.of("uno"))); - try { - Stream.of(immutableCell("one", "uno", (Integer) null)).collect(collector); - fail("Expected NullPointerException"); - } catch (NullPointerException expected) { - } - } + public void testToTableNullMerge() { + Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = + TableCollectors.toTable( + Cell::getRowKey, + Cell::getColumnKey, + Cell::getValue, + (Integer v1, Integer v2) -> null, + HashBasedTable::create); + BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = + pairwiseOnResultOf(Table::cellSet); + CollectorTester.of(collector, equivalence) + .expectCollects( + ImmutableTable.of(), immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)); + } - public void testToTableConflict() { - Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = - TableCollectors.toTable( - Cell::getRowKey, Cell::getColumnKey, Cell::getValue, HashBasedTable::create); - try { - Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)) - .collect(collector); - fail("Expected IllegalStateException"); - } catch (IllegalStateException expected) { - } + public void testToTableNullValues() { + Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = + TableCollectors.toTable( + Cell::getRowKey, + Cell::getColumnKey, + Cell::getValue, + () -> ArrayTable.create(ImmutableList.of("one"), ImmutableList.of("uno"))); + try { + Stream.of(immutableCell("one", "uno", (Integer) null)).collect(collector); + fail("Expected NullPointerException"); + } catch (NullPointerException expected) { } + } - public void testToTableMerging() { - Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = - TableCollectors.toTable( - Cell::getRowKey, - Cell::getColumnKey, - Cell::getValue, - Integer::sum, - HashBasedTable::create); - BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = - pairwiseOnResultOf(Table::cellSet); - CollectorTester.of(collector, equivalence) - .expectCollects( - new ImmutableTable.Builder<String, String, Integer>() - .put("one", "uno", 1) - .put("two", "dos", 6) - .put("three", "tres", 3) - .build(), - immutableCell("one", "uno", 1), - immutableCell("two", "dos", 2), - immutableCell("three", "tres", 3), - immutableCell("two", "dos", 4)); + public void testToTableConflict() { + Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = + TableCollectors.toTable( + Cell::getRowKey, Cell::getColumnKey, Cell::getValue, HashBasedTable::create); + try { + Stream.of(immutableCell("one", "uno", 1), immutableCell("one", "uno", 2)).collect(collector); + fail("Expected IllegalStateException"); + } catch (IllegalStateException expected) { } } + public void testToTableMerging() { + Collector<Cell<String, String, Integer>, ?, Table<String, String, Integer>> collector = + TableCollectors.toTable( + Cell::getRowKey, + Cell::getColumnKey, + Cell::getValue, + Integer::sum, + HashBasedTable::create); + BiPredicate<Table<String, String, Integer>, Table<String, String, Integer>> equivalence = + pairwiseOnResultOf(Table::cellSet); + CollectorTester.of(collector, equivalence) + .expectCollects( + new ImmutableTable.Builder<String, String, Integer>() + .put("one", "uno", 1) + .put("two", "dos", 6) + .put("three", "tres", 3) + .build(), + immutableCell("one", "uno", 1), + immutableCell("two", "dos", 2), + immutableCell("three", "tres", 3), + immutableCell("two", "dos", 4)); + } + // This function specifically returns a BiPredicate, because Guava7’s Equivalence class does not // actually implement BiPredicate, and CollectorTests expects a BiPredicate. static <C, E, R extends Iterable<E>> BiPredicate<C, C> pairwiseOnResultOf(Function<C, R> arg) { Equivalence<C> equivalence = Equivalence.equals().<E>pairwise().onResultOf(arg); return equivalence::equivalent; } - - private TableCollectorsTest() {} } diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index 77ecbf730..5e474aa70 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java @@ -29,6 +29,7 @@ import junit.framework.TestCase; @GwtCompatible public class UnmodifiableIteratorTest extends TestCase { + @SuppressWarnings("DoNotCall") public void testRemove() { final String[] array = {"a", "b", "c"}; diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index c9d3068e0..36a017d45 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java @@ -29,6 +29,7 @@ import junit.framework.TestCase; */ @GwtCompatible public class UnmodifiableListIteratorTest extends TestCase { + @SuppressWarnings("DoNotCall") public void testRemove() { Iterator<String> iterator = create(); @@ -41,6 +42,7 @@ public class UnmodifiableListIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testAdd() { ListIterator<String> iterator = create(); @@ -55,6 +57,7 @@ public class UnmodifiableListIteratorTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testSet() { ListIterator<String> iterator = create(); diff --git a/guava-tests/test/com/google/common/escape/EscapersTest.java b/guava-tests/test/com/google/common/escape/EscapersTest.java index 245560af6..442232030 100644 --- a/guava-tests/test/com/google/common/escape/EscapersTest.java +++ b/guava-tests/test/com/google/common/escape/EscapersTest.java @@ -85,7 +85,7 @@ public class EscapersTest extends TestCase { .put('x', "<hello>".toCharArray()) .put('\uD800', "<hi>".toCharArray()) .put('\uDC00', "<lo>".toCharArray()) - .build()); + .buildOrThrow()); UnicodeEscaper unicodeEscaper = Escapers.asUnicodeEscaper(charEscaper); EscaperAsserts.assertBasic(unicodeEscaper); assertEquals("<hello><hi><lo>", charEscaper.escape("x\uD800\uDC00")); diff --git a/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java b/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java new file mode 100644 index 000000000..f4af7a751 --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/AbstractEventBusTest.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import com.google.common.eventbus.EventBus; +import junit.framework.TestCase; + +/** + * Abstract base class for tests that EventBus finds the correct subscribers. + * + * <p>The actual tests are distributed among the other classes in this package based on whether they + * are annotated or abstract in the superclass. + * + * <p>This test must be outside the c.g.c.eventbus package to test correctly. + * + * @author Louis Wasserman + */ +abstract class AbstractEventBusTest<H> extends TestCase { + static final Object EVENT = new Object(); + + abstract H createSubscriber(); + + private H subscriber; + + H getSubscriber() { + return subscriber; + } + + @Override + protected void setUp() throws Exception { + subscriber = createSubscriber(); + EventBus bus = new EventBus(); + bus.register(subscriber); + bus.post(EVENT); + } + + @Override + protected void tearDown() throws Exception { + subscriber = null; + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java b/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java new file mode 100644 index 000000000..a391fcbad --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/AbstractNotAnnotatedInSuperclassTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AbstractNotAnnotatedInSuperclassTest.SubClass; +import java.util.List; + +public class AbstractNotAnnotatedInSuperclassTest extends AbstractEventBusTest<SubClass> { + abstract static class SuperClass { + public abstract void overriddenInSubclassNowhereAnnotated(Object o); + + public abstract void overriddenAndAnnotatedInSubclass(Object o); + } + + static class SubClass extends SuperClass { + final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + + @Override + public void overriddenInSubclassNowhereAnnotated(Object o) { + overriddenInSubclassNowhereAnnotatedEvents.add(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testOverriddenInSubclassNowhereAnnotated() { + assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java b/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java new file mode 100644 index 000000000..aea17c3b4 --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/AnnotatedAndAbstractInSuperclassTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AnnotatedAndAbstractInSuperclassTest.SubClass; +import java.util.List; + +public class AnnotatedAndAbstractInSuperclassTest extends AbstractEventBusTest<SubClass> { + abstract static class SuperClass { + @Subscribe + public abstract void overriddenAndAnnotatedInSubclass(Object o); + + @Subscribe + public abstract void overriddenInSubclass(Object o); + } + + static class SubClass extends SuperClass { + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenInSubclassEvents = Lists.newArrayList(); + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + + @Override + public void overriddenInSubclass(Object o) { + overriddenInSubclassEvents.add(o); + } + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenInSubclassEvents).contains(EVENT); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java b/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java new file mode 100644 index 000000000..3ec8ea470 --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/AnnotatedNotAbstractInSuperclassTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.AnnotatedNotAbstractInSuperclassTest.SubClass; +import java.util.List; + +public class AnnotatedNotAbstractInSuperclassTest extends AbstractEventBusTest<SubClass> { + static class SuperClass { + final List<Object> notOverriddenInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenNotAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenNotAnnotatedInSubclassBadEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenAnnotatedInSubclassBadEvents = Lists.newArrayList(); + + @Subscribe + public void notOverriddenInSubclass(Object o) { + notOverriddenInSubclassEvents.add(o); + } + + @Subscribe + public void overriddenNotAnnotatedInSubclass(Object o) { + overriddenNotAnnotatedInSubclassEvents.add(o); + } + + @Subscribe + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + + @Subscribe + public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { + // the subclass overrides this and does *not* call super.dONAIS(o) + differentlyOverriddenNotAnnotatedInSubclassBadEvents.add(o); + } + + @Subscribe + public void differentlyOverriddenAnnotatedInSubclass(Object o) { + // the subclass overrides this and does *not* call super.dOAIS(o) + differentlyOverriddenAnnotatedInSubclassBadEvents.add(o); + } + } + + static class SubClass extends SuperClass { + final List<Object> differentlyOverriddenNotAnnotatedInSubclassGoodEvents = Lists.newArrayList(); + final List<Object> differentlyOverriddenAnnotatedInSubclassGoodEvents = Lists.newArrayList(); + + @Override + public void overriddenNotAnnotatedInSubclass(Object o) { + super.overriddenNotAnnotatedInSubclass(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + super.overriddenAndAnnotatedInSubclass(o); + } + + @Override + public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { + differentlyOverriddenNotAnnotatedInSubclassGoodEvents.add(o); + } + + @Subscribe + @Override + public void differentlyOverriddenAnnotatedInSubclass(Object o) { + differentlyOverriddenAnnotatedInSubclassGoodEvents.add(o); + } + } + + public void testNotOverriddenInSubclass() { + assertThat(getSubscriber().notOverriddenInSubclassEvents).contains(EVENT); + } + + public void testOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenNotAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testDifferentlyOverriddenNotAnnotatedInSubclass() { + assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassGoodEvents) + .contains(EVENT); + assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassBadEvents).isEmpty(); + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + public void testDifferentlyOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassGoodEvents).contains(EVENT); + assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassBadEvents).isEmpty(); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java b/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java deleted file mode 100644 index a1cbb5944..000000000 --- a/guava-tests/test/com/google/common/eventbus/outside/AnnotatedSubscriberFinderTests.java +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (C) 2012 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.eventbus.outside; - -import static com.google.common.truth.Truth.assertThat; - -import com.google.common.collect.Lists; -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.Subscribe; -import java.util.List; -import junit.framework.TestCase; - -/** - * Test that EventBus finds the correct subscribers. - * - * <p>This test must be outside the c.g.c.eventbus package to test correctly. - * - * @author Louis Wasserman - */ -public class AnnotatedSubscriberFinderTests { - - private static final Object EVENT = new Object(); - - abstract static class AbstractEventBusTest<H> extends TestCase { - abstract H createSubscriber(); - - private H subscriber; - - H getSubscriber() { - return subscriber; - } - - @Override - protected void setUp() throws Exception { - subscriber = createSubscriber(); - EventBus bus = new EventBus(); - bus.register(subscriber); - bus.post(EVENT); - } - - @Override - protected void tearDown() throws Exception { - subscriber = null; - } - } - - /* - * We break the tests up based on whether they are annotated or abstract in the superclass. - */ - public static class BaseSubscriberFinderTest - extends AbstractEventBusTest<BaseSubscriberFinderTest.Subscriber> { - static class Subscriber { - final List<Object> nonSubscriberEvents = Lists.newArrayList(); - final List<Object> subscriberEvents = Lists.newArrayList(); - - public void notASubscriber(Object o) { - nonSubscriberEvents.add(o); - } - - @Subscribe - public void subscriber(Object o) { - subscriberEvents.add(o); - } - } - - public void testNonSubscriber() { - assertThat(getSubscriber().nonSubscriberEvents).isEmpty(); - } - - public void testSubscriber() { - assertThat(getSubscriber().subscriberEvents).contains(EVENT); - } - - @Override - Subscriber createSubscriber() { - return new Subscriber(); - } - } - - public static class AnnotatedAndAbstractInSuperclassTest - extends AbstractEventBusTest<AnnotatedAndAbstractInSuperclassTest.SubClass> { - abstract static class SuperClass { - @Subscribe - public abstract void overriddenAndAnnotatedInSubclass(Object o); - - @Subscribe - public abstract void overriddenInSubclass(Object o); - } - - static class SubClass extends SuperClass { - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenInSubclassEvents = Lists.newArrayList(); - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - - @Override - public void overriddenInSubclass(Object o) { - overriddenInSubclassEvents.add(o); - } - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenInSubclassEvents).contains(EVENT); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class AnnotatedNotAbstractInSuperclassTest - extends AbstractEventBusTest<AnnotatedNotAbstractInSuperclassTest.SubClass> { - static class SuperClass { - final List<Object> notOverriddenInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenNotAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - final List<Object> differentlyOverriddenNotAnnotatedInSubclassBadEvents = - Lists.newArrayList(); - final List<Object> differentlyOverriddenAnnotatedInSubclassBadEvents = Lists.newArrayList(); - - @Subscribe - public void notOverriddenInSubclass(Object o) { - notOverriddenInSubclassEvents.add(o); - } - - @Subscribe - public void overriddenNotAnnotatedInSubclass(Object o) { - overriddenNotAnnotatedInSubclassEvents.add(o); - } - - @Subscribe - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - - @Subscribe - public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { - // the subclass overrides this and does *not* call super.dONAIS(o) - differentlyOverriddenNotAnnotatedInSubclassBadEvents.add(o); - } - - @Subscribe - public void differentlyOverriddenAnnotatedInSubclass(Object o) { - // the subclass overrides this and does *not* call super.dOAIS(o) - differentlyOverriddenAnnotatedInSubclassBadEvents.add(o); - } - } - - static class SubClass extends SuperClass { - final List<Object> differentlyOverriddenNotAnnotatedInSubclassGoodEvents = - Lists.newArrayList(); - final List<Object> differentlyOverriddenAnnotatedInSubclassGoodEvents = Lists.newArrayList(); - - @Override - public void overriddenNotAnnotatedInSubclass(Object o) { - super.overriddenNotAnnotatedInSubclass(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - super.overriddenAndAnnotatedInSubclass(o); - } - - @Override - public void differentlyOverriddenNotAnnotatedInSubclass(Object o) { - differentlyOverriddenNotAnnotatedInSubclassGoodEvents.add(o); - } - - @Subscribe - @Override - public void differentlyOverriddenAnnotatedInSubclass(Object o) { - differentlyOverriddenAnnotatedInSubclassGoodEvents.add(o); - } - } - - public void testNotOverriddenInSubclass() { - assertThat(getSubscriber().notOverriddenInSubclassEvents).contains(EVENT); - } - - public void testOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenNotAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testDifferentlyOverriddenNotAnnotatedInSubclass() { - assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassGoodEvents) - .contains(EVENT); - assertThat(getSubscriber().differentlyOverriddenNotAnnotatedInSubclassBadEvents).isEmpty(); - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testDifferentlyOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassGoodEvents) - .contains(EVENT); - assertThat(getSubscriber().differentlyOverriddenAnnotatedInSubclassBadEvents).isEmpty(); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class AbstractNotAnnotatedInSuperclassTest - extends AbstractEventBusTest<AbstractNotAnnotatedInSuperclassTest.SubClass> { - abstract static class SuperClass { - public abstract void overriddenInSubclassNowhereAnnotated(Object o); - - public abstract void overriddenAndAnnotatedInSubclass(Object o); - } - - static class SubClass extends SuperClass { - final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - - @Override - public void overriddenInSubclassNowhereAnnotated(Object o) { - overriddenInSubclassNowhereAnnotatedEvents.add(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - public void testOverriddenInSubclassNowhereAnnotated() { - assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class NeitherAbstractNorAnnotatedInSuperclassTest - extends AbstractEventBusTest<NeitherAbstractNorAnnotatedInSuperclassTest.SubClass> { - static class SuperClass { - final List<Object> neitherOverriddenNorAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); - final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); - - public void neitherOverriddenNorAnnotated(Object o) { - neitherOverriddenNorAnnotatedEvents.add(o); - } - - public void overriddenInSubclassNowhereAnnotated(Object o) { - overriddenInSubclassNowhereAnnotatedEvents.add(o); - } - - public void overriddenAndAnnotatedInSubclass(Object o) { - overriddenAndAnnotatedInSubclassEvents.add(o); - } - } - - static class SubClass extends SuperClass { - @Override - public void overriddenInSubclassNowhereAnnotated(Object o) { - super.overriddenInSubclassNowhereAnnotated(o); - } - - @Subscribe - @Override - public void overriddenAndAnnotatedInSubclass(Object o) { - super.overriddenAndAnnotatedInSubclass(o); - } - } - - public void testNeitherOverriddenNorAnnotated() { - assertThat(getSubscriber().neitherOverriddenNorAnnotatedEvents).isEmpty(); - } - - public void testOverriddenInSubclassNowhereAnnotated() { - assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); - } - - public void testOverriddenAndAnnotatedInSubclass() { - assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); - } - - @Override - SubClass createSubscriber() { - return new SubClass(); - } - } - - public static class DeepInterfaceTest - extends AbstractEventBusTest<DeepInterfaceTest.SubscriberClass> { - interface Interface1 { - @Subscribe - void annotatedIn1(Object o); - - @Subscribe - void annotatedIn1And2(Object o); - - @Subscribe - void annotatedIn1And2AndClass(Object o); - - void declaredIn1AnnotatedIn2(Object o); - - void declaredIn1AnnotatedInClass(Object o); - - void nowhereAnnotated(Object o); - } - - interface Interface2 extends Interface1 { - @Override - @Subscribe - void declaredIn1AnnotatedIn2(Object o); - - @Override - @Subscribe - void annotatedIn1And2(Object o); - - @Override - @Subscribe - void annotatedIn1And2AndClass(Object o); - - void declaredIn2AnnotatedInClass(Object o); - - @Subscribe - void annotatedIn2(Object o); - } - - static class SubscriberClass implements Interface2 { - final List<Object> annotatedIn1Events = Lists.newArrayList(); - final List<Object> annotatedIn1And2Events = Lists.newArrayList(); - final List<Object> annotatedIn1And2AndClassEvents = Lists.newArrayList(); - final List<Object> declaredIn1AnnotatedIn2Events = Lists.newArrayList(); - final List<Object> declaredIn1AnnotatedInClassEvents = Lists.newArrayList(); - final List<Object> declaredIn2AnnotatedInClassEvents = Lists.newArrayList(); - final List<Object> annotatedIn2Events = Lists.newArrayList(); - final List<Object> nowhereAnnotatedEvents = Lists.newArrayList(); - - @Override - public void annotatedIn1(Object o) { - annotatedIn1Events.add(o); - } - - @Subscribe - @Override - public void declaredIn1AnnotatedInClass(Object o) { - declaredIn1AnnotatedInClassEvents.add(o); - } - - @Override - public void declaredIn1AnnotatedIn2(Object o) { - declaredIn1AnnotatedIn2Events.add(o); - } - - @Override - public void annotatedIn1And2(Object o) { - annotatedIn1And2Events.add(o); - } - - @Subscribe - @Override - public void annotatedIn1And2AndClass(Object o) { - annotatedIn1And2AndClassEvents.add(o); - } - - @Subscribe - @Override - public void declaredIn2AnnotatedInClass(Object o) { - declaredIn2AnnotatedInClassEvents.add(o); - } - - @Override - public void annotatedIn2(Object o) { - annotatedIn2Events.add(o); - } - - @Override - public void nowhereAnnotated(Object o) { - nowhereAnnotatedEvents.add(o); - } - } - - public void testAnnotatedIn1() { - assertThat(getSubscriber().annotatedIn1Events).contains(EVENT); - } - - public void testAnnotatedIn2() { - assertThat(getSubscriber().annotatedIn2Events).contains(EVENT); - } - - public void testAnnotatedIn1And2() { - assertThat(getSubscriber().annotatedIn1And2Events).contains(EVENT); - } - - public void testAnnotatedIn1And2AndClass() { - assertThat(getSubscriber().annotatedIn1And2AndClassEvents).contains(EVENT); - } - - public void testDeclaredIn1AnnotatedIn2() { - assertThat(getSubscriber().declaredIn1AnnotatedIn2Events).contains(EVENT); - } - - public void testDeclaredIn1AnnotatedInClass() { - assertThat(getSubscriber().declaredIn1AnnotatedInClassEvents).contains(EVENT); - } - - public void testDeclaredIn2AnnotatedInClass() { - assertThat(getSubscriber().declaredIn2AnnotatedInClassEvents).contains(EVENT); - } - - public void testNowhereAnnotated() { - assertThat(getSubscriber().nowhereAnnotatedEvents).isEmpty(); - } - - @Override - SubscriberClass createSubscriber() { - return new SubscriberClass(); - } - } -} diff --git a/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java b/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java new file mode 100644 index 000000000..461fb795b --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/BaseSubscriberFinderTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.BaseSubscriberFinderTest.Subscriber; +import java.util.List; + +public class BaseSubscriberFinderTest extends AbstractEventBusTest<Subscriber> { + static class Subscriber { + final List<Object> nonSubscriberEvents = Lists.newArrayList(); + final List<Object> subscriberEvents = Lists.newArrayList(); + + public void notASubscriber(Object o) { + nonSubscriberEvents.add(o); + } + + @Subscribe + public void subscriber(Object o) { + subscriberEvents.add(o); + } + } + + public void testNonSubscriber() { + assertThat(getSubscriber().nonSubscriberEvents).isEmpty(); + } + + public void testSubscriber() { + assertThat(getSubscriber().subscriberEvents).contains(EVENT); + } + + @Override + Subscriber createSubscriber() { + return new Subscriber(); + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java b/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java new file mode 100644 index 000000000..4fefbc12a --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/DeepInterfaceTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.DeepInterfaceTest.SubscriberClass; +import java.util.List; + +public class DeepInterfaceTest extends AbstractEventBusTest<SubscriberClass> { + interface Interface1 { + @Subscribe + void annotatedIn1(Object o); + + @Subscribe + void annotatedIn1And2(Object o); + + @Subscribe + void annotatedIn1And2AndClass(Object o); + + void declaredIn1AnnotatedIn2(Object o); + + void declaredIn1AnnotatedInClass(Object o); + + void nowhereAnnotated(Object o); + } + + interface Interface2 extends Interface1 { + @Override + @Subscribe + void declaredIn1AnnotatedIn2(Object o); + + @Override + @Subscribe + void annotatedIn1And2(Object o); + + @Override + @Subscribe + void annotatedIn1And2AndClass(Object o); + + void declaredIn2AnnotatedInClass(Object o); + + @Subscribe + void annotatedIn2(Object o); + } + + static class SubscriberClass implements Interface2 { + final List<Object> annotatedIn1Events = Lists.newArrayList(); + final List<Object> annotatedIn1And2Events = Lists.newArrayList(); + final List<Object> annotatedIn1And2AndClassEvents = Lists.newArrayList(); + final List<Object> declaredIn1AnnotatedIn2Events = Lists.newArrayList(); + final List<Object> declaredIn1AnnotatedInClassEvents = Lists.newArrayList(); + final List<Object> declaredIn2AnnotatedInClassEvents = Lists.newArrayList(); + final List<Object> annotatedIn2Events = Lists.newArrayList(); + final List<Object> nowhereAnnotatedEvents = Lists.newArrayList(); + + @Override + public void annotatedIn1(Object o) { + annotatedIn1Events.add(o); + } + + @Subscribe + @Override + public void declaredIn1AnnotatedInClass(Object o) { + declaredIn1AnnotatedInClassEvents.add(o); + } + + @Override + public void declaredIn1AnnotatedIn2(Object o) { + declaredIn1AnnotatedIn2Events.add(o); + } + + @Override + public void annotatedIn1And2(Object o) { + annotatedIn1And2Events.add(o); + } + + @Subscribe + @Override + public void annotatedIn1And2AndClass(Object o) { + annotatedIn1And2AndClassEvents.add(o); + } + + @Subscribe + @Override + public void declaredIn2AnnotatedInClass(Object o) { + declaredIn2AnnotatedInClassEvents.add(o); + } + + @Override + public void annotatedIn2(Object o) { + annotatedIn2Events.add(o); + } + + @Override + public void nowhereAnnotated(Object o) { + nowhereAnnotatedEvents.add(o); + } + } + + public void testAnnotatedIn1() { + assertThat(getSubscriber().annotatedIn1Events).contains(EVENT); + } + + public void testAnnotatedIn2() { + assertThat(getSubscriber().annotatedIn2Events).contains(EVENT); + } + + public void testAnnotatedIn1And2() { + assertThat(getSubscriber().annotatedIn1And2Events).contains(EVENT); + } + + public void testAnnotatedIn1And2AndClass() { + assertThat(getSubscriber().annotatedIn1And2AndClassEvents).contains(EVENT); + } + + public void testDeclaredIn1AnnotatedIn2() { + assertThat(getSubscriber().declaredIn1AnnotatedIn2Events).contains(EVENT); + } + + public void testDeclaredIn1AnnotatedInClass() { + assertThat(getSubscriber().declaredIn1AnnotatedInClassEvents).contains(EVENT); + } + + public void testDeclaredIn2AnnotatedInClass() { + assertThat(getSubscriber().declaredIn2AnnotatedInClassEvents).contains(EVENT); + } + + public void testNowhereAnnotated() { + assertThat(getSubscriber().nowhereAnnotatedEvents).isEmpty(); + } + + @Override + SubscriberClass createSubscriber() { + return new SubscriberClass(); + } +} diff --git a/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java b/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java new file mode 100644 index 000000000..a2aca555b --- /dev/null +++ b/guava-tests/test/com/google/common/eventbus/outside/NeitherAbstractNorAnnotatedInSuperclassTest.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.eventbus.outside; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; +import com.google.common.eventbus.outside.NeitherAbstractNorAnnotatedInSuperclassTest.SubClass; +import java.util.List; + +public class NeitherAbstractNorAnnotatedInSuperclassTest extends AbstractEventBusTest<SubClass> { + static class SuperClass { + final List<Object> neitherOverriddenNorAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenInSubclassNowhereAnnotatedEvents = Lists.newArrayList(); + final List<Object> overriddenAndAnnotatedInSubclassEvents = Lists.newArrayList(); + + public void neitherOverriddenNorAnnotated(Object o) { + neitherOverriddenNorAnnotatedEvents.add(o); + } + + public void overriddenInSubclassNowhereAnnotated(Object o) { + overriddenInSubclassNowhereAnnotatedEvents.add(o); + } + + public void overriddenAndAnnotatedInSubclass(Object o) { + overriddenAndAnnotatedInSubclassEvents.add(o); + } + } + + static class SubClass extends SuperClass { + @Override + public void overriddenInSubclassNowhereAnnotated(Object o) { + super.overriddenInSubclassNowhereAnnotated(o); + } + + @Subscribe + @Override + public void overriddenAndAnnotatedInSubclass(Object o) { + super.overriddenAndAnnotatedInSubclass(o); + } + } + + public void testNeitherOverriddenNorAnnotated() { + assertThat(getSubscriber().neitherOverriddenNorAnnotatedEvents).isEmpty(); + } + + public void testOverriddenInSubclassNowhereAnnotated() { + assertThat(getSubscriber().overriddenInSubclassNowhereAnnotatedEvents).isEmpty(); + } + + public void testOverriddenAndAnnotatedInSubclass() { + assertThat(getSubscriber().overriddenAndAnnotatedInSubclassEvents).contains(EVENT); + } + + @Override + SubClass createSubscriber() { + return new SubClass(); + } +} diff --git a/guava-tests/test/com/google/common/hash/BloomFilterTest.java b/guava-tests/test/com/google/common/hash/BloomFilterTest.java index 411e0977e..95306661d 100644 --- a/guava-tests/test/com/google/common/hash/BloomFilterTest.java +++ b/guava-tests/test/com/google/common/hash/BloomFilterTest.java @@ -522,7 +522,10 @@ public class BloomFilterTest extends TestCase { ByteArrayOutputStream out = new ByteArrayOutputStream(); bf.writeTo(out); - assertEquals(bf, BloomFilter.readFrom(new ByteArrayInputStream(out.toByteArray()), funnel)); + BloomFilter<byte[]> read = + BloomFilter.readFrom(new ByteArrayInputStream(out.toByteArray()), funnel); + assertThat(read).isEqualTo(bf); + assertThat(read.expectedFpp()).isGreaterThan(0); } /** diff --git a/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java b/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java new file mode 100644 index 000000000..effa63291 --- /dev/null +++ b/guava-tests/test/com/google/common/hash/Fingerprint2011Test.java @@ -0,0 +1,233 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +package com.google.common.hash; + +import static com.google.common.base.Charsets.ISO_8859_1; +import static com.google.common.base.Charsets.UTF_8; +import static com.google.common.truth.Truth.assertThat; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableSortedMap; +import com.google.common.collect.Ordering; +import com.google.common.primitives.UnsignedLong; +import java.util.Arrays; +import junit.framework.TestCase; + +/** + * Unit test for Fingerprint2011. + * + * @author kylemaddison@google.com (Kyle Maddison) + */ +public class Fingerprint2011Test extends TestCase { + + // Length of the sample string to produce + private static final int MAX_BYTES = 1000; + + // Map from sample string lengths to the fingerprint + private static final ImmutableSortedMap<Integer, Long> LENGTH_FINGERPRINTS = + new ImmutableSortedMap.Builder<Integer, Long>(Ordering.natural()) + .put(1000, 0x433109b33e13e6edL) + .put(800, 0x5f2f123bfc815f81L) + .put(640, 0x6396fc6a67293cf4L) + .put(512, 0x45c01b4934ddbbbeL) + .put(409, 0xfcd19b617551db45L) + .put(327, 0x4eee69e12854871eL) + .put(261, 0xab753446a3bbd532L) + .put(208, 0x54242fe06a291c3fL) + .put(166, 0x4f7acff7703a635bL) + .put(132, 0xa784bd0a1f22cc7fL) + .put(105, 0xf19118e187456638L) + .put(84, 0x3e2e58f9196abfe5L) + .put(67, 0xd38ae3dec0107aeaL) + .put(53, 0xea3033885868e10eL) + .put(42, 0x1394a146d0d7e04bL) + .put(33, 0x9962499315d2e8daL) + .put(26, 0x0849f5cfa85489b5L) + .put(20, 0x83b395ff19bf2171L) + .put(16, 0x9d33dd141bd55d9aL) + .put(12, 0x196248eb0b02466aL) + .put(9, 0x1cf73a50ff120336L) + .put(7, 0xb451c339457dbf51L) + .put(5, 0x681982c5e7b74064L) + .put(4, 0xc5ce47450ca6c021L) + .put(3, 0x9fcc3c3fde4d5ff7L) + .put(2, 0x090966a836e5fa4bL) + .put(1, 0x8199675ecaa6fe64L) + .put(0, 0x23ad7c904aa665e3L) + .build(); + private static final HashFunction HASH_FN = Hashing.fingerprint2011(); + + // If this test fails, all bets are off + public void testReallySimpleFingerprints() { + assertEquals(8473225671271759044L, fingerprint("test".getBytes(UTF_8))); + // 32 characters long + assertEquals(7345148637025587076L, fingerprint(Strings.repeat("test", 8).getBytes(UTF_8))); + // 256 characters long + assertEquals(4904844928629814570L, fingerprint(Strings.repeat("test", 64).getBytes(UTF_8))); + } + + public void testStringsConsistency() { + for (String s : Arrays.asList("", "some", "test", "strings", "to", "try")) { + assertEquals(HASH_FN.newHasher().putUnencodedChars(s).hash(), HASH_FN.hashUnencodedChars(s)); + } + } + + public void testUtf8() { + char[] charsA = new char[128]; + char[] charsB = new char[128]; + + for (int i = 0; i < charsA.length; i++) { + if (i < 100) { + charsA[i] = 'a'; + charsB[i] = 'a'; + } else { + // Both two-byte characters, but must be different + charsA[i] = (char) (0x0180 + i); + charsB[i] = (char) (0x0280 + i); + } + } + + String stringA = new String(charsA); + String stringB = new String(charsB); + assertThat(stringA).isNotEqualTo(stringB); + assertThat(HASH_FN.hashUnencodedChars(stringA)) + .isNotEqualTo(HASH_FN.hashUnencodedChars(stringB)); + assertThat(fingerprint(stringA.getBytes(UTF_8))) + .isNotEqualTo(fingerprint(stringB.getBytes(UTF_8))); + + // ISO 8859-1 only has 0-255 (ubyte) representation so throws away UTF-8 characters + // greater than 127 (ie with their top bit set). + // Don't attempt to do this in real code. + assertEquals( + fingerprint(stringA.getBytes(ISO_8859_1)), fingerprint(stringB.getBytes(ISO_8859_1))); + } + + public void testMumurHash64() { + byte[] bytes = "test".getBytes(UTF_8); + assertEquals( + 1618900948208871284L, Fingerprint2011.murmurHash64WithSeed(bytes, 0, bytes.length, 1)); + + bytes = "test test test".getBytes(UTF_8); + assertEquals( + UnsignedLong.valueOf("12313169684067793560").longValue(), + Fingerprint2011.murmurHash64WithSeed(bytes, 0, bytes.length, 1)); + } + + public void testPutNonChars() { + Hasher hasher = HASH_FN.newHasher(); + // Expected data is 0x0100010100000000 + hasher + .putBoolean(true) + .putBoolean(true) + .putBoolean(false) + .putBoolean(true) + .putBoolean(false) + .putBoolean(false) + .putBoolean(false) + .putBoolean(false); + final long hashCode = hasher.hash().asLong(); + + hasher = HASH_FN.newHasher(); + hasher + .putByte((byte) 0x01) + .putByte((byte) 0x01) + .putByte((byte) 0x00) + .putByte((byte) 0x01) + .putByte((byte) 0x00) + .putByte((byte) 0x00) + .putByte((byte) 0x00) + .putByte((byte) 0x00); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher + .putChar((char) 0x0101) + .putChar((char) 0x0100) + .putChar((char) 0x0000) + .putChar((char) 0x0000); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putBytes(new byte[] {0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putLong(0x0000000001000101L); + assertEquals(hashCode, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher + .putShort((short) 0x0101) + .putShort((short) 0x0100) + .putShort((short) 0x0000) + .putShort((short) 0x0000); + assertEquals(hashCode, hasher.hash().asLong()); + } + + public void testHashFloatIsStable() { + // This is about the best we can do for floating-point + Hasher hasher = HASH_FN.newHasher(); + hasher.putFloat(0x01000101f).putFloat(0f); + assertEquals(0x96a4f8cc6ecbf16L, hasher.hash().asLong()); + + hasher = HASH_FN.newHasher(); + hasher.putDouble(0x0000000001000101d); + assertEquals(0xcf54171253fdc198L, hasher.hash().asLong()); + } + + /** Convenience method to compute a fingerprint on a full bytes array. */ + private static long fingerprint(byte[] bytes) { + return fingerprint(bytes, bytes.length); + } + + /** Convenience method to compute a fingerprint on a subset of a byte array. */ + private static long fingerprint(byte[] bytes, int length) { + return HASH_FN.hashBytes(bytes, 0, length).asLong(); + } + + /** + * Tests that the Java port of Fingerprint2011 provides the same results on buffers up to 800 + * bytes long as the original implementation in C++. See http://cl/106539598 + */ + public void testMultipleLengths() { + int iterations = 800; + byte[] buf = new byte[iterations * 4]; + int bufLen = 0; + long h = 0; + for (int i = 0; i < iterations; ++i) { + h ^= fingerprint(buf, i); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, i * i % bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, i * i * i % bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + h ^= fingerprint(buf, bufLen); + h = remix(h); + buf[bufLen++] = getChar(h); + + int x0 = buf[bufLen - 1] & 0xff; + int x1 = buf[bufLen - 2] & 0xff; + int x2 = buf[bufLen - 3] & 0xff; + int x3 = buf[bufLen / 2] & 0xff; + buf[((x0 << 16) + (x1 << 8) + x2) % bufLen] ^= x3; + buf[((x1 << 16) + (x2 << 8) + x3) % bufLen] ^= i % 256; + } + assertEquals(0xeaa3b1c985261632L, h); + } + + private static long remix(long h) { + h ^= h >>> 41; + h *= 949921979; + return h; + } + + private static byte getChar(long h) { + return (byte) ('a' + ((h & 0xfffff) % 26)); + } +} diff --git a/guava-tests/test/com/google/common/hash/HashingTest.java b/guava-tests/test/com/google/common/hash/HashingTest.java index bc3db34f0..aff5c254f 100644 --- a/guava-tests/test/com/google/common/hash/HashingTest.java +++ b/guava-tests/test/com/google/common/hash/HashingTest.java @@ -125,6 +125,15 @@ public class HashingTest extends TestCase { Hashing.sipHash24().toString()); } + public void testFingerprint2011() { + HashTestUtils.check2BitAvalanche(Hashing.fingerprint2011(), 100, 0.4); + HashTestUtils.checkAvalanche(Hashing.fingerprint2011(), 100, 0.4); + HashTestUtils.checkNo2BitCharacteristics(Hashing.fingerprint2011()); + HashTestUtils.checkNoFunnels(Hashing.fingerprint2011()); + HashTestUtils.assertInvariants(Hashing.fingerprint2011()); + assertEquals("Hashing.fingerprint2011()", Hashing.fingerprint2011().toString()); + } + @AndroidIncompatible // slow TODO(cpovirk): Maybe just reduce iterations under Android. public void testGoodFastHash() { for (int i = 1; i < 200; i += 17) { @@ -492,6 +501,9 @@ public class HashingTest extends TestCase { .put(Hashing.farmHashFingerprint64(), EMPTY_STRING, "4f40902f3b6ae19a") .put(Hashing.farmHashFingerprint64(), TQBFJOTLD, "34511b3bf383beab") .put(Hashing.farmHashFingerprint64(), TQBFJOTLDP, "737d7e5f8660653e") + .put(Hashing.fingerprint2011(), EMPTY_STRING, "e365a64a907cad23") + .put(Hashing.fingerprint2011(), TQBFJOTLD, "c9688c84e813b089") + .put(Hashing.fingerprint2011(), TQBFJOTLDP, "a714d70f1d569cd0") .build(); public void testAllHashFunctionsHaveKnownHashes() throws Exception { diff --git a/guava-tests/test/com/google/common/io/ByteStreamsTest.java b/guava-tests/test/com/google/common/io/ByteStreamsTest.java index 3ae2c2559..dddae1ffc 100644 --- a/guava-tests/test/com/google/common/io/ByteStreamsTest.java +++ b/guava-tests/test/com/google/common/io/ByteStreamsTest.java @@ -562,12 +562,49 @@ public class ByteStreamsTest extends IoTestCase { // write to the output stream nos.write('n'); String test = "Test string for NullOutputStream"; - nos.write(test.getBytes()); - nos.write(test.getBytes(), 2, 10); + byte[] bytes = test.getBytes(Charsets.US_ASCII); + nos.write(bytes); + nos.write(bytes, 2, 10); + nos.write(bytes, bytes.length - 5, 5); // nothing really to assert? assertSame(ByteStreams.nullOutputStream(), ByteStreams.nullOutputStream()); } + public void testNullOutputStream_exceptions() throws Exception { + OutputStream nos = ByteStreams.nullOutputStream(); + try { + nos.write(null); + fail(); + } catch (NullPointerException expected) { + } + try { + nos.write(null, 0, 1); + fail(); + } catch (NullPointerException expected) { + } + byte[] tenBytes = new byte[10]; + try { + nos.write(tenBytes, -1, 1); + fail("Expected exception from negative offset"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 1, -1); + fail("Expected exception from negative length"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 9, 2); + fail("Expected exception from offset+length > array size"); + } catch (IndexOutOfBoundsException expected) { + } + try { + nos.write(tenBytes, 9, 100); + fail("Expected exception from offset+length > array size"); + } catch (IndexOutOfBoundsException expected) { + } + } + public void testLimit() throws Exception { byte[] big = newPreFilledByteArray(5); InputStream bin = new ByteArrayInputStream(big); diff --git a/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java b/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java index f8e40df25..160df410b 100644 --- a/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java +++ b/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java @@ -92,6 +92,7 @@ public class LittleEndianDataInputStreamTest extends TestCase { } } + @SuppressWarnings("DoNotCall") public void testReadLine() throws IOException { DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data)); try { diff --git a/guava-tests/test/com/google/common/io/SourceSinkTester.java b/guava-tests/test/com/google/common/io/SourceSinkTester.java index 9b07355a6..55a302f85 100644 --- a/guava-tests/test/com/google/common/io/SourceSinkTester.java +++ b/guava-tests/test/com/google/common/io/SourceSinkTester.java @@ -69,7 +69,7 @@ public class SourceSinkTester<S, T, F extends SourceSinkFactory<S, T>> extends T .put("\\n at EOF", "hello\nworld\n") .put("\\r at EOF", "hello\nworld\r") .put("lorem ipsum", LOREM_IPSUM) - .build(); + .buildOrThrow(); protected final F factory; protected final T data; diff --git a/guava-tests/test/com/google/common/math/IntMathTest.java b/guava-tests/test/com/google/common/math/IntMathTest.java index 12b23e214..4db13adbd 100644 --- a/guava-tests/test/com/google/common/math/IntMathTest.java +++ b/guava-tests/test/com/google/common/math/IntMathTest.java @@ -137,10 +137,11 @@ public class IntMathTest extends TestCase { @GwtIncompatible // BigIntegerMath // TODO(cpovirk): GWT-enable BigIntegerMath public void testConstantsHalfPowersOf10() { for (int i = 0; i < IntMath.halfPowersOf10.length; i++) { - assert IntMath.halfPowersOf10[i] - == Math.min( + assertEquals( + IntMath.halfPowersOf10[i], + Math.min( Integer.MAX_VALUE, - BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * i + 1), FLOOR).longValue()); + BigIntegerMath.sqrt(BigInteger.TEN.pow(2 * i + 1), FLOOR).longValue())); } } diff --git a/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java b/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java index 54d310f0d..ddb2064e2 100644 --- a/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java +++ b/guava-tests/test/com/google/common/math/QuantilesAlgorithm.java @@ -53,7 +53,7 @@ enum QuantilesAlgorithm { for (int index : indexes) { builder.put(index, singleQuantileFromSorted(index, scale, dataset)); } - return builder.build(); + return builder.buildOrThrow(); } private double singleQuantileFromSorted(int index, int scale, double[] dataset) { @@ -97,7 +97,7 @@ enum QuantilesAlgorithm { for (int index : indexes) { builder.put(index, singleQuantile(index, scale, dataset)); } - return builder.build(); + return builder.buildOrThrow(); } }, diff --git a/guava-tests/test/com/google/common/math/QuantilesTest.java b/guava-tests/test/com/google/common/math/QuantilesTest.java index a9b787299..e5d113dfc 100644 --- a/guava-tests/test/com/google/common/math/QuantilesTest.java +++ b/guava-tests/test/com/google/common/math/QuantilesTest.java @@ -557,7 +557,7 @@ public class QuantilesTest extends TestCase { } assertThat(percentiles().indexes(index1, index2).compute(PSEUDORANDOM_DATASET)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); } } } @@ -573,7 +573,7 @@ public class QuantilesTest extends TestCase { Collections.shuffle(indexes, random); assertThat(percentiles().indexes(Ints.toArray(indexes)).compute(PSEUDORANDOM_DATASET)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); } @AndroidIncompatible // slow @@ -589,7 +589,7 @@ public class QuantilesTest extends TestCase { Collections.shuffle(indexes, random); assertThat(percentiles().indexes(Ints.toArray(indexes)).computeInPlace(dataset)) .comparingValuesUsing(QUANTILE_CORRESPONDENCE) - .containsExactlyEntriesIn(expectedBuilder.build()); + .containsExactlyEntriesIn(expectedBuilder.buildOrThrow()); assertThat(dataset).usingExactEquality().containsExactlyElementsIn(PSEUDORANDOM_DATASET); } diff --git a/guava-tests/test/com/google/common/net/HostSpecifierTest.java b/guava-tests/test/com/google/common/net/HostSpecifierTest.java index fadeff7aa..8112879a8 100644 --- a/guava-tests/test/com/google/common/net/HostSpecifierTest.java +++ b/guava-tests/test/com/google/common/net/HostSpecifierTest.java @@ -92,8 +92,9 @@ public final class HostSpecifierTest extends TestCase { } private void assertGood(String spec) throws ParseException { - HostSpecifier.fromValid(spec); // Throws exception if not working correctly - HostSpecifier.from(spec); + // Throws exception if not working correctly + HostSpecifier unused = HostSpecifier.fromValid(spec); + unused = HostSpecifier.from(spec); assertTrue(HostSpecifier.isValid(spec)); } diff --git a/guava-tests/test/com/google/common/net/InternetDomainNameTest.java b/guava-tests/test/com/google/common/net/InternetDomainNameTest.java index 7113fb457..c440ee53f 100644 --- a/guava-tests/test/com/google/common/net/InternetDomainNameTest.java +++ b/guava-tests/test/com/google/common/net/InternetDomainNameTest.java @@ -232,7 +232,7 @@ public final class InternetDomainNameTest extends TestCase { public void testValid() { for (String name : VALID_NAME) { - InternetDomainName.from(name); + InternetDomainName unused = InternetDomainName.from(name); } } @@ -392,7 +392,7 @@ public final class InternetDomainNameTest extends TestCase { // These would throw an exception if leniency were not preserved during parent() and child() // calls. InternetDomainName child = parent.child(LOTS_OF_DELTAS); - child.child(LOTS_OF_DELTAS); + InternetDomainName unused = child.child(LOTS_OF_DELTAS); } public void testValidTopPrivateDomain() { diff --git a/guava-tests/test/com/google/common/net/PercentEscaperTest.java b/guava-tests/test/com/google/common/net/PercentEscaperTest.java index 8443680e7..e600e4c7c 100644 --- a/guava-tests/test/com/google/common/net/PercentEscaperTest.java +++ b/guava-tests/test/com/google/common/net/PercentEscaperTest.java @@ -120,16 +120,11 @@ public class PercentEscaperTest extends TestCase { } } - /** - * Tests that if space is a safe character you cannot also specify 'plusForSpace' (throws {@link - * IllegalArgumentException}). - */ public void testBadArguments_plusforspace() { - try { - new PercentEscaper(" ", false); - } catch (IllegalArgumentException e) { - fail("Space can be a 'safe' character if plusForSpace is false"); - } + // space can be a safe char if plusForSpace is false + PercentEscaper unused = new PercentEscaper(" ", false); + + // space cannot be a safe char is plusForSpace is true String msg = "plusForSpace cannot be specified when space is a 'safe' character"; try { new PercentEscaper(" ", true); diff --git a/guava-tests/test/com/google/common/primitives/BooleansTest.java b/guava-tests/test/com/google/common/primitives/BooleansTest.java index 560c33700..43ec04c4a 100644 --- a/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/guava-tests/test/com/google/common/primitives/BooleansTest.java @@ -299,7 +299,8 @@ public class BooleansTest extends TestCase { assertEquals(1, Booleans.asList(ARRAY_FALSE_TRUE).lastIndexOf(true)); List<Boolean> reference = Booleans.asList(ARRAY_FALSE); assertEquals(Booleans.asList(ARRAY_FALSE), reference); - assertEquals(reference, reference); + // Explicitly call `equals`; `assertEquals` might return fast + assertTrue(reference.equals(reference)); } public void testAsListHashcode() { diff --git a/guava-tests/test/com/google/common/reflect/InvokableTest.java b/guava-tests/test/com/google/common/reflect/InvokableTest.java index 3e51c82d3..5e15d6643 100644 --- a/guava-tests/test/com/google/common/reflect/InvokableTest.java +++ b/guava-tests/test/com/google/common/reflect/InvokableTest.java @@ -601,7 +601,7 @@ public class InvokableTest extends TestCase { } public void testAnonymousClassInConstructor() { - new AnonymousClassInConstructor(); + AnonymousClassInConstructor unused = new AnonymousClassInConstructor(); } private static class AnonymousClassInConstructor { @@ -621,7 +621,7 @@ public class InvokableTest extends TestCase { } public void testLocalClassInInstanceInitializer() { - new LocalClassInInstanceInitializer(); + LocalClassInInstanceInitializer unused = new LocalClassInInstanceInitializer(); } private static class LocalClassInInstanceInitializer { @@ -633,7 +633,7 @@ public class InvokableTest extends TestCase { } public void testLocalClassInStaticInitializer() { - new LocalClassInStaticInitializer(); + LocalClassInStaticInitializer unused = new LocalClassInStaticInitializer(); } private static class LocalClassInStaticInitializer { @@ -645,7 +645,8 @@ public class InvokableTest extends TestCase { } public void testLocalClassWithSeeminglyHiddenThisInStaticInitializer_BUG() { - new LocalClassWithSeeminglyHiddenThisInStaticInitializer(); + LocalClassWithSeeminglyHiddenThisInStaticInitializer unused = + new LocalClassWithSeeminglyHiddenThisInStaticInitializer(); } /** diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java index f49b96245..991cada29 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java @@ -359,7 +359,6 @@ abstract class AbstractAbstractFutureTest extends TestCase { } @GwtIncompatible // threads - public void testOverflowTimeout() throws Exception { // First, sanity check that naive multiplication would really overflow to a negative number: long nanosPerSecond = NANOSECONDS.convert(1, SECONDS); diff --git a/guava-tests/test/com/google/common/util/concurrent/ClosingFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java index ab0e5f8d6..ecccd784c 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ClosingFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractClosingFutureTest.java @@ -81,7 +81,7 @@ import org.mockito.Mockito; * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)} paths to complete a * {@link ClosingFuture} pipeline. */ -public abstract class ClosingFutureTest extends TestCase { +public abstract class AbstractClosingFutureTest extends TestCase { // TODO(dpb): Use Expect once that supports JUnit 3, or we can use JUnit 4. final List<AssertionError> failures = new ArrayList<>(); final StandardSubjectBuilder expect = @@ -1633,7 +1633,7 @@ public abstract class ClosingFutureTest extends TestCase { /** * Marks the given step final and waits for it to fail. Expects the failure exception to match - * {@link ClosingFutureTest#exception}. + * {@link AbstractClosingFutureTest#exception}. */ abstract void assertFinallyFailsWithException(ClosingFuture<?> closingFuture); @@ -1645,191 +1645,6 @@ public abstract class ClosingFutureTest extends TestCase { assertTrue(awaitUninterruptibly(closingFuture.whenClosedCountDown(), 1, SECONDS)); } - /** Tests for {@link ClosingFuture} that exercise {@link ClosingFuture#finishToFuture()}. */ - - public static class FinishToFutureTest extends ClosingFutureTest { - - public void testFinishToFuture_throwsIfCalledTwice() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - try { - FluentFuture<Closeable> unused2 = closingFuture.finishToFuture(); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToFuture_throwsAfterCallingFinishToValueAndCloser() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - closingFuture.finishToValueAndCloser(new NoOpValueAndCloserConsumer<>(), directExecutor()); - try { - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToFuture_preventsFurtherDerivation() { - ClosingFuture<String> closingFuture = ClosingFuture.from(immediateFuture("value1")); - FluentFuture<String> unused = closingFuture.finishToFuture(); - assertDerivingThrowsIllegalStateException(closingFuture); - } - - @Override - <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { - return getUninterruptibly(closingFuture.finishToFuture()); - } - - @Override - void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { - assertThatFutureFailsWithException(closingFuture.finishToFuture()); - } - - @Override - void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { - assertThatFutureBecomesCancelled(closingFuture.finishToFuture()); - } - - @Override - void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { - assertThat(closingFuture.finishToFuture().cancel(false)).isTrue(); - waitUntilClosed(closingFuture); - futureCancelled.countDown(); - } - } - - /** - * Tests for {@link ClosingFuture} that exercise {@link - * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)}. - */ - - public static class FinishToValueAndCloserTest extends ClosingFutureTest { - - private final ExecutorService finishToValueAndCloserExecutor = newSingleThreadExecutor(); - private volatile ValueAndCloser<?> valueAndCloser; - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - assertWithMessage("finishToValueAndCloserExecutor was shut down") - .that(shutdownAndAwaitTermination(finishToValueAndCloserExecutor, 10, SECONDS)) - .isTrue(); - } - - public void testFinishToValueAndCloser_throwsIfCalledTwice() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - try { - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - public void testFinishToValueAndCloser_throwsAfterCallingFinishToFuture() throws Exception { - ClosingFuture<Closeable> closingFuture = - ClosingFuture.submit( - new ClosingCallable<Closeable>() { - @Override - public Closeable call(DeferredCloser closer) throws Exception { - return closer.eventuallyClose(mockCloseable, executor); - } - }, - executor); - FluentFuture<Closeable> unused = closingFuture.finishToFuture(); - try { - closingFuture.finishToValueAndCloser( - new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); - fail("should have thrown"); - } catch (IllegalStateException expected) { - } - } - - @Override - <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { - return finishToValueAndCloser(closingFuture).get(); - } - - @Override - void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { - assertThatFutureFailsWithException(closingFuture.statusFuture()); - ValueAndCloser<?> valueAndCloser = finishToValueAndCloser(closingFuture); - try { - valueAndCloser.get(); - fail(); - } catch (ExecutionException expected) { - assertThat(expected).hasCauseThat().isSameInstanceAs(exception); - } - valueAndCloser.closeAsync(); - } - - @Override - void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { - assertThatFutureBecomesCancelled(closingFuture.statusFuture()); - } - - @Override - void waitUntilClosed(ClosingFuture<?> closingFuture) { - if (valueAndCloser != null) { - valueAndCloser.closeAsync(); - } - super.waitUntilClosed(closingFuture); - } - - @Override - void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { - assertThat(closingFuture.cancel(false)).isTrue(); - ValueAndCloser<?> unused = finishToValueAndCloser(closingFuture); - waitUntilClosed(closingFuture); - futureCancelled.countDown(); - } - - private <V> ValueAndCloser<V> finishToValueAndCloser(ClosingFuture<V> closingFuture) { - final CountDownLatch valueAndCloserSet = new CountDownLatch(1); - closingFuture.finishToValueAndCloser( - new ValueAndCloserConsumer<V>() { - @Override - public void accept(ValueAndCloser<V> valueAndCloser) { - FinishToValueAndCloserTest.this.valueAndCloser = valueAndCloser; - valueAndCloserSet.countDown(); - } - }, - finishToValueAndCloserExecutor); - assertWithMessage("valueAndCloser was set") - .that(awaitUninterruptibly(valueAndCloserSet, 10, SECONDS)) - .isTrue(); - @SuppressWarnings("unchecked") - ValueAndCloser<V> valueAndCloserWithType = (ValueAndCloser<V>) valueAndCloser; - return valueAndCloserWithType; - } - } - void assertThatFutureFailsWithException(Future<?> future) { try { getUninterruptibly(future); @@ -1839,7 +1654,7 @@ public abstract class ClosingFutureTest extends TestCase { } } - private static void assertThatFutureBecomesCancelled(Future<?> future) throws ExecutionException { + static void assertThatFutureBecomesCancelled(Future<?> future) throws ExecutionException { try { getUninterruptibly(future); fail("Expected future to be canceled: " + future); @@ -2006,7 +1821,7 @@ public abstract class ClosingFutureTest extends TestCase { } } - private static final class NoOpValueAndCloserConsumer<V> implements ValueAndCloserConsumer<V> { + static final class NoOpValueAndCloserConsumer<V> implements ValueAndCloserConsumer<V> { @Override public void accept(ValueAndCloser<V> valueAndCloser) {} } diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java index 557fc0b5f..9b3f0f867 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractExecutionThreadServiceTest.java @@ -68,7 +68,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { thrownByExecutionThread); } - public void testServiceStartStop() throws Exception { WaitOnRunService service = new WaitOnRunService(); assertFalse(service.startUpCalled); @@ -85,7 +84,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { executionThread.join(); } - public void testServiceStopIdempotence() throws Exception { WaitOnRunService service = new WaitOnRunService(); @@ -102,7 +100,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { executionThread.join(); } - public void testServiceExitingOnItsOwn() throws Exception { WaitOnRunService service = new WaitOnRunService(); service.expectedShutdownState = Service.State.RUNNING; @@ -173,7 +170,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnStartUp() throws Exception { ThrowOnStartUpService service = new ThrowOnStartUpService(); assertFalse(service.startUpCalled); @@ -212,7 +208,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnRun() throws Exception { ThrowOnRunService service = new ThrowOnRunService(); @@ -229,7 +224,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { assertEquals(Service.State.FAILED, service.state()); } - public void testServiceThrowOnRunAndThenAgainOnShutDown() throws Exception { ThrowOnRunService service = new ThrowOnRunService(); service.throwOnShutDown = true; @@ -271,7 +265,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { } } - public void testServiceThrowOnShutDown() throws Exception { ThrowOnShutDown service = new ThrowOnShutDown(); @@ -331,7 +324,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { protected void run() throws Exception {} } - public void testStopWhileStarting_runNotCalled() throws Exception { final CountDownLatch started = new CountDownLatch(1); FakeService service = @@ -361,7 +353,6 @@ public class AbstractExecutionThreadServiceTest extends TestCase { assertEquals(0, service.shutdownCalled); } - public void testDefaultService() throws InterruptedException { WaitOnRunService service = new WaitOnRunService(); service.startAsync().awaitRunning(); diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java index 6c921b5b6..9aee78029 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractFutureCancellationCauseTest.java @@ -30,6 +30,7 @@ import javax.annotation.concurrent.GuardedBy; import junit.framework.TestCase; /** Tests for {@link AbstractFuture} with the cancellation cause system property set */ +@AndroidIncompatible // custom classloading public class AbstractFutureCancellationCauseTest extends TestCase { diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java index e55a31e72..dc020fb20 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractFutureTest.java @@ -52,7 +52,6 @@ import junit.framework.TestCase; * * @author Brian Stoler */ - public class AbstractFutureTest extends TestCase { public void testSuccess() throws ExecutionException, InterruptedException { final Object value = new Object(); @@ -292,6 +291,7 @@ public class AbstractFutureTest extends TestCase { * derived from observing how much time actually passed for various operations. */ @SuppressWarnings({"DeprecatedThreadMethods", "ThreadPriorityCheck"}) + @AndroidIncompatible // Thread.suspend public void testToString_delayedTimeout() throws Exception { TimedWaiterThread thread = new TimedWaiterThread(new AbstractFuture<Object>() {}, 2, TimeUnit.SECONDS); diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java index 7cad8b0fa..2df5a4f3a 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractIdleServiceTest.java @@ -36,7 +36,6 @@ public class AbstractIdleServiceTest extends TestCase { // Functional tests using real thread. We only verify publicly visible state. // Interaction assertions are done by the single-threaded unit tests. - public static class FunctionalTest extends TestCase { private static class DefaultService extends AbstractIdleService { diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java index a2411ad50..a05a83869 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java @@ -19,6 +19,8 @@ package com.google.common.util.concurrent; import static com.google.common.truth.Truth.assertThat; import static com.google.common.util.concurrent.AbstractScheduledService.Scheduler.newFixedDelaySchedule; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.util.concurrent.AbstractScheduledService.Cancellable; @@ -47,10 +49,9 @@ import junit.framework.TestCase; * * @author Luke Sandberg */ - public class AbstractScheduledServiceTest extends TestCase { - volatile Scheduler configuration = newFixedDelaySchedule(0, 10, TimeUnit.MILLISECONDS); + volatile Scheduler configuration = newFixedDelaySchedule(0, 10, MILLISECONDS); volatile ScheduledFuture<?> future = null; volatile boolean atFixedRateCalled = false; @@ -113,7 +114,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.startAsync().awaitRunning(); fail(); } catch (IllegalStateException e) { - assertEquals(service.startUpException, e.getCause()); + assertThat(e).hasCauseThat().isEqualTo(service.startUpException); } assertEquals(0, service.numberOfTimesRunCalled.get()); assertEquals(Service.State.FAILED, service.state()); @@ -156,7 +157,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); fail(); } catch (IllegalStateException e) { - assertEquals(service.shutDownException, e.getCause()); + assertThat(e).hasCauseThat().isEqualTo(service.shutDownException); } assertEquals(Service.State.FAILED, service.state()); } @@ -208,7 +209,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override protected Scheduler scheduler() { - return newFixedDelaySchedule(0, 1, TimeUnit.MILLISECONDS); + return newFixedDelaySchedule(0, 1, MILLISECONDS); } }; @@ -217,7 +218,7 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitRunning(); service.stopAsync(); service.awaitTerminated(); - assertTrue(executor.get().awaitTermination(100, TimeUnit.MILLISECONDS)); + assertTrue(executor.get().awaitTermination(100, MILLISECONDS)); } public void testDefaultExecutorIsShutdownWhenServiceFails() throws Exception { @@ -240,7 +241,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override protected Scheduler scheduler() { - return newFixedDelaySchedule(0, 1, TimeUnit.MILLISECONDS); + return newFixedDelaySchedule(0, 1, MILLISECONDS); } }; @@ -250,7 +251,7 @@ public class AbstractScheduledServiceTest extends TestCase { } catch (IllegalStateException expected) { } - assertTrue(executor.get().awaitTermination(100, TimeUnit.MILLISECONDS)); + assertTrue(executor.get().awaitTermination(100, MILLISECONDS)); } public void testSchedulerOnlyCalledOnce() throws Exception { @@ -277,7 +278,7 @@ public class AbstractScheduledServiceTest extends TestCase { new AbstractScheduledService() { @Override protected Scheduler scheduler() { - return Scheduler.newFixedDelaySchedule(0, 1, TimeUnit.NANOSECONDS); + return Scheduler.newFixedDelaySchedule(0, 1, NANOSECONDS); } @Override @@ -294,7 +295,7 @@ public class AbstractScheduledServiceTest extends TestCase { } }; try { - service.startAsync().awaitRunning(1, TimeUnit.MILLISECONDS); + service.startAsync().awaitRunning(1, MILLISECONDS); fail("Expected timeout"); } catch (TimeoutException e) { assertThat(e) @@ -366,9 +367,9 @@ public class AbstractScheduledServiceTest extends TestCase { public static class SchedulerTest extends TestCase { // These constants are arbitrary and just used to make sure that the correct method is called // with the correct parameters. - private static final int initialDelay = 10; - private static final int delay = 20; - private static final TimeUnit unit = TimeUnit.MILLISECONDS; + private static final int INITIAL_DELAY = 10; + private static final int DELAY = 20; + private static final TimeUnit UNIT = MILLISECONDS; // Unique runnable object used for comparison. final Runnable testRunnable = @@ -382,14 +383,14 @@ public class AbstractScheduledServiceTest extends TestCase { Runnable command, long initialDelay, long delay, TimeUnit unit) { assertFalse(called); // only called once. called = true; - assertEquals(SchedulerTest.initialDelay, initialDelay); - assertEquals(SchedulerTest.delay, delay); - assertEquals(SchedulerTest.unit, unit); + assertEquals(INITIAL_DELAY, initialDelay); + assertEquals(DELAY, delay); + assertEquals(UNIT, unit); assertEquals(testRunnable, command); } public void testFixedRateSchedule() { - Scheduler schedule = Scheduler.newFixedRateSchedule(initialDelay, delay, unit); + Scheduler schedule = Scheduler.newFixedRateSchedule(INITIAL_DELAY, DELAY, UNIT); Cancellable unused = schedule.schedule( null, @@ -397,7 +398,7 @@ public class AbstractScheduledServiceTest extends TestCase { @Override public ScheduledFuture<?> scheduleAtFixedRate( Runnable command, long initialDelay, long period, TimeUnit unit) { - assertSingleCallWithCorrectParameters(command, initialDelay, delay, unit); + assertSingleCallWithCorrectParameters(command, initialDelay, period, unit); return new ThrowingScheduledFuture<>(); } }, @@ -406,7 +407,7 @@ public class AbstractScheduledServiceTest extends TestCase { } public void testFixedDelaySchedule() { - Scheduler schedule = newFixedDelaySchedule(initialDelay, delay, unit); + Scheduler schedule = newFixedDelaySchedule(INITIAL_DELAY, DELAY, UNIT); Cancellable unused = schedule.schedule( null, @@ -440,7 +441,6 @@ public class AbstractScheduledServiceTest extends TestCase { } } - public void testFixedDelayScheduleFarFuturePotentiallyOverflowingScheduleIsNeverReached() throws Exception { TestAbstractScheduledCustomService service = @@ -461,7 +461,6 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); } - public void testCustomSchedulerFarFuturePotentiallyOverflowingScheduleIsNeverReached() throws Exception { TestAbstractScheduledCustomService service = @@ -487,17 +486,16 @@ public class AbstractScheduledServiceTest extends TestCase { service.awaitTerminated(); } - private class TestCustomScheduler extends AbstractScheduledService.CustomScheduler { + private static class TestCustomScheduler extends AbstractScheduledService.CustomScheduler { public AtomicInteger scheduleCounter = new AtomicInteger(0); @Override protected Schedule getNextSchedule() throws Exception { scheduleCounter.incrementAndGet(); - return new Schedule(0, TimeUnit.SECONDS); + return new Schedule(0, SECONDS); } } - public void testCustomSchedule_startStop() throws Exception { final CyclicBarrier firstBarrier = new CyclicBarrier(2); final CyclicBarrier secondBarrier = new CyclicBarrier(2); @@ -528,7 +526,6 @@ public class AbstractScheduledServiceTest extends TestCase { future.cancel(false); } - public void testCustomSchedulerServiceStop() throws Exception { TestAbstractScheduledCustomService service = new TestAbstractScheduledCustomService(); service.startAsync().awaitRunning(); @@ -538,11 +535,10 @@ public class AbstractScheduledServiceTest extends TestCase { service.secondBarrier.await(); service.awaitTerminated(); // Sleep for a while just to ensure that our task wasn't called again. - Thread.sleep(unit.toMillis(3 * delay)); + Thread.sleep(UNIT.toMillis(3 * DELAY)); assertEquals(1, service.numIterations.get()); } - public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException { final CyclicBarrier inGetNextSchedule = new CyclicBarrier(2); // This will flakily deadlock, so run it multiple times to increase the flake likelihood @@ -562,7 +558,7 @@ public class AbstractScheduledServiceTest extends TestCase { Thread.yield(); throw new RuntimeException("boom"); } - return new Schedule(0, TimeUnit.NANOSECONDS); + return new Schedule(0, NANOSECONDS); } }; } @@ -573,7 +569,6 @@ public class AbstractScheduledServiceTest extends TestCase { } } - public void testBig() throws Exception { TestAbstractScheduledCustomService service = new TestAbstractScheduledCustomService() { @@ -584,7 +579,7 @@ public class AbstractScheduledServiceTest extends TestCase { protected Schedule getNextSchedule() throws Exception { // Explicitly yield to increase the probability of a pathological scheduling. Thread.yield(); - return new Schedule(0, TimeUnit.SECONDS); + return new Schedule(0, SECONDS); } }; } @@ -627,13 +622,12 @@ public class AbstractScheduledServiceTest extends TestCase { return new CustomScheduler() { @Override protected Schedule getNextSchedule() throws Exception { - return new Schedule(delay, unit); + return new Schedule(DELAY, UNIT); } }; } } - public void testCustomSchedulerFailure() throws Exception { TestFailingCustomScheduledService service = new TestFailingCustomScheduledService(); service.startAsync().awaitRunning(); @@ -644,7 +638,7 @@ public class AbstractScheduledServiceTest extends TestCase { } Thread.sleep(1000); try { - service.stopAsync().awaitTerminated(100, TimeUnit.SECONDS); + service.stopAsync().awaitTerminated(100, SECONDS); fail(); } catch (IllegalStateException e) { assertEquals(State.FAILED, service.state()); @@ -677,7 +671,7 @@ public class AbstractScheduledServiceTest extends TestCase { if (numIterations.get() > 2) { throw new IllegalStateException("Failed"); } - return new Schedule(delay, unit); + return new Schedule(DELAY, UNIT); } }; } diff --git a/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java b/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java index e3c22a867..5f4210621 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AbstractServiceTest.java @@ -330,7 +330,6 @@ public class AbstractServiceTest extends TestCase { } } - public void testAwaitTerminated() throws Exception { final NoOpService service = new NoOpService(); Thread waiter = @@ -348,7 +347,6 @@ public class AbstractServiceTest extends TestCase { assertFalse(waiter.isAlive()); } - public void testAwaitTerminated_FailedService() throws Exception { final ManualSwitchedService service = new ManualSwitchedService(); final AtomicReference<Throwable> exception = Atomics.newReference(); @@ -376,7 +374,6 @@ public class AbstractServiceTest extends TestCase { assertThat(exception.get()).hasCauseThat().isEqualTo(EXCEPTION); } - public void testThreadedServiceStartAndWaitStopAndWait() throws Throwable { ThreadedService service = new ThreadedService(); RecordingListener listener = RecordingListener.record(service); @@ -394,7 +391,6 @@ public class AbstractServiceTest extends TestCase { listener.getStateHistory()); } - public void testThreadedServiceStopIdempotence() throws Throwable { ThreadedService service = new ThreadedService(); @@ -410,7 +406,6 @@ public class AbstractServiceTest extends TestCase { throwIfSet(thrownByExecutionThread); } - public void testThreadedServiceStopIdempotenceAfterWait() throws Throwable { ThreadedService service = new ThreadedService(); @@ -428,7 +423,6 @@ public class AbstractServiceTest extends TestCase { throwIfSet(thrownByExecutionThread); } - public void testThreadedServiceStopIdempotenceDoubleWait() throws Throwable { ThreadedService service = new ThreadedService(); @@ -661,7 +655,6 @@ public class AbstractServiceTest extends TestCase { } } - public void testAddListenerAfterFailureDoesntCauseDeadlock() throws InterruptedException { final StartFailingService service = new StartFailingService(); service.startAsync(); @@ -681,7 +674,6 @@ public class AbstractServiceTest extends TestCase { assertFalse(thread + " is deadlocked", thread.isAlive()); } - public void testListenerDoesntDeadlockOnStartAndWaitFromRunning() throws Exception { final NoOpThreadedService service = new NoOpThreadedService(); service.addListener( @@ -696,7 +688,6 @@ public class AbstractServiceTest extends TestCase { service.stopAsync(); } - public void testListenerDoesntDeadlockOnStopAndWaitFromTerminated() throws Exception { final NoOpThreadedService service = new NoOpThreadedService(); service.addListener( diff --git a/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java b/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java index 038e2ec69..de7d58a9c 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleArrayTest.java @@ -13,6 +13,10 @@ package com.google.common.util.concurrent; +import static java.lang.Math.max; + +import com.google.common.annotations.GwtIncompatible; +import com.google.common.testing.NullPointerTester; import java.util.Arrays; /** Unit test for {@link AtomicDoubleArray}. */ @@ -48,6 +52,13 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { assertEquals(Double.doubleToRawLongBits(x), Double.doubleToRawLongBits(y)); } + @GwtIncompatible // NullPointerTester + public void testNulls() { + new NullPointerTester().testAllPublicStaticMethods(AtomicDoubleArray.class); + new NullPointerTester().testAllPublicConstructors(AtomicDoubleArray.class); + new NullPointerTester().testAllPublicInstanceMethods(new AtomicDoubleArray(1)); + } + /** constructor creates array of given size with all elements zero */ public void testConstructor() { AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); @@ -181,7 +192,6 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { } /** compareAndSet in one thread enables another waiting for value to succeed */ - public void testCompareAndSetInMultipleThreads() throws InterruptedException { final AtomicDoubleArray a = new AtomicDoubleArray(1); a.set(0, 1.0); @@ -211,7 +221,8 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { assertBitEquals(prev, aa.get(i)); assertFalse(aa.weakCompareAndSet(i, unused, x)); assertBitEquals(prev, aa.get(i)); - while (!aa.weakCompareAndSet(i, prev, x)) {; + while (!aa.weakCompareAndSet(i, prev, x)) { + ; } assertBitEquals(x, aa.get(i)); prev = x; @@ -261,6 +272,128 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { } } + /** getAndAccumulate with sum adds given value to current, and returns previous value */ + public void testGetAndAccumulateWithSum() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.getAndAccumulate(i, y, Double::sum); + assertBitEquals(x, z); + assertBitEquals(x + y, aa.get(i)); + } + } + } + } + + /** getAndAccumulate with max stores max of given value to current, and returns previous value */ + public void testGetAndAccumulateWithMax() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.getAndAccumulate(i, y, Double::max); + double expectedMax = max(x, y); + assertBitEquals(x, z); + assertBitEquals(expectedMax, aa.get(i)); + } + } + } + } + + /** accumulateAndGet with sum adds given value to current, and returns current value */ + public void testAccumulateAndGetWithSum() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.accumulateAndGet(i, y, Double::sum); + assertBitEquals(x + y, z); + assertBitEquals(x + y, aa.get(i)); + } + } + } + } + + /** accumulateAndGet with max stores max of given value to current, and returns current value */ + public void testAccumulateAndGetWithMax() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.accumulateAndGet(i, y, Double::max); + double expectedMax = max(x, y); + assertBitEquals(expectedMax, z); + assertBitEquals(expectedMax, aa.get(i)); + } + } + } + } + + /** getAndUpdate adds given value to current, and returns previous value */ + public void testGetAndUpdateWithSum() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.getAndUpdate(i, value -> value + y); + assertBitEquals(x, z); + assertBitEquals(x + y, aa.get(i)); + } + } + } + } + + /** getAndUpdate subtracts given value to current, and returns previous value */ + public void testGetAndUpdateWithSubtract() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.getAndUpdate(i, value -> value - y); + assertBitEquals(x, z); + assertBitEquals(x - y, aa.get(i)); + } + } + } + } + + /** updateAndGet adds given value to current, and returns current value */ + public void testUpdateAndGetWithSum() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.updateAndGet(i, value -> value + y); + assertBitEquals(x + y, z); + assertBitEquals(x + y, aa.get(i)); + } + } + } + } + + /** updateAndGet subtracts given value to current, and returns current value */ + public void testUpdateAndGetWithSubtract() { + AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); + for (int i : new int[] {0, SIZE - 1}) { + for (double x : VALUES) { + for (double y : VALUES) { + aa.set(i, x); + double z = aa.updateAndGet(i, value -> value - y); + assertBitEquals(x - y, z); + assertBitEquals(x - y, aa.get(i)); + } + } + } + } + static final long COUNTDOWN = 100000; class Counter extends CheckedRunnable { @@ -296,7 +429,6 @@ public class AtomicDoubleArrayTest extends JSR166TestCase { * Multiple threads using same array of counters successfully update a number of times equal to * total count */ - public void testCountingInMultipleThreads() throws InterruptedException { final AtomicDoubleArray aa = new AtomicDoubleArray(SIZE); for (int i = 0; i < SIZE; i++) { diff --git a/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java b/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java index df9bd8bd7..f7ffe51b9 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AtomicDoubleTest.java @@ -13,6 +13,7 @@ package com.google.common.util.concurrent; +import static java.lang.Math.max; /** Unit test for {@link AtomicDouble}. */ public class AtomicDoubleTest extends JSR166TestCase { @@ -97,7 +98,6 @@ public class AtomicDoubleTest extends JSR166TestCase { } /** compareAndSet in one thread enables another waiting for value to succeed */ - public void testCompareAndSetInMultipleThreads() throws Exception { final AtomicDouble at = new AtomicDouble(1.0); Thread t = @@ -125,7 +125,8 @@ public class AtomicDoubleTest extends JSR166TestCase { assertBitEquals(prev, at.get()); assertFalse(at.weakCompareAndSet(unused, x)); assertBitEquals(prev, at.get()); - while (!at.weakCompareAndSet(prev, x)) {; + while (!at.weakCompareAndSet(prev, x)) { + ; } assertBitEquals(x, at.get()); prev = x; @@ -166,6 +167,108 @@ public class AtomicDoubleTest extends JSR166TestCase { } } + /** getAndAccumulate with sum adds given value to current, and returns previous value */ + public void testGetAndAccumulateWithSum() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.getAndAccumulate(y, Double::sum); + assertBitEquals(x, z); + assertBitEquals(x + y, a.get()); + } + } + } + + /** getAndAccumulate with max stores max of given value to current, and returns previous value */ + public void testGetAndAccumulateWithMax() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.getAndAccumulate(y, Double::max); + double expectedMax = max(x, y); + assertBitEquals(x, z); + assertBitEquals(expectedMax, a.get()); + } + } + } + + /** accumulateAndGet with sum adds given value to current, and returns current value */ + public void testAccumulateAndGetWithSum() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.accumulateAndGet(y, Double::sum); + assertBitEquals(x + y, z); + assertBitEquals(x + y, a.get()); + } + } + } + + /** accumulateAndGet with max stores max of given value to current, and returns current value */ + public void testAccumulateAndGetWithMax() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.accumulateAndGet(y, Double::max); + double expectedMax = max(x, y); + assertBitEquals(expectedMax, z); + assertBitEquals(expectedMax, a.get()); + } + } + } + + /** getAndUpdate with sum stores sum of given value to current, and returns previous value */ + public void testGetAndUpdateWithSum() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.getAndUpdate(value -> value + y); + assertBitEquals(x, z); + assertBitEquals(x + y, a.get()); + } + } + } + + /** + * getAndUpdate with subtract stores subtraction of value from current, and returns previous value + */ + public void testGetAndUpdateWithSubtract() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.getAndUpdate(value -> value - y); + assertBitEquals(x, z); + assertBitEquals(x - y, a.get()); + } + } + } + + /** updateAndGet with sum stores sum of given value to current, and returns current value */ + public void testUpdateAndGetWithSum() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.updateAndGet(value -> value + y); + assertBitEquals(x + y, z); + assertBitEquals(x + y, a.get()); + } + } + } + + /** + * updateAndGet with subtract stores subtraction of value from current, and returns current value + */ + public void testUpdateAndGetWithSubtract() { + for (double x : VALUES) { + for (double y : VALUES) { + AtomicDouble a = new AtomicDouble(x); + double z = a.updateAndGet(value -> value - y); + assertBitEquals(x - y, z); + assertBitEquals(x - y, a.get()); + } + } + } + /** a deserialized serialized atomic holds same value */ public void testSerialization() throws Exception { AtomicDouble a = new AtomicDouble(); diff --git a/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java b/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java index 476582585..b1e741a68 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapBasherTest.java @@ -16,13 +16,15 @@ package com.google.common.util.concurrent; +import static java.util.concurrent.TimeUnit.SECONDS; + import com.google.common.annotations.GwtIncompatible; +import java.util.ArrayList; import java.util.Random; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; import junit.framework.TestCase; /** @@ -31,29 +33,27 @@ import junit.framework.TestCase; * @author mike nonemacher */ @GwtIncompatible // threads - public class AtomicLongMapBasherTest extends TestCase { private final Random random = new Random(301); - public void testModify_basher() throws InterruptedException { + public void testModify_basher() throws Exception { int nTasks = 3000; int nThreads = 100; final int getsPerTask = 1000; final int deltaRange = 10000; final String key = "key"; - final AtomicLong sum = new AtomicLong(); final AtomicLongMap<String> map = AtomicLongMap.create(); ExecutorService threadPool = Executors.newFixedThreadPool(nThreads); + ArrayList<Future<Long>> futures = new ArrayList<>(); for (int i = 0; i < nTasks; i++) { - @SuppressWarnings("unused") // https://errorprone.info/bugpattern/FutureReturnValueIgnored - Future<?> possiblyIgnoredError = + futures.add( threadPool.submit( - new Runnable() { + new Callable<Long>() { @Override - public void run() { - int threadSum = 0; + public Long call() { + long threadSum = 0; for (int j = 0; j < getsPerTask; j++) { long delta = random.nextInt(deltaRange); int behavior = random.nextInt(10); @@ -106,14 +106,16 @@ public class AtomicLongMapBasherTest extends TestCase { throw new AssertionError(); } } - sum.addAndGet(threadSum); + return threadSum; } - }); + })); } - threadPool.shutdown(); - assertTrue(threadPool.awaitTermination(300, TimeUnit.SECONDS)); - - assertEquals(sum.get(), map.get(key)); + assertTrue(threadPool.awaitTermination(300, SECONDS)); + long sum = 0; + for (Future<Long> f : futures) { + sum += f.get(); + } + assertEquals(sum, map.get(key)); } } diff --git a/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java b/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java index 587a4ec21..878ea5ec8 100644 --- a/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/AtomicLongMapTest.java @@ -52,7 +52,7 @@ public class AtomicLongMapTest extends TestCase { Map<String, Long> in = ImmutableMap.of("1", 1L, "2", 2L, "3", 3L); AtomicLongMap<String> map = AtomicLongMap.create(in); assertFalse(map.isEmpty()); - assertSame(3, map.size()); + assertEquals(3, map.size()); assertTrue(map.containsKey("1")); assertTrue(map.containsKey("2")); assertTrue(map.containsKey("3")); @@ -302,7 +302,7 @@ public class AtomicLongMapTest extends TestCase { Map<String, Long> in = ImmutableMap.of("1", 1L, "2", 2L, "3", 3L); AtomicLongMap<String> map = AtomicLongMap.create(); assertTrue(map.isEmpty()); - assertSame(0, map.size()); + assertEquals(0, map.size()); assertFalse(map.containsKey("1")); assertFalse(map.containsKey("2")); assertFalse(map.containsKey("3")); @@ -312,7 +312,7 @@ public class AtomicLongMapTest extends TestCase { map.putAll(in); assertFalse(map.isEmpty()); - assertSame(3, map.size()); + assertEquals(3, map.size()); assertTrue(map.containsKey("1")); assertTrue(map.containsKey("2")); assertTrue(map.containsKey("3")); diff --git a/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java new file mode 100644 index 000000000..79288eb2a --- /dev/null +++ b/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToFutureTest.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2017 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.util.concurrent; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.util.concurrent.Futures.immediateFuture; +import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly; + +import com.google.common.util.concurrent.ClosingFuture.ClosingCallable; +import com.google.common.util.concurrent.ClosingFuture.DeferredCloser; +import java.io.Closeable; +import java.util.concurrent.ExecutionException; + +/** Tests for {@link ClosingFuture} that exercise {@link ClosingFuture#finishToFuture()}. */ +public class ClosingFutureFinishToFutureTest extends AbstractClosingFutureTest { + public void testFinishToFuture_throwsIfCalledTwice() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + try { + FluentFuture<Closeable> unused2 = closingFuture.finishToFuture(); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToFuture_throwsAfterCallingFinishToValueAndCloser() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + closingFuture.finishToValueAndCloser(new NoOpValueAndCloserConsumer<>(), directExecutor()); + try { + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToFuture_preventsFurtherDerivation() { + ClosingFuture<String> closingFuture = ClosingFuture.from(immediateFuture("value1")); + FluentFuture<String> unused = closingFuture.finishToFuture(); + assertDerivingThrowsIllegalStateException(closingFuture); + } + + @Override + <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { + return getUninterruptibly(closingFuture.finishToFuture()); + } + + @Override + void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { + assertThatFutureFailsWithException(closingFuture.finishToFuture()); + } + + @Override + void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { + assertThatFutureBecomesCancelled(closingFuture.finishToFuture()); + } + + @Override + void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { + assertThat(closingFuture.finishToFuture().cancel(false)).isTrue(); + waitUntilClosed(closingFuture); + futureCancelled.countDown(); + } +} diff --git a/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java b/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java new file mode 100644 index 000000000..ac3cf5569 --- /dev/null +++ b/guava-tests/test/com/google/common/util/concurrent/ClosingFutureFinishToValueAndCloserTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2017 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.common.util.concurrent; + +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; +import static com.google.common.util.concurrent.MoreExecutors.shutdownAndAwaitTermination; +import static com.google.common.util.concurrent.Uninterruptibles.awaitUninterruptibly; +import static java.util.concurrent.Executors.newSingleThreadExecutor; +import static java.util.concurrent.TimeUnit.SECONDS; + +import com.google.common.util.concurrent.ClosingFuture.ClosingCallable; +import com.google.common.util.concurrent.ClosingFuture.DeferredCloser; +import com.google.common.util.concurrent.ClosingFuture.ValueAndCloser; +import com.google.common.util.concurrent.ClosingFuture.ValueAndCloserConsumer; +import java.io.Closeable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; + +/** + * Tests for {@link ClosingFuture} that exercise {@link + * ClosingFuture#finishToValueAndCloser(ValueAndCloserConsumer, Executor)}. + */ +public class ClosingFutureFinishToValueAndCloserTest extends AbstractClosingFutureTest { + private final ExecutorService finishToValueAndCloserExecutor = newSingleThreadExecutor(); + private volatile ValueAndCloser<?> valueAndCloser; + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + assertWithMessage("finishToValueAndCloserExecutor was shut down") + .that(shutdownAndAwaitTermination(finishToValueAndCloserExecutor, 10, SECONDS)) + .isTrue(); + } + + public void testFinishToValueAndCloser_throwsIfCalledTwice() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + try { + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + public void testFinishToValueAndCloser_throwsAfterCallingFinishToFuture() throws Exception { + ClosingFuture<Closeable> closingFuture = + ClosingFuture.submit( + new ClosingCallable<Closeable>() { + @Override + public Closeable call(DeferredCloser closer) throws Exception { + return closer.eventuallyClose(mockCloseable, executor); + } + }, + executor); + FluentFuture<Closeable> unused = closingFuture.finishToFuture(); + try { + closingFuture.finishToValueAndCloser( + new NoOpValueAndCloserConsumer<>(), finishToValueAndCloserExecutor); + fail("should have thrown"); + } catch (IllegalStateException expected) { + } + } + + @Override + <T> T getFinalValue(ClosingFuture<T> closingFuture) throws ExecutionException { + return finishToValueAndCloser(closingFuture).get(); + } + + @Override + void assertFinallyFailsWithException(ClosingFuture<?> closingFuture) { + assertThatFutureFailsWithException(closingFuture.statusFuture()); + ValueAndCloser<?> valueAndCloser = finishToValueAndCloser(closingFuture); + try { + valueAndCloser.get(); + fail(); + } catch (ExecutionException expected) { + assertThat(expected).hasCauseThat().isSameInstanceAs(exception); + } + valueAndCloser.closeAsync(); + } + + @Override + void assertBecomesCanceled(ClosingFuture<?> closingFuture) throws ExecutionException { + assertThatFutureBecomesCancelled(closingFuture.statusFuture()); + } + + @Override + void waitUntilClosed(ClosingFuture<?> closingFuture) { + if (valueAndCloser != null) { + valueAndCloser.closeAsync(); + } + super.waitUntilClosed(closingFuture); + } + + @Override + void cancelFinalStepAndWait(ClosingFuture<TestCloseable> closingFuture) { + assertThat(closingFuture.cancel(false)).isTrue(); + ValueAndCloser<?> unused = finishToValueAndCloser(closingFuture); + waitUntilClosed(closingFuture); + futureCancelled.countDown(); + } + + private <V> ValueAndCloser<V> finishToValueAndCloser(ClosingFuture<V> closingFuture) { + final CountDownLatch valueAndCloserSet = new CountDownLatch(1); + closingFuture.finishToValueAndCloser( + new ValueAndCloserConsumer<V>() { + @Override + public void accept(ValueAndCloser<V> valueAndCloser) { + ClosingFutureFinishToValueAndCloserTest.this.valueAndCloser = valueAndCloser; + valueAndCloserSet.countDown(); + } + }, + finishToValueAndCloserExecutor); + assertWithMessage("valueAndCloser was set") + .that(awaitUninterruptibly(valueAndCloserSet, 10, SECONDS)) + .isTrue(); + @SuppressWarnings("unchecked") + ValueAndCloser<V> valueAndCloserWithType = (ValueAndCloser<V>) valueAndCloser; + return valueAndCloserWithType; + } +} diff --git a/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java b/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java index 18e69b10e..2b1dd2fa0 100644 --- a/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/CycleDetectingLockFactoryTest.java @@ -442,7 +442,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { lockD.lock(); } - public void testReentrantLock_tryLock() throws Exception { LockingThread thread = new LockingThread(lockA); thread.start(); @@ -454,7 +453,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { assertTrue(lockA.tryLock()); } - public void testReentrantWriteLock_tryLock() throws Exception { LockingThread thread = new LockingThread(writeLockA); thread.start(); @@ -468,7 +466,6 @@ public class CycleDetectingLockFactoryTest extends TestCase { assertTrue(readLockA.tryLock()); } - public void testReentrantReadLock_tryLock() throws Exception { LockingThread thread = new LockingThread(readLockA); thread.start(); diff --git a/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java b/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java index 5bd3cf7f4..34678ed25 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java @@ -36,7 +36,6 @@ public class ExecutionListTest extends TestCase { private final ExecutionList list = new ExecutionList(); - public void testRunOnPopulatedList() throws Exception { Executor exec = Executors.newCachedThreadPool(); CountDownLatch countDownLatch = new CountDownLatch(3); @@ -67,7 +66,6 @@ public class ExecutionListTest extends TestCase { assertEquals(1, runCalled.get()); } - public void testExecute_idempotentConcurrently() throws InterruptedException { final CountDownLatch okayToRun = new CountDownLatch(1); final AtomicInteger runCalled = new AtomicInteger(); @@ -103,7 +101,6 @@ public class ExecutionListTest extends TestCase { assertEquals(1, runCalled.get()); } - public void testAddAfterRun() throws Exception { // Run the previous test testRunOnPopulatedList(); diff --git a/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java b/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java index 1c03f5ac4..068287c19 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ExecutionSequencerTest.java @@ -88,7 +88,6 @@ public class ExecutionSequencerTest extends TestCase { assertThat(thirdCallable.called).isTrue(); } - public void testCancellationMultipleThreads() throws Exception { final BlockingCallable blockingCallable = new BlockingCallable(); ListenableFuture<Void> unused = serializer.submit(blockingCallable, executor); @@ -116,7 +115,6 @@ public class ExecutionSequencerTest extends TestCase { assertThat(getDone(future2)).isFalse(); } - public void testSecondTaskWaitsForFirstEvenIfCancelled() throws Exception { final BlockingCallable blockingCallable = new BlockingCallable(); ListenableFuture<Void> future1 = serializer.submit(blockingCallable, executor); @@ -327,7 +325,6 @@ public class ExecutionSequencerTest extends TestCase { private static final int DIRECT_EXECUTIONS_PER_THREAD = 100; @GwtIncompatible // threads - public void testAvoidsStackOverflow_multipleThreads() throws Exception { final LongHolder holder = new LongHolder(); final ArrayList<ListenableFuture<Integer>> lengthChecks = new ArrayList<>(); diff --git a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index cc4751d0f..ab53f5383 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -132,7 +132,6 @@ public class FluentFutureTest extends TestCase { assertThat(f.get()).isEqualTo(2); } - @GwtIncompatible // withTimeout public void testWithTimeout() throws Exception { ScheduledExecutorService executor = newScheduledThreadPool(1); diff --git a/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java index 3bc69bd32..666a18929 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FuturesGetCheckedTest.java @@ -353,7 +353,7 @@ public class FuturesGetCheckedTest extends TestCase { public static final class WillBeUnloadedException extends Exception {} - + @AndroidIncompatible // "Parent ClassLoader may not be null"; maybe avoidable if we try? public void testGetChecked_classUnloading() throws Exception { WeakReference<?> classUsedByGetChecked = doTestClassUnloading(); GcFinalization.awaitClear(classUsedByGetChecked); diff --git a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index 0c3a9ae65..3fe2347a8 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java @@ -53,6 +53,7 @@ import static java.util.Arrays.asList; import static java.util.concurrent.Executors.newSingleThreadExecutor; import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor; import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import static java.util.concurrent.TimeUnit.SECONDS; import com.google.common.annotations.GwtCompatible; @@ -410,7 +411,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_interruptPropagatesToTransformingThread() throws Exception { SettableFuture<String> input = SettableFuture.create(); final CountDownLatch inFunction = new CountDownLatch(1); @@ -803,7 +803,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // Threads - public void testTransformAsync_functionToString() throws Exception { final CountDownLatch functionCalled = new CountDownLatch(1); final CountDownLatch functionBlocking = new CountDownLatch(1); @@ -1132,7 +1131,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testCatchingAsync_interruptPropagatesToTransformingThread() throws Exception { SettableFuture<String> input = SettableFuture.create(); final CountDownLatch inFunction = new CountDownLatch(1); @@ -1172,7 +1170,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // Threads - public void testCatchingAsync_functionToString() throws Exception { final CountDownLatch functionCalled = new CountDownLatch(1); final CountDownLatch functionBlocking = new CountDownLatch(1); @@ -1749,7 +1746,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_asyncFunction_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -1784,7 +1780,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testTransformAsync_asyncFunction_cancelledBeforeApplyingFunction() throws InterruptedException { final AtomicBoolean functionCalled = new AtomicBoolean(); @@ -1858,7 +1853,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -1892,7 +1886,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_cancelledBeforeApplyingFunction() throws InterruptedException { final AtomicBoolean callableCalled = new AtomicBoolean(); @@ -1926,7 +1919,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testSubmitAsync_asyncCallable_returnsInterruptedFuture() throws InterruptedException { assertThat(Thread.interrupted()).isFalse(); SettableFuture<Integer> cancelledFuture = SettableFuture.create(); @@ -2015,7 +2007,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_error() throws InterruptedException { final Error error = new Error("deliberate"); AsyncCallable<Integer> callable = @@ -2037,14 +2028,10 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_nullInsteadOfFuture() throws Exception { ListenableFuture<?> chainedFuture = scheduleAsync( - constantAsyncCallable(null), - 1, - TimeUnit.NANOSECONDS, - newSingleThreadScheduledExecutor()); + constantAsyncCallable(null), 1, NANOSECONDS, newSingleThreadScheduledExecutor()); try { chainedFuture.get(); fail(); @@ -2059,7 +2046,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_cancelledWhileApplyingFunction() throws InterruptedException, ExecutionException { final CountDownLatch inFunction = new CountDownLatch(1); @@ -2075,7 +2061,7 @@ public class FuturesTest extends TestCase { } }; ListenableFuture<Integer> future = - scheduleAsync(callable, 1, TimeUnit.NANOSECONDS, newSingleThreadScheduledExecutor()); + scheduleAsync(callable, 1, NANOSECONDS, newSingleThreadScheduledExecutor()); inFunction.await(); future.cancel(false); callableDone.countDown(); @@ -2092,7 +2078,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testScheduleAsync_asyncCallable_cancelledBeforeCallingFunction() throws InterruptedException { final AtomicBoolean callableCalled = new AtomicBoolean(); @@ -2114,7 +2099,7 @@ public class FuturesTest extends TestCase { awaitUninterruptibly(beforeFunction); } }); - ListenableFuture<Integer> future = scheduleAsync(callable, 1, TimeUnit.NANOSECONDS, executor); + ListenableFuture<Integer> future = scheduleAsync(callable, 1, NANOSECONDS, executor); future.cancel(false); // Unpause the executor. @@ -2547,7 +2532,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_noLeakInterruption() throws Exception { final SettableFuture<String> stringFuture = SettableFuture.create(); AsyncCallable<String> combiner = @@ -2591,7 +2575,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_asyncResult() throws Exception { SettableFuture<Integer> futureInteger = SettableFuture.create(); SettableFuture<Boolean> futureBoolean = SettableFuture.create(); @@ -2683,7 +2666,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_cancelledNotInterrupted() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); SettableFuture<Boolean> booleanFuture = SettableFuture.create(); @@ -2722,7 +2704,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllComplete_interrupted() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); SettableFuture<Boolean> booleanFuture = SettableFuture.create(); @@ -2815,7 +2796,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllCompleteRunnable_resultCanceledWithoutInterrupt_doesNotInterruptRunnable() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); @@ -2856,7 +2836,6 @@ public class FuturesTest extends TestCase { } @GwtIncompatible // threads - public void testWhenAllCompleteRunnable_resultCanceledWithInterrupt_InterruptsRunnable() throws Exception { SettableFuture<String> stringFuture = SettableFuture.create(); @@ -3375,13 +3354,11 @@ public class FuturesTest extends TestCase { : pseudoTimedGetUninterruptibly(future, 2500, MILLISECONDS); } - @GwtIncompatible // threads public void testAllAsList_extensive() throws InterruptedException { runExtensiveMergerTest(Merger.allMerger); } - @GwtIncompatible // threads public void testSuccessfulAsList_extensive() throws InterruptedException { runExtensiveMergerTest(Merger.successMerger); diff --git a/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java index d0fcee238..24990200d 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FuturesTransformAsyncTest.java @@ -131,7 +131,6 @@ public class FuturesTransformAsyncTest extends AbstractChainedListenableFutureTe } } - public void testFutureCancellableBeforeFunctionCompletion() throws Exception { // Set the result in a separate thread since this test runs the function // (which will block) in the same thread. diff --git a/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java b/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java index 4e2c85efd..8b5caebf5 100644 --- a/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java @@ -46,7 +46,6 @@ import junit.framework.TestSuite; * * @author Justin T. Sampson */ - public class GeneratedMonitorTest extends TestCase { public static TestSuite suite() { diff --git a/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java b/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java index 4d7a45f9c..bb3b43b9d 100644 --- a/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/InterruptibleMonitorTest.java @@ -22,7 +22,6 @@ package com.google.common.util.concurrent; * * @author Justin T. Sampson */ - public class InterruptibleMonitorTest extends MonitorTestCase { public InterruptibleMonitorTest() { diff --git a/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java index afa7eae81..fcfe744e0 100644 --- a/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/InterruptibleTaskTest.java @@ -25,7 +25,6 @@ import java.util.concurrent.locks.AbstractOwnableSynchronizer; import java.util.concurrent.locks.LockSupport; import junit.framework.TestCase; - public final class InterruptibleTaskTest extends TestCase { // Regression test for a deadlock where a task could be stuck busy waiting for the task to @@ -91,6 +90,14 @@ public final class InterruptibleTaskTest extends TestCase { * protect ourselves from that we want to make sure that tasks don't spin too much waiting for the * interrupting thread to complete the protocol. */ + /* + * This test hangs (or maybe is just *very* slow) under Android. + * + * TODO(b/218700094): Ideally, get this to pass under Android. Failing that, convince ourselves + * that the test isn't exposing a real problem with InterruptibleTask, one that could matter in + * prod. + */ + @AndroidIncompatible public void testInterruptIsSlow() throws Exception { final CountDownLatch isInterruptibleRegistered = new CountDownLatch(1); final SlowChannel slowChannel = new SlowChannel(); diff --git a/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java b/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java index 3bb819a34..741ff45de 100644 --- a/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/JdkFutureAdaptersTest.java @@ -100,7 +100,6 @@ public class JdkFutureAdaptersTest extends TestCase { assertTrue(listenableFuture.isDone()); } - public void testListenInPoolThreadUsesGivenExecutor() throws Exception { ExecutorService executorService = newCachedThreadPool(new ThreadFactoryBuilder().setDaemon(true).build()); @@ -125,7 +124,6 @@ public class JdkFutureAdaptersTest extends TestCase { assertTrue(listenableFuture.isDone()); } - public void testListenInPoolThreadCustomExecutorInterrupted() throws Exception { final CountDownLatch submitSuccessful = new CountDownLatch(1); ExecutorService executorService = @@ -235,7 +233,6 @@ public class JdkFutureAdaptersTest extends TestCase { } } - @SuppressWarnings("IsInstanceIncompatibleType") // intentional. public void testListenInPoolThreadRunsListenerAfterRuntimeException() throws Exception { RuntimeExceptionThrowingFuture<String> input = new RuntimeExceptionThrowingFuture<>(); diff --git a/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java index 8969a7574..fd51a7329 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java @@ -80,7 +80,6 @@ public class ListenableFutureTaskTest extends TestCase { super.tearDown(); } - public void testListenerDoesNotRunUntilTaskCompletes() throws Exception { // Test default state of not started. @@ -106,7 +105,6 @@ public class ListenableFutureTaskTest extends TestCase { assertFalse(task.isCancelled()); } - public void testListenerCalledOnException() throws Exception { throwException = true; @@ -142,7 +140,6 @@ public class ListenableFutureTaskTest extends TestCase { assertEquals(1, runLatch.getCount()); } - public void testListenerCalledOnCancelFromRunning() throws Exception { exec.execute(task); runLatch.await(); diff --git a/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java b/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java index 5fd9b9508..e0eb32e6a 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ListenerCallQueueTest.java @@ -129,7 +129,6 @@ public class ListenerCallQueueTest extends TestCase { logHandler.getStoredLogRecords().get(0).getMessage()); } - public void testEnqueueAndDispatch_multithreaded() throws InterruptedException { Object listener = new Object(); ExecutorService service = Executors.newFixedThreadPool(4); @@ -153,7 +152,6 @@ public class ListenerCallQueueTest extends TestCase { } } - public void testEnqueueAndDispatch_multithreaded_withThrowingRunnable() throws InterruptedException { Object listener = new Object(); diff --git a/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java b/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java index a9ead52bb..44f8d31f2 100644 --- a/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java +++ b/guava-tests/test/com/google/common/util/concurrent/MonitorTestCase.java @@ -26,7 +26,6 @@ import junit.framework.TestCase; * * @author Justin T. Sampson */ - public abstract class MonitorTestCase extends TestCase { public class TestGuard extends Monitor.Guard { diff --git a/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java b/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java index fe4e7f540..aac61735e 100644 --- a/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/MoreExecutorsTest.java @@ -88,7 +88,6 @@ public class MoreExecutorsTest extends JSR166TestCase { public void run() {} }; - public void testDirectExecutorServiceServiceInThreadExecution() throws Exception { final ListeningExecutorService executor = newDirectExecutorService(); final ThreadLocal<Integer> threadLocalCount = @@ -168,7 +167,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(10, threadLocalCount.get().intValue()); } - public void testDirectExecutorServiceServiceTermination() throws Exception { final ExecutorService executor = newDirectExecutorService(); final CyclicBarrier barrier = new CyclicBarrier(2); @@ -259,7 +257,6 @@ public class MoreExecutorsTest extends JSR166TestCase { * Test for a bug where threads weren't getting signaled when shutdown was called, only when tasks * completed. */ - public void testDirectExecutorService_awaitTermination_missedSignal() { final ExecutorService service = MoreExecutors.newDirectExecutorService(); Thread waiter = @@ -342,6 +339,7 @@ public class MoreExecutorsTest extends JSR166TestCase { */ } + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testListeningDecorator_noWrapExecuteTask() { ExecutorService delegate = mock(ExecutorService.class); ListeningExecutorService service = listeningDecorator(delegate); @@ -354,7 +352,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(delegate).execute(task); } - public void testListeningDecorator_scheduleSuccess() throws Exception { final CountDownLatch completed = new CountDownLatch(1); ScheduledThreadPoolExecutor delegate = @@ -380,7 +377,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_scheduleFailure() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); ListeningScheduledExecutorService service = listeningDecorator(delegate); @@ -391,7 +387,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_schedulePeriodic() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); ListeningScheduledExecutorService service = listeningDecorator(delegate); @@ -412,7 +407,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(0, delegate.getQueue().size()); } - public void testListeningDecorator_cancelled() throws Exception { ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(1); BlockingQueue<?> delegateQueue = delegate.getQueue(); @@ -566,7 +560,7 @@ public class MoreExecutorsTest extends JSR166TestCase { } } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testAddDelayedShutdownHook_success() throws InterruptedException { TestApplication application = new TestApplication(); ExecutorService service = mock(ExecutorService.class); @@ -578,7 +572,7 @@ public class MoreExecutorsTest extends JSR166TestCase { shutdownFirst.verify(service).awaitTermination(2, TimeUnit.SECONDS); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testAddDelayedShutdownHook_interrupted() throws InterruptedException { TestApplication application = new TestApplication(); ExecutorService service = mock(ExecutorService.class); @@ -588,7 +582,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdown(); } - public void testGetExitingExecutorService_executorSetToUseDaemonThreads() { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = @@ -597,7 +590,7 @@ public class MoreExecutorsTest extends JSR166TestCase { assertTrue(executor.getThreadFactory().newThread(EMPTY_RUNNABLE).isDaemon()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingExecutorService_executorDelegatesToOriginal() { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = mock(ThreadPoolExecutor.class); @@ -607,7 +600,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).execute(EMPTY_RUNNABLE); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingExecutorService_shutdownHookRegistered() throws InterruptedException { TestApplication application = new TestApplication(); ThreadPoolExecutor executor = mock(ThreadPoolExecutor.class); @@ -618,7 +611,6 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).shutdown(); } - public void testGetExitingScheduledExecutorService_executorSetToUseDaemonThreads() { TestApplication application = new TestApplication(); ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); @@ -626,7 +618,7 @@ public class MoreExecutorsTest extends JSR166TestCase { assertTrue(executor.getThreadFactory().newThread(EMPTY_RUNNABLE).isDaemon()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetExitingScheduledExecutorService_executorDelegatesToOriginal() { TestApplication application = new TestApplication(); ScheduledThreadPoolExecutor executor = mock(ScheduledThreadPoolExecutor.class); @@ -636,7 +628,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(executor).execute(EMPTY_RUNNABLE); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testGetScheduledExitingExecutorService_shutdownHookRegistered() throws InterruptedException { TestApplication application = new TestApplication(); @@ -669,7 +661,6 @@ public class MoreExecutorsTest extends JSR166TestCase { assertEquals(oldName, Thread.currentThread().getName()); } - public void testExecutors_nullCheck() throws Exception { new ClassSanityTester() .setDefault(RateLimiter.class, RateLimiter.create(1.0)) @@ -699,14 +690,13 @@ public class MoreExecutorsTest extends JSR166TestCase { /* Half of a 1-second timeout in nanoseconds */ private static final long HALF_SECOND_NANOS = NANOSECONDS.convert(1L, SECONDS) / 2; - public void testShutdownAndAwaitTermination_immediateShutdown() throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); assertTrue(shutdownAndAwaitTermination(service, 1L, SECONDS)); assertTrue(service.isTerminated()); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_immediateShutdownInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)).thenReturn(true); @@ -716,7 +706,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).awaitTermination(HALF_SECOND_NANOS, NANOSECONDS); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_forcedShutDownInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) @@ -729,7 +719,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdownNow(); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_nonTerminationInternal() throws Exception { ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) @@ -741,7 +731,7 @@ public class MoreExecutorsTest extends JSR166TestCase { verify(service).shutdownNow(); } - + @AndroidIncompatible // Mocking ExecutorService is forbidden there. TODO(b/218700094): Don't mock. public void testShutdownAndAwaitTermination_interruptedInternal() throws Exception { final ExecutorService service = mock(ExecutorService.class); when(service.awaitTermination(HALF_SECOND_NANOS, NANOSECONDS)) diff --git a/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java b/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java index 20209e8b8..80e7ab2e1 100644 --- a/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/SequentialExecutorTest.java @@ -274,7 +274,14 @@ public class SequentialExecutorTest extends TestCase { assertEquals(1, numCalls.get()); } - + /* + * Under Android, MyError propagates up and fails the test? + * + * TODO(b/218700094): Does this matter to prod users, or is it just a feature of our testing + * environment? If the latter, maybe write a custom Executor that avoids failing the test when it + * sees an Error? + */ + @AndroidIncompatible public void testTaskThrowsError() throws Exception { class MyError extends Error {} final CyclicBarrier barrier = new CyclicBarrier(2); @@ -313,7 +320,6 @@ public class SequentialExecutorTest extends TestCase { } } - public void testRejectedExecutionThrownWithMultipleCalls() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final SettableFuture<?> future = SettableFuture.create(); diff --git a/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java b/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java index e8552eda9..9f89fb1b3 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java @@ -120,7 +120,6 @@ public class ServiceManagerTest extends TestCase { } } - public void testServiceStartupTimes() { Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); @@ -132,7 +131,6 @@ public class ServiceManagerTest extends TestCase { assertThat(startupTimes.get(b)).isAtLeast(353); } - public void testServiceStartupDurations() { Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); @@ -144,7 +142,6 @@ public class ServiceManagerTest extends TestCase { assertThat(startupTimes.get(b)).isAtLeast(Duration.ofMillis(353)); } - public void testServiceStartupTimes_selfStartingServices() { // This tests to ensure that: // 1. service times are accurate when the service is started by the manager @@ -179,7 +176,6 @@ public class ServiceManagerTest extends TestCase { assertThat(startupTimes.get(b)).isNotNull(); } - public void testServiceStartStop() { Service a = new NoOpService(); Service b = new NoOpService(); @@ -201,7 +197,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.failedServices.isEmpty()); } - public void testFailStart() throws Exception { Service a = new NoOpService(); Service b = new FailStartService(); @@ -229,7 +224,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.stoppedCalled); } - public void testFailRun() throws Exception { Service a = new NoOpService(); Service b = new FailRunService(); @@ -252,7 +246,6 @@ public class ServiceManagerTest extends TestCase { assertTrue(listener.stoppedCalled); } - public void testFailStop() throws Exception { Service a = new NoOpService(); Service b = new FailStopService(); @@ -281,7 +274,6 @@ public class ServiceManagerTest extends TestCase { assertThat(toString).contains("FailStartService"); } - public void testTimeouts() throws Exception { Service a = new NoOpDelayedService(50); ServiceManager manager = new ServiceManager(asList(a)); @@ -458,7 +450,6 @@ public class ServiceManagerTest extends TestCase { * Tests that a ServiceManager can be fully shut down if one of its failure listeners is slow or * even permanently blocked. */ - public void testListenerDeadlock() throws InterruptedException { final CountDownLatch failEnter = new CountDownLatch(1); final CountDownLatch failLeave = new CountDownLatch(1); @@ -619,7 +610,6 @@ public class ServiceManagerTest extends TestCase { * * <p>Before the bug was fixed this test would fail at least 30% of the time. */ - public void testTransitionRace() throws TimeoutException { for (int k = 0; k < 1000; k++) { List<Service> services = Lists.newArrayList(); diff --git a/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java index 9b8b88f27..105e8de04 100644 --- a/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/SettableFutureTest.java @@ -51,19 +51,16 @@ public class SettableFutureTest extends TestCase { } } - public void testSetValue() throws Exception { assertTrue(future.set("value")); tester.testCompletedFuture("value"); } - public void testSetFailure() throws Exception { assertTrue(future.setException(new Exception("failure"))); tester.testFailedFuture("failure"); } - public void testSetFailureNull() throws Exception { try { future.setException(null); @@ -75,7 +72,6 @@ public class SettableFutureTest extends TestCase { tester.testFailedFuture("failure"); } - public void testCancel() throws Exception { assertTrue(future.cancel(true)); tester.testCancelledFuture(); diff --git a/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java b/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java index 04b824f82..35406864d 100644 --- a/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java @@ -34,7 +34,6 @@ import junit.framework.TestCase; * @author kevinb * @author Jens Nyman */ - public class SimpleTimeLimiterTest extends TestCase { private static final long DELAY_MS = 50; diff --git a/guava-tests/test/com/google/common/util/concurrent/StripedTest.java b/guava-tests/test/com/google/common/util/concurrent/StripedTest.java index fa9d87f75..688d6fd34 100644 --- a/guava-tests/test/com/google/common/util/concurrent/StripedTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/StripedTest.java @@ -129,7 +129,7 @@ public class StripedTest extends TestCase { assertTrue(Striped.lazyWeakLock(256).size() == 256); } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testWeakImplementations() { for (Striped<?> striped : weakImplementations()) { WeakReference<Object> weakRef = new WeakReference<>(striped.get(new Object())); @@ -137,7 +137,7 @@ public class StripedTest extends TestCase { } } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testWeakReadWrite() { Striped<ReadWriteLock> striped = Striped.lazyWeakReadWriteLock(1000); Object key = new Object(); @@ -150,7 +150,7 @@ public class StripedTest extends TestCase { readLock.unlock(); } - + @AndroidIncompatible // Presumably GC doesn't trigger, despite our efforts. public void testStrongImplementations() { for (Striped<?> striped : strongImplementations()) { WeakReference<Object> weakRef = new WeakReference<>(striped.get(new Object())); diff --git a/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java b/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java index 8a52ffeed..5b77f9a59 100644 --- a/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/SupplementalMonitorTest.java @@ -33,7 +33,6 @@ import junit.framework.TestCase; * * @author Justin T. Sampson */ - public class SupplementalMonitorTest extends TestCase { public void testLeaveWithoutEnterThrowsIMSE() { diff --git a/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java b/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java index 7684b9633..a3a7b8e79 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ThreadFactoryBuilderTest.java @@ -56,7 +56,6 @@ public class ThreadFactoryBuilderTest extends TestCase { builder = new ThreadFactoryBuilder(); } - public void testThreadFactoryBuilder_defaults() throws InterruptedException { ThreadFactory threadFactory = builder.build(); Thread thread = threadFactory.newThread(monitoredRunnable); @@ -93,7 +92,6 @@ public class ThreadFactoryBuilderTest extends TestCase { assertThat(thread.getName()).matches("^pool-\\d+-thread-" + threadId + "$"); } - public void testNameFormatWithPercentS_custom() { String format = "super-duper-thread-%s"; ThreadFactory factory = builder.setNameFormat(format).build(); @@ -102,7 +100,6 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testNameFormatWithPercentD_custom() { String format = "super-duper-thread-%d"; ThreadFactory factory = builder.setNameFormat(format).build(); @@ -111,21 +108,18 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testDaemon_false() { ThreadFactory factory = builder.setDaemon(false).build(); Thread thread = factory.newThread(monitoredRunnable); assertFalse(thread.isDaemon()); } - public void testDaemon_true() { ThreadFactory factory = builder.setDaemon(true).build(); Thread thread = factory.newThread(monitoredRunnable); assertTrue(thread.isDaemon()); } - public void testPriority_custom() { for (int i = Thread.MIN_PRIORITY; i <= Thread.MAX_PRIORITY; i++) { ThreadFactory factory = builder.setPriority(i).build(); @@ -150,7 +144,6 @@ public class ThreadFactoryBuilderTest extends TestCase { } } - public void testUncaughtExceptionHandler_custom() { assertEquals( UNCAUGHT_EXCEPTION_HANDLER, @@ -161,7 +154,6 @@ public class ThreadFactoryBuilderTest extends TestCase { .getUncaughtExceptionHandler()); } - public void testBuildMutateBuild() { ThreadFactory factory1 = builder.setPriority(1).build(); assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); @@ -177,7 +169,6 @@ public class ThreadFactoryBuilderTest extends TestCase { unused = builder.build(); // this is *also* allowed } - public void testBuildMutate() { ThreadFactory factory1 = builder.setPriority(1).build(); assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); @@ -186,7 +177,6 @@ public class ThreadFactoryBuilderTest extends TestCase { assertEquals(1, factory1.newThread(monitoredRunnable).getPriority()); } - public void testThreadFactory() throws InterruptedException { final String THREAD_NAME = "ludicrous speed"; final int THREAD_PRIORITY = 1; diff --git a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 157afa79d..e735ae02a 100644 --- a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java @@ -84,7 +84,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testCancel_interrupted() throws Exception { final AtomicBoolean interruptedExceptionThrown = new AtomicBoolean(); final CountDownLatch enterLatch = new CountDownLatch(1); @@ -135,7 +134,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testRunIdempotency() throws Exception { final int numThreads = 10; final ExecutorService executor = Executors.newFixedThreadPool(numThreads); @@ -171,7 +169,6 @@ public class TrustedListenableFutureTaskTest extends TestCase { } @GwtIncompatible // blocking wait - public void testToString() throws Exception { final CountDownLatch enterLatch = new CountDownLatch(1); final CountDownLatch exitLatch = new CountDownLatch(1); diff --git a/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java b/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java index eb8455b18..4a26b4976 100644 --- a/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/UncaughtExceptionHandlersTest.java @@ -23,7 +23,6 @@ import com.google.common.util.concurrent.UncaughtExceptionHandlers.Exiter; import junit.framework.TestCase; /** @author Gregory Kick */ - public class UncaughtExceptionHandlersTest extends TestCase { private Runtime runtimeMock; diff --git a/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java index 0d2426607..3f91b8123 100644 --- a/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/UninterruptibleFutureTest.java @@ -77,7 +77,6 @@ public class UninterruptibleFutureTest extends TestCase { * This first test doesn't test anything in Uninterruptibles, just demonstrates some normal * behavior of futures so that you can contrast the next test with it. */ - public void testRegularFutureInterrupted() throws ExecutionException { /* @@ -116,7 +115,6 @@ public class UninterruptibleFutureTest extends TestCase { assertTrue(sleeper.completed); } - public void testMakeUninterruptible_timeoutPreservedThroughInterruption() throws ExecutionException { @@ -155,32 +153,26 @@ public class UninterruptibleFutureTest extends TestCase { } } - public void testMakeUninterruptible_untimed_uninterrupted() throws Exception { runUntimedInterruptsTest(0); } - public void testMakeUninterruptible_untimed_interrupted() throws Exception { runUntimedInterruptsTest(1); } - public void testMakeUninterruptible_untimed_multiplyInterrupted() throws Exception { runUntimedInterruptsTest(38); } - public void testMakeUninterruptible_timed_uninterrupted() throws Exception { runTimedInterruptsTest(0); } - public void testMakeUninterruptible_timed_interrupted() throws Exception { runTimedInterruptsTest(1); } - public void testMakeUninterruptible_timed_multiplyInterrupted() throws Exception { runTimedInterruptsTest(38); } @@ -218,7 +210,6 @@ public class UninterruptibleFutureTest extends TestCase { /** * Confirms that the test code triggers {@link InterruptedException} in a standard {@link Future}. */ - public void testMakeUninterruptible_plainFutureSanityCheck() throws Exception { SettableFuture<String> future = SettableFuture.create(); FutureTask<Boolean> wasInterrupted = untimedInterruptReporter(future, true); @@ -235,7 +226,6 @@ public class UninterruptibleFutureTest extends TestCase { } } - public void testMakeUninterruptible_timedGetZeroTimeoutAttempted() throws TimeoutException, ExecutionException { SettableFuture<String> future = SettableFuture.create(); @@ -248,7 +238,6 @@ public class UninterruptibleFutureTest extends TestCase { assertEquals(RESULT, getUninterruptibly(future, 0, SECONDS)); } - public void testMakeUninterruptible_timedGetNegativeTimeoutAttempted() throws TimeoutException, ExecutionException { SettableFuture<String> future = SettableFuture.create(); diff --git a/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java b/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java index 59bf80878..3e775bab5 100644 --- a/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/UninterruptibleMonitorTest.java @@ -22,7 +22,6 @@ package com.google.common.util.concurrent; * * @author Justin T. Sampson */ - public class UninterruptibleMonitorTest extends MonitorTestCase { public UninterruptibleMonitorTest() { diff --git a/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java b/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java index 4343d894d..1b6501efe 100644 --- a/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java @@ -55,7 +55,6 @@ import junit.framework.TestCase; * * @author Anthony Zana */ - public class UninterruptiblesTest extends TestCase { private static final String EXPECTED_TAKE = "expectedTake"; diff --git a/guava/pom.xml b/guava/pom.xml index 4a4f9ebe6..81a2005c7 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> </parent> <artifactId>guava</artifactId> <packaging>bundle</packaging> @@ -129,7 +129,7 @@ <!-- excludePackageNames requires specification of packages separately from "all subpackages". https://issues.apache.org/jira/browse/MJAVADOC-584 --> <excludePackageNames> - com.google.common.base.internal,com.google.common.base.internal.*,com.google.thirdparty.publicsuffix,com.google.thirdparty.publicsuffix.*,com.oracle.*,com.sun.*,java.*,javax.*,jdk,jdk.*,org.*,sun.* + com.azul.tooling.in,com.google.common.base.internal,com.google.common.base.internal.*,com.google.thirdparty.publicsuffix,com.google.thirdparty.publicsuffix.*,com.oracle.*,com.sun.*,java.*,javax.*,jdk,jdk.*,org.*,sun.* </excludePackageNames> <!-- Ignore some tags that are found in Java 11 sources but not recognized... under -source 8, I think it was? I can no longer reproduce the failure. --> <tags> diff --git a/guava/src/com/google/common/base/CharMatcher.java b/guava/src/com/google/common/base/CharMatcher.java index e052f800a..253bc6a22 100644 --- a/guava/src/com/google/common/base/CharMatcher.java +++ b/guava/src/com/google/common/base/CharMatcher.java @@ -1462,10 +1462,10 @@ public abstract class CharMatcher implements Predicate<Character> { // [[[:Zs:][:Zl:][:Zp:][:Cc:][:Cf:][:Cs:][:Co:]]&[\u0000-\uFFFF]] // with the "Abbreviate" option, and get the ranges from there. private static final String RANGE_STARTS = - "\u0000\u007f\u00ad\u0600\u061c\u06dd\u070f\u08e2\u1680\u180e\u2000\u2028\u205f\u2066" + "\u0000\u007f\u00ad\u0600\u061c\u06dd\u070f\u0890\u08e2\u1680\u180e\u2000\u2028\u205f\u2066" + "\u3000\ud800\ufeff\ufff9"; private static final String RANGE_ENDS = // inclusive ends - "\u0020\u00a0\u00ad\u0605\u061c\u06dd\u070f\u08e2\u1680\u180e\u200f\u202f\u2064\u206f" + "\u0020\u00a0\u00ad\u0605\u061c\u06dd\u070f\u0891\u08e2\u1680\u180e\u200f\u202f\u2064\u206f" + "\u3000\uf8ff\ufeff\ufffb"; static final Invisible INSTANCE = new Invisible(); diff --git a/guava/src/com/google/common/base/Converter.java b/guava/src/com/google/common/base/Converter.java index 208a0324e..422480d16 100644 --- a/guava/src/com/google/common/base/Converter.java +++ b/guava/src/com/google/common/base/Converter.java @@ -19,7 +19,9 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.errorprone.annotations.CheckReturnValue; import com.google.errorprone.annotations.ForOverride; +import com.google.errorprone.annotations.InlineMe; import com.google.errorprone.annotations.concurrent.LazyInit; import com.google.j2objc.annotations.RetainedWith; import java.io.Serializable; @@ -270,7 +272,7 @@ public abstract class Converter<A, B> implements Function<A, B> { * both use cases by using @PolyNull. (By contrast, we can't use @PolyNull for our superinterface * (`implements Function<@PolyNull A, @PolyNull B>`), at least as far as I know.) */ - public Iterable<B> convertAll(final Iterable<? extends A> fromIterable) { + public Iterable<B> convertAll(Iterable<? extends A> fromIterable) { checkNotNull(fromIterable, "fromIterable"); return new Iterable<B>() { @Override @@ -307,7 +309,7 @@ public abstract class Converter<A, B> implements Function<A, B> { * * <p><b>Note:</b> you should not override this method. It is non-final for legacy reasons. */ - @CanIgnoreReturnValue + @CheckReturnValue public Converter<B, A> reverse() { Converter<B, A> result = reverse; return (result == null) ? reverse = new ReverseConverter<>(this) : result; @@ -492,6 +494,7 @@ public abstract class Converter<A, B> implements Function<A, B> { */ @SuppressWarnings("nullness") @CheckForNull + @InlineMe(replacement = "this.convert(a)") public final B apply(@CheckForNull A a) { return convert(a); } diff --git a/guava/src/com/google/common/base/Enums.java b/guava/src/com/google/common/base/Enums.java index 449b7e3a9..5c55b6594 100644 --- a/guava/src/com/google/common/base/Enums.java +++ b/guava/src/com/google/common/base/Enums.java @@ -105,8 +105,8 @@ public final class Enums { * * @since 16.0 */ - public static <T extends Enum<T>> Converter<String, T> stringConverter(final Class<T> enumClass) { - return new StringConverter<T>(enumClass); + public static <T extends Enum<T>> Converter<String, T> stringConverter(Class<T> enumClass) { + return new StringConverter<>(enumClass); } private static final class StringConverter<T extends Enum<T>> extends Converter<String, T> diff --git a/guava/src/com/google/common/base/Equivalence.java b/guava/src/com/google/common/base/Equivalence.java index fbcd21237..4e2e89886 100644 --- a/guava/src/com/google/common/base/Equivalence.java +++ b/guava/src/com/google/common/base/Equivalence.java @@ -165,7 +165,43 @@ public abstract class Equivalence<T> implements BiPredicate<@Nullable T, @Nullab * @since 10.0 */ public final <S extends @Nullable T> Wrapper<S> wrap(@ParametricNullness S reference) { - return new Wrapper<S>(this, reference); + /* + * I'm pretty sure that this warning "makes sense" but doesn't indicate a real problem. + * + * Why it "makes sense": If we pass a `@Nullable Foo`, then we should also pass an + * `Equivalence<? super @Nullable Foo>`. And there's no such thing because Equivalence doesn't + * permit nullable type arguments. + * + * Why there's no real problem: Every Equivalence can handle null. + * + * We could work around this by giving Wrapper 2 type parameters. In the terms of this method, + * that would be both the T parameter (from the class) and the S parameter (from this method). + * However, such a change would be source-incompatible. (Plus, there's no reason for the S + * parameter from the user's perspective, so it would be a wart.) + * + * We could probably also work around this by making Wrapper non-final and putting the + * implementation into a subclass with those 2 type parameters. But we like `final`, if only to + * deter users from using mocking frameworks to construct instances. (And could also complicate + * serialization, which is discussed more in the next paragraph.) + * + * We could probably also work around this by having Wrapper accept an instance of a new + * WrapperGuts class, which would then be the class that would declare the 2 type parameters. + * But that would break deserialization of previously serialized Wrapper instances. And while we + * specifically say not to rely on serialization across Guava versions, users sometimes do. So + * we'd rather not break them without a good enough reason. + * + * (We could work around the serialization problem by writing custom serialization code. But + * even that helps only the case of serializing with an old version and deserializing with a + * new, not vice versa -- unless we introduce WrapperGuts and the logic to handle it today, wait + * until "everyone" has picked up a version of Guava with that code, and *then* change to use + * WrapperGuts.) + * + * Anyway, a suppression isn't really a big deal. But I have tried to do some due diligence on + * avoiding it :) + */ + @SuppressWarnings("nullness") + Wrapper<S> w = new Wrapper<>(this, reference); + return w; } /** diff --git a/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/guava/src/com/google/common/base/FinalizableReferenceQueue.java index 5ce1d3103..7447b8051 100644 --- a/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -156,7 +156,7 @@ public class FinalizableReferenceQueue implements Closeable { public FinalizableReferenceQueue() { // We could start the finalizer lazily, but I'd rather it blow up early. queue = new ReferenceQueue<>(); - frqRef = new PhantomReference<Object>(this, queue); + frqRef = new PhantomReference<>(this, queue); boolean threadStarted = false; try { startFinalizer.invoke(null, FinalizableReference.class, queue, frqRef); diff --git a/guava/src/com/google/common/base/FunctionalEquivalence.java b/guava/src/com/google/common/base/FunctionalEquivalence.java index 8bb67be28..4383f4f36 100644 --- a/guava/src/com/google/common/base/FunctionalEquivalence.java +++ b/guava/src/com/google/common/base/FunctionalEquivalence.java @@ -20,6 +20,7 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import javax.annotation.CheckForNull; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Equivalence applied on functional result. @@ -34,11 +35,11 @@ final class FunctionalEquivalence<F, T> extends Equivalence<F> implements Serial private static final long serialVersionUID = 0; - private final Function<? super F, ? extends T> function; + private final Function<? super F, ? extends @Nullable T> function; private final Equivalence<T> resultEquivalence; FunctionalEquivalence( - Function<? super F, ? extends T> function, Equivalence<T> resultEquivalence) { + Function<? super F, ? extends @Nullable T> function, Equivalence<T> resultEquivalence) { this.function = checkNotNull(function); this.resultEquivalence = checkNotNull(resultEquivalence); } diff --git a/guava/src/com/google/common/base/Functions.java b/guava/src/com/google/common/base/Functions.java index 5337d0e36..78785047e 100644 --- a/guava/src/com/google/common/base/Functions.java +++ b/guava/src/com/google/common/base/Functions.java @@ -288,7 +288,7 @@ public final class Functions { */ public static <T extends @Nullable Object> Function<T, Boolean> forPredicate( Predicate<T> predicate) { - return new PredicateFunction<T>(predicate); + return new PredicateFunction<>(predicate); } /** @see Functions#forPredicate */ diff --git a/guava/src/com/google/common/base/Joiner.java b/guava/src/com/google/common/base/Joiner.java index 0f3d6e4b6..8b29f68f8 100644 --- a/guava/src/com/google/common/base/Joiner.java +++ b/guava/src/com/google/common/base/Joiner.java @@ -236,7 +236,7 @@ public class Joiner { * Returns a joiner with the same behavior as this one, except automatically substituting {@code * nullText} for any provided null elements. */ - public Joiner useForNull(final String nullText) { + public Joiner useForNull(String nullText) { checkNotNull(nullText); return new Joiner(this) { @Override @@ -493,9 +493,7 @@ public class Joiner { } private static Iterable<@Nullable Object> iterable( - @CheckForNull final Object first, - @CheckForNull final Object second, - final @Nullable Object[] rest) { + @CheckForNull Object first, @CheckForNull Object second, @Nullable Object[] rest) { checkNotNull(rest); return new AbstractList<@Nullable Object>() { @Override diff --git a/guava/src/com/google/common/base/ParametricNullness.java b/guava/src/com/google/common/base/ParametricNullness.java index c73605548..5b595adb3 100644 --- a/guava/src/com/google/common/base/ParametricNullness.java +++ b/guava/src/com/google/common/base/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/base/Predicates.java b/guava/src/com/google/common/base/Predicates.java index c3b556265..dc487fc56 100644 --- a/guava/src/com/google/common/base/Predicates.java +++ b/guava/src/com/google/common/base/Predicates.java @@ -82,7 +82,7 @@ public final class Predicates { * false}. */ public static <T extends @Nullable Object> Predicate<T> not(Predicate<T> predicate) { - return new NotPredicate<T>(predicate); + return new NotPredicate<>(predicate); } /** @@ -94,7 +94,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> and( Iterable<? extends Predicate<? super T>> components) { - return new AndPredicate<T>(defensiveCopy(components)); + return new AndPredicate<>(defensiveCopy(components)); } /** @@ -116,7 +116,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> and( Predicate<? super T> first, Predicate<? super T> second) { - return new AndPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); + return new AndPredicate<>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); } /** @@ -128,7 +128,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> or( Iterable<? extends Predicate<? super T>> components) { - return new OrPredicate<T>(defensiveCopy(components)); + return new OrPredicate<>(defensiveCopy(components)); } /** @@ -150,7 +150,7 @@ public final class Predicates { */ public static <T extends @Nullable Object> Predicate<T> or( Predicate<? super T> first, Predicate<? super T> second) { - return new OrPredicate<T>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); + return new OrPredicate<>(Predicates.<T>asList(checkNotNull(first), checkNotNull(second))); } /** @@ -213,7 +213,7 @@ public final class Predicates { * @param target the collection that may contain the function input */ public static <T extends @Nullable Object> Predicate<T> in(Collection<? extends T> target) { - return new InPredicate<T>(target); + return new InPredicate<>(target); } /** @@ -713,7 +713,7 @@ public final class Predicates { } static <T> List<T> defensiveCopy(Iterable<T> iterable) { - ArrayList<T> list = new ArrayList<T>(); + ArrayList<T> list = new ArrayList<>(); for (T element : iterable) { list.add(checkNotNull(element)); } diff --git a/guava/src/com/google/common/base/Present.java b/guava/src/com/google/common/base/Present.java index 59efebc10..4e62da29e 100644 --- a/guava/src/com/google/common/base/Present.java +++ b/guava/src/com/google/common/base/Present.java @@ -71,7 +71,7 @@ final class Present<T> extends Optional<T> { @Override public <V> Optional<V> transform(Function<? super T, V> function) { - return new Present<V>( + return new Present<>( checkNotNull( function.apply(reference), "the Function passed to Optional.transform() must not return null.")); diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java index 57d3486b2..6ced905b9 100644 --- a/guava/src/com/google/common/base/Suppliers.java +++ b/guava/src/com/google/common/base/Suppliers.java @@ -226,7 +226,7 @@ public final class Suppliers { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public static <T extends @Nullable Object> Supplier<T> memoizeWithExpiration( Supplier<T> delegate, long duration, TimeUnit unit) { - return new ExpiringMemoizingSupplier<T>(delegate, duration, unit); + return new ExpiringMemoizingSupplier<>(delegate, duration, unit); } @VisibleForTesting @@ -286,7 +286,7 @@ public final class Suppliers { /** Returns a supplier that always supplies {@code instance}. */ public static <T extends @Nullable Object> Supplier<T> ofInstance( @ParametricNullness T instance) { - return new SupplierOfInstance<T>(instance); + return new SupplierOfInstance<>(instance); } private static class SupplierOfInstance<T extends @Nullable Object> @@ -331,7 +331,7 @@ public final class Suppliers { */ public static <T extends @Nullable Object> Supplier<T> synchronizedSupplier( Supplier<T> delegate) { - return new ThreadSafeSupplier<T>(delegate); + return new ThreadSafeSupplier<>(delegate); } private static class ThreadSafeSupplier<T extends @Nullable Object> diff --git a/guava/src/com/google/common/base/Throwables.java b/guava/src/com/google/common/base/Throwables.java index 7832d186a..e45ce800c 100644 --- a/guava/src/com/google/common/base/Throwables.java +++ b/guava/src/com/google/common/base/Throwables.java @@ -19,7 +19,6 @@ import static java.util.Arrays.asList; import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.VisibleForTesting; @@ -290,7 +289,6 @@ public final class Throwables { * @return an unmodifiable list containing the cause chain starting with {@code throwable} * @throws IllegalArgumentException if there is a loop in the causal chain */ - @Beta // TODO(kevinb): decide best return type public static List<Throwable> getCausalChain(Throwable throwable) { checkNotNull(throwable); List<Throwable> causes = new ArrayList<>(4); @@ -330,7 +328,6 @@ public final class Throwables { * ClassCastException}'s cause is {@code throwable}. * @since 22.0 */ - @Beta @GwtIncompatible // Class.cast(Object) @CheckForNull public static <X extends Throwable> X getCauseAs( @@ -382,11 +379,12 @@ public final class Throwables { * exception's creation. * * @since 19.0 + * @deprecated This method is equivalent to {@link Throwable#getStackTrace()} on JDK versions past + * JDK 8 and on all Android versions. Use {@link Throwable#getStackTrace()} directly, or where + * possible use the {@code java.lang.StackWalker.walk} method introduced in JDK 9. */ - // TODO(cpovirk): Say something about the possibility that List access could fail at runtime? - @Beta + @Deprecated @GwtIncompatible // lazyStackTraceIsLazy, jlaStackTrace - // TODO(cpovirk): Consider making this available under GWT (slow implementation only). public static List<StackTraceElement> lazyStackTrace(Throwable throwable) { return lazyStackTraceIsLazy() ? jlaStackTrace(throwable) @@ -398,15 +396,17 @@ public final class Throwables { * documentation. * * @since 19.0 + * @deprecated This method always returns false on JDK versions past JDK 8 and on all Android + * versions. */ - @Beta + @Deprecated @GwtIncompatible // getStackTraceElementMethod public static boolean lazyStackTraceIsLazy() { return getStackTraceElementMethod != null && getStackTraceDepthMethod != null; } @GwtIncompatible // invokeAccessibleNonThrowingMethod - private static List<StackTraceElement> jlaStackTrace(final Throwable t) { + private static List<StackTraceElement> jlaStackTrace(Throwable t) { checkNotNull(t); /* * TODO(cpovirk): Consider optimizing iterator() to catch IOOBE instead of doing bounds checks. diff --git a/guava/src/com/google/common/base/internal/Finalizer.java b/guava/src/com/google/common/base/internal/Finalizer.java index 75d0d72f6..b45ec1578 100644 --- a/guava/src/com/google/common/base/internal/Finalizer.java +++ b/guava/src/com/google/common/base/internal/Finalizer.java @@ -23,7 +23,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; -import org.checkerframework.checker.nullness.qual.Nullable; +import javax.annotation.CheckForNull; /** * Thread that finalizes referents. All references should implement {@code @@ -43,6 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * collected, and this class can detect when the main class loader has been garbage collected and * stop itself. */ +// no @ElementTypesAreNonNullByDefault for the reasons discussed above public class Finalizer implements Runnable { private static final Logger logger = Logger.getLogger(Finalizer.class.getName()); @@ -116,10 +117,11 @@ public class Finalizer implements Runnable { // By preference, we will use the Thread constructor that has an `inheritThreadLocals` parameter. // But before Java 9, our only way not to inherit ThreadLocals is to zap them after the thread // is created, by accessing a private field. - private static final @Nullable Constructor<Thread> bigThreadConstructor = - getBigThreadConstructor(); + @CheckForNull + private static final Constructor<Thread> bigThreadConstructor = getBigThreadConstructor(); - private static final @Nullable Field inheritableThreadLocals = + @CheckForNull + private static final Field inheritableThreadLocals = (bigThreadConstructor == null) ? getInheritableThreadLocalsField() : null; /** Constructs a new finalizer thread. */ @@ -129,8 +131,7 @@ public class Finalizer implements Runnable { PhantomReference<Object> frqReference) { this.queue = queue; - this.finalizableReferenceClassReference = - new WeakReference<Class<?>>(finalizableReferenceClass); + this.finalizableReferenceClassReference = new WeakReference<>(finalizableReferenceClass); // Keep track of the FRQ that started us so we know when to stop. this.frqReference = frqReference; @@ -191,7 +192,8 @@ public class Finalizer implements Runnable { } /** Looks up FinalizableReference.finalizeReferent() method. */ - private @Nullable Method getFinalizeReferentMethod() { + @CheckForNull + private Method getFinalizeReferentMethod() { Class<?> finalizableReferenceClass = finalizableReferenceClassReference.get(); if (finalizableReferenceClass == null) { /* @@ -209,7 +211,8 @@ public class Finalizer implements Runnable { } } - private static @Nullable Field getInheritableThreadLocalsField() { + @CheckForNull + private static Field getInheritableThreadLocalsField() { try { Field inheritableThreadLocals = Thread.class.getDeclaredField("inheritableThreadLocals"); inheritableThreadLocals.setAccessible(true); @@ -223,7 +226,8 @@ public class Finalizer implements Runnable { } } - private static @Nullable Constructor<Thread> getBigThreadConstructor() { + @CheckForNull + private static Constructor<Thread> getBigThreadConstructor() { try { return Thread.class.getConstructor( ThreadGroup.class, Runnable.class, String.class, long.class, boolean.class); diff --git a/guava/src/com/google/common/cache/CacheBuilder.java b/guava/src/com/google/common/cache/CacheBuilder.java index 3537bab53..668769b6e 100644 --- a/guava/src/com/google/common/cache/CacheBuilder.java +++ b/guava/src/com/google/common/cache/CacheBuilder.java @@ -48,8 +48,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * <p>The successor to Guava's caching API is <a * href="https://github.com/ben-manes/caffeine/wiki">Caffeine</a>. Its API is designed to make it a - * nearly drop-in replacement -- though it requires Java 8 APIs and is not available for Android or - * GWT/j2cl. Its equivalent to {@code CacheBuilder} is its <a + * nearly drop-in replacement -- though it requires Java 8 APIs, is not available for Android or + * GWT/j2cl, and may have <a href="https://github.com/ben-manes/caffeine/wiki/Guava">different + * (usually better) behavior</a> when multiple threads attempt concurrent mutations. Its equivalent + * to {@code CacheBuilder} is its <a * href="https://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/latest/com.github.benmanes.caffeine/com/github/benmanes/caffeine/cache/Caffeine.html">{@code * Caffeine}</a> class. Caffeine offers better performance, more features (including asynchronous * loading), and fewer <a diff --git a/guava/src/com/google/common/cache/CacheBuilderSpec.java b/guava/src/com/google/common/cache/CacheBuilderSpec.java index 64b5ad261..7757f3bc4 100644 --- a/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -108,7 +108,7 @@ public final class CacheBuilderSpec { .put("expireAfterWrite", new WriteDurationParser()) .put("refreshAfterWrite", new RefreshDurationParser()) .put("refreshInterval", new RefreshDurationParser()) - .build(); + .buildOrThrow(); @VisibleForTesting @CheckForNull Integer initialCapacity; @VisibleForTesting @CheckForNull Long maximumSize; diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java index f421781d8..f2cbee3db 100644 --- a/guava/src/com/google/common/cache/LocalCache.java +++ b/guava/src/com/google/common/cache/LocalCache.java @@ -21,6 +21,7 @@ import static com.google.common.cache.CacheBuilder.UNSET_INT; import static com.google.common.util.concurrent.Futures.transform; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly; +import static java.util.Collections.unmodifiableSet; import static java.util.concurrent.TimeUnit.NANOSECONDS; import com.google.common.annotations.GwtCompatible; @@ -35,7 +36,6 @@ import com.google.common.cache.CacheBuilder.NullListener; import com.google.common.cache.CacheBuilder.OneWeigher; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; import com.google.common.cache.CacheLoader.UnsupportedLoadingOperationException; -import com.google.common.cache.LocalCache.AbstractCacheSet; import com.google.common.collect.AbstractSequentialIterator; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -2189,7 +2189,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - V compute(K key, int hash, BiFunction<? super K, ? super V, ? extends V> function) { + V compute(K key, int hash, BiFunction<? super K, ? super @Nullable V, ? extends V> function) { ReferenceEntry<K, V> e; ValueReference<K, V> valueReference = null; ComputingValueReference<K, V> computingValueReference = null; @@ -3558,7 +3558,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } } - public V compute(K key, BiFunction<? super K, ? super V, ? extends V> function) { + public V compute(K key, BiFunction<? super K, ? super @Nullable V, ? extends V> function) { stopwatch.start(); V previousValue; try { @@ -3993,7 +3993,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> int hits = 0; int misses = 0; - Map<K, V> result = Maps.newLinkedHashMap(); + ImmutableMap.Builder<K, V> result = ImmutableMap.builder(); for (Object key : keys) { V value = get(key); if (value == null) { @@ -4008,7 +4008,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } globalStatsCounter.recordHits(hits); globalStatsCounter.recordMisses(misses); - return ImmutableMap.copyOf(result); + return result.buildKeepingLast(); } ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionException { @@ -4033,7 +4033,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> try { if (!keysToLoad.isEmpty()) { try { - Map<K, V> newEntries = loadAll(keysToLoad, defaultLoader); + Map<K, V> newEntries = loadAll(unmodifiableSet(keysToLoad), defaultLoader); for (K key : keysToLoad) { V value = newEntries.get(key); if (value == null) { @@ -4205,7 +4205,7 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V> } @Override - public V compute(K key, BiFunction<? super K, ? super V, ? extends V> function) { + public V compute(K key, BiFunction<? super K, ? super @Nullable V, ? extends V> function) { checkNotNull(key); checkNotNull(function); int hash = hash(key); diff --git a/guava/src/com/google/common/cache/LongAddables.java b/guava/src/com/google/common/cache/LongAddables.java index b0f9e2b21..249c6e149 100644 --- a/guava/src/com/google/common/cache/LongAddables.java +++ b/guava/src/com/google/common/cache/LongAddables.java @@ -31,7 +31,8 @@ final class LongAddables { static { Supplier<LongAddable> supplier; try { - new LongAdder(); // trigger static initialization of the LongAdder class, which may fail + // trigger static initialization of the LongAdder class, which may fail + LongAdder unused = new LongAdder(); supplier = new Supplier<LongAddable>() { @Override diff --git a/guava/src/com/google/common/cache/ParametricNullness.java b/guava/src/com/google/common/cache/ParametricNullness.java index 19305a6f9..64682de55 100644 --- a/guava/src/com/google/common/cache/ParametricNullness.java +++ b/guava/src/com/google/common/cache/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/cache/RemovalListeners.java b/guava/src/com/google/common/cache/RemovalListeners.java index d0623e7e3..38edf3528 100644 --- a/guava/src/com/google/common/cache/RemovalListeners.java +++ b/guava/src/com/google/common/cache/RemovalListeners.java @@ -39,20 +39,10 @@ public final class RemovalListeners { * @param executor the executor with which removal notifications are asynchronously executed */ public static <K, V> RemovalListener<K, V> asynchronous( - final RemovalListener<K, V> listener, final Executor executor) { + RemovalListener<K, V> listener, Executor executor) { checkNotNull(listener); checkNotNull(executor); - return new RemovalListener<K, V>() { - @Override - public void onRemoval(final RemovalNotification<K, V> notification) { - executor.execute( - new Runnable() { - @Override - public void run() { - listener.onRemoval(notification); - } - }); - } - }; + return (RemovalNotification<K, V> notification) -> + executor.execute(() -> listener.onRemoval(notification)); } } diff --git a/guava/src/com/google/common/cache/RemovalNotification.java b/guava/src/com/google/common/cache/RemovalNotification.java index dab7fe533..b96fc5709 100644 --- a/guava/src/com/google/common/cache/RemovalNotification.java +++ b/guava/src/com/google/common/cache/RemovalNotification.java @@ -47,7 +47,7 @@ public final class RemovalNotification<K, V> */ public static <K, V> RemovalNotification<K, V> create( @CheckForNull K key, @CheckForNull V value, RemovalCause cause) { - return new RemovalNotification(key, value, cause); + return new RemovalNotification<>(key, value, cause); } private RemovalNotification(@CheckForNull K key, @CheckForNull V value, RemovalCause cause) { diff --git a/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/guava/src/com/google/common/collect/AbstractSortedMultiset.java index fd4fce202..621e8f98a 100644 --- a/guava/src/com/google/common/collect/AbstractSortedMultiset.java +++ b/guava/src/com/google/common/collect/AbstractSortedMultiset.java @@ -56,7 +56,7 @@ abstract class AbstractSortedMultiset<E extends @Nullable Object> extends Abstra @Override NavigableSet<E> createElementSet() { - return new SortedMultisets.NavigableElementSet<E>(this); + return new SortedMultisets.NavigableElementSet<>(this); } @Override diff --git a/guava/src/com/google/common/collect/ArrayListMultimap.java b/guava/src/com/google/common/collect/ArrayListMultimap.java index c8f7106d8..e31f491f0 100644 --- a/guava/src/com/google/common/collect/ArrayListMultimap.java +++ b/guava/src/com/google/common/collect/ArrayListMultimap.java @@ -53,8 +53,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedListMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/ArrayTable.java b/guava/src/com/google/common/collect/ArrayTable.java index 01652c5ff..1fce76244 100644 --- a/guava/src/com/google/common/collect/ArrayTable.java +++ b/guava/src/com/google/common/collect/ArrayTable.java @@ -84,7 +84,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * thread that reads from another. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @since 10.0 diff --git a/guava/src/com/google/common/collect/CartesianList.java b/guava/src/com/google/common/collect/CartesianList.java index 475b3f2ec..4c31b1299 100644 --- a/guava/src/com/google/common/collect/CartesianList.java +++ b/guava/src/com/google/common/collect/CartesianList.java @@ -45,7 +45,7 @@ final class CartesianList<E> extends AbstractList<List<E>> implements RandomAcce } axesBuilder.add(copy); } - return new CartesianList<E>(axesBuilder.build()); + return new CartesianList<>(axesBuilder.build()); } CartesianList(ImmutableList<List<E>> axes) { @@ -112,7 +112,7 @@ final class CartesianList<E> extends AbstractList<List<E>> implements RandomAcce } @Override - public ImmutableList<E> get(final int index) { + public ImmutableList<E> get(int index) { checkElementIndex(index, size()); return new ImmutableList<E>() { diff --git a/guava/src/com/google/common/collect/CollectCollectors.java b/guava/src/com/google/common/collect/CollectCollectors.java index 63eec1201..f582660c8 100644 --- a/guava/src/com/google/common/collect/CollectCollectors.java +++ b/guava/src/com/google/common/collect/CollectCollectors.java @@ -17,6 +17,7 @@ package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.stream.Collectors.collectingAndThen; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; @@ -194,7 +195,7 @@ final class CollectCollectors { checkNotNull(keyFunction); checkNotNull(valueFunction); checkNotNull(mergeFunction); - return Collectors.collectingAndThen( + return collectingAndThen( Collectors.toMap(keyFunction, valueFunction, mergeFunction, LinkedHashMap::new), ImmutableMap::copyOf); } @@ -229,7 +230,7 @@ final class CollectCollectors { checkNotNull(keyFunction); checkNotNull(valueFunction); checkNotNull(mergeFunction); - return Collectors.collectingAndThen( + return collectingAndThen( Collectors.toMap( keyFunction, valueFunction, mergeFunction, () -> new TreeMap<K, V>(comparator)), ImmutableSortedMap::copyOfSorted); @@ -368,7 +369,7 @@ final class CollectCollectors { Function<? super T, ? extends Stream<? extends V>> valuesFunction) { checkNotNull(keyFunction); checkNotNull(valuesFunction); - return Collectors.collectingAndThen( + return collectingAndThen( flatteningToMultimap( input -> checkNotNull(keyFunction.apply(input)), input -> valuesFunction.apply(input).peek(Preconditions::checkNotNull), @@ -395,7 +396,7 @@ final class CollectCollectors { Function<? super T, ? extends Stream<? extends V>> valuesFunction) { checkNotNull(keyFunction); checkNotNull(valuesFunction); - return Collectors.collectingAndThen( + return collectingAndThen( flatteningToMultimap( input -> checkNotNull(keyFunction.apply(input)), input -> valuesFunction.apply(input).peek(Preconditions::checkNotNull), diff --git a/guava/src/com/google/common/collect/CollectSpliterators.java b/guava/src/com/google/common/collect/CollectSpliterators.java index 91f563dfe..7d0e82f20 100644 --- a/guava/src/com/google/common/collect/CollectSpliterators.java +++ b/guava/src/com/google/common/collect/CollectSpliterators.java @@ -19,6 +19,7 @@ package com.google.common.collect; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT; +import static java.lang.Math.max; import com.google.common.annotations.GwtCompatible; import com.google.j2objc.annotations.Weak; @@ -225,7 +226,7 @@ final class CollectSpliterators { "flatMap does not support SORTED characteristic"); checkNotNull(fromSpliterator); checkNotNull(function); - return new FlatMapSpliteratorOfObject<InElementT, OutElementT>( + return new FlatMapSpliteratorOfObject<>( null, fromSpliterator, function, topCharacteristics, topSize); } @@ -247,7 +248,7 @@ final class CollectSpliterators { "flatMap does not support SORTED characteristic"); checkNotNull(fromSpliterator); checkNotNull(function); - return new FlatMapSpliteratorOfInt<InElementT>( + return new FlatMapSpliteratorOfInt<>( null, fromSpliterator, function, topCharacteristics, topSize); } @@ -269,7 +270,7 @@ final class CollectSpliterators { "flatMap does not support SORTED characteristic"); checkNotNull(fromSpliterator); checkNotNull(function); - return new FlatMapSpliteratorOfLong<InElementT>( + return new FlatMapSpliteratorOfLong<>( null, fromSpliterator, function, topCharacteristics, topSize); } @@ -291,7 +292,7 @@ final class CollectSpliterators { "flatMap does not support SORTED characteristic"); checkNotNull(fromSpliterator); checkNotNull(function); - return new FlatMapSpliteratorOfDouble<InElementT>( + return new FlatMapSpliteratorOfDouble<>( null, fromSpliterator, function, topCharacteristics, topSize); } @@ -409,9 +410,9 @@ final class CollectSpliterators { @Override public final long estimateSize() { if (prefix != null) { - estimatedSize = Math.max(estimatedSize, prefix.estimateSize()); + estimatedSize = max(estimatedSize, prefix.estimateSize()); } - return Math.max(estimatedSize, 0); + return max(estimatedSize, 0); } @Override diff --git a/guava/src/com/google/common/collect/Comparators.java b/guava/src/com/google/common/collect/Comparators.java index 1b90fb89c..5779be31b 100644 --- a/guava/src/com/google/common/collect/Comparators.java +++ b/guava/src/com/google/common/collect/Comparators.java @@ -19,7 +19,6 @@ package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.CollectPreconditions.checkNonnegative; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Comparator; import java.util.Iterator; @@ -62,7 +61,6 @@ public final class Comparators { // Note: 90% of the time we don't add type parameters or wildcards that serve only to "tweak" the // desired return type. However, *nested* generics introduce a special class of problems that we // think tip it over into being worthwhile. - @Beta public static <T extends @Nullable Object, S extends T> Comparator<Iterable<S>> lexicographical( Comparator<T> comparator) { return new LexicographicalOrdering<S>(checkNotNull(comparator)); @@ -73,7 +71,6 @@ public final class Comparators { * equal to the element that preceded it, according to the specified comparator. Note that this is * always true when the iterable has fewer than two elements. */ - @Beta public static <T extends @Nullable Object> boolean isInOrder( Iterable<? extends T> iterable, Comparator<T> comparator) { checkNotNull(comparator); @@ -96,7 +93,6 @@ public final class Comparators { * greater than the element that preceded it, according to the specified comparator. Note that * this is always true when the iterable has fewer than two elements. */ - @Beta public static <T extends @Nullable Object> boolean isInStrictOrder( Iterable<? extends T> iterable, Comparator<T> comparator) { checkNotNull(comparator); @@ -178,7 +174,6 @@ public final class Comparators { * * @since 22.0 */ - @Beta public static <T> Comparator<Optional<T>> emptiesFirst(Comparator<? super T> valueComparator) { checkNotNull(valueComparator); return Comparator.<Optional<T>, @Nullable T>comparing( @@ -192,7 +187,6 @@ public final class Comparators { * * @since 22.0 */ - @Beta public static <T> Comparator<Optional<T>> emptiesLast(Comparator<? super T> valueComparator) { checkNotNull(valueComparator); return Comparator.<Optional<T>, @Nullable T>comparing( @@ -212,7 +206,6 @@ public final class Comparators { * @throws ClassCastException if the parameters are not <i>mutually comparable</i>. * @since 30.0 */ - @Beta public static <T extends Comparable<? super T>> T min(T a, T b) { return (a.compareTo(b) <= 0) ? a : b; } @@ -232,7 +225,6 @@ public final class Comparators { * comparator. * @since 30.0 */ - @Beta @ParametricNullness public static <T extends @Nullable Object> T min( @ParametricNullness T a, @ParametricNullness T b, Comparator<T> comparator) { @@ -252,7 +244,6 @@ public final class Comparators { * @throws ClassCastException if the parameters are not <i>mutually comparable</i>. * @since 30.0 */ - @Beta public static <T extends Comparable<? super T>> T max(T a, T b) { return (a.compareTo(b) >= 0) ? a : b; } @@ -272,7 +263,6 @@ public final class Comparators { * comparator. * @since 30.0 */ - @Beta @ParametricNullness public static <T extends @Nullable Object> T max( @ParametricNullness T a, @ParametricNullness T b, Comparator<T> comparator) { diff --git a/guava/src/com/google/common/collect/ComparisonChain.java b/guava/src/com/google/common/collect/ComparisonChain.java index 32aeb4d4b..9c05205ec 100644 --- a/guava/src/com/google/common/collect/ComparisonChain.java +++ b/guava/src/com/google/common/collect/ComparisonChain.java @@ -49,7 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * the presence of expensive {@code compareTo} and {@code compare} implementations. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CommonObjectUtilitiesExplained#comparecompareto"> {@code + * "https://github.com/google/guava/wiki/CommonObjectUtilitiesExplained#comparecompareto">{@code * ComparisonChain}</a>. * * @author Mark Davis diff --git a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index ab03eadd3..47248412b 100644 --- a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -49,8 +49,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@code Multiset} operations (exceptions where noted). Null elements are not supported. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Cliff L. Biffle * @author mike nonemacher @@ -88,7 +87,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme // TODO(schmoe): provide a way to use this class with other (possibly arbitrary) // ConcurrentMap implementors. One possibility is to extract most of this class into // an AbstractConcurrentMapMultiset. - return new ConcurrentHashMultiset<E>(new ConcurrentHashMap<E, AtomicInteger>()); + return new ConcurrentHashMultiset<>(new ConcurrentHashMap<E, AtomicInteger>()); } /** @@ -121,7 +120,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme */ @Beta public static <E> ConcurrentHashMultiset<E> create(ConcurrentMap<E, AtomicInteger> countMap) { - return new ConcurrentHashMultiset<E>(countMap); + return new ConcurrentHashMultiset<>(countMap); } @VisibleForTesting @@ -449,7 +448,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme @Override Set<E> createElementSet() { - final Set<E> delegate = countMap.keySet(); + Set<E> delegate = countMap.keySet(); return new ForwardingSet<E>() { @Override protected Set<E> delegate() { @@ -504,7 +503,7 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme Iterator<Entry<E>> entryIterator() { // AbstractIterator makes this fairly clean, but it doesn't support remove(). To support // remove(), we create an AbstractIterator, and then use ForwardingIterator to delegate to it. - final Iterator<Entry<E>> readOnlyIterator = + Iterator<Entry<E>> readOnlyIterator = new AbstractIterator<Entry<E>>() { private final Iterator<Map.Entry<E, AtomicInteger>> mapEntries = countMap.entrySet().iterator(); diff --git a/guava/src/com/google/common/collect/ContiguousSet.java b/guava/src/com/google/common/collect/ContiguousSet.java index cd7704261..b3e4889d7 100644 --- a/guava/src/com/google/common/collect/ContiguousSet.java +++ b/guava/src/com/google/common/collect/ContiguousSet.java @@ -242,7 +242,7 @@ public abstract class ContiguousSet<C extends Comparable> extends ImmutableSorte @Override @GwtIncompatible // NavigableSet ImmutableSortedSet<C> createDescendingSet() { - return new DescendingImmutableSortedSet<C>(this); + return new DescendingImmutableSortedSet<>(this); } /** Returns a short-hand representation of the contents such as {@code "[1..100]"}. */ diff --git a/guava/src/com/google/common/collect/Cut.java b/guava/src/com/google/common/collect/Cut.java index 4a8d4c7fc..21fe5ff2d 100644 --- a/guava/src/com/google/common/collect/Cut.java +++ b/guava/src/com/google/common/collect/Cut.java @@ -308,7 +308,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ } static <C extends Comparable> Cut<C> belowValue(C endpoint) { - return new BelowValue<C>(endpoint); + return new BelowValue<>(endpoint); } private static final class BelowValue<C extends Comparable> extends Cut<C> { @@ -392,7 +392,7 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ } static <C extends Comparable> Cut<C> aboveValue(C endpoint) { - return new AboveValue<C>(endpoint); + return new AboveValue<>(endpoint); } private static final class AboveValue<C extends Comparable> extends Cut<C> { diff --git a/guava/src/com/google/common/collect/DescendingMultiset.java b/guava/src/com/google/common/collect/DescendingMultiset.java index ec5a1d0e3..7db0fbbd4 100644 --- a/guava/src/com/google/common/collect/DescendingMultiset.java +++ b/guava/src/com/google/common/collect/DescendingMultiset.java @@ -54,7 +54,7 @@ abstract class DescendingMultiset<E extends @Nullable Object> extends Forwarding public NavigableSet<E> elementSet() { NavigableSet<E> result = elementSet; if (result == null) { - return elementSet = new SortedMultisets.NavigableElementSet<E>(this); + return elementSet = new SortedMultisets.NavigableElementSet<>(this); } return result; } diff --git a/guava/src/com/google/common/collect/DiscreteDomain.java b/guava/src/com/google/common/collect/DiscreteDomain.java index bce706222..222ebe528 100644 --- a/guava/src/com/google/common/collect/DiscreteDomain.java +++ b/guava/src/com/google/common/collect/DiscreteDomain.java @@ -37,7 +37,7 @@ import javax.annotation.CheckForNull; * represent partial domains such as "prime integers" or "strings of length 5." * * <p>See the Guava User Guide section on <a href= - * "https://github.com/google/guava/wiki/RangesExplained#discrete-domains"> {@code + * "https://github.com/google/guava/wiki/RangesExplained#discrete-domains">{@code * DiscreteDomain}</a>. * * @author Kevin Bourrillion diff --git a/guava/src/com/google/common/collect/EmptyContiguousSet.java b/guava/src/com/google/common/collect/EmptyContiguousSet.java index f4fe33cca..50d7b126a 100644 --- a/guava/src/com/google/common/collect/EmptyContiguousSet.java +++ b/guava/src/com/google/common/collect/EmptyContiguousSet.java @@ -150,7 +150,7 @@ final class EmptyContiguousSet<C extends Comparable> extends ContiguousSet<C> { } private Object readResolve() { - return new EmptyContiguousSet<C>(domain); + return new EmptyContiguousSet<>(domain); } private static final long serialVersionUID = 0; @@ -159,7 +159,7 @@ final class EmptyContiguousSet<C extends Comparable> extends ContiguousSet<C> { @GwtIncompatible // serialization @Override Object writeReplace() { - return new SerializedForm<C>(domain); + return new SerializedForm<>(domain); } @GwtIncompatible // NavigableSet diff --git a/guava/src/com/google/common/collect/EnumBiMap.java b/guava/src/com/google/common/collect/EnumBiMap.java index 82aa052d6..97d3c2e7c 100644 --- a/guava/src/com/google/common/collect/EnumBiMap.java +++ b/guava/src/com/google/common/collect/EnumBiMap.java @@ -32,7 +32,7 @@ import java.util.Map; * An {@code EnumBiMap} and its inverse are both serializable. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/guava/src/com/google/common/collect/EnumHashBiMap.java b/guava/src/com/google/common/collect/EnumHashBiMap.java index f68bc4c20..5fbbb70c6 100644 --- a/guava/src/com/google/common/collect/EnumHashBiMap.java +++ b/guava/src/com/google/common/collect/EnumHashBiMap.java @@ -36,7 +36,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * EnumHashBiMap} and its inverse are both serializable. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/guava/src/com/google/common/collect/EnumMultiset.java b/guava/src/com/google/common/collect/EnumMultiset.java index 09dde1b93..778902ede 100644 --- a/guava/src/com/google/common/collect/EnumMultiset.java +++ b/guava/src/com/google/common/collect/EnumMultiset.java @@ -38,8 +38,7 @@ import javax.annotation.CheckForNull; * in O(1). * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/EvictingQueue.java b/guava/src/com/google/common/collect/EvictingQueue.java index 45f59f367..5667dfa8c 100644 --- a/guava/src/com/google/common/collect/EvictingQueue.java +++ b/guava/src/com/google/common/collect/EvictingQueue.java @@ -54,7 +54,7 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial private EvictingQueue(int maxSize) { checkArgument(maxSize >= 0, "maxSize (%s) must >= 0", maxSize); - this.delegate = new ArrayDeque<E>(maxSize); + this.delegate = new ArrayDeque<>(maxSize); this.maxSize = maxSize; } @@ -65,7 +65,7 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial * queue. */ public static <E> EvictingQueue<E> create(int maxSize) { - return new EvictingQueue<E>(maxSize); + return new EvictingQueue<>(maxSize); } /** diff --git a/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/guava/src/com/google/common/collect/FilteredEntryMultimap.java index 3ff00b71b..de946a215 100644 --- a/guava/src/com/google/common/collect/FilteredEntryMultimap.java +++ b/guava/src/com/google/common/collect/FilteredEntryMultimap.java @@ -118,7 +118,7 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje } @Override - public Collection<V> get(@ParametricNullness final K key) { + public Collection<V> get(@ParametricNullness K key) { return filterCollection(unfiltered.get(key), new ValuePredicate(key)); } @@ -396,15 +396,11 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje return FilteredEntryMultimap.this.keySet().size(); } - private boolean removeEntriesIf(final Predicate<? super Multiset.Entry<K>> predicate) { + private boolean removeEntriesIf(Predicate<? super Multiset.Entry<K>> predicate) { return FilteredEntryMultimap.this.removeEntriesIf( - new Predicate<Map.Entry<K, Collection<V>>>() { - @Override - public boolean apply(Map.Entry<K, Collection<V>> entry) { - return predicate.apply( - Multisets.immutableEntry(entry.getKey(), entry.getValue().size())); - } - }); + (Map.Entry<K, Collection<V>> entry) -> + predicate.apply( + Multisets.immutableEntry(entry.getKey(), entry.getValue().size()))); } @Override diff --git a/guava/src/com/google/common/collect/GeneralRange.java b/guava/src/com/google/common/collect/GeneralRange.java index 20cf4fbfc..3d7256ff8 100644 --- a/guava/src/com/google/common/collect/GeneralRange.java +++ b/guava/src/com/google/common/collect/GeneralRange.java @@ -46,7 +46,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { T upperEndpoint = range.hasUpperBound() ? range.upperEndpoint() : null; BoundType upperBoundType = range.hasUpperBound() ? range.upperBoundType() : OPEN; - return new GeneralRange<T>( + return new GeneralRange<>( Ordering.natural(), range.hasLowerBound(), lowerEndpoint, @@ -58,7 +58,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { /** Returns the whole range relative to the specified comparator. */ static <T extends @Nullable Object> GeneralRange<T> all(Comparator<? super T> comparator) { - return new GeneralRange<T>(comparator, false, null, OPEN, false, null, OPEN); + return new GeneralRange<>(comparator, false, null, OPEN, false, null, OPEN); } /** @@ -67,7 +67,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { */ static <T extends @Nullable Object> GeneralRange<T> downTo( Comparator<? super T> comparator, @ParametricNullness T endpoint, BoundType boundType) { - return new GeneralRange<T>(comparator, true, endpoint, boundType, false, null, OPEN); + return new GeneralRange<>(comparator, true, endpoint, boundType, false, null, OPEN); } /** @@ -76,7 +76,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { */ static <T extends @Nullable Object> GeneralRange<T> upTo( Comparator<? super T> comparator, @ParametricNullness T endpoint, BoundType boundType) { - return new GeneralRange<T>(comparator, false, null, OPEN, true, endpoint, boundType); + return new GeneralRange<>(comparator, false, null, OPEN, true, endpoint, boundType); } /** @@ -89,7 +89,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { BoundType lowerType, @ParametricNullness T upper, BoundType upperType) { - return new GeneralRange<T>(comparator, true, lower, lowerType, true, upper, upperType); + return new GeneralRange<>(comparator, true, lower, lowerType, true, upper, upperType); } private final Comparator<? super T> comparator; @@ -138,7 +138,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { checkArgument( cmp <= 0, "lowerEndpoint (%s) > upperEndpoint (%s)", lowerEndpoint, upperEndpoint); if (cmp == 0) { - checkArgument(lowerBoundType != OPEN | upperBoundType != OPEN); + checkArgument(lowerBoundType != OPEN || upperBoundType != OPEN); } } } @@ -233,7 +233,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { } } - return new GeneralRange<T>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType); + return new GeneralRange<>(comparator, hasLowBound, lowEnd, lowType, hasUpBound, upEnd, upType); } @Override @@ -268,7 +268,7 @@ final class GeneralRange<T extends @Nullable Object> implements Serializable { GeneralRange<T> result = reverse; if (result == null) { result = - new GeneralRange<T>( + new GeneralRange<>( Ordering.from(comparator).reverse(), hasUpperBound, getUpperEndpoint(), diff --git a/guava/src/com/google/common/collect/HashBasedTable.java b/guava/src/com/google/common/collect/HashBasedTable.java index c8ba50fd1..21882e62d 100644 --- a/guava/src/com/google/common/collect/HashBasedTable.java +++ b/guava/src/com/google/common/collect/HashBasedTable.java @@ -41,7 +41,7 @@ import java.util.Map; * concurrently and one of the threads modifies the table, it must be synchronized externally. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @since 7.0 diff --git a/guava/src/com/google/common/collect/HashBiMap.java b/guava/src/com/google/common/collect/HashBiMap.java index b6e2042a2..b0a5dd50e 100644 --- a/guava/src/com/google/common/collect/HashBiMap.java +++ b/guava/src/com/google/common/collect/HashBiMap.java @@ -50,7 +50,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * <p>This implementation guarantees insertion-based iteration order of its keys. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap"> {@code BiMap} </a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#bimap">{@code BiMap} </a>. * * @author Louis Wasserman * @author Mike Bostock @@ -489,6 +489,7 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj public Iterator<K> iterator() { return new Itr<K>() { @Override + @ParametricNullness K output(BiEntry<K, V> entry) { return entry.key; } @@ -530,17 +531,20 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj } @Override + @ParametricNullness public K getKey() { return delegate.key; } @Override + @ParametricNullness public V getValue() { return delegate.value; } @Override - public V setValue(V value) { + @ParametricNullness + public V setValue(@ParametricNullness V value) { V oldValue = delegate.value; int valueHash = smearedHash(value); if (valueHash == delegate.valueHash && Objects.equal(value, oldValue)) { @@ -675,6 +679,7 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj public Iterator<V> iterator() { return new Itr<V>() { @Override + @ParametricNullness V output(BiEntry<K, V> entry) { return entry.value; } @@ -703,17 +708,20 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj } @Override + @ParametricNullness public V getKey() { return delegate.value; } @Override + @ParametricNullness public K getValue() { return delegate.key; } @Override - public K setValue(K key) { + @ParametricNullness + public K setValue(@ParametricNullness K key) { K oldKey = delegate.key; int keyHash = smearedHash(key); if (keyHash == delegate.keyHash && Objects.equal(key, oldKey)) { diff --git a/guava/src/com/google/common/collect/ImmutableBiMap.java b/guava/src/com/google/common/collect/ImmutableBiMap.java index 2f2e9ab5c..4c222c1bf 100644 --- a/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -480,6 +480,21 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableBiMapFauxverideShim< } } + /** + * Throws {@link UnsupportedOperationException}. This method is inherited from {@link + * ImmutableMap.Builder}, but it does not make sense for bimaps. + * + * @throws UnsupportedOperationException always + * @deprecated This method does not make sense for bimaps and should not be called. + * @since 31.1 + */ + @DoNotCall + @Deprecated + @Override + public ImmutableBiMap<K, V> buildKeepingLast() { + throw new UnsupportedOperationException("Not supported for bimaps"); + } + @Override @VisibleForTesting ImmutableBiMap<K, V> buildJdkBacked() { diff --git a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index aeabe5d3a..c59e9fdab 100644 --- a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -62,7 +62,7 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? */ public static <B, T extends B> ImmutableClassToInstanceMap<B> of(Class<T> type, T value) { ImmutableMap<Class<? extends B>, B> map = ImmutableMap.<Class<? extends B>, B>of(type, value); - return new ImmutableClassToInstanceMap<B>(map); + return new ImmutableClassToInstanceMap<>(map); } /** @@ -70,7 +70,7 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? * Builder} constructor. */ public static <B> Builder<B> builder() { - return new Builder<B>(); + return new Builder<>(); } /** @@ -131,11 +131,11 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? * @throws IllegalArgumentException if duplicate keys were added */ public ImmutableClassToInstanceMap<B> build() { - ImmutableMap<Class<? extends B>, B> map = mapBuilder.build(); + ImmutableMap<Class<? extends B>, B> map = mapBuilder.buildOrThrow(); if (map.isEmpty()) { return of(); } else { - return new ImmutableClassToInstanceMap<B>(map); + return new ImmutableClassToInstanceMap<>(map); } } } diff --git a/guava/src/com/google/common/collect/ImmutableCollection.java b/guava/src/com/google/common/collect/ImmutableCollection.java index 80fefb6e7..314f83cce 100644 --- a/guava/src/com/google/common/collect/ImmutableCollection.java +++ b/guava/src/com/google/common/collect/ImmutableCollection.java @@ -156,7 +156,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * <h3>See also</h3> * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @since 2.0 */ diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java index 115c02247..bc8166507 100644 --- a/guava/src/com/google/common/collect/ImmutableList.java +++ b/guava/src/com/google/common/collect/ImmutableList.java @@ -53,7 +53,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @see ImmutableMap * @see ImmutableSet diff --git a/guava/src/com/google/common/collect/ImmutableListMultimap.java b/guava/src/com/google/common/collect/ImmutableListMultimap.java index f84701624..0184c5bf1 100644 --- a/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -43,7 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * detailed at {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @since 2.0 @@ -377,7 +377,7 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> } } - return new ImmutableListMultimap<>(builder.build(), size); + return new ImmutableListMultimap<>(builder.buildOrThrow(), size); } ImmutableListMultimap(ImmutableMap<K, ImmutableList<V>> map, int size) { @@ -490,7 +490,7 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V> ImmutableMap<Object, ImmutableList<Object>> tmpMap; try { - tmpMap = builder.build(); + tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { throw (InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e); } diff --git a/guava/src/com/google/common/collect/ImmutableMap.java b/guava/src/com/google/common/collect/ImmutableMap.java index 23335b280..b24ed6c73 100644 --- a/guava/src/com/google/common/collect/ImmutableMap.java +++ b/guava/src/com/google/common/collect/ImmutableMap.java @@ -32,14 +32,16 @@ import com.google.errorprone.annotations.concurrent.LazyInit; import com.google.j2objc.annotations.RetainedWith; import com.google.j2objc.annotations.WeakOuter; import java.io.Serializable; -import java.util.AbstractMap; import java.util.Arrays; +import java.util.BitSet; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.EnumMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.SortedMap; import java.util.Spliterator; import java.util.Spliterators; @@ -56,7 +58,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jesse Wilson * @author Kevin Bourrillion @@ -334,8 +336,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { * UnsupportedOperationException}. */ static <K, V> Entry<K, V> entryOf(K key, V value) { - checkEntryNotNull(key, value); - return new AbstractMap.SimpleImmutableEntry<>(key, value); + return new ImmutableMapEntry<>(key, value); } /** @@ -365,7 +366,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } static void checkNoConflict( - boolean safe, String conflictDescription, Entry<?, ?> entry1, Entry<?, ?> entry2) { + boolean safe, String conflictDescription, Object entry1, Object entry2) { if (!safe) { throw conflictException(conflictDescription, entry1, entry2); } @@ -438,8 +439,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Associates {@code key} with {@code value} in the built map. Duplicate keys are not allowed, - * and will cause {@link #build} to fail. + * Associates {@code key} with {@code value} in the built map. If the same key is put more than + * once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep the last + * value put for that key. */ @CanIgnoreReturnValue public Builder<K, V> put(K key, V value) { @@ -451,8 +453,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Adds the given {@code entry} to the map, making it immutable if necessary. Duplicate keys are - * not allowed, and will cause {@link #build} to fail. + * Adds the given {@code entry} to the map, making it immutable if necessary. If the same key is + * put more than once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will + * keep the last value put for that key. * * @since 11.0 */ @@ -462,8 +465,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Associates all of the given map's keys and values in the built map. Duplicate keys are not - * allowed, and will cause {@link #build} to fail. + * Associates all of the given map's keys and values in the built map. If the same key is put + * more than once, {@link #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep + * the last value put for that key. * * @throws NullPointerException if any key or value in {@code map} is null */ @@ -473,8 +477,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { } /** - * Adds all of the given entries to the built map. Duplicate keys are not allowed, and will - * cause {@link #build} to fail. + * Adds all of the given entries to the built map. If the same key is put more than once, {@link + * #buildOrThrow} will fail, while {@link #buildKeepingLast} will keep the last value put for + * that key. * * @throws NullPointerException if any key, value, or entry is null * @since 19.0 @@ -518,10 +523,55 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { return this; } - /* - * TODO(kevinb): Should build() and the ImmutableBiMap & ImmutableSortedMap - * versions throw an IllegalStateException instead? - */ + private ImmutableMap<K, V> build(boolean throwIfDuplicateKeys) { + /* + * If entries is full, or if hash flooding is detected, then this implementation may end up + * using the entries array directly and writing over the entry objects with non-terminal + * entries, but this is safe; if this Builder is used further, it will grow the entries array + * (so it can't affect the original array), and future build() calls will always copy any + * entry objects that cannot be safely reused. + */ + switch (size) { + case 0: + return of(); + case 1: + // requireNonNull is safe because the first `size` elements have been filled in. + Entry<K, V> onlyEntry = requireNonNull(entries[0]); + return of(onlyEntry.getKey(), onlyEntry.getValue()); + default: + break; + } + // localEntries is an alias for the entries field, except if we end up removing duplicates in + // a copy of the entries array. Likewise, localSize is the same as size except in that case. + // It's possible to keep using this Builder after calling buildKeepingLast(), so we need to + // ensure that its state is not corrupted by removing duplicates that should cause a later + // buildOrThrow() to fail, or by changing the size. + @Nullable Entry<K, V>[] localEntries; + int localSize = size; + if (valueComparator == null) { + localEntries = entries; + } else { + if (entriesUsed) { + entries = Arrays.copyOf(entries, size); + } + localEntries = entries; + if (!throwIfDuplicateKeys) { + // We want to retain only the last-put value for any given key, before sorting. + // This could be improved, but orderEntriesByValue is rather rarely used anyway. + @SuppressWarnings("nullness") // entries 0..size-1 are non-null + Entry<K, V>[] nonNullEntries = (Entry<K, V>[]) localEntries; + localEntries = lastEntryForEachKey(nonNullEntries, size); + localSize = localEntries.length; + } + Arrays.sort( + localEntries, + 0, + localSize, + Ordering.from(valueComparator).onResultOf(Maps.<V>valueFunction())); + } + entriesUsed = true; + return RegularImmutableMap.fromEntryArray(localSize, localEntries, throwIfDuplicateKeys); + } /** * Returns a newly-created immutable map. The iteration order of the returned map is the order @@ -548,31 +598,26 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { * @since 31.0 */ public ImmutableMap<K, V> buildOrThrow() { - /* - * If entries is full, or if hash flooding is detected, then this implementation may end up - * using the entries array directly and writing over the entry objects with non-terminal - * entries, but this is safe; if this Builder is used further, it will grow the entries array - * (so it can't affect the original array), and future build() calls will always copy any - * entry objects that cannot be safely reused. - */ - if (valueComparator != null) { - if (entriesUsed) { - entries = Arrays.copyOf(entries, size); - } - Arrays.sort( - entries, 0, size, Ordering.from(valueComparator).onResultOf(Maps.<V>valueFunction())); - } - switch (size) { - case 0: - return of(); - case 1: - // requireNonNull is safe because the first `size` elements have been filled in. - Entry<K, V> onlyEntry = requireNonNull(entries[0]); - return of(onlyEntry.getKey(), onlyEntry.getValue()); - default: - entriesUsed = true; - return RegularImmutableMap.fromEntryArray(size, entries); - } + return build(true); + } + + /** + * Returns a newly-created immutable map, using the last value for any key that was added more + * than once. The iteration order of the returned map is the order in which entries were + * inserted into the builder, unless {@link #orderEntriesByValue} was called, in which case + * entries are sorted by value. If a key was added more than once, it appears in iteration order + * based on the first time it was added, again unless {@link #orderEntriesByValue} was called. + * + * <p>In the current implementation, all values associated with a given key are stored in the + * {@code Builder} object, even though only one of them will be used in the built map. If there + * can be many repeated keys, it may be more space-efficient to use a {@link + * java.util.LinkedHashMap LinkedHashMap} and {@link ImmutableMap#copyOf(Map)} rather than + * {@code ImmutableMap.Builder}. + * + * @since 31.1 + */ + public ImmutableMap<K, V> buildKeepingLast() { + return build(false); } @VisibleForTesting // only for testing JDK backed implementation @@ -588,8 +633,29 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { return of(onlyEntry.getKey(), onlyEntry.getValue()); default: entriesUsed = true; - return JdkBackedImmutableMap.create(size, entries); + return JdkBackedImmutableMap.create(size, entries, /* throwIfDuplicateKeys= */ true); + } + } + + private static <K, V> Entry<K, V>[] lastEntryForEachKey(Entry<K, V>[] entries, int size) { + Set<K> seen = new HashSet<>(); + BitSet dups = new BitSet(); // slots that are overridden by a later duplicate key + for (int i = size - 1; i >= 0; i--) { + if (!seen.add(entries[i].getKey())) { + dups.set(i); + } + } + if (dups.isEmpty()) { + return entries; + } + @SuppressWarnings({"rawtypes", "unchecked"}) + Entry<K, V>[] newEntries = new Entry[size - dups.cardinality()]; + for (int inI = 0, outI = 0; inI < size; inI++) { + if (!dups.get(inI)) { + newEntries[outI++] = entries[inI]; + } } + return newEntries; } } @@ -905,6 +971,31 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { @Override @CheckForNull public final V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) { + /* + * Even though it's weird to pass a defaultValue that is null, some callers do so. Those who + * pass a literal "null" should probably just use `get`, but I would expect other callers to + * pass an expression that *might* be null. This could happen with: + * + * - a `getFooOrDefault(@CheckForNull Foo defaultValue)` method that returns + * `map.getOrDefault(FOO_KEY, defaultValue)` + * + * - a call that consults a chain of maps, as in `mapA.getOrDefault(key, mapB.getOrDefault(key, + * ...))` + * + * So it makes sense for the parameter (and thus the return type) to be @CheckForNull. + * + * Two other points: + * + * 1. We'll want to use something like @PolyNull once we can make that work for the various + * platforms we target. + * + * 2. Kotlin's Map type has a getOrDefault method that accepts and returns a "plain V," in + * contrast to the "V?" type that we're using. As a result, Kotlin sees a conflict between the + * nullness annotations in ImmutableMap and those in its own Map type. In response, it considers + * the parameter and return type both to be platform types. As a result, Kotlin permits calls + * that can lead to NullPointerException. That's unfortunate. But hopefully most Kotlin callers + * use `get(key) ?: defaultValue` instead of this method, anyway. + */ V result = get(key); // TODO(b/192579700): Use a ternary once it no longer confuses our nullness checker. if (result != null) { @@ -1148,7 +1239,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { builder.put(keyIter.next(), valueIter.next()); } - return builder.build(); + return builder.buildOrThrow(); } @SuppressWarnings("unchecked") @@ -1161,7 +1252,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable { for (int i = 0; i < keys.length; i++) { builder.put(keys[i], values[i]); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/guava/src/com/google/common/collect/ImmutableMultimap.java b/guava/src/com/google/common/collect/ImmutableMultimap.java index 5dfbb9bca..d16e1bc56 100644 --- a/guava/src/com/google/common/collect/ImmutableMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableMultimap.java @@ -64,7 +64,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * immediately after the last entry having that key. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java index f397a49af..b05ab3fe0 100644 --- a/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -47,7 +47,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * element when the multiset was created. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman @@ -325,7 +325,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa @GwtIncompatible // not present in emulated superclass @Override - int copyIntoArray(Object[] dst, int offset) { + int copyIntoArray(@Nullable Object[] dst, int offset) { for (Multiset.Entry<E> entry : entrySet()) { Arrays.fill(dst, offset, offset + entry.getCount(), entry.getElement()); offset += entry.getCount(); diff --git a/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 007c16b77..52d6e55c3 100644 --- a/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -51,7 +51,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Mike Ward * @since 2.0 @@ -428,7 +428,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> } } - return new ImmutableSetMultimap<>(builder.build(), size, valueComparator); + return new ImmutableSetMultimap<>(builder.buildOrThrow(), size, valueComparator); } /** @@ -634,7 +634,7 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V> ImmutableMap<Object, ImmutableSet<Object>> tmpMap; try { - tmpMap = builder.build(); + tmpMap = builder.buildOrThrow(); } catch (IllegalArgumentException e) { throw (InvalidObjectException) new InvalidObjectException(e.getMessage()).initCause(e); } diff --git a/guava/src/com/google/common/collect/ImmutableSortedMap.java b/guava/src/com/google/common/collect/ImmutableSortedMap.java index c4b59c826..ab971937d 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -54,7 +54,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman @@ -743,6 +743,24 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride return fromEntries(comparator, false, entries, size); } } + + /** + * Throws UnsupportedOperationException. A future version may support this operation. Then the + * value for any given key will be the one that was last supplied in a {@code put} operation for + * that key. + * + * @throws UnsupportedOperationException always + * @since 31.1 + * @deprecated This method is not currently implemented, and may never be. + */ + @DoNotCall + @Deprecated + @Override + public final ImmutableSortedMap<K, V> buildKeepingLast() { + // TODO(emcmanus): implement + throw new UnsupportedOperationException( + "ImmutableSortedMap.Builder does not yet implement buildKeepingLast()"); + } } private final transient RegularImmutableSortedSet<K> keySet; diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index bf5a2f4d0..0638df04e 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -45,7 +45,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * collection will not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Louis Wasserman * @since 12.0 diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java index 8a7aec16c..20d007271 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -53,7 +53,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * collection will not correctly obey its specification. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/guava/src/com/google/common/collect/ImmutableTable.java b/guava/src/com/google/common/collect/ImmutableTable.java index 6d159389f..033c271e6 100644 --- a/guava/src/com/google/common/collect/ImmutableTable.java +++ b/guava/src/com/google/common/collect/ImmutableTable.java @@ -40,7 +40,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * at {@link ImmutableCollection}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained"> immutable collections</a>. + * "https://github.com/google/guava/wiki/ImmutableCollectionsExplained">immutable collections</a>. * * @author Gregory Kick * @since 11.0 diff --git a/guava/src/com/google/common/collect/Interners.java b/guava/src/com/google/common/collect/Interners.java index a3ae37496..10ae27463 100644 --- a/guava/src/com/google/common/collect/Interners.java +++ b/guava/src/com/google/common/collect/Interners.java @@ -81,7 +81,7 @@ public final class Interners { if (!strong) { mapMaker.weakKeys(); } - return new InternerImpl<E>(mapMaker); + return new InternerImpl<>(mapMaker); } } @@ -158,7 +158,7 @@ public final class Interners { * @since 8.0 */ public static <E> Function<E, E> asFunction(Interner<E> interner) { - return new InternerFunction<E>(checkNotNull(interner)); + return new InternerFunction<>(checkNotNull(interner)); } private static class InternerFunction<E> implements Function<E, E> { diff --git a/guava/src/com/google/common/collect/Iterables.java b/guava/src/com/google/common/collect/Iterables.java index fb2b5438e..7928b15d6 100644 --- a/guava/src/com/google/common/collect/Iterables.java +++ b/guava/src/com/google/common/collect/Iterables.java @@ -57,7 +57,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * absolutely necessary. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables">{@code * Iterables}</a>. * * @author Kevin Bourrillion @@ -516,6 +516,10 @@ public final class Iterables { * <p>Iterators returned by the returned iterable do not support the {@link Iterator#remove()} * method. The returned lists implement {@link RandomAccess}, whether or not the input list does. * + * <p><b>Note:</b> The current implementation eagerly allocates storage for {@code size} elements. + * As a consequence, passing values like {@code Integer.MAX_VALUE} can lead to {@link + * OutOfMemoryError}. + * * <p><b>Note:</b> if {@code iterable} is a {@link List}, use {@link Lists#partition(List, int)} * instead. * diff --git a/guava/src/com/google/common/collect/Iterators.java b/guava/src/com/google/common/collect/Iterators.java index 5ea2da9da..2f9fd3b4a 100644 --- a/guava/src/com/google/common/collect/Iterators.java +++ b/guava/src/com/google/common/collect/Iterators.java @@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * necessary. * * <p>See the Guava User Guide section on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#iterables">{@code * Iterators}</a>. * * @author Kevin Bourrillion @@ -127,7 +127,7 @@ public final class Iterators { /** Returns an unmodifiable view of {@code iterator}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> unmodifiableIterator( - final Iterator<? extends T> iterator) { + Iterator<? extends T> iterator) { checkNotNull(iterator); if (iterator instanceof UnmodifiableIterator) { @SuppressWarnings("unchecked") // Since it's unmodifiable, the covariant cast is safe @@ -397,7 +397,7 @@ public final class Iterators { * should use an explicit {@code break} or be certain that you will eventually remove all the * elements. */ - public static <T extends @Nullable Object> Iterator<T> cycle(final Iterable<T> iterable) { + public static <T extends @Nullable Object> Iterator<T> cycle(Iterable<T> iterable) { checkNotNull(iterable); return new Iterator<T>() { Iterator<T> iterator = emptyModifiableIterator(); @@ -462,8 +462,7 @@ public final class Iterators { * * <p>This is mainly just to avoid the intermediate ArrayDeque in ConsumingQueueIterator. */ - private static <I extends Iterator<?>> Iterator<I> consumingForArray( - final @Nullable I... elements) { + private static <I extends Iterator<?>> Iterator<I> consumingForArray(@Nullable I... elements) { return new UnmodifiableIterator<I>() { int index = 0; @@ -566,7 +565,7 @@ public final class Iterators { */ public static <T extends @Nullable Object> Iterator<T> concat( Iterator<? extends Iterator<? extends T>> inputs) { - return new ConcatenatedIterator<T>(inputs); + return new ConcatenatedIterator<>(inputs); } /** Concats a varargs array of iterators without making a defensive copy of the array. */ @@ -586,6 +585,10 @@ public final class Iterators { * * <p>The returned lists implement {@link java.util.RandomAccess}. * + * <p><b>Note:</b> The current implementation eagerly allocates storage for {@code size} elements. + * As a consequence, passing values like {@code Integer.MAX_VALUE} can lead to {@link + * OutOfMemoryError}. + * * @param iterator the iterator to return a partitioned view of * @param size the desired size of each partition (the last may be smaller) * @return an iterator of immutable lists containing the elements of {@code iterator} divided into @@ -617,7 +620,7 @@ public final class Iterators { } private static <T extends @Nullable Object> UnmodifiableIterator<List<@Nullable T>> partitionImpl( - final Iterator<T> iterator, final int size, final boolean pad) { + Iterator<T> iterator, int size, boolean pad) { checkNotNull(iterator); checkArgument(size > 0); return new UnmodifiableIterator<List<@Nullable T>>() { @@ -658,7 +661,7 @@ public final class Iterators { * {@code retainIfTrue}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> filter( - final Iterator<T> unfiltered, final Predicate<? super T> retainIfTrue) { + Iterator<T> unfiltered, Predicate<? super T> retainIfTrue) { checkNotNull(unfiltered); checkNotNull(retainIfTrue); return new AbstractIterator<T>() { @@ -817,7 +820,7 @@ public final class Iterators { * element. */ public static <F extends @Nullable Object, T extends @Nullable Object> Iterator<T> transform( - final Iterator<F> fromIterator, final Function<? super F, ? extends T> function) { + Iterator<F> fromIterator, Function<? super F, ? extends T> function) { checkNotNull(function); return new TransformedIterator<F, T>(fromIterator) { @ParametricNullness @@ -952,7 +955,7 @@ public final class Iterators { * @since 3.0 */ public static <T extends @Nullable Object> Iterator<T> limit( - final Iterator<T> iterator, final int limitSize) { + Iterator<T> iterator, int limitSize) { checkNotNull(iterator); checkArgument(limitSize >= 0, "limit is negative"); return new Iterator<T>() { @@ -991,8 +994,7 @@ public final class Iterators { * @return an iterator that removes and returns elements from the supplied iterator * @since 2.0 */ - public static <T extends @Nullable Object> Iterator<T> consumingIterator( - final Iterator<T> iterator) { + public static <T extends @Nullable Object> Iterator<T> consumingIterator(Iterator<T> iterator) { checkNotNull(iterator); return new UnmodifiableIterator<T>() { @Override @@ -1052,7 +1054,7 @@ public final class Iterators { * {@link ImmutableList#copyOf(Object[])}}, or {@link ImmutableList#of}. */ @SafeVarargs - public static <T extends @Nullable Object> UnmodifiableIterator<T> forArray(final T... array) { + public static <T extends @Nullable Object> UnmodifiableIterator<T> forArray(T... array) { return forArray(array, 0, array.length, 0); } @@ -1064,7 +1066,7 @@ public final class Iterators { * Arrays.asList(array).subList(offset, offset + length).listIterator(index)}. */ static <T extends @Nullable Object> UnmodifiableListIterator<T> forArray( - final T[] array, final int offset, int length, int index) { + T[] array, int offset, int length, int index) { checkArgument(length >= 0); int end = offset + length; @@ -1074,7 +1076,7 @@ public final class Iterators { if (length == 0) { return emptyListIterator(); } - return new ArrayItr<T>(array, offset, length, index); + return new ArrayItr<>(array, offset, length, index); } private static final class ArrayItr<T extends @Nullable Object> @@ -1103,7 +1105,7 @@ public final class Iterators { * <p>The {@link Iterable} equivalent of this method is {@link Collections#singleton}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> singletonIterator( - @ParametricNullness final T value) { + @ParametricNullness T value) { return new UnmodifiableIterator<T>() { boolean done; @@ -1135,7 +1137,7 @@ public final class Iterators { * return an {@code UnmodifiableIterator} instead of a plain {@code Iterator}. */ public static <T extends @Nullable Object> UnmodifiableIterator<T> forEnumeration( - final Enumeration<T> enumeration) { + Enumeration<T> enumeration) { checkNotNull(enumeration); return new UnmodifiableIterator<T>() { @Override @@ -1157,8 +1159,7 @@ public final class Iterators { * <p>The {@code Iterable} equivalent of this method is either {@link Collections#enumeration} (if * you have a {@link Collection}), or {@code Iterators.asEnumeration(collection.iterator())}. */ - public static <T extends @Nullable Object> Enumeration<T> asEnumeration( - final Iterator<T> iterator) { + public static <T extends @Nullable Object> Enumeration<T> asEnumeration(Iterator<T> iterator) { checkNotNull(iterator); return new Enumeration<T>() { @Override @@ -1266,7 +1267,7 @@ public final class Iterators { PeekingImpl<T> peeking = (PeekingImpl<T>) iterator; return peeking; } - return new PeekingImpl<T>(iterator); + return new PeekingImpl<>(iterator); } /** @@ -1299,7 +1300,7 @@ public final class Iterators { checkNotNull(iterators, "iterators"); checkNotNull(comparator, "comparator"); - return new MergingIterator<T>(iterators, comparator); + return new MergingIterator<>(iterators, comparator); } /** @@ -1315,17 +1316,12 @@ public final class Iterators { final Queue<PeekingIterator<T>> queue; public MergingIterator( - Iterable<? extends Iterator<? extends T>> iterators, - final Comparator<? super T> itemComparator) { + Iterable<? extends Iterator<? extends T>> iterators, Comparator<? super T> itemComparator) { // A comparator that's used by the heap, allowing the heap // to be sorted based on the top of each iterator. Comparator<PeekingIterator<T>> heapComparator = - new Comparator<PeekingIterator<T>>() { - @Override - public int compare(PeekingIterator<T> o1, PeekingIterator<T> o2) { - return itemComparator.compare(o1.peek(), o2.peek()); - } - }; + (PeekingIterator<T> o1, PeekingIterator<T> o2) -> + itemComparator.compare(o1.peek(), o2.peek()); queue = new PriorityQueue<>(2, heapComparator); diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java index 09f313521..f126fdea3 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java @@ -78,7 +78,7 @@ final class JdkBackedImmutableBiMap<K, V> extends ImmutableBiMap<K, V> { if (result == null) { inverse = result = - new JdkBackedImmutableBiMap<V, K>( + new JdkBackedImmutableBiMap<>( new InverseEntries(), backwardDelegate, forwardDelegate); result.inverse = this; } @@ -112,12 +112,12 @@ final class JdkBackedImmutableBiMap<K, V> extends ImmutableBiMap<K, V> { @Override ImmutableSet<Entry<K, V>> createEntrySet() { - return new ImmutableMapEntrySet.RegularEntrySet<K, V>(this, entries); + return new ImmutableMapEntrySet.RegularEntrySet<>(this, entries); } @Override ImmutableSet<K> createKeySet() { - return new ImmutableMapKeySet<K, V>(this); + return new ImmutableMapKeySet<>(this); } @Override diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java index 5b323b953..222c4deb8 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java @@ -21,6 +21,7 @@ import static com.google.common.collect.RegularImmutableMap.makeImmutable; import static java.util.Objects.requireNonNull; import com.google.common.annotations.GwtCompatible; +import java.util.HashMap; import java.util.Map; import java.util.function.BiConsumer; import javax.annotation.CheckForNull; @@ -38,16 +39,50 @@ final class JdkBackedImmutableMap<K, V> extends ImmutableMap<K, V> { * detected. This implementation may replace the entries in entryArray with its own entry objects * (though they will have the same key/value contents), and will take ownership of entryArray. */ - static <K, V> ImmutableMap<K, V> create(int n, @Nullable Entry<K, V>[] entryArray) { + static <K, V> ImmutableMap<K, V> create( + int n, @Nullable Entry<K, V>[] entryArray, boolean throwIfDuplicateKeys) { Map<K, V> delegateMap = Maps.newHashMapWithExpectedSize(n); + // If duplicates are allowed, this map will track the last value for each duplicated key. + // A second pass will retain only the first entry for that key, but with this last value. The + // value will then be replaced by null, signaling that later entries with the same key should + // be deleted. + Map<K, @Nullable V> duplicates = null; + int dupCount = 0; for (int i = 0; i < n; i++) { // requireNonNull is safe because the first `n` elements have been filled in. entryArray[i] = makeImmutable(requireNonNull(entryArray[i])); - V oldValue = delegateMap.putIfAbsent(entryArray[i].getKey(), entryArray[i].getValue()); + K key = entryArray[i].getKey(); + V value = entryArray[i].getValue(); + V oldValue = delegateMap.put(key, value); if (oldValue != null) { - throw conflictException("key", entryArray[i], entryArray[i].getKey() + "=" + oldValue); + if (throwIfDuplicateKeys) { + throw conflictException("key", entryArray[i], entryArray[i].getKey() + "=" + oldValue); + } + if (duplicates == null) { + duplicates = new HashMap<>(); + } + duplicates.put(key, value); + dupCount++; } } + if (duplicates != null) { + @SuppressWarnings({"rawtypes", "unchecked"}) + Entry<K, V>[] newEntryArray = new Entry[n - dupCount]; + for (int inI = 0, outI = 0; inI < n; inI++) { + Entry<K, V> entry = requireNonNull(entryArray[inI]); + K key = entry.getKey(); + if (duplicates.containsKey(key)) { + V value = duplicates.get(key); + if (value == null) { + continue; // delete this duplicate + } + entry = new ImmutableMapEntry<>(key, value); + duplicates.put(key, null); + } + newEntryArray[outI++] = entry; + } + entryArray = newEntryArray; + } return new JdkBackedImmutableMap<>(delegateMap, ImmutableList.asImmutableList(entryArray, n)); } @@ -72,7 +107,7 @@ final class JdkBackedImmutableMap<K, V> extends ImmutableMap<K, V> { @Override ImmutableSet<Entry<K, V>> createEntrySet() { - return new ImmutableMapEntrySet.RegularEntrySet<K, V>(this, entries); + return new ImmutableMapEntrySet.RegularEntrySet<>(this, entries); } @Override @@ -83,12 +118,12 @@ final class JdkBackedImmutableMap<K, V> extends ImmutableMap<K, V> { @Override ImmutableSet<K> createKeySet() { - return new ImmutableMapKeySet<K, V>(this); + return new ImmutableMapKeySet<>(this); } @Override ImmutableCollection<V> createValues() { - return new ImmutableMapValues<K, V>(this); + return new ImmutableMapValues<>(this); } @Override diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java index 7bdd9e851..faf22b343 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java @@ -71,7 +71,7 @@ final class JdkBackedImmutableMultiset<E> extends ImmutableMultiset<E> { @Override public ImmutableSet<E> elementSet() { ImmutableSet<E> result = elementSet; - return (result == null) ? elementSet = new ElementSet<E>(entries, this) : result; + return (result == null) ? elementSet = new ElementSet<>(entries, this) : result; } @Override diff --git a/guava/src/com/google/common/collect/LinkedHashMultimap.java b/guava/src/com/google/common/collect/LinkedHashMultimap.java index b4d2ab943..8076cf870 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultimap.java +++ b/guava/src/com/google/common/collect/LinkedHashMultimap.java @@ -76,8 +76,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/guava/src/com/google/common/collect/LinkedHashMultiset.java b/guava/src/com/google/common/collect/LinkedHashMultiset.java index 13f70a7c9..5ee2015e9 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultiset.java +++ b/guava/src/com/google/common/collect/LinkedHashMultiset.java @@ -32,8 +32,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * element will appear at the end of the iteration. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Kevin Bourrillion * @author Jared Levy diff --git a/guava/src/com/google/common/collect/LinkedListMultimap.java b/guava/src/com/google/common/collect/LinkedListMultimap.java index a557870d4..a69243469 100644 --- a/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -90,8 +90,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedListMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Mike Bostock * @since 2.0 diff --git a/guava/src/com/google/common/collect/ListMultimap.java b/guava/src/com/google/common/collect/ListMultimap.java index 168606840..29e58077c 100644 --- a/guava/src/com/google/common/collect/ListMultimap.java +++ b/guava/src/com/google/common/collect/ListMultimap.java @@ -34,8 +34,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link #asMap} has {@code List} values. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/Lists.java b/guava/src/com/google/common/collect/Lists.java index 31d6e2a4f..55dc73e37 100644 --- a/guava/src/com/google/common/collect/Lists.java +++ b/guava/src/com/google/common/collect/Lists.java @@ -57,7 +57,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link Sets}, {@link Maps} and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#lists"> {@code Lists}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#lists">{@code Lists}</a>. * * @author Kevin Bourrillion * @author Mike Bostock @@ -76,9 +76,9 @@ public final class Lists { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableList#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code ArrayList} {@linkplain ArrayList#ArrayList() constructor} - * directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code ArrayList} {@linkplain ArrayList#ArrayList() constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> ArrayList<E> newArrayList() { @@ -118,10 +118,9 @@ public final class Lists { * ImmutableList#copyOf(Iterable)} instead. (Or, change {@code elements} to be a {@link * FluentIterable} and call {@code elements.toList()}.) * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Use the {@code ArrayList} {@linkplain ArrayList#ArrayList(Collection) - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. Use + * the {@code ArrayList} {@linkplain ArrayList#ArrayList(Collection) constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> ArrayList<E> newArrayList( @@ -160,11 +159,11 @@ public final class Lists { * Creates an {@code ArrayList} instance backed by an array with the specified initial size; * simply delegates to {@link ArrayList#ArrayList(int)}. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use {@code new }{@link ArrayList#ArrayList(int) ArrayList}{@code <>(int)} - * directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. - * (Unlike here, there is no risk of overload ambiguity, since the {@code ArrayList} constructors - * very wisely did not accept varargs.) + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use {@code new }{@link ArrayList#ArrayList(int) ArrayList}{@code <>(int)} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. (Unlike here, there is no risk + * of overload ambiguity, since the {@code ArrayList} constructors very wisely did not accept + * varargs.) * * @param initialArraySize the exact size of the initial backing array for the returned array list * ({@code ArrayList} documentation calls this value the "capacity") @@ -210,10 +209,9 @@ public final class Lists { * outperform {@code LinkedList} except in certain rare and specific situations. Unless you have * spent a lot of time benchmarking your specific needs, use one of those instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedList} {@linkplain LinkedList#LinkedList() - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedList} {@linkplain LinkedList#LinkedList() constructor} directly, taking + * advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> LinkedList<E> newLinkedList() { @@ -232,10 +230,9 @@ public final class Lists { * outperform {@code LinkedList} except in certain rare and specific situations. Unless you have * spent a lot of time benchmarking your specific needs, use one of those instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Use the {@code LinkedList} {@linkplain LinkedList#LinkedList(Collection) - * constructor} directly, taking advantage of the new <a href="http://goo.gl/iz2Wi">"diamond" - * syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. Use + * the {@code LinkedList} {@linkplain LinkedList#LinkedList(Collection) constructor} directly, + * taking advantage of <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ @GwtCompatible(serializable = true) public static <E extends @Nullable Object> LinkedList<E> newLinkedList( diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java index c892557f3..6265f5dce 100644 --- a/guava/src/com/google/common/collect/Maps.java +++ b/guava/src/com/google/common/collect/Maps.java @@ -79,7 +79,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#maps"> {@code Maps}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#maps">{@code Maps}</a>. * * @author Kevin Bourrillion * @author Mike Bostock @@ -228,9 +228,9 @@ public final class Maps { * * <p><b>Note:</b> if {@code K} is an {@code enum} type, use {@link #newEnumMap} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code HashMap} */ @@ -246,9 +246,9 @@ public final class Maps { * * <p><b>Note:</b> if {@code K} is an {@link Enum} type, use {@link #newEnumMap} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the mappings to be placed in the new map * @return a new {@code HashMap} initialized with the mappings from {@code map} @@ -297,9 +297,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableMap#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code LinkedHashMap} */ @@ -314,9 +314,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableMap#copyOf(Map)} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the mappings to be placed in the new map * @return a new, {@code LinkedHashMap} initialized with the mappings from {@code map} @@ -358,9 +358,9 @@ public final class Maps { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedMap#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code TreeMap} */ @@ -375,9 +375,9 @@ public final class Maps { * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableSortedMap#copyOfSorted(SortedMap)} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the sorted map whose mappings are to be placed in the new map and whose comparator * is to be used to sort the new map @@ -395,9 +395,9 @@ public final class Maps { * <p><b>Note:</b> if mutability is not required, use {@code * ImmutableSortedMap.orderedBy(comparator).build()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param comparator the comparator to sort the keys with * @return a new, empty {@code TreeMap} @@ -426,9 +426,9 @@ public final class Maps { /** * Creates an {@code EnumMap} with the same mappings as the specified map. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code EnumMap} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code EnumMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @param map the map from which to initialize this {@code EnumMap} * @return a new {@code EnumMap} initialized with the mappings from {@code map} @@ -443,9 +443,9 @@ public final class Maps { /** * Creates an {@code IdentityHashMap} instance. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code IdentityHashMap} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code IdentityHashMap} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code IdentityHashMap} */ @@ -575,7 +575,20 @@ public final class Maps { onlyOnRight.putAll(right); // will whittle it down SortedMap<K, V> onBoth = Maps.newTreeMap(comparator); SortedMap<K, MapDifference.ValueDifference<V>> differences = Maps.newTreeMap(comparator); - doDifference(left, right, Equivalence.equals(), onlyOnLeft, onlyOnRight, onBoth, differences); + + /* + * V is a possibly nullable type, but we decided to declare Equivalence with a type parameter + * that is restricted to non-nullable types. Still, this code is safe: We made that decision + * about Equivalence not because Equivalence is null-hostile but because *every* Equivalence can + * handle null inputs -- and thus it would be meaningless for the type system to distinguish + * between "an Equivalence for nullable Foo" and "an Equivalence for non-nullable Foo." + * + * (And the unchecked cast is safe because Equivalence is contravariant.) + */ + @SuppressWarnings({"nullness", "unchecked"}) + Equivalence<V> equalsEquivalence = (Equivalence<V>) Equivalence.equals(); + + doDifference(left, right, equalsEquivalence, onlyOnLeft, onlyOnRight, onBoth, differences); return new SortedMapDifferenceImpl<>(onlyOnLeft, onlyOnRight, onBoth, differences); } @@ -1296,13 +1309,13 @@ public final class Maps { public static <K, V> ImmutableMap<K, V> toMap( Iterator<K> keys, Function<? super K, V> valueFunction) { checkNotNull(valueFunction); - // Using LHM instead of a builder so as not to fail on duplicate keys - Map<K, V> builder = newLinkedHashMap(); + ImmutableMap.Builder<K, V> builder = ImmutableMap.builder(); while (keys.hasNext()) { K key = keys.next(); builder.put(key, valueFunction.apply(key)); } - return ImmutableMap.copyOf(builder); + // Using buildKeepingLast() so as not to fail on duplicate keys + return builder.buildKeepingLast(); } /** @@ -1379,7 +1392,7 @@ public final class Maps { builder.put(keyFunction.apply(value), value); } try { - return builder.build(); + return builder.buildOrThrow(); } catch (IllegalArgumentException duplicateKeys) { throw new IllegalArgumentException( duplicateKeys.getMessage() @@ -1432,7 +1445,7 @@ public final class Maps { builder.put(key, requireNonNull(properties.getProperty(key))); } - return builder.build(); + return builder.buildOrThrow(); } /** @@ -1705,6 +1718,57 @@ public final class Maps { } @Override + public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { + throw new UnsupportedOperationException(); + } + + @Override + @CheckForNull + public V putIfAbsent(K key, V value) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean remove(@Nullable Object key, @Nullable Object value) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean replace(K key, V oldValue, V newValue) { + throw new UnsupportedOperationException(); + } + + @Override + @CheckForNull + public V replace(K key, V value) { + throw new UnsupportedOperationException(); + } + + @Override + public V computeIfAbsent( + K key, java.util.function.Function<? super K, ? extends V> mappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V computeIfPresent( + K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V compute( + K key, BiFunction<? super K, ? super @Nullable V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V merge( + K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override public BiMap<V, K> inverse() { BiMap<V, K> result = inverse; return (result == null) @@ -3558,6 +3622,57 @@ public final class Maps { throw new UnsupportedOperationException(); } + @Override + public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { + throw new UnsupportedOperationException(); + } + + @Override + @CheckForNull + public V putIfAbsent(K key, V value) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean remove(@Nullable Object key, @Nullable Object value) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean replace(K key, V oldValue, V newValue) { + throw new UnsupportedOperationException(); + } + + @Override + @CheckForNull + public V replace(K key, V value) { + throw new UnsupportedOperationException(); + } + + @Override + public V computeIfAbsent( + K key, java.util.function.Function<? super K, ? extends V> mappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V computeIfPresent( + K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V compute( + K key, BiFunction<? super K, ? super @Nullable V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + + @Override + public V merge( + K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) { + throw new UnsupportedOperationException(); + } + @CheckForNull private transient UnmodifiableNavigableMap<K, V> descendingMap; @Override @@ -4476,7 +4591,7 @@ public final class Maps { for (E e : list) { builder.put(e, i++); } - return builder.build(); + return builder.buildOrThrow(); } /** diff --git a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index cd01279f4..181b3fbb5 100644 --- a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -131,7 +131,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { * instead. */ public static <B> Builder<B> orderedBy(Comparator<B> comparator) { - return new Builder<B>(comparator); + return new Builder<>(comparator); } /** @@ -216,7 +216,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { */ public <T extends B> MinMaxPriorityQueue<T> create(Iterable<? extends T> initialContents) { MinMaxPriorityQueue<T> queue = - new MinMaxPriorityQueue<T>( + new MinMaxPriorityQueue<>( this, initialQueueSize(expectedSize, maximumSize, initialContents)); for (T element : initialContents) { queue.offer(element); @@ -436,11 +436,11 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { // Last element is moved to before index, swapped with trickled element. if (changes == null) { // The trickled element is still after index. - return new MoveDesc<E>(actualLastElement, toTrickle); + return new MoveDesc<>(actualLastElement, toTrickle); } else { // The trickled element is back before index, but the replaced element // has now been moved after index. - return new MoveDesc<E>(actualLastElement, changes.replaced); + return new MoveDesc<>(actualLastElement, changes.replaced); } } // Trickled element was after index to begin with, no adjustment needed. @@ -560,7 +560,7 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { } // bubble it up the opposite heap if (otherHeap.bubbleUpAlternatingLevels(crossOver, toTrickle) < removeIndex) { - return new MoveDesc<E>(toTrickle, parent); + return new MoveDesc<>(toTrickle, parent); } else { return null; } @@ -815,8 +815,8 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> { if (moved != null) { // Either both are null or neither is, but we check both to satisfy the nullness checker. if (forgetMeNot == null || skipMe == null) { - forgetMeNot = new ArrayDeque<E>(); - skipMe = new ArrayList<E>(3); + forgetMeNot = new ArrayDeque<>(); + skipMe = new ArrayList<>(3); } if (!foundAndRemovedExactReference(skipMe, moved.toTrickle)) { forgetMeNot.add(moved.toTrickle); diff --git a/guava/src/com/google/common/collect/Multimap.java b/guava/src/com/google/common/collect/Multimap.java index e1a0a8ef6..0f8385191 100644 --- a/guava/src/com/google/common/collect/Multimap.java +++ b/guava/src/com/google/common/collect/Multimap.java @@ -154,8 +154,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link UnsupportedOperationException}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/MultimapBuilder.java b/guava/src/com/google/common/collect/MultimapBuilder.java index dddae2864..3d6278aae 100644 --- a/guava/src/com/google/common/collect/MultimapBuilder.java +++ b/guava/src/com/google/common/collect/MultimapBuilder.java @@ -84,7 +84,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedKeys < 0} */ - public static MultimapBuilderWithKeys<@Nullable Object> hashKeys(final int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable Object> hashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); return new MultimapBuilderWithKeys<@Nullable Object>() { @Override @@ -115,7 +115,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * multimap, save that if all values associated with a key are removed and then the key is added * back into the multimap, that key will come last in the key iteration order. */ - public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys(final int expectedKeys) { + public static MultimapBuilderWithKeys<@Nullable Object> linkedHashKeys(int expectedKeys) { checkNonnegative(expectedKeys, "expectedKeys"); return new MultimapBuilderWithKeys<@Nullable Object>() { @Override @@ -154,7 +154,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * is not serializable. */ public static <K0 extends @Nullable Object> MultimapBuilderWithKeys<K0> treeKeys( - final Comparator<K0> comparator) { + Comparator<K0> comparator) { checkNotNull(comparator); return new MultimapBuilderWithKeys<K0>() { @Override @@ -169,8 +169,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @since 16.0 */ - public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys( - final Class<K0> keyClass) { + public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys(Class<K0> keyClass) { checkNotNull(keyClass); return new MultimapBuilderWithKeys<K0>() { @SuppressWarnings("unchecked") @@ -193,7 +192,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N @Override public List<V> get() { - return new ArrayList<V>(expectedValuesPerKey); + return new ArrayList<>(expectedValuesPerKey); } } @@ -251,7 +250,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N @Override public SortedSet<V> get() { - return new TreeSet<V>(comparator); + return new TreeSet<>(comparator); } } @@ -295,8 +294,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public ListMultimapBuilder<K0, @Nullable Object> arrayListValues( - final int expectedValuesPerKey) { + public ListMultimapBuilder<K0, @Nullable Object> arrayListValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new ListMultimapBuilder<K0, @Nullable Object>() { @Override @@ -330,7 +328,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public SetMultimapBuilder<K0, @Nullable Object> hashSetValues(final int expectedValuesPerKey) { + public SetMultimapBuilder<K0, @Nullable Object> hashSetValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new SetMultimapBuilder<K0, @Nullable Object>() { @Override @@ -353,8 +351,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * * @throws IllegalArgumentException if {@code expectedValuesPerKey < 0} */ - public SetMultimapBuilder<K0, @Nullable Object> linkedHashSetValues( - final int expectedValuesPerKey) { + public SetMultimapBuilder<K0, @Nullable Object> linkedHashSetValues(int expectedValuesPerKey) { checkNonnegative(expectedValuesPerKey, "expectedValuesPerKey"); return new SetMultimapBuilder<K0, @Nullable Object>() { @Override @@ -379,7 +376,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N * comparator} is not serializable. */ public <V0 extends @Nullable Object> SortedSetMultimapBuilder<K0, V0> treeSetValues( - final Comparator<V0> comparator) { + Comparator<V0> comparator) { checkNotNull(comparator, "comparator"); return new SortedSetMultimapBuilder<K0, V0>() { @Override @@ -391,8 +388,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N } /** Uses an {@link EnumSet} to store value collections. */ - public <V0 extends Enum<V0>> SetMultimapBuilder<K0, V0> enumSetValues( - final Class<V0> valueClass) { + public <V0 extends Enum<V0>> SetMultimapBuilder<K0, V0> enumSetValues(Class<V0> valueClass) { checkNotNull(valueClass, "valueClass"); return new SetMultimapBuilder<K0, V0>() { @Override diff --git a/guava/src/com/google/common/collect/Multimaps.java b/guava/src/com/google/common/collect/Multimaps.java index 9bc9e98f5..22e457ca4 100644 --- a/guava/src/com/google/common/collect/Multimaps.java +++ b/guava/src/com/google/common/collect/Multimaps.java @@ -63,7 +63,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static methods acting on or generating a {@code Multimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multimaps"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multimaps">{@code * Multimaps}</a>. * * @author Jared Levy diff --git a/guava/src/com/google/common/collect/Multiset.java b/guava/src/com/google/common/collect/Multiset.java index e7c7d62c1..ca56a7453 100644 --- a/guava/src/com/google/common/collect/Multiset.java +++ b/guava/src/com/google/common/collect/Multiset.java @@ -80,8 +80,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@code Multiset}, {@code AtomicLongMap} does not automatically remove zeros. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Kevin Bourrillion * @since 2.0 diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java index e3203d237..71fe61434 100644 --- a/guava/src/com/google/common/collect/Multisets.java +++ b/guava/src/com/google/common/collect/Multisets.java @@ -51,7 +51,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static utility methods for creating and working with {@link Multiset} instances. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multisets"> {@code + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#multisets">{@code * Multisets}</a>. * * @author Kevin Bourrillion diff --git a/guava/src/com/google/common/collect/NullnessCasts.java b/guava/src/com/google/common/collect/NullnessCasts.java index 6ceeda75f..4f894dbd3 100644 --- a/guava/src/com/google/common/collect/NullnessCasts.java +++ b/guava/src/com/google/common/collect/NullnessCasts.java @@ -57,7 +57,7 @@ final class NullnessCasts { } /** Returns {@code null} as any type, even one that does not include {@code null}. */ - @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals"}) + @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"}) // The warnings are legitimate. Each time we use this method, we document why. @ParametricNullness static <T extends @Nullable Object> T unsafeNull() { diff --git a/guava/src/com/google/common/collect/ParametricNullness.java b/guava/src/com/google/common/collect/ParametricNullness.java index b1cda482c..94b1bcd3a 100644 --- a/guava/src/com/google/common/collect/ParametricNullness.java +++ b/guava/src/com/google/common/collect/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/collect/PeekingIterator.java b/guava/src/com/google/common/collect/PeekingIterator.java index a274fe454..8524ed751 100644 --- a/guava/src/com/google/common/collect/PeekingIterator.java +++ b/guava/src/com/google/common/collect/PeekingIterator.java @@ -27,7 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * An iterator that supports a one-element lookahead while iterating. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionHelpersExplained#peekingiterator"> {@code + * "https://github.com/google/guava/wiki/CollectionHelpersExplained#peekingiterator">{@code * PeekingIterator}</a>. * * @author Mick Killianey diff --git a/guava/src/com/google/common/collect/Range.java b/guava/src/com/google/common/collect/Range.java index ab5c07793..2a5d464dc 100644 --- a/guava/src/com/google/common/collect/Range.java +++ b/guava/src/com/google/common/collect/Range.java @@ -16,6 +16,7 @@ package com.google.common.collect; +import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.GwtCompatible; @@ -154,7 +155,7 @@ public final class Range<C extends Comparable> extends RangeGwtSerializationDepe } static <C extends Comparable<?>> Range<C> create(Cut<C> lowerBound, Cut<C> upperBound) { - return new Range<C>(lowerBound, upperBound); + return new Range<>(lowerBound, upperBound); } /** @@ -556,6 +557,15 @@ public final class Range<C extends Comparable> extends RangeGwtSerializationDepe } else { Cut<C> newLower = (lowerCmp >= 0) ? lowerBound : connectedRange.lowerBound; Cut<C> newUpper = (upperCmp <= 0) ? upperBound : connectedRange.upperBound; + + // create() would catch this, but give a confusing error message + checkArgument( + newLower.compareTo(newUpper) <= 0, + "intersection is undefined for disconnected ranges %s and %s", + this, + connectedRange); + + // TODO(kevinb): all the precondition checks in the constructor are redundant... return create(newLower, newUpper); } } diff --git a/guava/src/com/google/common/collect/RangeSet.java b/guava/src/com/google/common/collect/RangeSet.java index 1fb7b10fc..79fbab159 100644 --- a/guava/src/com/google/common/collect/RangeSet.java +++ b/guava/src/com/google/common/collect/RangeSet.java @@ -43,7 +43,7 @@ import javax.annotation.CheckForNull; * <p>For a {@link Set} whose contents are specified by a {@link Range}, see {@link ContiguousSet}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#rangeset"> RangeSets</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#rangeset">RangeSets</a>. * * @author Kevin Bourrillion * @author Louis Wasserman diff --git a/guava/src/com/google/common/collect/RegularContiguousSet.java b/guava/src/com/google/common/collect/RegularContiguousSet.java index 913e2d7d3..787606eb1 100644 --- a/guava/src/com/google/common/collect/RegularContiguousSet.java +++ b/guava/src/com/google/common/collect/RegularContiguousSet.java @@ -58,7 +58,7 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> C fromElement, boolean fromInclusive, C toElement, boolean toInclusive) { if (fromElement.compareTo(toElement) == 0 && !fromInclusive && !toInclusive) { // Range would reject our attempt to create (x, x). - return new EmptyContiguousSet<C>(domain); + return new EmptyContiguousSet<>(domain); } return intersectionInCurrentDomain( Range.range( @@ -231,14 +231,14 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C> } private Object readResolve() { - return new RegularContiguousSet<C>(range, domain); + return new RegularContiguousSet<>(range, domain); } } @GwtIncompatible // serialization @Override Object writeReplace() { - return new SerializedForm<C>(range, domain); + return new SerializedForm<>(range, domain); } private static final long serialVersionUID = 0; diff --git a/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/guava/src/com/google/common/collect/RegularImmutableBiMap.java index 60d22e2b8..b8bca9580 100644 --- a/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -20,13 +20,14 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkPositionIndex; import static com.google.common.collect.CollectPreconditions.checkEntryNotNull; import static com.google.common.collect.ImmutableMapEntry.createEntryArray; +import static com.google.common.collect.RegularImmutableMap.MAX_HASH_BUCKET_LENGTH; import static com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket; import static java.util.Objects.requireNonNull; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMapEntry.NonTerminalImmutableBiMapEntry; -import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.common.collect.RegularImmutableMap.BucketOverflowException; import com.google.errorprone.annotations.concurrent.LazyInit; import com.google.j2objc.annotations.RetainedWith; import java.io.Serializable; @@ -88,11 +89,11 @@ class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> { int valueBucket = Hashing.smear(valueHash) & mask; ImmutableMapEntry<K, V> nextInKeyBucket = keyTable[keyBucket]; - int keyBucketLength = checkNoConflictInKeyBucket(key, entry, nextInKeyBucket); ImmutableMapEntry<K, V> nextInValueBucket = valueTable[valueBucket]; - int valueBucketLength = checkNoConflictInValueBucket(value, entry, nextInValueBucket); - if (keyBucketLength > RegularImmutableMap.MAX_HASH_BUCKET_LENGTH - || valueBucketLength > RegularImmutableMap.MAX_HASH_BUCKET_LENGTH) { + try { + checkNoConflictInKeyBucket(key, value, nextInKeyBucket, /* throwIfDuplicateKeys= */ true); + checkNoConflictInValueBucket(value, entry, nextInValueBucket); + } catch (BucketOverflowException e) { return JdkBackedImmutableBiMap.create(n, entryArray); } ImmutableMapEntry<K, V> newEntry = @@ -124,18 +125,20 @@ class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> { // checkNoConflictInKeyBucket is static imported from RegularImmutableMap /** - * @return number of entries in this bucket * @throws IllegalArgumentException if another entry in the bucket has the same key + * @throws BucketOverflowException if this bucket has too many entries, which may indicate a hash + * flooding attack */ - @CanIgnoreReturnValue - private static int checkNoConflictInValueBucket( - Object value, Entry<?, ?> entry, @CheckForNull ImmutableMapEntry<?, ?> valueBucketHead) { + private static void checkNoConflictInValueBucket( + Object value, Entry<?, ?> entry, @CheckForNull ImmutableMapEntry<?, ?> valueBucketHead) + throws BucketOverflowException { int bucketSize = 0; for (; valueBucketHead != null; valueBucketHead = valueBucketHead.getNextInValueBucket()) { checkNoConflict(!value.equals(valueBucketHead.getValue()), "value", entry, valueBucketHead); - bucketSize++; + if (++bucketSize > MAX_HASH_BUCKET_LENGTH) { + throw new BucketOverflowException(); + } } - return bucketSize; } @Override diff --git a/guava/src/com/google/common/collect/RegularImmutableMap.java b/guava/src/com/google/common/collect/RegularImmutableMap.java index 43425b2ec..f0f2031b9 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -28,6 +28,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableMapEntry.NonTerminalImmutableMapEntry; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.io.Serializable; +import java.util.IdentityHashMap; import java.util.function.BiConsumer; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; @@ -73,7 +74,7 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { private final transient int mask; static <K, V> ImmutableMap<K, V> fromEntries(Entry<K, V>... entries) { - return fromEntryArray(entries.length, entries); + return fromEntryArray(entries.length, entries, /* throwIfDuplicateKeys= */ true); } /** @@ -81,11 +82,26 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { * the entries in entryArray with its own entry objects (though they will have the same key/value * contents), and may take ownership of entryArray. */ - static <K, V> ImmutableMap<K, V> fromEntryArray(int n, @Nullable Entry<K, V>[] entryArray) { + static <K, V> ImmutableMap<K, V> fromEntryArray( + int n, @Nullable Entry<K, V>[] entryArray, boolean throwIfDuplicateKeys) { checkPositionIndex(n, entryArray.length); if (n == 0) { - return (RegularImmutableMap<K, V>) EMPTY; + @SuppressWarnings("unchecked") // it has no entries so the type variables don't matter + ImmutableMap<K, V> empty = (ImmutableMap<K, V>) EMPTY; + return empty; } + try { + return fromEntryArrayCheckingBucketOverflow(n, entryArray, throwIfDuplicateKeys); + } catch (BucketOverflowException e) { + // probable hash flooding attack, fall back to j.u.HM based implementation and use its + // implementation of hash flooding protection + return JdkBackedImmutableMap.create(n, entryArray, throwIfDuplicateKeys); + } + } + + private static <K, V> ImmutableMap<K, V> fromEntryArrayCheckingBucketOverflow( + int n, @Nullable Entry<K, V>[] entryArray, boolean throwIfDuplicateKeys) + throws BucketOverflowException { /* * The cast is safe: n==entryArray.length means that we have filled the whole array with Entry * instances, in which case it is safe to cast it from an array of nullable entries to an array @@ -97,31 +113,90 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { int tableSize = Hashing.closedTableSize(n, MAX_LOAD_FACTOR); @Nullable ImmutableMapEntry<K, V>[] table = createEntryArray(tableSize); int mask = tableSize - 1; - for (int entryIndex = 0; entryIndex < n; entryIndex++) { + // If duplicates are allowed, this IdentityHashMap will record the final Entry for each + // duplicated key. We will use this final Entry to overwrite earlier slots in the entries array + // that have the same key. Then a second pass will remove all but the first of the slots that + // have this Entry. The value in the map becomes false when this first entry has been copied, so + // we know not to copy the remaining ones. + IdentityHashMap<Entry<K, V>, Boolean> duplicates = null; + int dupCount = 0; + for (int entryIndex = n - 1; entryIndex >= 0; entryIndex--) { // requireNonNull is safe because the first `n` elements have been filled in. Entry<K, V> entry = requireNonNull(entryArray[entryIndex]); K key = entry.getKey(); V value = entry.getValue(); checkEntryNotNull(key, value); int tableIndex = Hashing.smear(key.hashCode()) & mask; - ImmutableMapEntry<K, V> existing = table[tableIndex]; - // prepend, not append, so the entries can be immutable - ImmutableMapEntry<K, V> newEntry = - (existing == null) - ? makeImmutable(entry, key, value) - : new NonTerminalImmutableMapEntry<K, V>(key, value, existing); - table[tableIndex] = newEntry; - entries[entryIndex] = newEntry; - int bucketSize = checkNoConflictInKeyBucket(key, newEntry, existing); - if (bucketSize > MAX_HASH_BUCKET_LENGTH) { - // probable hash flooding attack, fall back to j.u.HM based implementation and use its - // implementation of hash flooding protection - return JdkBackedImmutableMap.create(n, entryArray); + ImmutableMapEntry<K, V> keyBucketHead = table[tableIndex]; + ImmutableMapEntry<K, V> effectiveEntry = + checkNoConflictInKeyBucket(key, value, keyBucketHead, throwIfDuplicateKeys); + if (effectiveEntry == null) { + // prepend, not append, so the entries can be immutable + effectiveEntry = + (keyBucketHead == null) + ? makeImmutable(entry, key, value) + : new NonTerminalImmutableMapEntry<K, V>(key, value, keyBucketHead); + table[tableIndex] = effectiveEntry; + } else { + // We already saw this key, and the first value we saw (going backwards) is the one we are + // keeping. So we won't touch table[], but we do still want to add the existing entry that + // we found to entries[] so that we will see this key in the right place when iterating. + if (duplicates == null) { + duplicates = new IdentityHashMap<>(); + } + duplicates.put(effectiveEntry, true); + dupCount++; + // Make sure we are not overwriting the original entries array, in case we later do + // buildOrThrow(). We would want an exception to include two values for the duplicate key. + if (entries == entryArray) { + entries = entries.clone(); + } + } + entries[entryIndex] = effectiveEntry; + } + if (duplicates != null) { + // Explicit type parameters needed here to avoid a problem with nullness inference. + entries = RegularImmutableMap.<K, V>removeDuplicates(entries, n, n - dupCount, duplicates); + int newTableSize = Hashing.closedTableSize(entries.length, MAX_LOAD_FACTOR); + if (newTableSize != tableSize) { + return fromEntryArrayCheckingBucketOverflow( + entries.length, entries, /* throwIfDuplicateKeys= */ true); } } return new RegularImmutableMap<>(entries, table, mask); } + /** + * Constructs a new entry array where each duplicated key from the original appears only once, at + * its first position but with its final value. The {@code duplicates} map is modified. + * + * @param entries the original array of entries including duplicates + * @param n the number of valid entries in {@code entries} + * @param newN the expected number of entries once duplicates are removed + * @param duplicates a map of canonical {@link Entry} objects for each duplicate key. This map + * will be updated by the method, setting each value to false as soon as the {@link Entry} has + * been included in the new entry array. + * @return an array of {@code newN} entries where no key appears more than once. + */ + static <K, V> Entry<K, V>[] removeDuplicates( + Entry<K, V>[] entries, int n, int newN, IdentityHashMap<Entry<K, V>, Boolean> duplicates) { + Entry<K, V>[] newEntries = createEntryArray(newN); + for (int in = 0, out = 0; in < n; in++) { + Entry<K, V> entry = entries[in]; + Boolean status = duplicates.get(entry); + // null=>not dup'd; true=>dup'd, first; false=>dup'd, not first + if (status != null) { + if (status) { + duplicates.put(entry, false); + } else { + continue; // delete this entry; we already copied an earlier one for the same key + } + } + newEntries[out++] = entry; + } + return newEntries; + } + /** Makes an entry usable internally by a new ImmutableMap without rereading its contents. */ static <K, V> ImmutableMapEntry<K, V> makeImmutable(Entry<K, V> entry, K key, V value) { boolean reusable = @@ -142,20 +217,41 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> { } /** - * @return number of entries in this bucket - * @throws IllegalArgumentException if another entry in the bucket has the same key + * Checks if the given key already appears in the hash chain starting at {@code keyBucketHead}. If + * it does not, then null is returned. If it does, then if {@code throwIfDuplicateKeys} is true an + * {@code IllegalArgumentException} is thrown, and otherwise the existing {@link Entry} is + * returned. + * + * @throws IllegalArgumentException if another entry in the bucket has the same key and {@code + * throwIfDuplicateKeys} is true + * @throws BucketOverflowException if this bucket has too many entries, which may indicate a hash + * flooding attack */ @CanIgnoreReturnValue - static int checkNoConflictInKeyBucket( - Object key, Entry<?, ?> entry, @CheckForNull ImmutableMapEntry<?, ?> keyBucketHead) { + static <K, V> @Nullable ImmutableMapEntry<K, V> checkNoConflictInKeyBucket( + Object key, + Object newValue, + @CheckForNull ImmutableMapEntry<K, V> keyBucketHead, + boolean throwIfDuplicateKeys) + throws BucketOverflowException { int bucketSize = 0; for (; keyBucketHead != null; keyBucketHead = keyBucketHead.getNextInKeyBucket()) { - checkNoConflict(!key.equals(keyBucketHead.getKey()), "key", entry, keyBucketHead); - bucketSize++; + if (keyBucketHead.getKey().equals(key)) { + if (throwIfDuplicateKeys) { + checkNoConflict(/* safe= */ false, "key", keyBucketHead, key + "=" + newValue); + } else { + return keyBucketHead; + } + } + if (++bucketSize > MAX_HASH_BUCKET_LENGTH) { + throw new BucketOverflowException(); + } } - return bucketSize; + return null; } + static class BucketOverflowException extends Exception {} + @Override @CheckForNull public V get(@CheckForNull Object key) { diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java index fcb683f56..572e0acbf 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java @@ -29,6 +29,7 @@ import java.util.Set; import java.util.Spliterator; import java.util.function.Consumer; import javax.annotation.CheckForNull; +import org.checkerframework.checker.nullness.qual.Nullable; /** * An immutable sorted set with one or more elements. TODO(jlevy): Consider separate class for a @@ -164,7 +165,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> { } @Override - int copyIntoArray(Object[] dst, int offset) { + int copyIntoArray(@Nullable Object[] dst, int offset) { return elements.copyIntoArray(dst, offset); } diff --git a/guava/src/com/google/common/collect/RegularImmutableTable.java b/guava/src/com/google/common/collect/RegularImmutableTable.java index 24434c5a1..337f123b6 100644 --- a/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -98,8 +98,8 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> { static <R, C, V> RegularImmutableTable<R, C, V> forCells( List<Cell<R, C, V>> cells, - @CheckForNull final Comparator<? super R> rowComparator, - @CheckForNull final Comparator<? super C> columnComparator) { + @CheckForNull Comparator<? super R> rowComparator, + @CheckForNull Comparator<? super C> columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* @@ -110,20 +110,17 @@ abstract class RegularImmutableTable<R, C, V> extends ImmutableTable<R, C, V> { * column, the rows in the second column, etc. */ Comparator<Cell<R, C, V>> comparator = - new Comparator<Cell<R, C, V>>() { - @Override - public int compare(Cell<R, C, V> cell1, Cell<R, C, V> cell2) { - int rowCompare = - (rowComparator == null) - ? 0 - : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); - if (rowCompare != 0) { - return rowCompare; - } - return (columnComparator == null) - ? 0 - : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); + (Cell<R, C, V> cell1, Cell<R, C, V> cell2) -> { + int rowCompare = + (rowComparator == null) + ? 0 + : rowComparator.compare(cell1.getRowKey(), cell2.getRowKey()); + if (rowCompare != 0) { + return rowCompare; } + return (columnComparator == null) + ? 0 + : columnComparator.compare(cell1.getColumnKey(), cell2.getColumnKey()); }; Collections.sort(cells, comparator); } diff --git a/guava/src/com/google/common/collect/Serialization.java b/guava/src/com/google/common/collect/Serialization.java index 5e8806764..4ab53f2d7 100644 --- a/guava/src/com/google/common/collect/Serialization.java +++ b/guava/src/com/google/common/collect/Serialization.java @@ -187,10 +187,10 @@ final class Serialization { } // Secret sauce for setting final fields; don't make it public. - static <T> FieldSetter<T> getFieldSetter(final Class<T> clazz, String fieldName) { + static <T> FieldSetter<T> getFieldSetter(Class<T> clazz, String fieldName) { try { Field field = clazz.getDeclaredField(fieldName); - return new FieldSetter<T>(field); + return new FieldSetter<>(field); } catch (NoSuchFieldException e) { throw new AssertionError(e); // programmer error } diff --git a/guava/src/com/google/common/collect/SetMultimap.java b/guava/src/com/google/common/collect/SetMultimap.java index 216533ea2..b7a54570a 100644 --- a/guava/src/com/google/common/collect/SetMultimap.java +++ b/guava/src/com/google/common/collect/SetMultimap.java @@ -46,8 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * that affects its {@link Object#equals} behavior. Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java index 5338bd244..c8cdc38ca 100644 --- a/guava/src/com/google/common/collect/Sets.java +++ b/guava/src/com/google/common/collect/Sets.java @@ -60,7 +60,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * {@link Lists}, {@link Maps} and {@link Queues}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#sets"> {@code Sets}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#sets">{@code Sets}</a>. * * @author Kevin Bourrillion * @author Jared Levy @@ -173,9 +173,9 @@ public final class Sets { * using a {@code LinkedHashSet} instead, at the cost of increased memory footprint, to get * deterministic iteration behavior. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code HashSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code HashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. */ public static <E extends @Nullable Object> HashSet<E> newHashSet() { return new HashSet<E>(); @@ -212,9 +212,9 @@ public final class Sets { * <p><b>Note:</b> if {@code E} is an {@link Enum} type, use {@link #newEnumSet(Iterable, Class)} * instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Instead, use the {@code HashSet} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. + * Instead, use the {@code HashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>Overall, this method is not very useful and will likely be deprecated in the future. */ @@ -299,9 +299,9 @@ public final class Sets { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSet#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of - * the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code LinkedHashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code LinkedHashSet} */ @@ -315,9 +315,9 @@ public final class Sets { * <p><b>Note:</b> if mutability is not required and the elements are non-null, use {@link * ImmutableSet#copyOf(Iterable)} instead. * - * <p><b>Note for Java 7 and later:</b> if {@code elements} is a {@link Collection}, you don't - * need this method. Instead, use the {@code LinkedHashSet} constructor directly, taking advantage - * of the new <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> if {@code elements} is a {@link Collection}, you don't need this method. + * Instead, use the {@code LinkedHashSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>Overall, this method is not very useful and will likely be deprecated in the future. * @@ -359,9 +359,9 @@ public final class Sets { * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedSet#of()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * @return a new, empty {@code TreeSet} */ @@ -380,9 +380,9 @@ public final class Sets { * method has different behavior than {@link TreeSet#TreeSet(SortedSet)}, which returns a {@code * TreeSet} with that comparator. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>This method is just a small convenience for creating an empty set and then calling {@link * Iterables#addAll}. This method is not very useful and will likely be deprecated in the future. @@ -402,11 +402,11 @@ public final class Sets { * <p><b>Note:</b> if mutability is not required, use {@code * ImmutableSortedSet.orderedBy(comparator).build()} instead. * - * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as - * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new - * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. One caveat to this is that the {@code - * TreeSet} constructor uses a null {@code Comparator} to mean "natural ordering," whereas this - * factory rejects null. Clean your code accordingly. + * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated. Instead, + * use the {@code TreeSet} constructor directly, taking advantage of <a + * href="http://goo.gl/iz2Wi">"diamond" syntax</a>. One caveat to this is that the {@code TreeSet} + * constructor uses a null {@code Comparator} to mean "natural ordering," whereas this factory + * rejects null. Clean your code accordingly. * * @param comparator the comparator to use to sort the set * @return a new, empty {@code TreeSet} diff --git a/guava/src/com/google/common/collect/SortedMultiset.java b/guava/src/com/google/common/collect/SortedMultiset.java index 68932f585..7cc512d8e 100644 --- a/guava/src/com/google/common/collect/SortedMultiset.java +++ b/guava/src/com/google/common/collect/SortedMultiset.java @@ -37,8 +37,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Collection} contract, which is specified in terms of {@link Object#equals}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Louis Wasserman * @since 11.0 diff --git a/guava/src/com/google/common/collect/SortedMultisets.java b/guava/src/com/google/common/collect/SortedMultisets.java index 1d1940c9a..f602a42a1 100644 --- a/guava/src/com/google/common/collect/SortedMultisets.java +++ b/guava/src/com/google/common/collect/SortedMultisets.java @@ -128,7 +128,7 @@ final class SortedMultisets { @Override public NavigableSet<E> descendingSet() { - return new NavigableElementSet<E>(multiset().descendingMultiset()); + return new NavigableElementSet<>(multiset().descendingMultiset()); } @Override @@ -154,7 +154,7 @@ final class SortedMultisets { boolean fromInclusive, @ParametricNullness E toElement, boolean toInclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset() .subMultiset( fromElement, BoundType.forBoolean(fromInclusive), @@ -163,13 +163,13 @@ final class SortedMultisets { @Override public NavigableSet<E> headSet(@ParametricNullness E toElement, boolean inclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset().headMultiset(toElement, BoundType.forBoolean(inclusive))); } @Override public NavigableSet<E> tailSet(@ParametricNullness E fromElement, boolean inclusive) { - return new NavigableElementSet<E>( + return new NavigableElementSet<>( multiset().tailMultiset(fromElement, BoundType.forBoolean(inclusive))); } } diff --git a/guava/src/com/google/common/collect/SortedSetMultimap.java b/guava/src/com/google/common/collect/SortedSetMultimap.java index 844901467..8454aeccb 100644 --- a/guava/src/com/google/common/collect/SortedSetMultimap.java +++ b/guava/src/com/google/common/collect/SortedSetMultimap.java @@ -43,8 +43,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * position in the order of the values). Undefined behavior and bugs will result. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @since 2.0 diff --git a/guava/src/com/google/common/collect/SparseImmutableTable.java b/guava/src/com/google/common/collect/SparseImmutableTable.java index b314f7bb3..44881fde7 100644 --- a/guava/src/com/google/common/collect/SparseImmutableTable.java +++ b/guava/src/com/google/common/collect/SparseImmutableTable.java @@ -82,14 +82,14 @@ final class SparseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V> for (Entry<R, Map<C, V>> row : rows.entrySet()) { rowBuilder.put(row.getKey(), ImmutableMap.copyOf(row.getValue())); } - this.rowMap = rowBuilder.build(); + this.rowMap = rowBuilder.buildOrThrow(); ImmutableMap.Builder<C, ImmutableMap<R, V>> columnBuilder = new ImmutableMap.Builder<>(columns.size()); for (Entry<C, Map<R, V>> col : columns.entrySet()) { columnBuilder.put(col.getKey(), ImmutableMap.copyOf(col.getValue())); } - this.columnMap = columnBuilder.build(); + this.columnMap = columnBuilder.buildOrThrow(); } @Override diff --git a/guava/src/com/google/common/collect/Streams.java b/guava/src/com/google/common/collect/Streams.java index 3bf838202..cd7a07c34 100644 --- a/guava/src/com/google/common/collect/Streams.java +++ b/guava/src/com/google/common/collect/Streams.java @@ -18,13 +18,13 @@ package com.google.common.collect; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT; +import static java.lang.Math.min; import static java.util.Objects.requireNonNull; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.math.LongMath; import com.google.errorprone.annotations.InlineMe; -import com.google.errorprone.annotations.InlineMeValidationDisabled; import java.util.ArrayDeque; import java.util.Collection; import java.util.Deque; @@ -107,7 +107,7 @@ public final class Streams { */ @Beta @InlineMe(replacement = "optional.stream()") - @InlineMeValidationDisabled("Java 9+ API only") + @com.google.errorprone.annotations.InlineMeValidationDisabled("Java 9+ API only") public static <T> Stream<T> stream(java.util.Optional<T> optional) { return optional.isPresent() ? Stream.of(optional.get()) : Stream.empty(); } @@ -120,7 +120,7 @@ public final class Streams { */ @Beta @InlineMe(replacement = "optional.stream()") - @InlineMeValidationDisabled("Java 9+ API only") + @com.google.errorprone.annotations.InlineMeValidationDisabled("Java 9+ API only") public static IntStream stream(OptionalInt optional) { return optional.isPresent() ? IntStream.of(optional.getAsInt()) : IntStream.empty(); } @@ -133,7 +133,7 @@ public final class Streams { */ @Beta @InlineMe(replacement = "optional.stream()") - @InlineMeValidationDisabled("Java 9+ API only") + @com.google.errorprone.annotations.InlineMeValidationDisabled("Java 9+ API only") public static LongStream stream(OptionalLong optional) { return optional.isPresent() ? LongStream.of(optional.getAsLong()) : LongStream.empty(); } @@ -146,7 +146,7 @@ public final class Streams { */ @Beta @InlineMe(replacement = "optional.stream()") - @InlineMeValidationDisabled("Java 9+ API only") + @com.google.errorprone.annotations.InlineMeValidationDisabled("Java 9+ API only") public static DoubleStream stream(OptionalDouble optional) { return optional.isPresent() ? DoubleStream.of(optional.getAsDouble()) : DoubleStream.empty(); } @@ -331,7 +331,7 @@ public final class Streams { Iterator<B> itrB = Spliterators.iterator(splitrB); return StreamSupport.stream( new AbstractSpliterator<R>( - Math.min(splitrA.estimateSize(), splitrB.estimateSize()), characteristics) { + min(splitrA.estimateSize(), splitrB.estimateSize()), characteristics) { @Override public boolean tryAdvance(Consumer<? super R> action) { if (itrA.hasNext() && itrB.hasNext()) { @@ -410,10 +410,10 @@ public final class Streams { * <pre>{@code * mapWithIndex( * Stream.of("a", "b", "c"), - * (str, index) -> str + ":" + index) + * (e, index) -> index + ":" + e) * }</pre> * - * <p>would return {@code Stream.of("a:0", "b:1", "c:2")}. + * <p>would return {@code Stream.of("0:a", "1:b", "2:c")}. * * <p>The resulting stream is <a * href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a> @@ -425,7 +425,6 @@ public final class Streams { * <p>The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - @Beta public static <T extends @Nullable Object, R extends @Nullable Object> Stream<R> mapWithIndex( Stream<T> stream, FunctionWithIndex<? super T, ? extends R> function) { checkNotNull(stream); @@ -493,11 +492,11 @@ public final class Streams { * * <pre>{@code * mapWithIndex( - * IntStream.of(0, 1, 2), - * (i, index) -> i + ":" + index) + * IntStream.of(10, 11, 12), + * (e, index) -> index + ":" + e) * }</pre> * - * <p>...would return {@code Stream.of("0:0", "1:1", "2:2")}. + * <p>...would return {@code Stream.of("0:10", "1:11", "2:12")}. * * <p>The resulting stream is <a * href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a> @@ -509,7 +508,6 @@ public final class Streams { * <p>The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - @Beta public static <R extends @Nullable Object> Stream<R> mapWithIndex( IntStream stream, IntFunctionWithIndex<R> function) { checkNotNull(stream); @@ -573,11 +571,11 @@ public final class Streams { * * <pre>{@code * mapWithIndex( - * LongStream.of(0, 1, 2), - * (i, index) -> i + ":" + index) + * LongStream.of(10, 11, 12), + * (e, index) -> index + ":" + e) * }</pre> * - * <p>...would return {@code Stream.of("0:0", "1:1", "2:2")}. + * <p>...would return {@code Stream.of("0:10", "1:11", "2:12")}. * * <p>The resulting stream is <a * href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a> @@ -589,7 +587,6 @@ public final class Streams { * <p>The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - @Beta public static <R extends @Nullable Object> Stream<R> mapWithIndex( LongStream stream, LongFunctionWithIndex<R> function) { checkNotNull(stream); @@ -653,11 +650,11 @@ public final class Streams { * * <pre>{@code * mapWithIndex( - * DoubleStream.of(0, 1, 2), - * (x, index) -> x + ":" + index) + * DoubleStream.of(0.0, 1.0, 2.0) + * (e, index) -> index + ":" + e) * }</pre> * - * <p>...would return {@code Stream.of("0.0:0", "1.0:1", "2.0:2")}. + * <p>...would return {@code Stream.of("0:0.0", "1:1.0", "2:2.0")}. * * <p>The resulting stream is <a * href="http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html">efficiently splittable</a> @@ -669,7 +666,6 @@ public final class Streams { * <p>The order of the resulting stream is defined if and only if the order of the original stream * was defined. */ - @Beta public static <R extends @Nullable Object> Stream<R> mapWithIndex( DoubleStream stream, DoubleFunctionWithIndex<R> function) { checkNotNull(stream); @@ -735,7 +731,6 @@ public final class Streams { * * @since 21.0 */ - @Beta public interface FunctionWithIndex<T extends @Nullable Object, R extends @Nullable Object> { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness @@ -791,7 +786,6 @@ public final class Streams { * * @since 21.0 */ - @Beta public interface IntFunctionWithIndex<R extends @Nullable Object> { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness @@ -806,7 +800,6 @@ public final class Streams { * * @since 21.0 */ - @Beta public interface LongFunctionWithIndex<R extends @Nullable Object> { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness @@ -821,7 +814,6 @@ public final class Streams { * * @since 21.0 */ - @Beta public interface DoubleFunctionWithIndex<R extends @Nullable Object> { /** Applies this function to the given argument and its index within a stream. */ @ParametricNullness @@ -853,7 +845,6 @@ public final class Streams { * split has a last element of null, so throw NPE" from "the final split was empty, so look for an * element in the prior one.") */ - @Beta public static <T> java.util.Optional<T> findLast(Stream<T> stream) { class OptionalState { boolean set = false; @@ -932,7 +923,6 @@ public final class Streams { * @see IntStream#findFirst() * @throws NullPointerException if the last element of the stream is null */ - @Beta public static OptionalInt findLast(IntStream stream) { // findLast(Stream) does some allocation, so we might as well box some more java.util.Optional<Integer> boxedLast = findLast(stream.boxed()); @@ -951,7 +941,6 @@ public final class Streams { * @see LongStream#findFirst() * @throws NullPointerException if the last element of the stream is null */ - @Beta public static OptionalLong findLast(LongStream stream) { // findLast(Stream) does some allocation, so we might as well box some more java.util.Optional<Long> boxedLast = findLast(stream.boxed()); @@ -970,7 +959,6 @@ public final class Streams { * @see DoubleStream#findFirst() * @throws NullPointerException if the last element of the stream is null */ - @Beta public static OptionalDouble findLast(DoubleStream stream) { // findLast(Stream) does some allocation, so we might as well box some more java.util.Optional<Double> boxedLast = findLast(stream.boxed()); diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java index 25e28709d..29fe61a89 100644 --- a/guava/src/com/google/common/collect/Synchronized.java +++ b/guava/src/com/google/common/collect/Synchronized.java @@ -1195,7 +1195,8 @@ final class Synchronized { } @Override - public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { + public V compute( + K key, BiFunction<? super K, ? super @Nullable V, ? extends V> remappingFunction) { synchronized (mutex) { return delegate().compute(key, remappingFunction); } diff --git a/guava/src/com/google/common/collect/Table.java b/guava/src/com/google/common/collect/Table.java index 97d3f7027..3c9e7ec7a 100644 --- a/guava/src/com/google/common/collect/Table.java +++ b/guava/src/com/google/common/collect/Table.java @@ -46,7 +46,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * UnsupportedOperationException}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @param <R> the type of the table row keys diff --git a/guava/src/com/google/common/collect/TableCollectors.java b/guava/src/com/google/common/collect/TableCollectors.java index 99ab81068..16fcb1669 100644 --- a/guava/src/com/google/common/collect/TableCollectors.java +++ b/guava/src/com/google/common/collect/TableCollectors.java @@ -68,8 +68,7 @@ final class TableCollectors { */ return Collector.of( - () -> new ImmutableTableCollectorState<R, C, V>() - /* GWT isn't currently playing nicely with constructor references? */ , + ImmutableTableCollectorState<R, C, V>::new, (state, input) -> state.put( rowFunction.apply(input), diff --git a/guava/src/com/google/common/collect/Tables.java b/guava/src/com/google/common/collect/Tables.java index 2d743f07e..9c58611d4 100644 --- a/guava/src/com/google/common/collect/Tables.java +++ b/guava/src/com/google/common/collect/Tables.java @@ -44,7 +44,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * Provides static methods that involve a {@code Table}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#tables"> {@code Tables}</a>. + * "https://github.com/google/guava/wiki/CollectionUtilitiesExplained#tables">{@code Tables}</a>. * * @author Jared Levy * @author Louis Wasserman diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java index 8411fcdea..20b17fdef 100644 --- a/guava/src/com/google/common/collect/TopKSelector.java +++ b/guava/src/com/google/common/collect/TopKSelector.java @@ -185,8 +185,10 @@ final class TopKSelector< } iterations++; if (iterations >= maxIterations) { + @SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts + T[] castBuffer = (T[]) buffer; // We've already taken O(k log k), let's make sure we don't take longer than O(k log k). - Arrays.sort(buffer, left, right + 1, comparator); + Arrays.sort(castBuffer, left, right + 1, comparator); break; } } @@ -271,7 +273,9 @@ final class TopKSelector< * this {@code TopKSelector}. This method returns in O(k log k) time. */ public List<T> topK() { - Arrays.sort(buffer, 0, bufferSize, comparator); + @SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts + T[] castBuffer = (T[]) buffer; + Arrays.sort(castBuffer, 0, bufferSize, comparator); if (bufferSize > k) { Arrays.fill(buffer, k, buffer.length, null); bufferSize = k; diff --git a/guava/src/com/google/common/collect/TreeBasedTable.java b/guava/src/com/google/common/collect/TreeBasedTable.java index 315404aaf..9ef210a54 100644 --- a/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/guava/src/com/google/common/collect/TreeBasedTable.java @@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Objects.requireNonNull; import com.google.common.annotations.GwtCompatible; -import com.google.common.base.Function; import com.google.common.base.Supplier; import java.io.Serializable; import java.util.Comparator; @@ -60,7 +59,7 @@ import javax.annotation.CheckForNull; * concurrently and one of the threads modifies the table, it must be synchronized externally. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> {@code Table}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table">{@code Table}</a>. * * @author Jared Levy * @author Louis Wasserman @@ -313,18 +312,12 @@ public class TreeBasedTable<R, C, V> extends StandardRowSortedTable<R, C, V> { /** Overridden column iterator to return columns values in globally sorted order. */ @Override Iterator<C> createColumnKeyIterator() { - final Comparator<? super C> comparator = columnComparator(); + Comparator<? super C> comparator = columnComparator(); - final Iterator<C> merged = + Iterator<C> merged = Iterators.mergeSorted( Iterables.transform( - backingMap.values(), - new Function<Map<C, V>, Iterator<C>>() { - @Override - public Iterator<C> apply(Map<C, V> input) { - return input.keySet().iterator(); - } - }), + backingMap.values(), (Map<C, V> input) -> input.keySet().iterator()), comparator); return new AbstractIterator<C>() { diff --git a/guava/src/com/google/common/collect/TreeMultimap.java b/guava/src/com/google/common/collect/TreeMultimap.java index 04ae2074a..dd0c2f833 100644 --- a/guava/src/com/google/common/collect/TreeMultimap.java +++ b/guava/src/com/google/common/collect/TreeMultimap.java @@ -64,8 +64,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * with a call to {@link Multimaps#synchronizedSortedSetMultimap}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code - * Multimap}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap">{@code Multimap}</a>. * * @author Jared Levy * @author Louis Wasserman @@ -136,7 +135,7 @@ public class TreeMultimap<K extends @Nullable Object, V extends @Nullable Object */ @Override SortedSet<V> createCollection() { - return new TreeSet<V>(valueComparator); + return new TreeSet<>(valueComparator); } @Override diff --git a/guava/src/com/google/common/collect/TreeMultiset.java b/guava/src/com/google/common/collect/TreeMultiset.java index dcc3f681f..23cbca83e 100644 --- a/guava/src/com/google/common/collect/TreeMultiset.java +++ b/guava/src/com/google/common/collect/TreeMultiset.java @@ -51,8 +51,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * java.util.Collection} contract, which is specified in terms of {@link Object#equals}. * * <p>See the Guava User Guide article on <a href= - * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset"> {@code - * Multiset}</a>. + * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multiset">{@code Multiset}</a>. * * @author Louis Wasserman * @author Jared Levy diff --git a/guava/src/com/google/common/collect/TreeRangeMap.java b/guava/src/com/google/common/collect/TreeRangeMap.java index a9200896b..60e7bf3df 100644 --- a/guava/src/com/google/common/collect/TreeRangeMap.java +++ b/guava/src/com/google/common/collect/TreeRangeMap.java @@ -436,7 +436,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K, public void merge( Range<Comparable<?>> range, @CheckForNull Object value, - BiFunction<? super Object, ? super Object, ? extends Object> remappingFunction) { + BiFunction<? super Object, ? super @Nullable Object, ? extends @Nullable Object> + remappingFunction) { checkNotNull(range); throw new IllegalArgumentException( "Cannot merge range " + range + " into an empty subRangeMap"); diff --git a/guava/src/com/google/common/collect/TreeRangeSet.java b/guava/src/com/google/common/collect/TreeRangeSet.java index 8308880a5..7ba71139e 100644 --- a/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/guava/src/com/google/common/collect/TreeRangeSet.java @@ -48,7 +48,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> /** Creates an empty {@code TreeRangeSet} instance. */ public static <C extends Comparable<?>> TreeRangeSet<C> create() { - return new TreeRangeSet<C>(new TreeMap<Cut<C>, Range<C>>()); + return new TreeRangeSet<>(new TreeMap<Cut<C>, Range<C>>()); } /** Returns a {@code TreeRangeSet} initialized with the ranges in the specified range set. */ @@ -306,7 +306,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> window) { if (window.isConnected(upperBoundWindow)) { - return new RangesByUpperBound<C>(rangesByLowerBound, window.intersection(upperBoundWindow)); + return new RangesByUpperBound<>(rangesByLowerBound, window.intersection(upperBoundWindow)); } else { return ImmutableSortedMap.of(); } @@ -368,7 +368,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> * We want to start the iteration at the first range where the upper bound is in * upperBoundWindow. */ - final Iterator<Range<C>> backingItr; + Iterator<Range<C>> backingItr; if (!upperBoundWindow.hasLowerBound()) { backingItr = rangesByLowerBound.values().iterator(); } else { @@ -415,7 +415,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { candidates = rangesByLowerBound.descendingMap().values(); } - final PeekingIterator<Range<C>> backingItr = Iterators.peekingIterator(candidates.iterator()); + PeekingIterator<Range<C>> backingItr = Iterators.peekingIterator(candidates.iterator()); if (backingItr.hasNext() && upperBoundWindow.upperBound.isLessThan(backingItr.peek().upperBound)) { backingItr.next(); @@ -470,7 +470,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> private ComplementRangesByLowerBound( NavigableMap<Cut<C>, Range<C>> positiveRangesByLowerBound, Range<Cut<C>> window) { this.positiveRangesByLowerBound = positiveRangesByLowerBound; - this.positiveRangesByUpperBound = new RangesByUpperBound<C>(positiveRangesByLowerBound); + this.positiveRangesByUpperBound = new RangesByUpperBound<>(positiveRangesByLowerBound); this.complementLowerBoundWindow = window; } @@ -479,7 +479,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> return ImmutableSortedMap.of(); } else { subWindow = subWindow.intersection(complementLowerBoundWindow); - return new ComplementRangesByLowerBound<C>(positiveRangesByLowerBound, subWindow); + return new ComplementRangesByLowerBound<>(positiveRangesByLowerBound, subWindow); } } @@ -529,9 +529,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { positiveRanges = positiveRangesByUpperBound.values(); } - final PeekingIterator<Range<C>> positiveItr = - Iterators.peekingIterator(positiveRanges.iterator()); - final Cut<C> firstComplementRangeLowerBound; + PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator(positiveRanges.iterator()); + Cut<C> firstComplementRangeLowerBound; if (complementLowerBoundWindow.contains(Cut.<C>belowAll()) && (!positiveItr.hasNext() || positiveItr.peek().lowerBound != Cut.<C>belowAll())) { firstComplementRangeLowerBound = Cut.belowAll(); @@ -581,7 +580,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> boolean inclusive = complementLowerBoundWindow.hasUpperBound() && complementLowerBoundWindow.upperBoundType() == BoundType.CLOSED; - final PeekingIterator<Range<C>> positiveItr = + PeekingIterator<Range<C>> positiveItr = Iterators.peekingIterator( positiveRangesByUpperBound .headMap(startingPoint, inclusive) @@ -600,8 +599,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> } else { cut = positiveRangesByLowerBound.higherKey(Cut.<C>belowAll()); } - final Cut<C> firstComplementRangeUpperBound = - MoreObjects.firstNonNull(cut, Cut.<C>aboveAll()); + Cut<C> firstComplementRangeUpperBound = MoreObjects.firstNonNull(cut, Cut.<C>aboveAll()); return new AbstractIterator<Entry<Cut<C>, Range<C>>>() { Cut<C> nextComplementRangeUpperBound = firstComplementRangeUpperBound; @@ -708,14 +706,14 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> this.lowerBoundWindow = checkNotNull(lowerBoundWindow); this.restriction = checkNotNull(restriction); this.rangesByLowerBound = checkNotNull(rangesByLowerBound); - this.rangesByUpperBound = new RangesByUpperBound<C>(rangesByLowerBound); + this.rangesByUpperBound = new RangesByUpperBound<>(rangesByLowerBound); } private NavigableMap<Cut<C>, Range<C>> subMap(Range<Cut<C>> window) { if (!window.isConnected(lowerBoundWindow)) { return ImmutableSortedMap.of(); } else { - return new SubRangeSetRangesByLowerBound<C>( + return new SubRangeSetRangesByLowerBound<>( lowerBoundWindow.intersection(window), restriction, rangesByLowerBound); } } @@ -786,7 +784,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> if (restriction.isEmpty()) { return Iterators.emptyIterator(); } - final Iterator<Range<C>> completeRangeItr; + Iterator<Range<C>> completeRangeItr; if (lowerBoundWindow.upperBound.isLessThan(restriction.lowerBound)) { return Iterators.emptyIterator(); } else if (lowerBoundWindow.lowerBound.isLessThan(restriction.lowerBound)) { @@ -803,7 +801,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> .values() .iterator(); } - final Cut<Cut<C>> upperBoundOnLowerBounds = + Cut<Cut<C>> upperBoundOnLowerBounds = Ordering.natural() .min(lowerBoundWindow.upperBound, Cut.belowValue(restriction.upperBound)); return new AbstractIterator<Entry<Cut<C>, Range<C>>>() { @@ -832,7 +830,7 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C> Cut<Cut<C>> upperBoundOnLowerBounds = Ordering.natural() .min(lowerBoundWindow.upperBound, Cut.belowValue(restriction.upperBound)); - final Iterator<Range<C>> completeRangeItr = + Iterator<Range<C>> completeRangeItr = rangesByLowerBound .headMap( upperBoundOnLowerBounds.endpoint(), diff --git a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java index 59bd2ce31..31f3c7197 100644 --- a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -64,7 +64,7 @@ final class UnmodifiableSortedMultiset<E extends @Nullable Object> extends Unmod public SortedMultiset<E> descendingMultiset() { UnmodifiableSortedMultiset<E> result = descendingMultiset; if (result == null) { - result = new UnmodifiableSortedMultiset<E>(delegate().descendingMultiset()); + result = new UnmodifiableSortedMultiset<>(delegate().descendingMultiset()); result.descendingMultiset = this; return descendingMultiset = result; } diff --git a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java index 20e856348..dbe6e3568 100644 --- a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java +++ b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Map; import javax.annotation.CheckForNull; @@ -41,7 +40,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class ArrayBasedCharEscaper extends CharEscaper { diff --git a/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java b/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java index a0883fea2..efc77d058 100644 --- a/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java +++ b/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.VisibleForTesting; import java.util.Collections; @@ -36,7 +35,6 @@ import java.util.Map; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class ArrayBasedEscaperMap { diff --git a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java index 5ea780712..355faaa10 100644 --- a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java +++ b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.Map; import javax.annotation.CheckForNull; @@ -41,7 +40,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class ArrayBasedUnicodeEscaper extends UnicodeEscaper { diff --git a/guava/src/com/google/common/escape/CharEscaper.java b/guava/src/com/google/common/escape/CharEscaper.java index 55090f698..136240ec6 100644 --- a/guava/src/com/google/common/escape/CharEscaper.java +++ b/guava/src/com/google/common/escape/CharEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; @@ -40,7 +39,6 @@ import javax.annotation.CheckForNull; * @author Sven Mawson * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class CharEscaper extends Escaper { diff --git a/guava/src/com/google/common/escape/CharEscaperBuilder.java b/guava/src/com/google/common/escape/CharEscaperBuilder.java index cbe6958f3..97528cb56 100644 --- a/guava/src/com/google/common/escape/CharEscaperBuilder.java +++ b/guava/src/com/google/common/escape/CharEscaperBuilder.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.HashMap; @@ -34,7 +33,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Sven Mawson * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class CharEscaperBuilder { diff --git a/guava/src/com/google/common/escape/Escaper.java b/guava/src/com/google/common/escape/Escaper.java index cdfe4e92a..31b7df0e6 100644 --- a/guava/src/com/google/common/escape/Escaper.java +++ b/guava/src/com/google/common/escape/Escaper.java @@ -85,13 +85,7 @@ public abstract class Escaper { */ public abstract String escape(String string); - private final Function<String, String> asFunction = - new Function<String, String>() { - @Override - public String apply(String from) { - return escape(from); - } - }; + private final Function<String, String> asFunction = this::escape; /** Returns a {@link Function} that invokes {@link #escape(String)} on this escaper. */ public final Function<String, String> asFunction() { diff --git a/guava/src/com/google/common/escape/Escapers.java b/guava/src/com/google/common/escape/Escapers.java index 41af6688e..acfb82ce2 100644 --- a/guava/src/com/google/common/escape/Escapers.java +++ b/guava/src/com/google/common/escape/Escapers.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.HashMap; @@ -31,7 +30,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class Escapers { @@ -93,7 +91,6 @@ public final class Escapers { * @author David Beaumont * @since 15.0 */ - @Beta public static final class Builder { private final Map<Character, String> replacementMap = new HashMap<>(); private char safeMin = Character.MIN_VALUE; @@ -228,7 +225,7 @@ public final class Escapers { } /** Private helper to wrap a CharEscaper as a UnicodeEscaper. */ - private static UnicodeEscaper wrap(final CharEscaper escaper) { + private static UnicodeEscaper wrap(CharEscaper escaper) { return new UnicodeEscaper() { @Override @CheckForNull diff --git a/guava/src/com/google/common/escape/ParametricNullness.java b/guava/src/com/google/common/escape/ParametricNullness.java index 2f03d59f3..d9412065f 100644 --- a/guava/src/com/google/common/escape/ParametricNullness.java +++ b/guava/src/com/google/common/escape/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/escape/UnicodeEscaper.java b/guava/src/com/google/common/escape/UnicodeEscaper.java index c10ae34cd..280915c75 100644 --- a/guava/src/com/google/common/escape/UnicodeEscaper.java +++ b/guava/src/com/google/common/escape/UnicodeEscaper.java @@ -16,7 +16,6 @@ package com.google.common.escape; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; @@ -50,7 +49,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public abstract class UnicodeEscaper extends Escaper { diff --git a/guava/src/com/google/common/eventbus/ParametricNullness.java b/guava/src/com/google/common/eventbus/ParametricNullness.java index fc5bb175f..ac91392f7 100644 --- a/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/eventbus/Subscriber.java b/guava/src/com/google/common/eventbus/Subscriber.java index 73e7f420a..71ee197c9 100644 --- a/guava/src/com/google/common/eventbus/Subscriber.java +++ b/guava/src/com/google/common/eventbus/Subscriber.java @@ -64,16 +64,13 @@ class Subscriber { } /** Dispatches {@code event} to this subscriber using the proper executor. */ - final void dispatchEvent(final Object event) { + final void dispatchEvent(Object event) { executor.execute( - new Runnable() { - @Override - public void run() { - try { - invokeSubscriberMethod(event); - } catch (InvocationTargetException e) { - bus.handleSubscriberException(e.getCause(), context(event)); - } + () -> { + try { + invokeSubscriberMethod(event); + } catch (InvocationTargetException e) { + bus.handleSubscriberException(e.getCause(), context(event)); } }); } diff --git a/guava/src/com/google/common/graph/AbstractBaseGraph.java b/guava/src/com/google/common/graph/AbstractBaseGraph.java index c4be6b631..797468b7a 100644 --- a/guava/src/com/google/common/graph/AbstractBaseGraph.java +++ b/guava/src/com/google/common/graph/AbstractBaseGraph.java @@ -21,7 +21,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static com.google.common.graph.GraphConstants.ENDPOINTS_MISMATCH; -import com.google.common.base.Function; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterators; import com.google.common.collect.Sets; @@ -115,31 +114,16 @@ abstract class AbstractBaseGraph<N> implements BaseGraph<N> { Iterators.concat( Iterators.transform( graph.predecessors(node).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N predecessor) { - return EndpointPair.ordered(predecessor, node); - } - }), + (N predecessor) -> EndpointPair.ordered(predecessor, node)), Iterators.transform( // filter out 'node' from successors (already covered by predecessors, above) Sets.difference(graph.successors(node), ImmutableSet.of(node)).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N successor) { - return EndpointPair.ordered(node, successor); - } - }))); + (N successor) -> EndpointPair.ordered(node, successor)))); } else { return Iterators.unmodifiableIterator( Iterators.transform( graph.adjacentNodes(node).iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N adjacentNode) { - return EndpointPair.unordered(node, adjacentNode); - } - })); + (N adjacentNode) -> EndpointPair.unordered(node, adjacentNode))); } } }; diff --git a/guava/src/com/google/common/graph/DirectedGraphConnections.java b/guava/src/com/google/common/graph/DirectedGraphConnections.java index 23083da32..0feb973f3 100644 --- a/guava/src/com/google/common/graph/DirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/DirectedGraphConnections.java @@ -163,13 +163,13 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { orderedNodeConnections = null; break; case STABLE: - orderedNodeConnections = new ArrayList<NodeConnection<N>>(); + orderedNodeConnections = new ArrayList<>(); break; default: throw new AssertionError(incidentEdgeOrder.type()); } - return new DirectedGraphConnections<N, V>( + return new DirectedGraphConnections<>( /* adjacentNodeValues = */ new HashMap<N, Object>(initialCapacity, INNER_LOAD_FACTOR), orderedNodeConnections, /* predecessorCount = */ 0, @@ -239,8 +239,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { return new AbstractSet<N>() { @Override public UnmodifiableIterator<N> iterator() { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); - final Set<N> seenNodes = new HashSet<>(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Set<N> seenNodes = new HashSet<>(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -276,7 +276,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { @Override public UnmodifiableIterator<N> iterator() { if (orderedNodeConnections == null) { - final Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); + Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -291,7 +291,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } }; } else { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -326,7 +326,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { @Override public UnmodifiableIterator<N> iterator() { if (orderedNodeConnections == null) { - final Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); + Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -341,7 +341,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } }; } else { - final Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); + Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator(); return new AbstractIterator<N>() { @Override @CheckForNull @@ -371,46 +371,33 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> { } @Override - public Iterator<EndpointPair<N>> incidentEdgeIterator(final N thisNode) { + public Iterator<EndpointPair<N>> incidentEdgeIterator(N thisNode) { checkNotNull(thisNode); - final Iterator<EndpointPair<N>> resultWithDoubleSelfLoop; + Iterator<EndpointPair<N>> resultWithDoubleSelfLoop; if (orderedNodeConnections == null) { resultWithDoubleSelfLoop = Iterators.concat( Iterators.transform( predecessors().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N predecessor) { - return EndpointPair.ordered(predecessor, thisNode); - } - }), + (N predecessor) -> EndpointPair.ordered(predecessor, thisNode)), Iterators.transform( successors().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N successor) { - return EndpointPair.ordered(thisNode, successor); - } - })); + (N successor) -> EndpointPair.ordered(thisNode, successor))); } else { resultWithDoubleSelfLoop = Iterators.transform( orderedNodeConnections.iterator(), - new Function<NodeConnection<N>, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(NodeConnection<N> connection) { - if (connection instanceof NodeConnection.Succ) { - return EndpointPair.ordered(thisNode, connection.node); - } else { - return EndpointPair.ordered(connection.node, thisNode); - } + (NodeConnection<N> connection) -> { + if (connection instanceof NodeConnection.Succ) { + return EndpointPair.ordered(thisNode, connection.node); + } else { + return EndpointPair.ordered(connection.node, thisNode); } }); } - final AtomicBoolean alreadySeenSelfLoop = new AtomicBoolean(false); + AtomicBoolean alreadySeenSelfLoop = new AtomicBoolean(false); return new AbstractIterator<EndpointPair<N>>() { @Override @CheckForNull diff --git a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index 05f40c290..bd0e546f2 100644 --- a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -93,7 +93,7 @@ final class DirectedMultiNetworkConnections<N, E> extends AbstractDirectedNetwor } @Override - public Set<E> edgesConnecting(final N node) { + public Set<E> edgesConnecting(N node) { return new MultiEdgesConnecting<E>(outEdgeMap, node) { @Override public int size() { diff --git a/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/guava/src/com/google/common/graph/DirectedNetworkConnections.java index c2a25a5ad..e1db65708 100644 --- a/guava/src/com/google/common/graph/DirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedNetworkConnections.java @@ -62,6 +62,6 @@ final class DirectedNetworkConnections<N, E> extends AbstractDirectedNetworkConn @Override public Set<E> edgesConnecting(N node) { - return new EdgesConnecting<E>(((BiMap<E, N>) outEdgeMap).inverse(), node); + return new EdgesConnecting<>(((BiMap<E, N>) outEdgeMap).inverse(), node); } } diff --git a/guava/src/com/google/common/graph/ElementOrder.java b/guava/src/com/google/common/graph/ElementOrder.java index ea13674c6..b5985a280 100644 --- a/guava/src/com/google/common/graph/ElementOrder.java +++ b/guava/src/com/google/common/graph/ElementOrder.java @@ -80,7 +80,7 @@ public final class ElementOrder<T> { /** Returns an instance which specifies that no ordering is guaranteed. */ public static <S> ElementOrder<S> unordered() { - return new ElementOrder<S>(Type.UNORDERED, null); + return new ElementOrder<>(Type.UNORDERED, null); } /** @@ -120,19 +120,19 @@ public final class ElementOrder<T> { * @since 29.0 */ public static <S> ElementOrder<S> stable() { - return new ElementOrder<S>(Type.STABLE, null); + return new ElementOrder<>(Type.STABLE, null); } /** Returns an instance which specifies that insertion ordering is guaranteed. */ public static <S> ElementOrder<S> insertion() { - return new ElementOrder<S>(Type.INSERTION, null); + return new ElementOrder<>(Type.INSERTION, null); } /** * Returns an instance which specifies that the natural ordering of the elements is guaranteed. */ public static <S extends Comparable<? super S>> ElementOrder<S> natural() { - return new ElementOrder<S>(Type.SORTED, Ordering.<S>natural()); + return new ElementOrder<>(Type.SORTED, Ordering.<S>natural()); } /** @@ -140,7 +140,7 @@ public final class ElementOrder<T> { * determined by {@code comparator}. */ public static <S> ElementOrder<S> sorted(Comparator<S> comparator) { - return new ElementOrder<S>(Type.SORTED, checkNotNull(comparator)); + return new ElementOrder<>(Type.SORTED, checkNotNull(comparator)); } /** Returns the type of ordering used. */ diff --git a/guava/src/com/google/common/graph/EndpointPair.java b/guava/src/com/google/common/graph/EndpointPair.java index 7aa38606d..fe2397c6b 100644 --- a/guava/src/com/google/common/graph/EndpointPair.java +++ b/guava/src/com/google/common/graph/EndpointPair.java @@ -51,13 +51,13 @@ public abstract class EndpointPair<N> implements Iterable<N> { /** Returns an {@link EndpointPair} representing the endpoints of a directed edge. */ public static <N> EndpointPair<N> ordered(N source, N target) { - return new Ordered<N>(source, target); + return new Ordered<>(source, target); } /** Returns an {@link EndpointPair} representing the endpoints of an undirected edge. */ public static <N> EndpointPair<N> unordered(N nodeU, N nodeV) { // Swap nodes on purpose to prevent callers from relying on the "ordering" of an unordered pair. - return new Unordered<N>(nodeV, nodeU); + return new Unordered<>(nodeV, nodeU); } /** Returns an {@link EndpointPair} representing the endpoints of an edge in {@code graph}. */ diff --git a/guava/src/com/google/common/graph/GraphBuilder.java b/guava/src/com/google/common/graph/GraphBuilder.java index d57ed3771..8c0871b46 100644 --- a/guava/src/com/google/common/graph/GraphBuilder.java +++ b/guava/src/com/google/common/graph/GraphBuilder.java @@ -171,7 +171,7 @@ public final class GraphBuilder<N> extends AbstractGraphBuilder<N> { /** Returns an empty {@link MutableGraph} with the properties of this {@link GraphBuilder}. */ public <N1 extends N> MutableGraph<N1> build() { - return new StandardMutableGraph<N1>(this); + return new StandardMutableGraph<>(this); } GraphBuilder<N> copy() { diff --git a/guava/src/com/google/common/graph/ImmutableGraph.java b/guava/src/com/google/common/graph/ImmutableGraph.java index afad211a1..f829e9699 100644 --- a/guava/src/com/google/common/graph/ImmutableGraph.java +++ b/guava/src/com/google/common/graph/ImmutableGraph.java @@ -87,7 +87,7 @@ public class ImmutableGraph<N> extends ForwardingGraph<N> { for (N node : graph.nodes()) { nodeConnections.put(node, connectionsOf(graph, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } @SuppressWarnings("unchecked") diff --git a/guava/src/com/google/common/graph/ImmutableNetwork.java b/guava/src/com/google/common/graph/ImmutableNetwork.java index cb636aa28..c29f8a392 100644 --- a/guava/src/com/google/common/graph/ImmutableNetwork.java +++ b/guava/src/com/google/common/graph/ImmutableNetwork.java @@ -73,7 +73,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { @Override public ImmutableGraph<N> asGraph() { - return new ImmutableGraph<N>(super.asGraph()); // safe because the view is effectively immutable + return new ImmutableGraph<>(super.asGraph()); // safe because the view is effectively immutable } private static <N, E> Map<N, NetworkConnections<N, E>> getNodeConnections(Network<N, E> network) { @@ -84,7 +84,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { for (N node : network.nodes()) { nodeConnections.put(node, connectionsOf(network, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } private static <N, E> Map<E, N> getEdgeToReferenceNode(Network<N, E> network) { @@ -95,7 +95,7 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { for (E edge : network.edges()) { edgeToReferenceNode.put(edge, network.incidentNodes(edge).nodeU()); } - return edgeToReferenceNode.build(); + return edgeToReferenceNode.buildOrThrow(); } private static <N, E> NetworkConnections<N, E> connectionsOf(Network<N, E> network, N node) { @@ -115,31 +115,16 @@ public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> { } } - private static <N, E> Function<E, N> sourceNodeFn(final Network<N, E> network) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).source(); - } - }; + private static <N, E> Function<E, N> sourceNodeFn(Network<N, E> network) { + return (E edge) -> network.incidentNodes(edge).source(); } - private static <N, E> Function<E, N> targetNodeFn(final Network<N, E> network) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).target(); - } - }; + private static <N, E> Function<E, N> targetNodeFn(Network<N, E> network) { + return (E edge) -> network.incidentNodes(edge).target(); } - private static <N, E> Function<E, N> adjacentNodeFn(final Network<N, E> network, final N node) { - return new Function<E, N>() { - @Override - public N apply(E edge) { - return network.incidentNodes(edge).adjacentNode(node); - } - }; + private static <N, E> Function<E, N> adjacentNodeFn(Network<N, E> network, N node) { + return (E edge) -> network.incidentNodes(edge).adjacentNode(node); } /** diff --git a/guava/src/com/google/common/graph/ImmutableValueGraph.java b/guava/src/com/google/common/graph/ImmutableValueGraph.java index a1567dacb..eb17067fc 100644 --- a/guava/src/com/google/common/graph/ImmutableValueGraph.java +++ b/guava/src/com/google/common/graph/ImmutableValueGraph.java @@ -75,7 +75,7 @@ public final class ImmutableValueGraph<N, V> extends StandardValueGraph<N, V> { @Override public ImmutableGraph<N> asGraph() { - return new ImmutableGraph<N>(this); // safe because the view is effectively immutable + return new ImmutableGraph<>(this); // safe because the view is effectively immutable } private static <N, V> ImmutableMap<N, GraphConnections<N, V>> getNodeConnections( @@ -87,19 +87,14 @@ public final class ImmutableValueGraph<N, V> extends StandardValueGraph<N, V> { for (N node : graph.nodes()) { nodeConnections.put(node, connectionsOf(graph, node)); } - return nodeConnections.build(); + return nodeConnections.buildOrThrow(); } - private static <N, V> GraphConnections<N, V> connectionsOf( - final ValueGraph<N, V> graph, final N node) { + private static <N, V> GraphConnections<N, V> connectionsOf(ValueGraph<N, V> graph, N node) { Function<N, V> successorNodeToValueFn = - new Function<N, V>() { - @Override - public V apply(N successorNode) { + (N successorNode) -> // requireNonNull is safe because the endpoint pair comes from the graph. - return requireNonNull(graph.edgeValueOrDefault(node, successorNode, null)); - } - }; + requireNonNull(graph.edgeValueOrDefault(node, successorNode, null)); return graph.isDirected() ? DirectedGraphConnections.ofImmutable( node, graph.incidentEdges(node), successorNodeToValueFn) diff --git a/guava/src/com/google/common/graph/MapIteratorCache.java b/guava/src/com/google/common/graph/MapIteratorCache.java index aae91874c..05cdde8c3 100644 --- a/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/guava/src/com/google/common/graph/MapIteratorCache.java @@ -108,7 +108,7 @@ class MapIteratorCache<K, V> { return new AbstractSet<K>() { @Override public UnmodifiableIterator<K> iterator() { - final Iterator<Entry<K, V>> entryIterator = backingMap.entrySet().iterator(); + Iterator<Entry<K, V>> entryIterator = backingMap.entrySet().iterator(); return new UnmodifiableIterator<K>() { @Override diff --git a/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/guava/src/com/google/common/graph/MultiEdgesConnecting.java index 8a4250e6b..620f986a5 100644 --- a/guava/src/com/google/common/graph/MultiEdgesConnecting.java +++ b/guava/src/com/google/common/graph/MultiEdgesConnecting.java @@ -48,7 +48,7 @@ abstract class MultiEdgesConnecting<E> extends AbstractSet<E> { @Override public UnmodifiableIterator<E> iterator() { - final Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator(); + Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator(); return new AbstractIterator<E>() { @Override @CheckForNull diff --git a/guava/src/com/google/common/graph/ParametricNullness.java b/guava/src/com/google/common/graph/ParametricNullness.java index 62534eb4c..87ff930a4 100644 --- a/guava/src/com/google/common/graph/ParametricNullness.java +++ b/guava/src/com/google/common/graph/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/graph/StandardValueGraph.java b/guava/src/com/google/common/graph/StandardValueGraph.java index f2c71bc22..ab3ae582b 100644 --- a/guava/src/com/google/common/graph/StandardValueGraph.java +++ b/guava/src/com/google/common/graph/StandardValueGraph.java @@ -118,7 +118,7 @@ class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> { @Override public Set<EndpointPair<N>> incidentEdges(N node) { - final GraphConnections<N, V> connections = checkedConnections(node); + GraphConnections<N, V> connections = checkedConnections(node); return new IncidentEdgeSet<N>(this, node) { @Override diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java index 5a36f9f89..fb594b440 100644 --- a/guava/src/com/google/common/graph/Traverser.java +++ b/guava/src/com/google/common/graph/Traverser.java @@ -96,7 +96,7 @@ public abstract class Traverser<N> { * * @param graph {@link SuccessorsFunction} representing a general graph that may have cycles. */ - public static <N> Traverser<N> forGraph(final SuccessorsFunction<N> graph) { + public static <N> Traverser<N> forGraph(SuccessorsFunction<N> graph) { return new Traverser<N>(graph) { @Override Traversal<N> newTraversal() { @@ -178,7 +178,7 @@ public abstract class Traverser<N> { * @param tree {@link SuccessorsFunction} representing a directed acyclic graph that has at most * one path between any two nodes */ - public static <N> Traverser<N> forTree(final SuccessorsFunction<N> tree) { + public static <N> Traverser<N> forTree(SuccessorsFunction<N> tree) { if (tree instanceof BaseGraph) { checkArgument(((BaseGraph<?>) tree).isDirected(), "Undirected graphs can never be trees."); } @@ -239,7 +239,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> breadthFirst(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -294,7 +294,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> depthFirstPreOrder(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -349,7 +349,7 @@ public abstract class Traverser<N> { * @since 24.1 */ public final Iterable<N> depthFirstPostOrder(Iterable<? extends N> startNodes) { - final ImmutableSet<N> validated = validate(startNodes); + ImmutableSet<N> validated = validate(startNodes); return new Iterable<N>() { @Override public Iterator<N> iterator() { @@ -382,7 +382,7 @@ public abstract class Traverser<N> { } static <N> Traversal<N> inGraph(SuccessorsFunction<N> graph) { - final Set<N> visited = new HashSet<>(); + Set<N> visited = new HashSet<>(); return new Traversal<N>(graph) { @Override @CheckForNull @@ -438,8 +438,8 @@ public abstract class Traverser<N> { * determined by the {@code InsertionOrder} parameter: nieces are placed at the FRONT before * aunts for pre-order; while in BFS they are placed at the BACK after aunts. */ - private Iterator<N> topDown(Iterator<? extends N> startNodes, final InsertionOrder order) { - final Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); + private Iterator<N> topDown(Iterator<? extends N> startNodes, InsertionOrder order) { + Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); horizon.add(startNodes); return new AbstractIterator<N>() { @Override @@ -463,8 +463,8 @@ public abstract class Traverser<N> { } final Iterator<N> postOrder(Iterator<? extends N> startNodes) { - final Deque<N> ancestorStack = new ArrayDeque<>(); - final Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); + Deque<N> ancestorStack = new ArrayDeque<>(); + Deque<Iterator<? extends N>> horizon = new ArrayDeque<>(); horizon.add(startNodes); return new AbstractIterator<N>() { @Override diff --git a/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/guava/src/com/google/common/graph/UndirectedGraphConnections.java index 085e3a74a..4eeb2328f 100644 --- a/guava/src/com/google/common/graph/UndirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/UndirectedGraphConnections.java @@ -20,7 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.graph.GraphConstants.INNER_CAPACITY; import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR; -import com.google.common.base.Function; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import java.util.Collections; @@ -79,15 +78,10 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> { } @Override - public Iterator<EndpointPair<N>> incidentEdgeIterator(final N thisNode) { + public Iterator<EndpointPair<N>> incidentEdgeIterator(N thisNode) { return Iterators.transform( adjacentNodeValues.keySet().iterator(), - new Function<N, EndpointPair<N>>() { - @Override - public EndpointPair<N> apply(N incidentNode) { - return EndpointPair.unordered(thisNode, incidentNode); - } - }); + (N incidentNode) -> EndpointPair.unordered(thisNode, incidentNode)); } @Override diff --git a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index a5c45ca11..6caac3b71 100644 --- a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -73,7 +73,7 @@ final class UndirectedMultiNetworkConnections<N, E> } @Override - public Set<E> edgesConnecting(final N node) { + public Set<E> edgesConnecting(N node) { return new MultiEdgesConnecting<E>(incidentEdgeMap, node) { @Override public int size() { diff --git a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java index 38cb7639e..190897f88 100644 --- a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java @@ -54,6 +54,6 @@ final class UndirectedNetworkConnections<N, E> extends AbstractUndirectedNetwork @Override public Set<E> edgesConnecting(N node) { - return new EdgesConnecting<E>(((BiMap<E, N>) incidentEdgeMap).inverse(), node); + return new EdgesConnecting<>(((BiMap<E, N>) incidentEdgeMap).inverse(), node); } } diff --git a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java index 4b69bb721..820fe963b 100644 --- a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java +++ b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java @@ -70,7 +70,7 @@ abstract class AbstractCompositeHashFunction extends AbstractHashFunction { return fromHashers(hashers); } - private Hasher fromHashers(final Hasher[] hashers) { + private Hasher fromHashers(Hasher[] hashers) { return new Hasher() { @Override public Hasher putByte(byte b) { diff --git a/guava/src/com/google/common/hash/BloomFilter.java b/guava/src/com/google/common/hash/BloomFilter.java index e0affaad4..889ab5049 100644 --- a/guava/src/com/google/common/hash/BloomFilter.java +++ b/guava/src/com/google/common/hash/BloomFilter.java @@ -23,6 +23,7 @@ import com.google.common.base.Objects; import com.google.common.base.Predicate; import com.google.common.hash.BloomFilterStrategies.LockFreeBitArray; import com.google.common.math.DoubleMath; +import com.google.common.math.LongMath; import com.google.common.primitives.SignedBytes; import com.google.common.primitives.UnsignedBytes; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -607,11 +608,13 @@ public final class BloomFilter<T extends @Nullable Object> implements Predicate< dataLength = din.readInt(); Strategy strategy = BloomFilterStrategies.values()[strategyOrdinal]; - long[] data = new long[dataLength]; - for (int i = 0; i < data.length; i++) { - data[i] = din.readLong(); + + LockFreeBitArray dataArray = new LockFreeBitArray(LongMath.checkedMultiply(dataLength, 64L)); + for (int i = 0; i < dataLength; i++) { + dataArray.putData(i, din.readLong()); } - return new BloomFilter<T>(new LockFreeBitArray(data), numHashFunctions, funnel, strategy); + + return new BloomFilter<T>(dataArray, numHashFunctions, funnel, strategy); } catch (RuntimeException e) { String message = "Unable to deserialize BloomFilter from InputStream." diff --git a/guava/src/com/google/common/hash/BloomFilterStrategies.java b/guava/src/com/google/common/hash/BloomFilterStrategies.java index 3a012f358..876269e9c 100644 --- a/guava/src/com/google/common/hash/BloomFilterStrategies.java +++ b/guava/src/com/google/common/hash/BloomFilterStrategies.java @@ -263,27 +263,38 @@ enum BloomFilterStrategies implements BloomFilter.Strategy { data.length(), other.data.length()); for (int i = 0; i < data.length(); i++) { - long otherLong = other.data.get(i); - - long ourLongOld; - long ourLongNew; - boolean changedAnyBits = true; - do { - ourLongOld = data.get(i); - ourLongNew = ourLongOld | otherLong; - if (ourLongOld == ourLongNew) { - changedAnyBits = false; - break; - } - } while (!data.compareAndSet(i, ourLongOld, ourLongNew)); + putData(i, other.data.get(i)); + } + } - if (changedAnyBits) { - int bitsAdded = Long.bitCount(ourLongNew) - Long.bitCount(ourLongOld); - bitCount.add(bitsAdded); + /** + * ORs the bits encoded in the {@code i}th {@code long} in the underlying {@link + * AtomicLongArray} with the given value. + */ + void putData(int i, long longValue) { + long ourLongOld; + long ourLongNew; + boolean changedAnyBits = true; + do { + ourLongOld = data.get(i); + ourLongNew = ourLongOld | longValue; + if (ourLongOld == ourLongNew) { + changedAnyBits = false; + break; } + } while (!data.compareAndSet(i, ourLongOld, ourLongNew)); + + if (changedAnyBits) { + int bitsAdded = Long.bitCount(ourLongNew) - Long.bitCount(ourLongOld); + bitCount.add(bitsAdded); } } + /** Returns the number of {@code long}s in the underlying {@link AtomicLongArray}. */ + int dataLength() { + return data.length(); + } + @Override public boolean equals(@CheckForNull Object o) { if (o instanceof LockFreeBitArray) { diff --git a/guava/src/com/google/common/hash/FarmHashFingerprint64.java b/guava/src/com/google/common/hash/FarmHashFingerprint64.java index 7d6a3981d..3437b00a2 100644 --- a/guava/src/com/google/common/hash/FarmHashFingerprint64.java +++ b/guava/src/com/google/common/hash/FarmHashFingerprint64.java @@ -170,7 +170,7 @@ final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction { * Compute an 8-byte hash of a byte array of length greater than 64 bytes. */ private static long hashLength65Plus(byte[] bytes, int offset, int length) { - final int seed = 81; + int seed = 81; // For strings over 64 bytes we loop. Internal state consists of 56 bytes: v, w, x, y, and z. long x = seed; @SuppressWarnings("ConstantOverflow") diff --git a/guava/src/com/google/common/hash/Fingerprint2011.java b/guava/src/com/google/common/hash/Fingerprint2011.java new file mode 100644 index 000000000..1b01e0092 --- /dev/null +++ b/guava/src/com/google/common/hash/Fingerprint2011.java @@ -0,0 +1,198 @@ +// Copyright 2011 Google Inc. All Rights Reserved. + +package com.google.common.hash; + +import static com.google.common.base.Preconditions.checkPositionIndexes; +import static com.google.common.hash.LittleEndianByteArray.load64; +import static com.google.common.hash.LittleEndianByteArray.load64Safely; +import static java.lang.Long.rotateRight; + +import com.google.common.annotations.VisibleForTesting; + +/** + * Implementation of Geoff Pike's fingerprint2011 hash function. See {@link Hashing#fingerprint2011} + * for information on the behaviour of the algorithm. + * + * <p>On Intel Core2 2.66, on 1000 bytes, fingerprint2011 takes 0.9 microseconds compared to + * fingerprint at 4.0 microseconds and md5 at 4.5 microseconds. + * + * <p>Note to maintainers: This implementation relies on signed arithmetic being bit-wise equivalent + * to unsigned arithmetic in all cases except: + * + * <ul> + * <li>comparisons (signed values can be negative) + * <li>division (avoided here) + * <li>shifting (right shift must be unsigned) + * </ul> + * + * @author kylemaddison@google.com (Kyle Maddison) + * @author gpike@google.com (Geoff Pike) + */ +@ElementTypesAreNonnullByDefault +final class Fingerprint2011 extends AbstractNonStreamingHashFunction { + static final HashFunction FINGERPRINT_2011 = new Fingerprint2011(); + + // Some primes between 2^63 and 2^64 for various uses. + private static final long K0 = 0xa5b85c5e198ed849L; + private static final long K1 = 0x8d58ac26afe12e47L; + private static final long K2 = 0xc47b6e9e3a970ed3L; + private static final long K3 = 0xc6a4a7935bd1e995L; + + @Override + public HashCode hashBytes(byte[] input, int off, int len) { + checkPositionIndexes(off, off + len, input.length); + return HashCode.fromLong(fingerprint(input, off, len)); + } + + @Override + public int bits() { + return 64; + } + + @Override + public String toString() { + return "Hashing.fingerprint2011()"; + } + + // End of public functions. + + @VisibleForTesting + static long fingerprint(byte[] bytes, int offset, int length) { + long result; + + if (length <= 32) { + result = murmurHash64WithSeed(bytes, offset, length, K0 ^ K1 ^ K2); + } else if (length <= 64) { + result = hashLength33To64(bytes, offset, length); + } else { + result = fullFingerprint(bytes, offset, length); + } + + long u = length >= 8 ? load64(bytes, offset) : K0; + long v = length >= 9 ? load64(bytes, offset + length - 8) : K0; + result = hash128to64(result + v, u); + return result == 0 || result == 1 ? result + ~1 : result; + } + + private static long shiftMix(long val) { + return val ^ (val >>> 47); + } + + /** Implementation of Hash128to64 from util/hash/hash128to64.h */ + @VisibleForTesting + static long hash128to64(long high, long low) { + long a = (low ^ high) * K3; + a ^= (a >>> 47); + long b = (high ^ a) * K3; + b ^= (b >>> 47); + b *= K3; + return b; + } + + /** + * Computes intermediate hash of 32 bytes of byte array from the given offset. Results are + * returned in the output array - this is 12% faster than allocating new arrays every time. + */ + private static void weakHashLength32WithSeeds( + byte[] bytes, int offset, long seedA, long seedB, long[] output) { + long part1 = load64(bytes, offset); + long part2 = load64(bytes, offset + 8); + long part3 = load64(bytes, offset + 16); + long part4 = load64(bytes, offset + 24); + + seedA += part1; + seedB = rotateRight(seedB + seedA + part4, 51); + long c = seedA; + seedA += part2; + seedA += part3; + seedB += rotateRight(seedA, 23); + output[0] = seedA + part4; + output[1] = seedB + c; + } + + /* + * Compute an 8-byte hash of a byte array of length greater than 64 bytes. + */ + private static long fullFingerprint(byte[] bytes, int offset, int length) { + // For lengths over 64 bytes we hash the end first, and then as we + // loop we keep 56 bytes of state: v, w, x, y, and z. + long x = load64(bytes, offset); + long y = load64(bytes, offset + length - 16) ^ K1; + long z = load64(bytes, offset + length - 56) ^ K0; + long[] v = new long[2]; + long[] w = new long[2]; + weakHashLength32WithSeeds(bytes, offset + length - 64, length, y, v); + weakHashLength32WithSeeds(bytes, offset + length - 32, length * K1, K0, w); + z += shiftMix(v[1]) * K1; + x = rotateRight(z + x, 39) * K1; + y = rotateRight(y, 33) * K1; + + // Decrease length to the nearest multiple of 64, and operate on 64-byte chunks. + length = (length - 1) & ~63; + do { + x = rotateRight(x + y + v[0] + load64(bytes, offset + 16), 37) * K1; + y = rotateRight(y + v[1] + load64(bytes, offset + 48), 42) * K1; + x ^= w[1]; + y ^= v[0]; + z = rotateRight(z ^ w[0], 33); + weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v); + weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y, w); + long tmp = z; + z = x; + x = tmp; + offset += 64; + length -= 64; + } while (length != 0); + return hash128to64(hash128to64(v[0], w[0]) + shiftMix(y) * K1 + z, hash128to64(v[1], w[1]) + x); + } + + private static long hashLength33To64(byte[] bytes, int offset, int length) { + long z = load64(bytes, offset + 24); + long a = load64(bytes, offset) + (length + load64(bytes, offset + length - 16)) * K0; + long b = rotateRight(a + z, 52); + long c = rotateRight(a, 37); + a += load64(bytes, offset + 8); + c += rotateRight(a, 7); + a += load64(bytes, offset + 16); + long vf = a + z; + long vs = b + rotateRight(a, 31) + c; + a = load64(bytes, offset + 16) + load64(bytes, offset + length - 32); + z = load64(bytes, offset + length - 8); + b = rotateRight(a + z, 52); + c = rotateRight(a, 37); + a += load64(bytes, offset + length - 24); + c += rotateRight(a, 7); + a += load64(bytes, offset + length - 16); + long wf = a + z; + long ws = b + rotateRight(a, 31) + c; + long r = shiftMix((vf + ws) * K2 + (wf + vs) * K0); + return shiftMix(r * K0 + vs) * K2; + } + + @VisibleForTesting + static long murmurHash64WithSeed(byte[] bytes, int offset, int length, long seed) { + long mul = K3; + int topBit = 0x7; + + int lengthAligned = length & ~topBit; + int lengthRemainder = length & topBit; + long hash = seed ^ (length * mul); + + for (int i = 0; i < lengthAligned; i += 8) { + long loaded = load64(bytes, offset + i); + long data = shiftMix(loaded * mul) * mul; + hash ^= data; + hash *= mul; + } + + if (lengthRemainder != 0) { + long data = load64Safely(bytes, offset + lengthAligned, lengthRemainder); + hash ^= data; + hash *= mul; + } + + hash = shiftMix(hash) * mul; + hash = shiftMix(hash); + return hash; + } +} diff --git a/guava/src/com/google/common/hash/Funnels.java b/guava/src/com/google/common/hash/Funnels.java index 66738361c..b8e63d504 100644 --- a/guava/src/com/google/common/hash/Funnels.java +++ b/guava/src/com/google/common/hash/Funnels.java @@ -168,7 +168,7 @@ public final class Funnels { */ public static <E extends @Nullable Object> Funnel<Iterable<? extends E>> sequentialFunnel( Funnel<E> elementFunnel) { - return new SequentialFunnel<E>(elementFunnel); + return new SequentialFunnel<>(elementFunnel); } private static class SequentialFunnel<E extends @Nullable Object> diff --git a/guava/src/com/google/common/hash/Hashing.java b/guava/src/com/google/common/hash/Hashing.java index dd6536773..afff20c74 100644 --- a/guava/src/com/google/common/hash/Hashing.java +++ b/guava/src/com/google/common/hash/Hashing.java @@ -17,11 +17,11 @@ package com.google.common.hash; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.errorprone.annotations.Immutable; import java.security.Key; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.zip.Adler32; @@ -42,7 +42,6 @@ import javax.crypto.spec.SecretKeySpec; * @author Kurt Alfred Kluever * @since 11.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class Hashing { /** @@ -470,6 +469,30 @@ public final class Hashing { } /** + * Returns a hash function implementing the Fingerprint2011 hashing function (64 hash bits). + * + * <p>This is designed for generating persistent fingerprints of strings. It isn't + * cryptographically secure, but it produces a high-quality hash with few collisions. Fingerprints + * generated using this are byte-wise identical to those created using the C++ version, but note + * that this uses unsigned integers (see {@link com.google.common.primitives.UnsignedInts}). + * Comparisons between the two should take this into account. + * + * <p>Fingerprint2011() is a form of Murmur2 on strings up to 32 bytes and a form of CityHash for + * longer strings. It could have been one or the other throughout. The main advantage of the + * combination is that CityHash has a bunch of special cases for short strings that don't need to + * be replicated here. The result will never be 0 or 1. + * + * <p>This function is best understood as a <a + * href="https://en.wikipedia.org/wiki/Fingerprint_(computing)">fingerprint</a> rather than a true + * <a href="https://en.wikipedia.org/wiki/Hash_function">hash function</a>. + * + * @since 31.1 + */ + public static HashFunction fingerprint2011() { + return Fingerprint2011.FINGERPRINT_2011; + } + + /** * Assigns to {@code hashCode} a "bucket" in the range {@code [0, buckets)}, in a uniform manner * that minimizes the need for remapping as {@code buckets} grows. That is, {@code * consistentHash(h, n)} equals: @@ -621,7 +644,7 @@ public final class Hashing { List<HashFunction> list = new ArrayList<>(); list.add(first); list.add(second); - list.addAll(Arrays.asList(rest)); + Collections.addAll(list, rest); return new ConcatenatedHashFunction(list.toArray(new HashFunction[0])); } @@ -642,7 +665,7 @@ public final class Hashing { for (HashFunction hashFunction : hashFunctions) { list.add(hashFunction); } - checkArgument(list.size() > 0, "number of hash functions (%s) must be > 0", list.size()); + checkArgument(!list.isEmpty(), "number of hash functions (%s) must be > 0", list.size()); return new ConcatenatedHashFunction(list.toArray(new HashFunction[0])); } diff --git a/guava/src/com/google/common/hash/LittleEndianByteArray.java b/guava/src/com/google/common/hash/LittleEndianByteArray.java index 15d8b2cfb..625201547 100644 --- a/guava/src/com/google/common/hash/LittleEndianByteArray.java +++ b/guava/src/com/google/common/hash/LittleEndianByteArray.java @@ -243,7 +243,7 @@ final class LittleEndianByteArray { * which will have an efficient native implementation in JDK 9. * */ - final String arch = System.getProperty("os.arch"); + String arch = System.getProperty("os.arch"); if ("amd64".equals(arch)) { theGetter = ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN) diff --git a/guava/src/com/google/common/hash/LongAddables.java b/guava/src/com/google/common/hash/LongAddables.java index 370030dab..7c371ec88 100644 --- a/guava/src/com/google/common/hash/LongAddables.java +++ b/guava/src/com/google/common/hash/LongAddables.java @@ -29,7 +29,8 @@ final class LongAddables { static { Supplier<LongAddable> supplier; try { - new LongAdder(); // trigger static initialization of the LongAdder class, which may fail + // trigger static initialization of the LongAdder class, which may fail + LongAdder unused = new LongAdder(); supplier = new Supplier<LongAddable>() { @Override diff --git a/guava/src/com/google/common/hash/MacHashFunction.java b/guava/src/com/google/common/hash/MacHashFunction.java index 031b1c017..6d53a54c3 100644 --- a/guava/src/com/google/common/hash/MacHashFunction.java +++ b/guava/src/com/google/common/hash/MacHashFunction.java @@ -58,7 +58,7 @@ final class MacHashFunction extends AbstractHashFunction { private static boolean supportsClone(Mac mac) { try { - mac.clone(); + Object unused = mac.clone(); return true; } catch (CloneNotSupportedException e) { return false; diff --git a/guava/src/com/google/common/hash/MessageDigestHashFunction.java b/guava/src/com/google/common/hash/MessageDigestHashFunction.java index 48b47b0f0..43fc087f2 100644 --- a/guava/src/com/google/common/hash/MessageDigestHashFunction.java +++ b/guava/src/com/google/common/hash/MessageDigestHashFunction.java @@ -61,7 +61,7 @@ final class MessageDigestHashFunction extends AbstractHashFunction implements Se private static boolean supportsClone(MessageDigest digest) { try { - digest.clone(); + Object unused = digest.clone(); return true; } catch (CloneNotSupportedException e) { return false; diff --git a/guava/src/com/google/common/hash/ParametricNullness.java b/guava/src/com/google/common/hash/ParametricNullness.java index 2ae8d4200..460106c09 100644 --- a/guava/src/com/google/common/hash/ParametricNullness.java +++ b/guava/src/com/google/common/hash/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/html/ParametricNullness.java b/guava/src/com/google/common/html/ParametricNullness.java index 9a62c35ba..61b446164 100644 --- a/guava/src/com/google/common/html/ParametricNullness.java +++ b/guava/src/com/google/common/html/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/io/BaseEncoding.java b/guava/src/com/google/common/io/BaseEncoding.java index f42857c35..0d6f2e068 100644 --- a/guava/src/com/google/common/io/BaseEncoding.java +++ b/guava/src/com/google/common/io/BaseEncoding.java @@ -176,7 +176,7 @@ public abstract class BaseEncoding { * Returns a {@code ByteSink} that writes base-encoded bytes to the specified {@code CharSink}. */ @GwtIncompatible // ByteSink,CharSink - public final ByteSink encodingSink(final CharSink encodedSink) { + public final ByteSink encodingSink(CharSink encodedSink) { checkNotNull(encodedSink); return new ByteSink() { @Override @@ -247,7 +247,7 @@ public abstract class BaseEncoding { * CharSource}. */ @GwtIncompatible // ByteSource,CharSource - public final ByteSource decodingSource(final CharSource encodedSource) { + public final ByteSource decodingSource(CharSource encodedSource) { checkNotNull(encodedSource); return new ByteSource() { @Override @@ -588,7 +588,7 @@ public abstract class BaseEncoding { @GwtIncompatible // Writer,OutputStream @Override - public OutputStream encodingStream(final Writer out) { + public OutputStream encodingStream(Writer out) { checkNotNull(out); return new OutputStream() { int bitBuffer = 0; @@ -650,7 +650,7 @@ public abstract class BaseEncoding { bitBuffer <<= 8; // Add additional zero byte in the end. } // Position of first character is length of bitBuffer minus bitsPerChar. - final int bitOffset = (len + 1) * 8 - alphabet.bitsPerChar; + int bitOffset = (len + 1) * 8 - alphabet.bitsPerChar; int bitsProcessed = 0; while (bitsProcessed < len * 8) { int charIndex = (int) (bitBuffer >>> (bitOffset - bitsProcessed)) & alphabet.mask; @@ -718,7 +718,7 @@ public abstract class BaseEncoding { chunk |= alphabet.decode(chars.charAt(charIdx + charsProcessed++)); } } - final int minOffset = alphabet.bytesPerChunk * 8 - charsProcessed * alphabet.bitsPerChar; + int minOffset = alphabet.bytesPerChunk * 8 - charsProcessed * alphabet.bitsPerChar; for (int offset = (alphabet.bytesPerChunk - 1) * 8; offset >= minOffset; offset -= 8) { target[bytesWritten++] = (byte) ((chunk >>> offset) & 0xFF); } @@ -728,7 +728,7 @@ public abstract class BaseEncoding { @Override @GwtIncompatible // Reader,InputStream - public InputStream decodingStream(final Reader reader) { + public InputStream decodingStream(Reader reader) { checkNotNull(reader); return new InputStream() { int bitBuffer = 0; @@ -992,7 +992,7 @@ public abstract class BaseEncoding { } @GwtIncompatible - static Reader ignoringReader(final Reader delegate, final String toIgnore) { + static Reader ignoringReader(Reader delegate, String toIgnore) { checkNotNull(delegate); checkNotNull(toIgnore); return new Reader() { @@ -1018,7 +1018,7 @@ public abstract class BaseEncoding { } static Appendable separatingAppendable( - final Appendable delegate, final String separator, final int afterEveryChars) { + Appendable delegate, String separator, int afterEveryChars) { checkNotNull(delegate); checkNotNull(separator); checkArgument(afterEveryChars > 0); @@ -1049,10 +1049,8 @@ public abstract class BaseEncoding { } @GwtIncompatible // Writer - static Writer separatingWriter( - final Writer delegate, final String separator, final int afterEveryChars) { - final Appendable separatingAppendable = - separatingAppendable(delegate, separator, afterEveryChars); + static Writer separatingWriter(Writer delegate, String separator, int afterEveryChars) { + Appendable separatingAppendable = separatingAppendable(delegate, separator, afterEveryChars); return new Writer() { @Override public void write(int c) throws IOException { @@ -1103,7 +1101,7 @@ public abstract class BaseEncoding { @GwtIncompatible // Writer,OutputStream @Override - public OutputStream encodingStream(final Writer output) { + public OutputStream encodingStream(Writer output) { return delegate.encodingStream(separatingWriter(output, separator, afterEveryChars)); } @@ -1143,7 +1141,7 @@ public abstract class BaseEncoding { @Override @GwtIncompatible // Reader,InputStream - public InputStream decodingStream(final Reader reader) { + public InputStream decodingStream(Reader reader) { return delegate.decodingStream(ignoringReader(reader, separator)); } diff --git a/guava/src/com/google/common/io/ByteStreams.java b/guava/src/com/google/common/io/ByteStreams.java index 2f1f6690e..99213bf16 100644 --- a/guava/src/com/google/common/io/ByteStreams.java +++ b/guava/src/com/google/common/io/ByteStreams.java @@ -18,6 +18,8 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkPositionIndex; import static com.google.common.base.Preconditions.checkPositionIndexes; +import static java.lang.Math.max; +import static java.lang.Math.min; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; @@ -170,13 +172,18 @@ public final class ByteStreams { */ private static byte[] toByteArrayInternal(InputStream in, Queue<byte[]> bufs, int totalLen) throws IOException { - // Starting with an 8k buffer, double the size of each successive buffer. Buffers are retained - // in a deque so that there's no copying between buffers while reading and so all of the bytes - // in each new allocated buffer are available for reading from the stream. - for (int bufSize = BUFFER_SIZE; + // Roughly size to match what has been read already. Some file systems, such as procfs, return 0 + // as their length. These files are very small, so it's wasteful to allocate an 8KB buffer. + int initialBufferSize = min(BUFFER_SIZE, max(128, Integer.highestOneBit(totalLen) * 2)); + // Starting with an 8k buffer, double the size of each successive buffer. Smaller buffers + // quadruple in size until they reach 8k, to minimize the number of small reads for longer + // streams. Buffers are retained in a deque so that there's no copying between buffers while + // reading and so all of the bytes in each new allocated buffer are available for reading from + // the stream. + for (int bufSize = initialBufferSize; totalLen < MAX_ARRAY_LEN; - bufSize = IntMath.saturatedMultiply(bufSize, 2)) { - byte[] buf = new byte[Math.min(bufSize, MAX_ARRAY_LEN - totalLen)]; + bufSize = IntMath.saturatedMultiply(bufSize, bufSize < 4096 ? 4 : 2)) { + byte[] buf = new byte[min(bufSize, MAX_ARRAY_LEN - totalLen)]; bufs.add(buf); int off = 0; while (off < buf.length) { @@ -200,11 +207,18 @@ public final class ByteStreams { } private static byte[] combineBuffers(Queue<byte[]> bufs, int totalLen) { - byte[] result = new byte[totalLen]; - int remaining = totalLen; + if (bufs.isEmpty()) { + return new byte[0]; + } + byte[] result = bufs.remove(); + if (result.length == totalLen) { + return result; + } + int remaining = totalLen - result.length; + result = Arrays.copyOf(result, totalLen); while (remaining > 0) { byte[] buf = bufs.remove(); - int bytesToCopy = Math.min(remaining, buf.length); + int bytesToCopy = min(remaining, buf.length); int resultOffset = totalLen - remaining; System.arraycopy(buf, 0, result, resultOffset, bytesToCopy); remaining -= bytesToCopy; @@ -256,7 +270,7 @@ public final class ByteStreams { } // the stream was longer, so read the rest normally - Queue<byte[]> bufs = new ArrayDeque<byte[]>(TO_BYTE_ARRAY_DEQUE_SIZE + 2); + Queue<byte[]> bufs = new ArrayDeque<>(TO_BYTE_ARRAY_DEQUE_SIZE + 2); bufs.add(bytes); bufs.add(new byte[] {(byte) b}); return toByteArrayInternal(in, bufs, bytes.length + 1); @@ -657,6 +671,7 @@ public final class ByteStreams { @Override public void write(byte[] b, int off, int len) { checkNotNull(b); + checkPositionIndexes(off, off + len, b.length); } @Override @@ -819,7 +834,7 @@ public final class ByteStreams { * either the full amount has been skipped or until the end of the stream is reached, whichever * happens first. Returns the total number of bytes skipped. */ - static long skipUpTo(InputStream in, final long n) throws IOException { + static long skipUpTo(InputStream in, long n) throws IOException { long totalSkipped = 0; // A buffer is allocated if skipSafely does not skip any bytes. byte[] buf = null; diff --git a/guava/src/com/google/common/io/CharStreams.java b/guava/src/com/google/common/io/CharStreams.java index c41419423..d36f9a3c5 100644 --- a/guava/src/com/google/common/io/CharStreams.java +++ b/guava/src/com/google/common/io/CharStreams.java @@ -34,8 +34,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Provides utility methods for working with character streams. * - * <p>All method parameters must be non-null unless documented otherwise. - * * <p>Some of the methods in this class take arguments with a generic type of {@code Readable & * Closeable}. A {@link java.io.Reader} implements both of those interfaces. Similarly for {@code * Appendable & Closeable} and {@link java.io.Writer}. diff --git a/guava/src/com/google/common/io/Files.java b/guava/src/com/google/common/io/Files.java index bf6289e90..ba5528ff8 100644 --- a/guava/src/com/google/common/io/Files.java +++ b/guava/src/com/google/common/io/Files.java @@ -32,6 +32,7 @@ import com.google.common.graph.Traverser; import com.google.common.hash.HashCode; import com.google.common.hash.HashFunction; import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.errorprone.annotations.InlineMe; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -85,7 +86,6 @@ public final class Files { * helpful predefined constants * @return the buffered reader */ - @Beta public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); @@ -104,7 +104,6 @@ public final class Files { * helpful predefined constants * @return the buffered writer */ - @Beta public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException { checkNotNull(file); checkNotNull(charset); @@ -235,7 +234,6 @@ public final class Files { * (2^31 - 1) * @throws IOException if an I/O error occurs */ - @Beta public static byte[] toByteArray(File file) throws IOException { return asByteSource(file).read(); } @@ -248,11 +246,12 @@ public final class Files { * helpful predefined constants * @return a string containing all the characters from the file * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).read()}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).read()}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).read()", + imports = "com.google.common.io.Files") public static String toString(File file, Charset charset) throws IOException { return asCharSource(file, charset).read(); } @@ -267,7 +266,6 @@ public final class Files { * @param to the destination file * @throws IOException if an I/O error occurs */ - @Beta public static void write(byte[] from, File to) throws IOException { asByteSink(to).write(from); } @@ -280,11 +278,12 @@ public final class Files { * @param charset the charset used to encode the output stream; see {@link StandardCharsets} for * helpful predefined constants * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSink(to, charset).write(from)}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asCharSink(to, charset).write(from)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSink(to, charset).write(from)", + imports = "com.google.common.io.Files") public static void write(CharSequence from, File to, Charset charset) throws IOException { asCharSink(to, charset).write(from); } @@ -299,7 +298,6 @@ public final class Files { * @param to the output stream * @throws IOException if an I/O error occurs */ - @Beta public static void copy(File from, OutputStream to) throws IOException { asByteSource(from).copyTo(to); } @@ -323,7 +321,6 @@ public final class Files { * @throws IOException if an I/O error occurs * @throws IllegalArgumentException if {@code from.equals(to)} */ - @Beta public static void copy(File from, File to) throws IOException { checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to); asByteSource(from).copyTo(asByteSink(to)); @@ -337,11 +334,12 @@ public final class Files { * helpful predefined constants * @param to the appendable object * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(from, charset).copyTo(to)}. This method is scheduled to - * be removed in October 2019. + * @deprecated Prefer {@code asCharSource(from, charset).copyTo(to)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(from, charset).copyTo(to)", + imports = "com.google.common.io.Files") public static void copy(File from, Charset charset, Appendable to) throws IOException { asCharSource(from, charset).copyTo(to); @@ -358,8 +356,10 @@ public final class Files { * @deprecated Prefer {@code asCharSink(to, charset, FileWriteMode.APPEND).write(from)}. This * method is scheduled to be removed in October 2019. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSink(to, charset, FileWriteMode.APPEND).write(from)", + imports = {"com.google.common.io.FileWriteMode", "com.google.common.io.Files"}) public static void append(CharSequence from, File to, Charset charset) throws IOException { asCharSink(to, charset, FileWriteMode.APPEND).write(from); @@ -370,7 +370,6 @@ public final class Files { * * @throws IOException if an I/O error occurs */ - @Beta public static boolean equal(File file1, File file2) throws IOException { checkNotNull(file1); checkNotNull(file2); @@ -452,7 +451,6 @@ public final class Files { * @param file the file to create or update * @throws IOException if an I/O error occurs */ - @Beta @SuppressWarnings("GoodTime") // reading system time without TimeSource public static void touch(File file) throws IOException { checkNotNull(file); @@ -470,7 +468,6 @@ public final class Files { * directories of the specified file could not be created. * @since 4.0 */ - @Beta public static void createParentDirs(File file) throws IOException { checkNotNull(file); File parent = file.getCanonicalFile().getParentFile(); @@ -501,7 +498,6 @@ public final class Files { * @throws IOException if an I/O error occurs * @throws IllegalArgumentException if {@code from.equals(to)} */ - @Beta public static void move(File from, File to) throws IOException { checkNotNull(from); checkNotNull(to); @@ -527,11 +523,12 @@ public final class Files { * helpful predefined constants * @return the first line, or null if the file is empty * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).readFirstLine()}. This method is - * scheduled to be removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).readFirstLine()}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).readFirstLine()", + imports = "com.google.common.io.Files") @CheckForNull public static String readFirstLine(File file, Charset charset) throws IOException { @@ -554,7 +551,6 @@ public final class Files { * @return a mutable {@link List} containing all the lines * @throws IOException if an I/O error occurs */ - @Beta public static List<String> readLines(File file, Charset charset) throws IOException { // don't use asCharSource(file, charset).readLines() because that returns // an immutable list, which would change the behavior of this method @@ -586,11 +582,12 @@ public final class Files { * @param callback the {@link LineProcessor} to use to handle the lines * @return the output of processing the lines * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asCharSource(file, charset).readLines(callback)}. This method is - * scheduled to be removed in October 2019. + * @deprecated Prefer {@code asCharSource(file, charset).readLines(callback)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asCharSource(file, charset).readLines(callback)", + imports = "com.google.common.io.Files") @CanIgnoreReturnValue // some processors won't return a useful result @ParametricNullness public @@ -608,11 +605,12 @@ public final class Files { * @param processor the object to which the bytes of the file are passed. * @return the result of the byte processor * @throws IOException if an I/O error occurs - * @deprecated Prefer {@code asByteSource(file).read(processor)}. This method is scheduled to be - * removed in October 2019. + * @deprecated Prefer {@code asByteSource(file).read(processor)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asByteSource(file).read(processor)", + imports = "com.google.common.io.Files") @CanIgnoreReturnValue // some processors won't return a useful result @ParametricNullness public @@ -629,11 +627,12 @@ public final class Files { * @return the {@link HashCode} of all of the bytes in the file * @throws IOException if an I/O error occurs * @since 12.0 - * @deprecated Prefer {@code asByteSource(file).hash(hashFunction)}. This method is scheduled to - * be removed in October 2019. + * @deprecated Prefer {@code asByteSource(file).hash(hashFunction)}. */ - @Beta @Deprecated + @InlineMe( + replacement = "Files.asByteSource(file).hash(hashFunction)", + imports = "com.google.common.io.Files") public static HashCode hash(File file, HashFunction hashFunction) throws IOException { return asByteSource(file).hash(hashFunction); @@ -654,7 +653,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file) throws IOException { checkNotNull(file); return map(file, MapMode.READ_ONLY); @@ -677,7 +675,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file, MapMode mode) throws IOException { return mapInternal(file, mode, -1); } @@ -701,7 +698,6 @@ public final class Files { * @see FileChannel#map(MapMode, long, long) * @since 2.0 */ - @Beta public static MappedByteBuffer map(File file, MapMode mode, long size) throws IOException { checkArgument(size >= 0, "size (%s) may not be negative", size); return mapInternal(file, mode, size); @@ -745,7 +741,6 @@ public final class Files { * * @since 11.0 */ - @Beta public static String simplifyPath(String pathname) { checkNotNull(pathname); if (pathname.length() == 0) { @@ -806,7 +801,6 @@ public final class Files { * * @since 11.0 */ - @Beta public static String getFileExtension(String fullName) { checkNotNull(fullName); String fileName = new File(fullName).getName(); @@ -824,7 +818,6 @@ public final class Files { * @return The file name without its path or extension. * @since 14.0 */ - @Beta public static String getNameWithoutExtension(String file) { checkNotNull(file); String fileName = new File(file).getName(); @@ -880,7 +873,6 @@ public final class Files { * * @since 15.0 */ - @Beta public static Predicate<File> isDirectory() { return FilePredicate.IS_DIRECTORY; } @@ -890,7 +882,6 @@ public final class Files { * * @since 15.0 */ - @Beta public static Predicate<File> isFile() { return FilePredicate.IS_FILE; } diff --git a/guava/src/com/google/common/io/ParametricNullness.java b/guava/src/com/google/common/io/ParametricNullness.java index afa0db1f5..98da76585 100644 --- a/guava/src/com/google/common/io/ParametricNullness.java +++ b/guava/src/com/google/common/io/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/io/Resources.java b/guava/src/com/google/common/io/Resources.java index cc595fcee..d1e37070a 100644 --- a/guava/src/com/google/common/io/Resources.java +++ b/guava/src/com/google/common/io/Resources.java @@ -17,7 +17,6 @@ package com.google.common.io; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Charsets; import com.google.common.base.MoreObjects; @@ -36,14 +35,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; * methods use {@link URL} parameters, they are usually not appropriate for HTTP or other * non-classpath resources. * - * <p>All method parameters must be non-null unless documented otherwise. - * * @author Chris Nokleberg * @author Ben Yu * @author Colin Decker * @since 1.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class Resources { diff --git a/guava/src/com/google/common/math/LongMath.java b/guava/src/com/google/common/math/LongMath.java index 1e67812b7..dd5ff0694 100644 --- a/guava/src/com/google/common/math/LongMath.java +++ b/guava/src/com/google/common/math/LongMath.java @@ -425,7 +425,7 @@ public final class LongMath { // subtracting two nonnegative longs can't overflow // cmpRemToHalfDivisor has the same sign as compare(abs(rem), abs(q) / 2). if (cmpRemToHalfDivisor == 0) { // exactly on the half mark - increment = (mode == HALF_UP | (mode == HALF_EVEN & (div & 1) != 0)); + increment = (mode == HALF_UP || (mode == HALF_EVEN && (div & 1) != 0)); } else { increment = cmpRemToHalfDivisor > 0; // closer to the UP value } diff --git a/guava/src/com/google/common/math/ParametricNullness.java b/guava/src/com/google/common/math/ParametricNullness.java index c079b9781..8e57826e4 100644 --- a/guava/src/com/google/common/math/ParametricNullness.java +++ b/guava/src/com/google/common/math/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/net/HostAndPort.java b/guava/src/com/google/common/net/HostAndPort.java index 19e6b6729..a27eb65ff 100644 --- a/guava/src/com/google/common/net/HostAndPort.java +++ b/guava/src/com/google/common/net/HostAndPort.java @@ -18,11 +18,11 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.CharMatcher; import com.google.common.base.Objects; import com.google.common.base.Strings; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import java.io.Serializable; import javax.annotation.CheckForNull; @@ -60,7 +60,6 @@ import javax.annotation.CheckForNull; * @author Paul Marks * @since 10.0 */ -@Beta @Immutable @GwtCompatible @ElementTypesAreNonnullByDefault @@ -164,6 +163,7 @@ public final class HostAndPort implements Serializable { * @return if parsing was successful, a populated HostAndPort object. * @throws IllegalArgumentException if nothing meaningful could be parsed. */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static HostAndPort fromString(String hostPortString) { checkNotNull(hostPortString); String host; @@ -274,6 +274,7 @@ public final class HostAndPort implements Serializable { * @return {@code this}, to enable chaining of calls. * @throws IllegalArgumentException if bracketless IPv6 is detected. */ + @CanIgnoreReturnValue public HostAndPort requireBracketsForIPv6() { checkArgument(!hasBracketlessColons, "Possible bracketless IPv6 literal: %s", host); return this; diff --git a/guava/src/com/google/common/net/HostSpecifier.java b/guava/src/com/google/common/net/HostSpecifier.java index 7448944ab..c57f3d975 100644 --- a/guava/src/com/google/common/net/HostSpecifier.java +++ b/guava/src/com/google/common/net/HostSpecifier.java @@ -14,9 +14,9 @@ package com.google.common.net; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Preconditions; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.net.InetAddress; import java.text.ParseException; import javax.annotation.CheckForNull; @@ -41,7 +41,6 @@ import javax.annotation.CheckForNull; * @author Craig Berry * @since 5.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class HostSpecifier { @@ -71,9 +70,9 @@ public final class HostSpecifier { public static HostSpecifier fromValid(String specifier) { // Verify that no port was specified, and strip optional brackets from // IPv6 literals. - final HostAndPort parsedHost = HostAndPort.fromString(specifier); + HostAndPort parsedHost = HostAndPort.fromString(specifier); Preconditions.checkArgument(!parsedHost.hasPort()); - final String host = parsedHost.getHost(); + String host = parsedHost.getHost(); // Try to interpret the specifier as an IP address. Note we build // the address rather than using the .is* methods because we want to @@ -93,7 +92,7 @@ public final class HostSpecifier { // It is not any kind of IP address; must be a domain name or invalid. // TODO(user): different versions of this for different factories? - final InternetDomainName domain = InternetDomainName.from(host); + InternetDomainName domain = InternetDomainName.from(host); if (domain.hasPublicSuffix()) { return new HostSpecifier(domain.toString()); @@ -110,6 +109,7 @@ public final class HostSpecifier { * * @throws ParseException if the specifier is not valid. */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static HostSpecifier from(String specifier) throws ParseException { try { return fromValid(specifier); @@ -130,7 +130,7 @@ public final class HostSpecifier { */ public static boolean isValid(String specifier) { try { - fromValid(specifier); + HostSpecifier unused = fromValid(specifier); return true; } catch (IllegalArgumentException e) { return false; @@ -144,7 +144,7 @@ public final class HostSpecifier { } if (other instanceof HostSpecifier) { - final HostSpecifier that = (HostSpecifier) other; + HostSpecifier that = (HostSpecifier) other; return this.canonicalForm.equals(that.canonicalForm); } diff --git a/guava/src/com/google/common/net/HttpHeaders.java b/guava/src/com/google/common/net/HttpHeaders.java index f318da151..2ecbfaa8c 100644 --- a/guava/src/com/google/common/net/HttpHeaders.java +++ b/guava/src/com/google/common/net/HttpHeaders.java @@ -14,7 +14,6 @@ package com.google.common.net; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; /** @@ -102,7 +101,6 @@ public final class HttpHeaders { * * @since 17.0 */ - @Beta public static final String FOLLOW_ONLY_WHEN_PRERENDER_SHOWN = "Follow-Only-When-Prerender-Shown"; /** The HTTP {@code Host} header field name. */ public static final String HOST = "Host"; @@ -201,6 +199,14 @@ public final class HttpHeaders { public static final String ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; /** The HTTP {@code Access-Control-Allow-Origin} header field name. */ public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; + /** + * The HTTP <a href="https://wicg.github.io/private-network-access/#headers">{@code + * Access-Control-Allow-Private-Network}</a> header field name. + * + * @since 31.1 + */ + public static final String ACCESS_CONTROL_ALLOW_PRIVATE_NETWORK = + "Access-Control-Allow-Private-Network"; /** The HTTP {@code Access-Control-Allow-Credentials} header field name. */ public static final String ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; /** The HTTP {@code Access-Control-Expose-Headers} header field name. */ @@ -357,7 +363,7 @@ public final class HttpHeaders { * * @since 27.1 */ - @Beta public static final String SOURCE_MAP = "SourceMap"; + public static final String SOURCE_MAP = "SourceMap"; /** * The HTTP <a href="http://tools.ietf.org/html/rfc6797#section-6.1">{@code @@ -455,14 +461,14 @@ public final class HttpHeaders { * * @since 15.0 */ - @Beta public static final String PUBLIC_KEY_PINS = "Public-Key-Pins"; + public static final String PUBLIC_KEY_PINS = "Public-Key-Pins"; /** * The HTTP <a href="http://tools.ietf.org/html/draft-evans-palmer-key-pinning">{@code * Public-Key-Pins-Report-Only}</a> header field name. * * @since 15.0 */ - @Beta public static final String PUBLIC_KEY_PINS_REPORT_ONLY = "Public-Key-Pins-Report-Only"; + public static final String PUBLIC_KEY_PINS_REPORT_ONLY = "Public-Key-Pins-Report-Only"; /** * The HTTP {@code X-Request-ID} header field name. * @@ -482,7 +488,7 @@ public final class HttpHeaders { * * @since 24.1 */ - @Beta public static final String X_DOWNLOAD_OPTIONS = "X-Download-Options"; + public static final String X_DOWNLOAD_OPTIONS = "X-Download-Options"; /** The HTTP {@code X-XSS-Protection} header field name. */ public static final String X_XSS_PROTECTION = "X-XSS-Protection"; /** @@ -665,9 +671,17 @@ public final class HttpHeaders { * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-full-version">{@code * Sec-CH-UA-Full-Version}</a> header field name. * + * @deprecated Prefer {@link SEC_CH_UA_FULL_VERSION_LIST}. * @since 30.0 */ - public static final String SEC_CH_UA_FULL_VERSION = "Sec-CH-UA-Full-Version"; + @Deprecated public static final String SEC_CH_UA_FULL_VERSION = "Sec-CH-UA-Full-Version"; + /** + * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-full-version-list">{@code + * Sec-CH-UA-Full-Version}</a> header field name. + * + * @since 31.1 + */ + public static final String SEC_CH_UA_FULL_VERSION_LIST = "Sec-CH-UA-Full-Version-List"; /** * The HTTP <a href="https://wicg.github.io/ua-client-hints/#sec-ch-ua-mobile">{@code * Sec-CH-UA-Mobile}</a> header field name. diff --git a/guava/src/com/google/common/net/InetAddresses.java b/guava/src/com/google/common/net/InetAddresses.java index 4e2aa6995..d3e68db8a 100644 --- a/guava/src/com/google/common/net/InetAddresses.java +++ b/guava/src/com/google/common/net/InetAddresses.java @@ -17,13 +17,13 @@ package com.google.common.net; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.CharMatcher; import com.google.common.base.MoreObjects; import com.google.common.hash.Hashing; import com.google.common.io.ByteStreams; import com.google.common.primitives.Ints; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.math.BigInteger; import java.net.Inet4Address; import java.net.Inet6Address; @@ -95,7 +95,6 @@ import javax.annotation.CheckForNull; * @author Erik Kline * @since 5.0 */ -@Beta @GwtIncompatible @ElementTypesAreNonnullByDefault public final class InetAddresses { @@ -144,6 +143,7 @@ public final class InetAddresses { * @return {@link InetAddress} representing the argument * @throws IllegalArgumentException if the argument is not a valid IP string literal */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static InetAddress forString(String ipString) { byte[] addr = ipStringToBytes(ipString); @@ -667,7 +667,6 @@ public final class InetAddresses { * * @since 5.0 */ - @Beta public static final class TeredoInfo { private final Inet4Address server; private final Inet4Address client; diff --git a/guava/src/com/google/common/net/InternetDomainName.java b/guava/src/com/google/common/net/InternetDomainName.java index 58734497d..d71a9d5c3 100644 --- a/guava/src/com/google/common/net/InternetDomainName.java +++ b/guava/src/com/google/common/net/InternetDomainName.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ascii; import com.google.common.base.CharMatcher; @@ -26,6 +25,7 @@ import com.google.common.base.Joiner; import com.google.common.base.Optional; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import com.google.thirdparty.publicsuffix.PublicSuffixPatterns; import com.google.thirdparty.publicsuffix.PublicSuffixType; @@ -71,7 +71,6 @@ import javax.annotation.CheckForNull; * @author Catherine Berry * @since 5.0 */ -@Beta @GwtCompatible(emulated = true) @Immutable @ElementTypesAreNonnullByDefault @@ -163,7 +162,7 @@ public final class InternetDomainName { * Otherwise, it finds the first suffix of any type. */ private int findSuffixOfType(Optional<PublicSuffixType> desiredType) { - final int partsSize = parts.size(); + int partsSize = parts.size(); for (int i = 0; i < partsSize; i++) { String ancestorName = DOT_JOINER.join(parts.subList(i, partsSize)); @@ -206,6 +205,7 @@ public final class InternetDomainName { * {@link #isValid} * @since 10.0 (previously named {@code fromLenient}) */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static InternetDomainName from(String domain) { return new InternetDomainName(checkNotNull(domain)); } @@ -217,7 +217,7 @@ public final class InternetDomainName { * @return Is the domain name syntactically valid? */ private static boolean validateSyntax(List<String> parts) { - final int lastIndex = parts.size() - 1; + int lastIndex = parts.size() - 1; // Validate the last part specially, as it has different syntax rules. @@ -584,7 +584,7 @@ public final class InternetDomainName { */ public static boolean isValid(String name) { try { - from(name); + InternetDomainName unused = from(name); return true; } catch (IllegalArgumentException e) { return false; diff --git a/guava/src/com/google/common/net/MediaType.java b/guava/src/com/google/common/net/MediaType.java index ca471616a..a713d0b17 100644 --- a/guava/src/com/google/common/net/MediaType.java +++ b/guava/src/com/google/common/net/MediaType.java @@ -21,11 +21,9 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.base.Ascii; import com.google.common.base.CharMatcher; -import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Joiner.MapJoiner; import com.google.common.base.MoreObjects; @@ -37,12 +35,12 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; +import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.Immutable; import com.google.errorprone.annotations.concurrent.LazyInit; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; -import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import javax.annotation.CheckForNull; @@ -72,7 +70,6 @@ import javax.annotation.CheckForNull; * @since 12.0 * @author Gregory Kick */ -@Beta @GwtCompatible @Immutable @ElementTypesAreNonnullByDefault @@ -792,14 +789,7 @@ public final class MediaType { } private Map<String, ImmutableMultiset<String>> parametersAsMap() { - return Maps.transformValues( - parameters.asMap(), - new Function<Collection<String>, ImmutableMultiset<String>>() { - @Override - public ImmutableMultiset<String> apply(Collection<String> input) { - return ImmutableMultiset.copyOf(input); - } - }); + return Maps.transformValues(parameters.asMap(), ImmutableMultiset::copyOf); } /** @@ -1049,6 +1039,7 @@ public final class MediaType { * * @throws IllegalArgumentException if the input is not parsable */ + @CanIgnoreReturnValue // TODO(b/219820829): consider removing public static MediaType parse(String input) { checkNotNull(input); Tokenizer tokenizer = new Tokenizer(input); @@ -1063,7 +1054,7 @@ public final class MediaType { tokenizer.consumeTokenIfPresent(LINEAR_WHITE_SPACE); String attribute = tokenizer.consumeToken(TOKEN_MATCHER); tokenizer.consumeCharacter('='); - final String value; + String value; if ('"' == tokenizer.previewChar()) { tokenizer.consumeCharacter('"'); StringBuilder valueBuilder = new StringBuilder(); @@ -1096,6 +1087,7 @@ public final class MediaType { this.input = input; } + @CanIgnoreReturnValue String consumeTokenIfPresent(CharMatcher matcher) { checkState(hasMore()); int startPosition = position; @@ -1118,6 +1110,7 @@ public final class MediaType { return c; } + @CanIgnoreReturnValue char consumeCharacter(char c) { checkState(hasMore()); checkState(previewChar() == c); @@ -1185,14 +1178,10 @@ public final class MediaType { Multimap<String, String> quotedParameters = Multimaps.transformValues( parameters, - new Function<String, String>() { - @Override - public String apply(String value) { - return (TOKEN_MATCHER.matchesAllOf(value) && !value.isEmpty()) + (String value) -> + (TOKEN_MATCHER.matchesAllOf(value) && !value.isEmpty()) ? value - : escapeAndQuote(value); - } - }); + : escapeAndQuote(value)); PARAMETER_JOINER.appendTo(builder, quotedParameters.entries()); } return builder.toString(); diff --git a/guava/src/com/google/common/net/ParametricNullness.java b/guava/src/com/google/common/net/ParametricNullness.java index acc3eab57..1ad2e27c0 100644 --- a/guava/src/com/google/common/net/ParametricNullness.java +++ b/guava/src/com/google/common/net/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/net/PercentEscaper.java b/guava/src/com/google/common/net/PercentEscaper.java index 7c7de9bb3..929014731 100644 --- a/guava/src/com/google/common/net/PercentEscaper.java +++ b/guava/src/com/google/common/net/PercentEscaper.java @@ -16,7 +16,6 @@ package com.google.common.net; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.UnicodeEscaper; import javax.annotation.CheckForNull; @@ -50,7 +49,6 @@ import javax.annotation.CheckForNull; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public final class PercentEscaper extends UnicodeEscaper { diff --git a/guava/src/com/google/common/net/package-info.java b/guava/src/com/google/common/net/package-info.java index d9db26637..d55642d94 100644 --- a/guava/src/com/google/common/net/package-info.java +++ b/guava/src/com/google/common/net/package-info.java @@ -21,7 +21,9 @@ * * @author Craig Berry */ +@CheckReturnValue @ParametersAreNonnullByDefault package com.google.common.net; +import com.google.errorprone.annotations.CheckReturnValue; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/primitives/ParametricNullness.java b/guava/src/com/google/common/primitives/ParametricNullness.java index 17d606c2c..4289b9b16 100644 --- a/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/guava/src/com/google/common/primitives/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/primitives/UnsignedBytes.java b/guava/src/com/google/common/primitives/UnsignedBytes.java index bf9a3066a..db4f489e4 100644 --- a/guava/src/com/google/common/primitives/UnsignedBytes.java +++ b/guava/src/com/google/common/primitives/UnsignedBytes.java @@ -365,7 +365,7 @@ public final class UnsignedBytes { @Override public int compare(byte[] left, byte[] right) { - final int stride = 8; + int stride = 8; int minLength = Math.min(left.length, right.length); int strideLimit = minLength & ~(stride - 1); int i; diff --git a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java index 4666f992c..ff921959d 100644 --- a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java +++ b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java @@ -14,7 +14,6 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; @@ -39,7 +38,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Ben Yu * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault public abstract class AbstractInvocationHandler implements InvocationHandler { diff --git a/guava/src/com/google/common/reflect/ClassPath.java b/guava/src/com/google/common/reflect/ClassPath.java index de693da5f..d15bb5055 100644 --- a/guava/src/com/google/common/reflect/ClassPath.java +++ b/guava/src/com/google/common/reflect/ClassPath.java @@ -20,10 +20,8 @@ import static com.google.common.base.StandardSystemProperty.JAVA_CLASS_PATH; import static com.google.common.base.StandardSystemProperty.PATH_SEPARATOR; import static java.util.logging.Level.WARNING; -import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.CharMatcher; -import com.google.common.base.Predicate; import com.google.common.base.Splitter; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; @@ -92,7 +90,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 14.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class ClassPath { private static final Logger logger = Logger.getLogger(ClassPath.class.getName()); @@ -167,13 +164,7 @@ public final class ClassPath { public ImmutableSet<ClassInfo> getTopLevelClasses() { return FluentIterable.from(resources) .filter(ClassInfo.class) - .filter( - new Predicate<ClassInfo>() { - @Override - public boolean apply(ClassInfo info) { - return info.isTopLevel(); - } - }) + .filter(ClassInfo::isTopLevel) .toSet(); } @@ -211,7 +202,6 @@ public final class ClassPath { * * @since 14.0 */ - @Beta public static class ResourceInfo { private final File file; private final String resourceName; @@ -307,7 +297,6 @@ public final class ClassPath { * * @since 14.0 */ - @Beta public static final class ClassInfo extends ResourceInfo { private final String className; diff --git a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java index 7fad5ded3..6273704a1 100644 --- a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java @@ -14,12 +14,12 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import com.google.common.collect.ForwardingMap; import com.google.common.collect.ImmutableMap; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.DoNotCall; import java.util.Map; +import javax.annotation.CheckForNull; /** * A type-to-instance map backed by an {@link ImmutableMap}. See also {@link @@ -28,18 +28,18 @@ import java.util.Map; * @author Ben Yu * @since 13.0 */ -@Beta +@ElementTypesAreNonnullByDefault public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B> implements TypeToInstanceMap<B> { /** Returns an empty type to instance map. */ public static <B> ImmutableTypeToInstanceMap<B> of() { - return new ImmutableTypeToInstanceMap<B>(ImmutableMap.<TypeToken<? extends B>, B>of()); + return new ImmutableTypeToInstanceMap<>(ImmutableMap.<TypeToken<? extends B>, B>of()); } /** Returns a new builder. */ public static <B> Builder<B> builder() { - return new Builder<B>(); + return new Builder<>(); } /** @@ -58,7 +58,6 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken * * @since 13.0 */ - @Beta public static final class Builder<B> { private final ImmutableMap.Builder<TypeToken<? extends B>, B> mapBuilder = ImmutableMap.builder(); @@ -91,7 +90,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken * @throws IllegalArgumentException if duplicate keys were added */ public ImmutableTypeToInstanceMap<B> build() { - return new ImmutableTypeToInstanceMap<B>(mapBuilder.build()); + return new ImmutableTypeToInstanceMap<>(mapBuilder.buildOrThrow()); } } @@ -102,11 +101,13 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken } @Override + @CheckForNull public <T extends B> T getInstance(TypeToken<T> type) { return trustedGet(type.rejectTypeVariables()); } @Override + @CheckForNull public <T extends B> T getInstance(Class<T> type) { return trustedGet(TypeToken.of(type)); } @@ -121,6 +122,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public <T extends B> T putInstance(TypeToken<T> type, T value) { throw new UnsupportedOperationException(); } @@ -135,6 +137,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public <T extends B> T putInstance(Class<T> type, T value) { throw new UnsupportedOperationException(); } @@ -149,6 +152,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public B put(TypeToken<? extends B> key, B value) { throw new UnsupportedOperationException(); } @@ -172,6 +176,7 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken } @SuppressWarnings("unchecked") // value could not get in if not a T + @CheckForNull private <T extends B> T trustedGet(TypeToken<T> type) { return (T) delegate.get(type); } diff --git a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index 2d21dbbcc..9542e0a7e 100644 --- a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -16,8 +16,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; -import com.google.common.base.Function; import com.google.common.collect.ForwardingMap; import com.google.common.collect.ForwardingMapEntry; import com.google.common.collect.ForwardingSet; @@ -28,39 +26,47 @@ import com.google.errorprone.annotations.DoNotCall; import java.util.Iterator; import java.util.Map; import java.util.Set; +import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.Nullable; /** * A mutable type-to-instance map. See also {@link ImmutableTypeToInstanceMap}. * + * <p>This implementation <i>does</i> support null values, despite how it is annotated; see + * discussion at {@link TypeToInstanceMap}. + * * @author Ben Yu * @since 13.0 */ -@Beta +@ElementTypesAreNonnullByDefault public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? extends B>, B> implements TypeToInstanceMap<B> { private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap(); @Override - public <T extends B> @Nullable T getInstance(Class<T> type) { + @CheckForNull + public <T extends B> T getInstance(Class<T> type) { return trustedGet(TypeToken.of(type)); } @Override - public <T extends B> @Nullable T getInstance(TypeToken<T> type) { + @CheckForNull + public <T extends B> T getInstance(TypeToken<T> type) { return trustedGet(type.rejectTypeVariables()); } @Override @CanIgnoreReturnValue - public <T extends B> @Nullable T putInstance(Class<T> type, @Nullable T value) { + @CheckForNull + public <T extends B> T putInstance(Class<T> type, T value) { return trustedPut(TypeToken.of(type), value); } @Override @CanIgnoreReturnValue - public <T extends B> @Nullable T putInstance(TypeToken<T> type, @Nullable T value) { + @CheckForNull + public <T extends B> T putInstance(TypeToken<T> type, T value) { return trustedPut(type.rejectTypeVariables(), value); } @@ -74,6 +80,7 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? @Deprecated @Override @DoNotCall("Always throws UnsupportedOperationException") + @CheckForNull public B put(TypeToken<? extends B> key, B value) { throw new UnsupportedOperationException("Please use putInstance() instead."); } @@ -102,12 +109,14 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? } @SuppressWarnings("unchecked") // value could not get in if not a T - private <T extends B> @Nullable T trustedPut(TypeToken<T> type, @Nullable T value) { + @CheckForNull + private <T extends B> T trustedPut(TypeToken<T> type, T value) { return (T) backingMap.put(type, value); } @SuppressWarnings("unchecked") // value could not get in if not a T - private <T extends B> @Nullable T trustedGet(TypeToken<T> type) { + @CheckForNull + private <T extends B> T trustedGet(TypeToken<T> type) { return (T) backingMap.get(type); } @@ -115,7 +124,7 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? private final Entry<K, V> delegate; - static <K, V> Set<Entry<K, V>> transformEntries(final Set<Entry<K, V>> entries) { + static <K, V> Set<Entry<K, V>> transformEntries(Set<Entry<K, V>> entries) { return new ForwardingSet<Map.Entry<K, V>>() { @Override protected Set<Entry<K, V>> delegate() { @@ -129,25 +138,27 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<? @Override public Object[] toArray() { - return standardToArray(); + /* + * standardToArray returns `@Nullable Object[]` rather than `Object[]` but only because it + * can be used with collections that may contain null. This collection is a collection of + * non-null Entry objects (Entry objects that might contain null values but are not + * themselves null), so we can treat it as a plain `Object[]`. + */ + @SuppressWarnings("nullness") + Object[] result = standardToArray(); + return result; } @Override - public <T> T[] toArray(T[] array) { + @SuppressWarnings("nullness") // b/192354773 in our checker affects toArray declarations + public <T extends @Nullable Object> T[] toArray(T[] array) { return standardToArray(array); } }; } private static <K, V> Iterator<Entry<K, V>> transformEntries(Iterator<Entry<K, V>> entries) { - return Iterators.transform( - entries, - new Function<Entry<K, V>, Entry<K, V>>() { - @Override - public Entry<K, V> apply(Entry<K, V> entry) { - return new UnmodifiableEntry<>(entry); - } - }); + return Iterators.transform(entries, UnmodifiableEntry::new); } private UnmodifiableEntry(java.util.Map.Entry<K, V> delegate) { diff --git a/guava/src/com/google/common/reflect/Parameter.java b/guava/src/com/google/common/reflect/Parameter.java index 61ab85a3f..c3c46eca9 100644 --- a/guava/src/com/google/common/reflect/Parameter.java +++ b/guava/src/com/google/common/reflect/Parameter.java @@ -28,6 +28,10 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Represents a method or constructor parameter. * + * <p><b>Note:</b> Since Java 8 introduced {@link java.lang.reflect.Parameter} to represent method + * and constructor parameters, this class is no longer necessary. We intend to deprecate it in a + * future version. + * * @author Ben Yu * @since 14.0 */ diff --git a/guava/src/com/google/common/reflect/ParametricNullness.java b/guava/src/com/google/common/reflect/ParametricNullness.java index 588aa5f59..b6331ac26 100644 --- a/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/guava/src/com/google/common/reflect/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/reflect/Reflection.java b/guava/src/com/google/common/reflect/Reflection.java index fa35f7f2d..954496348 100644 --- a/guava/src/com/google/common/reflect/Reflection.java +++ b/guava/src/com/google/common/reflect/Reflection.java @@ -17,7 +17,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import com.google.common.annotations.Beta; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; @@ -26,7 +25,6 @@ import java.lang.reflect.Proxy; * * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class Reflection { diff --git a/guava/src/com/google/common/reflect/TypeParameter.java b/guava/src/com/google/common/reflect/TypeParameter.java index 9c64abb72..69cd8291a 100644 --- a/guava/src/com/google/common/reflect/TypeParameter.java +++ b/guava/src/com/google/common/reflect/TypeParameter.java @@ -16,7 +16,6 @@ package com.google.common.reflect; import static com.google.common.base.Preconditions.checkArgument; -import com.google.common.annotations.Beta; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import javax.annotation.CheckForNull; @@ -34,7 +33,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 12.0 */ -@Beta @ElementTypesAreNonnullByDefault /* * A nullable bound would let users create a TypeParameter instance for a parameter with a nullable diff --git a/guava/src/com/google/common/reflect/TypeResolver.java b/guava/src/com/google/common/reflect/TypeResolver.java index fbe48c1e8..32517eb87 100644 --- a/guava/src/com/google/common/reflect/TypeResolver.java +++ b/guava/src/com/google/common/reflect/TypeResolver.java @@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static java.util.Arrays.asList; -import com.google.common.annotations.Beta; import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.collect.ImmutableMap; @@ -51,7 +50,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 15.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class TypeResolver { @@ -123,7 +121,7 @@ public final class TypeResolver { } private static void populateTypeMappings( - final Map<TypeVariableKey, Type> mappings, final Type from, final Type to) { + Map<TypeVariableKey, Type> mappings, Type from, Type to) { if (from.equals(to)) { return; } @@ -296,11 +294,11 @@ public final class TypeResolver { checkArgument(!variable.equalsType(type), "Type variable %s bound to itself", variable); builder.put(variable, type); } - return new TypeTable(builder.build()); + return new TypeTable(builder.buildOrThrow()); } - final Type resolve(final TypeVariable<?> var) { - final TypeTable unguarded = this; + final Type resolve(TypeVariable<?> var) { + TypeTable unguarded = this; TypeTable guarded = new TypeTable() { @Override @@ -414,7 +412,7 @@ public final class TypeResolver { visit(t.getUpperBounds()); } - private void map(final TypeVariableKey var, final Type arg) { + private void map(TypeVariableKey var, Type arg) { if (mappings.containsKey(var)) { // Mapping already established // This is possible when following both superClass -> enclosingClass @@ -504,7 +502,7 @@ public final class TypeResolver { return Types.newArtificialTypeVariable(WildcardCapturer.class, name, upperBounds); } - private WildcardCapturer forTypeVariable(final TypeVariable<?> typeParam) { + private WildcardCapturer forTypeVariable(TypeVariable<?> typeParam) { return new WildcardCapturer(id) { @Override TypeVariable<?> captureAsTypeVariable(Type[] upperBounds) { diff --git a/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/guava/src/com/google/common/reflect/TypeToInstanceMap.java index 443b2580c..8a418df2a 100644 --- a/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -14,11 +14,10 @@ package com.google.common.reflect; -import com.google.common.annotations.Beta; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.errorprone.annotations.DoNotMock; import java.util.Map; -import org.checkerframework.checker.nullness.qual.Nullable; +import javax.annotation.CheckForNull; /** * A map, each entry of which maps a {@link TypeToken} to an instance of that type. In addition to @@ -35,12 +34,15 @@ import org.checkerframework.checker.nullness.qual.Nullable; * <p>Like any other {@code Map<Class, Object>}, this map may contain entries for primitive types, * and a primitive type and its corresponding wrapper type may map to different values. * + * <p>This class's support for {@code null} requires some explanation. For details, see {@link + * ClassToInstanceMap}. Its explanation applies equally well to {@code TypeToInstanceMap}. + * * @param <B> the common supertype that all entries must share; often this is simply {@link Object} * @author Ben Yu * @since 13.0 */ -@Beta @DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap") +@ElementTypesAreNonnullByDefault public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { /** @@ -51,14 +53,16 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * <p>{@code getInstance(Foo.class)} is equivalent to {@code * getInstance(TypeToken.of(Foo.class))}. */ - <T extends B> @Nullable T getInstance(Class<T> type); + @CheckForNull + <T extends B> T getInstance(Class<T> type); /** * Returns the value the specified type is mapped to, or {@code null} if no entry for this type is * present. This will only return a value that was bound to this specific type, not a value that * may have been bound to a subtype. */ - <T extends B> @Nullable T getInstance(TypeToken<T> type); + @CheckForNull + <T extends B> T getInstance(TypeToken<T> type); /** * Maps the specified class to the specified value. Does <i>not</i> associate this value with any @@ -71,7 +75,8 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * null} if there was no previous entry. */ @CanIgnoreReturnValue - <T extends B> @Nullable T putInstance(Class<T> type, @Nullable T value); + @CheckForNull + <T extends B> T putInstance(Class<T> type, T value); /** * Maps the specified type to the specified value. Does <i>not</i> associate this value with any @@ -81,5 +86,6 @@ public interface TypeToInstanceMap<B> extends Map<TypeToken<? extends B>, B> { * if there was no previous entry. */ @CanIgnoreReturnValue - <T extends B> @Nullable T putInstance(TypeToken<T> type, @Nullable T value); + @CheckForNull + <T extends B> T putInstance(TypeToken<T> type, T value); } diff --git a/guava/src/com/google/common/reflect/TypeToken.java b/guava/src/com/google/common/reflect/TypeToken.java index f107b7081..fea1d53a2 100644 --- a/guava/src/com/google/common/reflect/TypeToken.java +++ b/guava/src/com/google/common/reflect/TypeToken.java @@ -97,7 +97,6 @@ import javax.annotation.CheckForNull; * @author Ben Yu * @since 12.0 */ -@Beta @SuppressWarnings("serial") // SimpleTypeToken is the serialized form. @ElementTypesAreNonnullByDefault public abstract class TypeToken<T> extends TypeCapture<T> implements Serializable { @@ -168,7 +167,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl /** Returns an instance of type token that wraps {@code type}. */ public static <T> TypeToken<T> of(Class<T> type) { - return new SimpleTypeToken<T>(type); + return new SimpleTypeToken<>(type); } /** Returns an instance of type token that wraps {@code type}. */ @@ -240,7 +239,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl ImmutableMap.of( new TypeResolver.TypeVariableKey(typeParam.typeVariable), typeArg.runtimeType)); // If there's any type error, we'd report now rather than later. - return new SimpleTypeToken<T>(resolver.resolveType(runtimeType)); + return new SimpleTypeToken<>(resolver.resolveType(runtimeType)); } /** @@ -591,6 +590,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl * * @since 14.0 */ + @Beta public final Invokable<T, Object> method(Method method) { checkArgument( this.someRawTypeIsSubclassOf(method.getDeclaringClass()), @@ -630,6 +630,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl * * @since 14.0 */ + @Beta public final Invokable<T, T> constructor(Constructor<?> constructor) { checkArgument( constructor.getDeclaringClass() == getRawType(), @@ -746,15 +747,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl @SuppressWarnings({"unchecked", "rawtypes"}) ImmutableList<Class<? super T>> collectedTypes = (ImmutableList) TypeCollector.FOR_RAW_TYPE.collectTypes(getRawTypes()); - return FluentIterable.from(collectedTypes) - .filter( - new Predicate<Class<?>>() { - @Override - public boolean apply(Class<?> type) { - return type.isInterface(); - } - }) - .toSet(); + return FluentIterable.from(collectedTypes).filter(Class::isInterface).toSet(); } @Override @@ -1103,7 +1096,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl } private ImmutableSet<Class<? super T>> getRawTypes() { - final ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder(); + ImmutableSet.Builder<Class<?>> builder = ImmutableSet.builder(); new TypeVisitor() { @Override void visitTypeVariable(TypeVariable<?> t) { @@ -1428,7 +1421,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl } private static <K, V> ImmutableList<K> sortKeysByValue( - final Map<K, V> map, final Comparator<? super V> valueComparator) { + Map<K, V> map, Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override diff --git a/guava/src/com/google/common/reflect/Types.java b/guava/src/com/google/common/reflect/Types.java index 0dc327d3d..e69b42a8e 100644 --- a/guava/src/com/google/common/reflect/Types.java +++ b/guava/src/com/google/common/reflect/Types.java @@ -20,7 +20,6 @@ import static com.google.common.collect.Iterables.transform; import static java.util.Objects.requireNonNull; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Objects; import com.google.common.base.Predicates; @@ -57,14 +56,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; final class Types { /** Class#toString without the "class " and "interface " prefixes */ - private static final Function<Type, String> TYPE_NAME = - new Function<Type, String>() { - @Override - public String apply(Type from) { - return JavaVersion.CURRENT.typeName(from); - } - }; - private static final Joiner COMMA_JOINER = Joiner.on(", ").useForNull("null"); /** Returns the array type of {@code componentType}. */ @@ -180,7 +171,7 @@ final class Types { @CheckForNull static Type getComponentType(Type type) { checkNotNull(type); - final AtomicReference<@Nullable Type> result = new AtomicReference<>(); + AtomicReference<@Nullable Type> result = new AtomicReference<>(); new TypeVisitor() { @Override void visitTypeVariable(TypeVariable<?> t) { @@ -303,7 +294,7 @@ final class Types { return builder .append(rawType.getName()) .append('<') - .append(COMMA_JOINER.join(transform(argumentsList, TYPE_NAME))) + .append(COMMA_JOINER.join(transform(argumentsList, JavaVersion.CURRENT::typeName))) .append('>') .toString(); } @@ -331,8 +322,7 @@ final class Types { private static <D extends GenericDeclaration> TypeVariable<D> newTypeVariableImpl( D genericDeclaration, String name, Type[] bounds) { - TypeVariableImpl<D> typeVariableImpl = - new TypeVariableImpl<D>(genericDeclaration, name, bounds); + TypeVariableImpl<D> typeVariableImpl = new TypeVariableImpl<>(genericDeclaration, name, bounds); @SuppressWarnings("unchecked") TypeVariable<D> typeVariable = Reflection.newProxy( @@ -382,7 +372,7 @@ final class Types { builder.put(method.getName(), method); } } - typeVariableMethods = builder.build(); + typeVariableMethods = builder.buildKeepingLast(); } private final TypeVariableImpl<?> typeVariableImpl; diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java index e61c6fff5..fc408a92d 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -78,7 +78,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna implements ListenableFuture<V> { // NOTE: Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || - private static final boolean GENERATE_CANCELLATION_CAUSES; + static final boolean GENERATE_CANCELLATION_CAUSES; static { // System.getProperty may throw if the security policy does not permit access. @@ -1084,7 +1084,6 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna * method returns @Nullable, too. However, we're not sure if we want to make any changes to that * class, since it's in a separate artifact that we planned to release only a single version of. */ - @SuppressWarnings("nullness") @CheckForNull protected final Throwable tryInternalFastPathGetFailure() { if (this instanceof Trusted) { @@ -1108,10 +1107,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna /** Releases all threads in the {@link #waiters} list, and clears the list. */ private void releaseWaiters() { - Waiter head; - do { - head = waiters; - } while (!ATOMIC_HELPER.casWaiters(this, head, Waiter.TOMBSTONE)); + Waiter head = ATOMIC_HELPER.gasWaiters(this, Waiter.TOMBSTONE); for (Waiter currentWaiter = head; currentWaiter != null; currentWaiter = currentWaiter.next) { currentWaiter.unpark(); } @@ -1129,10 +1125,7 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna // 2. reverse the linked list, because despite our rather clear contract, people depend on us // executing listeners in the order they were added // 3. push all the items onto 'onto' and return the new head of the stack - Listener head; - do { - head = listeners; - } while (!ATOMIC_HELPER.casListeners(this, head, Listener.TOMBSTONE)); + Listener head = ATOMIC_HELPER.gasListeners(this, Listener.TOMBSTONE); Listener reversedList = onto; while (head != null) { Listener tmp = head; @@ -1301,6 +1294,12 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna abstract boolean casListeners( AbstractFuture<?> future, @CheckForNull Listener expect, Listener update); + /** Performs a GAS operation on the {@link #waiters} field. */ + abstract Waiter gasWaiters(AbstractFuture<?> future, Waiter update); + + /** Performs a GAS operation on the {@link #listeners} field. */ + abstract Listener gasListeners(AbstractFuture<?> future, Listener update); + /** Performs a CAS operation on the {@link #value} field. */ abstract boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update); } @@ -1383,6 +1382,18 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna return UNSAFE.compareAndSwapObject(future, LISTENERS_OFFSET, expect, update); } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + return (Listener) UNSAFE.getAndSetObject(future, LISTENERS_OFFSET, update); + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + return (Waiter) UNSAFE.getAndSetObject(future, WAITERS_OFFSET, update); + } + /** Performs a CAS operation on the {@link #value} field. */ @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { @@ -1433,6 +1444,18 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna return listenersUpdater.compareAndSet(future, expect, update); } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + return listenersUpdater.getAndSet(future, update); + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + return waitersUpdater.getAndSet(future, update); + } + @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { return valueUpdater.compareAndSet(future, expect, update); @@ -1479,6 +1502,30 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna } } + /** Performs a GAS operation on the {@link #listeners} field. */ + @Override + Listener gasListeners(AbstractFuture<?> future, Listener update) { + synchronized (future) { + Listener old = future.listeners; + if (old != update) { + future.listeners = update; + } + return old; + } + } + + /** Performs a GAS operation on the {@link #waiters} field. */ + @Override + Waiter gasWaiters(AbstractFuture<?> future, Waiter update) { + synchronized (future) { + Waiter old = future.waiters; + if (old != update) { + future.waiters = update; + } + return old; + } + } + @Override boolean casValue(AbstractFuture<?> future, @CheckForNull Object expect, Object update) { synchronized (future) { diff --git a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java index 87fb6df4d..db5bf2912 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java @@ -20,6 +20,7 @@ import static com.google.common.util.concurrent.Futures.immediateCancelledFuture import static com.google.common.util.concurrent.Internal.toNanosSaturated; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.Objects.requireNonNull; +import static java.util.concurrent.TimeUnit.NANOSECONDS; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Supplier; @@ -128,7 +129,7 @@ public abstract class AbstractScheduledService implements Service { */ public static Scheduler newFixedDelaySchedule(Duration initialDelay, Duration delay) { return newFixedDelaySchedule( - toNanosSaturated(initialDelay), toNanosSaturated(delay), TimeUnit.NANOSECONDS); + toNanosSaturated(initialDelay), toNanosSaturated(delay), NANOSECONDS); } /** @@ -165,7 +166,7 @@ public abstract class AbstractScheduledService implements Service { */ public static Scheduler newFixedRateSchedule(Duration initialDelay, Duration period) { return newFixedRateSchedule( - toNanosSaturated(initialDelay), toNanosSaturated(period), TimeUnit.NANOSECONDS); + toNanosSaturated(initialDelay), toNanosSaturated(period), NANOSECONDS); } /** @@ -722,6 +723,14 @@ public abstract class AbstractScheduledService implements Service { this.delay = delay; this.unit = checkNotNull(unit); } + + /** + * @param delay the time from now to delay execution + * @since 31.1 + */ + public Schedule(Duration delay) { + this(toNanosSaturated(delay), NANOSECONDS); + } } /** diff --git a/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/guava/src/com/google/common/util/concurrent/AggregateFuture.java index a32e76cdc..6d2ed9c8e 100644 --- a/guava/src/com/google/common/util/concurrent/AggregateFuture.java +++ b/guava/src/com/google/common/util/concurrent/AggregateFuture.java @@ -135,29 +135,26 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends // This is not actually a problem, since the foreach only needs this.futures to be non-null // at the beginning of the loop. int i = 0; - for (final ListenableFuture<? extends InputT> future : futures) { - final int index = i++; + for (ListenableFuture<? extends InputT> future : futures) { + int index = i++; future.addListener( - new Runnable() { - @Override - public void run() { - try { - if (future.isCancelled()) { - // Clear futures prior to cancelling children. This sets our own state but lets - // the input futures keep running, as some of them may be used elsewhere. - futures = null; - cancel(false); - } else { - collectValueFromNonCancelledFuture(index, future); - } - } finally { - /* - * "null" means: There is no need to access `futures` again during - * `processCompleted` because we're reading each value during a call to - * handleOneInputDone. - */ - decrementCountAndMaybeComplete(null); + () -> { + try { + if (future.isCancelled()) { + // Clear futures prior to cancelling children. This sets our own state but lets + // the input futures keep running, as some of them may be used elsewhere. + futures = null; + cancel(false); + } else { + collectValueFromNonCancelledFuture(index, future); } + } finally { + /* + * "null" means: There is no need to access `futures` again during + * `processCompleted` because we're reading each value during a call to + * handleOneInputDone. + */ + decrementCountAndMaybeComplete(null); } }, directExecutor()); @@ -179,15 +176,9 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends * could actually hurt in some cases, as it forces us to keep all inputs in memory until the * final input completes. */ - final ImmutableCollection<? extends Future<? extends InputT>> localFutures = + ImmutableCollection<? extends Future<? extends InputT>> localFutures = collectsValues ? futures : null; - Runnable listener = - new Runnable() { - @Override - public void run() { - decrementCountAndMaybeComplete(localFutures); - } - }; + Runnable listener = () -> decrementCountAndMaybeComplete(localFutures); for (ListenableFuture<? extends InputT> future : futures) { future.addListener(listener, directExecutor()); } @@ -247,8 +238,18 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends checkNotNull(seen); if (!isCancelled()) { /* - * requireNonNull is safe because this is a TrustedFuture, and we're calling this method only - * if it has failed. + * requireNonNull is safe because: + * + * - This is a TrustedFuture, so tryInternalFastPathGetFailure will in fact return the failure + * cause if this Future has failed. + * + * - And this future *has* failed: This method is called only from handleException (through + * getOrInitSeenExceptions). handleException tried to call setException and failed, so + * either this Future was cancelled (which we ruled out with the isCancelled check above), + * or it had already failed. (It couldn't have completed *successfully* or even had + * setFuture called on it: Neither of those can happen until we've finished processing all + * the completed inputs. And we're still processing at least one input, the one that + * triggered handleException.) * * TODO(cpovirk): Think about whether we could/should use Verify to check the return value of * addCausalChain. diff --git a/guava/src/com/google/common/util/concurrent/AsyncCallable.java b/guava/src/com/google/common/util/concurrent/AsyncCallable.java index 826f3c294..c3cbb78a9 100644 --- a/guava/src/com/google/common/util/concurrent/AsyncCallable.java +++ b/guava/src/com/google/common/util/concurrent/AsyncCallable.java @@ -14,7 +14,6 @@ package com.google.common.util.concurrent; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.concurrent.Future; import org.checkerframework.checker.nullness.qual.Nullable; @@ -28,7 +27,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 20.0 */ -@Beta @FunctionalInterface @GwtCompatible @ElementTypesAreNonnullByDefault diff --git a/guava/src/com/google/common/util/concurrent/AtomicDouble.java b/guava/src/com/google/common/util/concurrent/AtomicDouble.java index 81da695cc..56360a870 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicDouble.java +++ b/guava/src/com/google/common/util/concurrent/AtomicDouble.java @@ -14,6 +14,7 @@ package com.google.common.util.concurrent; +import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.Double.doubleToRawLongBits; import static java.lang.Double.longBitsToDouble; @@ -21,6 +22,8 @@ import com.google.common.annotations.GwtIncompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.j2objc.annotations.ReflectionSupport; import java.util.concurrent.atomic.AtomicLongFieldUpdater; +import java.util.function.DoubleBinaryOperator; +import java.util.function.DoubleUnaryOperator; /** * A {@code double} value that may be updated atomically. See the {@link @@ -155,10 +158,63 @@ public class AtomicDouble extends Number implements java.io.Serializable { */ @CanIgnoreReturnValue public final double getAndAdd(double delta) { + return getAndAccumulate(delta, Double::sum); + } + + /** + * Atomically adds the given value to the current value. + * + * @param delta the value to add + * @return the updated value + */ + @CanIgnoreReturnValue + public final double addAndGet(double delta) { + return accumulateAndGet(delta, Double::sum); + } + + /** + * Atomically updates the current value with the results of applying the given function to the + * current and given values. + * + * @param x the update value + * @param accumulatorFunction the accumulator function + * @return the previous value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double getAndAccumulate(double x, DoubleBinaryOperator accumulatorFunction) { + checkNotNull(accumulatorFunction); + return getAndUpdate(oldValue -> accumulatorFunction.applyAsDouble(oldValue, x)); + } + + /** + * Atomically updates the current value with the results of applying the given function to the + * current and given values. + * + * @param x the update value + * @param accumulatorFunction the accumulator function + * @return the updated value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double accumulateAndGet(double x, DoubleBinaryOperator accumulatorFunction) { + checkNotNull(accumulatorFunction); + return updateAndGet(oldValue -> accumulatorFunction.applyAsDouble(oldValue, x)); + } + + /** + * Atomically updates the current value with the results of applying the given function. + * + * @param updateFunction the update function + * @return the previous value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double getAndUpdate(DoubleUnaryOperator updateFunction) { while (true) { long current = value; double currentVal = longBitsToDouble(current); - double nextVal = currentVal + delta; + double nextVal = updateFunction.applyAsDouble(currentVal); long next = doubleToRawLongBits(nextVal); if (updater.compareAndSet(this, current, next)) { return currentVal; @@ -167,17 +223,18 @@ public class AtomicDouble extends Number implements java.io.Serializable { } /** - * Atomically adds the given value to the current value. + * Atomically updates the current value with the results of applying the given function. * - * @param delta the value to add + * @param updateFunction the update function * @return the updated value + * @since 31.1 */ @CanIgnoreReturnValue - public final double addAndGet(double delta) { + public final double updateAndGet(DoubleUnaryOperator updateFunction) { while (true) { long current = value; double currentVal = longBitsToDouble(current); - double nextVal = currentVal + delta; + double nextVal = updateFunction.applyAsDouble(currentVal); long next = doubleToRawLongBits(nextVal); if (updater.compareAndSet(this, current, next)) { return nextVal; diff --git a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java index 58407f5d5..6cc28aad0 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java +++ b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java @@ -13,6 +13,7 @@ package com.google.common.util.concurrent; +import static com.google.common.base.Preconditions.checkNotNull; import static java.lang.Double.doubleToRawLongBits; import static java.lang.Double.longBitsToDouble; @@ -20,6 +21,8 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.primitives.ImmutableLongArray; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.concurrent.atomic.AtomicLongArray; +import java.util.function.DoubleBinaryOperator; +import java.util.function.DoubleUnaryOperator; /** * A {@code double} array in which elements may be updated atomically. See the {@link @@ -69,7 +72,7 @@ public class AtomicDoubleArray implements java.io.Serializable { * @throws NullPointerException if array is null */ public AtomicDoubleArray(double[] array) { - final int len = array.length; + int len = array.length; long[] longArray = new long[len]; for (int i = 0; i < len; i++) { longArray[i] = doubleToRawLongBits(array[i]); @@ -171,10 +174,68 @@ public class AtomicDoubleArray implements java.io.Serializable { */ @CanIgnoreReturnValue public final double getAndAdd(int i, double delta) { + return getAndAccumulate(i, delta, Double::sum); + } + + /** + * Atomically adds the given value to the element at index {@code i}. + * + * @param i the index + * @param delta the value to add + * @return the updated value + */ + @CanIgnoreReturnValue + public double addAndGet(int i, double delta) { + return accumulateAndGet(i, delta, Double::sum); + } + + /** + * Atomically updates the element at index {@code i} with the results of applying the given + * function to the curernt and given values. + * + * @param i the index to update + * @param x the update value + * @param accumulatorFunction the accumulator function + * @return the previous value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double getAndAccumulate(int i, double x, DoubleBinaryOperator accumulatorFunction) { + checkNotNull(accumulatorFunction); + return getAndUpdate(i, oldValue -> accumulatorFunction.applyAsDouble(oldValue, x)); + } + + /** + * Atomically updates the element at index {@code i} with the results of applying the given + * function to the curernt and given values. + * + * @param i the index to update + * @param x the update value + * @param accumulatorFunction the accumulator function + * @return the updated value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double accumulateAndGet(int i, double x, DoubleBinaryOperator accumulatorFunction) { + checkNotNull(accumulatorFunction); + return updateAndGet(i, oldValue -> accumulatorFunction.applyAsDouble(oldValue, x)); + } + + /** + * Atomically updates the element at index {@code i} with the results of applying the given + * function to the curernt value. + * + * @param i the index to update + * @param updaterFunction the update function + * @return the previous value + * @since 31.1 + */ + @CanIgnoreReturnValue + public final double getAndUpdate(int i, DoubleUnaryOperator updaterFunction) { while (true) { long current = longs.get(i); double currentVal = longBitsToDouble(current); - double nextVal = currentVal + delta; + double nextVal = updaterFunction.applyAsDouble(currentVal); long next = doubleToRawLongBits(nextVal); if (longs.compareAndSet(i, current, next)) { return currentVal; @@ -183,18 +244,20 @@ public class AtomicDoubleArray implements java.io.Serializable { } /** - * Atomically adds the given value to the element at index {@code i}. + * Atomically updates the element at index {@code i} with the results of applying the given + * function to the curernt value. * - * @param i the index - * @param delta the value to add + * @param i the index to update + * @param updaterFunction the update function * @return the updated value + * @since 31.1 */ @CanIgnoreReturnValue - public double addAndGet(int i, double delta) { + public final double updateAndGet(int i, DoubleUnaryOperator updaterFunction) { while (true) { long current = longs.get(i); double currentVal = longBitsToDouble(current); - double nextVal = currentVal + delta; + double nextVal = updaterFunction.applyAsDouble(currentVal); long next = doubleToRawLongBits(nextVal); if (longs.compareAndSet(i, current, next)) { return nextVal; diff --git a/guava/src/com/google/common/util/concurrent/Callables.java b/guava/src/com/google/common/util/concurrent/Callables.java index 47b52643d..3b52c2e98 100644 --- a/guava/src/com/google/common/util/concurrent/Callables.java +++ b/guava/src/com/google/common/util/concurrent/Callables.java @@ -35,15 +35,8 @@ public final class Callables { private Callables() {} /** Creates a {@code Callable} which immediately returns a preset value each time it is called. */ - public static <T extends @Nullable Object> Callable<T> returning( - @ParametricNullness final T value) { - return new Callable<T>() { - @Override - @ParametricNullness - public T call() { - return value; - } - }; + public static <T extends @Nullable Object> Callable<T> returning(@ParametricNullness T value) { + return () -> value; } /** @@ -57,15 +50,10 @@ public final class Callables { @Beta @GwtIncompatible public static <T extends @Nullable Object> AsyncCallable<T> asAsyncCallable( - final Callable<T> callable, final ListeningExecutorService listeningExecutorService) { + Callable<T> callable, ListeningExecutorService listeningExecutorService) { checkNotNull(callable); checkNotNull(listeningExecutorService); - return new AsyncCallable<T>() { - @Override - public ListenableFuture<T> call() throws Exception { - return listeningExecutorService.submit(callable); - } - }; + return () -> listeningExecutorService.submit(callable); } /** @@ -78,22 +66,18 @@ public final class Callables { */ @GwtIncompatible // threads static <T extends @Nullable Object> Callable<T> threadRenaming( - final Callable<T> callable, final Supplier<String> nameSupplier) { + Callable<T> callable, Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(callable); - return new Callable<T>() { - @Override - @ParametricNullness - public T call() throws Exception { - Thread currentThread = Thread.currentThread(); - String oldName = currentThread.getName(); - boolean restoreName = trySetName(nameSupplier.get(), currentThread); - try { - return callable.call(); - } finally { - if (restoreName) { - boolean unused = trySetName(oldName, currentThread); - } + return () -> { + Thread currentThread = Thread.currentThread(); + String oldName = currentThread.getName(); + boolean restoreName = trySetName(nameSupplier.get(), currentThread); + try { + return callable.call(); + } finally { + if (restoreName) { + boolean unused = trySetName(oldName, currentThread); } } }; @@ -108,21 +92,18 @@ public final class Callables { * for each invocation of the wrapped callable. */ @GwtIncompatible // threads - static Runnable threadRenaming(final Runnable task, final Supplier<String> nameSupplier) { + static Runnable threadRenaming(Runnable task, Supplier<String> nameSupplier) { checkNotNull(nameSupplier); checkNotNull(task); - return new Runnable() { - @Override - public void run() { - Thread currentThread = Thread.currentThread(); - String oldName = currentThread.getName(); - boolean restoreName = trySetName(nameSupplier.get(), currentThread); - try { - task.run(); - } finally { - if (restoreName) { - boolean unused = trySetName(oldName, currentThread); - } + return () -> { + Thread currentThread = Thread.currentThread(); + String oldName = currentThread.getName(); + boolean restoreName = trySetName(nameSupplier.get(), currentThread); + try { + task.run(); + } finally { + if (restoreName) { + boolean unused = trySetName(oldName, currentThread); } } }; @@ -130,7 +111,7 @@ public final class Callables { /** Tries to set name of the given {@link Thread}, returns true if successful. */ @GwtIncompatible // threads - private static boolean trySetName(final String threadName, Thread currentThread) { + private static boolean trySetName(String threadName, Thread currentThread) { /* * setName should usually succeed, but the security manager can prohibit it. Is there a way to * see if we have the modifyThread permission without catching an exception? diff --git a/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/guava/src/com/google/common/util/concurrent/ClosingFuture.java index 8859fbcde..fbd604cea 100644 --- a/guava/src/com/google/common/util/concurrent/ClosingFuture.java +++ b/guava/src/com/google/common/util/concurrent/ClosingFuture.java @@ -36,7 +36,6 @@ import static java.util.logging.Level.FINER; import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.WARNING; -import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.collect.FluentIterable; @@ -190,7 +189,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @since 30.0 */ // TODO(dpb): Consider reusing one CloseableList for the entire pipeline, modulo combinations. -@Beta // @Beta for one release. @DoNotMock("Use ClosingFuture.from(Futures.immediate*Future)") @ElementTypesAreNonnullByDefault // TODO(dpb): GWT compatibility. diff --git a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index b6b161d1a..decb5f1b1 100644 --- a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -283,7 +283,7 @@ public class CycleDetectingLockFactory { checkNotNull(policy); @SuppressWarnings("unchecked") Map<E, LockGraphNode> lockGraphNodes = (Map<E, LockGraphNode>) getOrCreateNodes(enumClass); - return new WithExplicitOrdering<E>(policy, lockGraphNodes); + return new WithExplicitOrdering<>(policy, lockGraphNodes); } @SuppressWarnings("unchecked") @@ -308,7 +308,7 @@ public class CycleDetectingLockFactory { static <E extends Enum<E>> Map<E, LockGraphNode> createNodes(Class<E> clazz) { EnumMap<E, LockGraphNode> map = Maps.newEnumMap(clazz); E[] keys = clazz.getEnumConstants(); - final int numKeys = keys.length; + int numKeys = keys.length; ArrayList<LockGraphNode> nodes = Lists.newArrayListWithCapacity(numKeys); // Create a LockGraphNode for each enum value. for (E key : keys) { diff --git a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java index 148f50b8f..80c777934 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java @@ -25,7 +25,6 @@ import static com.google.common.util.concurrent.Futures.immediateVoidFuture; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.Objects.requireNonNull; -import com.google.common.annotations.Beta; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicReference; @@ -39,7 +38,14 @@ import org.checkerframework.checker.nullness.qual.Nullable; * until the {@code Future} it returned is {@linkplain Future#isDone done} (successful, failed, or * cancelled). * - * <p>This class has limited support for cancellation and other "early completion": + * <p>This class serializes execution of <i>submitted</i> tasks but not any <i>listeners</i> of + * those tasks. + * + * <p>Submitted tasks have a happens-before order as defined in the Java Language Specification. + * Tasks execute with the same happens-before order that the function calls to {@link #submit} and + * {@link #submitAsync} that submitted those tasks had. + * + * <p>This class has limited support for cancellation and other "early completions": * * <ul> * <li>While calls to {@code submit} and {@code submitAsync} return a {@code Future} that can be @@ -60,9 +66,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * safe for the next task to start.</i> * </ul> * - * <p>An additional limitation: this class serializes execution of <i>tasks</i> but not any - * <i>listeners</i> of those tasks. - * * <p>This class is similar to {@link MoreExecutors#newSequentialExecutor}. This class is different * in a few ways: * @@ -80,7 +83,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 26.0 */ -@Beta @ElementTypesAreNonnullByDefault public final class ExecutionSequencer { @@ -141,7 +143,7 @@ public final class ExecutionSequencer { * {@link Callable#call()} will not be invoked. */ public <T extends @Nullable Object> ListenableFuture<T> submit( - final Callable<T> callable, Executor executor) { + Callable<T> callable, Executor executor) { checkNotNull(callable); checkNotNull(executor); return submitAsync( @@ -167,11 +169,11 @@ public final class ExecutionSequencer { * {@link AsyncCallable#call()} is invoked, {@link AsyncCallable#call()} will not be invoked. */ public <T extends @Nullable Object> ListenableFuture<T> submitAsync( - final AsyncCallable<T> callable, final Executor executor) { + AsyncCallable<T> callable, Executor executor) { checkNotNull(callable); checkNotNull(executor); - final TaskNonReentrantExecutor taskExecutor = new TaskNonReentrantExecutor(executor, this); - final AsyncCallable<T> task = + TaskNonReentrantExecutor taskExecutor = new TaskNonReentrantExecutor(executor, this); + AsyncCallable<T> task = new AsyncCallable<T>() { @Override public ListenableFuture<T> call() throws Exception { @@ -197,58 +199,55 @@ public final class ExecutionSequencer { * have completed - namely after oldFuture is done, and taskFuture has either completed or been * cancelled before the callable started execution. */ - final SettableFuture<@Nullable Void> newFuture = SettableFuture.create(); + SettableFuture<@Nullable Void> newFuture = SettableFuture.create(); - final ListenableFuture<@Nullable Void> oldFuture = ref.getAndSet(newFuture); + ListenableFuture<@Nullable Void> oldFuture = ref.getAndSet(newFuture); // Invoke our task once the previous future completes. - final TrustedListenableFutureTask<T> taskFuture = TrustedListenableFutureTask.create(task); + TrustedListenableFutureTask<T> taskFuture = TrustedListenableFutureTask.create(task); oldFuture.addListener(taskFuture, taskExecutor); - final ListenableFuture<T> outputFuture = Futures.nonCancellationPropagating(taskFuture); + ListenableFuture<T> outputFuture = Futures.nonCancellationPropagating(taskFuture); // newFuture's lifetime is determined by taskFuture, which can't complete before oldFuture // unless taskFuture is cancelled, in which case it falls back to oldFuture. This ensures that // if the future we return is cancelled, we don't begin execution of the next task until after // oldFuture completes. Runnable listener = - new Runnable() { - @Override - public void run() { - if (taskFuture.isDone()) { - // Since the value of oldFuture can only ever be immediateFuture(null) or setFuture of - // a future that eventually came from immediateFuture(null), this doesn't leak - // throwables or completion values. - newFuture.setFuture(oldFuture); - } else if (outputFuture.isCancelled() && taskExecutor.trySetCancelled()) { - // If this CAS succeeds, we know that the provided callable will never be invoked, - // so when oldFuture completes it is safe to allow the next submitted task to - // proceed. Doing this immediately here lets the next task run without waiting for - // the cancelled task's executor to run the noop AsyncCallable. - // - // --- - // - // If the CAS fails, the provided callable already started running (or it is about - // to). Our contract promises: - // - // 1. not to execute a new callable until the old one has returned - // - // If we were to cancel taskFuture, that would let the next task start while the old - // one is still running. - // - // Now, maybe we could tweak our implementation to not start the next task until the - // callable actually completes. (We could detect completion in our wrapper - // `AsyncCallable task`.) However, our contract also promises: - // - // 2. not to cancel any Future the user returned from an AsyncCallable - // - // We promise this because, once we cancel that Future, we would no longer be able to - // tell when any underlying work it is doing is done. Thus, we might start a new task - // while that underlying work is still running. - // - // So that is why we cancel only in the case of CAS success. - taskFuture.cancel(false); - } + () -> { + if (taskFuture.isDone()) { + // Since the value of oldFuture can only ever be immediateFuture(null) or setFuture of + // a future that eventually came from immediateFuture(null), this doesn't leak + // throwables or completion values. + newFuture.setFuture(oldFuture); + } else if (outputFuture.isCancelled() && taskExecutor.trySetCancelled()) { + // If this CAS succeeds, we know that the provided callable will never be invoked, + // so when oldFuture completes it is safe to allow the next submitted task to + // proceed. Doing this immediately here lets the next task run without waiting for + // the cancelled task's executor to run the noop AsyncCallable. + // + // --- + // + // If the CAS fails, the provided callable already started running (or it is about + // to). Our contract promises: + // + // 1. not to execute a new callable until the old one has returned + // + // If we were to cancel taskFuture, that would let the next task start while the old + // one is still running. + // + // Now, maybe we could tweak our implementation to not start the next task until the + // callable actually completes. (We could detect completion in our wrapper + // `AsyncCallable task`.) However, our contract also promises: + // + // 2. not to cancel any Future the user returned from an AsyncCallable + // + // We promise this because, once we cancel that Future, we would no longer be able to + // tell when any underlying work it is doing is done. Thus, we might start a new task + // while that underlying work is still running. + // + // So that is why we cancel only in the case of CAS success. + taskFuture.cancel(false); } }; // Adding the listener to both futures guarantees that newFuture will aways be set. Adding to @@ -422,7 +421,7 @@ public final class ExecutionSequencer { Executor queuedExecutor; // Intentionally using non-short-circuit operator while ((queuedTask = executingTaskQueue.nextTask) != null - & (queuedExecutor = executingTaskQueue.nextExecutor) != null) { + && (queuedExecutor = executingTaskQueue.nextExecutor) != null) { executingTaskQueue.nextTask = null; executingTaskQueue.nextExecutor = null; queuedExecutor.execute(queuedTask); diff --git a/guava/src/com/google/common/util/concurrent/FluentFuture.java b/guava/src/com/google/common/util/concurrent/FluentFuture.java index 4320b78b9..b47e67927 100644 --- a/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -72,7 +72,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @since 23.0 */ -@Beta @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) @ElementTypesAreNonnullByDefault @@ -186,6 +185,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final <X extends Throwable> FluentFuture<V> catching( Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) { return (FluentFuture<V>) Futures.catching(this, exceptionType, fallback, executor); @@ -250,6 +250,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor the executor that runs {@code fallback} if the input fails */ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class") + @Beta public final <X extends Throwable> FluentFuture<V> catchingAsync( Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) { return (FluentFuture<V>) Futures.catchingAsync(this, exceptionType, fallback, executor); @@ -266,6 +267,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @since 28.0 */ @GwtIncompatible // ScheduledExecutorService + @Beta public final FluentFuture<V> withTimeout( Duration timeout, ScheduledExecutorService scheduledExecutor) { return withTimeout(toNanosSaturated(timeout), TimeUnit.NANOSECONDS, scheduledExecutor); @@ -283,6 +285,7 @@ public abstract class FluentFuture<V extends @Nullable Object> */ @GwtIncompatible // ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + @Beta public final FluentFuture<V> withTimeout( long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) { return (FluentFuture<V>) Futures.withTimeout(this, timeout, unit, scheduledExecutor); @@ -327,6 +330,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @return A future that holds result of the function (if the input succeeded) or the original * input's failure (if not) */ + @Beta public final <T extends @Nullable Object> FluentFuture<T> transformAsync( AsyncFunction<? super V, T> function, Executor executor) { return (FluentFuture<T>) Futures.transformAsync(this, function, executor); @@ -364,6 +368,7 @@ public abstract class FluentFuture<V extends @Nullable Object> * @param executor Executor to run the function in. * @return A future that holds result of the transformation. */ + @Beta public final <T extends @Nullable Object> FluentFuture<T> transform( Function<? super V, T> function, Executor executor) { return (FluentFuture<T>) Futures.transform(this, function, executor); diff --git a/guava/src/com/google/common/util/concurrent/Futures.java b/guava/src/com/google/common/util/concurrent/Futures.java index 43205b88b..09b5c3c1a 100644 --- a/guava/src/com/google/common/util/concurrent/Futures.java +++ b/guava/src/com/google/common/util/concurrent/Futures.java @@ -172,7 +172,11 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @since 14.0 */ public static <V extends @Nullable Object> ListenableFuture<V> immediateCancelledFuture() { - return new ImmediateCancelledFuture<V>(); + ListenableFuture<Object> instance = ImmediateCancelledFuture.INSTANCE; + if (instance != null) { + return (ListenableFuture<V>) instance; + } + return new ImmediateCancelledFuture<>(); } /** @@ -181,7 +185,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 28.2 */ - @Beta public static <O extends @Nullable Object> ListenableFuture<O> submit( Callable<O> callable, Executor executor) { TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable); @@ -196,7 +199,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 28.2 */ - @Beta public static ListenableFuture<@Nullable Void> submit(Runnable runnable, Executor executor) { TrustedListenableFutureTask<@Nullable Void> task = TrustedListenableFutureTask.create(runnable, null); @@ -210,7 +212,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 23.0 */ - @Beta public static <O extends @Nullable Object> ListenableFuture<O> submitAsync( AsyncCallable<O> callable, Executor executor) { TrustedListenableFutureTask<O> task = TrustedListenableFutureTask.create(callable); @@ -224,8 +225,8 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 28.0 */ - @Beta @GwtIncompatible // java.util.concurrent.ScheduledExecutorService + // TODO(cpovirk): Return ListenableScheduledFuture? public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync( AsyncCallable<O> callable, Duration delay, ScheduledExecutorService executorService) { return scheduleAsync(callable, toNanosSaturated(delay), TimeUnit.NANOSECONDS, executorService); @@ -237,9 +238,9 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @throws RejectedExecutionException if the task cannot be scheduled for execution * @since 23.0 */ - @Beta @GwtIncompatible // java.util.concurrent.ScheduledExecutorService @SuppressWarnings("GoodTime") // should accept a java.time.Duration + // TODO(cpovirk): Return ListenableScheduledFuture? public static <O extends @Nullable Object> ListenableFuture<O> scheduleAsync( AsyncCallable<O> callable, long delay, @@ -776,7 +777,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * * @since 15.0 */ - @Beta public static <V extends @Nullable Object> ListenableFuture<V> nonCancellationPropagating( ListenableFuture<V> future) { if (future.isDone()) { @@ -840,22 +840,22 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * @return a future that provides a list of the results of the component futures * @since 10.0 */ - /* - * Another way to express this signature would be to bound <V> by @NonNull and accept LF<? extends - * @Nullable V>. That might be better: There's currently no difference between the outputs users - * get when calling this with <Foo> and calling it with <@Nullable Foo>. The only difference is - * that calling it with <Foo> won't work when an input Future has a @Nullable type. So why even - * make that error possible by giving callers the choice? - * - * On the other hand, the current signature is consistent with the similar allAsList method. And - * eventually this method may go away entirely in favor of an API like - * whenAllComplete().collectSuccesses(). That API would have a signature more like the current - * one. - */ @Beta @SafeVarargs public static <V extends @Nullable Object> ListenableFuture<List<@Nullable V>> successfulAsList( ListenableFuture<? extends V>... futures) { + /* + * Another way to express this signature would be to bound <V> by @NonNull and accept + * LF<? extends @Nullable V>. That might be better: There's currently no difference between the + * outputs users get when calling this with <Foo> and calling it with <@Nullable Foo>. The only + * difference is that calling it with <Foo> won't work when an input Future has a @Nullable + * type. So why even make that error possible by giving callers the choice? + * + * On the other hand, the current signature is consistent with the similar allAsList method. And + * eventually this method may go away entirely in favor of an API like + * whenAllComplete().collectSuccesses(). That API would have a signature more like the current + * one. + */ return new ListFuture<V>(ImmutableList.copyOf(futures), false); } @@ -904,7 +904,6 @@ public final class Futures extends GwtFuturesCatchingSpecialization { * * @since 17.0 */ - @Beta public static <T extends @Nullable Object> ImmutableList<ListenableFuture<T>> inCompletionOrder( Iterable<? extends ListenableFuture<? extends T>> futures) { ListenableFuture<? extends T>[] copy = gwtCompatibleToArray(futures); diff --git a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java index 81912f5d8..8b1c17ae4 100644 --- a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java +++ b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java @@ -98,6 +98,9 @@ class ImmediateFuture<V extends @Nullable Object> implements ListenableFuture<V> } static final class ImmediateCancelledFuture<V extends @Nullable Object> extends TrustedFuture<V> { + static final @Nullable ImmediateCancelledFuture<Object> INSTANCE = + AbstractFuture.GENERATE_CANCELLATION_CAUSES ? null : new ImmediateCancelledFuture<>(); + ImmediateCancelledFuture() { cancel(false); } diff --git a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java index 168adf24b..bcec00730 100644 --- a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java +++ b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java @@ -240,7 +240,7 @@ abstract class InterruptibleTask<T extends @Nullable Object> @Override public final String toString() { Runnable state = get(); - final String result; + String result; if (state == DONE) { result = "running=[DONE]"; } else if (state instanceof Blocker) { diff --git a/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java b/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java index 82f8d950d..0b0db4573 100644 --- a/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java +++ b/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java @@ -56,7 +56,7 @@ public final class JdkFutureAdapters { if (future instanceof ListenableFuture) { return (ListenableFuture<V>) future; } - return new ListenableFutureAdapter<V>(future); + return new ListenableFutureAdapter<>(future); } /** @@ -85,7 +85,7 @@ public final class JdkFutureAdapters { if (future instanceof ListenableFuture) { return (ListenableFuture<V>) future; } - return new ListenableFutureAdapter<V>(future, executor); + return new ListenableFutureAdapter<>(future, executor); } /** @@ -150,22 +150,19 @@ public final class JdkFutureAdapters { // TODO(lukes): handle RejectedExecutionException adapterExecutor.execute( - new Runnable() { - @Override - public void run() { - try { - /* - * Threads from our private pool are never interrupted. Threads from a - * user-supplied executor might be, but... what can we do? This is another reason - * to return a proper ListenableFuture instead of using listenInPoolThread. - */ - getUninterruptibly(delegate); - } catch (Throwable e) { - // ExecutionException / CancellationException / RuntimeException / Error - // The task is presumably done, run the listeners. - } - executionList.execute(); + () -> { + try { + /* + * Threads from our private pool are never interrupted. Threads from a + * user-supplied executor might be, but... what can we do? This is another reason + * to return a proper ListenableFuture instead of using listenInPoolThread. + */ + getUninterruptibly(delegate); + } catch (Throwable e) { + // ExecutionException / CancellationException / RuntimeException / Error + // The task is presumably done, run the listeners. } + executionList.execute(); }); } } diff --git a/guava/src/com/google/common/util/concurrent/ListenableFuture.java b/guava/src/com/google/common/util/concurrent/ListenableFuture.java index cf0199ade..a8d9dd4de 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -116,15 +116,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -/* - * It would make sense to also annotate this class with @ElementTypesAreNonnullByDefault. However, - * it makes no difference because this class is already covered by the package-level - * @ParametersAreNonnullByDefault, and this class declares only parameters, not return types or - * fields. (Not to mention that we'll be removing all @*AreNonnullByDefault annotations after tools - * understand .) And it's fortunate that the annotation makes no difference, because - * we're seeing a breakage internally when we add that annotation :) - * - */ +@ElementTypesAreNonnullByDefault public interface ListenableFuture<V extends @Nullable Object> extends Future<V> { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java b/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java index 9fdcc53ed..678a6c671 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java +++ b/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java @@ -59,7 +59,7 @@ public class ListenableFutureTask<V extends @Nullable Object> extends FutureTask * @since 10.0 */ public static <V extends @Nullable Object> ListenableFutureTask<V> create(Callable<V> callable) { - return new ListenableFutureTask<V>(callable); + return new ListenableFutureTask<>(callable); } /** @@ -74,7 +74,7 @@ public class ListenableFutureTask<V extends @Nullable Object> extends FutureTask */ public static <V extends @Nullable Object> ListenableFutureTask<V> create( Runnable runnable, @ParametricNullness V result) { - return new ListenableFutureTask<V>(runnable, result); + return new ListenableFutureTask<>(runnable, result); } ListenableFutureTask(Callable<V> callable) { diff --git a/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java b/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java index e5aa5e302..f6e5d9f9e 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java +++ b/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java @@ -14,7 +14,6 @@ package com.google.common.util.concurrent; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import java.util.concurrent.ScheduledFuture; import org.checkerframework.checker.nullness.qual.Nullable; @@ -25,7 +24,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Anthony Zana * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public interface ListenableScheduledFuture<V extends @Nullable Object> diff --git a/guava/src/com/google/common/util/concurrent/Monitor.java b/guava/src/com/google/common/util/concurrent/Monitor.java index 6696b97ee..d01c6faa2 100644 --- a/guava/src/com/google/common/util/concurrent/Monitor.java +++ b/guava/src/com/google/common/util/concurrent/Monitor.java @@ -17,7 +17,6 @@ package com.google.common.util.concurrent; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.util.concurrent.Internal.toNanosSaturated; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.primitives.Longs; import com.google.errorprone.annotations.concurrent.GuardedBy; @@ -200,7 +199,6 @@ import javax.annotation.CheckForNull; * @author Martin Buchholz * @since 10.0 */ -@Beta @GwtIncompatible @SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress. @ElementTypesAreNonnullByDefault @@ -304,7 +302,6 @@ public final class Monitor { * * @since 10.0 */ - @Beta public abstract static class Guard { @Weak final Monitor monitor; @@ -822,7 +819,7 @@ public final class Monitor { * @throws InterruptedException if interrupted while waiting */ public void waitFor(Guard guard) throws InterruptedException { - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (!guard.isSatisfied()) { @@ -852,7 +849,7 @@ public final class Monitor { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException { final long timeoutNanos = toSafeNanos(time, unit); - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { @@ -869,7 +866,7 @@ public final class Monitor { * currently occupying this monitor. */ public void waitForUninterruptibly(Guard guard) { - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (!guard.isSatisfied()) { @@ -897,7 +894,7 @@ public final class Monitor { @SuppressWarnings("GoodTime") // should accept a java.time.Duration public boolean waitForUninterruptibly(Guard guard, long time, TimeUnit unit) { final long timeoutNanos = toSafeNanos(time, unit); - if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) { + if (!((guard.monitor == this) && lock.isHeldByCurrentThread())) { throw new IllegalMonitorStateException(); } if (guard.isSatisfied()) { diff --git a/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/guava/src/com/google/common/util/concurrent/MoreExecutors.java index fc61fbab3..90776bc9e 100644 --- a/guava/src/com/google/common/util/concurrent/MoreExecutors.java +++ b/guava/src/com/google/common/util/concurrent/MoreExecutors.java @@ -440,14 +440,22 @@ public final class MoreExecutors { * difficult to reproduce because they depend on timing. For example: * * <ul> - * <li>A call like {@code future.transform(function, directExecutor())} may execute the function - * immediately in the thread that is calling {@code transform}. (This specific case happens - * if the future is already completed.) If {@code transform} call was made from a UI thread - * or other latency-sensitive thread, a heavyweight function can harm responsiveness. - * <li>If the task will be executed later, consider which thread will trigger the execution -- - * since that thread will execute the task inline. If the thread is a shared system thread - * like an RPC network thread, a heavyweight task can stall progress of the whole system or - * even deadlock it. + * <li>When a {@code ListenableFuture} listener is registered to run under {@code + * directExecutor}, the listener can execute in any of three possible threads: + * <ol> + * <li>When a thread attaches a listener to a {@code ListenableFuture} that's already + * complete, the listener runs immediately in that thread. + * <li>When a thread attaches a listener to a {@code ListenableFuture} that's + * <em>in</em>complete and the {@code ListenableFuture} later completes normally, the + * listener runs in the the thread that completes the {@code ListenableFuture}. + * <li>When a listener is attached to a {@code ListenableFuture} and the {@code + * ListenableFuture} gets cancelled, the listener runs immediately in the the thread + * that cancelled the {@code Future}. + * </ol> + * Given all these possibilities, it is frequently possible for listeners to execute in UI + * threads, RPC network threads, or other latency-sensitive threads. In those cases, slow + * listeners can harm responsiveness, slow the system as a whole, or worse. (See also the + * note about locking below.) * <li>If many tasks will be triggered by the same event, one heavyweight task may delay other * tasks -- even tasks that are not themselves {@code directExecutor} tasks. * <li>If many such tasks are chained together (such as with {@code @@ -463,9 +471,11 @@ public final class MoreExecutors { * terminate whichever thread happens to trigger the execution. * </ul> * - * Additionally, beware of executing tasks with {@code directExecutor} while holding a lock. Since - * the task you submit to the executor (or any other arbitrary work the executor does) may do slow - * work or acquire other locks, you risk deadlocks. + * A specific warning about locking: Code that executes user-supplied tasks, such as {@code + * ListenableFuture} listeners, should take care not to do so while holding a lock. Additionally, + * as a further line of defense, prefer not to perform any locking inside a task that will be run + * under {@code directExecutor}: Not only might the wait for a lock be long, but if the running + * thread was holding a lock, the listener may deadlock or break lock isolation. * * <p>This instance is equivalent to: * @@ -488,8 +498,11 @@ public final class MoreExecutors { /** * Returns an {@link Executor} that runs each task executed sequentially, such that no two tasks - * are running concurrently. Submitted tasks have a happens-before order as defined in the Java - * Language Specification. + * are running concurrently. + * + * <p>{@linkplain Executor#execute executed} tasks have a happens-before order as defined in the + * Java Language Specification. Tasks execute with the same happens-before order that the function + * calls to {@link Executor#execute `execute()`} that submitted those tasks had. * * <p>The executor uses {@code delegate} in order to {@link Executor#execute execute} each task in * turn, and does not create any threads of its own. @@ -527,7 +540,6 @@ public final class MoreExecutors { * * @since 23.3 (since 23.1 as {@code sequentialExecutor}) */ - @Beta @GwtIncompatible public static Executor newSequentialExecutor(Executor delegate) { return new SequentialExecutor(delegate); diff --git a/guava/src/com/google/common/util/concurrent/NullnessCasts.java b/guava/src/com/google/common/util/concurrent/NullnessCasts.java index 0a0d719ef..a3a914e89 100644 --- a/guava/src/com/google/common/util/concurrent/NullnessCasts.java +++ b/guava/src/com/google/common/util/concurrent/NullnessCasts.java @@ -65,7 +65,8 @@ final class NullnessCasts { * return to a caller, the code needs to a way to return {@code null} from a method that returns * "plain {@code T}." This API provides that. */ - @SuppressWarnings("nullness") + @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"}) + // The warnings are legitimate. Each time we use this method, we document why. @ParametricNullness static <T extends @Nullable Object> T uncheckedNull() { return null; diff --git a/guava/src/com/google/common/util/concurrent/ParametricNullness.java b/guava/src/com/google/common/util/concurrent/ParametricNullness.java index ebc5928cf..a745bf7bb 100644 --- a/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java index 052c7e012..d0b600be8 100644 --- a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java +++ b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java @@ -96,10 +96,10 @@ final class SequentialExecutor implements Executor { * execution of tasks will stop until a call to this method is made. */ @Override - public void execute(final Runnable task) { + public void execute(Runnable task) { checkNotNull(task); - final Runnable submittedTask; - final long oldRunCount; + Runnable submittedTask; + long oldRunCount; synchronized (queue) { // If the worker is already running (or execute() on the delegate returned successfully, and // the worker has yet to start) then we don't need to start the worker. diff --git a/guava/src/com/google/common/util/concurrent/ServiceManager.java b/guava/src/com/google/common/util/concurrent/ServiceManager.java index d2dda7a1e..5ab95ffa6 100644 --- a/guava/src/com/google/common/util/concurrent/ServiceManager.java +++ b/guava/src/com/google/common/util/concurrent/ServiceManager.java @@ -265,8 +265,7 @@ public final class ServiceManager implements ServiceManagerBridge { @CanIgnoreReturnValue public ServiceManager startAsync() { for (Service service : services) { - State state = service.state(); - checkState(state == NEW, "Service %s is %s, cannot start it.", service, state); + checkState(service.state() == NEW, "Not all services are NEW, cannot start %s", this); } for (Service service : services) { try { diff --git a/guava/src/com/google/common/util/concurrent/SettableFuture.java b/guava/src/com/google/common/util/concurrent/SettableFuture.java index 893161e27..0a9e19465 100644 --- a/guava/src/com/google/common/util/concurrent/SettableFuture.java +++ b/guava/src/com/google/common/util/concurrent/SettableFuture.java @@ -40,7 +40,7 @@ public final class SettableFuture<V extends @Nullable Object> * Creates a new {@code SettableFuture} that can be completed or cancelled by a later method call. */ public static <V extends @Nullable Object> SettableFuture<V> create() { - return new SettableFuture<V>(); + return new SettableFuture<>(); } @CanIgnoreReturnValue diff --git a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 5a1969e01..c6ade6a3a 100644 --- a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -73,35 +73,27 @@ public final class SimpleTimeLimiter implements TimeLimiter { @Override public <T> T newProxy( - final T target, - Class<T> interfaceType, - final long timeoutDuration, - final TimeUnit timeoutUnit) { + T target, Class<T> interfaceType, long timeoutDuration, TimeUnit timeoutUnit) { checkNotNull(target); checkNotNull(interfaceType); checkNotNull(timeoutUnit); checkPositiveTimeout(timeoutDuration); checkArgument(interfaceType.isInterface(), "interfaceType must be an interface type"); - final Set<Method> interruptibleMethods = findInterruptibleMethods(interfaceType); + Set<Method> interruptibleMethods = findInterruptibleMethods(interfaceType); InvocationHandler handler = new InvocationHandler() { @Override @CheckForNull - public Object invoke( - Object obj, final Method method, @CheckForNull final @Nullable Object[] args) + public Object invoke(Object obj, Method method, @CheckForNull @Nullable Object[] args) throws Throwable { Callable<@Nullable Object> callable = - new Callable<@Nullable Object>() { - @Override - @CheckForNull - public Object call() throws Exception { - try { - return method.invoke(target, args); - } catch (InvocationTargetException e) { - throw throwCause(e, false /* combineStackTraces */); - } + () -> { + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + throw throwCause(e, false /* combineStackTraces */); } }; return callWithTimeout( diff --git a/guava/src/com/google/common/util/concurrent/Striped.java b/guava/src/com/google/common/util/concurrent/Striped.java index fc8bcd8f3..2ea61cb32 100644 --- a/guava/src/com/google/common/util/concurrent/Striped.java +++ b/guava/src/com/google/common/util/concurrent/Striped.java @@ -206,14 +206,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<Lock>} */ public static Striped<Lock> lock(int stripes) { - return custom( - stripes, - new Supplier<Lock>() { - @Override - public Lock get() { - return new PaddedLock(); - } - }); + return custom(stripes, PaddedLock::new); } /** @@ -224,14 +217,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<Lock>} */ public static Striped<Lock> lazyWeakLock(int stripes) { - return lazy( - stripes, - new Supplier<Lock>() { - @Override - public Lock get() { - return new ReentrantLock(false); - } - }); + return lazy(stripes, () -> new ReentrantLock(false)); } private static <L> Striped<L> lazy(int stripes, Supplier<L> supplier) { @@ -248,15 +234,8 @@ public abstract class Striped<L> { * @param permits the number of permits in each semaphore * @return a new {@code Striped<Semaphore>} */ - public static Striped<Semaphore> semaphore(int stripes, final int permits) { - return custom( - stripes, - new Supplier<Semaphore>() { - @Override - public Semaphore get() { - return new PaddedSemaphore(permits); - } - }); + public static Striped<Semaphore> semaphore(int stripes, int permits) { + return custom(stripes, () -> new PaddedSemaphore(permits)); } /** @@ -267,15 +246,8 @@ public abstract class Striped<L> { * @param permits the number of permits in each semaphore * @return a new {@code Striped<Semaphore>} */ - public static Striped<Semaphore> lazyWeakSemaphore(int stripes, final int permits) { - return lazy( - stripes, - new Supplier<Semaphore>() { - @Override - public Semaphore get() { - return new Semaphore(permits, false); - } - }); + public static Striped<Semaphore> lazyWeakSemaphore(int stripes, int permits) { + return lazy(stripes, () -> new Semaphore(permits, false)); } /** @@ -286,7 +258,7 @@ public abstract class Striped<L> { * @return a new {@code Striped<ReadWriteLock>} */ public static Striped<ReadWriteLock> readWriteLock(int stripes) { - return custom(stripes, READ_WRITE_LOCK_SUPPLIER); + return custom(stripes, ReentrantReadWriteLock::new); } /** @@ -297,25 +269,8 @@ public abstract class Striped<L> { * @return a new {@code Striped<ReadWriteLock>} */ public static Striped<ReadWriteLock> lazyWeakReadWriteLock(int stripes) { - return lazy(stripes, WEAK_SAFE_READ_WRITE_LOCK_SUPPLIER); + return lazy(stripes, WeakSafeReadWriteLock::new); } - - private static final Supplier<ReadWriteLock> READ_WRITE_LOCK_SUPPLIER = - new Supplier<ReadWriteLock>() { - @Override - public ReadWriteLock get() { - return new ReentrantReadWriteLock(); - } - }; - - private static final Supplier<ReadWriteLock> WEAK_SAFE_READ_WRITE_LOCK_SUPPLIER = - new Supplier<ReadWriteLock>() { - @Override - public ReadWriteLock get() { - return new WeakSafeReadWriteLock(); - } - }; - /** * ReadWriteLock implementation whose read and write locks retain a reference back to this lock. * Otherwise, a reference to just the read lock or just the write lock would not suffice to ensure @@ -441,7 +396,7 @@ public abstract class Striped<L> { final AtomicReferenceArray<@Nullable ArrayReference<? extends L>> locks; final Supplier<L> supplier; final int size; - final ReferenceQueue<L> queue = new ReferenceQueue<L>(); + final ReferenceQueue<L> queue = new ReferenceQueue<>(); SmallLazyStriped(int stripes, Supplier<L> supplier) { super(stripes); @@ -461,7 +416,7 @@ public abstract class Striped<L> { return existing; } L created = supplier.get(); - ArrayReference<L> newRef = new ArrayReference<L>(created, index, queue); + ArrayReference<L> newRef = new ArrayReference<>(created, index, queue); while (!locks.compareAndSet(index, existingRef, newRef)) { // we raced, we need to re-read and try again existingRef = locks.get(index); diff --git a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java index 1027f3c83..091f56e79 100644 --- a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java +++ b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java @@ -151,15 +151,15 @@ public final class ThreadFactoryBuilder { // Split out so that the anonymous ThreadFactory can't contain a reference back to the builder. // At least, I assume that's why. TODO(cpovirk): Check, and maybe add a test for this. private static ThreadFactory doBuild(ThreadFactoryBuilder builder) { - final String nameFormat = builder.nameFormat; - final Boolean daemon = builder.daemon; - final Integer priority = builder.priority; - final UncaughtExceptionHandler uncaughtExceptionHandler = builder.uncaughtExceptionHandler; - final ThreadFactory backingThreadFactory = + String nameFormat = builder.nameFormat; + Boolean daemon = builder.daemon; + Integer priority = builder.priority; + UncaughtExceptionHandler uncaughtExceptionHandler = builder.uncaughtExceptionHandler; + ThreadFactory backingThreadFactory = (builder.backingThreadFactory != null) ? builder.backingThreadFactory : Executors.defaultThreadFactory(); - final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; + AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null; return new ThreadFactory() { @Override public Thread newThread(Runnable runnable) { diff --git a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java index 219a0981a..ed8a7bfdb 100644 --- a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java +++ b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java @@ -161,7 +161,7 @@ final class TimeoutFuture<V extends @Nullable Object> extends FluentFuture.Trust if (localInputFuture != null) { String message = "inputFuture=[" + localInputFuture + "]"; if (localTimer != null) { - final long delay = localTimer.getDelay(TimeUnit.MILLISECONDS); + long delay = localTimer.getDelay(TimeUnit.MILLISECONDS); // Negative delays look confusing in an error message if (delay > 0) { message += ", remaining delay=[" + delay + " ms]"; diff --git a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java index a2c2115c3..929c9fb1e 100644 --- a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java +++ b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java @@ -37,11 +37,11 @@ class TrustedListenableFutureTask<V extends @Nullable Object> extends FluentFutu static <V extends @Nullable Object> TrustedListenableFutureTask<V> create( AsyncCallable<V> callable) { - return new TrustedListenableFutureTask<V>(callable); + return new TrustedListenableFutureTask<>(callable); } static <V extends @Nullable Object> TrustedListenableFutureTask<V> create(Callable<V> callable) { - return new TrustedListenableFutureTask<V>(callable); + return new TrustedListenableFutureTask<>(callable); } /** @@ -55,7 +55,7 @@ class TrustedListenableFutureTask<V extends @Nullable Object> extends FluentFutu */ static <V extends @Nullable Object> TrustedListenableFutureTask<V> create( Runnable runnable, @ParametricNullness V result) { - return new TrustedListenableFutureTask<V>(Executors.callable(runnable, result)); + return new TrustedListenableFutureTask<>(Executors.callable(runnable, result)); } /* diff --git a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java index 94678ecf3..09ace92fa 100644 --- a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java +++ b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java @@ -18,7 +18,6 @@ import static com.google.common.base.Verify.verify; import static com.google.common.util.concurrent.Internal.toNanosSaturated; import static java.util.concurrent.TimeUnit.NANOSECONDS; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Preconditions; @@ -80,7 +79,6 @@ public final class Uninterruptibles { */ @CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict. @GwtIncompatible // concurrency - @Beta public static boolean awaitUninterruptibly(CountDownLatch latch, Duration timeout) { return awaitUninterruptibly(latch, toNanosSaturated(timeout), TimeUnit.NANOSECONDS); } @@ -121,7 +119,6 @@ public final class Uninterruptibles { * @since 28.0 */ @GwtIncompatible // concurrency - @Beta public static boolean awaitUninterruptibly(Condition condition, Duration timeout) { return awaitUninterruptibly(condition, toNanosSaturated(timeout), TimeUnit.NANOSECONDS); } @@ -182,7 +179,6 @@ public final class Uninterruptibles { * @since 28.0 */ @GwtIncompatible // concurrency - @Beta public static void joinUninterruptibly(Thread toJoin, Duration timeout) { joinUninterruptibly(toJoin, toNanosSaturated(timeout), TimeUnit.NANOSECONDS); } @@ -274,7 +270,6 @@ public final class Uninterruptibles { */ @CanIgnoreReturnValue @GwtIncompatible // java.time.Duration - @Beta @ParametricNullness public static <V extends @Nullable Object> V getUninterruptibly( Future<V> future, Duration timeout) throws ExecutionException, TimeoutException { @@ -379,7 +374,6 @@ public final class Uninterruptibles { * @since 28.0 */ @GwtIncompatible // concurrency - @Beta public static void sleepUninterruptibly(Duration sleepFor) { sleepUninterruptibly(toNanosSaturated(sleepFor), TimeUnit.NANOSECONDS); } @@ -417,7 +411,6 @@ public final class Uninterruptibles { * @since 28.0 */ @GwtIncompatible // concurrency - @Beta public static boolean tryAcquireUninterruptibly(Semaphore semaphore, Duration timeout) { return tryAcquireUninterruptibly(semaphore, toNanosSaturated(timeout), TimeUnit.NANOSECONDS); } @@ -442,7 +435,6 @@ public final class Uninterruptibles { * @since 28.0 */ @GwtIncompatible // concurrency - @Beta public static boolean tryAcquireUninterruptibly( Semaphore semaphore, int permits, Duration timeout) { return tryAcquireUninterruptibly( @@ -487,7 +479,6 @@ public final class Uninterruptibles { * @since 30.0 */ @GwtIncompatible // concurrency - @Beta public static boolean tryLockUninterruptibly(Lock lock, Duration timeout) { return tryLockUninterruptibly(lock, toNanosSaturated(timeout), TimeUnit.NANOSECONDS); } @@ -527,7 +518,6 @@ public final class Uninterruptibles { * * @since 30.0 */ - @Beta @GwtIncompatible // concurrency public static void awaitTerminationUninterruptibly(ExecutorService executor) { // TODO(cpovirk): We could optimize this to avoid calling nanoTime() at all. @@ -540,7 +530,6 @@ public final class Uninterruptibles { * * @since 30.0 */ - @Beta @GwtIncompatible // concurrency public static boolean awaitTerminationUninterruptibly( ExecutorService executor, Duration timeout) { @@ -553,7 +542,6 @@ public final class Uninterruptibles { * * @since 30.0 */ - @Beta @GwtIncompatible // concurrency @SuppressWarnings("GoodTime") public static boolean awaitTerminationUninterruptibly( diff --git a/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java b/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java index 03c08cc2f..5a3c3927a 100644 --- a/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java @@ -62,16 +62,13 @@ abstract class WrappingExecutorService implements ExecutorService { * delegates to {@link #wrapTask(Callable)}. */ protected Runnable wrapTask(Runnable command) { - final Callable<Object> wrapped = wrapTask(Executors.callable(command, null)); - return new Runnable() { - @Override - public void run() { - try { - wrapped.call(); - } catch (Exception e) { - throwIfUnchecked(e); - throw new RuntimeException(e); - } + Callable<Object> wrapped = wrapTask(Executors.callable(command, null)); + return () -> { + try { + wrapped.call(); + } catch (Exception e) { + throwIfUnchecked(e); + throw new RuntimeException(e); } }; } diff --git a/guava/src/com/google/common/xml/ParametricNullness.java b/guava/src/com/google/common/xml/ParametricNullness.java index a476558fb..e4e5d12f0 100644 --- a/guava/src/com/google/common/xml/ParametricNullness.java +++ b/guava/src/com/google/common/xml/ParametricNullness.java @@ -20,24 +20,33 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static javax.annotation.meta.When.UNKNOWN; import com.google.common.annotations.GwtCompatible; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierNickname; /** - * Marks a "top-level" type-variable usage as (a) a Kotlin platform type when the type argument is - * non-nullable and (b) nullable when the type argument is nullable. This is the closest we can get - * to "non-nullable when non-nullable; nullable when nullable" (like the Android <a + * Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when + * non-nullable; nullable when nullable" (like the Android <a * href="https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/NullFromTypeParam.java">{@code - * NullFromTypeParam}</a>). We use this to "undo" {@link ElementTypesAreNonnullByDefault}. + * NullFromTypeParam}</a>). + * + * <p>Consumers of this annotation include: + * + * <ul> + * <li>Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type + * argument is non-nullable and (b) nullable when the type argument is nullable. We use this + * to "undo" {@link ElementTypesAreNonnullByDefault}. + * <li><a href="https://developers.google.com/j2objc">J2ObjC</a> + * <li>{@code NullPointerTester}, at least in the Android backport (where the type-use annotations + * {@code NullPointerTester} would need are not available) and in case of <a + * href="https://bugs.openjdk.java.net/browse/JDK-8202469">JDK-8202469</a> + * </ul> + * */ @GwtCompatible @Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -@TypeQualifierNickname -@Nonnull(when = UNKNOWN) +@javax.annotation.meta.TypeQualifierNickname +@javax.annotation.Nonnull(when = javax.annotation.meta.When.UNKNOWN) @interface ParametricNullness {} diff --git a/guava/src/com/google/common/xml/XmlEscapers.java b/guava/src/com/google/common/xml/XmlEscapers.java index a1c637c35..33241f3f3 100644 --- a/guava/src/com/google/common/xml/XmlEscapers.java +++ b/guava/src/com/google/common/xml/XmlEscapers.java @@ -14,7 +14,6 @@ package com.google.common.xml; -import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; import com.google.common.escape.Escaper; import com.google.common.escape.Escapers; @@ -38,7 +37,6 @@ import com.google.common.escape.Escapers; * @author David Beaumont * @since 15.0 */ -@Beta @GwtCompatible @ElementTypesAreNonnullByDefault public class XmlEscapers { diff --git a/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java b/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java index 9e5f17366..c987065e4 100644 --- a/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java +++ b/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java @@ -42,7 +42,7 @@ public final class PublicSuffixPatterns { /** If a hostname is contained as a key in this map, it is a public suffix. */ public static final ImmutableMap<String, PublicSuffixType> EXACT = TrieParser.parseTrie( - "a&0&0trk9--nx?27qjf--nx?e9ebgn--nx?nbb0c7abgm--nx??1&2oa08--nx?apg6qpcbgm--nx?hbbgm--nx?rdceqa08--nx??2&8ugbgm--nx?eyh3la2ckx--nx?qbd9--nx??3&2wqq1--nx?60a0y8--nx??4x1d77xrck--nx?6&1f4a3abgm--nx?2yqyn--nx?3np8lv81qo3--nx?5b06t--nx?axq--nx?ec7q--nx?lbgw--nx??883xnn--nx?9d2c24--nx?a&a?it??b!.&gro?lim?moc?sr,t&en?opsgolb,?ude?vog??abila?c?ihsot?m?n??c!.&b&a?m?n??c&b?g?q??ep?fn?k&s?y??ln?no?oc,p&i-on,ohsdaerpsym,?sn?t&n?opsgolb,?un?ysrab,?i&ma?r&emarp?fa??sroc??naiva?s??d&ats?n&eit?oh??om?sa?tl??eg?f&c?ob??g!emo?naripi?oy??hskihs?i&cnal?dem?hs?k!on??sa!.snduolc,??jnin?k&aso?dov?ede?usto??l!.&c,gro?moc?ofni?r&ep?nb,?t&en?ni??ude?vog??irgnahs?le&nisiuc?rbmuder???m!.&ca?gro?oc?sserp?ten?vog??ahokoy?e00sf7vqn--nx?m??n!.&ac?cc?eman?gro?ibom?loohcs?moc?ni?o&c?fni?rp??r&d?o??s&u?w??vt?xm??av?is?olecrab?tea??p!.&bog?ca?d&em?ls??g&ni?ro??mo&c?n??oba?ten?ude??c?g7hyabgm--nx?ra!.&461e?6pi?iru?nru?rdda-ni?siri???s??q!.&eman?gro?hcs?lim?moc?t&en?opsgolb,?ude?vog???r&az?emac?f4a3abgm--nx?n!d5uhf8le58r4w--nx??u&kas?tan???s!.&bup?dem?gro?hcs?moc?ten?ude?vog??ac!.uban.iu,?iv??t&ad?elhta?led?oyot??u!.&a&cinniv?emirc?i&hzhziropaz?stynniv??s&edo?sedo??tlay?vatlop??bs?cc,d&argovorik?o!roghzu??tl,?e&hzhziropaz?nvir?t??f&i?ni,?g&l?ro??hk?i&stvinrehc?ykstynlemhk??k&c?m?s&nagul?t&enod?ul??v&iknarf-onavi?orteporp&end?ind?????l&iponret?opotsa&bes?ves??p??m&k?oc?s?yrk??n&c?d?i?osrehk?v?ylov??o&c,nvor??p&d?p,z??r&c?imotihz?k?ymotyhz??sk?t&en?l?z??ude?v:c?e&alokin?ik??i&alokym?hinrehc?krahk?vl?yk??k?l?o&g!inrehc??krahk??r?,xc,y&ikstinlemhk?mus?s&akrehc?sakrehc?tvonrehc???z&ib,u????v!aj?bb?et?iv??waniko?x&a?iacal??yogan?z&.&bew?c&a?i&n?rga???gro?l&im?oohcs??m&on?t??o&c!.topsgolb,?gn??radnorg?sin?t&en?la??ude?vog?wal??zip???b&00ave5a9iabgm--nx?1&25qhx--nx?68quv--nx?e2kc1--nx??2xtbgm--nx?3&b2kcc--nx?jca1d--nx??4&6&1rfz--nx?qif--nx??96rzc--nx??7w9u16qlj--nx?88uvor--nx?a&0dc4xbgm--nx?c?her?n?ra?t??b!.&erots?gro?moc?o&c?fni??ten?ude?v&og?t??zib??a??c&j?s??d&hesa08--nx?mi??g?l!.&gro?moc?ten?ude?vog??m??s!.&gro?moc?ten?ude?vog???tc-retarebsnegmrev--nx?u&lc!.&elej,snduolc,y&nop,srab,??smas??p!.ysrab,??wp-gnutarebsnegmrev--nx??c&1&1q54--nx?hbgw--nx??2e9c2czf--nx?4&4ub1km--nx?a1e--nx?byj9q--nx?erd5a9b1kcb--nx??8&4xx2g--nx?c9jrb2h--nx??9jr&b&2h--nx?54--nx?9s--nx??c&eg--nx?h3--nx?s2--nx???a!.&gro?lim?moc?rrd,ten?ude?vog??3a09--nx!.&ca1o--nx?gva1c--nx?h&ca1o--nx?za09--nx??ta1d--nx?ua08--nx???da??b&a?b?ci?f76a0c7ylqbgm--nx?sh??c!.&eugaelysatnaf,gnipparcs,liamwt,revres-emag,s&nduolc,otohpym,seccaptf,?xsc,?0atf7b45--nx?a1l--nx??e!.&21k?bog?dem?gro?lim?moc?nif?o&fni?rp??ten?ude?vog??beuq?n?smoc??fdh?i&l&buperananab?ohtac??n&agro?ilc?osanap??sum?tic??l!.&gro?moc?oc?ten?ude?vog?yo,?l??m!.&mt?ossa??p1akcq--nx??n!.&mon?ossa??i?p??relcel?s!.&gro?moc?ten?ude?vog??c??t!.&e&m,w,?hc,?s?w??v!.&e0,gro?lim?moc?ten?ude?v&g:.d,,og???q??wp?yn??d&2urzc--nx?3&1wrpk--nx?c&4b11--nx?9jrcpf--nx???5xq55--nx?697uto--nx?75yrpk--nx?9ctdvkce--nx?a!.mon?d?er?olnwod??b2babgm--nx?c!.vog?g9a2g2b0ae0chclc--nx??e&m!bulc??r!k??sopxe?timil?w??fc?g!.&ude?vog???h&d3tbgm--nx?p?t??i!.&ased?bew?ca?etrof,golbw,hcs?lim?o&c!.topsgolb,?g??palf,r&egolb,o??sepnop?ten?ym?zib??ar?b?ordna?p?rdam??l&iub?og?row??m!.&ed,ot,pj,t&a,opsgolb,???n&a&b?l!.citats:.&setis,ved,?,raas???ob?uf??o&of?rp??r&a&c&tiderc?yalcrab??ugnav??ef506w4b--nx?k!.&oc,ude,?jh3a1habgm--nx??of??s!.&dem?gro?moc?ofni?ten?ude?v&og?t???m!kcrem???t!.topsgolb,excwkcc--nx?l??uolc!.&a&bura-vnej.&1ti,abura.rue.1ti,?tcepsrep,xo:.&ku,nt,?,?bewilek:.sc,,citsalej.piv,drayknil,elej,gnitsohdnert.&ed,hc,?letemirp:.ku,,m&edaid,ialcer.&ac,ku,su,??n&evueluk,woru,?r&epolroov,o&pav,tnemele,??tenraxa.1-se,ululetoj,xelpciffart,??za5cbgn--nx??e&1&53wlf--nx?7a1hbbgm--nx?ta3kg--nx??2a6a1b6b1i--nx?3ma0e1cvr--nx?418txh--nx?707b0e3--nx?a!.&ca?gro?hcs?lim?oc?t&en?opsgolb,?vog??09--nx??b!.&ca?gnitsohbew,nevueluk.yxorpze,pohsdaerpsym,snoitulostsohretni.duolc,topsgolb,?ortal?ut!uoy???c&0krbd4--nx?a&lp!.oc,?ps!.&lla4sx,rebu,tsafym,?artxe??sla??i!ffo??n&a&d?iler?nif?rusni!efil?srelevart???eics!.oby,??rofria??d!.&1sndnyd,42pi-nyd,7erauqs,amil4,b&ow-nrefeilgitsng--nx,rb-ni,vz-nelletsebgitsng--nx,?decalpb,e&daregtmueart,mohsnd,nihcamyek,?hcierebsnoissuksid,keegnietsi,lsd-ni,moc,n&-i-g-o-l,aw-ym,e&lletsebgitsnüg,sgnutiel,?i&emtsi,lreb-n&i,yd,??oitatsksid-ygolonys,pv&-n&i,yd,?nyd,?refeilgitsnüg,?orp-ytinummoc,p&h21,iog:ol,,ohsdaerpsym,?r&e&ntrapdeeps.remotsuc,su&-lautriv,lautriv,?t&adpusnd,tub-ni,uor-ym,?vres&-e&bucl,mohym,?bew-emoh:.nyd,,luhcs,??ogiv-&niem,ym,??s&d-&onys,ygolonys,?nd&-&dd,nufiat,sehcsimanyd,tenretni,yard,?isoc.nyd,ps,yard,?oper-&nvs,tig,?sndd:.&nyd,sndnyd,?,?topsgolb,vresi-&niem,tset,?xi2,y&awetag-&llawerif,ym,?srab,tic-amil,?zten&mitbel,sadtretteuf,??a&lg?rt!.oby,??i&sdoow?ug??nil?on--nx??e!.&bil?dem?eif?gro?irp?kiir?moc!.topsgolb,?pia?ude?vog??ei?ffoc?gg?r&f?ged???f&a&c?s??il??g!.&gro?lim?moc?t&en?vp??ude?vog??a&f?gtrom?p!.&3xlh,kselp,sndp,tengam,xlh,ycvrp,??rots?yov??elloc?na&hcxe?ro??roeg?ug??i!.&pohsdaerpsym,topsgolb,vog??tilop?v&bba?om???j!.&fo,gro?oc?ten???k!.&c&a?s??e&m?n??ibom?o&c!.topsgolb,?fni?g??ro??i&b?l?n???l&a&dmrif?s!.rof,rof???b&a?i&b?dua???c&aro?ric??dnik?g!oog??i&bom?ms??l&asal?erauqa??ppa?uhcs?yts!efil???m!.&4&32i,pct,?66c,ailisarb,b&dnevar,g-raegelif,?ca?duolcsd,e&d-raegelif,i&-raegelif,lpad:.tsohlacol,,?pcm,?g&ro?s-raegelif,?hctilg,k&catsegde,uoc,?noitatsksid,o&bmoy,c!ku,?t&nigol,poh,??p&ion,j-raegelif,ohbew,?qbw,r&aegelif,idcm,ofsnd,?s&dym,ndd,ti!bt,?umhol,?t&en?s&acdnuos,ohon,??u&a-raegelif,de?tcn,?v&irp?og??y&golonys,olpedew,srab,??a&g?n!.&reh.togrof,sih.togrof,???em?i&rp?twohs??orhc?w??n!goloc?i&lno!.&egats-oree,oree,ysrab,??w??o!.&derno:.gnigats,,ecivres,knilemoh,r&ednu,of,??hp?latipac?ts&der?e&gdirb?rif???z!.&66duolc,amil,sh,???ruoblem??om?p!.&bog?gro?lim?mo&c?n??t&en?opsgolb,?ude??irg?yks??r!.&mo&c?n??ossa?topsgolb,?a&c!htlaeh??pmoc?wtfos??bc?eh?if?ots!.&e&rawpohs,saberots,?yflles,??taeht?u&ces?sni?t&inruf?necca??za???s!.&a!bap.us,?b!ibnal?rofmok??c!a??d!b?n&arb?ubroflanummok???e?f!noc,?g!ro??h!f??i!trap??k!shf??l?m!oc,t??n!mygskurbrutan??o?p!ohsdaerpsym,p??r!owebdluocti,?s!serp?yspoi,?t!opsgolb,?u?vhf?w?x!uvmok??y?z??a&c?el?hc??i&er?urc??nesemoh?roh?uoh??t&a&d?ts&e!laer??lla???is!.&areduolc,e&lej,nilnigol,r&etnim,ocevon,?winmo,?k&rowtenoilof,wnf,?laicosnepo,n&eyb,oyc,?spvtsaf,thrs,xulel,ysrab,?bew??ov?ra?t&ioled?ol??utitsni??u&lb?qi&nilc?tuob???v!.&21e?b&ew?og??ce&r?t??erots?gro?lim?m&oc?rif??o&c?fni??stra?t&en?ni??ude?vog??as?e3gerb2h--nx?i&l!.xlh,?rd?ssergorp??ol??w&kct--nx?r??xul?y!.&gro?lim?moc?ten?ude?vog????f&0f3rkcg--nx?198xim--nx?280xim--nx?7vqn--nx?a!.&gro?moc?ten?ude?vog???b!.vog?wa9bgm--nx??c!.topsgolb,a1p--nx!.&a14--nx,b8lea1j--nx,c&avc0aaa08--nx,ma09--nx,?f&a1a09--nx,ea1j--nx,?gva1c--nx,nha1h--nx,pda1j--nx,zila1h--nx,??ns??ea1j--nx?fo?g?iam?l&a1d--nx?og??n!.&bew?cer?erots?m&oc?rif??ofni?re&hto?p??stra?ten???orp?p!.&gro?moc?ude???rus?t!w??vd7ckaabgm--nx?w??g&2&4wq55--nx?8zrf6--nx??3&44sd3--nx?91w6j--nx!.&a5wqmg--nx?d&22svcw--nx?5xq55--nx??gla0do--nx?m1qtxm--nx?vta0cu--nx????455ses--nx?5mzt5--nx?69vqhr--nx?7&8a4d5a4prebgm--nx?rb2c--nx??a!.&gro?mo&c?n??oc?ten??vd??b!.&0?1?2?3?4?5?6?7?8?9?a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t!opsgolb,?u?v?w?x?y!srab,?z???c!b?za9a0cbgm--nx??e!.&eman?gro?ics?lim?moc!.topsgolb,?nue?ten?ude?vog??a??g!.&ayc,gro?lenap:.nomead,,oc?saak,ten???i&a?v??k!.&g&olb,ro??ku,lim?moc?oi,pj,su,ten?ude?v&og?t,???m!.&drp?gro?lim?m&o&c?n??t??oc?ude?vog??pk??n!.&dtl,eman?gro?hcs?i!bom??l&im?oc,?m&oc!.topsgolb,?rif,?neg,ogn,ten?ude?vog??aw?i!b!mulp??car?d&art?dew??h&sif?tolc??k&iv?oo&b?c???ls?n&aelc?iart??p!pohs??re&enigne?tac??t&ad?ekram!.&htiw,morf,??hgil?lusnoc?neg?ov?soh!.tfarcnepo,??vi&g?l???o!s??u&rehcisrev?smas?tarebsnegömrev???o&d?lb?og!.&duolc,etalsnart,???r&2n084qlj--nx?ebmoolb?o!.&77ndc.c:sr,,a&remacytirucesym,t&neimip,sivretla,?z,?bew-llams,d&ab-yrev-si,e&sufnocsim,vas-si,?nuof-si,oog-yrev-si,uolc&arfniarodef,mw,??e&a,cin-yrev-si,grof&loot,peh,?l&as-4-ffuts,poeparodef,?m&-morf,agevres,ohruoyslles,?n&ozdop,uma.elet,?r&ehwongniogyldlob,iwym,uces-77ndc.nigiro.lss,?t&adidnac-a-si,is&-ybboh,golb,???fehc-a-si,golbymdaer,k&eeg-a&-si,si,?h,nut,?l&i&amwt,ve-yrev-si,?lawerif&-ym,ym,?sd-ni,?m&acssecca,edom-elbac,?n&af&blm,cfu,egelloc,lfn,s&citlec-a-si,niurb-a-si,tap-a-si,?xos-a-si,?ibptth,o&itatsksid,rviop,?pv-ni,?o&jodsnd,tp&az,oh,??p&i&-on,fles,?o&hbew,tksedeerf,?tf&e&moh,vres,?ym,??r&e&gatop,ppepteews,su-xunil-a-si,?gmtrec,vdmac,?s&a&ila&nyd,snd,?nymsd,?b&alfmw,bevres,?dylimaf,eirfotatophcuoc,j,koob-daer,ltbup,nd&-won,deerf,emoh,golb,kcud,mood,nyd:.&emoh,og,?,ps,rvd,tog,uolc,?s&a-skcik,ndd,?tnemhcattaomb,u,?t&ce&jorparodef.&duolc,gts.so.ppa,so.ppa,?riderbew,?e&ews-yrev-si,nretni&ehtfodne,fodne,??hgink-a-si,igude,oi-allizom,s&ixetn&od,seod,?o&h-emag,l-si,?rifyam,??ue:.&a&-q,c,?cm,dc,e&b,d,e,i,m,s,?g&b,n,?hc,i&f,s,?k&d,m,s,u,?l&a,i,n,p,?n&c,i,?o&n,r,ssa,?pj,r&f,g,h,k,t,?s&e,i:rap,,u,?t&a,en,i,l,m,ni,p,?u&a,de,h,l,r,?vl,y&c,m,?z&c,n,??,vresnyd,x&inuemoh,unilemoh,?y&limafxut,srab,???ub&mah?oj???s!.&delacsne,gro?moc?rep?t&en?opsgolb,?ude?vog??gb639j43us5--nx??t?u!.&c&a?s??en?gro?moc?o&c?g??ro?topsgolb,??v!.ta,a1c--nx??wsa08--nx??h&0ee5a3ld2ckx--nx?4wc3o--nx!.&a&2xyc3o--nx?3j0hc3m--nx?ve4b3c0oc21--nx??id1kzuc3h--nx?l8bxi8ifc21--nx?rb0ef1c21--nx???8&8yvfe--nx?a7maabgm--nx??b!.&gro?moc?ten?ude?vog??mg??c!.&7erauqs,amil4,duolc-drayknil,gniksnd,p&h21,ohsdaerpsym,?sndtog,topsgolb,wolf.e&a.1pla,nigneppa,?xi2,ytic-amil,?aoc?et?ir!euz??r&aes!errecnac??uhc??sob?taw!s???d0sbgp--nx?f&2lpbgm--nx?k??g!.&gro?lim?moc?ude?vog???m!a1j--nx??ocir?p!.&gro?i?lim?moc?ogn?ten?ude?vog???s!.&g&nabhsah,ro??l&im?xv,?m&oc?roftalp.&cb,su,tne,ue,??pib,ten?vog?won,yolpedew,?a&c?nom??i&d?f?ri???t!.&ca?enilno,im?ni?o&c?g??pohs,ro?ten??iaf!.oby,?laeh!.arh,?orxer?ra&ba?e???vo!.lopdren,?zb??i&3tupk--nx?7a0oi--nx?a!.&ffo?gro?moc?ten?uwu,?1p--nx?bud?dnuyh?tnihc??b!.&gro?moc?oc?ro?ude??ahduba?o!m!.&duolcsd,ysrab,???s??c!.&ayb-tropora--nx?ca?d&e?m??esserp?gro?ln,moc?nif,o&c?g?ssa??ro?t&en?ni?roporéa??ude?vuog??cug?t??d&dk?ua??e&bhf--nx?piat??f!.&aw5-nenikkh--nx,dnala?iki,mroftalpduolc.if,nenikkäh,pohsdaerpsym,retnecatad.&omed,saap,?topsgolb,yd,?onas??g!.&d&om?tl??gro?moc?ude?vog???h&c&atih?ra??s&abodoy?ibustim???juohs?k!.&gro?moc?ofni?ten?ude?vog?zib??b4gc--nx?iw?nisleh?s?uzus??l!.&aac,topsgolb,?drahcir?iamsi??maim?n!.&b&ew?og??ca?gro?lim?mo&c?n??ni?o&c?fni??pp?t&en?ni??ude?zib??airpic?i&hgrobmal?m??re??om?rarref?s!.&egaptig,ppatig,topsgolb,?ed??t&aresam?i&c?nifni??rahb?tagub??ut?v!.&21k?gro?moc?oc?ten???wik?xa&rp?t??yf??j&6pqgza9iabgm--nx?8da1tabbgl--nx?b!.&ossa?topsgolb,uaerrab?vuog???d?f!.&ca?eman?gro?lim?moc?o&fni?rp??ten?vog?zib???nj?s?t!.&bew?c&a?in??eman?gro?lim?moc?o&c?g??t&en?ni?set??ude?vog?zib???yqx94qit--nx??k&8uxp3--nx?924tcf--nx?arfel?c&a&bdeef?lb??ebdnul?ilc?reme?ud??d!.&erots,ger,mrif,oc,pohsdaerpsym,topsgolb,zib,?t??e&es?samet??h!.&a&4ya0cu--nx?5wqmg--nx??b3qa0do--nx?cni,d&2&2svcw--nx?3rvcl--nx??5xq55--nx?tl,?g&a0nt--nx?la0do--nx?ro??i&050qmg--nx?7a0oi--nx?xa0km--nx??m&1qtxm--nx?oc??npqic--nx?saaces,t&en?opsgolb,?ude?v&di?og?ta0cu--nx??xva0fz--nx?人&个?個?箇??司公?府政?絡&網?网??織&組?组??织&組?组??络&網?网??育&敎?教???n??i&tsob?vdnas??l!.&bew?c&a?os??dtl?gro?hcs?letoh?moc?nssa?ogn?prg?t&en?ni??ude?vog??at?cd?is??m!.&eman?fni?gro?moc?t&en?opsgolb,?ude?vog???n&ab!cfdh?etats?mmoc?t&en?fos??u??i!l!.&noyc,pepym,??p???oob?p!.&b&ew?og??gro?kog?m&af?oc??nog?ofni?pog?sog?ten?ude?vog?zib???row!.&morf,ot,?ten!.&htumiza,nolt,o&c,vra,??doof???s!.topsgolb,?t?u!.&c&a?lp??d&om?tl??e&cilop?m??gro!.&gul:g,,sgul,??nnoc,o&c!.&bunsorter.tsuc,e&lddiwg,n&ilnoysrab,ozgniebllew,??krametyb.&hd,mv,?omida,p&i-on,ohsdaerpsym,?t&fihsreyal.j,opsgolb,?vres-hn,ysrab,??rpoc,?psoh,shn?t&en?nmyp,?vog!.eci&ffoemoh,vres,??ysrab,???l&04sr4w--nx?a!.&gro?lim?moc?t&en?opsgolb,?ude?vog??bolg?c?ed?g!el??i&c&nanif!.oc,lpl??os??romem?tnedurp??n&if?oitanretni??t&i&gid!.sppaduolc:.nodnol,,?p&ac?soh???ned?ot??utum!nretsewhtron???c!.&bog?lim?oc?topsgolb,vog???dil?e&datic?n&ahc?nahc!gnikooc?levart?rehtaew???t!ria?tam??vart??f&8f&pbgo--nx?tbgm--nx??a?n??g!.&gro?moc?oc?ten?ude?xx,zib,??h&d?op??i!.&21k?ca?fdi?gro?inum?oc!.&egapvar,topsgolb,??ten?vog??a&f?m&e?g?toh???m?r?xil??l&a&b&esab?t&eksab!.&sua,zn,??oof???c?mt??e&d?hs??ihmailliw?j??m!.&esserp?gro?moc?ten?ude?v&og?uog????n!.&n&iemodleeutriv,o&med,rtsic,??oc,pohsdaerpsym,retsulc-gnitsoh,topsgolb,wsma,yalphk,?o??o&a?btuf?l!.gmo,?o&c!.&ed,rotnemele,??hcs??rit?u??p!.&a&cin&diws?gel??d&g,ortso?urawon??i&dem?mraw?nydg,?k&elo&guld?rtso??slopolam?tsu?ytsyrut??l&ip?o&kzs?w&-awolats?oksnok????n&erapohs,img?zcel,?rog&-ai&bab?nelej??j?z??syn?tsaim?w&a&l&eib?i?o??zsraw??o&namil?tainop,??z&eiwolaib?mol???c&e&iw&alselob?o&nsos?rtso???le&im?zrogz???orw,p??d&em,ia?ragrats?uolc&inu,sds,??e&c&i&lrog?w&ilg,o&hc&arats?orp??klop?tak????yzreibok??i&csjuoniws?ksromop?saldop??l&ahdop?opo??napokaz,tatselaer?z&romop?swozam???g&alble?ezrbo&lok?nrat??ro??hcyzrblaw?i&csomohcurein?grat?klawus??k&e&rut?walcolw??in&byr?diws,sark,?le?o&nas?tsylaib??rob&el?lam??s&als?jazel?nadg,puls?rowezrp???l&colw?e&r?vart??i&am?m???m&o&c?dar?n?tyb??s&g?iruot??t!a???n&a&gaz?nzop,?i&bul?cezczs?lbul,molow?nok?zd&eb?obeiws???uleiw?y&tzslo?z&rtek?seic????o&c,fni?k&celo?zdolk??lkan?n&leim?pek?t&uk?yzczs??z&copo?eing?rowaj???rga?tua?w&ejarg?ogarm???p&e&eb,lks??klwwortso?ohs!daerpsym,??romophcaz?sos?t&aiwop?en?opos,ra,sezc??ude?v&irp?og!.&a&p?s!w???bni&p?w??ci?dtiw?essp?fiw?g&imu?u??hiiw?m&igu?rio?u!o???nds?o&ks?p!pu??s?wtsorats??p&a?sp!mk?pk?wk??u&m?p??wk?z??r&ksw?s??s&i?oiw?u?zu??talusnok?w&gzr?i&p?rg?w??m?opu?u!imzw???zouw????w&a&l&corw?sizdow??w??o&golg?k&ark,ul?zsurp??r&az?gew??t&rabul,sugua??z&coks?sezr????xes?y&buzsak?d&azczseib?ikseb??hcyt?n&jes?lod-zreimizak??pal?r&ogt?uzam??walup?zutrak??z&am-awar?c&aprak?iwol?zsogdyb??dalezc?ib?s&i&lak?p??uklo????l??r&as?f?s??s!.&gro?moc?ten?ude?vog???t!.vog??ubnatsi?x3b689qq6--nx?yc5rb54--nx??m&00tsb3--nx?1qtxm--nx?981rvj--nx?a!.&aayn,enummoc?gro?moc?o&c?idar,ken,?t&en?opsgolb,??c!bew??dretsma?e&rts?t!.&citsalej,esruocsid,???fma?xq--nx??b!.&gro?moc?ten?ude?vog??i??c!.&moc?oc?ten?vog???d!.&gro?moc?ten?ude?vog???f!.&gro?moc?oidar,ten?ude??i??g!vu96d8syzf--nx??h?i!.&ca?gro?moc?o&c!.&clp?dtl???r,?t&en?t??vt??k?rbg4--nx??k!.&drp?e&rianiretev?sserp??gro?lim?m&o&c?n??t??nicedem?ossa?pooc?s&eriaton?neicamrahp?sa??ude?v&og?uog????l&if?ohkcots??o!.&dem?gro?m&oc?uesum??o&c?rp??ten?ude?vog??b?c!.&2aq,3pmevres,5sndd,a&c&-morf,ir&bafno,fa,??g&-morf,oy-sehcaet,?i-morf,m&-morf,all&-a-si,amai,??p&-morf,c-a-si,?r&emacytirucesym,odih,?s,tadtsudgniht,v-morf,w-morf,z,?b&dnevarym,ew&-sndnyd,draiw.segap,ottad,?g,ildts.ipa,?c&amytirucesemoh,d-morf,esyrcs,itsalej.omed,n&-morf,vym,?p&kroweht,ytirucesemoh,?q,rievres,s-morf,?d&aerotffuts,e&calpb,ifitrec-&si,ton-si,?llortnocduolc,rewopenignepw:.sj,,tsohecapsppa,?i&-morf,rgevissam.saap,?m-morf,n&-morf,abeht-htiw-si,?s-morf,uolc&-noitatsyalp,hr,iafaw.&d&ej,yr,?nol,?meaeboda,panqym:-&ahpla,ved,?,smetsystuo,tekcilc,ved&j,pw,??vreser,wetomer,?e&butuoyhtiw,ciffo-sndnyd,d:-morf,o&celgoog,n&il.srebmem,neve.&1-&su,ue,?2-&su,ue,?3-&su,ue,?4-&su,ue,????,erf&-sndnyd,sndd,?filflahevres,gnahcxeevres,i&hcet-a-si,p-sekil,?k&auqevres,irtsretnuocevres,?l&bitpa-no,googhtiw,?m&agevres,ina-otni-si,oh-&sndnyd,ta-sndnyd,??n&-morf,ilno&-evreser,ysrab,?og-si,?r&alfduolcyrt,ehwynanohtyp:.ue,,ihcec,?srun-a-si,t&i&nuarepo,s&-ybboh,aloy,tipohs,xiw,??omer-sndnyd,upmocsma,ysgolb,?v&als-elcibuc-a-si,i&lsndd,tavresnoc-a-si,??z&amkcar,eelg,iig,??fehc-a-si,g&ni&gats-&raeghtua,swennwot,?ksndd,robsikrow,?o&fgp,lb&-sndnyd,pawodni,sihtsetirw,???h&n-morf,o-morf,?i&fiwehtno,h-morf,kiw-sndnyd,m-morf,pdetsoh,r-morf,w-morf,z&ihcppa,nilppa,??jn-morf,k&a&-morf,erfocsic,?cils-si,eeg&-a&-si,si,?sndd,?h,latsnaebcitsale:.&1-&htuos-pa,lartnec-&ac,ue,?ts&ae&-&as,su,?ht&ron-pa,uos-pa,??ew-&su,ue,vog-su,???2-ts&ae&-su,ht&ron-pa,uos-pa,??ew-&su,ue,??3-ts&aehtron-pa,ew-ue,??,o-morf,r&adhtiwtliub,ow&-&sndnyd,ta-sndnyd,?ten-orehkcats,??u,?l&a&-morf,colottad,rebil-a-si,?f-morf,i&-morf,am&-sndnyd,detsohpw,??l&ecelffaw,uf-ytnuob:.a&hpla,teb,?,?ppmswa,ru-&elpmis,taen,?ssukoreh,xegap,?m&n-morf,pml.ppa,rofererac-htlaeh,sacrasevres,uirarret-yltsaf,?n&a&cilbuper-a-si,f&-sllub-a-si,racsan-a-si,?i&cisum-a-si,ratrebil-a-si,??c,dc&hsums,umpw,xirtrepmi,?eerg-a-si,i-morf,m-morf,o&ehtnaptog,isam-al-a-tse,r&italik,tap-el-tse,?s&iam-al-a-tse,replausunu,??pj,t-morf,?o&bordym,c,hce-namtsop,jodsnd,m&-morf,ed-baltlow,?n:iloxip,,ttadym,?p&2pevres,aelutym,i&-sndnyd,fles,ogol,ruoy&esol,hctid,?ym&eerf,teg,??ohsdaerpsym,pa&-rettalp,anis:piv,,esaberif,k1,lortnocduolc,oifilauq,r&aegyks,oetem:.ue,,?tnorfegap,ukoreh,?t&fevres,thevres,??r&a:-morf,tskcor-a-si,,b,e&d&iv&erp-yb-detsoh.saap,orpnwo,?ner&.ppa,no,??e&bevres,nigne-na-si,?ggolb&-a-si,ndi,?h&caet-a-si,pargotohp-a-si,?krow-drah-a-si,n&gised-a-si,ia&rtlanosrep-a-si,tretne-na-si,??p&acsdnal-a-si,eekkoob-a-si,?retac-a-si,subq,tn&ecysrab,iap-a-si,uh-a-si,?vres&-&ki.&cpj-rev-duolcj,duolcj,?s&ndnyd,pvtsaf,??inim,nmad,sak,?y&alp-a-si,wal-a-si,?zilibomdeepsegap,?g,ituob,k,mgrp.nex,o&-morf,sivdalaicnanif-a-si,t&areleccalabolgswa,c&a-na-si,od-a-si,?susaym,??p-morf,u&as-o-nyd,e&tsoh.&duolc-gar,hc-duolc-gar,?ugolb-nom-tse,?omuhevres,??s&a&apod,ila&nyd,snd,?nymsd,vnacremarf,?bbevres,ci&p&-sndnyd,evres,?tcatytiruces,?dylimaf,e&cived-anelab,itilitu3,lahw-eht-sevas,mag-otni-si,t&isro,yskciuq,??i&ht2tniop,pa&elgoog,tneltneg,??jfac,k&-morf,aerf-ten,colb&egrof,pohsym,??m&-morf,cxolb,?n&d&-pmet,dyard,golb,mood,tog,?kselp,nyd,ootrac-otni-si,?o&-xobeerf,xobeerf,?ppa&raeghtua,tneg,?r&ac-otni-si,e&ntrap-paelut,tsohmaerd,??s&e&l-rof-slles,rtca-na-si,?ibodym,?tsaeb-cihtym.&a&llicno,zno,?ilay,lacarac,re&gitnef,motsuc,?sv,toleco,x:n&ihps,yl,?,?u,wanozama.&1-&htuos-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??la&nretxe-3s,rtnec-&ac&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????ts&ae&-&as&-&3s,etisbew-3s,?.kcatslaud.3s,?su:-etisbew-3s,.kcatslaud.3s,,?ht&ron-pa&-&3s,etisbew-3s,?.kcatslaud.3s,?uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-&3s,etisbew-3s,?.kcatslaud.3s,?vog-su-&3s,spif-3s,????2-ts&ae&-su&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ht&ron-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????3&-tsew-ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,??s,???t&arcomed-a-si,c&-morf,etedatad.&ecnatsni,omed,??eel&-si,rebu-si,?hgilfhtiwletoh,m-morf,n&atnuocca-na-si,e&duts-a-si,r-ot-ecaps,tnocresu&buhtig,e&capsppa,lbavresbo.citats,?pl,???ops&edoc,golb,ppa,?s&i&hcrana-&a-si,na-si,?laicos-a-si,pareht-a-si,tra-na-si,xetn&od,seod,??oh&piym,sfn,??u&-morf,nyekcoh-asi,?v-morf,?u&-rof-slles,4,e,h,oynahtretramssi,r:ug-a-si,,?v&n-morf,w-morf,?w&o&lpwons-yrt,zok,?ww100,?x&bsbf.sppa,em,i&nuemoh,rtrepmi,?obaniateb,t-morf,unilemoh,?y&a&bnx:.&2u,lacol-2u,?,l&erottad,pezam,?wetag-llawerif,?dnacsekil,fipohsym,k&-morf,niksisnd,?rotceridevitcaym,u:goo,,w-morf,x&alagkeeg,orphsilbup,???inu??m!.&dna,rof,??or?tsla??p!.nwo,?raf!.jrots,etats??s?t!.&gro?lim?mo&c?n??oc?ten?ude?vog???u&esum!.&a&92chg-seacinumocelet-e-soierroc--nx?atnav?c&i&aduj?rfatsae??rollam??d&anac?enomaledasac?irolf??e&raaihpledalihp?srednu??g&hannavas?oonattahc??hamo?i&auhsu?bmuloc!hsitirb??dem?groeg?hpledalihp?l&artsua?etalif??n&igriv?rofilac??ssur?tsonod??ksa&la?rben??l&lojal?q-snl--nx?uossim!trof???m&a&bala?nap??enic?o&m?r???n&a&cirema?idni??edasap?ilorachtuos?olecrab??r&abrabatnas?ezzivs??su?t&nalta?osennim??zalp??c&dnotgnihsaw?ebeuq?i&depolcycne?ficap?hpargonaeco?lbup?sum?t&carporihc?lec?naltadim??vu??yn??d&a&dhgab?etsmraf?m?orliar??i&rdam?ulegnedleeb??leif?n&a!l&gne?nif?ragyduj?t&ocs?rop??yram???u&brofsdgybmeh?osdnaegami???r&augria?ofxo???e&c&a&l&ap?phtrib??ps??n&a&lubma?tsiser??e&fedlatsaoc?gilletni?ics!foyrotsih????pein?rof??d&nukneklov?revasem??e&rt?tsurt??f&atnas?ildliw??g&a&lliv?tireh!lanoitan???dirbmac?rog??i&cnum?nollaw??koorbrehs?l&ab?bib?cycrotom?i&ssim?txet??oks?tsac??m&affollah?it!iram??utsoc??n&golos?ilno?recul??r&a&uqs?waled!foetats???i&hs&acnal?kroy?pmahwen??otsih??omitlab?ut&an?cetihcra?inruf?luc!irga?su???vuol??s&abatad?iacnarf?sius?uoh!lum???t&a&locohc?rak?ts!e!yrtnuoc!su?????imesoy?tevroc??u&qihpargonaeco?velleb??vit&caretni?omotua???f&iuj?ohgrub??g&n&i&dliub?ginerevmuesum?kiv?lahw?nim?peekemit?vil??ulmmastsnuk??orf?r&ebnrats?u&b&ierf?le?m&ah?uan??ram?s&mailliw!lainoloc??naitsirhc?retepts??zlas??ob&irf?mexul?????h&atu?c&raeser?sirotsih?uot??g&ea1h--nx?rubsttip??si&tirb?wej??t&laeh?ro&n?wtrof??uo&mnom?y????i&d6glbhbd9--nx?iawah?k&nisleh?s??lad!rodavlas??sissa?tannicnic??k&c&nivleeg?olc!-dna-hctaw?dnahctaw???fj?inebis?l&is?ofron??na&rfenna?t??oorbnarc?r&am&ned?reiets??oy!wen????l&a&ci&dem?golo&eahcra?meg?oz??natob?rotsih??ertnom?iromem?noita&cude?n??oc?rutluc?trop?utriv?van??e&nurb?s&ab?surb??utriv??i&artnogero?sarb??l&a&besab?hsnoegrus??e&hs?rdnevle??i&b?m!dniw????o&bup?ohcs?tsirb???m&a&dretsma?ets?h&netlehc?rud???ct?elas!urej??l&if?ohkcots?u??raf?silanruoj?u&esumyrotsihlarutan?ira&tenalp?uqa??terobra???n&a&c!irema!evitan???gihcim?i&dni?tpyge??mfoelsi?wehctaksas??e&d&alokohcs?ews?rag!cinatob?lacinatob?s&nerdlihc?u????gahnepoc?hcneum?laftsew?ppahcsnetewruutan?r&dlihc?ednaalv?hu!dnutamieh???sseig??gised!dn&atra?utsnuk???h&ab!nesie??ojts??i&lreb?tsua??l&eok?ocnil??n&ob?urbneohcs??o&dnol?gero?i&s&iv&dnadnuos?elet??nam??t&a&c&inummoc?ude!tra???dnuof?erc?i&cossa?va??kinummokelet?nissassa?r&belectsevrah?oproc?tsulli??silivic?t&nalp?s??vres&erp?noclatnemnorivne??zilivic??c&elloc?if-ecneics??ibihxe???ri?s&dnah?imaj?reffej?sral??t&erbepac?nilc?sob???r&e&b?dom?tsew?uab?zul??obredap??vahnebeok?wot??o&2a6v-seacinumoc--nx?ablib?c&edtra?ixemwen?sicnarfnas??elap?g&a&cihc?to??eidnas??i&cadnuf?diserp?ratno??llecitnom?mitiram?nirot?r&htna?ienajedoir???pohskrow?qari?r&aw!dloc?livic??dd?e&b&ma?yc??irrac?llimsiwel?naksiznarf?papswen?t&aeht?exe?nec!ecneics?larutluc?muesum?tra??s&ehc&nam?or??neum??upmoc???ia!nepo??obal?u&asonid?obal?takirak???s&a&l&g?l&ad?eh???xet??di&k?pardnarg??e&cneics!larutan??dnal?hcsi&deuj?rotsih!nizidem?rutan??selhcs??itinamuh?l&aw?egnasol?l&e&rutansecneics?xurb??iasrev???r&e&em?ugif??tsac??suohcirotsih?u&en?q&adac?itna!nacirema?su????õçacinumoc!elet-e-soierroc???gnirpsmlap?htab?i&lopanaidni?rap?uoltnias?xa??l&essurb?lod??mraeriflanoitan?n&a&blats?l??erdlihc?oi&snam?tacinummoc!elet-dna-stsop???äl??re&dnalf?lttes?mraf?nim?tnececneics??s&alg?erp??t&farc!dnastra??nalp?olip?ra!e&nif?vitaroced!su???su?xuaeb???u&b!muloc??cric???t&agilltrop?cejorp?dats?e&esum?kramnaidni??iorted?ne&m&elttes?norivne?piuqemraf??vnoc??oped?r&a!drib?enif?gttuts?hsiwej?kcor?n&acirema?ootrac??tamsa?yraropmetnoc??op&aes?snart?wen??ufknarf??s&a&cdaorb?octsae??ewhtuos?ilayol?nuk?r&ohnemled?uhlyram??urt???u&a&bgreb?etalpodaroloc??rmyc??w&ocsom?rn??x&esse?ineohp?nam?tas??y&a&bekaepasehc?w&etag?liar???camrahp?doc?e&hsub?l&ekreb?l&av!eniwydnarb??ort???n&dys?om??rrus?s&nreug?rejwen???golo&e&ahcra?g??motne?nh&cet?te??oz?po&rhtna?t??roh??hpargotohp?l&etalihp?imaf??m&edaca?onortsa??n&atob?yn??ps?r&a&ropmetnoc?tilim??e&diorbme?llag!tra??vocsid??lewej?nosameerf?otsih!dnaecneics?ecneics?gnivil!su??la&col?rutan??retupmoc?su??tsudnidnaecneics??spelipe?t&eicos!lacirotsih??i&nummoc?srevinu??nuoc???z&arg?iewhcs?nil?ojadab?urcatnas??моки?םילשורי???rof??z!.&ca?gro?hcs?lim?moc?o&c?fni??ten?ude?vog?zib????n&315rmi--nx?a&brud?cilbuper?f?grompj?hkaga?idraug?m?ol?ssin?u&hix?qna??varac?yalo??b!.&gro?moc?oc,ten?ude?vog??c??c!.&ah?bh?c&a?s??d&5xq55--nx?g?s?uolctnatsni,?eh?g&la0do--nx?ro??h&a?q?s??i&7a0oi--nx?h??j&b?f?t?x?z??kh?l&h?im?j??m&n?oc!.swanozama.&1-htron-nc.3s,be.1-&htron-nc,tsewhtron-nc,????n&h?l?s?y??om?qc?s&g?j??ten?ude?vog?wt?x&g?j?n?s??z&g?x??司公?絡網?络网??b??d&g!.ypnc,?ka??e&drag?erg?fuak?gawsklov?hctik?i&libommi?w??m!.r&iaper,of,??po?r!ednaalv??sier?ves??g!.&ca?gro?moc?ten?ude?vog??is&ed!.ssb,?irev???h!.&bog?cc,gro?lim?moc?ten?ude???i!.&bew,c&a?in??dni?esabapus,gro?lim?mrif?neg?oc?s&er?nduolc,?t&en?opsgolb,?ude?vog?ysrab,?elknivlac?griv?ks?lreb?p?v?w!.taht,?x??k!.&gro?ten?ude?vog???l&eok?ocnil??m!.&cyn,gro?ude?vog???o&dnol!.&fo,ni,??i&hsaf!.fo,?n&o?utiderc??siv!orue??t&a&cude!.oc,?dnuof?tsyalp??c&etorp?u&a?rtsnoc?????kin?las?mrom?nac?p&q?uoc??s&iam?nhojcs?pe?scire??t&ron?sob??zama??p!.&gro?oc?ten?ude?vog??k??r&e&c?yab??op!.eidni,??s!.&gro?moc?osrep?t&opsgolb,ra??ude?v&inu?uog????t!.&d&ni?uolcegnaro,?esnefed?gro?ltni?m&oc!nim??siruot??n&erut?if??o&fni?srep??sn&e?r??t&an?en!irga?ude??rnr??unr?vog??m??u&f?r!.&bdnevar,lper,sh,tnempoleved,??stad?xamay?y??v!.&ca?eman?gro?htlaeh?moc?o&fni?rp??t&en?ni?opsgolb,?ude?vog?zib???wo&rc?t!epac????o&76i4orfy--nx?a!.&bp?de?go?oc?ti?vg??boat??b!.&a&ci&sum?tilop??i&c&arcomed?neic??golo&ce?ncet??m&edaca?onoce??rt&ap?sudni??vilob??n&egidni?icidem??serpme?tsiver?vitarepooc??b&ew?og??dulas?e&rbmon?tr&a?op&ed?snart????g&olb?ro??ikiw?l&a&noi&canirulp?seforp??rutan??im??moc?o&fni?lbeup?rga?tneimivom??saiciton?t&askt?en?ni??ude?vt??h?iew?olg??c!.&bew?cer?dr&c,rac,?esabapus,gro?ipym,l&im?per:.di,,?m&o&c!.topsgolb,?n??rif?udon,?ofni?s&egap&dael,l,?tra??t&4n,en?ni??ude?vog??a?e?in?mara?s&edarb?ic???d!.&b&ew?og??dls?gro?lim?moc?t&en?ra??ude?vog??agoba?if?zd7acbgm--nx??e&c?d&iv?or??morafla??f!ni!.&e&g&delwonk-fo-l&errab,lerrab,?ellocevoli,?ht-skorg,rom-rof-ereh,tadpusn:d,,?llatiswonk,macrvd,ofni-v,p&i&-on,fles,?ohbew,?ruo-rof,s&iht-skorg,nd&-cimanyd,nyd,uolc,??tsrifyam,ysrab,zmurof,???g&el?n!am?ib???hwsohw?i!.&35nyd,8302,a&minifed,tad-b,?b&altig,uhtig,?c&inone:.remotsuc,,zh,?d&in,u&olc&iaznab.ppa,ropav,?rd,??e&c&apsinu.1rf-duolc,ivedniser,?donppad.sndnyd,egipa,lej,nilnigol,sufxob,t&i&beulb,snoehtnap,?newtu,ybeeb.saap,??gni&gatsniser.secived,tsohytsoh,?k&coregrof.di,orgn,ramytefasresworb,?m&oc?udon,?n&mtsp:.kcom,,yded,?ot&oq,pyrctfihs,?p&opilol,pa&-arusah,e&nalpkcab,tybeeb.1dkes,???r&e&tsneum-hf,vres&cisab,lautriv,??ial.sppa,?s&codehtdaer,gnihtbew,nemeis-om,pparevelc,tacdnas,?t&e&kcubtib,notorp,?i&belet,detfihs,kecaps,?raedon.egats,s&ohg,udgniht.&cersid.&dvreser,tsuc,?dorp.tsuc,gnitset.&dvreser,tsuc,?ved.&dvreser,tsuc,????vgib.0ku,whs,x&bslprbv.g,cq,rotide,?y&olpedew,srab,??b?d&ar?u&a?ts???j?r?syhp??j!.&eman?gro?hcs?lim?moc?ten?ude?vog???ll&ag?o??m!.&gro?moc?ten?ude?vog??g?il?mi?orp??n!.&a&0&b-ekhgnark--nx?c-iehsrgev--nx?g-lksedlig--nx?k-negnanvk--nx??1&p-nedragy--nx?q-&asierrs--nx?grebsnt--nx?lado-rs--nx?n&egnidl--nx?orf-rs--nx??regnayh--nx?ssofenh--nx??r-datsgrt--nx?s-ladrjts--nx?v-y&senner--nx?vrejks--nx???3g-datsobegh--nx?4&5-&dnaleprj--nx?goksnerl--nx?tednalyh--nx??6-neladnjm--nx?s-&antouvachb--nx?impouvtalm--nx??y-&agrjnevvad--nx?ikhvlaraeb--nx???7k-antouvacchb--nx?8&k-rekie-erv--nx?l-ladrua-rs--nx?m-darehsdrk--nx??a!.sg??bct-eimeuvejsemn--nx?d&do?iisevvad?lov?narts?uas??f&1-&l--nx?s--nx??2-h--nx??g&10aq0-ineve--nx?av?ev?lot?r&ajn&evvad?u??ájn&evvad?u????h?iz-lf--nx?j&ddadab?sel??k&el?hoj&sarak?šárák??iiv&ag&na&el?g??ŋ&ael?ág???ran???l&f?lahrevo?o&ms?s??sennev?t-&ilm--nx?tom--nx??u&-edr--nx?s??øms??muar?n&0-tsr--nx?2-dob--nx?5-&asir--nx?tals--nx??a&r!-i-om?f?t??t??douvsatvid?kiv?m&os?øs??n&od?ød??ra?sen?t&aouvatheig?ouv&a&c&ch&ab?áb??h&ab?áb???n??i&ag?ág??sa&mo?ttvid??án???z-rey--nx?ær&f?t???o&p-&ladr--nx?sens--nx??q-nagv--nx?r-asns--nx?s-kjks--nx?v-murb--nx?w-&anr&f--nx?t--nx??ublk--nx???ppol?q&0-t&baol--nx?soum--nx?veib--nx??x-&ipphl--nx?r&embh--nx?imph--nx???y-tinks--nx??r&f-atsr--nx?g-&an&ms--nx?nd--nx??e&drf--nx?ngs--nx??murs--nx?netl--nx?olmb--nx?sorr--nx??h-&a&lms--nx?yrf--nx??emjt--nx??i&-&lboh--nx?rsir--nx?y&d&ar--nx?na--nx??ksa--nx?lem--nx?r&ul--nx?yd--nx????stu??j-&drav--nx?rolf--nx?sdav--nx??kua?l-&drojf--nx?lares--nx??m-tlohr--nx?n-esans--nx?olf?p-sdnil--nx?s-ladrl--nx?tih?v-rvsyt--nx??s&a&ns?ons??i&ar?er&dron?r&os?øs???ár??la&g?h??mor!t??sir?uf?åns??t&koulo&nka?ŋká??la?p-raddjb--nx?r-agrjnu--nx?s&aefr&ammah?ámmáh??orf?r&o?ø???u-vreiks--nx??u&h-dnusel--nx?i-&drojfk--nx?vleslm--nx??j-ekerom--nx?k-rekrem--nx?u-&dnalr--nx?goksr--nx?sensk--nx??v-nekyr--nx?w-&k&abrd--nx?ivjg--nx??oryso--nx??y-y&dnas--nx?mrak--nx?n&art--nx?nif--nx??reva--nx??z-smort--nx??v!.sg?ledatskork?reiks??wh-antouvn--nx?x&9-dlofts--nx.aoq-relv--nx?d-nmaherk--nx?f-dnalnks--nx?h-neltloh--nx?i-drgeppo--nx?j-gve&gnal--nx?lreb--nx??m-negnilr--nx?n-drojfvk--nx??y&7-ujdaehal--nx?8-antouvig--nx?b-&dlofrs--nx?goksmr--nx?kivryr--nx?retslj--nx??e-nejsom--nx?f-y&krajb--nx?re&dni--nx?tso--nx??stivk--nx??g-regark--nx?orf?ørf??z9-drojfstb--nx??b&25-akiivagael--nx?53ay7-olousech--nx?a&iy-gv--nx?le-tl&b--nx?s--nx??n0-ydr--nx??c&0-dnal-erdns--nx?z-netot-erts--nx??g&g-regnarav-rs--nx?o-nejssendnas--nx??ju-erdils-ertsy--nx?nj-dnalh-goksrua--nx?q&q-ladsmor-go-erm--nx.&ari-yreh--nx?ednas??s-neslahsladrjts--nx???ca&4s-atsaefrmmh--nx?8m-dnusynnrb--nx?il-tl--nx?le-slg--nx?n5-rdib--nx?op-drgl--nx?uw-ynnrb--nx??d&a&qx-tggrv--nx?reh!nnivk?sd&ork?ørk??uas??ts&e&bi?kkar?llyh?nnan??g&ort?ørt??k&alf?irderf??levev?mirg?obeg&ah?æh??r&ah?ejg????barm-jdddb--nx?ie!rah?s&etivk?ladman???lof&r&os?øs??ts&ev.ednas?o.relav?ø.relåv???n&a&l&-erd&n&os?øs??ron??adroh.so?dron.&a&g5-b--nx?ri-yreh--nx??ob?y&oreh?øreh??øb??e&m!lejh??pr&oj?øj??vi??gyb?n&aks?åks??o&h-goksrua?rf??r&o?ua?ø??tros?øh-goksrua??rts!e&devt?lab?mloh???s&ellil?naitsirk?rof???u&l!os??s!d&im?lejt??e&guah?l&a?å???kkoh?lavk?naitsirk?r&af?eg&e?ie???tef?y&onnorb?ønnørb?????r&a&blavs!.sg??g&eppo?la???o&j&f&a!dniv?k?vk??die?e&dnas?kkelf??llins?r&iel?ots??s&lab?t&ab?åb??yt??å!k??ævk??les??ts??åg&eppo?lå???ureksub.sen??e&ayb-yrettn--nx?d&ar?lom?r&of?øf??år??g&gyr?nats??i&meuv&ejsem&aan?åån??sekaal??rjea??j&d&ef?oks??les??k&er&aom?åom??hgna&ark?årk??iregnir?kot!s??s&ig?uaf???l&bmab?kyb?l&av?ehtats??oh??m&it?ojt?øjt??n&arg?g&os?øs??meh?reil?te?ummok?yrb??r&dils-erts&ev?y&o?ø???ua?vod??sa&ans?åns??t&robraa?spaav??urg??f&62ats-ugsrop--nx?a&10-ujvrekkhr--nx?7k-tajjrv-attm--nx??o!.sg?h??s!.sg??v!.sg???g&5aly-yr&n--nx?v--nx??a&llor?ve&gnal?lreb???n&av!snellu??org??oks&die?m&or?ør??ner&ol?øl??r&o?ø???r&eb!adnar?edyps?s&die?elf?gnok?n&ot?øt????obspras??uahatsla?åve&gnal?lreb???h&0alu-ysm--nx?7&4ay8-akiivagg--nx?5ay7-atkoulok--nx??a!.sg???i&e&hsr&agev?ågev??rf??k&h&avlaraeb?ávlaraeb??s??lm&a?å??mpouvtal&am?ám??pph&al?ál??rrounaddleid?ssaneve?ššáneve??j&0aoq-ysgv--nx?94bawh-akhojrk--nx??k&a&b&ord?ørd??jks?lleis??iv!aklejps?l&am?evs?u??mag?nel?ojg?r&a&l?n??epok?iel?y&or?ør???s&ah?kel?om??øjg??kabene?ojsarak?ram&deh.&aoq-relv--nx?rel&av?åv??so??e&let.&ag5-b--nx?ob?øb??ra???åjks??l&a!d&anrus?d&numurb?ron??e&gnard?nte?s&meh?sin??ttin??g&is?nyl??kro?l&em?l&ejfttah?of??u&ag-ertdim?s???n&am?era?gos?i&b?nroh?r??kos?nus?oj??o-&dron?r&os?øs???ppo?r&a!l?nram??e&gne?l?v??is?o&jts?ts??u&a-&dron?r&os?øs???h??å?æl?øjts??s&e&jg?nivk?ryf??kav?mor-go-er&om.&ednas?yoreh??øm.&ednas?yøreh???uag??t&las?rajh?suan??v&l&a?e-rots??u-go-eron??yt??ksedlig?res&a?å???bib&eklof?seklyf??es!dah??h!.sg??i&m?syrt??l&ejf?ov&etsua?gnit?ksa?sdie???n!.sg??o!.sg?boh?g?h??r!.sg??å!ksedlig??øboh??m&a&rah?vk??f!.sg??h!.sg??i&e&h&dnort?rtsua?ssej??rkrejb??ksa??ol?t!.sg??u&dom?esum?r&ab?drejg?evle?os?uh?æb?øs??ttals???n&a&g&av?okssman?åv??jlis?or?r&g?rev???e&d&do&sen?ton??lah?r&agy&o?ø??ojfsam???g&iets?n&a&l&as?lab??n&avk?ævk??t&arg?ddosen??v&al?essov???i&d&ol?øl??l&ar?ær???yl??reb??iks?k&srot?y&or?ør???l&a&d&gnos?n&er?ojm?øjm??om??tloh??ug?åtloh??mmard?ojs&om?sendnas??ppolg?s&lahsladr&ojts?øjts??o??t&o&l?t-erts&ev?o?ø???roh?øl??vly&kkys?nav??yam-naj!.sg??øjs&om?sendnas???g&orf?ujb??i&dnaort?vnarg??kob?ladendua?maherk&a?å??n&it?urgsrop??orf-&dron?r&os?øs???r&aieb?evats??sfev?uaks?yrts??o&6axi-ygvtsev--nx?c,d&ob?rav??ievs?kssouf?l&m&ob?øb??ous&adna?ech&ac?áč???so!.sg???msdeks?niekotuak?r&egark?olf?y&oso?øso???s&dav?mort???p&ed?ohsdaerpsym,p&akdron?elk???r&a&d&dj&ab?áb??iab??jtif?luag?mah?vsyt??e&gn&a&k&iel?ro??merb?n&at?mas??rav-r&os?øs??srop?talf?v&ats?el??y&oh?øh???ivsgnok??il?jkniets?k&a&nvej?rem?s&gnir?nellu???ie-er&den?v&o?ø???ram?sa?årem??la&jf?vh??m&b&ah?áh??mahellil??nnul?ts&l&oj?øj??ul??y&o?ø???imp&ah?áh??m!.sg??osir?t!.sg??ádiáb?ævsyt?øsir??s&adnil?en&dnas?e&dga?k&ri&b?k??som??ve??me&h?jg??nroh-go-ejve?s&a?ednil?k&o?ø??of?yt?å??tsev??gv?hf?igaval?o&r&or?ør??sman??so&fen&oh?øh??m?v??uh&lem?sreka.sen??å!dnil???t&a&baol?g&aov?grav??jjr&av-attam?áv-attám??l&a&b?s??ás??soum?ts?v&eib?our???e&dnaly&oh?øh??f?s&nyt?rokomsdeks?sen??vtpiks??in&aks?áks??loh&ar?år??n!.sg??o&m&a?å??psgolb,?s!.sg?efremmah?or?ør??terdi?á&baol?ggráv?lá&b?s??soum?veib???u&b!.sg?alk?e&dna?gnir?nner??les?ælk??dra&b?eb??g&nasrop?vi?ŋásrop??j&daehal&a?á??jedub?v&arekkhar?árekkhár???ksiouf?n&diaegadvoug?taed???v&irp?lesl&am?åm???y&b&essen?nart?sebel?tsev??o&d&ar?na!s??or??gavtsev?k&rajb?sa??lem?mrak?n&art?n&if?orb???r&a&mah?n?v??e&dni?t&so?ton??va??ul?yd??s&am?enner?gav?lrak?tivk??vrejks??ø&d&ar?na!s??ør??gåvtsev?k&rajb?sa??lem?mrak?n&art?n&if?ørb???r&e&dni?t&so?tøn??va??ul?yd?æ&n?v???s&enner?gåv?tivk?åm??vrejks???á&slág?tlá?vreiks??å&gåv?h?jddådåb?lf??ø&d&ob?rav??r&egark?olf??s&dav?mort????aki?i&sac?tal??u??o&b?f?g?hay?o?ttat??r!.&cer?erots?gro?m&o&c?n??rif?t??o&c,fni??pohs,stra?t&n?opsgolb,?www??e&a!.&a&ac?cgd?idem??bulc!orea??ci&ffartria?taborea??e&cn&a&l&lievrus-ria?ubma??netniam?rusni??erefnoc??gnahcxe?mordorea?ni&gne?lria?zagam??rawtfos??gni&d&art?ilg!arap?gnah???l&dnahdnuorg?ledom??noollab?retac?sael?t&lusnoc?uhcarap??vidyks??hcraeser?l&anruoj?euf?icnuoc?ortnoc!-ciffart-ria???n&gised?oi&nu?t&a&cifitrec?ercer?gi&tsevni-tnedicca?van??i&cossa!-regnessap??valivic??redef??cudorp?neverp-tnedicca????ograc?p&ihsnoipmahc?uorg!gnikrow???r&e&dart?enigne?korb?niart?trahc??o&htua?tacude???s&citsigol?e&civres?r??krow?serp!xe??tnega??t&farcr&ia?otor??hgil&f?orcim??liubemoh?n&atlusnoc?e&duts?m&esuma?n&iatretne?revog??piuqe????olip?ropria?si&lanruoj?tneics???w&erc?ohs??y&cnegreme?dobper?tefas????rref?z??p!.&a&aa?ca?pc??dem?ecartsnd.icb,gne?r&ab?uj??snduolc,t&acova?cca?hcer??wal?ysrab,???s!.&em?gro?hcs,moc?ten?ude?vog???t!.&116,ayo,gro?lim?moc?nayn,sulpnpv,t&cennockciuq.tcerid,en??ude?v&dr,og???o&hp?m?v?yk??tol?ua??v&iv?lov??xas?ykot??p&a&ehc?g?m?s??eej?g!.&gro?ibom?moc?ossa?ppa,ten?ude???i&r!.nalc,?v?z??j!.&a&3&5xq6f--nx?xqi0ostn--nx??5wtb6--nx?85uwuu--nx?9xtlk--nx?bihc!.&a&bihciakoy?don?ma&him?ye&ragan?tat???r&a&bom?gan?hihci??u&agedos?kas?ustak???s&os?ufomihs??t&amihcay?iran??w&a&g&im&anah?o??omak??kihci?zustum??ihsak??y&agamak?imonihci???e&akas?nagot??i&azni?esohc?h&asa?s&abanuf?ohc???ka&to?zok??musi?orihs?r&akihabihsokoy?o&dim?tak??ukujuk??usihs??nano&hc?yk??o&d&iakustoy?ustam??hsonhot?k&a&rihs?t??iba??nihsaran?sobimanim?tas&arihsimao?imot??uhc?yihcay??u&kujno?s&ayaru?t&imik?tuf???zarasik????g&as!.&a&gas?m&a&tamah?yik??ihsak??rat?t&a&gatik?hatik??ira!ihsin????e&kaira?nimimak??i&akneg?g&aruyk?o??h&c&amo?uo??siorihs??kaznak?modukuf?ra&gonihsoy?mi???nezih?u&k&at?ohuok??s&ot?tarak?????ihs!.&a&kok?m&a&hagan?yirom??ihsakat??rabiam?wagoton??e&miharot?nokih??houyr?i&azaihsin?esok?kustakat?moihsagih??na&mihcahimo?nok??o&hsia?mag?t&asoyot?ok?tir???us&ay?t&asuk?o??????k&aso!.&a&d&awihsik?eki??k&a&noyot?s&akaayahihc?oihsagih???oadat?uziak??m&ayas!akaso??odak??r&a&bustam?wihsak??ediijuf??t&akarih?i&k?us???wag&ayen?odoyihsagih???e&son?tawanojihs??honim?i&akas?h&cugirom?s&ayabadnot?i&a&kat?t??n??oyimusihsagih???k&a&rabi?sim??ustakat??muzi?r&ijat?otamuk???nan&ak?n&ah?es???o&ay?n&a&ganihcawak?simuzi?tak??eba?ikibah?oyot??t&anim?iad?omamihs??uhc??ust&oimuzi?tes????ou&kuf!.&a&d&amay?eos??g&no?ok?usak??hiku?k&awayim?uzii??ma&kan?y&asih?im???rawak?t&a&gon?ka&h?num?t???umo??wa&g&a&kan?nay?t??ias??ko!rih???y&ihsa?usak???e&m&ay?uruk??taruk?us??i&a&nohs?raihcat??goruk?h&cukuf?s&a&gih?hukuy??in???k&a&gako?muzim??iust?o?ustani??m&anim?otihsoynihs?u??r&ogo?ugasas??usu??ne&siek?zu&b?kihc???o&gukihc?h&ak?ot?ukihc??j&ono?ukihc??kayim?nihsukihc?to?uhc??u&fiazad?gnihs?stoyot????zihs!.&a&bmetog?d&amihs?eijuf?ihsoy?omihs??kouzihs?mihsim?ra&biah?honikam??tawi?wa&g&ekak?ukik??kijuf??yimonijuf??i&a&ra?sok??hcamirom?juf?kaz&eamo?ustam??ma&nnak?ta??nukonuzi?orukuf??nohenawak?o&nosus?ti??u&stamamah?z&a&mun?wak??i!ay?i&hs&agih?in??manim??mihs????????m&a&tias!.&a&d&ihsoy?ot?usah??k&a&dih?sa??o&arihs?s???m&a&tias?y&as?o&rom?tah??ustamihsagih???i&hsagurust?jawak??uri??ni?wa&g&e&ko?man??ikot?o??k&ara?i&hsoy?mak???ru?zorokot??y&a&g&amuk?ihsok?otah??kuf??imo??ziin??e&bakusak?ogawak?sogo?ttas?zokoy??i&baraw?h&cugawak?s&oyim?ubustam???iroy?k&ato?ihs?u&k?stawi???m&akoyr?i&hsoy?juf??uziimak???naznar?o&dakas?ihsay?jnoh?n&a&go?nim??imijuf?nah?oy??r&ihsayim?otagan??t&asim!ak??igus?omatik??zak??u&bihcihc!ihsagih??sonuok?ynah????y&ak&aw!.&a&d&ira?notimak??kadih?ma&h&arihs?im??y&a&kaw?tik??oduk???ru&ustakihcan?y??sauy?wa&g&a&dira?zok??orih??konik??yok?zok??e&banat?dawi??i&garustak?jiat?mani??naniak?o&bog?nimik?t&asim?omihs&ah?uk????ugnihs???o!.&a&jos?koasak?m&ay&ako?ust??ihsayah??r&abi?ukawaihsin??wi&aka?nam???e&gakay?kaw??i&gan?h&cu&kasa?otes??sahakat??k&asim?ihsaruk??miin??n&anemuk?ezib??o&hsotas?jnihs?n&amat?imagak??ohs?uhcibik?????ot!.&a&damay?got?koakat?may&etat?ot??nahoj?riat?waki&inakan?reman???eb&ayo?oruk??i&h&asa?ciimak?sahanuf??kuzanu?m&an&i?ot??ih???nezuyn?otnan?u&hcuf?stimukuf?z&imi?ou???????ihs&o&gak!.&a&m&ayuok?ihsogak??si?yonak??e&banawak?n&at&akan?imanim??uka??tomoonihsin??i&adnesamustas?k&azarukam?oih??m&ama?uzi??usuy??nesi?o&knik?os?tomustam??uzimurat???rih!.&a&ka&n?s??m&ayukuf?i&hsorihihsagih?j&ate?imakikaso????r&a&bohs?h&ekat?im???es??tiak?wiad??e&kato?ruk??i&h&ci&akustah?mono?nihs??s&inares?oyim???manimasa?uk??negokikesnij?o&gnoh?namuk??uhcuf????uk&ot!.&a&bihci?mi&hsu&kot?stamok??m??wagakan??egihsustam?i&gum?h&coganas?soyim??kijaw?m&anim?uzia??ukihsihs??nan&a?iak??o&nati?turan????uf!.&a&batuf?m&a&to?y&enak?irok???ihs&im?ukuf??os?uko??r&aboihsatik?uganat??ta&katik?mawak?rih??w&a&g&akus?emas?uy??k&a&mat?rihs?sa??ihsi??nah??ohs???e&gnabuzia?iman?ta&d?tii???i&adnab?enet?hs&agih?iimagak??k&a&wi?zimuzi??ubay??minuk?r&ook?ustamay???nihsiat?o&g&etomo?ihsin?nan?omihs??no!duruf?rih??rihsawani?ta&may?simuzia???u&rahim?stamakawuzia?zia&ihsin?nay???????nug!.&a&bawak?doyihc?k&anna?oi&hsoy?juf?mot???m&ayakat?ustagaihsagih??n&ihsatak?nak??r&ahonagan?nak?o?u&kati?mamat???t&amun?inomihs?o??w&akubihs?iem?ohs???i&hsa&beam?yabetat??kas&akat?esi??m&akanim?uzio??ogamust?rodim??o&jonakan?n&eu?oyikust??tnihs??u&komnan?stasuk?yrik?????ran!.&a&bihsak?d&akatotamay?u!o???guraki?m&ay&atik&imak?omihs??irokotamay??oki??ra&hihsak?n??wa&geson?knet???e&kayim?ozamay?sog?ustim??i&a&rukas?wak??garustak?h&ciomihs?sinawak??jo?ka&mnak?toruk??makawak?nos?r&net?otakat?ugeh???o&d&na?oyo??gnas?jnihs?nihsoy!ihsagih??tomarawat?yrok????t&ag&amay!.&a&dihsio?k&atarihs?ourust??may&a&kan?rum??enak?onimak??rukho?ta&ga&may?nuf??hakat?kas??wa&g&ekas?orumam??ki&hsin?m??z&anabo?enoy?ot???zuy??e&agas?bonamay?dii?nihsagih?o??i&a&gan?nohs??h&asa?sinawak??nugo??o&dnet?jnihs?ynan??ukohak???iin!.&a&ga?k&ium?oagan??munou!imanim??t&a&bihs?giin??ioy??w&a&gioti?kikes?zuy??irak??yijo??e&kustim?mabust??i&aniat?hcamakot?kaz&awihsak?omuzi??m&a&gat?karum??o???n&anust?esog??o&das?ihcot?jnas?k&ihay?oym??mak?naga?ries??u&ories?steoj?????i&ka!.&a&go?k&asok?oimak??t&ago!rihcah??ika!atik???w&aki?oyk???e&mojog?natim?suranihsagih?t&ado?okoy???i&hsoyirom?magatak?naokimak??nesiad?o&hakin?jnoh!iruy??nuzak?rihson?tasi&juf?m??yjnoh??u&kobmes?oppah????o!.&a&dakatognub?m&asah?ihsemih??su?t&ekat?i&h?o????e&onokok?ustimak??i&jih?k&asinuk?ias?usu??mukust??onoognub?u&fuy?juk?ppeb?suk??????wa&ga&k!.&a&mihsoan?rihotok?waga&kihsagih?ya???emaguram?i&j&nonak?ustnez??kunas?monihcu??o&hsonot?nnam?yotim??u&st&amakat?odat??zatu????nak!.&a&dustam?kus&okoy?tarih??maz?nibe?r&a&gihsaimanim?h&esi?imagas??wa&do?guy???u&im?kamak???tikamay?wa&k&ia?oyik?umas??sijuf??yimonin??e&nokah?saya??i&akan?esiak?gusta?hsuz?kasagihc?o?ukust??o&nadah?sio?tamay?????kihsi!.&a&danihcu?gak?kihs?mijaw?t&abust?ikawak??wazanak??i&gurust?hcionon?mon?ukah??nasukah?o&anan?ton!akan???u&kohak?stamok?z&imana?us?????niko!.&a&han?m&arat?ijemuk?uru??n&e&dak?zi??no??ra&hihsin?rih??wa&kihsi?niko??yehi?zonig??e&osaru?seay??i&hsagih?jomihs?k&a&gihsi?not??ihsakot??m&a&ginuk?kihsug?maz??igo?otekat??nuga!noy???n&a&moti?timoy?wonig??i&jikan?k???o&gan?jnan?tiad&atik?imanim???u&botom?kusug&akan!atik??imot??rab&anoy?eah???????c&204ugv--nx?462a0t7--nx?678z7vq5d--nx?94ptr5--nx?a??d&17sql1--nx?3thr--nx?5&20xbz--nx?40sj5--nx??7&87tlk--nx?ptlk--nx??861ti4--nx?a?e??e&16thr--nx?5&1a4m2--nx?9ny7k--nx??im!.&a&bot?k&asustam?uzus??m&a&him?y&emak?im???ihs??nawuk?wi&em?k???e&bani?ogawak?si!imanim???i&arataw?gusim?h&asa?ciakkoy??k&a&mat?sosik?t??iat??raban??o&dat?hik?n&amuk?ihseru?o&du?mok????ust???mihe!.&a&m&a&h&ataway?iin??yustam??ij&awu?imak???taki!man???ebot?i&anoh?kasam?rabami??n&ania?egokamuk?oot??o&jias?kihcu?nustam?uhcukokihs?yi!es???u&kohik?zo????n!.&nriheg,teniesa.resu,?amihs!.&a&d&amah?ho?usam??kustay?m&a?ihsoni&hsin?ko???wakih??e&namihs?ustam??i&g&aka?usay??konikak?mikih??nannu?o&mu&kay?zi!ihsagih?uko???nawust?tasim??u&stog?yamat?????tawi!.&a&bahay?d&amay?on??koirom?t&a&honat?katnezukir??imus??w&as&ijuf?uzim??ihs???e&hon&i&hci?n??uk??tawi??i&a&duf?murak?wak??h&custo?si&amak?ukuzihs???j&oboj?uk??k&a&m&anah?uzuk??sagenak??esonihci??m&akatik?uzia&rih?wi????o&kayim?no&rih?t??tanufo??uhso????g&3zsiu--nx?71qstn--nx?l??h&03pv23--nx?13ynr--nx?22tsiu--nx?61qqle--nx??i&54urkm--nx?g&ayim!.&a&dukak?m&a&goihs?kihs??ihsustam!ihsagih??unawi??r&awago?iho??ta&bihs?rum??w&a&gano?kuruf??iat??y&imot?ukaw???e&mot?nimes??i&hsiorihs?ka&monihsi?s&awak?o???mak?r&ataw?o&muram?tan????o&az?jagat?t&asim?omamay???u&fir?k&irnasimanim?uhsakihcihs?????ihcot!.&a&g&a&h?kihsa??ust??kom?m&ay&o?usarak??unak??r&a&boihsusan?watho??iho?ukas??t&akihsin?iay??wa&konimak?zenakat??y&imonustu?oihs???e&iiju?kustomihs?nufawi??i&akihci?g&etom?ihcot?on???o&k&ihsam?kin??nas?sioruk?tab??u&bim?san?????h&c&ia!.&a&dnah?m&a!h&akat?im??yuni??ihs&ibot?ust???r&a&hat?tihs??ik?u&ihsagih?kawi???t&ihc?o&k?yot???wa&koyot?zani??yi&monihci?rak???e&inak?k&aoyot?usa??manokot?noyot??i&a&gusak?kot?sia??eot?h&asairawo?cugo?s&ahoyot?oyim???k&a&mok?zako??ihssi??motay?rogamag??n&an&ikeh?ok??ihssin??o&got?ihsin?jna?rihsnihs?suf?tes??u&bo?raho?s&oyik?takihs??yrihc?zah????ok!.&a&dusay?kadih?mayotom?r&ah&im?usuy??umakan??sot!ihsin??wa&g&atik?odoyin??k&as?o????i&esieg?hco!k??jamu?k&a!sus??usto??ma&gak?k??rahan??o&mukus?n&i?ust!ihsagih???torum?yot!o???u&koknan?zimihsasot????ugamay!.&a&m&ayukot?ihso??toyot??e&bu?subat??i&gah?kesonomihs?nukawi?rakih??nanuhs?otagan?u&ba?foh?otim?stamaduk?uy?????sanamay!.&a&dihsoyijuf?mayabat?r&ahoneu?ustakihsin??w&a&k&ayah?ijuf??suran??ohs???egusok?i&ak?h&cimakan?s&anamay?od???k&asarin?u&feuf?sto????o&k&akanamay?ihcugawakijuf??nihso?t&asimawakihci?ukoh??uhc??spla-imanim?u&b&nan?onim??fok?hsok?rust?????ka&rabi!.&a&bukust?gok?kan!ihcatih??m&a&sak?timo?wi??ihsak?ustomihs??ni?r&a&hihcu?way??u&agimusak?ihcust???t&ag&amay?eman??oihcatih??w&ag&arukas?o??os??yi&moihcatih?rom???e&bomot?dirot?not?tadomihs??i&a&k&as?ot??rao??esukihc?gahakat?h&asa?catih??k&a&rabi?saguyr??ihsani?uy??ma?rukustamat??o&dnab?giad?him?kati?rihsijuf?soj?t&asorihs?im??yihcay??u&fius?kihsu?simak????sagan!.&a&m&abo?ihsust??natawak?r&abamihs?u&mo?ustam???wijihc?yahasi??i&akias?hies?k&asagan?i??masah??neznu?o&besas?darih?t&eso?og!imaknihs????ust&igot?onihcuk?uf????zayim!.&a&biihs?guyh?k&oebon?ustorom??mihsuk?r&emihsin?uatik??ta&katik?mim??wag&atik?odak??ya??e&banakat?sakog??i&hsayabok?kaza&kat?yim??m&animawak?ot&inuk?nihs????nanihcin?o&j&ik?onokayim??n&ibe?ust??tias??urahakat????ro&moa!.&a&dawot?turust?wasim??e&hon&ihc&ah?ihs??nas?og?ukor??sario??i&anarih?ganayati?hsioruk?jehon?kasorih?makihsah?nawo?r&amodakan?omoa???o&gnihs?kkat??u&ragust?stum????ttot!.&a&r&ahawak?uotok??sa&kaw?sim???egok?irottot?nanihcin?o&ganoy?nih?tanimiakas??u&bnan?z&ay?ihc??????ukuf!.&a&deki?gurust?ma&bo?h&akat?im??yustak??sakaw??eabas?i&akas?ho?jiehie?ukuf??nezihce!imanim??ono????k&26rtl8--nx?4&3qtr5--nx?ytjd--nx??522tin--nx?797ti4--nx??l33ussp--nx?m&11tqqq--nx?41s3c--nx??n&30sql1--nx?65zqhe--nx?n7p7qrt0--nx??o&131rot--nx?7qrbk--nx?c?diakkoh!.&a&deki?gakihset?hcebihs?k&adih?u&fib?narihs???m&ayiruk?hot?ihs&orihatik?ukuf??oras?usta??r&ib&a!ka??o?uruf??ozo?u&gakihsagih?oyot???sakim?ta&gikust?mun??w&a&ga&k&an?uf??nus!imak???k&aru?i&h&asa?sagih??kat?mak??omihs?um??zimawi??ine?oyk??yot??e&a&mustam?nan??b&a&kihs?yak??o&noroh?to???ian?k&ihsam?ufoto??nakami?ppoko!ihsin??sotihc?tad!okah??uonikat??i&a&bib?mokamot?n&a&k&kaw?oroh??wi??eomak?ihsatu?okik?usta&moruk?sakan????eib?h&c&ioy?u&bmek?irihs???s&ase?ekka?oknar?uesom???jufirihsir?k&amamihs?i&at?n???m&atik?otoyot??oa&kihs?rihs??r&a&hs?kihsi?mot??ihs&aba?ir??otarib???n&a&hctuk?rorum?se?tokahs??uber??o&kayot?m&ire?ukay??naruf!ima&k?nim???orih?r&ih&ibo?suk??o&bah?h&i&b?hsimak??sa??pnan?yan??umen??t&asoyik?eko?ukoh???u&bassa?kotnihs?m&assaw?uo??pp&akiin?en&ioto?nuk??ip??rato?s&akat?t&eb&e?i&a?hs!a??robon??m&e?o&m?takan???no&h?tamah??o&mik?s?t??u&kir?ppihc?st???onihsnihs?ufuras??uaru??yru!koh??zimihs!ok?????g!oyh!.&a&bmat?dnas?gusak?k&at?o&oyot?y??uzarakat??m&ayasas?irah??wa&g&ani?okak??k&i&hci?mak??oy???yi&hsa?monihsin???i&asak?hs&aka?i&at?nawak???j&awa!imanim??emih??k&a&goa?s&agama?ukuf??wihsin??i&hsog?m???mati?oia?rogimak??n&annas?esnonihs??o&gasa!kat??ka?n&ikat?o?ustat??rihsay?sihs?tomus?yas??u&bay?gnihs?????nagan!.&a&bukah?d&a&w?yim??e&ki?u??ii??k&a&s&ay?uki??zus??ihsoo?ousay??m&ay&akat?ii??i&hsukufosik?jii??ukihc??n&i!hsetat??uzii??r&ah?ugot??saim?t&agamay?oyim??w&a&g&a&kan?n??o??kustam?ziurak??onim!imanim??u&koo?s!omihs????ya&ko?rih???e&akas?nagamok?subo??i&gakat?h&asa?c&a!mo!nanihs???uonamay??sukagot??k&a&kas?mimanim?to??ia&atik?imanim??oa?uzihcom??m&akawak?ijuf?o!t???r&ato?ijoihs?omakat???n&ana?esnoawazon??o&hukas?n&a&gan?kan??i&hc?muza??ustat??romok?si&gan?k??tomustam??u&k&as?ohukihc??stamega????to&mamuk!.&a&gamay?rahihsin?sukama!imak??tamanim??enufim?i&hcukik?k&ihsam?u??nugo!imanim??romakat??o&ara?rihsustay?sa?t&amay?om&amuk?us??u!koyg???yohc??u&sagan?zo????yk!.&a&bmatoyk?k&ies?oemak?uzaw??mayi&h&cukuf?sagih??muk??nihsamay?rawatiju?t&away?ik???e&ba&nat!oyk??ya??di?ni??i&ju?kazamayo?manim??natnan?o&gnatoyk?kum?mak?rihsamayimanim?y&gakan?ka&koagan?s??oj???u&ruziam?z&ayim?ik??????wtc1--nx?ykot!.&a&d&i&hcam?mus??oyihc??k&atim?ihsustak??m&a&t!uko??yarumihsa&gih?sum???i&hs&agoa?ika?o!t??uzuok??ren???r&a&honih?wasago??iadok?umah??ssuf?t&ik?o??wa&g&anihs?ode??k&ara?ihcat???y&agates?ubihs???e&amok?donih?m&o?urukihsagih??soyik??i&enagok?gani?h&ca&da?tinuk??sabati??j&nubukok?oihcah??manigus??o&huzim?jihcah?n&akan?ih!sasum??urika??rugem?t&a&mayihsagih?nim??iat?ok??uhc?yknub??u&fohc?hcuf?kujnihs?????r&2xro6--nx?g?o??s&9nvfe--nx?xvp4--nx??t&netnocresu,opsgolb,?u&4rvp8--nx?fig!.&a&d&eki?ih??kimot?m&ayakat?ihsah??ne?raha&gi&kes?makak??sak??taga&may?tik??wa&g&ibi?ustakan??karihs!ihsagih????e&katim?uawak??i&gohakas?hc&apna?uonaw??k&ago?es?ot??m&anuzim?ijat??nak?urat??nanig?o&dog?jug?makonim?nim?roy?sihcih??u&fig?s&otom?t&amasak?oay???????x5ytlk--nx?yu6d27srjd--nx?z72thr--nx?井福?京東?分大?取鳥?口山?城&宮?茨??媛愛?山&富?岡?歌和??岡&福?静??島&児鹿?広?徳?福??崎&宮?長??川&奈神?石?香??庫兵?形山?手岩?木栃?本熊?根島?梨山?森青?潟新?玉埼?田秋?知&愛?高??縄沖?良奈?葉千?賀&佐?滋??道海北?都京?重三?野長?阜岐?阪大?馬群???k!.&art?gro?moc?per?ude?vog???l&eh?l??m!.uj,ac?j??nd?o&g?h&pih?s!.ysrab,??lnud?oc?t!.&lldtn,snd-won,???pa!.&0mroftalp,arusah,bew:erif,,e&niln&igol,okoob,?tupmocegde,?lecrev,n&aecolatigidno,ur:.a,,?poon,remarf,t&ibelet,xenw,?yfilten,??ra&a?hs??u&ekam?llag?org!.esruocsid,cts?kouk?nayalo???vsr?xece4ibgm--nx??q&a!3a9y--nx??g?i!.&gro?lim?moc?ten?ude?vog???m?se??r&a!.&acisum?bog?gro?lim?moc!.topsgolb,?rut?t&en?ni??ude?vog??4d5a4prebgm--nx?b?c?eydoog?los?t&at?s!uen???ugaj??b!.&21g?a&b&a&coros?iuc??itiruc??cnogoas?dicerapa?gniram?i&naiog?ramatnas??n&erom?irdnol??op?p&acam?irolf?ma&j?s???rief?tsivaob??b!aj?ib?mi?sb??c&ba?e&r?t??js?sp?t!e???d&em?mb?n&f?i??rt??e&dnarganipmac?ficer?ht?llivnioj?rdnaotnas??f&dj?ed?gg?n&e?i???g&e&l!.&a&b,m,p,?bp,c&a,s,?e&c,p,s,?fd,gm,ip,jr,la,ma,nr,o&g,r,t,?p&a,s,?r&p,r,?s&e,m,r,?tm,??s??l&s?z??n&c?e?o??ol!b?f?v??pp?ro??hvp?i&du?kiw?nana?oretin?r&c?eurab??sp?te?xat??l&at&an?rof??el?im?sq??m&a?da?e&gatnoc?leb??f?ic?oc!.&duolclautriv.elacs.sresu,topsgolb,???nce?o&ariebir?c&e?narboir?saso??d&o?ranreboas??e&g?t??i&b?dar?ecam?r??rp?t&a?erpoir???p&er?m!e?t??ooc?pa?se??qra?r&af?ga?o&davlas?j??tn?ut??s&a&ixac?mlap?nipmac??ed?u&anam?j?m???t&am?e&d?n?v??nc?o&f?n??ra?sf??u&caug9?de?ja?rg??v&da?ed?og!.&a&b?m?p??bp?c&a?s??e&c?p?s??fd?gm?ip?jr?la?ma?nr?o&g?r?t??p&a?s??r&p?r??s&e?m?r??tm???rs?t??xiv?z&hb?ls?o&c?f?????c!.&as?ca?de?if?o&c?g??ro???e&bew?ccos?dnik?e&b?n&igne?oip??rac??gni&arg?rheob??h&cor?sok?t&aew?orb???itnorf?k&col?o&p?rb???l&aed?ffeahcs??mal?nes?pinuj?t&a&eht?rebsnegömrev??law?nec?s&acnal?nom?ubkcolb??upmoc??v&o&c&sid?tfiws??rdnal??resbo??wulksretlow?ywal?zifp??f!.&aterg?bew-no,drp?e&c&itsuj-reissiuh?narf-ne-setsitned-sneigrurihc,?lipuog,rianiretev??hny,i&cc?rgabmahc??m&o&c?n??t??n&eicamrahp?icedem??ossa?pohsdaerpsym,s&e&lbatpmoc-strepxe?riaton?tsitned-sneigrurihc?uova??o&-x&bf,obeerf,?x&bf,obeerf,???t&acova?o&or-ne,psgolb,?r&epxe-ertemoeg?op!orea????vuog??avc7ylqbgm--nx?s??g!.&gro?moc?t&en?opsgolb,?ude?vog???h!.&e&erf,man??mo&c?rf??topsgolb,zi??ur??i!.&a&61f4a3abgm--nx?rf4a3abgm--nx??ca?di?gro?hcs?oc?ten?vog?نار&يا?یا???a&h?per??ew?lf??k!.&c&a?s??e&n?p?r??gk?iggnoeyg?kub&gn&oeyg?uhc??noej??l&im?uoes??man&gn&oeyg?uhc??noej??n&as&lu?ub??o&e&hcni?jead??wgnag???o&c?g??ro?s&e?h?m??topsgolb,u&gead?j&ej?gnawg????cilf??l!.&gro?moc?ten?ude?vog???m!.&topsgolb,vog???n!.&gro?moc?ofni?ten?ude?vog?zib???o&htua?odtnorf?t&c&a?od??laer???p!.&alsi?ca?eman?forp?gro?moc?o&fni?rp??t&en?se??ude?vog?zib???s?t!.&21k?bew?cn!.vog??eman?gro?kst?l&e&b?t??im?op??moc!.topsgolb,?neg?ofni?pek?rd?sbb?ten?ude?v&a?og?t??zib??f?m??ubad?vd??s&8sqif--nx?9zqif--nx?a!.vog?birappnb?gev?lliv?mtsirhc?s??b!.&ew,gro?moc?ten?ude?vog??c?oj?s?u??c&i&hparg?p?t&sigolyrrek?ylana???od??d&a?d?l?n&iwriaf?omaid??oogemoh?rac??e!.&bog?gro?mo&c!.topsgolb,?n??pohsdaerpsym,ude??civres!.enilnigol,?d&d2bgm--nx?oc??h&ctaw?guh??i&lppus?rtsudni?treporp!yrrek???jaiv?l&aw?cycrotom?etoh?gnis?pats??m&ag?oh?reh??nut?ohs?picer?r&it?ut&cip!.7331,?nev???s!i&rpretne?urc??ruoc??taicossa?vig??g!nidloh??h5c822qif--nx?i!.&ekacpuc,gro?moc?t&en?ni?opsgolb,?ude?vog??a09--nx?nnet?rap?targ??k&c&or!.&ecapsbew,snddym,ytic-amil,??us??hxda08--nx?row??l!.&c&a?s??ed,gro?o&c?fni??ten?ude?vog?zib??a&ed?tner??e&ssurb?toh!yrrek???lahsram?m?oot??m!.&bal,etisinim,gro?moc?ten?ude?vog??b?etsys!.tniopthgink,?ialc??n&a&f?gorf?ol??egassap?i&a&grab?mod??giro??o&it&acav?cudorp?ulos??puoc???o&dnoc?geuj?leuv?ppaz?t&ohp?ua???p!.&ces?gro?moc?olp?ten?ude?vog??i&hsralohcs?lihp?t??u??r!.&au,ca?gro?ni?oc?topsgolb,ude?vog?xo,yldnerb.pohs,?a&c?p?tiug??c?e&dliub!.etisduolc,?erac?gor?levart?mraf?n&niw?trap??wolf??ot&cartnoc?omatat??pj?uot??s!.&em?gro?hcs?moc?ten?ude?vog?zib??alg?e&n&isub!.oc,?tif??rp!xe!nacirema???xnal??iws??t&a&e&b?ytic??ob??ek&cit?ram??fig?h&cay?gilf??n&atnuocca?e&mt&rapa?sevni??ve!.oc,???rap??u!.&a&c!.&21k?bil?cc???g!.&21k?bil?cc???i!.&21k?bil?cc???l!.&21k?bil?cc???m!.&21k!.&hcorap?rthc?tvp???bil?cc???p!.&21k?bil?cc???si?v!.&21k?bil?cc???w!.&21k?bil?cc????c&d!.&21k?bil?cc???n!.&21k?bil?cc???s!.&21k?bil?cc????d&e&f?lacsne.xhp,?i!.&21k?bil?cc???m!.&21k?bil?cc???n!.&bil?cc???s!.&bil?cc???u&olcrim,rd,??e&d!.&21k?bil,cc???las-4-&dnal,ffuts,?m!.&21k?bil?cc???n!.&21k?bil?cc????h&n!.&21k?bil?cc???o!.&21k?bil?cc????i&h!.&bil?cc???m!.&21k?bil?c&c?et??goc?n&eg?otae??robra-nna?sum?tsd?wanethsaw???nd?r!.&bil?cc???v!.&21k?bil?cc???w!.&21k?bil?cc????jn!.&21k?bil?cc???k&a!.&21k?bil?cc???o!.&21k?bil?cc????l&a!.&21k?bil?cc???f!.&21k?bil?cc???i!.&21k?bil?cc????mn!.&21k?bil?cc???n&afflog,i!.&21k?bil?cc???m!.&21k?bil?cc???sn?t!.&21k?bil?cc????o&c!.&21k?bil?cc???m!.&21k?bil?cc???ttniop,?p&ion,rettalp,?r&a!.&21k?bil?cc???o!.&21k?bil?cc???p!.&21k?bil?cc????s&a!.&21k?bil?cc???dik?k!.&21k?bil?cc???m!.&21k?bil?cc???nd&deerf,uolc,??t&c!.&21k?bil?cc???m!.&21k?bil?cc???u!.&21k?bil?cc???v!.&21k?bil?cc????ug!.&21k?bil?cc???v&n!.&21k?bil?cc???w!.cc???x&ohparg,t!.&21k?bil?cc????y&b-si,k!.&21k?bil?cc???n!.&21k?bil?cc???w!.&21k?bil?cc????za!.&21k?bil?cc????ah!uab??bria?col?e!.ytrap.resu,?ineserf?lp?xe&l?n???vt?w!.&66duolc,gro?moc?s&ndnyd,tepym,?ten?ude?vog??a?e&iver?n!.elbaeciton,??odniw??y&alcrab?cam?ot???t&0srzc--nx?a!.&amil4,ca!.hts??gni&liamerutuf,tsoherutuf,?o&c!.topsgolb,?fni,?p&h21,ohsdaerpsym,?r&euefknuf.neiw,o??v&g?irp,?xi2,ytic-amil,zib,?c?e!s??hc?if?l!asite??mami?rcomed??b!.&gro?moc?ten?ude?vog??b?gl??c&atnoc?e&les?rid!txen????dimhcs?e!.&eman?gro?moc?ofni?ten?ude?vog?zib??b?em?grat?id?k&circ?ram??n!.&0&002cilc,rab,?1rab,2rab,5inu,6vnyd,7&7ndc.r,erauqs,?a&l&-morf,moob,?minifed,remacytirucesym,tadsyawla,z,?b&boi,g,lyltsaf:.pam,,?c&inagro-gnitae,paidemym,?d&ecalpb,irgevissam.saap.&1-&gs,nol,rf,yn,?2-&nol,yn,??nab-eht-ni,uolc&meaeboda,nievas.c&di-etsedron,itsalej,?xednay:.e&garots,tisbew,?,??e&c&narusnihtlaehezitavirp,rofelacs.j,?gdirbtib,ht-no-eciffo,l&acsnoom,ibom-eruza,?m&ecnuob,ohtanyd,tcerider,?n&ilno-evreser,ozdop,?rehurht,s:abapus,,tis-repparcs,zamkcar,?f&aeletis,crs.&cos,resu,?ehc-a-si,?g&ni&reesnes,sirkcilc,tsohnnylf,?olb&evres,tsaf,??k&catsvano,eeg-a&-si,si,?u,?l&acolottad,iamwt,s&d-ni,s-77ndc,??m&ac&asac,ih,?urofniem,?n&a&f&agp,lhn,?i&bed,llerk,??dcduabkcalb,i,pv-ni,?o&c-morf,duppa,jodsnd,rp-ytinummoc,ttadym,?p&i&-&etsef,on,?emoh,fles,nwo,?j,mac-dnab-ta,o&-oidar-mah,h&bew,sdaerpsym,??pa&duolc,egde,?tfe&moh,vres,?usnd,?r&e&tsulcyduolc,vres-xnk,?vdslennahc:.u,,?s&a&ila&nyd,snd,?nymsd,?bbevres,dylimaf,e&gde-ndc,suohsyub,t&isbeweruza,ys,??k&catstsaf,ekokohcs,?n&d&-won,d,golb,npv,?oitcnufduolc,?ppacitatseruza:.&2suts&ae,ew,?aisatsae,eporuetsew,sulartnec,?,s&a-skcik,ecca&-citats,duolc,???t&adies,ce&ffeym,jorprot:.segap,,?e&nretnifodne,smem,?farcenimevres,i-&ekorb,s&eod,lles,teg,??n&essidym,orfduolc,?r0p3l3t,s&ixetnod,oh&-spv:.citsalej.&cir,lta,sjn,?,gnik,???u&h,nyd,r:eakust.citsalej,,?ved-naissalta.dorp.ndc,x&inuemoh,spym,tsale.&1ots-slj,2ots-slj,3ots-slj,?unilemoh,?y&awetag-llawerif,ffijduolc:.&ed-1arf,su-1tsew,?,ltsaf.&dorp.&a,labolg,?lss.&a,b,labolg,?pam,slteerf,?n&-morf,ofipi,?srab,?z&a-morf,tirfym,???p?tcip?v??f&ig?o&l?sorcim???g!.&bog?dni?ed,g&olb,ro??lim?moc?ot,ten?ude???h!.&dem?gro?l&er?op??m&oc?rif??o&fni?rp?s&rep?sa???po&hs?oc??t&en?luda?ra??ude?vuog???i!.&a&2n-loritds--nx?7e-etsoaellav--nx?8&c-aneseclrof--nx?i-lrofanesec--nx??at?b?c!cul??dv?i&blo&-oipmet?oipmet??cserb?drabmol?g&gof?urep??l&gup?i&cis?me&-oigger?oigger???uig&-&aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf???aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf????n&a&brev?cul?pmac?tac??idras?obrac&-saiselgi?saiselgi??resi??otsip?r&b&alac!-oigger?oigger??mu??dna&-&attelrab-inart?inart-attelrab??attelrabinart?inartattelrab?ssela??epmi?ugil??tnelav&-obiv?obiv??vap?z&e&nev?ps&-al?al???irog???l&iuqa!l??leib??m&or?rap??n!acsot?e&dom?is?sec&-&ilrof?ìlrof??ilrof?ìlrof???g&amor&-ailime?ailime??edras?olob??i&ssem?tal??ne!var??o&cna?merc?rev?vas???oneg?p?r!a&csep?rr&ac&-assam?assam??ef??von??etam?tsailgo!-lled?lled???s!ip?sam&-ararrac?ararrac??u&caris?gar???t!a&cilisab?recam??resac?soa!-&d&-&ellav?lav??ellav?lav??ellav??d&-&ellav?lav??ellav?lav??ellav??te&lrab&-&airdna-inart?inart-airdna??airdnainart?inartairdna??ssinatlac???udap?v!o&dap?neg?tnam???zn&airb&-a&lled-e-aznom?znom??a&lledeaznom?znom??eaznom??e&c&aip?iv??soc?top??om???b&-&23,46,61,?3c-lorit-ds-onitnert--nx?be-etsoa&-ellav--nx?dellav--nx??c!f-anesec-lrof--nx?m-lrof-anesec--nx??he-etsoa-d-ellav--nx?m!u??o2-loritds-nezob--nx?sn-loritds&-nasl&ab--nx?ub--nx??nitnert--nx??v!6-lorit-dsnitnert--nx?7-loritds&-nitnert--nx?onitnert--nx???z&r-lorit-ds&-nitnert--nx?onitnert--nx??s-loritds-onitnert--nx???c&f?is?l?m?p?r?v??d&p?u!olcnys,??e&c!cel?inev?nerolf??f?g!ida&-&a&-onitnert?onitnert??otla!-onitnert?onitnert???a&-onitnert?onitnert??otla!-on&azlob?itnert??onitnert????hcram?l?m!or??n&idu?o&n&edrop?isorf??torc???p?r?s&erav?ilom??t!nomeip?s&eirt?oa!-&d-e&ellav?éllav??e&ellav?éllav???de&ellav?éllav??e&ellav?éllav?????v?znerif??g&a?b?f?il?o?p?r?up?vf??hc?i&b?c?dol?f?l!lecrev?opan?rof&-anesec?anesec???m?n&a&part?rt&-attelrab-airdna?attelrabairdna???imir?ret??p?r!a&b?ilgac?ssas???s!idnirb??t&ei&hc?r??sa??v??l&a!c??b?c?o&m?rit&-&d&eus&-&nitnert?onitnert??nitnert?onitnert??us&-&nitnert?onitnert??nitnert?onitnert??üs&-&nitnert?onitnert??nitnert?onitnert???s&-onitnert?onitnert???d&eus!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??us&-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??üs!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert???s&-onitnert?onitnert?????m&ac?f?i!t.nepo.citsalej.duolc,?ol?r??n&a!lim?sl&ab?ub???b?c?e!en.cj,v?zob??irut?m!p??p?r?t??o&a!v??b!retiv??c!cel??enuc?g!ivor??i&dem&-onadipmac?onadipmac??pmet&-aiblo?aiblo??rdnos?zal??l?m!a&greb?ret??oc?re&f?lap???n!a&dipmac&-oidem?oidem??lim?tsiro?zlob??ecip&-ilocsa?ilocsa??i&bru&-orasep?orasep??lleva?rot?tnert??r&elas?ovil??ulleb??p?r!a&sep&-onibru?onibru??znatac??oun??s!ivert?sabopmac??t!arp?e&nev?ssorg??n&arat?e&girga?rt?veneb????zz&era?urba???p&a?ohsdaerpsym,s?t??qa?r&a!m?s??b!a??c?f?g?k?me?o?p?s?t?v??s&a&b?iselgi&-ainobrac?ainobrac???b?c?elpan?i?m?ot?s?t?v??t&a?b?c?l?m?nomdeip?o!psgolb,?p?v??u&de?l?n?p??v&a?og?p?s?t?v??y&drabmol?ellav&-atsoa?atsoa??licis?nacsut??z&al?b?c?p??ìlrof&-anesec?anesec???derc?er?f?m!r??utni??je3a3abgm--nx?kh?l!.&topsgolb,vog??uda??m!.&gro?moc!.topsgolb,?ten?ude???n&a&morockivdnas?ruatser?tnuocca??e&g?m&eganam!.retuor,?piuqe??r??i!.ue?m?opdlog??opud?uocsid??o&b?cs!.&ude,vog:.ecivres,,??d?g?h?j?oferab?p&edemoh?s???p!.&emon?gro?lbup?moc?t&en?ni?opsgolb,?ude?vog???r&a!m&law?s???epxe?op&er?pus!.ysrab,?s???s!.&adaxiabme?e&motoas?picnirp?rots??gro?lim?moc?o&c?dalusnoc?hon,?ten?ude??a&cmoc?f??e&b?padub?r?uq??i!rolf?tned??o&h!.&duolc&p,rim,?e&lej,tiseerf,?flah,lrupmet,s&pvtsaf,seccaduolc,?tsafym,vedumpw,??p!sua???urt??t!.&eman?gro?ibom?levart?m&oc?uesum??o&c?fni?r&ea?p???pooc?sboj?t&en?ni??ude?vog?zib??ayh?n?o!bba?irram???uognah?xen?y!.gro,?ztej??u&2&5te9--nx?yssp--nx??a!.&a&s?w??civ?d&i?lq??fnoc?gro?moc!.&pohsdaerpsym,stelduolc.lem,topsgolb,??nsa?ofni?sat?t&ca?en?n??ude!.&a&s?w??ci&lohtac?v??dlq?sat?t&ca?n??wsn!.sloohcs????vog!.&a&s?w??civ?dlq?sat???wsn?zo??ti??c!.&fni?gro?moc?ten?ude?vog??i??d&e!.tir.segap-tig,?iab??e!.&dcym,enozgniebllew,noitatsksid,odagod.citsalej,snd&ps,uolc,?ysrab,??g!.&bew?gro?m&aug?oc??ofni?ten?ude?vog???h!.&0002?a&citore?idem?kitore??edszot?gro?ilus?letoh?m&alker?lif?t?urof??naltagni?o&c?ediv?fni?levynok?nisac??pohs?rarga?s&a&kal?zatu??emag?wen??t&lob?opsgolb,rops??virp?xe&s?zs??ytic?zsagoj??os?sut??l!.topsgolb,?m!.&ca?gro?moc?oc?ro?ten?vog???n!.&duolcesirpretne,eni&esrem,m,?tenkcahs,?em!.ysrab,??o&ggnaw?y!c???r!.&3kl,a&i&kymlak,rikhsab,vodrom,?yegyda,?bps,ca,duolcrim,e&niram,rpcm,?g&bc,nitsohurger.citsalej,ro,?ianatsuk,k&ihclan,s&m,rogitayp,??li&amdlc.bh,m,?moc,natsegad,onijym,pp,ri&b,d&cm:.spv,,orue,?midalv,?s&ar,itym,?t&en,ni,opsgolb,set,?u&4an,de,?vo&g,n,?ynzorg,zakvakidalv,?myc?p?ug??s!.&a&d&golov,nagarak,?gulak,i&groeg,kymlak,lerak,nemra,rikhsab,ssakahk,vodrom,zahkba,?lut,rahkub,vut,yegyda,znep,?bps,da&baghsa,rgonilest,?gunel,i&anatsuk,hcos,ovan,ttailgot,?k&alhsygnam,ihclan,s&legnahkra,m,n&a&mrum,yrb,?i&buytka,nbo,??tiort,vorkop,??l&ocarak,ybmaj,?na&gruk,jiabreza,ts&egad,hkazak-&htron,tsae,???ovonavi,r&adonsark,imidalv,?t&enxe,nek&hsat,mihc,??vo&hsalab,n,?ynzorg,z&akvakidalv,emret,??t&amok?i&juf?masih????v!.&em,g&olb,ro??moc?nc,ten?ude?ved,??ykuyr??v&b?c!.topsgolb,?ed!.&enilnigol,gnigats-oned,hcetaidem,lecrev,o&ned,tpyrctfihs,?ppa-rettalp,s&egap,rekrow,?vr&esi,uc,?weiverpbuhtig,ylf,??ih?l!.&di?fnoc?gro?lim?moc?nsa?ten?ude?vog???m!.&eman?gro?lim?m&oc?uesum??o&fni?r&ea?p???pooc?t&en?ni??ude?vog?zib???o&g?m??rt?s!.&bog?der?gro?moc?ude???t!.&bew-eht-no,naht-&esrow,retteb,?sndnyd,?d?gh?i?won??uqhv--nx??w&a!.moc?hs?l??b!.&gro?oc???c!.&gro?moc?ten?ude??cp??e&iver!.oby,?n?s??g?k!.&bme?dni?gro?moc?ten?ude?vog???m!.&ca?gro?m&oc?uesum??oc?pooc?t&en?ni??ude?vog?zib??b??o&csom?h!s??n?w??p!.&344x,de?en?o&c?g??ro?snduolc,ualeb???r!.&ca?gro?lim?oc?pooc?ten?vog??n??t!.&a46oa0fz--nx?b&82wrzc--nx?ulc??emag?gro?l&im?ru,?moc!.reliamym,?t&en?opsgolb,?ude?v&di?og?ta0cu--nx??zibe?業商?織組?路網???z!.&ca?gro?lim?oc?vog????x&a!.&cm,eb,gg,s&e,u,?tac,ue,yx,?t??c!.&hta,ofni,vog???e&d&ef?nay??ma!nab??rof?s??ilften?jt?m!.&bog?gro?moc?t&en?opsgolb,?ude??g?ma2ibgy--nx??o&b!x??f?rex??rbgn--nx?s!.vog??x&am&jt?kt??x???y&4punu--nx?7rr03--nx?a&d!i&loh?rfkcalb??ot??g?lp?p!ila??rot?ssin?wdaorb??b!.&duolcym,fo?hcetaidem,lim?moc!.topsgolb,?vog??ab?gur??c!.&ca?dtl?eman?gro?m&oc!.&ecrofelacs.j,topsgolb,??t??orp?s&egolke?serp??t&en?nemailrap??vog?zib??amrahp?nega??d&dadog?uts??e&kcoh?ltneb?n&dys?om?rotta??snikcm??g!.&eb,gro?moc?oc?ten?ude?vog??olonhcet!.oc,?rene??hpargotohp?id?k!.&gro?moc?ten?ude?vog??s??l!.&clp?d&em?i??gro?hcs?moc?ten?ude?vog??f?imaf!nacirema??l&a?il??ppus??m!.&eman?gro?lim?moc?t&en?opsgolb,?ude?vog?zib??edaca!.laiciffo,?ra??n&a&ffit?pmoc!ylimafa???os??o&j?s??p!.&gro?lim?moc?pooc?ten?ude?vog???r&e&corg?grus?llag?viled??lewej?otcerid?tnuoc?uxul??s!.&gro?lim?moc?ten?ude?vog??pil??t&efas?i&c?ledif?n&ifx?ummoc!.&bdnevar,gon,murofym,???r&ahc?uces??srevinu??laer?r&ap!.oby,?eporp??uaeb??u!.&bug?gro?lim?moc!.topsgolb,?ten?ude??b!tseb???van!dlo??xes??z&a!.&eman?gro?lim?moc?o&fni?rp??pp?t&en?ni??ude?vog?zib???b!.&az,gro?jsg,moc?ten?ude?vog???c!.&4e,inum.duolc.&rsu,tlf,?m&laer,urtnecatem.motsuc,?oc,topsgolb,??d!.&cos?gro?lop?m&oc?t??ossa?t&en?ra??ude?vog???ib!.&duolcsd,e&ht-rof,mos-rof,rom-rof,?izoj,nafamm,p&i&-on,fles,?ohbew,tfym,?retteb-rof,snd&nyd,uolc,?xro,?g??k!.&duolcj,gro?lim?moc?t&en?ropeletzak.saapu,?ude?vog???m!.&ca?gro?lim?oc?ten?ude?v&da?og????n!.&asq-irom--nx?ca?gro?htlaeh?i&r&c?o&am?ām???wi!k???keeg?l&im?oohcs??neg?oc!.topsgolb,?t&en?nemailrap?vog???a!niflla???rawhcs?s!.&ca?gro?oc???t!.&c&a?s??e&m?n??ibom?l&etoh?im??o&c?fni?g??ro?vt???u!.&gro?moc?oc?ten??rwon??yx!.&e&nozlacol,tisgolb,?gnitfarc,otpaz,??zub??λε?υε?авксом?брс!.&гро?до?ка?р&бо?п!у?????г&б?ро??дкм?зақ?итед?килотак?леб?мок?н&йално?ом??рку?сур!.&арамас,бпс,гро,зиб,ичос,ксм,м&ок,ырк,?рим,я,??тйас?фр?юе?յահ?לארשי?םוק?اي&روس?سيلم?ناتيروم??بر&ع?غملا??ة&كبش?ي&دوعسلا?روس??یدوعسلا??ت&ا&راما?لاصتا??را&ب?ڀ?ھب???ر&ئازجلا?ازاب?صم?طق??سنوت?عقوم?قارع?ك&تيب?يلوثاك??موك?ن&ا&تس&كاپ?کاپ??دوس?ر&يا?یا??مع?يلعلا??درالا?ميلا?ي&رحبلا?طسلف???ه&ارمه?يدوعسلا??وكمارا?يبظوبا?ۃیدوعسلا?टेन?त&राभ?ोराभ??नठगंस?मॉक?्मतराभ?ত&রাভ?ৰাভ??ালংাব?ਤਰਾਭ?તરાભ?ତରାଭ?ாயித்நஇ?ைக்ஙலஇ?்ரூப்பக்ஙிச?్తరాభ?ತರಾಭ?ംതരാഭ?ාකංල?มอค?ยทไ!.&จิกรุธ?ต็นเ?ร&ก์คงอ?าหท??ลาบฐัร?าษกึศ???ວາລ?ეგ?なんみ?アトス?トンイポ?ドウラク?ムコ?ル&グーグ?ーセ??ン&ゾマア?ョシッァフ??业企?东广?乐娱?亚基诺?你爱我?信中?务政?动移?博微?卦八?厅餐?司公?品食?善慈?团集?国中?國中?址网?坡加新?城商?尚时?山佛?店&商?网?酒大里嘉??府政?康健?息信?戏游?拉里格香?拿大?教主天?机手?构机!织组??标商?歌谷?浦利飞?港香!.&人個?司公?府政?絡網?織組?育教???湾台?灣&台?臺??物购?界世?益公?看点?科盈訊電?站网?籍書?线在?络网?网文中?聘招?販通?车汽众大?逊马亚?通联?里嘉?锡马淡?門澳?门澳?闻新?電家?국한?넷닷?성삼?컴닷??"); + "a&0&0trk9--nx?27qjf--nx?e9ebgn--nx?nbb0c7abgm--nx??1&2oa08--nx?apg6qpcbgm--nx?hbbgm--nx?rdceqa08--nx??2&8ugbgm--nx?eyh3la2ckx--nx?qbd9--nx??3&2wqq1--nx?60a0y8--nx??4x1d77xrck--nx?6&1f4a3abgm--nx?2yqyn--nx?5b06t--nx?axq--nx?ec7q--nx?lbgw--nx??883xnn--nx?9d2c24--nx?a&a?it??b!.&gro?lim?moc?sr,t&en?opsgolb,?ude?vog??abila?c?ihsot?m?n??c!.&b&a?m?n??c&b?g?q??ep?fn?k&s?y??ln?no?oc,p&i-on,ohsdaerpsym,?sn?t&n?opsgolb,?un?ysrab,?i&ma?r&emarp?fa??sroc??naiva?s??d&ats?n&eit?oh??om?sa?tl??eg?f&c?ob??g!emo?naripi?oy??hskihs?i&cnal?dem?hs?k!on??sa!.snduolc,??jnin?k&aso?dov?ede?usto??l!.&c,gro?moc?ofni?r&ep?nb,?t&en?ni??ude?vog??irgnahs?le&nisiuc?rbmuder???m!.&ca?gro?oc?sserp?ten?vog??ahokoy?e00sf7vqn--nx?m??n!.&ac?cc?eman?gro?ibom?loohcs?moc?ni?o&c?fni?rp??r&d?o??s&u?w??vt?xm??av?is?olecrab?tea??p!.&bog?ca?d&em?ls??g&ni?ro??mo&c?n??oba?ten?ude??c?g7hyabgm--nx?ra!.&461e?6pi?iru?nru?rdda-ni?siri???s??q!.&eman?gro?hcs?lim?moc?t&en?opsgolb,?ude?vog???r&az?emac?f4a3abgm--nx?n!d5uhf8le58r4w--nx??u&kas?tan???s!.&bup?dem?gro?hcs?moc?ten?ude?vog??ac!.uban.iu,?iv??t&ad?elhta?led?oyot??u!.&a&cinniv?emirc?i&hzhziropaz?stynniv??s&edo?sedo??tlay?vatlop??bs?cc,d&argovorik?o!roghzu??tl,?e&hzhziropaz?nvir?t??f&i?ni,?g&l?ro??hk?i&stvinrehc?ykstynlemhk??k&c?m?s&nagul?t&enod?ul??v&iknarf-onavi?orteporp&end?ind?????l&iponret?opotsa&bes?ves??p??m&k?oc?s?yrk??n&c?d?i?osrehk?v?ylov??o&c,nvor??p&d?p,z??r&c?imotihz?k?ymotyhz??sk?t&en?l?z??ude?v:c?e&alokin?ik??i&alokym?hinrehc?krahk?vl?yk??k?l?o&g!inrehc??krahk??r?,xc,y&ikstinlemhk?mus?s&akrehc?sakrehc?tvonrehc???z&ib,u????v!aj?bb?et?iv??waniko?x&a?iacal??yogan?z&.&bew?c&a?i&n?rga???gro?l&im?oohcs??m&on?t??o&c!.topsgolb,?gn??radnorg?sin?t&en?la??ude?vog?wal??zip???b&00ave5a9iabgm--nx?1&25qhx--nx?68quv--nx?e2kc1--nx??2xtbgm--nx?3&b2kcc--nx?jca1d--nx??4&6&1rfz--nx?qif--nx??96rzc--nx??7w9u16qlj--nx?88uvor--nx?a&0dc4xbgm--nx?c?her?n?ra?t??b!.&erots?gro?moc?o&c?fni??ten?ude?v&og?t??zib??a??c&j?s??d&hesa08--nx?mi??g?l!.&gro?moc?ten?ude?vog??m??s!.&gro?moc?ten?ude?vog???tc-retarebsnegmrev--nx?u&lc!.&elej,snduolc,y&nop,srab,??smas??p!.ysrab,??wp-gnutarebsnegmrev--nx??c&1&1q54--nx?hbgw--nx??2e9c2czf--nx?4&4ub1km--nx?a1e--nx?byj9q--nx?erd5a9b1kcb--nx??8&4xx2g--nx?c9jrb2h--nx??9jr&b&2h--nx?54--nx?9s--nx??c&eg--nx?h3--nx?s2--nx???a!.&gro?lim?moc?rrd,ten?ude?vog??3a09--nx!.&ca1o--nx?gva1c--nx?h&ca1o--nx?za09--nx??ta1d--nx?ua08--nx???da??b&a?b?ci?f76a0c7ylqbgm--nx?sh??c!.&eugaelysatnaf,gnipparcs,liamwt,nwaps.secnatsni,revres-emag,s&nduolc,otohpym,seccaptf,?xsc,?0atf7b45--nx?a1l--nx??e!.&21k?bog?dem?esab,gro?l&aiciffo,im??moc?nif?o&fni?rp??ten?ude?vog??beuq?n?smoc??fdh?i&l&buperananab?ohtac??n&agro?ilc?osanap??sum?tic??l!.&gro?moc?oc?ten?ude?vog?yo,?l??m!.&mt?ossa??p1akcq--nx??n!.&mon?ossa??i?p??relcel?s!.&gro?moc?ten?ude?vog???t!.&e&m,w,?hc,?s?w??v!.&e0,gro?lim?moc?ten?ude?v&g:.d,,og????wp?yn??d&2urzc--nx?3&1wrpk--nx?c&4b11--nx?9jrcpf--nx???5xq55--nx?697uto--nx?75yrpk--nx?9ctdvkce--nx?a!.mon?d?er?olnwod??b2babgm--nx?c!.vog?g9a2g2b0ae0chclc--nx??e&m!bulc??r!k??sopxe?timil?w??fc?g!.&ude?vog???h&d3tbgm--nx?p?t??i!.&ased?bew?ca?etrof,golbw,hcs?lim?o&c!.topsgolb,?g??palf,r&egolb,o??sepnop?ten?ym?zib??b?ordna?p?rdam??l&iub?og?row??m!.&ed,ot,pj,t&a,opsgolb,???n&a&b?l!.citats:.&setis,ved,?,raas???ob?uf??o&of?rp??r&a&c&tiderc?yalcrab??ugnav??ef506w4b--nx?k!.&oc,ude,?jh3a1habgm--nx??of??s!.&dem?gro?moc?ofni?ten?ude?v&og?t???m!kcrem???t!.topsgolb,excwkcc--nx?l??uolc!.&a&bura-vnej.&1ti,abura.rue.1ti,?tcepsrep,xo:.&ku,nt,?,?b&dnevar,ewilek:.sc,,?citsalej.piv,drayknil,elej,gnitsohdnert.&ed,hc,?letemirp:.ku,,m&edaid,ialcer.&ac,ku,su,??n&evueluk,woru,?r&epolroov,o&pav,tnemele,??tenraxa.1-se,ululetoj,xelpciffart,yawocne.ue,??za5cbgn--nx??e&1&53wlf--nx?7a1hbbgm--nx?ta3kg--nx??2a6a1b6b1i--nx?3ma0e1cvr--nx?418txh--nx?707b0e3--nx?a!.&ca?gro?hcs?lim?oc?t&en?opsgolb,?vog??09--nx??b!.&ca?gnitsohbew,nevueluk.yxorpze,pohsdaerpsym,snoitulostsohretni.duolc,topsgolb,?ortal?ut!uoy???c&0krbd4--nx?a&lp!.oc,?ps!.&lla4sx,rebu,tsafym,?artxe??sla??i!ffo??n&a&d?iler?nif?rusni!efil?srelevart???eics!.oby,??rofria??d!.&1sndnyd,42pi-nyd,7erauqs,amil4,b&ow-nrefeilgitsng--nx,rb-ni,vz-nelletsebgitsng--nx,?decalpb,e&daregtmueart,mohsnd,nihcamyek,?hcierebsnoissuksid,keegnietsi,lsd-ni,moc,n&-i-g-o-l,aw-ym,e&lletsebgitsnüg,sgnutiel,?i&emtsi,lreb-n&i,yd,??norblieh-sh.ti.segap,oitatsksid-ygolonys,pv&-n&i,yd,?nyd,?refeilgitsnüg,?orp-ytinummoc,p&h21,iog:ol,,ohsdaerpsym,?r&e&ntrapdeeps.remotsuc,su&-lautriv,lautriv,?t&adpusnd,tub-ni,uor-ym,?vres&-e&bucl,mohym,?bew-emoh:.nyd,,luhcs,??ogiv-&niem,ym,??s&d-&onys,ygolonys,?nd&-&dd,nufiat,sehcsimanyd,tenretni,yard,?isoc.nyd,ps,yard,?oper-&nvs,tig,?sndd:.&nyd,sndnyd,?,?topsgolb,vresi-&niem,tset,?xi2,y&awetag-&llawerif,ym,?srab,tic-amil,?zten&mitbel,sadtretteuf,??art!.oby,?i&sdoow?ug??nil?on--nx??e!.&bil?dem?eif?gro?irp?kiir?moc!.topsgolb,?pia?ude?vog??ei?ffoc?gg?r&f?ged???f&a&c?s??il??g!.&gro?lim?moc?t&en?vp??ude?vog??a&f?gtrom?p!.&3xlh,detalsnart,grebedoc,kselp,sndp,tengam,xlh,y&cvrp,kcor,???rots?yov??elloc?na&hcxe?ro??roeg?ug??i!.&pohsdaerpsym,topsgolb,vog??tilop?v&bba?om???j!.&fo,gro?oc?ten???k!.&c&a?s??e&m?n??ibom?o&c!.topsgolb,?fni?g??ro??i&b?l?n???l&a&dmrif?s!.rof,rof???b&a?i&b?dua???c&aro?ric??dnik?g!oog??i&bom?ms??l&asal?erauqa??ppa?uhcs?yts!efil???m!.&4&32i,p&ct,v,??66c,ailisarb,b&dnevar,g-raegelif,?ca?duolcsd,e&d-raegelif,i&-raegelif,lpad:.tsohlacol,,?pcm,?g&ro?s-raegelif,?hctilg,k&catsegde,uoc,?noitatsksid,o&bmoy,c!ku,?t&nigol,poh,??p&ion,j-raegelif,ohbew,?qbw,r&aegelif,idcm,ofsnd,?s&dym,ndd,ti!bt,?umhol,?t&en?s&acdnuos,ohon,??u&a-raegelif,de??v&irp?og??y&golonys,olpedew,srab,??a&g?n!.&reh.togrof,sih.togrof,???em?i&rp?twohs??orhc?w??n!goloc?i&lno!.&egats-oree,oree,ysrab,??w??o!.&derno:.gnigats,,ecivres,knilemoh,r&ednu,of,??hp?latipac?ts&der?e&gdirb?rif???z!.&66duolc,amil,sh,???ruoblem??om?p!.&bog?gro?lim?mo&c?n??t&en?opsgolb,?ude??irg?yks??r!.&mo&c?n??ossa?topsgolb,?a&c!htlaeh??pmoc?wtfos??bc?eh?if?ots!.&e&rawpohs,saberots,?yflles,??taeht?u&ces?sni?t&inruf?necca??za???s!.&a!bap.us,?b!ibnal?rofmok??c!a??d!b?n&arb?ubroflanummok???e?f!noc,?g!ro??h!f??i!trap??k!shf??l?m!oc,t??n!mygskurbrutan??o?p!ohsdaerpsym,p??r!owebdluocti,?s!serp?yspoi,?t!opsgolb,?u?vhf?w?x!uvmok??y?z??a&c?el?hc??i&er?urc??nesemoh?roh?uoh??t&a&d?ts&e!laer??lla???is!.&e&lej,nilnigol,r&etnim,ocevon,?winmo,?k&rowtenoilof,wnf,?laicosnepo,n&eyb,oyc,?spvtsaf,thrs,xulel,ysrab,?bew??ov?ra?t&ioled?ol??utitsni??u&lb?qi&nilc?tuob???v!.&21e?b&ew?ib?og??ce&r?t??erots?gro?lim?m&o&c?n??rif??o&c?fni??rar?stra?t&en?ni??ude?vog??as?e3gerb2h--nx?i&l!.xlh,?rd?ssergorp??ol??w&kct--nx?r??xul?y!.&gro?lim?moc?ten?ude?vog????f&0f3rkcg--nx?198xim--nx?280xim--nx?7vqn--nx?a!.&gro?moc?ten?ude?vog???b!.vog?wa9bgm--nx??c!.topsgolb,a1p--nx!.&a14--nx,b8lea1j--nx,c&avc0aaa08--nx,ma09--nx,?f&a1a09--nx,ea1j--nx,?gva1c--nx,nha1h--nx,pda1j--nx,zila1h--nx,??ns??ea1j--nx?g?iam?l&a1d--nx?og??n!.&bew?cer?erots?m&oc?rif??ofni?re&hto?p??stra?ten???orp?p!.&gro?moc?ude???rus?t!w??vd7ckaabgm--nx?w??g&2&4wq55--nx?8zrf6--nx??3&44sd3--nx?91w6j--nx!.&a5wqmg--nx?d&22svcw--nx?5xq55--nx??gla0do--nx?m1qtxm--nx?vta0cu--nx????455ses--nx?5mzt5--nx?69vqhr--nx?7&8a4d5a4prebgm--nx?rb2c--nx??a!.&gro?mo&c?n??oc?ten??vd??b!.&0?1?2?3?4?5?6?7?8?9?a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t!opsgolb,?u?v?w?x?y!srab,?z???c!b?za9a0cbgm--nx??e!.&eman?gro?ics?lim?moc!.topsgolb,?nue?ten?ude?vog??a??g!.&ayc,gro?lenap:.nomead,,oc?saak,ten???i&a?v??k!.&g&olb,ro??ku,lim?moc?oi,pj,su,ten?ude?v&og?t,???m!.&drp?gro?lim?m&o&c?n??t??oc?ude?vog??pk??n!.&dtl,eman?gro?hcs?i!bom??l&im?oc,?m&oc!.topsgolb,?rif,?neg,ogn,ten?ude?vog??aw?i!b!mulp??car?d&art?dew??h&sif?tolc??k&iv?oo&b?c???ls?n&aelc?iart??p!pohs??re&enigne?tac??t&ad?ekram!.&htiw,morf,??hgil?lusnoc?neg?ov?soh!.tfarcnepo,??vi&g?l???o!s??u&rehcisrev?smas?tarebsnegömrev???o&d?lb?og!.&duolc,etalsnart,???r&2n084qlj--nx?ebmoolb?o!.&77ndc.c:sr,,a&remacytirucesym,t&neimip,sivretla,?z,?bew-llams,d&ab-yrev-si,e&sufnocsim,vas-si,?nuof-si,oog-yrev-si,uolc&arfniarodef,mw,??e&a,cin-yrev-si,grof&loot,peh,?l&as-4-ffuts,poeparodef,?m&-morf,agevres,ohruoyslles,?n&ozdop,uma.elet,?r&ehwongniogyldlob,iwym,uces-77ndc.nigiro.lss,?t&adidnac-a-si,is&-ybboh,golb,???fehc-a-si,golbymdaer,k&eeg-a&-si,si,?h,nut,?l&i&amwt,ve-yrev-si,?lawerif&-ym,ym,?sd-ni,?m&acssecca,edom-elbac,?n&af&blm,cfu,egelloc,lfn,s&citlec-a-si,niurb-a-si,tap-a-si,?xos-a-si,?ibptth,o&itatsksid,rviop,?pv-ni,?o&jodsnd,tp&az,oh,??p&i&-on,fles,?o&hbew,tksedeerf,?tf&e&moh,vres,?ym,??r&e&gatop,ppepteews,su-xunil-a-si,?gmtrec,vdmac,?s&a&ila&nyd,snd,?nymsd,?b&alfmw,bevres,?d&ikcet.3s,ylimaf,?eirfotatophcuoc,j,koob-daer,ltbup,nd&-won,deerf,emoh,golb,kcud,mood,nyd:.&emoh,og,?,ps,rvd,tog,uolc,?s&a-skcik,ndd,?tnemhcattaomb,u,?t&ce&jorparodef.&duolc,gts.so.ppa,so.ppa,?riderbew,?e&ews-yrev-si,nretni&ehtfodne,fodne,??hgink-a-si,oi-allizom,s&ixetn&od,seod,?o&h-emag,l-si,?rifyam,??ue:.&a&-q,c,?cm,dc,e&b,d,e,i,m,s,?g&b,n,?hc,i&f,s,?k&d,m,s,u,?l&a,i,n,p,?n&c,i,?o&n,r,ssa,?pj,r&f,g,h,k,t,?s&e,i:rap,,u,?t&a,en,i,l,m,ni,p,?u&a,de,h,l,r,?vl,y&c,m,?z&c,n,??,vresnyd,x&inuemoh,unilemoh,?y&limafxut,srab,???ub&mah?oj???s!.&delacsne,gro?moc?rep?t&en?opsgolb,?ude?vog??gb639j43us5--nx??t?u!.&c&a?s??en?gro?moc?o&c?g??ro?topsgolb,??v!.ta,a1c--nx??wsa08--nx??h&0ee5a3ld2ckx--nx?4wc3o--nx!.&a&2xyc3o--nx?3j0hc3m--nx?ve4b3c0oc21--nx??id1kzuc3h--nx?l8bxi8ifc21--nx?rb0ef1c21--nx???8&8yvfe--nx?a7maabgm--nx??b!.&gro?moc?ten?ude?vog??mg??c!.&7erauqs,amil4,duolc-drayknil,gniksnd,p&h21,ohsdaerpsym,?sndtog,topsgolb,wolf.e&a.1pla,nigneppa,?xi2,ytic-amil,?aoc?et?ir!euz??r&aes!errecnac??uhc??sob?taw!s???d0sbgp--nx?f&2lpbgm--nx?k??g!.&gro?lim?moc?ude?vog???m!a1j--nx??ocir?p!.&gro?i?lim?moc?ogn?ten?ude?vog???s!.&g&nabhsah,ro??l&im?xv,?m&oc?roftalp.&cb,su,tne,ue,??pib,ten?vog?won,yolpedew,?a&c?nom??i&d?f?ri???t!.&ca?enilno,im?ni?o&c?g??pohs,ro?ten??iaf!.oby,?laeh!.arh,?orxer?ra&ba?e???vo!.lopdren,?zb??i&3tupk--nx?7a0oi--nx?a!.&ffo?gro?moc?ten?uwu,?1p--nx?bud?dnuyh?tnihc??b!.&gro?moc?oc?ro?ude??ahduba?o!m!.&duolcsd,ysrab,???s??c!.&ayb-tropora--nx?ca?d&e?m??esserp?gro?ln,moc?nif,o&c?g?ssa??ro?t&en?ni?roporéa??ude?vuog??cug?t??d&dk?ua??e&bhf--nx?piat??f!.&aw5-nenikkh--nx,dnala?i&ki,spak,?mroftalpduolc.if,nenikkäh,pohsdaerpsym,retnecatad.&omed,saap,?topsgolb,yd,?onas??g!.&d&om?tl??gro?moc?ude?vog???h&c&atih?ra??s&abodoy?ibustim???juohs?k!.&gro?moc?ofni?ten?ude?vog?zib??b4gc--nx?iw?nisleh?s?uzus??l!.&aac,topsgolb,?drahcir?iamsi??maim?n!.&b&ew?og??ca?gro?lim?mo&c?n??ni?o&c?fni??pp?t&en?ni??ude?zib??airpic?i&hgrobmal?m??re??om?rarref?s!.&egaptig,ppatig,topsgolb,?ed??t&aresam?i&c?nifni??rahb?tagub??ut?v!.&21k?gro?moc?oc?ten???wik?xa&rp?t??yf??j&6pqgza9iabgm--nx?8da1tabbgl--nx?b!.&ossa?topsgolb,uaerrab?vuog???d?f!.&ca?eman?gro?lim?moc?o&fni?rp??ten?vog?zib???nj?s?t!.&bew?c&a?in??eman?gro?lim?moc?o&c?g??t&en?ni?set??ude?vog?zib???yqx94qit--nx??k&8uxp3--nx?924tcf--nx?arfel?c&a&bdeef?lb??ebdnul?ilc?reme??d!.&erots,ger,mrif,oc,pohsdaerpsym,topsgolb,zib,?t??e&es?samet??h!.&a&4ya0cu--nx?5wqmg--nx??b3qa0do--nx?cni,d&2&2svcw--nx?3rvcl--nx??5xq55--nx?tl,?g&a0nt--nx?la0do--nx?ro??i&050qmg--nx?7a0oi--nx?xa0km--nx??m&1qtxm--nx?oc??npqic--nx?saaces,t&en?opsgolb,?ude?v&di?og?ta0cu--nx??xva0fz--nx?人&个?個?箇??司公?府政?絡&網?网??織&組?组??织&組?组??络&網?网??育&敎?教???n??i&tsob?vdnas??l!.&bew?c&a?os??dtl?gro?hcs?letoh?moc?nssa?ogn?prg?t&en?ni??ude?vog??at?cd?is??m!.&eman?fni?gro?moc?t&en?opsgolb,?ude?vog???n&ab!cfdh?etats?mmoc?t&en?fos??u??i!l!.&noyc,pepym,??p???oob?p!.&b&ew?og??gro?kog?m&af?oc??nog?ofni?pog?sog?ten?ude?vog?zib???row!.&morf,ot,?ten!.&htumiza,nolt,o&c,vra,??doof???s!.topsgolb,?t?u!.&c&a?lp??d&om?tl??e&cilop?m??gro!.&gul:g,,sgul,yr&ettoly&lkeew,tiniffa,?tneelffar,???lenap-tnednepedni,n&noc,oissimmoc-&layor,tnednepedni,??o&c!.&bunsorter.tsuc,e&lddiwg,n&ilnoysrab,ozgniebllew,??krametyb.&hd,mv,?omida,p&i-on,ohsdaerpsym,?t&fihsreyal.j,opsgolb,?vres-hn,ysrab,??rpoc,?psoh,shn?t&en?nmyp,seuqni-tnednepedni,?vog!.&eci&ffoemoh,vres,?ipa,??weiver-tnednepedni,y&riuqni-&cilbup,tnednepedni,?srab,????l&04sr4w--nx?a!.&gro?lim?moc?t&en?opsgolb,?ude?vog??bolg?c?ed?g!el??i&c&nanif!.oc,lpl??os??romem?tnedurp??n&if?oitanretni??t&i&gid!.sppaduolc:.nodnol,,?p&ac?soh???ned?ot??utum!nretsewhtron???c!.&bog?lim?oc?topsgolb,vog???dil?e&datic?n&ahc?nahc!gnikooc?levart?rehtaew???t!ria?tam??vart??f&8f&pbgo--nx?tbgm--nx??a?n??g!.&gro?moc?oc?ten?ude?xx,zib,??h&d?op??i!.&21k?ca?fdi?gro?inum?oc!.&egapvar,redrotibat,topsgolb,??ten?vog??a&f?m&e?g?toh???m?r??l&a&b&esab?t&eksab!.&sua,zn,??oof???c?mt??e&d?hs??ihmailliw?j??m!.&esserp?gro?moc?ten?ude?v&og?uog????n!.&no&med,rtsic,?oc,pohsdaerpsym,retsulc-gnitsoh,topsgolb,yalphk,?o??o&a?btuf?l!.gmo,?o&c!.&ed,rotnemele,??hcs??rit?u??p!.&a&cin&diws?gel??d&g,ortso?urawon??i&dem?mraw?nydg,?k&elo&guld?rtso??slopolam?tsu?ytsyrut??l&ip?o&kzs?w&-awolats?oksnok????n&erapohs,img?zcel,?rog&-ai&bab?nelej??j?z??syn?tsaim?w&a&l&eib?i?o??zsraw??o&namil?tainop,??z&eiwolaib?mol???c&e&iw&alselob?o&nsos?rtso???le&im?zrogz???orw,p??d&em,ia?ragrats?uolc&inu,sds,??e&c&i&lrog?w&ilg,o&hc&arats?orp??klop?tak????yzreibok??i&csjuoniws?ksromop?saldop??l&ahdop?opo??napokaz,tatselaer?z&romop?swozam???g&alble?ezrbo&lok?nrat??ro??hcyzrblaw?i&csomohcurein?grat?klawus??k&e&rut?walcolw??in&byr?diws,sark,?le?o&nas?tsylaib??rob&el?lam??s&als?jazel?nadg,puls?rowezrp???l&colw?e&r?vart??i&am?m???m&o&c?dar?n?tyb??s&g?iruot??t!a???n&a&gaz?nzop,?i&bul?cezczs?lbul,molow?nok?zd&eb?obeiws???uleiw?y&tzslo?z&rtek?seic????o&c,fni?k&celo?zdolk??lkan?n&leim?pek?t&uk?yzczs??z&copo?eing?rowaj???rga?tua?w&ejarg?ogarm???p&e&eb,lks!emoh,??klwwortso?ohs!-ecremmoce,daerpsym,??romophcaz?sos?t&aiwop?en?opos,ra,sezc??ude?v&irp?og!.&a&p?s!w???bni&p?w??ci?dtiw?essp?fiw?g&imu?u??hiiw?m&igu?rio?u!o???nds?o&ks?p!pu??s?wtsorats??p&a?sp!mk?pk?wk??u&m?p??wk?z??r&ksw?s??s&i?oiw?u?zu??talusnok?w&gzr?i&p?rg?w??m?opu?u!imzw???zouw????w&a&l&corw?sizdow??w??o&golg?k&ark,ul?zsurp??r&az?gew??t&rabul,sugua??z&coks?sezr????xes?y&buzsak?d&azczseib?ikseb??hcyt?n&jes?lod-zreimizak??pal?r&ogt?uzam??walup?zutrak??z&am-awar?c&aprak?iwol?zsogdyb??dalezc?ib?s&i&lak?p??uklo????l??r&as?f?s??s!.&gro?moc?ten?ude?vog???t!.vog??ubnatsi?x3b689qq6--nx?yc5rb54--nx??m&00tsb3--nx?1qtxm--nx?981rvj--nx?a!.&aayn,enummoc?gro?moc?o&c?idar,ken,?t&en?opsgolb,??c!bew??dretsma?e&rts?t!.&citsalej,esruocsid,???fma?xq--nx??b!.&gro?moc?ten?ude?vog??i??c!.&moc?oc?ten?vog???d!.&gro?moc?ten?ude?vog???f!.&gro?moc?oidar,ten?ude??i??g!vu96d8syzf--nx??h?i!.&ca?gro?moc?o&c!.&clp?dtl???r,?t&en?t??vt??k?rbg4--nx??k!.&drp?e&rianiretev?sserp??gro?lim?m&o&c?n??t??nicedem?ossa?pooc?s&eriaton?neicamrahp?sa??ude?v&og?uog????l&if?ohkcots??o!.&dem?gro?m&oc?uesum??o&c?rp??ten?ude?vog??b?c!.&2aq,3pmevres,5sndd,a&c&-morf,ir&bafno,fa,??g&-morf,oy-sehcaet,?i-morf,m&-morf,all&-a-si,amai,??p&-morf,c-a-si,?r&emacytirucesym,odih,?s,tadtsudgniht,v-morf,w-morf,z,?b&dnevarym,ew&-sndnyd,draiw.segap,ottad,?ildts.ipa,?c&amytirucesemoh,d-morf,esyrcs,itsalej.omed,n&-morf,vym,?p&kroweht,ytirucesemoh,?q,rievres,s-morf,?d&aerotffuts,e&calpb,ifitrec-&si,ton-si,?llortnocduolc,rewopenignepw:.sj,,tsohecapsppa,?i&-morf,rgevissam.saap,?m-morf,n&-morf,abeht-htiw-si,?s-morf,uolc&-noitatsyalp,hr,iafaw.&d&ej,yr,?nol,?meaeboda,panqym:-&ahpla,ved,?,smetsystuo,tekcilc,ved&j,pw,??vreser,wetomer,?e&butuoyhtiw,ciffo-sndnyd,d:-morf,o&celgoog,n&il.srebmem,neve.&1-&su,ue,?2-&su,ue,?3-&su,ue,?4-&su,ue,????,erf&-sndnyd,sndd,?filflahevres,gnahcxeevres,i&hcet-a-si,p-sekil,?k&auqevres,irtsretnuocevres,?l&bitpa-no,googhtiw,?m&agevres,ina-otni-si,oh-&sndnyd,ta-sndnyd,??n&-morf,ilno&-evreser,ysrab,?og-si,?r&alfduolcyrt,ehwynanohtyp:.ue,,ihcec,?srun-a-si,t&i&nuarepo,s&-ybboh,aloy,tipohs,xiw,??omer-sndnyd,upmocsma,ysgolb,?v&als-elcibuc-a-si,i&lsndd,tavresnoc-a-si,??z&amkcar,eelg,iig,??fehc-a-si,g&ni&gats-&raeghtua,swennwot,?ksndd,robsikrow,tsoh-bt.etis,?o&fgp,lb&-sndnyd,pawodni,sihtsetirw,???h&n-morf,o-morf,?i&fiwehtno,h-morf,kiw-sndnyd,m-morf,pdetsoh,r-morf,w-morf,z&ihcppa,nilppa,??jn-morf,k&a&-morf,erfocsic,?cils-si,eeg&-a&-si,si,?sndd,?h,latsnaebcitsale:.&1-&htuos-pa,lartnec-&ac,ue,?ts&ae&-&as,su,?ht&ron-pa,uos-pa,??ew-&su,ue,vog-su,???2-ts&ae&-su,ht&ron-pa,uos-pa,??ew-&su,ue,??3-ts&aehtron-pa,ew-ue,??,o-morf,r&adhtiwtliub,ow&-&sndnyd,ta-sndnyd,?ten-orehkcats,??u,?l&a&-morf,colottad,rebil-a-si,?f-morf,i&-morf,am&-sndnyd,detsohpw,??l&ecelffaw,uf-ytnuob:.a&hpla,teb,?,?ppmswa,ru-&elpmis,taen,?ssukoreh,xegap,?m&n-morf,pml.ppa,rofe&pyt.orp,rerac-htlaeh,?sacrasevres,uirarret-yltsaf,?n&a&cilbuper-a-si,f&-sllub-a-si,racsan-a-si,?i&cisum-a-si,ratrebil-a-si,??c,dc&hsums,umpw,xirtrepmi,?eerg-a-si,i-morf,m-morf,o&ehtnaptog,isam-al-a-tse,r&italik,tap-el-tse,?s&iam-al-a-tse,replausunu,??pj,t-morf,?o&bordym,c,hce-namtsop,jodsnd,m&-morf,ed-baltlow,?n:iloxip,,ttadym,?p&2pevres,aelutym,i&-sndnyd,fles,ogol,ruoy&esol,hctid,?ym&eerf,teg,??ohsdaerpsym,pa&-rettalp,anis:piv,,esaberif,k1,lortnocduolc,oifilauq,r&aegyks,oetem:.ue,,?tnorfegap,ukoreh,?t&fevres,thevres,??r&a:-morf,tskcor-a-si,,b,e&d&iv&erp-yb-detsoh.saap,orpnwo,?ner&.ppa,no,??e&bevres,nigne-na-si,?ggolb&-a-si,ndi,?h&caet-a-si,pargotohp-a-si,?krow-drah-a-si,n&gised-a-si,ia&rtlanosrep-a-si,tretne-na-si,??p&acsdnal-a-si,eekkoob-a-si,?retac-a-si,subq,tn&ecysrab,iap-a-si,uh-a-si,?vres&-&ki.&cpj-rev-duolcj,duolcj,?s&ndnyd,pvtsaf,??inim,nmad,sak,?y&alp-a-si,wal-a-si,?zilibomdeepsegap,?g,ituob,k,mgrp.nex,o&-morf,sivdalaicnanif-a-si,t&areleccalabolgswa,c&a-na-si,od-a-si,?susaym,??p-morf,u&as-o-nyd,e&tsoh.&duolc-gar,hc-duolc-gar,?ugolb-nom-tse,?omuhevres,??s&a&apod,ila&nyd,snd,?nymsd,vnacremarf,?bbevres,ci&p&-sndnyd,evres,?tcatytiruces,?dylimaf,e&cived-anelab,itilitu3,lahw-eht-sevas,mag-otni-si,t&i&iis,sro,?yskciuq,??i&ht2tniop,pa&elgoog,tneltneg,??jfac,k&-morf,aerf-ten,colb&egrof,pohsym,??m&-morf,cxolb,?n&d&-pmet,dyard,golb,htiwssem,mood,tog,?kselp,nyd,ootrac-otni-si,?o&-xobeerf,xobeerf,?ppa&raeghtua,tneg,?r&ac-otni-si,e&ntrap-paelut,tsohmaerd,??s&e&l-rof-slles,rtca-na-si,?ibodym,?tsaeb-cihtym.&a&llicno,zno,?ilay,lacarac,re&gitnef,motsuc,?sv,toleco,x:n&ihps,yl,?,?u,wanozama.&1-&htuos-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??la&nretxe-3s,rtnec-&ac&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????ts&ae&-&as&-&3s,etisbew-3s,?.kcatslaud.3s,?su:-etisbew-3s,.kcatslaud.3s,,?ht&ron-pa&-&3s,etisbew-3s,?.kcatslaud.3s,?uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-&3s,etisbew-3s,?.kcatslaud.3s,?vog-su-&3s,spif-3s,????2-ts&ae&-su&-3s,.&3s,etisbew-3s,kcatslaud.3s,??ht&ron-pa&-3s,.&3s,etisbew-3s,kcatslaud.3s,??uos-pa&-&3s,etisbew-3s,?.kcatslaud.3s,???ew-&su-&3s,etisbew-3s,?ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,????3&-tsew-ue&-3s,.&3s,etisbew-3s,kcatslaud.3s,??s,??yasdrocsid,?t&arcomed-a-si,c&-morf,etedatad.&ecnatsni,omed,??eel&-si,rebu-si,?hgilfhtiwletoh,m-morf,n&atnuocca-na-si,e&duts-a-si,r-ot-ecaps,tnocresu&buhtig,e&capsppa,donil.pi,lbavresbo.citats,?pl,???ops&edoc,golb,ppa,?s&i&hcrana-&a-si,na-si,?laicos-a-si,pareht-a-si,tra-na-si,xetn&od,seod,??oh&piym,sfn,??u&-morf,nyekcoh-asi,?v-morf,?u&-rof-slles,4,e,h,oynahtretramssi,r:ug-a-si,,?v&n-morf,rdlf,w-morf,?w&o&lpwons-yrt,zok,?ww100,?x&bsbf.sppa,em,i&nuemoh,rtrepmi,?obaniateb,t-morf,unilemoh,?y&a&bnx:.&2u,lacol-2u,?,l&erottad,pezam,?wetag-llawerif,?dnacsekil,fipohsym,k&-morf,niksisnd,?rotceridevitcaym,u:goo,,w-morf,x&alagkeeg,orp&hsilbup,mapson.duolc,???zesdrocsid,?inu??m!.&dna,rof,??or?tsla??p!.nwo,?raf!.jrots,etats??s?t!.&gro?lim?mo&c?n??oc?ten?ude?vog???u&esum!.&a&92chg-seacinumocelet-e-soierroc--nx?atnav?c&i&aduj?rfatsae??rollam??d&anac?enomaledasac?irolf??e&raaihpledalihp?srednu??g&hannavas?oonattahc??hamo?i&auhsu?bmuloc!hsitirb??dem?groeg?hpledalihp?l&artsua?etalif??n&igriv?rofilac??ssur?tsonod??ksa&la?rben??l&lojal?q-snl--nx?uossim!trof???m&a&bala?nap??enic?o&m?r???n&a&cirema?idni??edasap?ilorachtuos?olecrab??r&abrabatnas?ezzivs??su?t&nalta?osennim??zalp??c&dnotgnihsaw?ebeuq?i&depolcycne?ficap?hpargonaeco?lbup?sum?t&carporihc?lec?naltadim??vu??yn??d&a&dhgab?etsmraf?m?orliar??i&rdam?ulegnedleeb??leif?n&a!l&gne?nif?ragyduj?t&ocs?rop??yram???u&brofsdgybmeh?osdnaegami???r&augria?ofxo???e&c&a&l&ap?phtrib??ps??n&a&lubma?tsiser??e&fedlatsaoc?gilletni?ics!foyrotsih????pein?rof??d&nukneklov?revasem??e&rt?tsurt??f&atnas?ildliw??g&a&lliv?tireh!lanoitan???dirbmac?rog??i&cnum?nollaw??koorbrehs?l&ab?bib?cycrotom?i&ssim?txet??oks?tsac??m&affollah?it!iram??utsoc??n&golos?ilno?recul??r&a&uqs?waled!foetats???i&hs&acnal?kroy?pmahwen??otsih??omitlab?ut&an?cetihcra?inruf?luc!irga?su???vuol??s&abatad?iacnarf?sius?uoh!lum???t&a&locohc?rak?ts!e!yrtnuoc!su?????imesoy?tevroc??u&qihpargonaeco?velleb??vit&caretni?omotua???f&iuj?ohgrub??g&n&i&dliub?ginerevmuesum?kiv?lahw?nim?peekemit?vil??ulmmastsnuk??orf?r&ebnrats?u&b&ierf?le?m&ah?uan??ram?s&mailliw!lainoloc??naitsirhc?retepts??zlas??ob&irf?mexul?????h&atu?c&raeser?sirotsih?uot??g&ea1h--nx?rubsttip??si&tirb?wej??t&laeh?ro&n?wtrof??uo&mnom?y????i&d6glbhbd9--nx?iawah?k&nisleh?s??lad!rodavlas??sissa?tannicnic??k&c&nivleeg?olc!-dna-hctaw?dnahctaw???fj?inebis?l&is?ofron??na&rfenna?t??oorbnarc?r&am&ned?reiets??oy!wen????l&a&ci&dem?golo&eahcra?meg?oz??natob?rotsih??ertnom?iromem?noita&cude?n??oc?rutluc?trop?utriv?van??e&nurb?s&ab?surb??utriv??i&artnogero?sarb??l&a&besab?hsnoegrus??e&hs?rdnevle??i&b?m!dniw????o&bup?ohcs?tsirb???m&a&dretsma?ets?h&netlehc?rud???ct?elas!urej??l&if?ohkcots?u??raf?silanruoj?u&esumyrotsihlarutan?ira&tenalp?uqa??terobra???n&a&c!irema!evitan???gihcim?i&dni?tpyge??mfoelsi?wehctaksas??e&d&alokohcs?ews?rag!cinatob?lacinatob?s&nerdlihc?u????gahnepoc?hcneum?laftsew?ppahcsnetewruutan?r&dlihc?ednaalv?hu!dnutamieh???sseig??gised!dn&atra?utsnuk???h&ab!nesie??ojts??i&lreb?tsua??l&eok?ocnil??n&ob?urbneohcs??o&dnol?gero?i&s&iv&dnadnuos?elet??nam??t&a&c&inummoc?ude!tra???dnuof?erc?i&cossa?va??kinummokelet?nissassa?r&belectsevrah?oproc?tsulli??silivic?t&nalp?s??vres&erp?noclatnemnorivne??zilivic??c&elloc?if-ecneics??ibihxe???ri?s&dnah?imaj?reffej?sral??t&erbepac?nilc?sob???r&e&b?dom?tsew?uab?zul??obredap??vahnebeok?wot??o&2a6v-seacinumoc--nx?ablib?c&edtra?ixemwen?sicnarfnas??elap?g&a&cihc?to??eidnas??i&cadnuf?diserp?ratno??llecitnom?mitiram?nirot?r&htna?ienajedoir???pohskrow?qari?r&aw!dloc?livic??dd?e&b&ma?yc??irrac?llimsiwel?naksiznarf?papswen?t&aeht?exe?nec!ecneics?larutluc?muesum?tra??s&ehc&nam?or??neum??upmoc???ia!nepo??obal?u&asonid?obal?takirak???s&a&l&g?l&ad?eh???xet??di&k?pardnarg??e&cneics!larutan??dnal?hcsi&deuj?rotsih!nizidem?rutan??selhcs??itinamuh?l&aw?egnasol?l&e&rutansecneics?xurb??iasrev???r&e&em?ugif??tsac??suohcirotsih?u&en?q&adac?itna!nacirema?su????õçacinumoc!elet-e-soierroc???gnirpsmlap?htab?i&lopanaidni?rap?uoltnias?xa??l&essurb?lod??mraeriflanoitan?n&a&blats?l??erdlihc?oi&snam?tacinummoc!elet-dna-stsop???äl??re&dnalf?lttes?mraf?nim?tnececneics??s&alg?erp??t&farc!dnastra??nalp?olip?ra!e&nif?vitaroced!su???su?xuaeb???u&b!muloc??cric???t&agilltrop?cejorp?dats?e&esum?kramnaidni??iorted?ne&m&elttes?norivne?piuqemraf??vnoc??oped?r&a!drib?enif?gttuts?hsiwej?kcor?n&acirema?ootrac??tamsa?yraropmetnoc??op&aes?snart?wen??ufknarf??s&a&cdaorb?octsae??ewhtuos?ilayol?nuk?r&ohnemled?uhlyram??urt???u&a&bgreb?etalpodaroloc??rmyc??w&ocsom?rn??x&esse?ineohp?nam?tas??y&a&bekaepasehc?w&etag?liar???camrahp?doc?e&hsub?l&ekreb?l&av!eniwydnarb??ort???n&dys?om??rrus?s&nreug?rejwen???golo&e&ahcra?g??motne?nh&cet?te??oz?po&rhtna?t??roh??hpargotohp?l&etalihp?imaf??m&edaca?onortsa??n&atob?yn??ps?r&a&ropmetnoc?tilim??e&diorbme?llag!tra??vocsid??lewej?nosameerf?otsih!dnaecneics?ecneics?gnivil!su??la&col?rutan??retupmoc?su??tsudnidnaecneics??spelipe?t&eicos!lacirotsih??i&nummoc?srevinu??nuoc???z&arg?iewhcs?nil?ojadab?urcatnas??моки?םילשורי???rof??z!.&ca?gro?hcs?lim?moc?o&c?fni??ten?ude?vog?zib????n&315rmi--nx?a&brud?cilbuper?f?grompj?hkaga?idraug?m?ol?ssin?u&hix?qna??varac?yalo??b!.&gro?moc?oc,ten?ude?vog??c??c!.&ah?bh?c&a?s??d&5xq55--nx?g?s?uolctnatsni,?eh?g&la0do--nx?ro??h&a?q?s??i&7a0oi--nx?h??j&b?f?t?x?z??kh?l&h?im?j??m&n?oc!.swanozama.&1-htron-nc.3s,be.1-&htron-nc,tsewhtron-nc,????n&h?l?s?y??om?qc?s&g?j??ten?ude?vog?wt?x&g?j?n?s??z&g?x??司公?絡網?络网??b??d&g!.ypnc,?ka??e&drag?erg?fuak?gawsklov?hctik?i&libommi?w??m!.r&iaper,of,??po?r!ednaalv??sier?ves??g!.&ca?gro?moc?ten?ude?vog??is&ed!.ssb,?irev???h!.&bog?cc,gro?lim?moc?ten?ude???i!.&bew,c&a?in??dni?esabapus,gro?lim?mrif?neg?oc?s&er?nduolc,?t&en?opsgolb,?ude?vog?ysrab,?elknivlac?griv?ks?lreb?p?v?w!.taht,?x??k!.&gro?ten?ude?vog???l&eok?ocnil??m!.&cyn,gro?ude?vog???o&dnol!.&fo,ni,??i&hsaf!.fo,?n&o?utiderc??siv!orue??t&a&cude!.oc,?dnuof?tsyalp??c&etorp?u&a?rtsnoc?????kin?las?mrom?nac?p&q?uoc??s&iam?pe?scire??t&ron?sob??zama??p!.&gro?oc?ten?ude?vog??k??r&e&c?yab??op!.eidni,??s!.&gro?moc?osrep?t&opsgolb,ra??ude?v&inu?uog????t!.&d&ni?uolcegnaro,?gro?ltni?m&oc!nim??siruot??nif?o&fni?srep??sne?t&an?en??vog??m??u&f?r!.&bdnevar,lper,retropno,s&h,revres,?tnempoleved,??stad?xamay?y??v!.&ca?eman?gro?htlaeh?moc?o&fni?rp??t&en?ni?opsgolb,?ude?vog?zib???wo&rc?t!epac????o&76i4orfy--nx?a!.&bp?de?go?oc?ti?vg??boat??b!.&a&ci&sum?tilop??i&c&arcomed?neic??golo&ce?ncet??m&edaca?onoce??rt&ap?sudni??vilob??n&egidni?icidem??serpme?tsiver?vitarepooc??b&ew?og??dulas?e&rbmon?tr&a?op&ed?snart????g&olb?ro??ikiw?l&a&noi&canirulp?seforp??rutan??im??moc?o&fni?lbeup?rga?tneimivom??saiciton?t&askt?en?ni??ude?vt??h?iew?olg??c!.&bew?cer?dr&c,rac,?esabapus,gro?ipym,l&im?per:.di,,?m&o&c!.topsgolb,?n??rif??ofni?s&egap&dael,l,?tra??t&4n,en?ni??ude?vog??a?e?in?mara?s&edarb?ic???d!.&b&ew?og??dls?gro?lim?moc?t&en?ra??ude?vog??agoba?if?zd7acbgm--nx??e&c?d&iv?or??morafla??f!ni!.&e&g&delwonk-fo-l&errab,lerrab,?ellocevoli,?ht-skorg,rom-rof-ereh,tadpusn:d,,?llatiswonk,macrvd,ofni-v,p&i&-on,fles,?ohbew,?ruo-rof,s&iht-skorg,nd&-cimanyd,nyd,uolc,??tsrifyam,ysrab,zmurof,???g&el?n!am?ib???hwsohw?i!.&35nyd,8302,a&minifed,tad-b,?b&altig,uhtig,?czh,d&in,u&olc&iaznab.ppa,ropav,?rd,??e&c&apsinu.1rf-duolc,ivedniser,?donppad.sndnyd,egipa,lej,nilnigol,sufxob,t&i&beulb,snoehtnap,?newtu,ybeeb.saap,??gni&gatsniser.secived,tsohytsoh,?ilpu,k&coregrof.di,orgn,ramytefasresworb,?moc?n&mtsp:.kcom,,yded,?ot&oq,pyrctfihs,?p&opilol,pa&-arusah,e&nalpkcab,tybeeb.1dkes,???r&e&tsneum-hf,vres&cisab,lautriv,??ial.sppa,?s&codehtdaer,gnihtbew,nemeis-om,pparevelc,t&acdnas,ekcit,??t&e&kcubtib,notorp,?i&belet,detfihs,gude,kecaps,?raedon.egats,s&ohg,udgniht.&cersid.&dvreser,tsuc,?dorp.tsuc,gnitset.&dvreser,tsuc,?ved.&dvreser,tsuc,????vgib.0ku,whs,x&bslprbv.g,cq,rotide,?y&olpedew,srab,??b?d&ar?u&a?ts???j?r?syhp??j!.&eman?gro?hcs?lim?moc?ten?ude?vog???ll&ag?o??m!.&gro?moc?ten?ude?vog??g?il?mi?orp??n!.&a&0&b-ekhgnark--nx?c-iehsrgev--nx?g-lksedlig--nx?k-negnanvk--nx??1&p-nedragy--nx?q-&asierrs--nx?grebsnt--nx?lado-rs--nx?n&egnidl--nx?orf-rs--nx??regnayh--nx?ssofenh--nx??r-datsgrt--nx?s-ladrjts--nx?v-y&senner--nx?vrejks--nx???3g-datsobegh--nx?4&5-&dnaleprj--nx?goksnerl--nx?tednalyh--nx??6-neladnjm--nx?s-&antouvachb--nx?impouvtalm--nx??y-&agrjnevvad--nx?ikhvlaraeb--nx???7k-antouvacchb--nx?8&k-rekie-erv--nx?l-ladrua-rs--nx?m-darehsdrk--nx??a!.sg??bct-eimeuvejsemn--nx?d&do?iisevvad?lov?narts?uas??f&1-&l--nx?s--nx??2-h--nx??g&10aq0-ineve--nx?av?ev?lot?r&ajn&evvad?u??ájn&evvad?u????h?iz-lf--nx?j&ddadab?sel??k&el?hoj&sarak?šárák??iiv&ag&na&el?g??ŋ&ael?ág???ran???l&f?lahrevo?o&ms?s??sennev?t-&ilm--nx?tom--nx??u&-edr--nx?s??øms??muar?n&0-tsr--nx?2-dob--nx?5-&asir--nx?tals--nx??a&r!-i-om?f?t??t??douvsatvid?kiv?m&os?øs??n&od?ød??ra?sen?t&aouvatheig?ouv&a&c&ch&ab?áb??h&ab?áb???n??i&ag?ág??sa&mo?ttvid??án???z-rey--nx?ær&f?t???o&p-&ladr--nx?sens--nx??q-nagv--nx?r-asns--nx?s-kjks--nx?v-murb--nx?w-&anr&f--nx?t--nx??ublk--nx???ppol?q&0-t&baol--nx?soum--nx?veib--nx??x-&ipphl--nx?r&embh--nx?imph--nx???y-tinks--nx??r&f-atsr--nx?g-&an&ms--nx?nd--nx??e&drf--nx?ngs--nx??murs--nx?netl--nx?olmb--nx?sorr--nx??h-&a&lms--nx?yrf--nx??emjt--nx??i&-&lboh--nx?rsir--nx?y&d&ar--nx?na--nx??ksa--nx?lem--nx?r&ul--nx?yd--nx????stu??j-&drav--nx?rolf--nx?sdav--nx??kua?l-&drojf--nx?lares--nx??m-tlohr--nx?n-esans--nx?olf?p-sdnil--nx?s-ladrl--nx?tih?v-rvsyt--nx??s&a&ns?ons??i&ar?er&dron?r&os?øs???ár??la&g?h??mor!t??sir?uf?åns??t&koulo&nka?ŋká??la?p-raddjb--nx?r-agrjnu--nx?s&aefr&ammah?ámmáh??orf?r&o?ø???u-vreiks--nx??u&h-dnusel--nx?i-&drojfk--nx?vleslm--nx??j-ekerom--nx?k-rekrem--nx?u-&dnalr--nx?goksr--nx?sensk--nx??v-nekyr--nx?w-&k&abrd--nx?ivjg--nx??oryso--nx??y-y&dnas--nx?mrak--nx?n&art--nx?nif--nx??reva--nx??z-smort--nx??v!.sg?ledatskork?reiks??wh-antouvn--nx?x&9-dlofts--nx.aoq-relv--nx?d-nmaherk--nx?f-dnalnks--nx?h-neltloh--nx?i-drgeppo--nx?j-gve&gnal--nx?lreb--nx??m-negnilr--nx?n-drojfvk--nx??y&7-ujdaehal--nx?8-antouvig--nx?b-&dlofrs--nx?goksmr--nx?kivryr--nx?retslj--nx??e-nejsom--nx?f-y&krajb--nx?re&dni--nx?tso--nx??stivk--nx??g-regark--nx?orf?ørf??z9-drojfstb--nx??b&25-akiivagael--nx?53ay7-olousech--nx?a&iy-gv--nx?le-tl&b--nx?s--nx??n0-ydr--nx??c&0-dnal-erdns--nx?z-netot-erts--nx??g&g-regnarav-rs--nx?o-nejssendnas--nx??ju-erdils-ertsy--nx?nj-dnalh-goksrua--nx?q&q-ladsmor-go-erm--nx.&ari-yreh--nx?ednas??s-neslahsladrjts--nx???ca&4s-atsaefrmmh--nx?8m-dnusynnrb--nx?il-tl--nx?le-slg--nx?n5-rdib--nx?op-drgl--nx?uw-ynnrb--nx??d&a&qx-tggrv--nx?reh!nnivk?sd&ork?ørk??uas??ts&e&bi?kkar?llyh?nnan??g&ort?ørt??k&alf?irderf??levev?mirg?obeg&ah?æh??r&ah?ejg????barm-jdddb--nx?ie!rah?s&etivk?ladman???lof&r&os?øs??ts&ev.ednas?o.relav?ø.relåv???n&a&l&-erd&n&os?øs??ron??adroh.so?dron.&a&g5-b--nx?ri-yreh--nx??ob?y&oreh?øreh??øb??e&m!lejh??pr&oj?øj??vi??gyb?n&aks?åks??o&h-goksrua?rf??r&o?ua?ø??tros?øh-goksrua??rts!e&devt?lab?mloh???s&ellil?naitsirk?rof???u&l!os??s!d&im?lejt??e&guah?l&a?å???kkoh?lavk?naitsirk?r&af?eg&e?ie???tef?y&onnorb?ønnørb?????r&a&blavs!.sg??g&eppo?la???o&j&f&a!dniv?k?vk??die?e&dnas?kkelf??llins?r&iel?ots??s&lab?t&ab?åb??yt??å!k??ævk??les??ts??åg&eppo?lå???ureksub.sen??e&ayb-yrettn--nx?d&ar?lom?r&of?øf??år??g&gyr?nats??i&meuv&ejsem&aan?åån??sekaal??rjea??j&d&ef?oks??les??k&er&aom?åom??hgna&ark?årk??iregnir?kot!s??s&ig?uaf???l&bmab?kyb?l&av?ehtats??oh??m&it?ojt?øjt??n&arg?g&os?øs??meh?reil?te?ummok?yrb??r&dils-erts&ev?y&o?ø???ua?vod??sa&ans?åns??t&robraa?spaav??urg??f&62ats-ugsrop--nx?a&10-ujvrekkhr--nx?7k-tajjrv-attm--nx??o!.sg?h??s!.sg??v!.sg???g&5aly-yr&n--nx?v--nx??a&llor?ve&gnal?lreb???n&av!snellu??org??oks&die?m&or?ør??ner&ol?øl??r&o?ø???r&eb!adnar?edyps?s&die?elf?gnok?n&ot?øt????obspras??uahatsla?åve&gnal?lreb???h&0alu-ysm--nx?7&4ay8-akiivagg--nx?5ay7-atkoulok--nx??a!.sg???i&e&hsr&agev?ågev??rf??k&h&avlaraeb?ávlaraeb??s??lm&a?å??mpouvtal&am?ám??pph&al?ál??rrounaddleid?ssaneve?ššáneve??j&0aoq-ysgv--nx?94bawh-akhojrk--nx??k&a&b&ord?ørd??jks?lleis??iv!aklejps?l&am?evs?u??mag?nel?ojg?r&a&l?n??epok?iel?y&or?ør???s&ah?kel?om??øjg??kabene?ojsarak?ram&deh.&aoq-relv--nx?rel&av?åv??so??e&let.&ag5-b--nx?ob?øb??ra???åjks??l&a!d&anrus?d&numurb?ron??e&gnard?nte?s&meh?sin??ttin??g&is?nyl??kro?l&em?l&ejfttah?of??u&ag-ertdim?s???n&am?era?gos?i&b?nroh?r??kos?nus?oj??o-&dron?r&os?øs???ppo?r&a!l?nram??e&gne?l?v??is?o&jts?ts??u&a-&dron?r&os?øs???h??å?æl?øjts??s&e&jg?nivk?ryf??kav?mor-go-er&om.&ednas?yoreh??øm.&ednas?yøreh???uag??t&las?rajh?suan??v&l&a?e-rots??u-go-eron??yt??ksedlig?res&a?å???bib&eklof?seklyf??es!dah??h!.sg??i&m?syrt??l&ejf?ov&etsua?gnit?ksa?sdie???n!.sg??o!.sg?boh?g?h??r!.sg??å!ksedlig??øboh??m&a&rah?vk??f!.sg??h!.sg??i&e&h&dnort?rtsua?ssej??rkrejb??ksa??ol?t!.sg??u&dom?esum?r&ab?drejg?evle?os?uh?æb?øs??ttals???n&a&g&av?okssman?åv??jlis?or?r&g?rev???e&d&do&sen?ton??lah?r&agy&o?ø??ojfsam???g&iets?n&a&l&as?lab??n&avk?ævk??t&arg?ddosen??v&al?essov???i&d&ol?øl??l&ar?ær???yl??reb??iks?k&srot?y&or?ør???l&a&d&gnos?n&er?ojm?øjm??om??tloh??ug?åtloh??mmard?ojs&om?sendnas??ppolg?s&lahsladr&ojts?øjts??o??t&o&l?t-erts&ev?o?ø???roh?øl??vly&kkys?nav??yam-naj!.sg??øjs&om?sendnas???g&orf?ujb??i&dnaort?vnarg??kob?ladendua?maherk&a?å??n&it?urgsrop??orf-&dron?r&os?øs???r&aieb?evats??sfev?uaks?yrts??o&6axi-ygvtsev--nx?c,d&ob?rav??ievs?kssouf?l&m&ob?øb??ous&adna?ech&ac?áč???so!.sg???msdeks?niekotuak?r&egark?olf?y&oso?øso???s&dav?mort???p&ed?ohsdaerpsym,p&akdron?elk???r&a&d&dj&ab?áb??iab??jtif?luag?mah?vsyt??e&gn&a&k&iel?ro??merb?n&at?mas??rav-r&os?øs??srop?talf?v&ats?el??y&oh?øh???ivsgnok??il?jkniets?k&a&nvej?rem?s&gnir?nellu???ie-er&den?v&o?ø???ram?sa?årem??la&jf?vh??m&b&ah?áh??mahellil??nnul?ts&l&oj?øj??ul??y&o?ø???imp&ah?áh??m!.sg??osir?t!.sg??ádiáb?ævsyt?øsir??s&adnil?en&dnas?e&dga?k&ri&b?k??som??ve??me&h?jg??nroh-go-ejve?s&a?ednil?k&o?ø??of?yt?å??tsev??gv?hf?igaval?o&r&or?ør??sman??so&fen&oh?øh??m?v??uh&lem?sreka.sen??å!dnil???t&a&baol?g&aov?grav??jjr&av-attam?áv-attám??l&a&b?s??ás??soum?ts?v&eib?our???e&dnaly&oh?øh??f?s&nyt?rokomsdeks?sen??vtpiks??in&aks?áks??loh&ar?år??n!.sg??o&m&a?å??psgolb,?s!.sg?efremmah?or?ør??terdi?á&baol?ggráv?lá&b?s??soum?veib???u&b!.sg?alk?e&dna?gnir?nner??les?ælk??dra&b?eb??g&nasrop?vi?ŋásrop??j&daehal&a?á??jedub?v&arekkhar?árekkhár???ksiouf?n&diaegadvoug?taed???v&irp?lesl&am?åm???y&b&essen?nart?sebel?tsev??o&d&ar?na!s??or??gavtsev?k&rajb?sa??lem?mrak?n&art?n&if?orb???r&a&mah?n?v??e&dni?t&so?ton??va??ul?yd??s&am?enner?gav?lrak?tivk??vrejks??ø&d&ar?na!s??ør??gåvtsev?k&rajb?sa??lem?mrak?n&art?n&if?ørb???r&e&dni?t&so?tøn??va??ul?yd?æ&n?v???s&enner?gåv?tivk?åm??vrejks???á&slág?tlá?vreiks??å&gåv?h?jddådåb?lf??ø&d&ob?rav??r&egark?olf??s&dav?mort????aki?i&sac?tal??u??o&b?f?g?hay?o?ttat??r!.&cer?erots?gro?m&o&c?n??rif?t??o&c,fni??pohs,stra?t&n?opsgolb,?www?ysrab,?e&a!.&a&ac?cgd?idem??bulc!orea??ci&ffartria?taborea??e&cn&a&l&lievrus-ria?ubma??netniam?rusni??erefnoc??gnahcxe?mordorea?ni&gne?lria?zagam??rawtfos??gni&d&art?ilg!arap?gnah???l&dnahdnuorg?ledom??noollab?retac?sael?t&lusnoc?uhcarap??vidyks??hcraeser?l&anruoj?euf?icnuoc?ortnoc!-ciffart-ria???n&gised?oi&nu?t&a&cifitrec?ercer?gi&tsevni-tnedicca?van??i&cossa!-regnessap??valivic??redef??cudorp?neverp-tnedicca????ograc?p&ihsnoipmahc?uorg!gnikrow???r&e&dart?enigne?korb?niart?trahc??o&htua?tacude???s&citsigol?e&civres?r??krow?serp!xe??tnega??t&farcr&ia?otor??hgil&f?orcim??liubemoh?n&atlusnoc?e&duts?m&esuma?n&iatretne?revog??piuqe????olip?ropria?si&lanruoj?tneics???w&erc?ohs??y&cnegreme?dobper?tefas????rref?z??p!.&a&aa?ca?pc??dem?ecartsnd.icb,gne?r&ab?uj??snduolc,t&acova?cca?hcer??wal?ysrab,???s!.&em?gro?hcs,moc?ten?ude?vog???t!.&116,ayo,gro?lim?moc?nayn,sulpnpv,t&cennockciuq.tcerid,en??ude?v&dr,og???o&hp?m?v?yk??tol?ua??v&iv?lov??xas?ykot??p&a&ehc?g?m?s??eej?g!.&gro?ibom?moc?ossa?ppa,ten?ude???i&r!.nalc,?v?z??j!.&a&3&5xq6f--nx?xqi0ostn--nx??5wtb6--nx?85uwuu--nx?9xtlk--nx?bihc!.&a&bihciakoy?don?ma&him?ye&ragan?tat???r&a&bom?gan?hihci??u&agedos?kas?ustak???s&os?ufomihs??t&amihcay?iran??w&a&g&im&anah?o??omak??kihci?zustum??ihsak??y&agamak?imonihci???e&akas?nagot??i&azni?esohc?h&asa?s&abanuf?ohc???ka&to?zok??musi?orihs?r&akihabihsokoy?o&dim?tak??ukujuk??usihs??nano&hc?yk??o&d&iakustoy?ustam??hsonhot?k&a&rihs?t??iba??nihsaran?sobimanim?tas&arihsimao?imot??uhc?yihcay??u&kujno?s&ayaru?t&imik?tuf???zarasik????g&as!.&a&gas?m&a&tamah?yik??ihsak??rat?t&a&gatik?hatik??ira!ihsin????e&kaira?nimimak??i&akneg?g&aruyk?o??h&c&amo?uo??siorihs??kaznak?modukuf?ra&gonihsoy?mi???nezih?u&k&at?ohuok??s&ot?tarak?????ihs!.&a&kok?m&a&hagan?yirom??ihsakat??rabiam?wagoton??e&miharot?nokih??houyr?i&azaihsin?esok?kustakat?moihsagih??na&mihcahimo?nok??o&hsia?mag?t&asoyot?ok?tir???us&ay?t&asuk?o??????k&aso!.&a&d&awihsik?eki??k&a&noyot?s&akaayahihc?oihsagih???oadat?uziak??m&ayas!akaso??odak??r&a&bustam?wihsak??ediijuf??t&akarih?i&k?us???wag&ayen?odoyihsagih???e&son?tawanojihs??honim?i&akas?h&cugirom?s&ayabadnot?i&a&kat?t??n??oyimusihsagih???k&a&rabi?sim??ustakat??muzi?r&ijat?otamuk???nan&ak?n&ah?es???o&ay?n&a&ganihcawak?simuzi?tak??eba?ikibah?oyot??t&anim?iad?omamihs??uhc??ust&oimuzi?tes????ou&kuf!.&a&d&amay?eos??g&no?ok?usak??hiku?k&awayim?uzii??ma&kan?y&asih?im???rawak?t&a&gon?ka&h?num?t???umo??wa&g&a&kan?nay?t??ias??ko!rih???y&ihsa?usak???e&m&ay?uruk??taruk?us??i&a&nohs?raihcat??goruk?h&cukuf?s&a&gih?hukuy??in???k&a&gako?muzim??iust?o?ustani??m&anim?otihsoynihs?u??r&ogo?ugasas??usu??ne&siek?zu&b?kihc???o&gukihc?h&ak?ot?ukihc??j&ono?ukihc??kayim?nihsukihc?to?uhc??u&fiazad?gnihs?stoyot????zihs!.&a&bmetog?d&amihs?eijuf?ihsoy?omihs??kouzihs?mihsim?ra&biah?honikam??tawi?wa&g&ekak?ukik??kijuf??yimonijuf??i&a&ra?sok??hcamirom?juf?kaz&eamo?ustam??ma&nnak?ta??nukonuzi?orukuf??nohenawak?o&nosus?ti??u&stamamah?z&a&mun?wak??i!ay?i&hs&agih?in??manim??mihs????????m&a&tias!.&a&d&ihsoy?ot?usah??k&a&dih?sa??o&arihs?s???m&a&tias?y&as?o&rom?tah??ustamihsagih???i&hsagurust?jawak??uri??ni?wa&g&e&ko?man??ikot?o??k&ara?i&hsoy?mak???ru?zorokot??y&a&g&amuk?ihsok?otah??kuf??imo??ziin??e&bakusak?ogawak?sogo?ttas?zokoy??i&baraw?h&cugawak?s&oyim?ubustam???iroy?k&ato?ihs?u&k?stawi???m&akoyr?i&hsoy?juf??uziimak???naznar?o&dakas?ihsay?jnoh?n&a&go?nim??imijuf?nah?oy??r&ihsayim?otagan??t&asim!ak??igus?omatik??zak??u&bihcihc!ihsagih??sonuok?ynah????y&ak&aw!.&a&d&ira?notimak??kadih?ma&h&arihs?im??y&a&kaw?tik??oduk???ru&ustakihcan?y??sauy?wa&g&a&dira?zok??orih??konik??yok?zok??e&banat?dawi??i&garustak?jiat?mani??naniak?o&bog?nimik?t&asim?omihs&ah?uk????ugnihs???o!.&a&jos?koasak?m&ay&ako?ust??ihsayah??r&abi?ukawaihsin??wi&aka?nam???e&gakay?kaw??i&gan?h&cu&kasa?otes??sahakat??k&asim?ihsaruk??miin??n&anemuk?ezib??o&hsotas?jnihs?n&amat?imagak??ohs?uhcibik?????ot!.&a&damay?got?koakat?may&etat?ot??nahoj?riat?waki&inakan?reman???eb&ayo?oruk??i&h&asa?ciimak?sahanuf??kuzanu?m&an&i?ot??ih???nezuyn?otnan?u&hcuf?stimukuf?z&imi?ou???????ihs&o&gak!.&a&m&ayuok?ihsogak??si?yonak??e&banawak?n&at&akan?imanim??uka??tomoonihsin??i&adnesamustas?k&azarukam?oih??m&ama?uzi??usuy??nesi?o&knik?os?tomustam??uzimurat???rih!.&a&ka&n?s??m&ayukuf?i&hsorihihsagih?j&ate?imakikaso????r&a&bohs?h&ekat?im???es??tiak?wiad??e&kato?ruk??i&h&ci&akustah?mono?nihs??s&inares?oyim???manimasa?uk??negokikesnij?o&gnoh?namuk??uhcuf????uk&ot!.&a&bihci?mi&hsu&kot?stamok??m??wagakan??egihsustam?i&gum?h&coganas?soyim??kijaw?m&anim?uzia??ukihsihs??nan&a?iak??o&nati?turan????uf!.&a&batuf?m&a&to?y&enak?irok???ihs&im?ukuf??os?uko??r&aboihsatik?uganat??ta&katik?mawak?rih??w&a&g&akus?emas?uy??k&a&mat?rihs?sa??ihsi??nah??ohs???e&gnabuzia?iman?ta&d?tii???i&adnab?enet?hs&agih?iimagak??k&a&wi?zimuzi??ubay??minuk?r&ook?ustamay???nihsiat?o&g&etomo?ihsin?nan?omihs??no!duruf?rih??rihsawani?ta&may?simuzia???u&rahim?stamakawuzia?zia&ihsin?nay???????nug!.&a&bawak?doyihc?k&anna?oi&hsoy?juf?mot???m&ayakat?ustagaihsagih??n&ihsatak?nak??r&ahonagan?nak?o?u&kati?mamat???t&amun?inomihs?o??w&akubihs?iem?ohs???i&hsa&beam?yabetat??kas&akat?esi??m&akanim?uzio??ogamust?rodim??o&jonakan?n&eu?oyikust??tnihs??u&komnan?stasuk?yrik?????ran!.&a&bihsak?d&akatotamay?u!o???guraki?m&ay&atik&imak?omihs??irokotamay??oki??ra&hihsak?n??wa&geson?knet???e&kayim?ozamay?sog?ustim??i&a&rukas?wak??garustak?h&ciomihs?sinawak??jo?ka&mnak?toruk??makawak?nos?r&net?otakat?ugeh???o&d&na?oyo??gnas?jnihs?nihsoy!ihsagih??tomarawat?yrok????t&ag&amay!.&a&dihsio?k&atarihs?ourust??may&a&kan?rum??enak?onimak??rukho?ta&ga&may?nuf??hakat?kas??wa&g&ekas?orumam??ki&hsin?m??z&anabo?enoy?ot???zuy??e&agas?bonamay?dii?nihsagih?o??i&a&gan?nohs??h&asa?sinawak??nugo??o&dnet?jnihs?ynan??ukohak???iin!.&a&ga?k&ium?oagan??munou!imanim??t&a&bihs?giin??ioy??w&a&gioti?kikes?zuy??irak??yijo??e&kustim?mabust??i&aniat?hcamakot?kaz&awihsak?omuzi??m&a&gat?karum??o???n&anust?esog??o&das?ihcot?jnas?k&ihay?oym??mak?naga?ries??u&ories?steoj?????i&ka!.&a&go?k&asok?oimak??t&ago!rihcah??ika!atik???w&aki?oyk???e&mojog?natim?suranihsagih?t&ado?okoy???i&hsoyirom?magatak?naokimak??nesiad?o&hakin?jnoh!iruy??nuzak?rihson?tasi&juf?m??yjnoh??u&kobmes?oppah????o!.&a&dakatognub?m&asah?ihsemih??su?t&ekat?i&h?o????e&onokok?ustimak??i&jih?k&asinuk?ias?usu??mukust??onoognub?u&fuy?juk?ppeb?suk??????wa&ga&k!.&a&mihsoan?rihotok?waga&kihsagih?ya???emaguram?i&j&nonak?ustnez??kunas?monihcu??o&hsonot?nnam?yotim??u&st&amakat?odat??zatu????nak!.&a&dustam?kus&okoy?tarih??maz?nibe?r&a&gihsaimanim?h&esi?imagas??wa&do?guy???u&im?kamak???tikamay?wa&k&ia?oyik?umas??sijuf??yimonin??e&nokah?saya??i&akan?esiak?gusta?hsuz?kasagihc?o?ukust??o&nadah?sio?tamay?????kihsi!.&a&danihcu?gak?kihs?mijaw?t&abust?ikawak??wazanak??i&gurust?hcionon?mon?ukah??nasukah?o&anan?ton!akan???u&kohak?stamok?z&imana?us?????niko!.&a&han?m&arat?ijemuk?uru??n&e&dak?zi??no??ra&hihsin?rih??wa&kihsi?niko??yehi?zonig??e&osaru?seay??i&hsagih?jomihs?k&a&gihsi?not??ihsakot??m&a&ginuk?kihsug?maz??igo?otekat??nuga!noy???n&a&moti?timoy?wonig??i&jikan?k???o&gan?jnan?tiad&atik?imanim???u&botom?kusug&akan!atik??imot??rab&anoy?eah???????c&204ugv--nx?462a0t7--nx?678z7vq5d--nx?94ptr5--nx?a??d&17sql1--nx?3thr--nx?5&20xbz--nx?40sj5--nx??7&87tlk--nx?ptlk--nx??861ti4--nx?a?e!tfarcdnah,??e&16thr--nx?5&1a4m2--nx?9ny7k--nx??im!.&a&bot?k&asustam?uzus??m&a&him?y&emak?im???ihs??nawuk?wi&em?k???e&bani?ogawak?si!imanim???i&arataw?gusim?h&asa?ciakkoy??k&a&mat?sosik?t??iat??raban??o&dat?hik?n&amuk?ihseru?o&du?mok????ust???lasrepus,mihe!.&a&m&a&h&ataway?iin??yustam??ij&awu?imak???taki!man???ebot?i&anoh?kasam?rabami??n&ania?egokamuk?oot??o&jias?kihcu?nustam?uhcukokihs?yi!es???u&kohik?zo????n!.&nriheg,teniesa.resu,?amihs!.&a&d&amah?ho?usam??kustay?m&a?ihsoni&hsin?ko???wakih??e&namihs?ustam??i&g&aka?usay??konikak?mikih??nannu?o&mu&kay?zi!ihsagih?uko???nawust?tasim??u&stog?yamat?????rotsnoihsaf,tawi!.&a&bahay?d&amay?on??koirom?t&a&honat?katnezukir??imus??w&as&ijuf?uzim??ihs???e&hon&i&hci?n??uk??tawi??i&a&duf?murak?wak??h&custo?si&amak?ukuzihs???j&oboj?uk??k&a&m&anah?uzuk??sagenak??esonihci??m&akatik?uzia&rih?wi????o&kayim?no&rih?t??tanufo??uhso????g&3zsiu--nx?71qstn--nx?l??h&03pv23--nx?13ynr--nx?22tsiu--nx?61qqle--nx??i&54urkm--nx?g&ayim!.&a&dukak?m&a&goihs?kihs??ihsustam!ihsagih??unawi??r&awago?iho??ta&bihs?rum??w&a&gano?kuruf??iat??y&imot?ukaw???e&mot?nimes??i&hsiorihs?ka&monihsi?s&awak?o???mak?r&ataw?o&muram?tan????o&az?jagat?t&asim?omamay???u&fir?k&irnasimanim?uhsakihcihs?????ihcot!.&a&g&a&h?kihsa??ust??kom?m&ay&o?usarak??unak??r&a&boihsusan?watho??iho?ukas??t&akihsin?iay??wa&konimak?zenakat??y&imonustu?oihs???e&iiju?kustomihs?nufawi??i&akihci?g&etom?ihcot?on???o&k&ihsam?kin??nas?sioruk?tab??u&bim?san?????h&c&ia!.&a&dnah?m&a!h&akat?im??yuni??ihs&ibot?ust???r&a&hat?tihs??ik?u&ihsagih?kawi???t&ihc?o&k?yot???wa&koyot?zani??yi&monihci?rak???e&inak?k&aoyot?usa??manokot?noyot??i&a&gusak?kot?sia??eot?h&asairawo?cugo?s&ahoyot?oyim???k&a&mok?zako??ihssi??motay?rogamag??n&an&ikeh?ok??ihssin??o&got?ihsin?jna?rihsnihs?suf?tes??u&bo?raho?s&oyik?takihs??yrihc?zah????ok!.&a&dusay?kadih?mayotom?r&ah&im?usuy??umakan??sot!ihsin??wa&g&atik?odoyin??k&as?o????i&esieg?hco!k??jamu?k&a!sus??usto??ma&gak?k??rahan??o&mukus?n&i?ust!ihsagih???torum?yot!o???u&koknan?zimihsasot????ugamay!.&a&m&ayukot?ihso??toyot??e&bu?subat??i&gah?kesonomihs?nukawi?rakih??nanuhs?otagan?u&ba?foh?otim?stamaduk?uy?????sanamay!.&a&dihsoyijuf?mayabat?r&ahoneu?ustakihsin??w&a&k&ayah?ijuf??suran??ohs???egusok?i&ak?h&cimakan?s&anamay?od???k&asarin?u&feuf?sto????o&k&akanamay?ihcugawakijuf??nihso?t&asimawakihci?ukoh??uhc??spla-imanim?u&b&nan?onim??fok?hsok?rust?????ka&rabi!.&a&bukust?gok?kan!ihcatih??m&a&sak?timo?wi??ihsak?ustomihs??ni?r&a&hihcu?way??u&agimusak?ihcust???t&ag&amay?eman??oihcatih??w&ag&arukas?o??os??yi&moihcatih?rom???e&bomot?dirot?not?tadomihs??i&a&k&as?ot??rao??esukihc?gahakat?h&asa?catih??k&a&rabi?saguyr??ihsani?uy??ma?rukustamat??o&dnab?giad?him?kati?rihsijuf?soj?t&asorihs?im??yihcay??u&fius?kihsu?simak????sagan!.&a&m&abo?ihsust??natawak?r&abamihs?u&mo?ustam???wijihc?yahasi??i&akias?hies?k&asagan?i??masah??neznu?o&besas?darih?t&eso?og!imaknihs????ust&igot?onihcuk?uf????zayim!.&a&biihs?guyh?k&oebon?ustorom??mihsuk?r&emihsin?uatik??ta&katik?mim??wag&atik?odak??ya??e&banakat?sakog??i&hsayabok?kaza&kat?yim??m&animawak?ot&inuk?nihs????nanihcin?o&j&ik?onokayim??n&ibe?ust??tias??urahakat????ro&moa!.&a&dawot?turust?wasim??e&hon&ihc&ah?ihs??nas?og?ukor??sario??i&anarih?ganayati?hsioruk?jehon?kasorih?makihsah?nawo?r&amodakan?omoa???o&gnihs?kkat??u&ragust?stum????ttot!.&a&r&ahawak?uotok??sa&kaw?sim???egok?irottot?nanihcin?o&ganoy?nih?tanimiakas??u&bnan?z&ay?ihc??????ukuf!.&a&deki?gurust?ma&bo?h&akat?im??yustak??sakaw??eabas?i&akas?ho?jiehie?ukuf??nezihce!imanim??ono????k&26rtl8--nx?4&3qtr5--nx?ytjd--nx??522tin--nx?797ti4--nx??l33ussp--nx?m&11tqqq--nx?41s3c--nx??n&30sql1--nx?65zqhe--nx?n7p7qrt0--nx??o&131rot--nx?7qrbk--nx?c?diakkoh!.&a&deki?gakihset?hcebihs?k&adih?u&fib?narihs???m&ayiruk?hot?ihs&orihatik?ukuf??oras?usta??r&ib&a!ka??o?uruf??ozo?u&gakihsagih?oyot???sakim?ta&gikust?mun??w&a&ga&k&an?uf??nus!imak???k&aru?i&h&asa?sagih??kat?mak??omihs?um??zimawi??ine?oyk??yot??e&a&mustam?nan??b&a&kihs?yak??o&noroh?to???ian?k&ihsam?ufoto??nakami?ppoko!ihsin??sotihc?tad!okah??uonikat??i&a&bib?mokamot?n&a&k&kaw?oroh??wi??eomak?ihsatu?okik?usta&moruk?sakan????eib?h&c&ioy?u&bmek?irihs???s&ase?ekka?oknar?uesom???jufirihsir?k&amamihs?i&at?n???m&atik?otoyot??oa&kihs?rihs??r&a&hs?kihsi?mot??ihs&aba?ir??otarib???n&a&hctuk?rorum?se?tokahs??uber??o&kayot?m&ire?ukay??naruf!ima&k?nim???orih?r&ih&ibo?suk??o&bah?h&i&b?hsimak??sa??pnan?yan??umen??t&asoyik?eko?ukoh???u&bassa?kotnihs?m&assaw?uo??pp&akiin?en&ioto?nuk??ip??rato?s&akat?t&eb&e?i&a?hs!a??robon??m&e?o&m?takan???no&h?tamah??o&mik?s?t??u&kir?ppihc?st???onihsnihs?ufuras??uaru??yru!koh??zimihs!ok?????g!oyh!.&a&bmat?dnas?gusak?k&at?o&oyot?y??uzarakat??m&ayasas?irah??wa&g&ani?okak??k&i&hci?mak??oy???yi&hsa?monihsin???i&asak?hs&aka?i&at?nawak???j&awa!imanim??emih??k&a&goa?s&agama?ukuf??wihsin??i&hsog?m???mati?oia?rogimak??n&annas?esnonihs??o&gasa!kat??ka?n&ikat?o?ustat??rihsay?sihs?tomus?yas??u&bay?gnihs?????nagan!.&a&bukah?d&a&w?yim??e&ki?u??ii??k&a&s&ay?uki??zus??ihsoo?ousay??m&ay&akat?ii??i&hsukufosik?jii??ukihc??n&i!hsetat??uzii??r&ah?ugot??saim?t&agamay?oyim??w&a&g&a&kan?n??o??kustam?ziurak??onim!imanim??u&koo?s!omihs????ya&ko?rih???e&akas?nagamok?subo??i&gakat?h&asa?c&a!mo!nanihs???uonamay??sukagot??k&a&kas?mimanim?to??ia&atik?imanim??oa?uzihcom??m&akawak?ijuf?o!t???r&ato?ijoihs?omakat???n&ana?esnoawazon??o&hukas?n&a&gan?kan??i&hc?muza??ustat??romok?si&gan?k??tomustam??u&k&as?ohukihc??stamega????to&mamuk!.&a&gamay?rahihsin?sukama!imak??tamanim??enufim?i&hcukik?k&ihsam?u??nugo!imanim??romakat??o&ara?rihsustay?sa?t&amay?om&amuk?us??u!koyg???yohc??u&sagan?zo????yk!.&a&bmatoyk?k&ies?oemak?uzaw??mayi&h&cukuf?sagih??muk??nihsamay?rawatiju?t&away?ik???e&ba&nat!oyk??ya??di?ni??i&ju?kazamayo?manim??natnan?o&gnatoyk?kum?mak?rihsamayimanim?y&gakan?ka&koagan?s??oj???u&ruziam?z&ayim?ik??????wtc1--nx?ykot!.&a&d&i&hcam?mus??oyihc??k&atim?ihsustak??m&a&t!uko??yarumihsa&gih?sum???i&hs&agoa?ika?o!t??uzuok??ren???r&a&honih?wasago??iadok?umah??ssuf?t&ik?o??wa&g&anihs?ode??k&ara?ihcat???y&agates?ubihs???e&amok?donih?m&o?urukihsagih??soyik??i&enagok?gani?h&ca&da?tinuk??sabati??j&nubukok?oihcah??manigus??o&huzim?jihcah?n&akan?ih!sasum??urika??rugem?t&a&mayihsagih?nim??iat?ok??uhc?yknub??u&fohc?hcuf?kujnihs?????pohs&eht,iiawak,yub,?r&2xro6--nx?g?o??s&9nvfe--nx?xvp4--nx??t&netnocresu,opsgolb,?u&4rvp8--nx?fig!.&a&d&eki?ih??kimot?m&ayakat?ihsah??ne?raha&gi&kes?makak??sak??taga&may?tik??wa&g&ibi?ustakan??karihs!ihsagih????e&katim?uawak??i&gohakas?hc&apna?uonaw??k&ago?es?ot??m&anuzim?ijat??nak?urat??nanig?o&dog?jug?makonim?nim?roy?sihcih??u&fig?s&otom?t&amasak?oay???????x5ytlk--nx?yu6d27srjd--nx?z72thr--nx?井福?京東?分大?取鳥?口山?城&宮?茨??媛愛?山&富?岡?歌和??岡&福?静??島&児鹿?広?徳?福??崎&宮?長??川&奈神?石?香??庫兵?形山?手岩?木栃?本熊?根島?梨山?森青?潟新?玉埼?田秋?知&愛?高??縄沖?良奈?葉千?賀&佐?滋??道海北?都京?重三?野長?阜岐?阪大?馬群???k!.&art?gro?moc?per?ude?vog???l&eh?l??m!.uj,ac?j??nd?o&g?h&pih?s!.&esab,xilpoh,ysrab,???lnud?oc?t!.&lldtn,snd-won,???pa!.&0mroftalp,arusah,bew:erif,,e&gatskrelc,niln&igol,okoob,?tupmocegde,virdhsalfno,?krelc,lecrev,n&aecolatigidno,ur:.a,,?poon,remarf,t&ibelet,xenw,?yfilten,??ra&a?hs??u&ekam?llag?org!.esruocsid,cts?kouk?nayalo???vsr?xece4ibgm--nx??q&a!3a9y--nx??g?i!.&gro?lim?moc?ten?ude?vog???m?se??r&a!.&a&cisum?sanes??bog?gro?l&autum?im??moc!.topsgolb,?pooc?rut?t&e&b?n??ni??ude?vog??4d5a4prebgm--nx?b?c?eydoog?los?t&at?s!uen???ugaj??b!.&21g?a&b&a&coros?iuc??itiruc??cnogoas?dicerapa?gniram?i&naiog?ramatnas??n&erom?irdnol??op?p&acam?irolf?ma&j?s???rief?tsivaob??b!aj?ib?mi?sb??c&ba?e&r?t??js?sp?t!e???d&em?mb?n&f?i??rt??e&dnarganipmac?ficer?ht?llivnioj?rdnaotnas??f&dj?ed?gg?n&e?i???g&e&l!.&a&b,m,p,?bp,c&a,s,?e&c,p,s,?fd,gm,ip,jr,la,ma,nr,o&g,r,t,?p&a,s,?r&p,r,?s&e,m,r,?tm,??s??l&s?z??n&c?e?o??ol!b?f?v??pp?ro??hvp?i&du?kiw?nana?oretin?r&c?eurab??sp?te?xat??l&at&an?rof??el?im?sq??m&a?da?e&gatnoc?leb??f?ic?oc!.&duolclautriv.elacs.sresu,topsgolb,???nce?o&ariebir?c&e?narboir?saso??d&o?ranreboas??e&g?t??i&b?dar?ecam?r??rp?t&a?erpoir???p&er?m!e?t??ooc?pa?se??qra?r&af?ga?o&davlas?j??tn?ut??s&a&ixac?mlap?nipmac??ed?u&anam?j?m???t&am?e&d?n?v??nc?o&f?n??ra?sf??u&caug9?de?ja?rg??v&da?ed?og!.&a&b?m?p??bp?c&a?s??e&c?p?s??fd?gm?ip?jr?la?ma?nr?o&g?r?t??p&a?s??r&p?r??s&e?m?r??tm???rs?t??xiv?z&hb?ls?o&c?f?????c!.&as?ca?de?if?o&c?g??ro???e&bew?ccos?dnik?e&b?n&igne?oip??rac??gni&arg?rheob??h&cor?sok?t&aew?orb???itnorf?k&col?o&p?rb???l&aed?ffeahcs??mal?nes?pinuj?t&a&eht?rebsnegömrev??law?nec?s&acnal?nom?ubkcolb??upmoc??v&o&csid?rdnal??resbo??wulksretlow?ywal?zifp??f!.&aterg?bew-no,drp?e&c&itsuj-reissiuh?narf-ne-setsitned-sneigrurihc,?lipuog,rianiretev??hny,i&cc?rgabmahc??m&o&c?n??t??n&eicamrahp?icedem??ossa?pohsdaerpsym,s&e&lbatpmoc-strepxe?riaton?tsitned-sneigrurihc?uova??o&-x&bf,obeerf,?x&bf,obeerf,???t&acova?o&or-ne,psgolb,?r&epxe-ertemoeg?op!orea????vuog??avc7ylqbgm--nx?s??g!.&gro?moc?t&en?opsgolb,?ude?vog???h!.&e&erf,man??mo&c?rf??topsgolb,zi??ur??i!.&a&61f4a3abgm--nx?rf4a3abgm--nx??ca?di?gro?hcs?oc?ten?vog?نار&يا?یا???a&h?per??ew?lf??k!.&c&a?s??e&n?p?r??gk?iggnoeyg?kub&gn&oeyg?uhc??noej??l&im?uoes??man&gn&oeyg?uhc??noej??n&as&lu?ub??o&e&hcni?jead??wgnag???o&c?g??ro?s&e?h?m??topsgolb,u&gead?j&ej?gnawg????cilf??l!.&gro?moc?ten?ude?vog???m!.&topsgolb,vog???n!.&gro?moc?ofni?ten?ude?vog?zib???o&htua?odtnorf?t&c&a?od??laer???p!.&alsi?ca?eman?forp?gro?moc?o&fni?rp??t&en?se??ude?vog?zib???s?t!.&21k?bew?cn!.vog??eman?gro?kst?l&e&b?t??im?op??moc!.topsgolb,?neg?ofni?pek?rd?sbb?ten?ude?v&a?og?t??zib??f?m??ubad?vd??s&8sqif--nx?9zqif--nx?a!.vog?birappnb?gev?lliv?mtsirhc?s??b!.&ew,gro?moc?ten?ude?vog??c?oj?s?u??c&i&hparg?p?t&sigolyrrek?ylana???od??d&a?d?ik?l?n&iwriaf?omaid??oogemoh?rac??e!.&bog?gro?mo&c!.topsgolb,?n??pohsdaerpsym,ude??civres!.enilnigol,?d&d2bgm--nx?oc??h&ctaw?guh??i&lppus?rtsudni?treporp!yrrek???jaiv?l&aw?cycrotom?etoh?gnis?pats??m&ag?oh?reh??nut?ohs?picer?r&it?ut&cip!.7331,?nev???s!i&rpretne?urc??ruoc??taicossa?vig??g!nidloh??h5c822qif--nx?i!.&ekacpuc,gro?moc?t&en?ni?opsgolb,?ude?vog??a09--nx?nnet?rap?targ??k&c&or!.&ecapsbew,snddym,ytic-amil,??us??hxda08--nx?row??l!.&c&a?s??ed,gro?o&c?fni??ten?ude?vog?zib??a&ed?tner??e&ssurb?toh!yrrek???lahsram?m?oot??m!.&bal,etisinim,gro?moc?ten?ude?vog??b?etsys!.tniopthgink,?ialc??n&a&f?gorf?ol??egassap?i&a&grab?mod??giro??o&it&acav?cudorp?ulos??puoc???o&dnoc?geuj?leuv?ppaz?t&ohp?ua???p!.&ces?gro?moc?olp?ten?ude?vog??i&hsralohcs?lihp?t??u??r!.&au,ca?gro?ni?oc?topsgolb,ude?vog?xo,yldnerb.pohs,?a&c?p?tiug??c?e&dliub!.etisduolc,?erac?gor?levart?mraf?n&niw?trap??wolf??ot&cartnoc?omatat??pj?uot??s!.&em?gro?hcs?moc?ten?ude?vog?zib??alg?e&n&isub!.oc,?tif??rp!xe!nacirema???xnal??iws??t&a&e&b?ytic??ob??ek&cit?ram??fig?h&cay?gilf??n&atnuocca?e&mt&rapa?sevni??ve!.&nibook,oc,????rap??u!.&a&c!.&21k?bil?cc???g!.&21k?bil?cc???i!.&21k?bil?cc???l!.&21k?bil?cc???m!.&21k!.&hcorap?rthc?tvp???bil?cc???p!.&21k?bil?cc???si?v!.&21k?bil?cc???w!.&21k?bil?cc????c&d!.&21k?bil?cc???n!.&21k?bil?cc???s!.&21k?bil?cc????d&e&f?lacsne.xhp,?i!.&21k?bil?cc???m!.&21k?bil?cc???n!.&bil?cc???s!.&bil?cc???u&olcrim,rd,??e&d!.&21k?bil,cc???las-4-&dnal,ffuts,?m!.&21k?bil?cc???n!.&21k?bil?cc????h&n!.&21k?bil?cc???o!.&21k?bil?cc????i&h!.&bil?cc???m!.&21k?bil?c&c?et??goc?n&eg?otae??robra-nna?sum?tsd?wanethsaw???nd?r!.&bil?cc???v!.&21k?bil?cc???w!.&21k?bil?cc????jn!.&21k?bil?cc???k&a!.&21k?bil?cc???o!.&21k?bil?cc????l&a!.&21k?bil?cc???f!.&21k?bil?cc???i!.&21k?bil?cc????mn!.&21k?bil?cc???n&afflog,i!.&21k?bil?cc???m!.&21k?bil?cc???sn?t!.&21k?bil?cc????o&c!.&21k?bil?cc???m!.&21k?bil?cc???ttniop,?p&ion,rettalp,?r&a!.&21k?bil?cc???o!.&21k?bil?cc???p!.&21k?bil?cc????s&a!.&21k?bil?cc???dik?k!.&21k?bil?cc???m!.&21k?bil?cc???nd&deerf,uolc,??t&c!.&21k?bil?cc???m!.&21k?bil?cc???u!.&21k?bil?cc???v!.&21k?bil?cc????ug!.&21k?bil?cc???v&n!.&21k?bil?cc???w!.cc???x&ohparg,t!.&21k?bil?cc????y&b-si,k!.&21k?bil?cc???n!.&21k?bil?cc???w!.&21k?bil?cc????za!.&21k?bil?cc????ah!uab??bria?col?e!.ytrap.resu,?ineserf?lp?xe&l?n???vt?w!.&66duolc,gro?moc?s&ndnyd,tepym,?ten?ude?vog??a?e&iver?n!.elbaeciton,??odniw??y&alcrab?cam?ot???t&0srzc--nx?a!.&amil4,ca!.hts??gni&liamerutuf,tsoherutuf,?o&c!.topsgolb,?fni,?p&h21,ohsdaerpsym,?r&euefknuf.neiw,o??v&g?irp,?xi2,ytic-amil,zib,?c?e!s??hc?if?l!asite??mami?rcomed??b!.&gro?moc?ten?ude?vog??b?gl??c&atnoc?e&les?rid!txen????dimhcs?e!.&eman?gro?moc?ofni?ten?ude?vog?zib??b?em?grat?id?k&circ?ram??n!.&0rab,1rab,2rab,5inu,6vnyd,7&7ndc.r,erauqs,?a&l&-morf,moob,?minifed,remacytirucesym,tadsyawla,z,?b&boi,g,lyltsaf:.pam,,?c&inagro-gnitae,paidemym,?d&ecalpb,irgevissam.saap.&1-&gs,nol,rf,yn,?2-&nol,yn,??nab-eht-ni,uolc&meaeboda,nievas.c&di-etsedron,itsalej,?xednay:.e&garots,tisbew,?,??e&c&narusnihtlaehezitavirp,rofelacs.j,?gdirbtib,ht-no-eciffo,l&acs&liat.ateb,noom,?ibom-eruza,?m&ecnuob,ohtanyd,tcerider,?n&ilno-evreser,ozdop,?rehurht,s:abapus,,tis-repparcs,zamkcar,?f&aeletis,crs.&cos,resu,?ehc-a-si,?g&ni&reesnes,sirkcilc,tsohnnylf,?olb&evres,tsaf,??k&catsvano,eeg-a&-si,si,?u,?l&acolottad,iamwt,s&d-ni,s-77ndc,??m&ac&asac,ih,?urofniem,?n&a&f&agp,lhn,?i&bed,llerk,??dcduabkcalb,i,pv-ni,?o&c-morf,duppa,jodsnd,rp-ytinummoc,ttadym,?p&i&-&etsef,on,?emoh,fles,nwo,?j,mac-dnab-ta,o&-oidar-mah,h&bew,sdaerpsym,??pa&duolc,egde,?tfe&moh,vres,?usnd,?r&e&tsulcyduolc,vres-xnk,?vdslennahc:.u,,?s&a&ila&nyd,snd,?nymsd,?bbevres,dylimaf,e&gde-ndc,suohsyub,t&isbeweruza,ys,??k&catstsaf,ekokohcs,?n&d&-won,d,golb,npv,?oitcnufduolc,?ppacitatseruza:.&2suts&ae,ew,?aisatsae,eporuetsew,sulartnec,?,s&a-skcik,ecca&-citats,duolc,??t,?t&adies,ce&ffeym,jorprot:.segap,,lespohs,?e&nretnifodne,smem,?farcenimevres,i-&ekorb,s&eod,lles,teg,??n&essidym,orfduolc,?r0p3l3t,s&ixetnod,oh&-spv:.citsalej.&cir,lta,sjn,?,gnik,???u&h,nyd,r:eakust.citsalej,,?ved-naissalta.dorp.ndc,x&inuemoh,spym,tsale.&1ots-slj,2ots-slj,3ots-slj,?unilemoh,?y&awetag-llawerif,ffijduolc:.&ed-1arf,su-1tsew,?,ltsaf.&dorp.&a,labolg,?lss.&a,b,labolg,?pam,slteerf,?n&-morf,ofipi,?srab,?z&a-morf,tirfym,???p?tcip?v??f&ig?o&l?sorcim???g!.&bog?dni?ed,g&olb,ro??lim?moc?ot,ten?ude???h!.&dem?gro?l&er?op??m&oc?rif??o&fni?rp?s&rep?sa???po&hs?oc??t&en?luda?ra??ude?vuog???i!.&a&2n-loritds--nx?7e-etsoaellav--nx?8&c-aneseclrof--nx?i-lrofanesec--nx??at?b?c!cul??dv?i&blo&-oipmet?oipmet??cserb?drabmol?g&gof?urep??l&gup?i&cis?me&-oigger?oigger???uig&-&aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf???aizenev&-iluirf?iluirf??ev&-iluirf?iluirf??v&-iluirf?iluirf????n&a&brev?cul?pmac?tac??idras?obrac&-saiselgi?saiselgi??resi??otsip?r&b&alac!-oigger?oigger??mu??dna&-&attelrab-inart?inart-attelrab??attelrabinart?inartattelrab?ssela??epmi?ugil??tnelav&-obiv?obiv??vap?z&e&nev?ps&-al?al???irog???l&iuqa!l??leib??m&or?rap??n!acsot?e&dom?is?sec&-&ilrof?ìlrof??ilrof?ìlrof???g&amor&-ailime?ailime??edras?olob??i&ssem?tal??ne!var??o&cna?merc?rev?vas???oneg?p?r!a&csep?rr&ac&-assam?assam??ef??von??etam?tsailgo!-lled?lled???s!ip?sam&-ararrac?ararrac??u&caris?gar???t!a&cilisab?recam??resac?soa!-&d&-&ellav?lav??ellav?lav??ellav??d&-&ellav?lav??ellav?lav??ellav??te&lrab&-&airdna-inart?inart-airdna??airdnainart?inartairdna??ssinatlac???udap?v!o&dap?neg?tnam???zn&airb&-a&lled-e-aznom?znom??a&lledeaznom?znom??eaznom??e&c&aip?iv??soc?top??om???b&-&23,46,61,?3c-lorit-ds-onitnert--nx?be-etsoa&-ellav--nx?dellav--nx??c!f-anesec-lrof--nx?m-lrof-anesec--nx??he-etsoa-d-ellav--nx?m!u??o2-loritds-nezob--nx?sn-loritds&-nasl&ab--nx?ub--nx??nitnert--nx??v!6-lorit-dsnitnert--nx?7-loritds&-nitnert--nx?onitnert--nx???z&r-lorit-ds&-nitnert--nx?onitnert--nx??s-loritds-onitnert--nx???c&f?is?l?m?p?r?v??d&p?u!olcnys,??e&c!cel?inev?nerolf??f?g!ida&-&a&-onitnert?onitnert??otla!-onitnert?onitnert???a&-onitnert?onitnert??otla!-on&azlob?itnert??onitnert????hcram?l?m!or??n&idu?o&n&edrop?isorf??torc???p?r?s&erav?ilom??t!nomeip?s&eirt?oa!-&d-e&ellav?éllav??e&ellav?éllav???de&ellav?éllav??e&ellav?éllav?????v?znerif??g&a?b?f?il?o?p?r?up?vf??hc?i&b?c?dol?f?l!lecrev?opan?rof&-anesec?anesec???m?n&a&part?rt&-attelrab-airdna?attelrabairdna???imir?ret??p?r!a&b?ilgac?ssas???s!idnirb??t&ei&hc?r??sa??v??l&a!c??b?c?o&m?rit&-&d&eus&-&nitnert?onitnert??nitnert?onitnert??us&-&nitnert?onitnert??nitnert?onitnert??üs&-&nitnert?onitnert??nitnert?onitnert???s&-onitnert?onitnert???d&eus!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??us&-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert??üs!-&n&asl&ab?ub??ezob?itnert??onitnert??nitnert?onitnert???s&-onitnert?onitnert?????m&ac?f?i!t.nepo.citsalej.duolc,?ol?r??n&a!lim?sl&ab?ub???b?c?e!en.cj,v?zob??irut?m!p??p?r?t??o&a!v??b!retiv??c!cel??enuc?g!ivor??i&dem&-onadipmac?onadipmac??pmet&-aiblo?aiblo??rdnos?zal??l?m!a&greb?ret??oc?re&f?lap???n!a&dipmac&-oidem?oidem??lim?tsiro?zlob??ecip&-ilocsa?ilocsa??i&bru&-orasep?orasep??lleva?rot?tnert??r&elas?ovil??ulleb??p?r!a&sep&-onibru?onibru??znatac??oun??s!ivert?sabopmac??t!arp?e&nev?ssorg??n&arat?e&girga?rt?veneb????zz&era?urba???p&a?ohsdaerpsym,s?t??qa?r&a!m?s??b!a??c?f?g?k?me?o?p?s?t?v??s&a&b?iselgi&-ainobrac?ainobrac???b?c?elpan?i?m?ot?s?t?v??t&a?b?c?l?m?nomdeip?o!psgolb,?p?v??u&de?l?n?p??v&a?og?p?s?t?v??y&drabmol?ellav&-atsoa?atsoa??licis?nacsut??z&al?b?c?p??ìlrof&-anesec?anesec???derc?er?f?m?utni??je3a3abgm--nx?kh?l!.&topsgolb,vog??uda??m!.&gro?moc!.topsgolb,?ten?ude???n&a&morockivdnas?ruatser?tnuocca??e&g?m&eganam!.retuor,?piuqe??r??i!.ue?m?opdlog??opud?uocsid??o&b?cs!.&ude,vog:.ecivres,,??d?g?h?j?oferab?p&edemoh?s???p!.&emon?gro?lbup?moc?t&en?ni?opsgolb,?ude?vog???r&a!m&law?s???epxe?op&er?pus!.ysrab,?s???s!.&adaxiabme?e&motoas?picnirp?rots??gro?lim?moc?o&c?dalusnoc?hon,?ten?ude??a&cmoc?f??e&b?r?uq??i!rolf?tned??o&h!.&duolc&p,rim,?e&lej,tiseerf,?flah,lrupmet,s&pvtsaf,seccaduolc,?tsafym,vedumpw,??p!sua???urt??t!.&eman?gro?ibom?levart?m&oc?uesum??o&c?fni?r&ea?p???pooc?sboj?t&en?ni??ude?vog?zib??ayh?n?o!bba?irram???uognah?xen?y!.gro,?ztej??u&2&5te9--nx?yssp--nx??a!.&a&s?w??civ?d&i?lq??fnoc?gro?moc!.&pohsdaerpsym,stelduolc.lem,topsgolb,??nsa?ofni?sat?t&ca?en?n??ude!.&a&s?w??ci&lohtac?v??dlq?sat?t&ca?n??wsn!.sloohcs????vog!.&a&s?w??civ?dlq?sat???wsn?zo??ti??c!.&fni?gro?moc?ten?ude?vog??i??d&e!.tir.segap-tig,?iab??e!.&dcym,enozgniebllew,noitatsksid,odagod.citsalej,snd&ps,uolc,?ysrab,??g!.&bew?gro?m&aug?oc??ofni?ten?ude?vog???h!.&0002?a&citore?idem?kitore??edszot?gro?ilus?letoh?m&alker?lif?t?urof??naltagni?o&c?ediv?fni?levynok?nisac??pohs?rarga?s&a&kal?zatu??emag?wen??t&lob?opsgolb,rops??virp?xe&s?zs??ytic?zsagoj??os?sut??l!.topsgolb,?m!.&ca?gro?moc?oc?ro?ten?vog???n!.&duolcesirpretne,eni&esrem,m,?tenkcahs,?em!.ysrab,??o&ggnaw?y!c???r!.&3kl,a&i&kymlak,rikhsab,vodrom,?yegyda,?bps,ca,duolcrim,e&niram,rpcm,?g&bc,nitsohurger.citsalej,ro,?ianatsuk,k&ihclan,s&m,rogitayp,??li&amdlc.bh,m,?moc,natsegad,onijym,pp,ri&b,d&cm:.spv,,orue,?midalv,?s&ar,itym,?t&en,ni,opsgolb,set,?u&4an,de,?vo&g,n,?ynzorg,zakvakidalv,?myc?p?ug??s!.&a&d&golov,nagarak,?gulak,i&groeg,kymlak,lerak,nemra,rikhsab,ssakahk,vodrom,zahkba,?lut,rahkub,vut,yegyda,znep,?bps,da&baghsa,rgonilest,?gunel,i&anatsuk,hcos,ovan,ttailgot,?k&alhsygnam,ihclan,s&legnahkra,m,n&a&mrum,yrb,?i&buytka,nbo,??tiort,vorkop,??l&ocarak,ybmaj,?na&gruk,jiabreza,ts&egad,hkazak-&htron,tsae,???ovonavi,r&adonsark,imidalv,?t&enxe,nek&hsat,mihc,??vo&hsalab,n,?ynzorg,z&akvakidalv,emret,??t&amok?i&juf?masih????v!.&em,g&olb,ro??moc?nc,ten?ude?ved,??ykuyr??v&b?c!.&emon?gro?moc?t&ni?opsgolb,?ude???ed!.&enilnigol,gnigats-oned,hcetaidem,lecrev,o&ned,tpyrctfihs,?ppa-rettalp,s&egap,rekrow,?vr&esi,uc,?weiverpbuhtig,ylf,??ih?l!.&di?fnoc?gro?lim?moc?nsa?ten?ude?vog???m!.&eman?gro?lim?m&oc?uesum??o&fni?r&ea?p???pooc?t&en?ni??ude?vog?zib???o&g?m??rt?s!.&bog?der?gro?moc?ude???t!.&bew-eht-no,naht-&esrow,retteb,?sndnyd,?d?gh?i?won??uqhv--nx??w&a!.moc?hs?l??b!.&gro?oc???c!.&gro?moc?ten?ude??cp??e&iver!.oby,?n?s??g?k!.&bme?dni?gro?moc?ten?ude?vog???m!.&ca?gro?m&oc?uesum??oc?pooc?t&en?ni??ude?vog?zib??b??o&csom?h!s??n?w??p!.&344x,de?en?o&c?g??ro?snduolc,ualeb???r!.&ca?gro?lim?oc?pooc?ten?vog??n??t!.&a46oa0fz--nx?b&82wrzc--nx?ulc??emag?gro?l&im?ru,?moc!.reliamym,?t&en?opsgolb,?ude?v&di?og?ta0cu--nx??zibe?業商?織組?路網???z!.&ca?gro?lim?oc?vog????x&a!.&cm,eb,gg,s&e,u,?tac,ue,yx,?t??c!.&hta,ofni,vog???e&d&ef?nay??ma!nab??rof?s??ilften?jt?m!.&bog?gro?moc?t&en?opsgolb,?ude??g?ma2ibgy--nx??o&b!x??f?rex??rbgn--nx?s!.vog??x&am&jt?kt??x???y&4punu--nx?7rr03--nx?a&d!i&loh?rfkcalb??ot!.emyfilauqerp,??g?lp?p!ila??rot?ssin?wdaorb??b!.&duolcym,fo?hcetaidem,lim?moc!.topsgolb,?vog??ab?gur??c!.&ca?dtl?gro?lim?m&oc!.&ecrofelacs.j,topsgolb,??t??orp?s&egolke?serp??ten?vog?zib??amrahp?nega??d&dadog?uts??e&kcoh?ltneb?n&dys?om?rotta??snikcm??g!.&eb,gro?moc?oc?ten?ude?vog??olonhcet!.oc,?rene??hpargotohp?id?k!.&gro?moc?ten?ude??s??l!.&clp?d&em?i??gro?hcs?moc?ten?ude?vog??f?imaf!nacirema??l&a?il??ppus??m!.&eman?gro?lim?moc?t&en?opsgolb,?ude?vog?zib??edaca!.laiciffo,?ra??n&a&ffit?pmoc??os??o&j?s??p!.&gro?lim?moc?pooc?ten?ude?vog???r&e&corg?grus?llag?viled??lewej?otcerid?tnuoc?uxul??s!.&gro?lim?moc?ten?ude?vog??pil??t&efas?i&c?ledif?n&ifx?ummoc!.&bdnevar,gon,murofym,???r&ahc?uces??srevinu??laer?r&ap!.oby,?eporp??uaeb??u!.&bug?gro?lim?moc!.topsgolb,?ten?ude??b!tseb???van!dlo??xes??z&a!.&eman?gro?lim?moc?o&fni?rp??pp?t&en?ni??ude?vog?zib???b!.&az,gro?jsg,moc?ten?ude?vog???c!.&4e,inum.duolc.&rsu,tlf,?m&laer,urtnecatem.motsuc,?oc,topsgolb,??d!.&cos?gro?lop?m&oc?t??ossa?t&en?ra??ude?vog???ib!.&duolcsd,e&ht-rof,mos-rof,rom-rof,?izoj,nafamm,p&i&-on,fles,?ohbew,tfym,?retteb-rof,snd&nyd,uolc,?xro,?g??k!.&duolcj,gro?lim?moc?t&en?ropeletzak.saapu,?ude?vog???m!.&ca?gro?lim?oc?ten?ude?v&da?og????n!.&asq-irom--nx?ca?gro?htlaeh?i&r&c?o&am?ām???wi!k???keeg?l&im?oohcs??neg?oc!.topsgolb,?t&en?nemailrap?vog???a!niflla???rawhcs?s!.&ca?gro?oc???t!.&c&a?s??e&m?n??ibom?l&etoh?im??o&c?fni?g??ro?vt???u!.&gro?moc?oc?ten??rwon??yx!.&e&nozlacol,tisgolb,?gnitfarc,otpaz,??zub??λε?υε?авксом?брс!.&гро?до?ка?р&бо?п!у?????г&б?ро??дкм?зақ?итед?килотак?леб?мок?н&йално?ом??рку?сур!.&арамас,бпс,гро,зиб,ичос,ксм,м&ок,ырк,?рим,я,??тйас?фр?юе?յահ?לארשי?םוק?اي&روس?سيلم?ناتيروم??بر&ع?غملا??ة&كبش?ي&دوعسلا?روس??یدوعسلا??ت&ا&راما?لاصتا??را&ب?ڀ?ھب???ر&ئازجلا?ازاب?صم?طق??سنوت?عقوم?قارع?ك&تيب?يلوثاك??موك?ن&ا&تس&كاپ?کاپ??دوس?ر&يا?یا??مع?يلعلا??درالا?ميلا?ي&رحبلا?طسلف???ه&ارمه?يدوعسلا??وكمارا?يبظوبا?ۃیدوعسلا?टेन?त&राभ?ोराभ??नठगंस?मॉक?्मतराभ?ত&রাভ?ৰাভ??ালংাব?ਤਰਾਭ?તરાભ?ତରାଭ?ாயித்நஇ?ைக்ஙலஇ?்ரூப்பக்ஙிச?్తరాభ?ತರಾಭ?ംതരാഭ?ාකංල?มอค?ยทไ!.&จิกรุธ?ต็นเ?ร&ก์คงอ?าหท??ลาบฐัร?าษกึศ???ວາລ?ეგ?なんみ?アトス?トンイポ?ドウラク?ムコ?ル&グーグ?ーセ??ン&ゾマア?ョシッァフ??业企?东广?乐娱?亚基诺?你爱我?信中?务政?动移?博微?卦八?厅餐?司公?品食?善慈?团集?国中?國中?址网?坡加新?城商?尚时?山佛?店&商?网?酒大里嘉??府政?康健?息信?戏游?拉里格香?拿大?教主天?机手?构机!织组??标商?歌谷?浦利飞?港香!.&人個?司公?府政?絡網?織組?育教???湾台?灣&台?臺??物购?界世?益公?看点?科盈訊電?站网?籍書?线在?络网?网文中?聘招?販通?逊马亚?通联?里嘉?锡马淡?門澳?门澳?闻新?電家?국한?넷닷?성삼?컴닷??"); /** * If a hostname is not a key in the EXCLUDE map, and if removing its leftmost component results @@ -50,7 +50,7 @@ public final class PublicSuffixPatterns { */ public static final ImmutableMap<String, PublicSuffixType> UNDER = TrieParser.parseTrie( - "ac.vedwa,d&b?uolc.&etiso&isnes,tnegam,?iaznab,rehcnar-no,scitats,??e&b.lrusnart,d.&ecapsrebu,yksurf,?noz.notirt,t&atse.etupmoc,is.&hsmroftalp,tst,???gp?h&c.tenerif:.cvs,,k?trae.sppad:.zzb,,?k&c?f?nil.bewd,rowten.secla,u.hcs??ln.lrusnart,m&j?m?oc.&duolcmeaeboda.ved,edonil.recnalabedon,ico-remotsuc:.&ico,pco,sco,?,lrihwyap,mme0,osseccandcved,s&t&cejboedonil,nemelepiuq,?wanozama.&1-etupmoc,ble,etupmoc,??t&neyoj.snc,opsppa.r,???n&c.moc.swanozama.&ble,etupmoc,?ur.edoc,?o&c.pato,i.&duolciaznab.sdraykcab,elacsnoom,oir-no,reniatnoceruza,s&3k-no,olots,?xcq.sys,y5s,??p&j.&a&mahokoy?yogan??ebok?i&adnes?kasawak??oroppas?uhsuykatik??n?pa.&knalfhtron,repoleved,??r&b.mon?e??s&edoc.owo,w.rosivda,?t&a.&ofnistro.&nednuk,xe,?smcerutuf:.&ni,xe,?,?en.&cimonotpyrc,hvo.&gnitsoh,saapbew,???u&e.lrusnart,r.onijym.&gni&dnal,tsoh,?murtceps,spv,??ved.&e&gats>s,lcl,?rahbew,?gts,lcl,yawetag,?z&c.murtnecatem.duolc,yx.tibelet,??"); + "ac.vedwa,d&b?i.ym.ssr,uolc.&etiso&isnes,tnegam,?iaznab,rehcnar-no,scitats,??e&b.lrusnart,d.&ecapsrebu,yksurf,?noz.notirt,t&atse.etupmoc,is.&areduolc,hsmroftalp,tst,???g&oog.tnetnocresu,p??h&c.tenerif:.cvs,,k?trae.sppad:.zzb,,?k&c?f?nil.bewd,rowten.secla,u.hcs??ln.lrusnart,m&j?m?oc.&duolcmeaeboda.ved,edonil.recnalabedon,ico-remotsuc:.&ico,pco,sco,?,lrihwyap,mme0,osseccandcved,s&ecapsnaecolatigid,t&cejbo&edonil,rtluv,?nemelepiuq,?wanozama.&1-etupmoc,ble,etupmoc,??t&neyoj.snc,opsppa.r,???n&c.moc.swanozama.&ble,etupmoc,?ur.edoc,?o&c.pato,i.&duolciaznab.sdraykcab,elacsnoom,oir-no,reniatnoceruza,s&3k-no,olots,?xcq.sys,y5s,??p&j.&a&mahokoy?yogan??ebok?i&adnes?kasawak??oroppas?uhsuykatik??n?pa.&knalfhtron,repoleved,tegeb,??r&b.mon?e??s&edoc.owo,noitulos.rehid,w.rosivda,?t&a.&ofnistro.&nednuk,xe,?smcerutuf:.&ni,xe,?,?en.&cimonotpyrc,hvo.&gnitsoh,saapbew,???u&e.lrusnart,r.onijym.&gni&dnal,tsoh,?murtceps,spv,??ved.&e&gats>s,lcl,?rahbew,?gts,lcl,yawetag,?z&c.murtnecatem.duolc,yx.tibelet,??"); /** * The elements in this map would pass the UNDER test, but are known not to be public suffixes and diff --git a/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java b/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java index dd7778040..89cdadd3d 100644 --- a/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java +++ b/guava/src/com/google/thirdparty/publicsuffix/TrieParser.java @@ -36,7 +36,7 @@ final class TrieParser { while (idx < encodedLen) { idx += doParseTrieToBuilder(Queues.<CharSequence>newArrayDeque(), encoded, idx, builder); } - return builder.build(); + return builder.buildOrThrow(); } /** @@ -6,7 +6,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.google.guava</groupId> <artifactId>guava-parent</artifactId> - <version>31.0.1-jre</version> + <version>31.1-jre</version> <packaging>pom</packaging> <name>Guava Maven Parent</name> <description>Parent for guava artifacts</description> @@ -18,6 +18,8 @@ <checker-framework.version>3.12.0</checker-framework.version> <animal.sniffer.version>1.20</animal.sniffer.version> <maven-javadoc-plugin.version>3.1.0</maven-javadoc-plugin.version> + <!-- Empty for all JDKs but 9-12 --> + <maven-javadoc-plugin.additionalJOptions></maven-javadoc-plugin.additionalJOptions> <maven-source-plugin.version>3.2.1</maven-source-plugin.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -184,6 +186,7 @@ </additionalOptions> <linksource>true</linksource> <source>8</source> + <additionalJOption>${maven-javadoc-plugin.additionalJOptions}</additionalJOption> </configuration> <executions> <execution> @@ -270,7 +273,7 @@ <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> - <version>2.7.1</version> + <version>2.11.0</version> </dependency> <dependency> <groupId>com.google.j2objc</groupId> @@ -390,5 +393,23 @@ </plugins> </build> </profile> + <profile> + <!-- + Passes JDK 9-12-specific `no-module-directories` flag to Javadoc tool, + which is required to make symbol search work correctly in the generated + pages. + + This flag does not exist on 8 and 13+ (https://bugs.openjdk.java.net/browse/JDK-8215582). + + Consider removing it once our release and test scripts are migrated to a recent JDK (17+). + --> + <id>javadocs-jdk9-12</id> + <activation> + <jdk>[9,13)</jdk> + </activation> + <properties> + <maven-javadoc-plugin.additionalJOptions>--no-module-directories</maven-javadoc-plugin.additionalJOptions> + </properties> + </profile> </profiles> </project> |