code: public static int getFeatureCount(Class<?> spec) {
      checkIsSpec(spec);
  
      int count = 0;
  
      do {
        for (Method method : spec.getDeclaredMethods())
          if (method.isAnnotationPresent(FeatureMetadata.class))
            count++;
        spec = spec.getSuperclass();
      } while (spec != null && isSpec(spec));
  
      return count;
    }
docs: Returns the number of features contained in the given specification.
  Because Spock allows for the dynamic creation of new features at
  specification run time, this number is only an estimate.