class ProtobufUtil {

  static void checkProto2Syntax(Class<? extends Message> clazz, ExtensionRegistry registry) {
    for (GenericDescriptor d : getRecursiveDescriptorsForClass(clazz, registry)) {
      Syntax s = d.getFile().getSyntax();
      checkArgument(
          s == Syntax.PROTO2,
          "Message %s or one of its dependencies does not use proto2 syntax: %s in file %s",
          clazz.getName(),
          d.getFullName(),
          d.getFile().getName());
    }
  }

  private  ProtobufUtil();

}