hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: generics issue in httpclient 4.0-alpha4
Date Sat, 10 May 2008 11:37:44 GMT
On Sat, 2008-05-10 at 11:03 +0200, Sebastiaan van Erk wrote:
> Hi,
> 
> First of all, thanks for the new httpclient release. :-)
> 
> When I was updating my project I ran into one small generics issue; the 
> following code will not compile:
> 
> 	new UrlEncodedFormEntity(Collections.singletonList(new 
> BasicNameValuePair("a", "b")));
> 
> because UrlEncodedFormEntity wants a List<NameValuePair> and the above 
> code results in a List<BasicNameValuePair>. Considering that the list is 
> probably read only in the httpclient code, the declaration of the 
> UrlEncodedFormEntity constructor could be changed to:
> 
>      public UrlEncodedFormEntity (
>          final List <? extends NameValuePair> parameters,
>          final String encoding) throws UnsupportedEncodingException {
>          super(URLEncodedUtils.format(parameters, encoding),
>              encoding);
>          setContentType(URLEncodedUtils.CONTENT_TYPE);
>      }
> 
> (note the List<? extends NameValuePair>).
> 

´╗┐Sebastiaan,

It is obviously a bug. Please open a JIRA issue for it. We also happily
accept patches ;-)

Oleg


> Regards,
> Sebastiaan
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message