ソースを参照

Remove compile time warnings.

pull/29/head
Greg Holmes 9年前
コミット
c4499517d3

+ 1
- 1
src/com/dmdirc/util/collections/ListenerList.java ファイルの表示

@@ -140,7 +140,7 @@ public class ListenerList {
140 140
     @SuppressWarnings("unchecked")
141 141
     public <T> T getCallable(final Class<T> listenerType) {
142 142
         return (T) Proxy.newProxyInstance(listenerType.getClassLoader(),
143
-                new Class[] { listenerType }, new CallHandler<>(listenerType));
143
+                new Class<?>[] { listenerType }, new CallHandler<>(listenerType));
144 144
     }
145 145
 
146 146
     /**

+ 3
- 3
src/com/dmdirc/util/collections/WeakList.java ファイルの表示

@@ -80,7 +80,7 @@ public class WeakList<T> implements List<T> {
80 80
         final Collection<WeakReference<T>> res = new ArrayList<>();
81 81
 
82 82
         for (Object item : c) {
83
-            res.add(new EquatableWeakReference(item));
83
+            res.add(new EquatableWeakReference<>((T) item));
84 84
         }
85 85
 
86 86
         return res;
@@ -103,7 +103,7 @@ public class WeakList<T> implements List<T> {
103 103
     @Override
104 104
     @SuppressWarnings("unchecked")
105 105
     public boolean contains(final Object o) {
106
-        return list.contains(new EquatableWeakReference(o));
106
+        return list.contains(new EquatableWeakReference<>((T) o));
107 107
     }
108 108
 
109 109
     @Nonnull
@@ -132,7 +132,7 @@ public class WeakList<T> implements List<T> {
132 132
     @Override
133 133
     @SuppressWarnings("unchecked")
134 134
     public boolean remove(final Object o) {
135
-        return list.remove(new EquatableWeakReference(o));
135
+        return list.remove(new EquatableWeakReference<>((T) o));
136 136
     }
137 137
 
138 138
     @Override

+ 6
- 0
test/com/dmdirc/util/SimpleInjectorTest.java ファイルの表示

@@ -102,18 +102,24 @@ public class SimpleInjectorTest {
102 102
 
103 103
     static class TestObject implements Serializable {
104 104
 
105
+        private static final long serialVersionUID = 1L;
106
+
105 107
         public TestObject(final String test) { // NOPMD
106 108
         }
107 109
     }
108 110
 
109 111
     static class PrivateObject implements Serializable {
110 112
 
113
+        private static final long serialVersionUID = 1L;
114
+
111 115
         private PrivateObject() {
112 116
         }
113 117
     }
114 118
 
115 119
     static class ExceptionObject implements Serializable {
116 120
 
121
+        private static final long serialVersionUID = 1L;
122
+
117 123
         public ExceptionObject() {
118 124
             throw new IndexOutOfBoundsException();
119 125
         }

+ 4
- 5
test/com/dmdirc/util/collections/WeakListTest.java ファイルの表示

@@ -148,7 +148,6 @@ public class WeakListTest {
148 148
         list.add("test2");
149 149
         final List<String> instance = new WeakList<>();
150 150
         instance.add("test3");
151
-        System.out.println(instance);
152 151
         assertEquals("test3", instance.get(0));
153 152
         assertFalse(instance.containsAll(list));
154 153
         instance.addAll(0, list);
@@ -230,7 +229,7 @@ public class WeakListTest {
230 229
     @Test
231 230
     public void testIterator() {
232 231
         final List<String> instance = new WeakList<>();
233
-        Iterator result = instance.iterator();
232
+        Iterator<String> result = instance.iterator();
234 233
         assertFalse(result.hasNext());
235 234
         instance.add("test1");
236 235
         instance.add("test2");
@@ -243,7 +242,7 @@ public class WeakListTest {
243 242
     @Test
244 243
     public void testListIterator0args() {
245 244
         final List<String> instance = new WeakList<>();
246
-        ListIterator result = instance.listIterator();
245
+        Iterator<String> result = instance.listIterator();
247 246
         assertFalse(result.hasNext());
248 247
         instance.add("test1");
249 248
         instance.add("test2");
@@ -256,7 +255,7 @@ public class WeakListTest {
256 255
     @Test(expected=IndexOutOfBoundsException.class)
257 256
     public void testListIteratorInt() {
258 257
         final List<String> instance = new WeakList<>();
259
-        ListIterator result = instance.listIterator(1);
258
+        ListIterator<String> result = instance.listIterator(1);
260 259
         assertFalse(result.hasNext());
261 260
         instance.add("test1");
262 261
         instance.add("test2");
@@ -275,7 +274,7 @@ public class WeakListTest {
275 274
         instance.add("test2");
276 275
         instance.add("test3");
277 276
         instance.add("test4");
278
-        final List result = instance.subList(1, 3);
277
+        final List<String> result = instance.subList(1, 3);
279 278
         assertEquals(2, result.size());
280 279
         assertTrue(result.contains("test2"));
281 280
         assertTrue(result.contains("test3"));

読み込み中…
キャンセル
保存