cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Poth (JIRA)" <>
Subject [jira] [Commented] (CXF-7147) Unable to register a generic _InvocationCallback<Object>_ when using the async proxy client API in JAX-RS
Date Tue, 22 Nov 2016 14:08:58 GMT


John Poth commented on CXF-7147:

Hi [~sergey_beryozkin],

Thanks for looking into this. 

1- Registering InvocationCallback<Void> will not pass the check (I just re-verified).
This is because at runtime, _callbackRespClass_ will be set to  _java.lang.Void.class_ whereas
_methodReturnType_will be set to _java.lang.Void#TYPE_ and therefore


will return false. Some people treat void as a primitive (after all Void.TYPE.isPrimitive()
does return true) which will solve this. This can be changed and added to PrimitiveUtils,
I can update the PR if you think this makes sense. This will remove the Response and Object
corner cases.

2- Adding the check for InvocationCallback<Response> will fail later on in the code
when you receive the response. You will get a casting exception [here|]
for methods that return instances that cannot be casted to Response.

Hope this clears things up,


> Unable to register a generic _InvocationCallback<Object>_ when using the async
proxy client API in JAX-RS
> ---------------------------------------------------------------------------------------------------------
>                 Key: CXF-7147
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>            Reporter: John Poth
> It is currently impossible to register a generic _InvocationCallback<Object>_ when
invoking a method that returns void. This is due to a [check|]
that isn't satisfied when the _methodReturnType_ is void. I propose to add the following case
> {code}
> Object.class == callbackRespClass
> {code}
> And let the user handle the logic.
>  I also propose to remove the condition
> {code}
> Response.class == callbackRespClass
> {code}
> Which will lead to failure when [casting|]
to a return type upon completion. I will provide a PR.
> [~sergey_beryozkin] sorry for the confusion.

This message was sent by Atlassian JIRA

View raw message