Neal Hu created CXF-6429:
----------------------------

             Summary: Provider matching when nested generic type
                 Key: CXF-6429
                 URL: https://issues.apache.org/jira/browse/CXF-6429
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 3.0.3
         Environment: Windows
            Reporter: Neal Hu
             Fix For: 3.0.6


This is TCK case:
resource class: 
JAXBElement<String> method(JAXBElement<String> jaxb){

}
Provider 1(applicaiton provided provider): 
public class Provider1  implements MessageBodyReader<JAXBElement<String>>, 
MessageBodyWriter<JAXBElement<String>>
Provider 2: JAXBElementProvider
public class Provider2  implements MessageBodyReader<T>, MessageBodyWriter<T>

The case intends to match the pre-packaged provider, we challenged the case and 
got the response from Oracle spec leads:
------- 
The comparator for sorting selected MessageBodyWriter providers works as 
follows: 

1. compare the distance between requested and provided raw class (in this case, 
JAXBElement), if same, continue with step 2 
2. compare the distance between the requested and provided media type, if same, 
continue with step 3 
3. select custom provider if available, otherwise select default 
--
In this case, only the generic type JAXBElement(ignore <String> inside 
JAXBElement) should be considered, leaving the selection of which of two 
providers
for JAXBElement<String> and JAXBElement<Boolean> should be used, on relevant 
MessageBodyWriter#isWritable() method.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to