private void moveSharedFieldInitializer(Field field) {
    if (field.getAst().getInitialValueExpression() != null) {
      moveInitializer(field, getSharedInitializerMethod(), sharedFieldInitializerCount++);
    } else if (field.getAst().isFinal()) {
      errorReporter.error(field.getAst(),
              "@Shared final field '%s' is not initialized.",
              field.getName());
    }
  }
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