[Fwd: Code review request: 7072353 JNDI libraries do not build with javac -Xlint:all -Werror]

David Holmes David.Holmes at oracle.com
Wed Aug 3 07:42:21 UTC 2011


Alexandre Boulgakov said the following on 08/03/11 04:44:
> On 8/2/2011 2:19 AM, Xuelei Fan wrote:
>> 3017 Vector<Object>  temp = (Vector)extractURLs(res.errorMessage);
>>     You may not need the conversion any more, the return value of
>> extractURLs() has been updated to
>>     2564     private static Vector<String>  extractURLs(String refString)
> The cast is needed to go from Vector<String> to Vector<Object>.

Raw types should be avoided (here and elsewhere there are casts to raw 
Vector). I'm surprised (generics continue to surprise me) that despite 
all our advances in type-inference etc that the compiler can not tell 
that a Vector<T> is-a Vector<Object>. :(

Not knowing how LdapResult.referrals is used overall I'm unsure what 
might be a better fix but perhaps referrals could be declared as 
Vector<?> and an unchecked cast to Vector<Object> added only/if where 
needed?

Cheers,
David Holmes




More information about the security-dev mailing list