PermissionParser extends Parser<T> { protected void check(T type, Permission permission) { String name = permission.value(); checkMalformed(type, permission); if (Set.of(permission.children()).contains(name)) { environment.warn(type, format(name, "inherits itself")); } if (!names.add(name)) { environment.error(type, format(name, "already exists")); } } PermissionParser(Environment<T> environment); @Override void clear();  }
@Test void check_warn() { parser.names.add("a.b"); parser.check(Warnings.class, Warnings.class.getAnnotation(Permission.class)); verify(environment).warn(Warnings.class, "\"a.b\" inherits itself"); verify(environment).error(Warnings.class, "\"a.b\" already exists"); }