external/guava-libraries.git
5 days agoAdd notes for external Guava users re. JDK 7 APIs. jdk5-backport-sync master
Colin Decker [Thu, 17 Apr 2014 20:58:12 +0000 (16:58 -0400)]
Add notes for external Guava users re. JDK 7 APIs.
Deprecate obsoleted Objects APIs.
Replace <b>Note</b>: with <b>Note:</b> in Guava.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=65135062

5 days agoPush current RateLimiter implementation down into a subclass.
Colin Decker [Thu, 17 Apr 2014 20:56:11 +0000 (16:56 -0400)]
Push current RateLimiter implementation down into a subclass.
This will make it easier to provide alternative RateLimiter implementations to replace our legacy rate-limiting APIs.
Also, random cleanup:
- Static import stuff.
- Use Stopwatch instead of reimplementing it.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=65119596

6 days agoUse ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
Colin Decker [Wed, 16 Apr 2014 21:13:23 +0000 (17:13 -0400)]
Use ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=65059838

6 days agoUse ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
Colin Decker [Wed, 16 Apr 2014 21:12:20 +0000 (17:12 -0400)]
Use ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=65046437

6 days agoReplace usages of deprecated IterableSubject.iteratesOverSequence(...) with iteratesA...
Colin Decker [Wed, 16 Apr 2014 21:10:57 +0000 (17:10 -0400)]
Replace usages of deprecated IterableSubject.iteratesOverSequence(...) with iteratesAs(...)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=65045496

6 days agoUse Double.compare() instead of Doubles.compare().
Colin Decker [Wed, 16 Apr 2014 21:03:32 +0000 (17:03 -0400)]
Use Double.compare() instead of Doubles.compare().
Use Float.compare() instead of Floats.compare().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64999716

6 days agoRemove workaround that was required by the <T extends Object & Iterable<?> & Iterator...
Colin Decker [Wed, 16 Apr 2014 21:01:52 +0000 (17:01 -0400)]
Remove workaround that was required by the <T extends Object & Iterable<?> & Iterator<?>> method.
That method was removed.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64996669

6 days agoUse ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
Colin Decker [Wed, 16 Apr 2014 21:00:18 +0000 (17:00 -0400)]
Use ImmutableSet.of().iterator() instead of Iterators.emptyIterator().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64993582

6 days agoAllow disabling of guava gwt tests from command line.
Colin Decker [Wed, 16 Apr 2014 20:51:14 +0000 (16:51 -0400)]
Allow disabling of guava gwt tests from command line.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64929463

6 days agoRoll-forward:
Colin Decker [Wed, 16 Apr 2014 20:49:48 +0000 (16:49 -0400)]
Roll-forward:

*** Original change description ***

Make common.reflect build and pass tests against both Java 7 and Java 8.

In particular, Java 7 had both the TypeVariable and AnnotatedElement interfaces, which were unrelated.  In Java 8, TypeVariable extends AnnotatedElement, and gained a method getAnnotatedBounds(), returning an AnnotatedType[], where AnnotatedType was an interface introduced in Java 8...

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64921461

6 days agoUpdate Guava versions to 18.0-SNAPSHOT.
Colin Decker [Wed, 16 Apr 2014 20:46:39 +0000 (16:46 -0400)]
Update Guava versions to 18.0-SNAPSHOT.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64904324

8 days agoFix busted code tag in @return for MoreExecutors.shutdownAndAwaitTermination
Chris Povirk [Mon, 14 Apr 2014 15:26:38 +0000 (11:26 -0400)]
Fix busted code tag in @return for MoreExecutors.shutdownAndAwaitTermination
Updated javadoc in response to https://code.google.com/p/guava-libraries/issues/detail?id=1725
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64893877

8 days agoAdd @since 13.0 to Ordering.allEqual().
Chris Povirk [Mon, 14 Apr 2014 15:01:46 +0000 (11:01 -0400)]
Add @since 13.0 to Ordering.allEqual().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64777126

11 days agoRemove entrySet() redundancy between AbstractMultiset and ConcurrentHashMultiset.
Chris Povirk [Fri, 11 Apr 2014 13:56:40 +0000 (09:56 -0400)]
Remove entrySet() redundancy between AbstractMultiset and ConcurrentHashMultiset.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64720096

11 days agoShuffling from internal-only change.
Chris Povirk [Fri, 11 Apr 2014 13:51:05 +0000 (09:51 -0400)]
Shuffling from internal-only change.
To be used for a temporary migration aid only!
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64716281

12 days agoRollback of changelist 64659484 ("Make common.reflect build and pass tests against...
Chris Povirk [Thu, 10 Apr 2014 13:55:37 +0000 (09:55 -0400)]
Rollback of changelist 64659484 ("Make common.reflect build and pass tests against both Java 7 and Java 8").

Our internal build changes seem to be causing problems.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64665073

13 days ago- For a Collection<T> parameter that we don't know how to generate, fail the test...
Chris Povirk [Wed, 9 Apr 2014 22:52:51 +0000 (18:52 -0400)]
- For a Collection<T> parameter that we don't know how to generate, fail the test. Previously, we would sometimes generate a Collection<String>, since the value is usually used only for equals() and hashCode() testing. (All this also applies to most other JDK and Guava collection types.) code.google.com/p/guava-libraries/issues/detail?id=1665
- For Optional parameters, generate Optional.absent() before generating any Optional.of(...) instances.
- Deprecate setSampleInstances in favor of setDistinctValues.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64661899

13 days agoMake common.reflect build and pass tests against both Java 7 and Java 8.
Chris Povirk [Wed, 9 Apr 2014 22:51:05 +0000 (18:51 -0400)]
Make common.reflect build and pass tests against both Java 7 and Java 8.

In particular, Java 7 had both the TypeVariable and AnnotatedElement interfaces, which were unrelated.  In Java 8, TypeVariable extends AnnotatedElement, and gained a method getAnnotatedBounds(), returning an AnnotatedType[], where AnnotatedType was an interface introduced in Java 8.

We now have TypeVariableImpl extend a class NotAnnotatedElement, which provides an implementation for AnnotatedElement where no annotations are present, and throw UnsupportedOperationException on TypeVariableImpl.getAnnotatedBounds().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64659484

13 days agoChange default BloomFilter strategy to be controllable by a system property for Guava.
Chris Povirk [Wed, 9 Apr 2014 22:47:49 +0000 (18:47 -0400)]
Change default BloomFilter strategy to be controllable by a system property for Guava.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64657125

13 days agoThis CL is to fix EnumMultisetTest that would otherwise break with the new FreshValue...
Chris Povirk [Wed, 9 Apr 2014 19:42:42 +0000 (15:42 -0400)]
This CL is to fix EnumMultisetTest that would otherwise break with the new FreshValueGenerator that doesn't generate raw Iterable for Iterable<T>.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64631310

13 days agoTemporary fix to ClassSantityTester.
Chris Povirk [Wed, 9 Apr 2014 14:29:46 +0000 (10:29 -0400)]
Temporary fix to ClassSantityTester.
We cannot remove the fallback to Iterable.class generation yet, because doing that would break some teams' tests. They need to be fixed with extra setDistinctValues() before we remove the fallback.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64603381

2 weeks agoShuffling from internal-only change.
Chris Povirk [Tue, 8 Apr 2014 20:11:40 +0000 (16:11 -0400)]
Shuffling from internal-only change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64574375

2 weeks agoShuffling from internal-only change.
Chris Povirk [Tue, 8 Apr 2014 20:09:48 +0000 (16:09 -0400)]
Shuffling from internal-only change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64573579

2 weeks agoFix flaky ServiceManager test
Chris Povirk [Tue, 8 Apr 2014 20:02:31 +0000 (16:02 -0400)]
Fix flaky ServiceManager test

Guava issue 1715:
http://code.google.com/p/guava-libraries/issues/detail?id=1715
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64565848

2 weeks agoGenerates fresh value for Range. It was an oversight not adding it in the first place.
Chris Povirk [Mon, 7 Apr 2014 17:53:34 +0000 (13:53 -0400)]
Generates fresh value for Range. It was an oversight not adding it in the first place.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64481937

2 weeks agoMigrate to setDistinctValues().
Chris Povirk [Mon, 7 Apr 2014 16:18:19 +0000 (12:18 -0400)]
Migrate to setDistinctValues().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64399927

2 weeks agoAdded setDistinctValues() to ClassSanityTester and AbstractPackageSanityTester.
Chris Povirk [Mon, 7 Apr 2014 16:16:52 +0000 (12:16 -0400)]
Added setDistinctValues() to ClassSanityTester and AbstractPackageSanityTester.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64398568

2 weeks agoChange default BF strategy for Guava to MURMUR128_MITZ_64.
Chris Povirk [Mon, 7 Apr 2014 15:56:52 +0000 (11:56 -0400)]
Change default BF strategy for Guava to MURMUR128_MITZ_64.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64156827

2 weeks agoFix minor Javadoc error in CharStreams.
Chris Povirk [Mon, 7 Apr 2014 15:55:26 +0000 (11:55 -0400)]
Fix minor Javadoc error in CharStreams.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64151790

2 weeks agoImprove BF serialization documentation.
Chris Povirk [Mon, 7 Apr 2014 15:54:00 +0000 (11:54 -0400)]
Improve BF serialization documentation.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64144815

2 weeks agoRollback of changelist 63979311, which changed the default BloomFilter strategy.
Chris Povirk [Mon, 7 Apr 2014 15:49:29 +0000 (11:49 -0400)]
Rollback of changelist 63979311, which changed the default BloomFilter strategy.

The caused problems for teams that sent BloomFilters from new binaries to old binaries, as the old binaries could not read the new binaries' BloomFilters.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64114639

2 weeks agoAdd koeln TLD.
Chris Povirk [Mon, 7 Apr 2014 15:48:09 +0000 (11:48 -0400)]
Add koeln TLD.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64111945

2 weeks agoDon't allow repeated calls to hash() on a MessageDigest-based hasher.
Chris Povirk [Mon, 7 Apr 2014 15:45:57 +0000 (11:45 -0400)]
Don't allow repeated calls to hash() on a MessageDigest-based hasher.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64080687

3 weeks agoAdd tests to make sure classes don't get exported to JS by accident/mistake.
Kurt Kluever [Mon, 31 Mar 2014 18:37:31 +0000 (14:37 -0400)]
Add tests to make sure classes don't get exported to JS by accident/mistake.

This happened once with SafeHtmlBuilder and I nearly did it again recently. We can export classes that make use of @CompileTimeConstant if we make sure we export only specific methods, but for now it's simpler to blank disallow any class with @CompileTimeConstant.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=64052070

3 weeks agoSwitch default BloomFilter strategy from the broken MURMUR128_MITZ_32 to the
Kurt Kluever [Mon, 31 Mar 2014 18:36:22 +0000 (14:36 -0400)]
Switch default BloomFilter strategy from the broken MURMUR128_MITZ_32 to the
new MURMUR128_MITZ_64.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63979311

3 weeks agoClean up misuses of Truth where proposition values are passed into ASSERT.that()...
Kurt Kluever [Mon, 31 Mar 2014 18:34:49 +0000 (14:34 -0400)]
Clean up misuses of Truth where proposition values are passed into ASSERT.that() instead of the object under test.  This leads to patterns like:

ASSERT.that(myMap.values().isEmpty());

The above will do exactly nothing, because Truth is a fluent API and expects a value and returns an object with custom proposition methods on it, i.e.

ASSERT.that(myMap.values()).isEmpty(); is the appropriate fix.

This is in preparation for an upgrade to Truth which includes @CheckReturnValue on methods like .that() in order to let error-prone flag these as a compile-error.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63974750

3 weeks agoInit combinedHash to hash1 as per 'Less Hashing, Same Performance:
Kurt Kluever [Mon, 31 Mar 2014 18:33:25 +0000 (14:33 -0400)]
Init combinedHash to hash1 as per 'Less Hashing, Same Performance:
Building a Better Bloom Filter'
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63973319

3 weeks agoAdd a new BF strategy. The old one is subtly broken. For more information, see: https...
Kurt Kluever [Mon, 31 Mar 2014 18:31:56 +0000 (14:31 -0400)]
Add a new BF strategy. The old one is subtly broken. For more information, see: https://code.google.com/p/guava-libraries/issues/detail?id=1119
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63970075

3 weeks agoFix a typo in CacheBuilder's docs.
Kurt Kluever [Mon, 31 Mar 2014 18:30:25 +0000 (14:30 -0400)]
Fix a typo in CacheBuilder's docs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63969189

3 weeks agoAdd HashCode.getBytesInternal() for package-private direct access to the
Kurt Kluever [Mon, 31 Mar 2014 18:27:25 +0000 (14:27 -0400)]
Add HashCode.getBytesInternal() for package-private direct access to the
underlying, mutable byte array (for byte-based HashCodes).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63906429

3 weeks agoChange the behavior of Service.Listener and ServiceManager.Listener such that we...
Kurt Kluever [Mon, 31 Mar 2014 18:24:14 +0000 (14:24 -0400)]
Change the behavior of Service.Listener and ServiceManager.Listener such that we guarantee that listener callbacks (for a single listener) will never be called concurrently.  Previously, the only semantics we guaranteed was about the order in which callbacks were submitted to executor.execute.  This significantly strengthens those guarantees.

This is being done to resolve the flake that cpovirk@ identified here:
https://sponge.[]/target?id=58fc52ba-a5f8-4619-83d3-ea0a28b9ee72&target=//javatests/com/google/common/util/concurrent:MediumTests

The flaky test could be fixed either by using a SerializingExecutor in the test
or by changing the semantics of Service/SeriveManager.addListener to guarantee
serial callback execution.  I've opted for the latter since this is a very rare
and confusing race and it is unlikely that any user would actually want their
callbacks to execute concurrently.

To implement this I've deleted ExecutionQueue and introduced a new object
called SerialListenerQueue that is essentially
ExecutionQueue+SerializingExecutor.  I've implemented it this way rather than
by combining ExecutionQueue with SerializingExecutor since:
1. ExecutionQueue relies on poorly documented features of ConcurrentLinkedQueue
2. ExecutionQueue is itself quite complicated
3. that would introduce an extra queue operation per callback execution
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63836415

4 weeks agoFix up .gwt.xml file as a part of some internal changes.
Christian Edward Gruber [Sat, 22 Mar 2014 01:58:09 +0000 (18:58 -0700)]
Fix up .gwt.xml file as a part of some internal changes.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63544353

4 weeks agoPick up a whole lot of TLD changes.
Christian Edward Gruber [Sat, 22 Mar 2014 01:52:56 +0000 (18:52 -0700)]
Pick up a whole lot of TLD changes.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63499305

4 weeks agoChange bitCount from int to long.
Christian Edward Gruber [Sat, 22 Mar 2014 01:51:12 +0000 (18:51 -0700)]
Change bitCount from int to long.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63498264

4 weeks agoRemove redundant 'public' modifier from StatsCounter interface methods.
Christian Edward Gruber [Sat, 22 Mar 2014 01:47:44 +0000 (18:47 -0700)]
Remove redundant 'public' modifier from StatsCounter interface methods.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63486708

4 weeks agoMake Enums.getIfPresent ~16 times faster for 80% hit rate, ~72 times faster for 20...
Christian Edward Gruber [Sat, 22 Mar 2014 01:46:02 +0000 (18:46 -0700)]
Make Enums.getIfPresent ~16 times faster for 80% hit rate, ~72 times faster for 20% hit rate.

See: https://goto.google.com/benchmark:enums.getifpresent
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63478563

4 weeks agoAdd missing <inherits> to modules.
Chris Povirk [Thu, 20 Mar 2014 02:13:28 +0000 (22:13 -0400)]
Add missing <inherits> to modules.
The result is that we don't have to manually include User in our compilation tests, and other users won't have to include it, either.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63444626

4 weeks agoShuffling from internal-only change.
Chris Povirk [Thu, 20 Mar 2014 02:03:59 +0000 (22:03 -0400)]
Shuffling from internal-only change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63436180

4 weeks agoMake AtomicLongMap tests work under GWT.
Chris Povirk [Wed, 19 Mar 2014 18:43:32 +0000 (14:43 -0400)]
Make AtomicLongMap tests work under GWT.
See the comments added to the .gwt.xml files for the sordid details.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63401251

4 weeks agoAdd missing modules.
Chris Povirk [Wed, 19 Mar 2014 18:40:07 +0000 (14:40 -0400)]
Add missing modules.
This ensures that the open-source build compiles all packages and has everything it needs to run all tests (or so I will claim until I find my *next* oversight :))
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63359056

4 weeks agoPrevent our rollup modules from including any "real" source files from c.g.c subpackages.
Chris Povirk [Wed, 19 Mar 2014 18:36:38 +0000 (14:36 -0400)]
Prevent our rollup modules from including any "real" source files from c.g.c subpackages.
This should make no difference unless we forget to list a module, in which case it will prevent us from seeing the module's .java files without its .gwt.xml.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63357986

4 weeks agoGuava publicsuffix .gwt.xml fixes:
Chris Povirk [Wed, 19 Mar 2014 18:34:56 +0000 (14:34 -0400)]
Guava publicsuffix .gwt.xml fixes:
- Use the Guava-munged .gwt.xml files rather than the Google-internal versions. (The versions are currently identical, but this will change in CL 63334981.)
- Put the .gwt.xml files under guava-gwt instead of guava. (I'm not 100% sure whether this fixes any concrete problems or just removes the .gwt.xml files from the main guava jar, where they clearly don't belong.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63357956

4 weeks agoMark DoubleMath as @GwtCompatible, allowing these methods to be used from GWT code:
Chris Povirk [Wed, 19 Mar 2014 17:04:16 +0000 (13:04 -0400)]
Mark DoubleMath as @GwtCompatible, allowing these methods to be used from GWT code:
- log2(double x)
- factorial(int n)
- fuzzyEquals(double a, double b, double tolerance)
- fuzzyCompare(double a, double b, double tolerance)
The other methods are marked as @GwtIncompatible due to aspects of their implementations not being GWT-compatible.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63356280

4 weeks agoOverride close() in all subclasses of FilterOutputStream to ensure they do not swallo...
Chris Povirk [Wed, 19 Mar 2014 16:59:03 +0000 (12:59 -0400)]
Override close() in all subclasses of FilterOutputStream to ensure they do not swallow exceptions thrown when flushing the delegate stream.

https://code.google.com/p/guava-libraries/issues/detail?id=1651
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63289125

4 weeks agoRemove inaccurate claim of GWT compatibility.
Chris Povirk [Wed, 19 Mar 2014 16:55:39 +0000 (12:55 -0400)]
Remove inaccurate claim of GWT compatibility.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63262539

4 weeks agoRun some common.collect.testing tests under GWT.
Chris Povirk [Wed, 19 Mar 2014 16:53:59 +0000 (12:53 -0400)]
Run some common.collect.testing tests under GWT.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63261660

5 weeks agoRemove GWT copy of ImmutableSortedSet.of(E[]) from Guava.
Christian Edward Gruber [Mon, 17 Mar 2014 15:05:44 +0000 (08:05 -0700)]
Remove GWT copy of ImmutableSortedSet.of(E[]) from Guava.
The non-GWT version has been gone since CL 24279246.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63077177

5 weeks agoRelease Converter.from(Function, Function) for Guava 17.
Colin Decker [Thu, 13 Mar 2014 15:43:40 +0000 (11:43 -0400)]
Release Converter.from(Function, Function) for Guava 17.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63073973

5 weeks agoFix Maven warning from duplicate Animal Sniffer reference:
Colin Decker [Thu, 13 Mar 2014 15:41:14 +0000 (11:41 -0400)]
Fix Maven warning from duplicate Animal Sniffer reference:

[WARNING] Some problems were encountered while building the effective model for com.google.guava:guava:bundle:17.0-SNAPSHOT
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.codehaus.mojo:animal-sniffer-maven-plugin @ com.google.guava:guava-parent:17.0-SNAPSHOT, /usr/local/google/home/cpovirk/clients/guava-white/guava-libraries/pom.xml, line 184, column 17
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.google.guava:guava-parent:pom:17.0-SNAPSHOT
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.codehaus.mojo:animal-sniffer-maven-plugin @ line 184, column 17
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63030073

5 weeks agoAdding stream based factory methods for ByteArrayDataInput/Output and tidying up...
Colin Decker [Thu, 13 Mar 2014 15:38:04 +0000 (11:38 -0400)]
Adding stream based factory methods for ByteArrayDataInput/Output and tidying up to minimize actual constructors.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=63021371

5 weeks agoAdd Futures.inCompletionOrder.
Colin Decker [Thu, 13 Mar 2014 15:36:11 +0000 (11:36 -0400)]
Add Futures.inCompletionOrder.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62970544

5 weeks agoOpen source base.Verify in Guava 17.0
Colin Decker [Thu, 13 Mar 2014 15:29:20 +0000 (11:29 -0400)]
Open source base.Verify in Guava 17.0
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62936772

6 weeks agoAdd a test case to EnumsTest that ensures that the Enums.getIfPresent method doesn...
Chris Povirk [Wed, 5 Mar 2014 15:07:35 +0000 (10:07 -0500)]
Add a test case to EnumsTest that ensures that the Enums.getIfPresent method doesn't cause a reference to the Enum class parameter to be held indefinitely.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62564526

7 weeks agoRemove "<add-linker name='std'/>" workaround, which is no longer necessary.
Chris Povirk [Tue, 4 Mar 2014 19:57:08 +0000 (14:57 -0500)]
Remove "<add-linker name='std'/>" workaround, which is no longer necessary.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62490843

7 weeks agoAutomatically add <inherits> for java.* emulations to Guava.
Kurt Kluever [Fri, 28 Feb 2014 18:47:51 +0000 (13:47 -0500)]
Automatically add <inherits> for java.* emulations to Guava.
Remove the manually added <inherits>.

This change applies only to java.* emulations: Normally <inherits> are added automatically as part of the build.
The problem here was that the java.* <inherits> added were for internal-only modules that only transitively pulled in the public modules.
This change rewrites the internal-only module names to match the public module names.

The result is mostly a no-op, but, in addition to some theoretically irrelevant reordering, the automation also produces a few <inherit> fixes:
- Remove net -> util.
- Remove collect/testing -> util.
- Add collect/testing -> truth.
- Add collect/testing/google -> truth.

Additionally, the automation identifies that cache was missing a BUILD dependency on util.
(It got away with it because the dependency was pulled in transitively through base. (This worked because strict Java deps doesn't fully apply to GWT.))
I have added the appropriate dependency.

(This CL redoes *most* of CL 62235637 (which was rolled back in CL 62240733), and it also touches other packages that that CL did not.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62345986

7 weeks ago*** Reason for rollback ***
Kurt Kluever [Fri, 28 Feb 2014 18:43:11 +0000 (13:43 -0500)]
*** Reason for rollback ***

Removing the rest of the .gwt.xml references to java.* breaks open-source compilation of files like Suppliers, so Suppliers probably needs the java.* references; it just happens to be getting them now from other targets also on the classpath.

*** Original change description ***

Cleanup unnecessary gwt.xml's from c/g/common/base and c/g/common/collect.

***
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62240733

7 weeks agoCleanup unnecessary gwt.xml's from c/g/common/base and c/g/common/collect.
Kurt Kluever [Fri, 28 Feb 2014 18:41:41 +0000 (13:41 -0500)]
Cleanup unnecessary gwt.xml's from c/g/common/base and c/g/common/collect.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62235637

7 weeks agoChanged ArbitraryInstances to use public constant instance if present.
Kurt Kluever [Fri, 28 Feb 2014 18:40:04 +0000 (13:40 -0500)]
Changed ArbitraryInstances to use public constant instance if present.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62232146

7 weeks agoAdding precise control over types of null queries allowed by MapFeatures.
Kurt Kluever [Fri, 28 Feb 2014 18:36:51 +0000 (13:36 -0500)]
Adding precise control over types of null queries allowed by MapFeatures.
Also, propagate ALLOWS_NULL_VALUES to Multimap.values() features.
From leventov.ru: https://codereview.appspot.com/58760044/ https://codereview.appspot.com/65730044/
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62226066

7 weeks agoOverride toString() in Iterables.consumingIterable() and
Kurt Kluever [Fri, 28 Feb 2014 18:35:06 +0000 (13:35 -0500)]
Override toString() in Iterables.consumingIterable() and
Iterators.consumingIterator().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=62154162

7 weeks agoRemove javacomp_package
Kurt Kluever [Fri, 28 Feb 2014 18:11:04 +0000 (13:11 -0500)]
Remove javacomp_package

Leaves a couple of empty builddefs files in place to avoid breaking
projects that still subinclude them.  Those files will be removed
once the subincludes are all cleaned up.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61607971

8 weeks agoAdd a new HostAndPort.fromHost() factory, which behaves like fromParts()
Kurt Kluever [Tue, 25 Feb 2014 21:07:07 +0000 (16:07 -0500)]
Add a new HostAndPort.fromHost() factory, which behaves like fromParts()
without the port number.  This is useful for converting a host into
possibly-bracketed form, so that a port may be appended afterward.

Also, the correct buffer size is "length + 8", due to the 5-digit port,
two brackets, and a colon.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61830506

8 weeks agoFix a minor nit in Futures.dereference() documentation: the listener runs in either...
Kurt Kluever [Tue, 25 Feb 2014 21:00:57 +0000 (16:00 -0500)]
Fix a minor nit in Futures.dereference() documentation: the listener runs in either the thread that called dereference() OR the thread the completes the input future.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61801821

8 weeks agoDeprecate the primitive compare() methods internally.
Kurt Kluever [Tue, 25 Feb 2014 20:59:08 +0000 (15:59 -0500)]
Deprecate the primitive compare() methods internally.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61755619

8 weeks agoMinor docfix in Iterators.java.
Kurt Kluever [Tue, 25 Feb 2014 20:55:56 +0000 (15:55 -0500)]
Minor docfix in Iterators.java.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61749084

8 weeks agoIncrease timeouts that are expected never to expire.
Kurt Kluever [Tue, 25 Feb 2014 20:53:53 +0000 (15:53 -0500)]
Increase timeouts that are expected never to expire.
Under current timeouts, the test is flaky.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61742992

2 months agoImprove the error message thrown from MediaType.parse().
Christian Edward Gruber [Mon, 17 Feb 2014 16:28:17 +0000 (08:28 -0800)]
Improve the error message thrown from MediaType.parse().

Report as https://code.google.com/p/guava-libraries/issues/detail?id=1667
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61538444

2 months agoClarify javadoc of Files.move; it doesn't work just like mv.
Christian Edward Gruber [Thu, 13 Feb 2014 19:16:35 +0000 (11:16 -0800)]
Clarify javadoc of Files.move; it doesn't work just like mv.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61519547

2 months agoMark ImmutableMultiset toArray() tests as flaky.
Christian Edward Gruber [Thu, 13 Feb 2014 19:09:00 +0000 (11:09 -0800)]
Mark ImmutableMultiset toArray() tests as flaky.
The best way I know to do that for our suite-generated tests is to mark all ImmutableMultiset/ImmutableSortedMultiset tests as flaky.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61395617

2 months agogrow the destination buffer more aggressively to avoid excessive array copying in...
Christian Edward Gruber [Thu, 13 Feb 2014 19:05:28 +0000 (11:05 -0800)]
grow the destination buffer more aggressively to avoid excessive array copying in escapeSlow
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61330434

2 months agoAdd Follow-OnlyWhenPrerender-Shown http header constant.
Christian Edward Gruber [Thu, 13 Feb 2014 18:59:31 +0000 (10:59 -0800)]
Add Follow-OnlyWhenPrerender-Shown http header constant.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61312752

2 months agoMethod to shut down an ExecutorService in two phases included in j/c/g/common/util...
Christian Edward Gruber [Thu, 13 Feb 2014 18:55:43 +0000 (10:55 -0800)]
Method to shut down an ExecutorService in two phases included in j/c/g/common/util/MoreExecutors.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61230873

2 months agoAdd a more descriptive error message when AsyncFunction.apply returns null.
Christian Edward Gruber [Thu, 13 Feb 2014 18:53:43 +0000 (10:53 -0800)]
Add a more descriptive error message when AsyncFunction.apply returns null.

As it currently is, the NPE gets thrown several lines later in a very confusing function which, at first glance, should not be able to produce an NPE (since outputFuture is not @Nullable).  And since outputFuture looks like (but isn't) a field, one has to search the entire class to determine how it was set to null in the first place.  This adds a very clear message to the NPE saying that AsyncFunction may not return null.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61228632

2 months agoCorrect code example in Funnel Javadoc, that uses the old deprecated-then-removed...
Chris Povirk [Thu, 6 Feb 2014 21:47:09 +0000 (16:47 -0500)]
Correct code example in Funnel Javadoc, that uses the old deprecated-then-removed PrimitiveSink#putString(String) method.

http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/hash/Funnel.html
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61134562

2 months agoDeprecate the constants in com.google.common.base.Charsets for internal users. Intern...
Chris Povirk [Thu, 6 Feb 2014 21:43:31 +0000 (16:43 -0500)]
Deprecate the constants in com.google.common.base.Charsets for internal users. Internal users should prefer the constants in java.nio.charset.StandardCharsets.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61098351

2 months agoAdd closeQuietly(InputStream) and closeQuietly(Reader).
Chris Povirk [Thu, 6 Feb 2014 21:40:51 +0000 (16:40 -0500)]
Add closeQuietly(InputStream) and closeQuietly(Reader).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61085980

2 months agoDelete AndroidInteger.
Colin Decker [Wed, 5 Feb 2014 18:58:59 +0000 (13:58 -0500)]
Delete AndroidInteger.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61067964

2 months agoMozilla TLD update.
Colin Decker [Wed, 5 Feb 2014 18:55:00 +0000 (13:55 -0500)]
Mozilla TLD update.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61013135

2 months agoRun Animal Sniffer on guava-testlib and guava-test in addition to guava itself.
Colin Decker [Wed, 5 Feb 2014 18:53:28 +0000 (13:53 -0500)]
Run Animal Sniffer on guava-testlib and guava-test in addition to guava itself.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=61001284

2 months agoReshuffling from internal change.
Colin Decker [Wed, 5 Feb 2014 18:51:31 +0000 (13:51 -0500)]
Reshuffling from internal change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60993826

2 months agoBelated nitpicking and comment revisions for TypeResolver change.
Colin Decker [Mon, 3 Feb 2014 21:12:04 +0000 (16:12 -0500)]
Belated nitpicking and comment revisions for TypeResolver change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60944582

2 months agoChange TypeResolver to not construct new TypeResolver when all the bounds remain...
Chris Povirk [Mon, 3 Feb 2014 17:42:58 +0000 (12:42 -0500)]
Change TypeResolver to not construct new TypeResolver when all the bounds remain the same. This is to work round the change in JDK TypeVariableImpl.equals().

In summary:

1) When <A> resolves to itself <A> (i.e. all bounds resolve equal to themselves), uses the original TypeVariable instead of the Guava artificial TypeVariableImpl, which doesn't compare equal with JDK TypeVariableImpl.

2) In order to do 1), we need TypeVariableImpl.equals() to compare bounds too.

3) Uses TypeVariableKey as key in the map from TypeVariable to Type, during resolution. This ensures that during type resolution, despite the change of equals() in 2), the same type variable with or without partially resolved bounds is always mapped to the same resolved type.

4) Since JDK's TypeVariableImpl no longer compares equal with our custom TypeVariableImpl. We need to change equals() to do the same to ensure symmetry.

5) All of the above are done conditionally only under the new JDK.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60778041

2 months agoPromise at least weakly consistent iteration for asMap().
Chris Povirk [Fri, 31 Jan 2014 18:28:42 +0000 (13:28 -0500)]
Promise at least weakly consistent iteration for asMap().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60762175

2 months agoFix tests that break when Stopwatch constructors are hidden.
Chris Povirk [Fri, 31 Jan 2014 18:24:17 +0000 (13:24 -0500)]
Fix tests that break when Stopwatch constructors are hidden.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60761955

2 months agoHide deprecated Stopwatch constructors in Guava.
Chris Povirk [Fri, 31 Jan 2014 18:05:19 +0000 (13:05 -0500)]
Hide deprecated Stopwatch constructors in Guava.
The constructors are scheduled for deletion in Guava 17.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60668113

2 months agoRewrite Ints.tryParse(int) with a copy of the Longs.tryParse implementation, which...
Chris Povirk [Fri, 31 Jan 2014 18:01:02 +0000 (13:01 -0500)]
Rewrite Ints.tryParse(int) with a copy of the Longs.tryParse implementation, which accepts only ASCII digits.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60660931

2 months agoAdded Media types for the following font formats: EOT, SFNT, WOFF.
Chris Povirk [Tue, 28 Jan 2014 21:03:14 +0000 (16:03 -0500)]
Added Media types for the following font formats: EOT, SFNT, WOFF.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60484333

2 months agoFix a call to checkArgument in SimpleTimeLimiter.newProxy to use string substitution.
Chris Povirk [Tue, 28 Jan 2014 18:07:08 +0000 (13:07 -0500)]
Fix a call to checkArgument in SimpleTimeLimiter.newProxy to use string substitution.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60440806

2 months agoAlso benchmark creating SortedSets, which predictably fare worst, but at least
Colin Decker [Mon, 27 Jan 2014 21:52:59 +0000 (16:52 -0500)]
Also benchmark creating SortedSets, which predictably fare worst, but at least
we can observe by how much.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60385622

2 months agoStop using assertSeededHashFunctionEquals for goodFastHash.
Chris Povirk [Sat, 25 Jan 2014 00:37:36 +0000 (19:37 -0500)]
Stop using assertSeededHashFunctionEquals for goodFastHash.
The problem is that goodFastHash(n) is sometimes equal to goodFastHash(m) even when n and m are different.
Basically, the value is rounded up to a multiple of 128.
(It's a size, not a seed as it is for the other Hashing methods.)

Currently the test passes because of the specific values that the test Random generates.
However, which specific numbers are used for goodFastHash is dependent on the order in which the Hashing methods are tested, which is dependent on the JVM.
The methods are reordered with the latest JDK7 build, breaking the test (at least in Guava, which has a slightly different set of methods than internally).

We could "fix" this by sorting the methods before testing them, but the fundamental problem is that assertSeededHashFunctionEquals makes sense for seeds but not sizes.
(This basic fact is hinted at by a comment that already existed in the test.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=60202745