src/share/classes/javax/swing/text/html/HTMLDocument.java

Print this page

        

@@ -861,15 +861,17 @@
 
         if (name != null) {
             Object     maps = getProperty(MAP_PROPERTY);
 
             if (maps == null) {
-                maps = new Hashtable(11);
+                maps = new Hashtable<>(11);
                 putProperty(MAP_PROPERTY, maps);
             }
             if (maps instanceof Hashtable) {
-                ((Hashtable)maps).put("#" + name, map);
+                @SuppressWarnings("unchecked")
+                Hashtable<Object, Object> tmp = (Hashtable)maps;
+                tmp.put("#" + name, map);
             }
         }
     }
 
     /**

@@ -908,15 +910,17 @@
     /**
      * Returns an <code>Enumeration</code> of the possible Maps.
      * @return the enumerated list of maps, or <code>null</code>
      *          if the maps are not an instance of <code>Hashtable</code>
      */
-    Enumeration getMaps() {
+    Enumeration<Object> getMaps() {
         Object     maps = getProperty(MAP_PROPERTY);
 
         if (maps instanceof Hashtable) {
-            return ((Hashtable)maps).elements();
+            @SuppressWarnings("unchecked")
+            Hashtable<Object, Object> tmp = (Hashtable) maps;
+            return tmp.elements();
         }
         return null;
     }
 
     /**

@@ -1491,11 +1495,11 @@
             }
         }
         else if (searchLeafAttributes && attr != null) {
             // For some leaf elements we store the actual attributes inside
             // the AttributeSet of the Element (such as anchors).
-            Enumeration names = attr.getAttributeNames();
+            Enumeration<?> names = attr.getAttributeNames();
             if (names != null) {
                 while (names.hasMoreElements()) {
                     Object name = names.nextElement();
                     if ((name instanceof HTML.Tag) &&
                         (attr.getAttribute(name) instanceof AttributeSet)) {

@@ -2692,14 +2696,16 @@
             if (comments != null && !(comments instanceof Vector)) {
                 // No place to put comment.
                 return;
             }
             if (comments == null) {
-                comments = new Vector();
+                comments = new Vector<>();
                 putProperty(AdditionalComments, comments);
             }
-            ((Vector)comments).addElement(comment);
+            @SuppressWarnings("unchecked")
+            Vector<Object> v = (Vector<Object>)comments;
+            v.addElement(comment);
         }
 
         /**
          * Callback from the parser.  Route to the appropriate
          * handler for the tag.

@@ -3437,17 +3443,19 @@
                 // build the element, unless this is an option.
                 if (t == HTML.Tag.OPTION) {
                     option = new Option(attr);
 
                     if (selectModel instanceof OptionListModel) {
+                        @SuppressWarnings("unchecked")
                         OptionListModel<Option> m = (OptionListModel<Option>) selectModel;
                         m.addElement(option);
                         if (option.isSelected()) {
                             m.addSelectionInterval(optionCount, optionCount);
                             m.setInitialSelection(optionCount);
                         }
                     } else if (selectModel instanceof OptionComboBoxModel) {
+                        @SuppressWarnings("unchecked")
                         OptionComboBoxModel<Option> m = (OptionComboBoxModel<Option>) selectModel;
                         m.addElement(option);
                         if (option.isSelected()) {
                             m.setSelectedItem(option);
                             m.setInitialSelection(option);