Преглед изворни кода

Make all the things final.

Change-Id: I0c128522391d4de8452c603fae89d260c1a34ec2
Reviewed-on: http://gerrit.dmdirc.com/3836
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
pull/1/head
Chris Smith пре 9 година
родитељ
комит
693264fb86
34 измењених фајлова са 51 додато и 51 уклоњено
  1. 1
    1
      src/com/dmdirc/Main.java
  2. 1
    1
      src/com/dmdirc/ServerManager.java
  3. 1
    1
      src/com/dmdirc/ServerStatus.java
  4. 4
    4
      src/com/dmdirc/actions/Action.java
  5. 1
    1
      src/com/dmdirc/actions/ActionSubstitutor.java
  6. 1
    1
      src/com/dmdirc/actions/ConditionTree.java
  7. 2
    2
      src/com/dmdirc/actions/metatypes/ActionEvents.java
  8. 2
    2
      src/com/dmdirc/actions/metatypes/ChannelEvents.java
  9. 2
    2
      src/com/dmdirc/actions/metatypes/ClientEvents.java
  10. 2
    2
      src/com/dmdirc/actions/metatypes/LinkEvents.java
  11. 2
    2
      src/com/dmdirc/actions/metatypes/PluginEvents.java
  12. 2
    2
      src/com/dmdirc/actions/metatypes/QueryEvents.java
  13. 2
    2
      src/com/dmdirc/actions/metatypes/ServerEvents.java
  14. 1
    1
      src/com/dmdirc/commandline/RemoteServer.java
  15. 1
    1
      src/com/dmdirc/commandparser/PopupManager.java
  16. 1
    1
      src/com/dmdirc/commandparser/commands/flags/CommandFlagHandler.java
  17. 1
    1
      src/com/dmdirc/commandparser/commands/global/Help.java
  18. 1
    1
      src/com/dmdirc/commandparser/commands/global/OpenWindow.java
  19. 2
    2
      src/com/dmdirc/config/BaseConfigProvider.java
  20. 1
    1
      src/com/dmdirc/config/ConfigFileBackedConfigProvider.java
  21. 1
    1
      src/com/dmdirc/config/ConfigManager.java
  22. 1
    1
      src/com/dmdirc/config/IdentityManager.java
  23. 1
    1
      src/com/dmdirc/events/ChannelDisplayableUserEvent.java
  24. 1
    1
      src/com/dmdirc/events/PluginEvent.java
  25. 2
    2
      src/com/dmdirc/logger/ErrorLevel.java
  26. 1
    1
      src/com/dmdirc/logger/ErrorManager.java
  27. 2
    2
      src/com/dmdirc/plugins/PluginClassLoader.java
  28. 3
    3
      src/com/dmdirc/plugins/PluginInfo.java
  29. 1
    1
      src/com/dmdirc/plugins/PluginMetaData.java
  30. 1
    1
      src/com/dmdirc/ui/input/AdditionalTabTargets.java
  31. 2
    2
      src/com/dmdirc/ui/messages/ColourManager.java
  32. 2
    2
      src/com/dmdirc/util/URIParser.java
  33. 1
    1
      src/com/dmdirc/util/resourcemanager/DMDircResourceManager.java
  34. 1
    1
      src/com/dmdirc/util/resourcemanager/ResourceManager.java

+ 1
- 1
src/com/dmdirc/Main.java Прегледај датотеку

@@ -158,7 +158,7 @@ public class Main {
158 158
         }
159 159
 
160 160
         try {
161
-            ClientModule clientModule = new ClientModule();
161
+            final ClientModule clientModule = new ClientModule();
162 162
             final ObjectGraph graph = ObjectGraph.create(clientModule);
163 163
             clientModule.setObjectGraph(graph);
164 164
 

+ 1
- 1
src/com/dmdirc/ServerManager.java Прегледај датотеку

@@ -245,7 +245,7 @@ public class ServerManager implements ServerFactory {
245 245
         if (server.getState().isDisconnected()) {
246 246
             server.connect(uri, profile);
247 247
         } else {
248
-            Collection<? extends ChannelJoinRequest> joinRequests =
248
+            final Collection<? extends ChannelJoinRequest> joinRequests =
249 249
                     server.getParser().extractChannels(uri);
250 250
             server.join(joinRequests.toArray(new ChannelJoinRequest[joinRequests.size()]));
251 251
         }

+ 1
- 1
src/com/dmdirc/ServerStatus.java Прегледај датотеку

@@ -42,7 +42,7 @@ public class ServerStatus {
42 42
     /** The current state of the server. */
43 43
     private ServerState state = ServerState.DISCONNECTED;
44 44
     /** A history of transactions for debugging purposes. */
45
-    private RollingList<String> history = new RollingList<>(10);
45
+    private final RollingList<String> history = new RollingList<>(10);
46 46
     /** A list of known parser hashcodes. */
47 47
     private final List<Integer> parsers = new ArrayList<>();
48 48
 

+ 4
- 4
src/com/dmdirc/actions/Action.java Прегледај датотеку

@@ -425,10 +425,10 @@ public class Action extends ActionModel implements ConfigChangeListener {
425 425
      * @return True if the condition is valid, false otherwise
426 426
      */
427 427
     private boolean readCondition(final Map<String, String> data) {
428
-        int arg;
428
+        final int arg;
429 429
         ActionComponent component = null;
430
-        ActionComparison comparison;
431
-        String target;
430
+        final ActionComparison comparison;
431
+        final String target;
432 432
         String starget = null;
433 433
 
434 434
         // ------ Read the argument
@@ -502,7 +502,7 @@ public class Action extends ActionModel implements ConfigChangeListener {
502 502
      */
503 503
     private ActionComponent readComponent(final Map<String, String> data, final int arg) {
504 504
         final String componentName = data.get("component");
505
-        ActionComponent component;
505
+        final ActionComponent component;
506 506
 
507 507
         if (componentName.indexOf('.') == -1) {
508 508
             component = actionController.getComponent(componentName);

+ 1
- 1
src/com/dmdirc/actions/ActionSubstitutor.java Прегледај датотеку

@@ -243,7 +243,7 @@ public class ActionSubstitutor {
243 243
                     ? new CommandArguments(commandController, (String) args[2])
244 244
                     : new CommandArguments(commandController, Arrays.asList((String[]) args[2]));
245 245
 
246
-            int start;
246
+            final int start;
247 247
             int end;
248 248
 
249 249
             start = end = Integer.parseInt(numberMatcher.group(1)) - 1;

+ 1
- 1
src/com/dmdirc/actions/ConditionTree.java Прегледај датотеку

@@ -257,7 +257,7 @@ public final class ConditionTree {
257 257
                 final ConditionTree third = readTerm(myStack);
258 258
 
259 259
                 if (third != null && second instanceof Character) {
260
-                    OPERATION op;
260
+                    final OPERATION op;
261 261
 
262 262
                     if ((Character) second == '&') {
263 263
                         op = OPERATION.AND;

+ 2
- 2
src/com/dmdirc/actions/metatypes/ActionEvents.java Прегледај датотеку

@@ -36,9 +36,9 @@ public enum ActionEvents implements ActionMetaType {
36 36
     /** Action event type. */
37 37
     ACTION_DELETED(new String[]{"Action group", "Action name"}, ActionGroup.class, String.class);
38 38
     /** The names of the arguments for this meta type. */
39
-    private String[] argNames;
39
+    private final String[] argNames;
40 40
     /** The classes of the arguments for this meta type. */
41
-    private Class<?>[] argTypes;
41
+    private final Class<?>[] argTypes;
42 42
 
43 43
     /**
44 44
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/ChannelEvents.java Прегледај датотеку

@@ -60,9 +60,9 @@ public enum ChannelEvents implements ActionMetaType {
60 60
     CHANNEL_SOURCED_EVENT_WITH_VICTIM(new String[]{"channel", "user", "victim", "message"},
61 61
             Channel.class, ChannelClientInfo.class, ChannelClientInfo.class, String.class);
62 62
     /** The names of the arguments for this meta type. */
63
-    private String[] argNames;
63
+    private final String[] argNames;
64 64
     /** The classes of the arguments for this meta type. */
65
-    private Class<?>[] argTypes;
65
+    private final Class<?>[] argTypes;
66 66
 
67 67
     /**
68 68
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/ClientEvents.java Прегледај датотеку

@@ -65,9 +65,9 @@ public enum ClientEvents implements ActionMetaType {
65 65
     UNKNOWN_COMMAND(new String[]{"source", "command", "arguments"}, FrameContainer.class,
66 66
             String.class, String[].class);
67 67
     /** The names of the arguments for this meta type. */
68
-    private String[] argNames;
68
+    private final String[] argNames;
69 69
     /** The classes of the arguments for this meta type. */
70
-    private Class<?>[] argTypes;
70
+    private final Class<?>[] argTypes;
71 71
 
72 72
     /**
73 73
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/LinkEvents.java Прегледај датотеку

@@ -37,9 +37,9 @@ public enum LinkEvents implements ActionMetaType {
37 37
     /** Nickname link clicked. */
38 38
     NICKNAME_CLICKED(new String[]{"Window", "Nickname"}, Window.class, String.class);
39 39
     /** The names of the arguments for this meta type. */
40
-    private String[] argNames;
40
+    private final String[] argNames;
41 41
     /** The classes of the arguments for this meta type. */
42
-    private Class<?>[] argTypes;
42
+    private final Class<?>[] argTypes;
43 43
 
44 44
     /**
45 45
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/PluginEvents.java Прегледај датотеку

@@ -33,9 +33,9 @@ public enum PluginEvents implements ActionMetaType {
33 33
     /** Plugin event type. */
34 34
     PLUGIN_EVENT(new String[]{"plugin"}, PluginInfo.class);
35 35
     /** The names of the arguments for this meta type. */
36
-    private String[] argNames;
36
+    private final String[] argNames;
37 37
     /** The classes of the arguments for this meta type. */
38
-    private Class<?>[] argTypes;
38
+    private final Class<?>[] argTypes;
39 39
 
40 40
     /**
41 41
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/QueryEvents.java Прегледај датотеку

@@ -39,9 +39,9 @@ public enum QueryEvents implements ActionMetaType {
39 39
     QUERY_SOURCED_EVENT_WITH_ARG(new String[]{"query", "source", "message"}, Query.class,
40 40
             ClientInfo.class, String.class);
41 41
     /** The names of the arguments for this meta type. */
42
-    private String[] argNames;
42
+    private final String[] argNames;
43 43
     /** The classes of the arguments for this meta type. */
44
-    private Class<?>[] argTypes;
44
+    private final Class<?>[] argTypes;
45 45
 
46 46
     /**
47 47
      * Creates a new instance of this meta-type.

+ 2
- 2
src/com/dmdirc/actions/metatypes/ServerEvents.java Прегледај датотеку

@@ -56,9 +56,9 @@ public enum ServerEvents implements ActionMetaType {
56 56
     /** Server event type. */
57 57
     SERVER_EVENT(new String[]{"server"}, Connection.class);
58 58
     /** The names of the arguments for this meta type. */
59
-    private String[] argNames;
59
+    private final String[] argNames;
60 60
     /** The classes of the arguments for this meta type. */
61
-    private Class<?>[] argTypes;
61
+    private final Class<?>[] argTypes;
62 62
 
63 63
     /**
64 64
      * Creates a new instance of this meta-type.

+ 1
- 1
src/com/dmdirc/commandline/RemoteServer.java Прегледај датотеку

@@ -68,7 +68,7 @@ public class RemoteServer implements RemoteInterface {
68 68
      * Binds to the RMI registry so that other clients may find this remote server.
69 69
      */
70 70
     public void bind() {
71
-        RemoteInterface stub;
71
+        final RemoteInterface stub;
72 72
 
73 73
         try {
74 74
             stub = (RemoteInterface) UnicastRemoteObject.exportObject(this, 0);

+ 1
- 1
src/com/dmdirc/commandparser/PopupManager.java Прегледај датотеку

@@ -103,7 +103,7 @@ public class PopupManager {
103 103
      */
104 104
     private PopupMenuItem getItem(final String item,
105 105
             final PopupType type, final AggregateConfigProvider configManager) {
106
-        PopupMenuItem res;
106
+        final PopupMenuItem res;
107 107
 
108 108
         if ("-".equals(item)) {
109 109
             res = new PopupMenuItem(commandController);

+ 1
- 1
src/com/dmdirc/commandparser/commands/flags/CommandFlagHandler.java Прегледај датотеку

@@ -103,7 +103,7 @@ public class CommandFlagHandler {
103 103
         int offset;
104 104
         for (offset = 0; offset < arguments.getArguments().length; offset++) {
105 105
             final String arg = arguments.getArguments()[offset];
106
-            String name;
106
+            final String name;
107 107
 
108 108
             if (arg.startsWith("--")
109 109
                     && flags.containsKey(name = arg.substring(2).toLowerCase())) {

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/Help.java Прегледај датотеку

@@ -120,7 +120,7 @@ public class Help extends Command implements IntelligentCommand {
120 120
      */
121 121
     private void showCommand(final FrameContainer origin, final boolean isSilent,
122 122
             final String name) {
123
-        Map.Entry<CommandInfo, Command> command;
123
+        final Map.Entry<CommandInfo, Command> command;
124 124
 
125 125
         if (name.length() > 0 && name.charAt(0) == getController().getCommandChar()) {
126 126
             command = getController().getCommand(name.substring(1));

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/OpenWindow.java Прегледај датотеку

@@ -122,7 +122,7 @@ public class OpenWindow extends Command implements IntelligentCommand {
122 122
                     ? args.getArgumentsAsString(start + 1) : args.getArguments()[start];
123 123
 
124 124
             if (window == null) {
125
-                CustomWindow newWindow;
125
+                final CustomWindow newWindow;
126 126
                 if (parent == null) {
127 127
                     newWindow = new CustomWindow(args.getArguments()[start], title,
128 128
                             configProvider, urlBuilder, eventBus);

+ 2
- 2
src/com/dmdirc/config/BaseConfigProvider.java Прегледај датотеку

@@ -75,7 +75,7 @@ public abstract class BaseConfigProvider implements ReadOnlyConfigProvider {
75 75
     @Override
76 76
     public boolean hasOptionString(final String domain, final String option,
77 77
             final Validator<String> validator) {
78
-        String value;
78
+        final String value;
79 79
 
80 80
         return hasOption(domain, option, validator)
81 81
                 && !(value = getOption(domain, option, validator)).isEmpty()
@@ -101,7 +101,7 @@ public abstract class BaseConfigProvider implements ReadOnlyConfigProvider {
101 101
     public String getOptionString(final String domain, final String option,
102 102
             final boolean required, final Validator<String> validator,
103 103
             final String... fallbacks) {
104
-        String value;
104
+        final String value;
105 105
 
106 106
         final Validator<String> newValidator = required && fallbacks.length == 0
107 107
                 ? ValidatorChain.<String>builder().addValidator(

+ 1
- 1
src/com/dmdirc/config/ConfigFileBackedConfigProvider.java Прегледај датотеку

@@ -313,7 +313,7 @@ public class ConfigFileBackedConfigProvider extends BaseConfigProvider implement
313 313
     @Override
314 314
     public void setOption(final String domain, final String option,
315 315
             final String value) {
316
-        String oldValue;
316
+        final String oldValue;
317 317
         boolean unset = false;
318 318
 
319 319
         synchronized (this) {

+ 1
- 1
src/com/dmdirc/config/ConfigManager.java Прегледај датотеку

@@ -246,7 +246,7 @@ class ConfigManager extends BaseConfigProvider implements ConfigChangeListener,
246 246
      * @return True if the identity applies, false otherwise
247 247
      */
248 248
     public boolean identityApplies(final ConfigProvider identity) {
249
-        String comp;
249
+        final String comp;
250 250
 
251 251
         switch (identity.getTarget().getType()) {
252 252
             case PROTOCOL:

+ 1
- 1
src/com/dmdirc/config/IdentityManager.java Прегледај датотеку

@@ -690,7 +690,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
690 690
      * @param configManager The manager to be initialised.
691 691
      */
692 692
     private void setUpConfigManager(final ConfigManager configManager) {
693
-        List<ConfigProvider> sources = getIdentitiesForManager(configManager);
693
+        final List<ConfigProvider> sources = getIdentitiesForManager(configManager);
694 694
 
695 695
         for (ConfigProvider identity : sources) {
696 696
             log.trace("Found {}", identity);

+ 1
- 1
src/com/dmdirc/events/ChannelDisplayableUserEvent.java Прегледај датотеку

@@ -51,7 +51,7 @@ public abstract class ChannelDisplayableUserEvent extends ChannelUserEvent imple
51 51
     }
52 52
 
53 53
     @Override
54
-    public void setDisplayFormat(String format) {
54
+    public void setDisplayFormat(final String format) {
55 55
         this.displayFormatRef.set(format);
56 56
     }
57 57
 

+ 1
- 1
src/com/dmdirc/events/PluginEvent.java Прегледај датотеку

@@ -29,7 +29,7 @@ import com.dmdirc.plugins.PluginInfo;
29 29
  */
30 30
 public abstract class PluginEvent extends DMDircEvent {
31 31
 
32
-    private PluginInfo plugin;
32
+    private final PluginInfo plugin;
33 33
 
34 34
     public PluginEvent(final PluginInfo plugin) {
35 35
         this.plugin = plugin;

+ 2
- 2
src/com/dmdirc/logger/ErrorLevel.java Прегледај датотеку

@@ -36,9 +36,9 @@ public enum ErrorLevel {
36 36
     /** Unknown priority error. */
37 37
     UNKNOWN("Unknown", "info");
38 38
     /** Error level string. */
39
-    private String value;
39
+    private final String value;
40 40
     /** Error level icon. */
41
-    private String icon;
41
+    private final String icon;
42 42
 
43 43
     /**
44 44
      * Instantiates the enum.

+ 1
- 1
src/com/dmdirc/logger/ErrorManager.java Прегледај датотеку

@@ -247,7 +247,7 @@ public class ErrorManager implements ConfigChangeListener {
247 247
      * @return True if a duplicate error has already been registered, false otherwise
248 248
      */
249 249
     protected boolean addError(final ProgramError error) {
250
-        int index;
250
+        final int index;
251 251
 
252 252
         synchronized (errors) {
253 253
             index = errors.indexOf(error);

+ 2
- 2
src/com/dmdirc/plugins/PluginClassLoader.java Прегледај датотеку

@@ -117,7 +117,7 @@ public class PluginClassLoader extends ClassLoader {
117 117
             }
118 118
         }
119 119
 
120
-        ResourceManager res;
120
+        final ResourceManager res;
121 121
         try {
122 122
             res = pluginInfo.getResourceManager();
123 123
         } catch (IOException ioe) {
@@ -151,7 +151,7 @@ public class PluginClassLoader extends ClassLoader {
151 151
         }
152 152
 
153 153
         // We are meant to be loading this one!
154
-        byte[] data;
154
+        final byte[] data;
155 155
         if (res.resourceExists(fileName)) {
156 156
             data = res.getResourceBytes(fileName);
157 157
         } else {

+ 3
- 3
src/com/dmdirc/plugins/PluginInfo.java Прегледај датотеку

@@ -121,7 +121,7 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
121 121
         this.filename = new File(metadata.getPluginUrl().getPath()).getName();
122 122
         this.metaData = metadata;
123 123
 
124
-        ResourceManager res;
124
+        final ResourceManager res;
125 125
 
126 126
         try {
127 127
             res = getResourceManager();
@@ -222,8 +222,8 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
222 222
         if (metaData.getParent() != null) {
223 223
             final PluginInfo parentInfo = metaData.getManager()
224 224
                     .getPluginInfoByName(metaData.getParent());
225
-            Plugin parent = parentInfo.getPlugin();
226
-            ObjectGraph parentGraph = parent.getObjectGraph();
225
+            final Plugin parent = parentInfo.getPlugin();
226
+            final ObjectGraph parentGraph = parent.getObjectGraph();
227 227
             if (parentGraph != null) {
228 228
                 return parentGraph;
229 229
             }

+ 1
- 1
src/com/dmdirc/plugins/PluginMetaData.java Прегледај датотеку

@@ -111,7 +111,7 @@ public class PluginMetaData {
111 111
     /** The URL to load the metadata from. */
112 112
     private final URL url;
113 113
     /** The parent plugin manager. */
114
-    private PluginManager manager;
114
+    private final PluginManager manager;
115 115
 
116 116
     /**
117 117
      * Creates a new meta data reader for a config file at the specified URL.

+ 1
- 1
src/com/dmdirc/ui/input/AdditionalTabTargets.java Прегледај датотеку

@@ -35,7 +35,7 @@ public final class AdditionalTabTargets extends ArrayList<String> {
35 35
     /** A version number for this class. */
36 36
     private static final long serialVersionUID = 1;
37 37
     /** Whether to include normal targets. */
38
-    private List<TabCompletionType> includes = new ArrayList<>(Arrays.asList(TabCompletionType.
38
+    private final List<TabCompletionType> includes = new ArrayList<>(Arrays.asList(TabCompletionType.
39 39
             values()));
40 40
 
41 41
     /**

+ 2
- 2
src/com/dmdirc/ui/messages/ColourManager.java Прегледај датотеку

@@ -49,7 +49,7 @@ public class ColourManager {
49 49
     /** Config manager to read settings from. */
50 50
     private final AggregateConfigProvider configManager;
51 51
     /** Actual colours we're using for the 16 IRC colours. */
52
-    private Colour[] ircColours = DEFAULT_COLOURS.clone();
52
+    private final Colour[] ircColours = DEFAULT_COLOURS.clone();
53 53
 
54 54
     /**
55 55
      * Creates a new instance of {@link ColourManager}.
@@ -149,7 +149,7 @@ public class ColourManager {
149 149
             return Colour.WHITE;
150 150
         }
151 151
 
152
-        Colour colour;
152
+        final Colour colour;
153 153
         try {
154 154
             colour = new Colour(
155 155
                     Integer.parseInt(hex.substring(0, 2), 16),

+ 2
- 2
src/com/dmdirc/util/URIParser.java Прегледај датотеку

@@ -70,7 +70,7 @@ public class URIParser {
70 70
         final String authority;
71 71
         final String host;
72 72
         final String portString;
73
-        int port;
73
+        final int port;
74 74
         final String path;
75 75
         final String query;
76 76
         final String fragment;
@@ -133,7 +133,7 @@ public class URIParser {
133 133
         }
134 134
 
135 135
         boolean ssl = false;
136
-        String host;
136
+        final String host;
137 137
         String pass = null;
138 138
         int port = -1;
139 139
 

+ 1
- 1
src/com/dmdirc/util/resourcemanager/DMDircResourceManager.java Прегледај датотеку

@@ -53,7 +53,7 @@ public final class DMDircResourceManager {
53 53
         final CodeSource codeSource = Main.class.getProtectionDomain().getCodeSource();
54 54
         try {
55 55
             final File jarFile = new File(codeSource.getLocation().toURI().getPath());
56
-            String jarDir;
56
+            final String jarDir;
57 57
             if (isRunningFromJar()) {
58 58
                 jarDir = jarFile.getParentFile().getPath();
59 59
             } else {

+ 1
- 1
src/com/dmdirc/util/resourcemanager/ResourceManager.java Прегледај датотеку

@@ -132,7 +132,7 @@ public abstract class ResourceManager {
132 132
             return false;
133 133
         }
134 134
 
135
-        File newDir;
135
+        final File newDir;
136 136
 
137 137
         if (usePath && resourceName.indexOf('/') > -1) {
138 138
             newDir = new File(directory,

Loading…
Откажи
Сачувај