From cb3cf412b10a13a0c5ffc9829c7b7e30ac1ee49f Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Fri, 24 Jan 2014 17:08:05 -0500 Subject: [PATCH 1/2] JCLOUDS-415: Preparing for Guava 16.0 Invokable.equals has changed from 15 to 16 so we need to implement the check differently ourselves. --- .../rest/internal/DelegatesToInvocationFunction.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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..8d94c3e 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 final Object invoke(Object proxy, Method invoked, @Nullable Object[] argv 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 @@ protected Object handle(Invocation invocation) { } } + private static 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 ownerType; protected final SetCaller setCaller; -- 1.8.5.1 From 9e97b7a488748688c452b1d64e0c89aed52c031e Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Mon, 27 Jan 2014 14:44:38 -0500 Subject: [PATCH 2/2] JCLOUDS-415: Upgrading Guava 15.0 -> 16.0 --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ com.google.guava guava - 15.0 + 16.0 org.osgi -- 1.8.5.1