public boolean isInteraction(ExpressionStatement stat) throws InvalidSpecCompileException {
    if (scanResult != null) {
      if (stat != this.stat) {
        throw new InvalidSpecCompileException(stat, "InteractionRewriter was reused");
      }
      return scanResult;
    }

    this.stat = stat;

    Expression expr = parseCount(parseResults(stat.getExpression()));
    boolean interaction = (count != null || !responses.isEmpty()) && parseCall(expr);
    if (interaction && resources.getCurrentMethod().getAst().isStatic()) {
      throw new InvalidSpecCompileException(stat, "Interactions cannot be declared in static scope");
    }

    return scanResult = interaction;
  }
If the given statement is a valid interaction definition, returns the rewritten statement.
If the given statement is not an interaction definition, returns null.
If the given statement is an invalid interaction definition, records a compile error
and returns null.
spock-core/src/main/java/org/spockframework/compiler/InteractionRewriter.java