[OpenJDK 2D-Dev] JDK9: RFR: 8039342: Fix raw and unchecked warnings in sun.awt.*

Phil Race philip.race at oracle.com
Wed Apr 9 21:35:40 UTC 2014


Yes it looks to be about 70% AWT and about 30% 2d ..

Remember there's a magic decoder ring at 
http://openjdk.java.net/groups/2d/2dawtfiles.html
It may not have 100% coverage but it should help.

I looked over the 2D ones as below ..

src/share/classes/sun/awt/FontConfiguration.java
src/share/classes/sun/awt/PlatformFont.java
src/share/classes/sun/awt/geom/AreaOp.java
src/share/classes/sun/awt/geom/Crossings.java
src/share/classes/sun/awt/geom/Curve.java
src/share/classes/sun/awt/geom/Order2.java
src/share/classes/sun/awt/geom/Order3.java
src/share/classes/sun/awt/image/BufImgSurfaceData.java
src/share/classes/sun/awt/image/GifImageDecoder.java
src/share/classes/sun/awt/image/ImageDecoder.java
src/share/classes/sun/awt/image/ImageFetcher.java
src/share/classes/sun/awt/image/ImageRepresentation.java
src/share/classes/sun/awt/image/ImagingLib.java
src/share/classes/sun/awt/image/JPEGImageDecoder.java
src/share/classes/sun/awt/image/OffScreenImageSource.java
src/share/classes/sun/awt/image/PNGImageDecoder.java
src/share/classes/sun/awt/image/ToolkitImage.java
src/solaris/classes/sun/awt/X11FontManager.java
src/solaris/classes/sun/awt/X11GraphicsDevice.java
src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
src/solaris/classes/sun/awt/motif/MFontConfiguration.java

It seems fine except that
1. How are you testing all these changes ?

2. The changes in sun/awt/geom need closer examination and I would really
like Jim to weigh in on those ..

-phil.


On 4/7/2014 5:55 PM, Henry Jen wrote:
> Thanks Joe for pointing out the request should go to awt-dev.
>
> Cheers,
> Henry
>
>
> On 04/07/2014 04:13 PM, Joe Darcy wrote:
>> 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