Bladeren bron

Fix build warnings.

Change-Id: Ia13810eaecc9b387247c17948190ed5ccb692e14
Reviewed-on: http://gerrit.dmdirc.com/2667
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10 jaren geleden
bovenliggende
commit
64721a52b7

+ 1
- 1
src/com/dmdirc/parser/common/CallbackManager.java Bestand weergeven

@@ -341,7 +341,7 @@ public class CallbackManager {
341 341
      * @param callback The callback to retrieve
342 342
      * @return A proxy object which can be used to call the specified callback
343 343
      */
344
-    @SuppressWarnings("unchecked")
344
+    @SuppressWarnings({"unchecked", "rawtypes"})
345 345
     public <T extends CallbackInterface> T getCallback(final Class<T> callback) {
346 346
         return (T) Proxy.newProxyInstance(getClass().getClassLoader(),
347 347
                 new Class[]{ callback }, new CallbackHandler(callback));

+ 1
- 1
src/com/dmdirc/parser/common/SRVRecord.java Bestand weergeven

@@ -127,7 +127,7 @@ public class SRVRecord implements Comparable<SRVRecord> {
127 127
             final Attribute attr = new InitialDirContext(env).getAttributes(host, new String [] { "SRV" }).get("SRV");
128 128
 
129 129
             if (attr != null) {
130
-                final NamingEnumeration ne = attr.getAll();
130
+                final NamingEnumeration<?> ne = attr.getAll();
131 131
                 while (ne.hasMore()) {
132 132
                     try {
133 133
                         final SRVRecord record = new SRVRecord((String)ne.next());

+ 6
- 6
src/com/dmdirc/parser/irc/IRCChannelInfo.java Bestand weergeven

@@ -167,7 +167,7 @@ public class IRCChannelInfo implements ChannelInfo {
167 167
                 if (!isOpped && serverType.isOpOnly(cTemp)) {
168 168
                     // IRCD doesn't allow non-ops to ask for these modes.
169 169
                     continue;
170
-                } else if (serverType == serverType.STARCHAT && cTemp == 'H') {
170
+                } else if (serverType == ServerType.STARCHAT && cTemp == 'H') {
171 171
                     // IRCD Denies the mode exists
172 172
                     continue;
173 173
                 }
@@ -280,7 +280,7 @@ public class IRCChannelInfo implements ChannelInfo {
280 280
      * Empty the channel (Remove all known channelclients).
281 281
      */
282 282
     protected void emptyChannel() {
283
-        IRCClientInfo cTemp = null;
283
+        IRCClientInfo cTemp;
284 284
         synchronized (clients) {
285 285
             for (IRCChannelClientInfo client : clients.values()) {
286 286
                 cTemp = client.getClient();
@@ -463,8 +463,8 @@ public class IRCChannelInfo implements ChannelInfo {
463 463
     public String getModes() {
464 464
         final StringBuilder sModes = new StringBuilder("+");
465 465
         final StringBuilder sModeParams = new StringBuilder();
466
-        String sTemp = "";
467
-        long nTemp = 0;
466
+        String sTemp;
467
+        long nTemp;
468 468
         final long nChanModes = this.getMode();
469 469
         for (char cTemp : parser.chanModesBool.keySet()) {
470 470
             nTemp = parser.chanModesBool.get(cTemp);
@@ -613,8 +613,8 @@ public class IRCChannelInfo implements ChannelInfo {
613 613
     @Override
614 614
     public void alterMode(final boolean add, final Character mode, final String parameter) {
615 615
         int modecount = 1;
616
-        int modeint = 0;
617
-        String modestr = "";
616
+        int modeint;
617
+        String modestr;
618 618
         if (parser.h005Info.containsKey("MODES")) {
619 619
             try {
620 620
                 modecount = Integer.parseInt(parser.h005Info.get("MODES"));

+ 7
- 9
src/com/dmdirc/parser/irc/Logging.java Bestand weergeven

@@ -81,17 +81,15 @@ public class Logging {
81 81
     private Object log;
82 82
 
83 83
     /** Create a new Logging. */
84
-    @SuppressWarnings("unchecked")
84
+    @SuppressWarnings({"unchecked", "rawtypes"})
85 85
     private Logging() {
86
-        boolean classExists = false;
87 86
         try {
88
-            Class factory = null;
87
+            Class<?> factory;
89 88
             // Check for classes
90 89
             Class.forName("org.apache.commons.logging.Log");
91 90
             factory = Class.forName("org.apache.commons.logging.LogFactory");
92 91
 
93
-            classExists = factory != null;
94
-            if (classExists) {
92
+            if (factory != null) {
95 93
                 final Method getLog = factory.getMethod("getLog", new Class[]{Class.class});
96 94
                 log = getLog.invoke(null, this.getClass());
97 95
             }
@@ -101,7 +99,7 @@ public class Logging {
101 99
         } catch (InvocationTargetException ite) {
102 100
         }
103 101
 
104
-        isAvailable = classExists && log != null;
102
+        isAvailable = log != null;
105 103
     }
106 104
 
107 105
     /**
@@ -126,7 +124,7 @@ public class Logging {
126 124
     public boolean levelEnabled(final LogLevel level) {
127 125
         if (isAvailable) {
128 126
             try {
129
-                final Method check = log.getClass().getMethod(level.getCheckMethodName(), new Class[0]);
127
+                final Method check = log.getClass().getMethod(level.getCheckMethodName());
130 128
                 return (Boolean) check.invoke(log, new Object[0]);
131 129
             } catch (NoSuchMethodException nsme) {
132 130
             } catch (IllegalAccessException iae) {
@@ -160,10 +158,10 @@ public class Logging {
160 158
         }
161 159
         try {
162 160
             if (throwable == null) {
163
-                final Method method = log.getClass().getMethod(level.getMethodName(), new Class[]{String.class});
161
+                final Method method = log.getClass().getMethod(level.getMethodName(), String.class);
164 162
                 method.invoke(log, new Object[]{message});
165 163
             } else {
166
-                final Method method = log.getClass().getMethod(level.getMethodName(), new Class[]{String.class, Throwable.class});
164
+                final Method method = log.getClass().getMethod(level.getMethodName(), String.class, Throwable.class);
167 165
                 method.invoke(log, new Object[]{message, throwable});
168 166
             }
169 167
         } catch (NoSuchMethodException nsme) {

Laden…
Annuleren
Opslaan