private void buildFeatures() {
    for (Method method : clazz.getDeclaredMethods()) {
      FeatureMetadata metadata = method.getAnnotation(FeatureMetadata.class);
      if (metadata == null) continue;
      method.setAccessible(true);
      spec.addFeature(createFeature(method, metadata));
    }

    spec.getFeatures().sort(comparingInt(FeatureInfo::getDeclarationOrder));
  }
Builds a SpecInfo from a Class instance.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java