docs: @SuppressWarnings({"unchecked"})
      public synchronized <T extends TopLevelItem> T copy(T src, String name) throws IOException {
          acl.checkPermission(Item.CREATE);
          src.checkPermission(Item.EXTENDED_READ);
          XmlFile srcConfigFile = Items.getConfigFile(src);
          if (!src.hasPermission(Item.CONFIGURE)) {
              Matcher matcher = AbstractItem.SECRET_PATTERN.matcher(srcConfigFile.asString());
              while (matcher.find()) {
                  if (Secret.decrypt(matcher.group(1)) != null) {
                      // AccessDeniedException2 does not permit a custom message, and anyway redirecting the user to the login screen is obviously pointless.
                      throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name));
                  }
              }
          }
          src.getDescriptor().checkApplicableIn(parent);
          acl.getACL().checkCreatePermission(parent, src.getDescriptor());
          ItemListener.checkBeforeCopy(src, parent);
  
          T result = (T)createProject(src.getDescriptor(),name,false);
  
          // copy config
          Files.copy(Util.fileToPath(srcConfigFile.getFile()), Util.fileToPath(Items.getConfigFile(result).getFile()),
                  StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
  
          // reload from the new config
          final File rootDir = result.getRootDir();
          result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<T,IOException>() {
              @Override public T call() throws IOException {
                  return (T) Items.load(parent, rootDir);
              }
          });
          result.onCopiedFrom(src);
  
          add(result);
          ItemListener.fireOnCopied(src,result);
          Jenkins.getInstance().rebuildDependencyGraphAsync();
  
          return result;
      }