Interface SourceInfo

All Superinterfaces:
Serializable
All Known Implementing Classes:
FileSourceInfo, StringSourceInfo

public interface SourceInfo extends Serializable
This interface represents the source code folder of a submission.
  • Method Details

    • compilationUnits

      List<CompilationUnit> compilationUnits() throws IOException
      Returns the compilation units of the source.

      All compilation units must be relative to the root of the source returned by path().

      Returns:
      the compilation units of the source or an empty list if there are none
      Throws:
      IOException - if the compilation units could not be read
    • copyTo

      SourceInfo copyTo(Path target) throws IOException
      Copies the source to the given target directory.
      Parameters:
      target - the target directory, which must be accessible
      Returns:
      a new SourceInfo representing the copied source
      Throws:
      IOException - if the copy failed
    • getSpoonResource

      spoon.compiler.SpoonResource getSpoonResource()
    • getName

      default String getName()
      A name representing the source. This must not represent the real name of the source file or a path.
      Returns:
      the name of the source, which must not be unique
    • getCompilationUnit

      default CompilationUnit getCompilationUnit(SourcePath path)
    • getCompilationUnit

      default CompilationUnit getCompilationUnit(Path path)
    • getCompilationUnit

      default CompilationUnit getCompilationUnit(URI uri)
    • path

      Path path()
      Returns a path to the source, which might not exist on the file-system.

      For example, one could have the entire code in memory, so there would be no path on the file-system.

      Returns:
      a path to the source
    • getVersion

      JavaVersion getVersion()
      Returns the java version required to compile the source.
      Returns:
      the java version required to compile the source