[OpenJDK 2D-Dev] JDK 9 RFR of JDK-8042870: Fix raw and unchecked warnings in sun.print

Joe Darcy joe.darcy at oracle.com
Mon Jun 9 18:43:46 UTC 2014

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,


More information about the 2d-dev mailing list