I am implementing a ResponseHandler
for the apache HttpClient package, like so:
new ResponseHandler() {
public int handleResponse
Alas it's not possible. You can set the code to return Void
as you say, however you can never instanciate a Void
so you can't actually write a function which conforms to this specification.
Think of it as: The generic function says "this function returns something, of type X", and you can specify X but you can't change the sentence to "this function returns nothing". (I'm not sure if I agree with these semantics, but that's the way they are.)
In this case, what I always do, is just make the function return type Object
, and in fact always return null
.