code: public static boolean isLegalRoleName(String role) {
          return role != null &&
                  role.length() > 0 && role.length() <= 255 &&
                  ROLE_NAME_ALLOWED.matchesAllOf(role);
      }
docs: Role names mostly follow the same conventions as table names except, since they are only used internally, are
  slightly more permissive, such as allowing capital letters.