Merge changes from topic "auto-annotations"
* changes:
ConfigAnnotationParser: Use AutoAnnotation to construct GerritConfig
Replace ApproveOption with AutoAnnotation
Move newOption method to a new public class
CmdLineParser: Replace HelpOption with AutoAnnotation
CmdLineParser: Replace PrefixedOption with AutoAnnotation
Implement @Export with AutoAnnotation
diff --git a/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java b/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java
index 0aa56cf..0a1d765 100644
--- a/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java
+++ b/java/com/google/gerrit/acceptance/ConfigAnnotationParser.java
@@ -14,10 +14,10 @@
package com.google.gerrit.acceptance;
+import com.google.auto.value.AutoAnnotation;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
-import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -45,32 +45,13 @@
return cfg;
}
- static class GlobalPluginConfigToGerritConfig implements GerritConfig {
- private final GlobalPluginConfig delegate;
+ private static GerritConfig toGerritConfig(GlobalPluginConfig annotation) {
+ return newGerritConfig(annotation.name(), annotation.value(), annotation.values());
+ }
- GlobalPluginConfigToGerritConfig(GlobalPluginConfig delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return delegate.annotationType();
- }
-
- @Override
- public String name() {
- return delegate.name();
- }
-
- @Override
- public String value() {
- return delegate.value();
- }
-
- @Override
- public String[] values() {
- return delegate.values();
- }
+ @AutoAnnotation
+ private static GerritConfig newGerritConfig(String name, String value, String[] values) {
+ return new AutoAnnotation_ConfigAnnotationParser_newGerritConfig(name, value, values);
}
static Map<String, Config> parse(GlobalPluginConfig annotation) {
@@ -79,7 +60,7 @@
}
Map<String, Config> result = new HashMap<>();
Config cfg = new Config();
- parseAnnotation(cfg, new GlobalPluginConfigToGerritConfig(annotation));
+ parseAnnotation(cfg, toGerritConfig(annotation));
result.put(annotation.pluginName(), cfg);
return result;
}
@@ -100,7 +81,7 @@
config = new Config();
result.put(pluginName, config);
}
- parseAnnotation(config, new GlobalPluginConfigToGerritConfig(c));
+ parseAnnotation(config, toGerritConfig(c));
}
return result;
diff --git a/java/com/google/gerrit/extensions/BUILD b/java/com/google/gerrit/extensions/BUILD
index 797c656..b69d2c8 100644
--- a/java/com/google/gerrit/extensions/BUILD
+++ b/java/com/google/gerrit/extensions/BUILD
@@ -30,6 +30,7 @@
deps = [
"//java/com/google/gerrit/common:annotations",
"//lib:guava",
+ "//lib/auto:auto-value-annotations",
"//lib/guice",
"//lib/guice:guice-assistedinject",
],
diff --git a/java/com/google/gerrit/extensions/annotations/ExportImpl.java b/java/com/google/gerrit/extensions/annotations/ExportImpl.java
deleted file mode 100644
index a3e72bc..0000000
--- a/java/com/google/gerrit/extensions/annotations/ExportImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2012 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.extensions.annotations;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-
-final class ExportImpl implements Export, Serializable {
- private static final long serialVersionUID = 0;
- private final String value;
-
- ExportImpl(String value) {
- this.value = value;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return Export.class;
- }
-
- @Override
- public String value() {
- return value;
- }
-
- @Override
- public int hashCode() {
- return (127 * "value".hashCode()) ^ value.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- return o instanceof Export && value.equals(((Export) o).value());
- }
-
- @Override
- public String toString() {
- return "@" + Export.class.getName() + "(value=" + value + ")";
- }
-}
diff --git a/java/com/google/gerrit/extensions/annotations/Exports.java b/java/com/google/gerrit/extensions/annotations/Exports.java
index 1295ea0..9b196b6 100644
--- a/java/com/google/gerrit/extensions/annotations/Exports.java
+++ b/java/com/google/gerrit/extensions/annotations/Exports.java
@@ -14,11 +14,14 @@
package com.google.gerrit.extensions.annotations;
+import com.google.auto.value.AutoAnnotation;
+
/** Static constructors for {@link Export} annotations. */
public final class Exports {
/** Create an annotation to export under a specific name. */
- public static Export named(String name) {
- return new ExportImpl(name);
+ @AutoAnnotation
+ public static Export named(String value) {
+ return new AutoAnnotation_Exports_named(value);
}
/** Create an annotation to export based on a cannonical class name. */
diff --git a/java/com/google/gerrit/sshd/commands/ApproveOption.java b/java/com/google/gerrit/sshd/commands/ApproveOption.java
deleted file mode 100644
index cda340d..0000000
--- a/java/com/google/gerrit/sshd/commands/ApproveOption.java
+++ /dev/null
@@ -1,170 +0,0 @@
-// Copyright (C) 2009 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.sshd.commands;
-
-import static com.google.gerrit.util.cli.Localizable.localizable;
-
-import com.google.gerrit.common.data.LabelType;
-import com.google.gerrit.common.data.LabelValue;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.CmdLineParser;
-import org.kohsuke.args4j.Option;
-import org.kohsuke.args4j.OptionDef;
-import org.kohsuke.args4j.spi.FieldSetter;
-import org.kohsuke.args4j.spi.OneArgumentOptionHandler;
-import org.kohsuke.args4j.spi.OptionHandler;
-import org.kohsuke.args4j.spi.Setter;
-
-final class ApproveOption implements Option, Setter<Short> {
- private final String name;
- private final String usage;
- private final LabelType type;
-
- private Short value;
-
- ApproveOption(String name, String usage, LabelType type) {
- this.name = name;
- this.usage = usage;
- this.type = type;
- }
-
- @Override
- public String[] aliases() {
- return new String[0];
- }
-
- @Override
- public String[] depends() {
- return new String[] {};
- }
-
- @Override
- public boolean hidden() {
- return false;
- }
-
- @Override
- public Class<? extends OptionHandler<Short>> handler() {
- return Handler.class;
- }
-
- @Override
- public String metaVar() {
- return "N";
- }
-
- @Override
- public String name() {
- return name;
- }
-
- @Override
- public boolean required() {
- return false;
- }
-
- @Override
- public String usage() {
- return usage;
- }
-
- public Short value() {
- return value;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return null;
- }
-
- @Override
- public FieldSetter asFieldSetter() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public AnnotatedElement asAnnotatedElement() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void addValue(Short val) {
- this.value = val;
- }
-
- @Override
- public Class<Short> getType() {
- return Short.class;
- }
-
- @Override
- public boolean isMultiValued() {
- return false;
- }
-
- @Override
- public String[] forbids() {
- return null;
- }
-
- @Override
- public boolean help() {
- return false;
- }
-
- String getLabelName() {
- return type.getName();
- }
-
- public static class Handler extends OneArgumentOptionHandler<Short> {
- private final ApproveOption cmdOption;
-
- // CS IGNORE RedundantModifier FOR NEXT 1 LINES. REASON: needed by org.kohsuke.args4j.Option
- public Handler(CmdLineParser parser, OptionDef option, Setter<Short> setter) {
- super(parser, option, setter);
- this.cmdOption = (ApproveOption) setter;
- }
-
- @Override
- protected Short parse(String token) throws NumberFormatException, CmdLineException {
- String argument = token;
- if (argument.startsWith("+")) {
- argument = argument.substring(1);
- }
-
- final short value = Short.parseShort(argument);
- final LabelValue min = cmdOption.type.getMin();
- final LabelValue max = cmdOption.type.getMax();
-
- if (value < min.getValue() || value > max.getValue()) {
- final String name = cmdOption.name();
- final String e =
- "\""
- + token
- + "\" must be in range "
- + min.formatValue()
- + ".."
- + max.formatValue()
- + " for \""
- + name
- + "\"";
- throw new CmdLineException(owner, localizable(e));
- }
- return value;
- }
- }
-}
diff --git a/java/com/google/gerrit/sshd/commands/ReviewCommand.java b/java/com/google/gerrit/sshd/commands/ReviewCommand.java
index fa2d894..0861540 100644
--- a/java/com/google/gerrit/sshd/commands/ReviewCommand.java
+++ b/java/com/google/gerrit/sshd/commands/ReviewCommand.java
@@ -14,7 +14,9 @@
package com.google.gerrit.sshd.commands;
+import static com.google.gerrit.util.cli.Localizable.localizable;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.util.Objects.requireNonNull;
import com.google.common.base.Strings;
import com.google.common.flogger.FluentLogger;
@@ -40,20 +42,27 @@
import com.google.gerrit.sshd.CommandMetaData;
import com.google.gerrit.sshd.SshCommand;
import com.google.gerrit.util.cli.CmdLineParser;
+import com.google.gerrit.util.cli.OptionUtil;
import com.google.gson.JsonSyntaxException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.util.ArrayList;
+import java.lang.reflect.AnnotatedElement;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
+import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.spi.FieldSetter;
+import org.kohsuke.args4j.spi.OneArgumentOptionHandler;
+import org.kohsuke.args4j.spi.Setter;
@CommandMetaData(name = "review", description = "Apply reviews to one or more patch sets")
public class ReviewCommand extends SshCommand {
@@ -61,10 +70,8 @@
@Override
protected final CmdLineParser newCmdLineParser(Object options) {
- final CmdLineParser parser = super.newCmdLineParser(options);
- for (ApproveOption c : optionList) {
- parser.addOption(c, c);
- }
+ CmdLineParser parser = super.newCmdLineParser(options);
+ optionMap.forEach((o, s) -> parser.addOption(s, o));
return parser;
}
@@ -154,7 +161,7 @@
@Inject private PatchSetParser psParser;
- private List<ApproveOption> optionList;
+ private Map<Option, LabelSetter> optionMap;
private Map<String, Short> customLabels;
@Override
@@ -257,11 +264,8 @@
review.notify = notify;
review.labels = new TreeMap<>();
review.drafts = ReviewInput.DraftHandling.PUBLISH;
- for (ApproveOption ao : optionList) {
- Short v = ao.value();
- if (v != null) {
- review.labels.put(ao.getLabelName(), v);
- }
+ for (LabelSetter setter : optionMap.values()) {
+ setter.getValue().ifPresent(v -> review.labels.put(setter.getLabelName(), v));
}
review.labels.putAll(customLabels);
@@ -315,7 +319,7 @@
@Override
protected void parseCommandLine() throws UnloggedFailure {
- optionList = new ArrayList<>();
+ optionMap = new LinkedHashMap<>();
customLabels = new HashMap<>();
ProjectState allProjectsState;
@@ -332,10 +336,111 @@
usage.append(v.format()).append("\n");
}
- final String name = "--" + type.getName().toLowerCase();
- optionList.add(new ApproveOption(name, usage.toString(), type));
+ optionMap.put(newApproveOption(type, usage.toString()), new LabelSetter(type));
}
super.parseCommandLine();
}
+
+ private static String asOptionName(LabelType type) {
+ return "--" + type.getName().toLowerCase();
+ }
+
+ private static Option newApproveOption(LabelType type, String usage) {
+ return OptionUtil.newOption(
+ asOptionName(type),
+ new String[0],
+ usage,
+ "N",
+ false,
+ false,
+ false,
+ LabelHandler.class,
+ new String[0],
+ new String[0]);
+ }
+
+ private static class LabelSetter implements Setter<Short> {
+ private final LabelType type;
+ private Optional<Short> value;
+
+ LabelSetter(LabelType type) {
+ this.type = requireNonNull(type);
+ this.value = Optional.empty();
+ }
+
+ Optional<Short> getValue() {
+ return value;
+ }
+
+ LabelType getLabelType() {
+ return type;
+ }
+
+ String getLabelName() {
+ return type.getName();
+ }
+
+ @Override
+ public void addValue(Short value) {
+ this.value = Optional.of(value);
+ }
+
+ @Override
+ public Class<Short> getType() {
+ return Short.class;
+ }
+
+ @Override
+ public boolean isMultiValued() {
+ return false;
+ }
+
+ @Override
+ public FieldSetter asFieldSetter() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public AnnotatedElement asAnnotatedElement() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public static class LabelHandler extends OneArgumentOptionHandler<Short> {
+ private final LabelType type;
+
+ public LabelHandler(
+ org.kohsuke.args4j.CmdLineParser parser, OptionDef option, Setter<Short> setter) {
+ super(parser, option, setter);
+ this.type = ((LabelSetter) setter).getLabelType();
+ }
+
+ @Override
+ protected Short parse(String token) throws NumberFormatException, CmdLineException {
+ String argument = token;
+ if (argument.startsWith("+")) {
+ argument = argument.substring(1);
+ }
+
+ short value = Short.parseShort(argument);
+ LabelValue min = type.getMin();
+ LabelValue max = type.getMax();
+
+ if (value < min.getValue() || value > max.getValue()) {
+ String e =
+ "\""
+ + token
+ + "\" must be in range "
+ + min.formatValue()
+ + ".."
+ + max.formatValue()
+ + " for \""
+ + asOptionName(type)
+ + "\"";
+ throw new CmdLineException(owner, localizable(e));
+ }
+ return value;
+ }
+ }
}
diff --git a/java/com/google/gerrit/util/cli/BUILD b/java/com/google/gerrit/util/cli/BUILD
index c94fc1d..b9b9bba 100644
--- a/java/com/google/gerrit/util/cli/BUILD
+++ b/java/com/google/gerrit/util/cli/BUILD
@@ -7,6 +7,7 @@
"//java/com/google/gerrit/common:server",
"//lib:args4j",
"//lib:guava",
+ "//lib/auto:auto-value-annotations",
"//lib/flogger:api",
"//lib/guice",
"//lib/guice:guice-assistedinject",
diff --git a/java/com/google/gerrit/util/cli/CmdLineParser.java b/java/com/google/gerrit/util/cli/CmdLineParser.java
index 771451f..1c16133 100644
--- a/java/com/google/gerrit/util/cli/CmdLineParser.java
+++ b/java/com/google/gerrit/util/cli/CmdLineParser.java
@@ -36,6 +36,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.gerrit.util.cli.Localizable.localizable;
+import static java.util.Objects.requireNonNull;
import com.google.common.base.Strings;
import com.google.common.collect.ListMultimap;
@@ -46,8 +47,6 @@
import com.google.inject.assistedinject.Assisted;
import java.io.StringWriter;
import java.io.Writer;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -69,7 +68,6 @@
import org.kohsuke.args4j.ParserProperties;
import org.kohsuke.args4j.spi.BooleanOptionHandler;
import org.kohsuke.args4j.spi.EnumOptionHandler;
-import org.kohsuke.args4j.spi.FieldSetter;
import org.kohsuke.args4j.spi.MethodSetter;
import org.kohsuke.args4j.spi.OptionHandler;
import org.kohsuke.args4j.spi.Setter;
@@ -287,7 +285,7 @@
}
public boolean wasHelpRequestedByOption() {
- return parser.help.value;
+ return parser.help;
}
public void parseArgument(String... args) throws CmdLineException {
@@ -421,87 +419,30 @@
throw new CmdLineException(parser, localizable("invalid boolean \"%s=%s\""), name, value);
}
- private static class PrefixedOption implements Option {
- private final String prefix;
- private final Option o;
-
- PrefixedOption(String prefix, Option o) {
- this.prefix = prefix;
- checkArgument(o.name().startsWith("-"), "Option name must start with '-': %s", o);
- this.o = o;
- }
-
- @Override
- public String name() {
- return getPrefixedName(prefix, o.name());
- }
-
- @Override
- public String[] aliases() {
- String[] prefixedAliases = new String[o.aliases().length];
- for (int i = 0; i < prefixedAliases.length; i++) {
- prefixedAliases[i] = getPrefixedName(prefix, o.aliases()[i]);
- }
- return prefixedAliases;
- }
-
- @Override
- public String usage() {
- return o.usage();
- }
-
- @Override
- public String metaVar() {
- return o.metaVar();
- }
-
- @Override
- public boolean required() {
- return o.required();
- }
-
- @Override
- public boolean hidden() {
- return o.hidden();
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Class<? extends OptionHandler> handler() {
- return o.handler();
- }
-
- @Override
- public String[] depends() {
- return o.depends();
- }
-
- @Override
- public String[] forbids() {
- return null;
- }
-
- @Override
- public boolean help() {
- return false;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return o.annotationType();
- }
-
- private static String getPrefixedName(String prefix, String name) {
- return prefix + name;
- }
+ private static Option newPrefixedOption(String prefix, Option o) {
+ requireNonNull(prefix);
+ checkArgument(o.name().startsWith("-"), "Option name must start with '-': %s", o);
+ String[] aliases = Arrays.stream(o.aliases()).map(prefix::concat).toArray(String[]::new);
+ return OptionUtil.newOption(
+ prefix + o.name(),
+ aliases,
+ o.usage(),
+ o.metaVar(),
+ o.required(),
+ false,
+ o.hidden(),
+ o.handler(),
+ o.depends(),
+ new String[0]);
}
public class MyParser extends org.kohsuke.args4j.CmdLineParser {
+ boolean help;
+
@SuppressWarnings("rawtypes")
private List<OptionHandler> optionsList;
private Map<String, QueuedOption> queuedOptionsByName = new LinkedHashMap<>();
- private HelpOption help;
private class QueuedOption {
public final Option option;
@@ -569,7 +510,7 @@
Option o = m.getAnnotation(Option.class);
if (o != null) {
queueOption(
- new PrefixedOption(prefix, o),
+ newPrefixedOption(prefix, o),
new MethodSetter(this, bean, m),
m.getAnnotation(RequiresOptions.class));
}
@@ -578,7 +519,7 @@
Option o = f.getAnnotation(Option.class);
if (o != null) {
queueOption(
- new PrefixedOption(prefix, o),
+ newPrefixedOption(prefix, o),
Setters.create(f, bean),
f.getAnnotation(RequiresOptions.class));
}
@@ -668,12 +609,33 @@
private void ensureOptionsInitialized() {
if (optionsList == null) {
- help = new HelpOption();
optionsList = new ArrayList<>();
- addOption(help, help);
+ addOption(newHelpSetter(), newHelpOption());
}
}
+ private Setter<?> newHelpSetter() {
+ try {
+ return Setters.create(getClass().getDeclaredField("help"), this);
+ } catch (NoSuchFieldException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private Option newHelpOption() {
+ return OptionUtil.newOption(
+ "--help",
+ new String[] {"-h"},
+ "display this help text",
+ "",
+ false,
+ false,
+ false,
+ BooleanOptionHandler.class,
+ new String[0],
+ new String[0]);
+ }
+
private boolean isHandlerSpecified(OptionDef option) {
return option.handler() != OptionHandler.class;
}
@@ -687,90 +649,6 @@
}
}
- private static class HelpOption implements Option, Setter<Boolean> {
- private boolean value;
-
- @Override
- public String name() {
- return "--help";
- }
-
- @Override
- public String[] aliases() {
- return new String[] {"-h"};
- }
-
- @Override
- public String[] depends() {
- return new String[] {};
- }
-
- @Override
- public boolean hidden() {
- return false;
- }
-
- @Override
- public String usage() {
- return "display this help text";
- }
-
- @Override
- public void addValue(Boolean val) {
- value = val;
- }
-
- @Override
- public Class<? extends OptionHandler<Boolean>> handler() {
- return BooleanOptionHandler.class;
- }
-
- @Override
- public String metaVar() {
- return "";
- }
-
- @Override
- public boolean required() {
- return false;
- }
-
- @Override
- public Class<? extends Annotation> annotationType() {
- return Option.class;
- }
-
- @Override
- public FieldSetter asFieldSetter() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public AnnotatedElement asAnnotatedElement() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Class<Boolean> getType() {
- return Boolean.class;
- }
-
- @Override
- public boolean isMultiValued() {
- return false;
- }
-
- @Override
- public String[] forbids() {
- return null;
- }
-
- @Override
- public boolean help() {
- return false;
- }
- }
-
public CmdLineException reject(String message) {
return new CmdLineException(parser, localizable(message));
}
diff --git a/java/com/google/gerrit/util/cli/OptionUtil.java b/java/com/google/gerrit/util/cli/OptionUtil.java
new file mode 100644
index 0000000..1125a0d
--- /dev/null
+++ b/java/com/google/gerrit/util/cli/OptionUtil.java
@@ -0,0 +1,39 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.util.cli;
+
+import com.google.auto.value.AutoAnnotation;
+import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.OptionHandler;
+
+/** Utilities to support creating new {@link Option} instances. */
+public class OptionUtil {
+ @AutoAnnotation
+ @SuppressWarnings("rawtypes")
+ public static Option newOption(
+ String name,
+ String[] aliases,
+ String usage,
+ String metaVar,
+ boolean required,
+ boolean help,
+ boolean hidden,
+ Class<? extends OptionHandler> handler,
+ String[] depends,
+ String[] forbids) {
+ return new AutoAnnotation_OptionUtil_newOption(
+ name, aliases, usage, metaVar, required, help, hidden, handler, depends, forbids);
+ }
+}