Browse Source

Commands must have non-null origins too.

Change-Id: Iea8cc21d45ec063a2d184902a838224727fdcb49
Reviewed-on: http://gerrit.dmdirc.com/3453
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
pull/1/head
Chris Smith 10 years ago
parent
commit
25e7564521

+ 4
- 2
src/com/dmdirc/commandparser/commands/Command.java View File

28
 import com.dmdirc.interfaces.CommandController;
28
 import com.dmdirc.interfaces.CommandController;
29
 import com.dmdirc.ui.messages.Styliser;
29
 import com.dmdirc.ui.messages.Styliser;
30
 
30
 
31
+import javax.annotation.Nonnull;
32
+
31
 /**
33
 /**
32
  * Represents a generic command.
34
  * Represents a generic command.
33
  */
35
  */
141
      *
143
      *
142
      * @since 0.6.4
144
      * @since 0.6.4
143
      */
145
      */
144
-    public abstract void execute(FrameContainer origin,
145
-            CommandArguments args, CommandContext context);
146
+    public abstract void execute(@Nonnull FrameContainer origin, CommandArguments args,
147
+            CommandContext context);
146
 
148
 
147
 }
149
 }

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/Ifplugin.java View File

100
         }
100
         }
101
 
101
 
102
         if (result != negative) {
102
         if (result != negative) {
103
-            if (origin == null || !origin.isWritable()) {
103
+            if (!origin.isWritable()) {
104
                 globalCommandParserProvider.get()
104
                 globalCommandParserProvider.get()
105
                         .parseCommand(globalWindowProvider.get(), args.getArgumentsAsString(1));
105
                         .parseCommand(globalWindowProvider.get(), args.getArgumentsAsString(1));
106
             } else {
106
             } else {

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ChannelCommandParser.java View File

33
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
 
35
 
36
+import javax.annotation.Nonnull;
37
+
36
 /**
38
 /**
37
  * A command parser that is tailored for use in a channel environment.
39
  * A command parser that is tailored for use in a channel environment.
38
  */
40
  */
81
 
83
 
82
     @Override
84
     @Override
83
     protected void executeCommand(
85
     protected void executeCommand(
84
-            final FrameContainer origin,
86
+            @Nonnull final FrameContainer origin,
85
             final CommandInfo commandInfo,
87
             final CommandInfo commandInfo,
86
             final Command command,
88
             final Command command,
87
             final CommandArguments args,
89
             final CommandArguments args,

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ChatCommandParser.java View File

33
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
 
35
 
36
+import javax.annotation.Nonnull;
37
+
36
 /**
38
 /**
37
  * A command parser which implements common functionality for chat windows (queries and channels).
39
  * A command parser which implements common functionality for chat windows (queries and channels).
38
  *
40
  *
74
 
76
 
75
     @Override
77
     @Override
76
     protected void executeCommand(
78
     protected void executeCommand(
77
-            final FrameContainer origin,
79
+            @Nonnull final FrameContainer origin,
78
             final CommandInfo commandInfo,
80
             final CommandInfo commandInfo,
79
             final Command command,
81
             final Command command,
80
             final CommandArguments args,
82
             final CommandArguments args,

+ 2
- 1
src/com/dmdirc/commandparser/parsers/CommandParser.java View File

309
      * @param args        The arguments to the command
309
      * @param args        The arguments to the command
310
      * @param context     The context to use when executing the command
310
      * @param context     The context to use when executing the command
311
      */
311
      */
312
-    protected abstract void executeCommand(final FrameContainer origin,
312
+    protected abstract void executeCommand(
313
+            @Nonnull final FrameContainer origin,
313
             final CommandInfo commandInfo, final Command command,
314
             final CommandInfo commandInfo, final Command command,
314
             final CommandArguments args, final CommandContext context);
315
             final CommandArguments args, final CommandContext context);
315
 
316
 

+ 2
- 1
src/com/dmdirc/commandparser/parsers/GlobalCommandParser.java View File

34
 import com.dmdirc.logger.ErrorLevel;
34
 import com.dmdirc.logger.ErrorLevel;
35
 import com.dmdirc.logger.Logger;
35
 import com.dmdirc.logger.Logger;
36
 
36
 
37
+import javax.annotation.Nonnull;
37
 import javax.inject.Inject;
38
 import javax.inject.Inject;
38
 import javax.inject.Singleton;
39
 import javax.inject.Singleton;
39
 
40
 
81
 
82
 
82
     @Override
83
     @Override
83
     protected void executeCommand(
84
     protected void executeCommand(
84
-            final FrameContainer origin,
85
+            @Nonnull final FrameContainer origin,
85
             final CommandInfo commandInfo,
86
             final CommandInfo commandInfo,
86
             final Command command,
87
             final Command command,
87
             final CommandArguments args,
88
             final CommandArguments args,

+ 3
- 1
src/com/dmdirc/commandparser/parsers/QueryCommandParser.java View File

33
 import com.dmdirc.commandparser.commands.context.QueryCommandContext;
33
 import com.dmdirc.commandparser.commands.context.QueryCommandContext;
34
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
 
35
 
36
+import javax.annotation.Nonnull;
37
+
36
 /**
38
 /**
37
  * A command parser that is tailored for use in a query environment. Handles both query and server
39
  * A command parser that is tailored for use in a query environment. Handles both query and server
38
  * commands.
40
  * commands.
83
 
85
 
84
     @Override
86
     @Override
85
     protected void executeCommand(
87
     protected void executeCommand(
86
-            final FrameContainer origin,
88
+            @Nonnull final FrameContainer origin,
87
             final CommandInfo commandInfo,
89
             final CommandInfo commandInfo,
88
             final Command command,
90
             final Command command,
89
             final CommandArguments args,
91
             final CommandArguments args,

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ServerCommandParser.java View File

34
 import com.dmdirc.interfaces.CommandController;
34
 import com.dmdirc.interfaces.CommandController;
35
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
35
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
36
 
36
 
37
+import javax.annotation.Nonnull;
38
+
37
 /**
39
 /**
38
  * A command parser used in the context of a server.
40
  * A command parser used in the context of a server.
39
  */
41
  */
84
 
86
 
85
     @Override
87
     @Override
86
     protected void executeCommand(
88
     protected void executeCommand(
87
-            final FrameContainer origin,
89
+            @Nonnull final FrameContainer origin,
88
             final CommandInfo commandInfo,
90
             final CommandInfo commandInfo,
89
             final Command command,
91
             final Command command,
90
             final CommandArguments args,
92
             final CommandArguments args,

Loading…
Cancel
Save