static EnumSet parse()

in src/main/java/org/apache/maven/plugin/compiler/IncrementalBuild.java [169:199]


        static EnumSet<Aspect> parse(final String values) {
            var aspects = EnumSet.noneOf(Aspect.class);
            for (String value : values.split(",")) {
                value = value.trim();
                try {
                    aspects.add(valueOf(value.toUpperCase(Locale.US).replace('-', '_')));
                } catch (IllegalArgumentException e) {
                    var sb = new StringBuilder(256)
                            .append("Illegal incremental build setting: \"")
                            .append(value);
                    String s = "\". Valid values are ";
                    for (Aspect aspect : values()) {
                        sb.append(s).append(aspect);
                        s = ", ";
                    }
                    throw new CompilationFailureException(sb.append('.').toString(), e);
                }
            }
            for (Aspect aspect : aspects) {
                for (Aspect exclude : aspect.excludes) {
                    if (aspects.contains(exclude)) {
                        throw new CompilationFailureException("Illegal incremental build setting: \"" + aspect
                                + "\" and \"" + exclude + "\" are mutually exclusive.");
                    }
                }
            }
            if (aspects.isEmpty()) {
                throw new CompilationFailureException("Incremental build setting cannot be empty.");
            }
            return aspects;
        }