[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-8048980 : Fix raw and unchecked lint warnings in platform-spec
From:       Phil Race <philip.race () oracle ! com>
Date:       2014-07-07 21:50:36
Message-ID: 53BB162C.9060209 () oracle ! com
[Download RAW message or body]

Looks ok to me

-phil.

On 7/1/2014 5:35 PM, Joe Darcy wrote:
> Hello,
>
> Please review this small change to address a few remaining unchecked 
> and raw types warnings in platform-specific sun.font code; full patch 
> below:
>
>     JDK-8048980 : Fix raw and unchecked lint warnings in 
> platform-specific sun.font files
>     http://cr.openjdk.java.net/~darcy/8048980.0/
>
> Thanks,
>
> -Joe
>
> --- old/src/macosx/classes/sun/font/CFontConfiguration.java 2014-07-01 
> 17:26:37.000000000 -0700
> +++ new/src/macosx/classes/sun/font/CFontConfiguration.java 2014-07-01 
> 17:26:37.000000000 -0700
> @@ -106,6 +106,6 @@
>
>      @Override
>      protected void initReorderMap() {
> -        reorderMap = new HashMap();
> +        reorderMap = new HashMap<>();
>      }
>  }
> --- old/src/solaris/classes/sun/font/FcFontConfiguration.java 
> 2014-07-01 17:26:37.000000000 -0700
> +++ new/src/solaris/classes/sun/font/FcFontConfiguration.java 
> 2014-07-01 17:26:37.000000000 -0700
> @@ -170,7 +170,7 @@
>
>      @Override
>      protected void initReorderMap() {
> -        reorderMap = new HashMap();
> +        reorderMap = new HashMap<>();
>      }
>
>      @Override
> --- old/src/solaris/classes/sun/font/XMap.java    2014-07-01 
> 17:26:38.000000000 -0700
> +++ new/src/solaris/classes/sun/font/XMap.java    2014-07-01 
> 17:26:37.000000000 -0700
> @@ -37,7 +37,7 @@
>
>  class XMap {
>
> -    private static HashMap xMappers = new HashMap();
> +    private static HashMap<String, XMap> xMappers = new HashMap<>();
>
>      /* ConvertedGlyphs has unicode code points as indexes and values
>       * are platform-encoded multi-bytes chars packed into java chars.
> @@ -49,7 +49,7 @@
>      char[] convertedGlyphs;
>
>      static synchronized XMap getXMapper(String encoding) {
> -        XMap mapper = (XMap)xMappers.get(encoding);
> +        XMap mapper = xMappers.get(encoding);
>          if (mapper == null) {
>              mapper = getXMapperInternal(encoding);
>              xMappers.put(encoding, mapper);
> --- old/src/solaris/classes/sun/font/XRGlyphCache.java 2014-07-01 
> 17:26:38.000000000 -0700
> +++ new/src/solaris/classes/sun/font/XRGlyphCache.java 2014-07-01 
> 17:26:38.000000000 -0700
> @@ -190,20 +190,23 @@
>          for (XRGlyphCacheEntry cacheEntry : glyphList) {
>              if (cacheEntry.isGrayscale(containsLCDGlyphs)) {
>                  if (grayGlyphs == null) {
> -                    grayGlyphs = new 
> ArrayList<XRGlyphCacheEntry>(glyphList.size());
> +                    grayGlyphs = new ArrayList<>(glyphList.size());
>                  }
>                  cacheEntry.setGlyphSet(grayGlyphSet);
>                  grayGlyphs.add(cacheEntry);
>              } else {
>                  if (lcdGlyphs == null) {
> -                    lcdGlyphs = new 
> ArrayList<XRGlyphCacheEntry>(glyphList.size());
> +                    lcdGlyphs = new ArrayList<>(glyphList.size());
>                  }
>                  cacheEntry.setGlyphSet(lcdGlyphSet);
>                  lcdGlyphs.add(cacheEntry);
>              }
>          }
> -
> -        return new List[] { grayGlyphs, lcdGlyphs };
> +        // Arrays and generics don't play well together
> +        @SuppressWarnings({"unchecked", "rawtypes"})
> +        List<XRGlyphCacheEntry>[] tmp =
> +            (List<XRGlyphCacheEntry>[]) (new List[] { grayGlyphs, 
> lcdGlyphs });
> +        return tmp;
>      }
>
>      /**
>

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

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