Browse Source

Remove warnings in plugins

Change-Id: Ib35a1f83250d697cd8af514a6d646e49e79234b8
Reviewed-on: http://gerrit.dmdirc.com/3178
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.8
Greg Holmes 10 years ago
parent
commit
e88f8215d9

+ 4
- 8
src/com/dmdirc/addons/notifications/NotificationConfig.java View File

@@ -43,14 +43,10 @@ import net.miginfocom.swing.MigLayout;
43 43
  */
44 44
 public class NotificationConfig extends JPanel implements PreferencesInterface {
45 45
 
46
-    /**
47
-     * A version number for this class. It should be changed whenever the class structure is changed
48
-     * (or anything else that would prevent serialized objects being unserialized with the new
49
-     * class).
50
-     */
46
+    /** A version number for this class. */
51 47
     private static final long serialVersionUID = 1;
52 48
     /** Notification method order list. */
53
-    private ReorderableJList list;
49
+    private ReorderableJList<String> list;
54 50
     /** Notification methods. */
55 51
     private final List<String> methods;
56 52
     /** The plugin that owns this panel. */
@@ -80,7 +76,7 @@ public class NotificationConfig extends JPanel implements PreferencesInterface {
80 76
      * Initialises the components.
81 77
      */
82 78
     private void initComponents() {
83
-        list = new ReorderableJList();
79
+        list = new ReorderableJList<>();
84 80
 
85 81
         for (String method : methods) {
86 82
             list.getModel().addElement(method);
@@ -96,7 +92,7 @@ public class NotificationConfig extends JPanel implements PreferencesInterface {
96 92
 
97 93
         panel.add(new JLabel("Drag and drop items to reorder"), "wrap");
98 94
         panel.add(new JScrollPane(list), "growx, pushx");
99
-        panel.add(new ListReorderButtonPanel(list), "");
95
+        panel.add(new ListReorderButtonPanel<>(list), "");
100 96
 
101 97
         add(panel, "growx, wrap");
102 98
 

+ 6
- 10
src/com/dmdirc/addons/nowplaying/ConfigPanel.java View File

@@ -57,14 +57,10 @@ import net.miginfocom.swing.MigLayout;
57 57
 public class ConfigPanel extends JPanel implements PreferencesInterface,
58 58
         KeyListener {
59 59
 
60
-    /**
61
-     * A version number for this class. It should be changed whenever the class structure is changed
62
-     * (or anything else that would prevent serialized objects being unserialized with the new
63
-     * class).
64
-     */
60
+    /** A version number for this class. */
65 61
     private static final long serialVersionUID = 1;
66 62
     /** Media source order list. */
67
-    private ReorderableJList list;
63
+    private ReorderableJList<String> list;
68 64
     /** Media sources. */
69 65
     private final List<String> sources;
70 66
     /** The plugin that owns this panel. */
@@ -109,7 +105,7 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
109 105
      * Initialises the components.
110 106
      */
111 107
     private void initComponents() {
112
-        list = new ReorderableJList();
108
+        list = new ReorderableJList<>();
113 109
 
114 110
         for (String source : sources) {
115 111
             list.getModel().addElement(source);
@@ -130,7 +126,7 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
130 126
 
131 127
         panel.add(new JLabel("Drag and drop items to reorder"), "wrap");
132 128
         panel.add(new JScrollPane(list), "growx, pushx");
133
-        panel.add(new ListReorderButtonPanel(list), "");
129
+        panel.add(new ListReorderButtonPanel<>(list), "");
134 130
 
135 131
         add(panel, "growx, wrap");
136 132
 
@@ -192,10 +188,10 @@ public class ConfigPanel extends JPanel implements PreferencesInterface,
192 188
     public List<String> getSources() {
193 189
         final List<String> newSources = new LinkedList<>();
194 190
 
195
-        final Enumeration<?> values = list.getModel().elements();
191
+        final Enumeration<String> values = list.getModel().elements();
196 192
 
197 193
         while (values.hasMoreElements()) {
198
-            newSources.add((String) values.nextElement());
194
+            newSources.add(values.nextElement());
199 195
         }
200 196
 
201 197
         return newSources;

+ 1
- 1
src/com/dmdirc/addons/scriptplugin/ScriptCommand.java View File

@@ -134,7 +134,7 @@ public class ScriptCommand extends Command implements IntelligentCommand {
134 134
                             final Class<?> logger = Class.forName("com.dmdirc.logger.Logger");
135 135
                             if (logger != null) {
136 136
                                 final Method exceptionToStringArray = logger.getDeclaredMethod(
137
-                                        "exceptionToStringArray", new Class[]{Throwable.class});
137
+                                        "exceptionToStringArray", new Class<?>[]{Throwable.class});
138 138
                                 exceptionToStringArray.setAccessible(true);
139 139
 
140 140
                                 final String[] stacktrace = (String[]) exceptionToStringArray.

+ 5
- 5
src/com/dmdirc/addons/serverlistdialog/Profiles.java View File

@@ -50,7 +50,7 @@ public class Profiles extends JPanel implements ServerListListener {
50 50
     /** Server list model. */
51 51
     private final ServerListModel model;
52 52
     /** Combo boxes. */
53
-    private final Map<ServerGroupItem, JComboBox> combos = new HashMap<>();
53
+    private final Map<ServerGroupItem, JComboBox<ConfigProvider>> combos = new HashMap<>();
54 54
     /** Info label. */
55 55
     private final JLabel label;
56 56
     /** Controller to use to get profiles. */
@@ -102,9 +102,9 @@ public class Profiles extends JPanel implements ServerListListener {
102 102
      *
103 103
      * @return The server group item's associated profile selection box
104 104
      */
105
-    private JComboBox getComboBox(final ServerGroupItem item) {
105
+    private JComboBox<ConfigProvider> getComboBox(final ServerGroupItem item) {
106 106
         if (!combos.containsKey(item)) {
107
-            final DefaultComboBoxModel comboModel = new VetoableComboBoxModel();
107
+            final DefaultComboBoxModel<ConfigProvider> comboModel = new VetoableComboBoxModel<>();
108 108
 
109 109
             ConfigProvider selectedItem = null;
110 110
             comboModel.addElement(null);
@@ -116,7 +116,7 @@ public class Profiles extends JPanel implements ServerListListener {
116 116
                 }
117 117
             }
118 118
             comboModel.setSelectedItem(selectedItem);
119
-            combos.put(item, new JComboBox(comboModel));
119
+            combos.put(item, new JComboBox<>(comboModel));
120 120
         }
121 121
         return combos.get(item);
122 122
     }
@@ -125,7 +125,7 @@ public class Profiles extends JPanel implements ServerListListener {
125 125
     @Override
126 126
     public void dialogClosed(final boolean save) {
127 127
         if (save) {
128
-            for (Entry<ServerGroupItem, JComboBox> entry : combos.entrySet()) {
128
+            for (Entry<ServerGroupItem, JComboBox<ConfigProvider>> entry : combos.entrySet()) {
129 129
                 if (entry.getKey() != null) {
130 130
                     if (entry.getValue().getSelectedItem() == null) {
131 131
                         entry.getKey().setProfile(null);

Loading…
Cancel
Save