From 0739717a7f3899e49c2f4eb52deb2d8c843899cf Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Sun, 8 Nov 2015 23:15:55 +0100 Subject: [PATCH] Remove closure-execution from OptionHandler It seems that the code for executing a groovy closure from the OptionHandler is never executed and therefore not needed. Removing the code gives the benefit that the Groovy-classes are not needed if someone else wants to use the spring-boot-cli infrastructure to run his own cli interface. Closes gh-4411 --- .../cli/command/options/OptionHandler.java | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index 6911c94190..42cc049f02 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -29,7 +29,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; -import groovy.lang.Closure; import joptsimple.BuiltinHelpFormatter; import joptsimple.HelpFormatter; import joptsimple.OptionDescriptor; @@ -51,8 +50,6 @@ public class OptionHandler { private OptionParser parser; - private Closure closure; - private String help; private Collection optionHelp; @@ -76,10 +73,6 @@ public class OptionHandler { protected void options() { } - public void setClosure(Closure closure) { - this.closure = closure; - } - public final ExitStatus run(String... args) throws Exception { String[] argsToUse = args.clone(); for (int i = 0; i < argsToUse.length; i++) { @@ -98,18 +91,6 @@ public class OptionHandler { * @throws Exception in case of errors */ protected ExitStatus run(OptionSet options) throws Exception { - if (this.closure != null) { - Object result = this.closure.call(options); - if (result instanceof ExitStatus) { - return (ExitStatus) result; - } - if (result instanceof Boolean) { - return (Boolean) result ? ExitStatus.OK : ExitStatus.ERROR; - } - if (result instanceof Integer) { - return new ExitStatus((Integer) result, "Finished"); - } - } return ExitStatus.OK; }