You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by an...@apache.org on 2014/01/24 23:09:25 UTC

git commit: Trying an upgrade to Guava 16.0

Updated Branches:
  refs/heads/JCLOUDS-415 [created] ffe2b4da9


Trying an upgrade to Guava 16.0

Invokable.equals has changed from 15 to 16 so we need to implement the check differently ourselves.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/ffe2b4da
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/ffe2b4da
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/ffe2b4da

Branch: refs/heads/JCLOUDS-415
Commit: ffe2b4da9dcc28990b02607f1d9a6936087ade04
Parents: 8ff6002
Author: Andrew Phillips <an...@apache.org>
Authored: Fri Jan 24 17:08:05 2014 -0500
Committer: Andrew Phillips <an...@apache.org>
Committed: Fri Jan 24 17:08:05 2014 -0500

----------------------------------------------------------------------
 core/pom.xml                                      |  2 +-
 .../internal/DelegatesToInvocationFunction.java   | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/ffe2b4da/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 967a3ad..a8ebdac 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -95,7 +95,7 @@
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
-      <version>15.0</version>
+      <version>16.0</version>
     </dependency>
     <dependency>
       <groupId>org.osgi</groupId>

http://git-wip-us.apache.org/repos/asf/jclouds/blob/ffe2b4da/core/src/main/java/org/jclouds/rest/internal/DelegatesToInvocationFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/jclouds/rest/internal/DelegatesToInvocationFunction.java b/core/src/main/java/org/jclouds/rest/internal/DelegatesToInvocationFunction.java
index 280345e..f046366 100644
--- a/core/src/main/java/org/jclouds/rest/internal/DelegatesToInvocationFunction.java
+++ b/core/src/main/java/org/jclouds/rest/internal/DelegatesToInvocationFunction.java
@@ -141,7 +141,7 @@ public class DelegatesToInvocationFunction<S, F extends Function<Invocation, Obj
 
    protected Object handle(Invocation invocation) {
       Invokable<?, ?> invokable = invocation.getInvokable();
-      if (CLOSE.equals(invokable)) {
+      if (isCloseMethod(invokable)) {
          try {
             injector.getInstance(Closer.class).close();
             return null;
@@ -157,6 +157,22 @@ public class DelegatesToInvocationFunction<S, F extends Function<Invocation, Obj
       }
    }
 
+   private static final boolean isCloseMethod(Invokable<?, ?> invokable) {
+      /*
+       * Tests equality according to the Javadoc for java.lang.reflect.Method:
+       *
+       * Two Methods are the same if they were declared by the same class
+       * and have the same name and formal parameter types and return type.
+       *
+       * Invokable now uses the *owning* class (not the declaring class) in
+       * its equals check.
+       */
+      return (CLOSE.getDeclaringClass().equals(invokable.getDeclaringClass())
+               && CLOSE.getName().equals(invokable.getName())
+               && CLOSE.getParameters().equals(invokable.getParameters())
+               && CLOSE.getReturnType().equals(invokable.getReturnType()));
+   }
+
    protected final Injector injector;
    protected final TypeToken<S> ownerType;
    protected final SetCaller setCaller;