private ClassNode getPlainReference(ClassNode type) {
    // https://issues.apache.org/jira/browse/GROOVY-10403
    // needed for groovy-4 compatibility
    if (GET_PLAIN_NODE_REFERENCE != null) {
      try {
        return (ClassNode) GET_PLAIN_NODE_REFERENCE.invoke(type, false);
      } catch (IllegalAccessException | InvocationTargetException e) {
        throw new SpockException("Could not create plain reference");
      }
    }
    return type;
  }
A Spec visitor responsible for most of the rewriting of a Spec's AST.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java