Package cs1302.tracer

Record Class CompilationHelper.CompilationResult

java.lang.Object
java.lang.Record
cs1302.tracer.CompilationHelper.CompilationResult
Record Components:
classPath - Root of the class path where compiled classes were output.
compiledClassNames - Binary names of the classes that were compiled.
mainClass - Binary name of the class that contains the main method.
sourceRoot - The source root used during compilation, if any.
previewEnabled - True if preview features were enabled during compilation.
All Implemented Interfaces:
AutoCloseable
Enclosing class:
CompilationHelper

public static record CompilationHelper.CompilationResult(Path classPath, Set<String> compiledClassNames, String mainClass, Optional<Path> sourceRoot, boolean previewEnabled) extends Record implements AutoCloseable
A collection of information from the successful compilation of a Java program.
  • Constructor Details

    • CompilationResult

      public CompilationResult(Path classPath, Set<String> compiledClassNames, String mainClass, Optional<Path> sourceRoot)
      Constructs a CompilationResult with an explicit source root.
      Parameters:
      classPath - Class output path.
      compiledClassNames - Set of compiled class names.
      mainClass - Main entry class name.
      sourceRoot - Source root path.
    • CompilationResult

      public CompilationResult(Path classPath, Set<String> compiledClassNames, String mainClass)
      Constructs a CompilationResult without an explicit source root.
      Parameters:
      classPath - Class output path.
      compiledClassNames - Set of compiled class names.
      mainClass - Main entry class name.
    • CompilationResult

      public CompilationResult(Path classPath, Set<String> compiledClassNames, String mainClass, Optional<Path> sourceRoot, boolean previewEnabled)
      Creates an instance of a CompilationResult record class.
      Parameters:
      classPath - the value for the classPath record component
      compiledClassNames - the value for the compiledClassNames record component
      mainClass - the value for the mainClass record component
      sourceRoot - the value for the sourceRoot record component
      previewEnabled - the value for the previewEnabled record component
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • classPath

      public Path classPath()
      Returns the value of the classPath record component.
      Returns:
      the value of the classPath record component
    • compiledClassNames

      public Set<String> compiledClassNames()
      Returns the value of the compiledClassNames record component.
      Returns:
      the value of the compiledClassNames record component
    • mainClass

      public String mainClass()
      Returns the value of the mainClass record component.
      Returns:
      the value of the mainClass record component
    • sourceRoot

      public Optional<Path> sourceRoot()
      Returns the value of the sourceRoot record component.
      Returns:
      the value of the sourceRoot record component
    • previewEnabled

      public boolean previewEnabled()
      Returns the value of the previewEnabled record component.
      Returns:
      the value of the previewEnabled record component