code: static void validateValueUniquenessInScope(String qualifiedName,
        List<TypeElement> nestedElements) {
      Set<String> names = new LinkedHashSet<>();
      for (TypeElement nestedElement : nestedElements) {
        if (nestedElement instanceof EnumElement) {
          EnumElement enumElement = (EnumElement) nestedElement;
          for (EnumConstantElement constant : enumElement.constants()) {
            String name = constant.name();
            if (!names.add(name)) {
              throw new IllegalStateException(
                  "Duplicate enum constant " + name + " in scope " + qualifiedName);
            }
          }
        }
      }
    }
docs: Though not mentioned in the spec, enum names use C++ scoping rules, meaning that enum constants
  are siblings of their declaring element, not children of it.