[OpenJDK 2D-Dev] JDK9: RFR: 8039342: Fix raw and unchecked warnings in sun.awt.*
Joe Darcy
joe.darcy at oracle.com
Mon Apr 7 23:13:50 UTC 2014
Hi Henry,
Thanks for looking into this. FWIW, while I was working on
JDK-8039109: Fix unchecked and raw lint warnings in java.awt
I started looking at some sun.awt.* type too and I noticed the same
problem in AreaOp.pruneEdges(). The comment I added to my in-progress
webrev is:
203 /*
204 * The implementation of this method consistently treats its
205 * return type either as a Vector<Edge> or a Vector<Curve>.
206 */
so there does seem to be some internal inconsistency in what the Vector
is meant to hold.
In any case, your changes look good to me. (I'll adapt my changes for
8039109 based on your changes in this bug.)
Cheers,
-Joe
On 04/07/2014 01:46 PM, Henry Jen wrote:
> Hi,
>
> Please review the webrev cleans up raw and unchecked warnings in sun.awt,
>
> http://cr.openjdk.java.net/~henryjen/jdk9/8039342/0/webrev/
>
> The following changes in AreaOp::pruneEdges() is particular worth
> attention, when numedges < 2, two different type are mixed up in the
> past with use of rawtypes; However, I think it could only work if the
> Vector is empty?
>
> Cheers,
> Henry
>
>
>> @@ -193,16 +193,20 @@
>> }
>> return 1;
>> }
>> };
>>
>> - private Vector pruneEdges(Vector edges) {
>> + private Vector<Curve> pruneEdges(Vector<Edge> edges) {
>> int numedges = edges.size();
>> if (numedges < 2) {
>> - return edges;
>> + Vector<Curve> rt = new Vector<>();
>> + for (Edge edge: edges) {
>> + rt.add(edge.getCurve());
>> }
>> - Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]);
>> + return rt;
>> + }
>> + Edge[] edgelist = edges.toArray(new Edge[numedges]);
>> Arrays.sort(edgelist, YXTopComparator);
>> if (false) {
>> System.out.println("pruning: ");
>> for (int i = 0; i < numedges; i++) {
>> System.out.println("edgelist["+i+"] = "+edgelist[i]);
>
More information about the 2d-dev
mailing list