1 package com.uber.nullaway.jdk17; 2 3 import com.google.errorprone.CompilationTestHelper; 4 import com.uber.nullaway.NullAway; 5 import java.util.Arrays; 6 import org.junit.Before; 7 import org.junit.Rule; 8 import org.junit.Test; 9 import org.junit.rules.TemporaryFolder; 10 11 public class NullAwayModuleInfoTests { 12 13 @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); 14 15 private CompilationTestHelper defaultCompilationHelper; 16 17 @Before setup()18 public void setup() { 19 defaultCompilationHelper = 20 CompilationTestHelper.newInstance(NullAway.class, getClass()) 21 .setArgs( 22 Arrays.asList( 23 "-d", 24 temporaryFolder.getRoot().getAbsolutePath(), 25 // The module path system property is set in the build.gradle file to just 26 // include the jar for the Checker Framework qualifier annotations 27 "--module-path", 28 System.getProperty("test.module.path"), 29 "-XepOpt:NullAway:AnnotatedPackages=com.uber")); 30 } 31 32 @Test testModuleInfo()33 public void testModuleInfo() { 34 // just check that the tool doesn't crash 35 defaultCompilationHelper 36 .addSourceLines( 37 "module-info.java", 38 "module com.uber.mymodule {", 39 " // Important: two-level deep module tests matching of identifier `java` as base expression;", 40 " // see further discussion at https://github.com/uber/NullAway/pull/544#discussion_r780829467", 41 " requires java.base;", 42 " requires static org.checkerframework.checker.qual;", 43 "}") 44 .doTest(); 45 } 46 } 47