public void load(File sourceFile) throws CompilationFailedException {
    reset();

    try {
      classLoader.parseClass(sourceFile);
    } catch (IOException e) {
      throw new AstInspectorException("cannot read source file", e);
    } catch (AstSuccessfullyCaptured e) {
      indexAstNodes();
      return;
    }

    throw new AstInspectorException("internal error");
  }
Compiles the source text in the specified file up to the
configured compile phase and stores the resulting AST for subsequent
inspection.

@param sourceFile the file containing the source text to compile
@throws CompilationFailedException if an error occurs during compilation
@throws AstInspectorException if an IOException occurs when reading from
the file
spock-core/src/main/java/org/spockframework/util/inspector/AstInspector.java