8048980: Fix raw and unchecked lint warnings in platform-specific sun.font files
authordarcy
Mon, 07 Jul 2014 16:05:13 -0700
changeset 25573 160050c1b09e
parent 25572 72ada33d5b97
child 25574 6ecfb8f241be
8048980: Fix raw and unchecked lint warnings in platform-specific sun.font files Reviewed-by: henryjen, prr
jdk/src/macosx/classes/sun/font/CFontConfiguration.java
jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
jdk/src/solaris/classes/sun/font/XMap.java
jdk/src/solaris/classes/sun/font/XRGlyphCache.java
--- a/jdk/src/macosx/classes/sun/font/CFontConfiguration.java	Mon Jul 07 10:27:56 2014 -0700
+++ b/jdk/src/macosx/classes/sun/font/CFontConfiguration.java	Mon Jul 07 16:05:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,6 @@
 
     @Override
     protected void initReorderMap() {
-        reorderMap = new HashMap();
+        reorderMap = new HashMap<>();
     }
 }
--- a/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Mon Jul 07 10:27:56 2014 -0700
+++ b/jdk/src/solaris/classes/sun/font/FcFontConfiguration.java	Mon Jul 07 16:05:13 2014 -0700
@@ -170,7 +170,7 @@
 
     @Override
     protected void initReorderMap() {
-        reorderMap = new HashMap();
+        reorderMap = new HashMap<>();
     }
 
     @Override
--- a/jdk/src/solaris/classes/sun/font/XMap.java	Mon Jul 07 10:27:56 2014 -0700
+++ b/jdk/src/solaris/classes/sun/font/XMap.java	Mon Jul 07 16:05:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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);
--- a/jdk/src/solaris/classes/sun/font/XRGlyphCache.java	Mon Jul 07 10:27:56 2014 -0700
+++ b/jdk/src/solaris/classes/sun/font/XRGlyphCache.java	Mon Jul 07 16:05:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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;
     }
 
     /**