8047025: Fix raw and unchecked lint warnings in generated nimbus files
authorsmarks
Tue, 08 Jul 2014 09:19:29 -0700
changeset 25758 7b1757bad3fa
parent 25757 463491af0c8f
child 25759 625be49758c1
8047025: Fix raw and unchecked lint warnings in generated nimbus files Reviewed-by: henryjen, prr
jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template
jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Tue Jul 08 16:42:23 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/Defaults.template	Tue Jul 08 09:19:29 2014 -0700
@@ -398,7 +398,7 @@
         @Override
         public Object createValue(UIDefaults table) {
             try {
-                Class c;
+                Class<?> c;
                 Object cl;
                 // See if we should use a separate ClassLoader
                 if (table == null || !((cl = table.get("ClassLoader"))
@@ -412,7 +412,7 @@
                 }
 
                 c = Class.forName(className, true, (ClassLoader)cl);
-                Constructor constructor = c.getConstructor(
+                Constructor<?> constructor = c.getConstructor(
                         AbstractRegionPainter.PaintContext.class, int.class);
                 if (constructor == null) {
                     throw new NullPointerException(
@@ -564,7 +564,7 @@
                 //if c is not named, and parts[partIndex] has an expected class
                 //type registered, then check to make sure c is of the
                 //right type;
-                Class clazz = parts[partIndex].c;
+                Class<?> clazz = parts[partIndex].c;
                 if (clazz != null && clazz.isAssignableFrom(c.getClass())) {
                     //so far so good, recurse
                     return matches(c.getParent(), partIndex - 1);
@@ -636,7 +636,7 @@
             private String s;
             //true if this part represents a component name
             private boolean named;
-            private Class c;
+            private Class<?> c;
 
             Part(String s) {
                 named = s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"';
@@ -816,7 +816,7 @@
 
     private static final class PainterBorder implements Border, UIResource {
         private Insets insets;
-        private Painter painter;
+        private Painter<Component> painter;
         private String painterKey;
         
         PainterBorder(String painterKey, Insets insets) {
@@ -827,7 +827,9 @@
         @Override
         public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
             if (painter == null) {
-                painter = (Painter)UIManager.get(painterKey);
+                @SuppressWarnings("unchecked")
+                Painter<Component> temp = (Painter<Component>)UIManager.get(painterKey);
+                painter = temp;
                 if (painter == null) return;
             }
             
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template	Tue Jul 08 16:42:23 2014 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/StateImpl.template	Tue Jul 08 09:19:29 2014 -0700
@@ -28,7 +28,7 @@
 import javax.swing.*;
 
 
-class ${STATE_NAME} extends State {
+class ${STATE_NAME} extends State<JComponent> {
     ${STATE_NAME}() {
         super("${STATE_KEY}");
     }