docs: private RepositoryResource getNewerResource(RepositoryResource res1, RepositoryResource res2) throws RepositoryResourceValidationException {
  
          // if one of the resources is beta and the other not, return the non-beta one
          RepositoryResource singleNonBetaResource = returnNonBetaResourceOrNull(res1, res2);
          if (singleNonBetaResource != null) {
              return singleNonBetaResource;
          }
  
          if (res1.getType() == ResourceType.INSTALL) {
  
              // have two String versions .. convert them into Version objects,checking that they are valid versions in the process
              Version4Digit res1Version = null;
              Version4Digit res2Version = null;
  
              try {
                  res1Version = new Version4Digit(((ProductResourceWritable) res1).getProductVersion());
              } catch (IllegalArgumentException iae) {
                  // the version was not a proper osgi version
                  throw new RepositoryResourceValidationException("The product version was invalid: " + res1Version, res1.getId(), iae);
              }
  
              try {
                  res2Version = new Version4Digit(((ProductResourceWritable) res2).getProductVersion());
              } catch (IllegalArgumentException iae) {
                  // the version was not a proper osgi version
                  throw new RepositoryResourceValidationException("The product version was invalid: " + res2Version, res2.getId(), iae);
              }
  
              if (res1Version.compareTo(res2Version) > 0) {
                  return res1;
              } else {
                  return res2;
              }
  
          } else if (res1.getType() == ResourceType.TOOL) {
              // tools don't have product versions or applies to so just return res1
              return res1;
          } else {
              return compareNonProductResourceAppliesTo(res1, res2);
          }
      }