artiya4u / google-http-java-client

Automatically exported from code.google.com/p/google-http-java-client
0 stars 0 forks source link

Remove Guava library dependency #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
External references, such as a standards document, or specification?

http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/googl
e/common/annotations/Beta.html

http://www.overstocktechblog.com/2012/06/25/announcing-library-detectors/

Java environments (e.g. Java 6, Android 2.3, App Engine, or All)?

All

Please describe the feature requested.

Guava uses the @Beta annotation to indicate library API that hasn't yet matured 
and may change in the future.  Currently we are in Beta so all of our library 
is that way.  But supposedly we will want to go out of Beta soon, so the @Beta 
annotation would be very useful to cover the parts of our library that aren't 
ready to go out of Beta, such as our XML support.

Thanks to Overstock.com there is now even a FindBugs plugin to catch usage of 
@Beta APIs.  We can offer that tool for developers that want to enforce use of 
only @Beta APIs, e.g. those that are developing libraries that depend on our 
library.

Original issue reported on code.google.com by yan...@google.com on 9 Jul 2012 at 5:04

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 10 Nov 2012 at 12:57

GoogleCodeExporter commented 9 years ago
Change of plans: we decided that we are instead going to rename that library 
into version 2, and branch off the existing library minus the Beta parts into a 
version 1 library that we will soon take out of Beta.  But rather than close 
this issue, I'm going to reuse it for a new meaning: eliminate use of @Beta API 
from Guava in the version 1 branch.

Original comment by yan...@google.com on 10 Dec 2012 at 2:52

GoogleCodeExporter commented 9 years ago
Here's a diff for catching beta APIs from Guava:

diff -r 60074cd807e9 pom.xml
--- a/pom.xml   Wed Nov 28 12:10:14 2012 -0500
+++ b/pom.xml   Mon Dec 10 13:09:35 2012 -0500
@@ -292,7 +292,7 @@
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>findbugs-maven-plugin</artifactId>
-          <version>2.3.2</version>
+          <version>2.5.2</version>
         </plugin>
         <plugin>
           <groupId>org.sonatype.plugins</groupId>
@@ -427,6 +427,13 @@
         <artifactId>findbugs-maven-plugin</artifactId>
         <configuration>
           <excludeFilterFile>${basedir}/../findbugs-exclude.xml</excludeFilterFile>
+          <plugins>
+            <plugin>
+              <groupId>com.overstock.findbugs</groupId>
+              <artifactId>library-detectors</artifactId>
+              <version>1.1</version>
+            </plugin>
+          </plugins>
         </configuration>
         <executions>
           <execution>

It reports the following @Beta APIs problems on google-http-client

[INFO] --- findbugs-maven-plugin:2.5.2:check (default) @ google-http-client ---
[INFO] Use of class com.google.common.io.ByteStreams, which is annotated with 
@Beta. ["com.google.api.client.http.AbstractInputStreamContent", 
"com.google.common.io.ByteStreams"] At AbstractInputStreamContent.java:[lines 
58-199]At ByteStreams.java:[lines 52-866]
[INFO] Use of class com.google.common.io.CharStreams, which is annotated with 
@Beta. ["com.google.api.client.http.UrlEncodedParser", 
"com.google.common.io.CharStreams"] At UrlEncodedParser.java:[lines 67-207]At 
CharStreams.java:[lines 57-436]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.json.JsonParser", 
"com.google.common.primitives.UnsignedInteger"] At JsonParser.java:[lines 
50-660]At UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.json.JsonParser", 
"com.google.common.primitives.UnsignedLong"] At JsonParser.java:[lines 
50-660]At UnsignedLong.java:[lines 42-247]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedInteger"] At Data.java:[lines 46-550]At 
UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedLong"] At Data.java:[lines 46-550]At 
UnsignedLong.java:[lines 42-247]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedInteger"] At Data.java:[lines 46-550]At 
UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedLong"] At Data.java:[lines 46-550]At 
UnsignedLong.java:[lines 42-247]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedInteger"] At Data.java:[lines 46-550]At 
UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedLong"] At Data.java:[lines 46-550]At 
UnsignedLong.java:[lines 42-247]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedInteger"] At Data.java:[lines 46-550]At 
UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedInteger, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedInteger"] At Data.java:[lines 46-550]At 
UnsignedInteger.java:[lines 44-244]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedLong"] At Data.java:[lines 46-550]At 
UnsignedLong.java:[lines 42-247]
[INFO] Use of class com.google.common.primitives.UnsignedLong, which is 
annotated with @Beta. ["com.google.api.client.util.Data", 
"com.google.common.primitives.UnsignedLong"] At Data.java:[lines 46-550]At 
UnsignedLong.java:[lines 42-247]

Original comment by yan...@google.com on 10 Dec 2012 at 6:15

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 9 Jan 2013 at 2:45

GoogleCodeExporter commented 9 years ago
We've decide to go even further: not only are we going to eliminate the use of 
all @Beta Gauva APIs, we are also going to jarjar Guava into our library so 
developers won't need to add Guava to their classpath.  We will fully 
accomplish this in 1.15.  For 1.14, we will accomplish the following:

1. Make proxy classes of Guava API we use into the com.google.api.client.util 
package for the following classes: , Joiner, Lists, Maps, Objects, 
Preconditions, Strings, & Throwables

2. Deprecate the use of the following classes: UnsignedInteger & UnsignedLong

3. Make a copy (not a proxy) of the following Guava APIs we use into the 
com.google.api.client.util package for the following classes: Charsets, 
ByteStreams (includes LimitInputStream), CharStreams

4. Stop using ListMultimap & ArrayListMultimap in MockLowLevelHttpRequest

5. Not sure yet what to do about SettableFuture in HttpRequest

Original comment by yan...@google.com on 26 Jan 2013 at 1:37

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 26 Jan 2013 at 1:38

GoogleCodeExporter commented 9 years ago
As far as I can tell, java.util.concurrent.FutureTask will work just as well in 
HttpRequest as the Guava SettableFuture.

Original comment by ca...@carey.geek.nz on 28 Jan 2013 at 10:28

GoogleCodeExporter commented 9 years ago
Thanks for the tip!  Removing use of SettableFuture sent for review here:

https://codereview.appspot.com/7235054/

Original comment by yan...@google.com on 29 Jan 2013 at 1:01

GoogleCodeExporter commented 9 years ago
More changesets sent for review:

https://codereview.appspot.com/7230044/ (proxy for some classes from Guava: 
Charsets, Joiner,
Lists, Maps, Objects, Preconditions, Strings, Throwables)
https://codereview.appspot.com/7231053/ (eliminate use of Guava's ListMultimap 
in MockLowLevelHttpRequest)
https://codereview.appspot.com/7225058/ (eliminate use of Guava's UnsignedLong 
& UnsignedInteger)
https://codereview.appspot.com/7237052/ (eliminate use of Guava's CharStreams)

Original comment by yan...@google.com on 29 Jan 2013 at 3:06

GoogleCodeExporter commented 9 years ago
another one:

https://codereview.appspot.com/7231074/ (jarjar guava & change scope to 
test/provided)

Original comment by yan...@google.com on 1 Feb 2013 at 1:27

GoogleCodeExporter commented 9 years ago
Last one and then we can mark this as fixed:
https://codereview.appspot.com/7303054/

Original comment by yan...@google.com on 6 Feb 2013 at 8:58

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 6 Feb 2013 at 8:59

GoogleCodeExporter commented 9 years ago

Original comment by yan...@google.com on 6 Feb 2013 at 9:00