public static void checkIsSpec(Class<?> clazz) {
    if (isSpec(clazz)) return;

    if (Specification.class.isAssignableFrom(clazz))
      throw new InvalidSpecException(
"Specification '%s' was not compiled properly (Spock AST transform was not run); try to do a clean build"
      ).withArgs(clazz.getName());

    throw new InvalidSpecException(
"Class '%s' is not a Spock specification (does not extend spock.lang.Specification or a subclass thereof)"
    ).withArgs(clazz.getName());
  }
Checks if the given class is a Spock specification (according to <tt>isSpec()</tt>),
and throws an <tt>InvalidSpecException</tt> with a detailed explanation if it is not.
spock-core/src/main/java/org/spockframework/runtime/SpecUtil.java