src/share/classes/javax/swing/PopupFactory.java

Print this page

        

@@ -399,17 +399,18 @@
         /**
          * Returns the cache to use for heavy weight popups. Maps from
          * <code>Window</code> to a <code>List</code> of
          * <code>HeavyWeightPopup</code>s.
          */
+        @SuppressWarnings("unchecked")
         private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
             synchronized (HeavyWeightPopup.class) {
                 Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
                                   heavyWeightPopupCacheKey);
 
                 if (cache == null) {
-                    cache = new HashMap<Window, List<HeavyWeightPopup>>(2);
+                    cache = new HashMap<>(2);
                     SwingUtilities.appContextPut(heavyWeightPopupCacheKey,
                                                  cache);
                 }
                 return cache;
             }

@@ -696,15 +697,16 @@
         }
 
         /**
          * Returns the cache to use for heavy weight popups.
          */
+        @SuppressWarnings("unchecked")
         private static List<LightWeightPopup> getLightWeightPopupCache() {
             List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(
                                    lightWeightPopupCacheKey);
             if (cache == null) {
-                cache = new ArrayList<LightWeightPopup>();
+                cache = new ArrayList<>();
                 SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);
             }
             return cache;
         }
 

@@ -852,16 +854,17 @@
         }
 
         /**
          * Returns the cache to use for medium weight popups.
          */
+        @SuppressWarnings("unchecked")
         private static List<MediumWeightPopup> getMediumWeightPopupCache() {
             List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(
                                     mediumWeightPopupCacheKey);
 
             if (cache == null) {
-                cache = new ArrayList<MediumWeightPopup>();
+                cache = new ArrayList<>();
                 SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
             }
             return cache;
         }