Class NullnessBinaryStubDiffTest

java.lang.Object
org.checkerframework.framework.test.CheckerFrameworkPerDirectoryTest
org.checkerframework.checker.test.junit.NullnessBinaryStubDiffTest

public class NullnessBinaryStubDiffTest extends CheckerFrameworkPerDirectoryTest
Differential test for the binary stub format: verifies that loading the annotated JDK from annotated-jdk.bin.gz and the built-in checker stub files from their .astub.bin.gz forms (via BinaryStubReader) produces exactly the same annotations as parsing the text stubs (via AnnotationFileParser), for every class in each binary stub.

The -AbinaryStubDiffCheck option makes AnnotationFileElementTypes run BinaryStubDiffChecker at initialization, which reports each disagreement between the two paths as an error; this test expects no diagnostics. A failure here means BinaryStubWriter or BinaryStubReader diverges from the text parser's semantics for some construct in the stubs — the binary path would silently drop or alter annotations for every user.

The Nullness Checker is used as the host checker because it exercises four annotated type factories and the largest set of JDK annotations. The JDK check runs once per compilation; built-in stub files are checked by each stub-types factory that loads them.

  • Constructor Details

    • NullnessBinaryStubDiffTest

      public NullnessBinaryStubDiffTest(List<File> testFiles)
      Create a NullnessBinaryStubDiffTest.
      Parameters:
      testFiles - the files containing test code, which will be type-checked
  • Method Details

    • getTestDirs

      public static String[] getTestDirs()
      Returns the test directories.
      Returns:
      the test directories
    • resolveTestDirectory

      protected File resolveTestDirectory()
      Resolves the test root directory from the optional TestRootDirectory annotation or falls back to the default of currentDir/tests.
      Returns:
      the resolved directory
    • checkResult

      public void checkResult(TypecheckResult typecheckResult)
      Check that the TypecheckResult did not fail.
      Parameters:
      typecheckResult - result to check