Class ImmutableTestConfiguration

  • All Implemented Interfaces:
    TestConfiguration

    public class ImmutableTestConfiguration
    extends java.lang.Object
    implements TestConfiguration
    Represents all of the information needed to execute the Javac compiler for a given set of test files.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableTestConfiguration​(java.util.List<java.io.File> diagnosticFiles, java.util.List<java.io.File> testSourceFiles, java.util.List<@BinaryName java.lang.String> processors, java.util.Map<java.lang.String,​@Nullable java.lang.String> options, boolean shouldEmitDebugInfo)
      Create a new ImmutableTestConfiguration.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.io.File> getDiagnosticFiles()
      Diagnostic files consist of a set of lines that enumerate expected error/warning diagnostics.
      java.util.List<java.lang.String> getFlatOptions()
      Returns the map returned by TestConfiguration.getOptions(), flattened into a list.
      java.util.Map<java.lang.String,​@Nullable java.lang.String> getOptions()
      Some Javac command line arguments require arguments themselves (e.g.
      java.util.List<@BinaryName java.lang.String> getProcessors()
      Returns a list of annotation processors (Checkers) passed to the Javac compiler.
      java.util.List<java.io.File> getTestSourceFiles()
      Returns a list of source files a CheckerFrameworkPerDirectoryTest should be run over.
      boolean shouldEmitDebugInfo()
      Returns true if the TypecheckExecutor should emit debug information on system out, false otherwise.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ImmutableTestConfiguration

        public ImmutableTestConfiguration​(java.util.List<java.io.File> diagnosticFiles,
                                          java.util.List<java.io.File> testSourceFiles,
                                          java.util.List<@BinaryName java.lang.String> processors,
                                          java.util.Map<java.lang.String,​@Nullable java.lang.String> options,
                                          boolean shouldEmitDebugInfo)
        Create a new ImmutableTestConfiguration.
        Parameters:
        diagnosticFiles - files containing diagnostics that should be returned by javac
        testSourceFiles - the source files to compile
        processors - the annotation processors (usually checkers) to run
        options - options that should be passed to the compiler
        shouldEmitDebugInfo - the value of system property "emit.test.debug"
    • Method Detail

      • getTestSourceFiles

        public java.util.List<java.io.File> getTestSourceFiles()
        Description copied from interface: TestConfiguration
        Returns a list of source files a CheckerFrameworkPerDirectoryTest should be run over. These source files will be passed to Javac when the test is run. These are NOT JUnit tests.
        Specified by:
        getTestSourceFiles in interface TestConfiguration
        Returns:
        a list of source files a CheckerFrameworkPerDirectoryTest should be run over
      • getDiagnosticFiles

        public java.util.List<java.io.File> getDiagnosticFiles()
        Description copied from interface: TestConfiguration
        Diagnostic files consist of a set of lines that enumerate expected error/warning diagnostics. The lines are of the form:
        fileName:lineNumber: diagnostKind: (messageKey)
        e.g.,
        MethodInvocation.java:17: error: (method.invocation.invalid)
        If getDiagnosticFiles does NOT return an empty list, then the only diagnostics expected by the TestExecutor will be the ones found in these files. If it does return an empty list, then the only diagnostics expected will be the ones found in comments in the input test files.

        It is preferred that users write the errors in the test files and not in diagnostic files.

        Specified by:
        getDiagnosticFiles in interface TestConfiguration
        Returns:
        a List of diagnostic files containing the error/warning messages expected to be output when Javac is run on the files returned by getTestSourceFiles. Return an empty list if these messages were specified within the source files.
      • getProcessors

        public java.util.List<@BinaryName java.lang.String> getProcessors()
        Description copied from interface: TestConfiguration
        Returns a list of annotation processors (Checkers) passed to the Javac compiler.
        Specified by:
        getProcessors in interface TestConfiguration
        Returns:
        a list of annotation processors (Checkers) passed to the Javac compiler
      • getOptions

        public java.util.Map<java.lang.String,​@Nullable java.lang.String> getOptions()
        Description copied from interface: TestConfiguration
        Some Javac command line arguments require arguments themselves (e.g. -classpath takes a path) getOptions returns a Map(optionName => optionArgumentIfAny). If an option does not take an argument, pass null as the value.

        E.g.,

        
         Map(
             "-AprintAllQualifiers" => null
             "-classpath" => "myDir1:myDir2"
         )
         
        Specified by:
        getOptions in interface TestConfiguration
        Returns:
        a Map representing all command-line options to Javac other than source files and processors
      • shouldEmitDebugInfo

        public boolean shouldEmitDebugInfo()
        Description copied from interface: TestConfiguration
        Returns true if the TypecheckExecutor should emit debug information on system out, false otherwise.
        Specified by:
        shouldEmitDebugInfo in interface TestConfiguration
        Returns:
        true if the TypecheckExecutor should emit debug information on system out, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object