소스 검색

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 년 전
부모
커밋
25e7564521

+ 4
- 2
src/com/dmdirc/commandparser/commands/Command.java 파일 보기

@@ -28,6 +28,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
28 28
 import com.dmdirc.interfaces.CommandController;
29 29
 import com.dmdirc.ui.messages.Styliser;
30 30
 
31
+import javax.annotation.Nonnull;
32
+
31 33
 /**
32 34
  * Represents a generic command.
33 35
  */
@@ -141,7 +143,7 @@ public abstract class Command {
141 143
      *
142 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 파일 보기

@@ -100,7 +100,7 @@ public class Ifplugin extends Command implements IntelligentCommand {
100 100
         }
101 101
 
102 102
         if (result != negative) {
103
-            if (origin == null || !origin.isWritable()) {
103
+            if (!origin.isWritable()) {
104 104
                 globalCommandParserProvider.get()
105 105
                         .parseCommand(globalWindowProvider.get(), args.getArgumentsAsString(1));
106 106
             } else {

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ChannelCommandParser.java 파일 보기

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

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ChatCommandParser.java 파일 보기

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

+ 2
- 1
src/com/dmdirc/commandparser/parsers/CommandParser.java 파일 보기

@@ -309,7 +309,8 @@ public abstract class CommandParser implements Serializable {
309 309
      * @param args        The arguments to the command
310 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 314
             final CommandInfo commandInfo, final Command command,
314 315
             final CommandArguments args, final CommandContext context);
315 316
 

+ 2
- 1
src/com/dmdirc/commandparser/parsers/GlobalCommandParser.java 파일 보기

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

+ 3
- 1
src/com/dmdirc/commandparser/parsers/QueryCommandParser.java 파일 보기

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

+ 3
- 1
src/com/dmdirc/commandparser/parsers/ServerCommandParser.java 파일 보기

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

Loading…
취소
저장