docs: @SuppressWarnings("unchecked")
      private static <T> T getCachedReference(Project project, String key, Supplier<T> supplier) {
          if (project == null) {
              throw new IllegalArgumentException("Gradle project reference cannot be null.");
          }
  
          Project rootProject = project.getRootProject();
          ExtraPropertiesExtension ext = rootProject.getExtensions().getExtraProperties();
          T value;
          if (ext.has(key)) {
              value = (T) ext.get(key);
          } else {
              value = supplier.get();
              ext.set(key, value);
          }
          return value;
      }