[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] JDK 9 RFR of JDK-8042870: Fix raw and unchecked warnings in sun.print
From:       Joe Darcy <joe.darcy () oracle ! com>
Date:       2014-06-09 18:43:46
Message-ID: 53960062.6060701 () oracle ! com
[Download RAW message or body]

Hi Phil,

On 06/09/2014 11:33 AM, Phil Race wrote:
> All seems fine. Just a couple of observation/questions ..
>
> 1. I see you found an unused variable in ServiceDialog ..

Yep; seemed better to delete it than generify it unnecessarily :-)

>
> 2. IPPPrintService.java
>
> 1791     ArrayList<HashMap<String, AttributeClass>> respList = new 
> ArrayList<>();
>
>
> 1900                 @SuppressWarnings({"unchecked", "rawtypes"})
> 1901                 HashMap<String, AttributeClass>[] tmp =
> 1902                     respList.toArray((HashMap<String, 
> AttributeClass>[])new HashMap[respList.size()]);
>
>
> Just curious, what  was  the problem here using the generified type as 
> the
> argument to toArray() ?
>

The Java language prohibits the creation of a generic array because of a 
bad interaction between arrays and generics. Basically, arrays have 
always been reified (stored the type of the elements so a runtime check 
can be performed) and generics are erased (no runtime information on 
element values). So if you have something like an array of HashMap<Foo, 
Bar>, the runtime can only check that it is an array of HashMap.

I'll get this pushed shortly; thanks,

-Joe
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic