RFR: CODETOOLS-7902237: Fixing raw use of parameterized class

dmitry.bessonov at oracle.com dmitry.bessonov at oracle.com
Wed Jul 25 13:13:14 UTC 2018



On 24/07/2018 22:14, Jonathan Gibbons wrote:
> 
> 
> On 07/24/2018 07:48 AM, dmitry.bessonov at oracle.com wrote:
>> Please review the following fix related to "raw use of parameterized 
>> class" warning:
>>
>> JBS: https://bugs.openjdk.java.net/browse/CODETOOLS-7902237
>> Webrev: http://cr.openjdk.java.net/~dbessono/7902237/webrev/
>>
>> dmitry
> 
>   386             for (Iterator<?> iter = other.getIterator(false); 
> iter.hasNext(); ) {
>   387                 Entry otherEntry = (Entry) (iter.next());
> 
> can be
> 
>   386             for (Iterator<Entry> iter = other.getIterator(false); 
> iter.hasNext(); ) {
>   387                 Entry otherEntry = iter.next();
> 
> although, is it guaranteed that the iterator always returns Entry 
> objects?  (Never Entry[]?)

No it is not guaranteed.
The way ExcludeList.getIterator() method was designed assumes that it 
could return an iterator over arrays if entries.

dmitry


> 
> -- Jon


More information about the jtharness-dev mailing list