From 2336d44ffc4bb52a13d6ee68af224252adb81efc Mon Sep 17 00:00:00 2001 From: Hai Brenner Date: Mon, 4 Jul 2016 16:04:04 +0300 Subject: [PATCH] reduced more compilation warnings by having better Generics type handling and better JavaDocs --- .../selector/SimpleListCategoriesSelector.java | 2 +- .../java/meerkat/voting/ui/SystemConsoleUI.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/voting-booth/src/main/java/meerkat/voting/controller/selector/SimpleListCategoriesSelector.java b/voting-booth/src/main/java/meerkat/voting/controller/selector/SimpleListCategoriesSelector.java index b39fede..6b8f78b 100644 --- a/voting-booth/src/main/java/meerkat/voting/controller/selector/SimpleListCategoriesSelector.java +++ b/voting-booth/src/main/java/meerkat/voting/controller/selector/SimpleListCategoriesSelector.java @@ -133,7 +133,7 @@ public class SimpleListCategoriesSelector implements QuestionSelector { /** * Verifies that the ballot answer is of length 1. (We do not yet handle multi-choice questions in the channel choice round). * Otherwise, throws an exception. - * @param ballotAnswer + * @param ballotAnswer the answer to verify whose length is one * @param questionNumber the number of the question (needed only for error message strings) */ private void assertAnswerLengthIsOne (BallotAnswer ballotAnswer, int questionNumber) { diff --git a/voting-booth/src/main/java/meerkat/voting/ui/SystemConsoleUI.java b/voting-booth/src/main/java/meerkat/voting/ui/SystemConsoleUI.java index c4f0e83..e35c527 100644 --- a/voting-booth/src/main/java/meerkat/voting/ui/SystemConsoleUI.java +++ b/voting-booth/src/main/java/meerkat/voting/ui/SystemConsoleUI.java @@ -124,7 +124,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { @Override public void startNewVoterSession(FutureCallback callback) { logger.debug("UI interface call to startNewVoterSession"); - queue.add(new StartSessionUICommand((ControllerCallback)callback)); + queue.add(new StartSessionUICommand((NewVoterCallback)callback)); } /** @@ -135,8 +135,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { logger.debug("UI entered doShowWelcomeScreen"); System.out.println("Welcome, new voter!"); waitForEnter(null); - ControllerCallback callback = command.getCallback(); - assert (callback instanceof NewVoterCallback); + ControllerCallback callback = command.getCallback(); callback.onSuccess(null); } @@ -179,7 +178,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { @Override public void chooseChannel(List questions, FutureCallback> callback) { logger.debug("UI interface call to chooseChannel"); - ChannelChoiceUICommand command = new ChannelChoiceUICommand(questions, (ControllerCallback)callback); + ChannelChoiceUICommand command = new ChannelChoiceUICommand(questions, (ChannelChoiceCallback)callback); queue.add(command); } @@ -213,7 +212,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { @Override public void askVoterQuestions(List questions, FutureCallback> callback) { logger.debug("UI interface call to chooseChannel"); - queue.add(new RaceVotingUICommand(questions, (ControllerCallback)callback)); + queue.add(new RaceVotingUICommand(questions, (VotingCallback)callback)); } /** @@ -245,7 +244,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { @Override public void castOrAudit(FutureCallback callback) { logger.debug("UI interface call to castOrAudit"); - queue.add(new CastOrAuditUICommand((ControllerCallback)callback)); + queue.add(new CastOrAuditUICommand((CastOrAuditCallback)callback)); } /** @@ -289,7 +288,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { @Override public void notifyVoterToWaitForFinish(UIElement message, FutureCallback callback) { logger.debug("UI interface call to notifyVoterToWaitForFinish"); - queue.add(new WaitForFinishUICommand(message, (ControllerCallback)callback)); + queue.add(new WaitForFinishUICommand(message, (WaitForFinishCallback)callback)); } /** @@ -333,7 +332,7 @@ public class SystemConsoleUI implements VotingBoothUI, Runnable { public void showErrorMessageWithButtons(UIElement errorMessage, UIElement[] buttonLabels, FutureCallback callback) { logger.debug("UI interface call to showErrorMessageWithButtons"); queue.clear(); - queue.add(new FatalErrorUICommand(errorMessage, buttonLabels, (ControllerCallback)callback)); + queue.add(new FatalErrorUICommand(errorMessage, buttonLabels, (ControllerCallback)callback)); } /**