Class JavaDiagnosticReader

java.lang.Object
org.checkerframework.framework.test.diagnostics.JavaDiagnosticReader
All Implemented Interfaces:
Closeable, AutoCloseable, Iterator<TestDiagnosticLine>

public class JavaDiagnosticReader extends Object implements Iterator<TestDiagnosticLine>, Closeable
This class reads expected javac diagnostics from a single file. Its implementation is as an iterator over TestDiagnosticLine. However, clients should call the static methods: readJavaSourceFiles(java.lang.Iterable<? extends java.lang.Object>) reads diagnostics from multiple Java source files, and readDiagnosticFiles(java.lang.Iterable<? extends java.io.File>) reads diagnostics from multiple "diagnostic files".
  • Method Details

    • readJavaSourceFiles

      public static List<TestDiagnostic> readJavaSourceFiles(Iterable<? extends Object> files)
      Returns all the diagnostics in any of the Java source files.
      Parameters:
      files - the Java files to read; each is a File or a JavaFileObject
      Returns:
      the TestDiagnostics from the input file
    • readDiagnosticFiles

      public static List<TestDiagnostic> readDiagnosticFiles(Iterable<? extends File> files)
      Reads diagnostics line-by-line from the input diagnostic files.
      Parameters:
      files - a set of diagnostic files
      Returns:
      the TestDiagnosticLines from the input files
    • hasNext

      @Pure public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<TestDiagnosticLine>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<TestDiagnosticLine>
    • next

      public TestDiagnosticLine next()
      Specified by:
      next in interface Iterator<TestDiagnosticLine>
    • advance

      @RequiresNonNull("reader") protected void advance(@UnknownInitialization JavaDiagnosticReader this) throws IOException
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable