jersey/jersey — pull request #131 by eiden (2014-12-07 15:03:24+00:00)
Title: Added support for toString in proxy client

If I call `toString()` on a proxy client, it throws an `UnsupportedOperationException`:

````
@Path("/")
interface MyClient {
@GET String get();
}

@Test
public void buildClient() {
WebTarget target = ClientBuilder.newClient()
.target("http://localhost/");

MyClient client = WebResourceFactory.newResource(MyClient.class, target);

client.toString(); //<-- throws java.lang.UnsupportedOperationException: Not a resource method
}
```
It's not a good thing to throw exceptions in `toString`. This PR add support for handling `toString` calls in the invocation handler.

Guava has an [AbstractInvocationHandler](https://github.com/google/guava/blob/fa95e381e665d8ee9639543b99ed38020c8de5ef/guava/src/com/google/common/reflect/AbstractInvocationHandler.java) where this logic is implemented (`hashCode` and `equals` as well). But the guava artifact is not in the proxy-client's pom. A better solution would be to use the guava's `AbstractInvocationHandler`, but I don't have the knowledge to decide on wether it's a good idea to add that dependency to the pom.