diff --git a/config/suppressions.xml b/config/suppressions.xml
index 668a78347..3e57c3205 100644
--- a/config/suppressions.xml
+++ b/config/suppressions.xml
@@ -109,7 +109,7 @@
-
+
Aleksey Nesterenko
*/
public class ImportOrderCheck
- extends AbstractOptionCheck {
+ extends Check {
/**
* A key is pointing to the warning message text in "messages.properties"
@@ -217,11 +220,31 @@ public class ImportOrderCheck
/** Whether static imports should be sorted alphabetically or not. */
private boolean sortStaticImportsAlphabetically;
+ /** The policy to enforce. */
+ private ImportOrderOption option = ImportOrderOption.UNDER;
+
/**
- * Groups static imports under each group.
+ * Set the option to enforce.
+ * @param optionStr string to decode option from
+ * @throws ConversionException if unable to decode
*/
- public ImportOrderCheck() {
- super(ImportOrderOption.UNDER, ImportOrderOption.class);
+ public void setOption(String optionStr) {
+ try {
+ option = ImportOrderOption.valueOf(optionStr.trim().toUpperCase(Locale.ENGLISH));
+ }
+ catch (IllegalArgumentException iae) {
+ throw new ConversionException("unable to parse " + optionStr, iae);
+ }
+ }
+
+ /**
+ * Gets option set.
+ * @return the {@code option} set
+ */
+ public ImportOrderOption getAbstractOption() {
+ // WARNING!! Do not rename this method to getOption(). It breaks
+ // BeanUtils, which will silently not call setOption. Very annoying!
+ return option;
}
/**